A comprehensive command-line tool for both generating and viewing VTEX documentation navigation structures.
- π€ Intelligent Generation: Automatically generates navigation from VTEX Help Center content repository
- π― Simple Generation: Console-only generator focused on speed and clarity
- π Multi-language Support: Processes English, Spanish, and Portuguese content with proper localized slugs
- π Cross-language Linking: Automatically links related documents across languages
- π Smart Slug Generation: Prioritizes
legacySlug
β filename-based β empty string for missing translations - π Intelligent Duplicate Detection: Only warns about true duplicates (same section + language), not multilingual documents
- π Validation & Reports: Built-in validation with detailed reporting capabilities
- β‘ Performance Optimized: Simple mode offers ~13% better performance
- π³ Interactive Tree View: Navigate through the VTEX documentation structure with keyboard controls
- π Multi-language Support: Switch between English, Spanish, and Portuguese on the fly
- π Statistics: View detailed statistics about the documentation structure
- πΎ Auto-download: Automatically downloads the navigation file if not present locally
- β‘ Fast Navigation: Keyboard shortcuts for efficient browsing
npm install -g vtexhelp-nav-cli
Or run directly with npx:
npx vtexhelp-nav-cli
Note: The executable name is vtex-nav (alias: vtexhelp-nav-cli).
The CLI currently provides a simple, console-only generation command:
# Generate navigation with clean console output
vtexhelp-nav gen
# Generate with custom options
vtexhelp-nav gen --output custom-nav.json --verbose --force
# Generate specific languages only
vtexhelp-nav gen --languages en,es --report
Options:
-d, --content-dir <dir> Directory to clone/use content from (default: ".vtexhelp-content")
-o, --output <file> Output navigation.json file path (default: "generated-navigation.json")
--validate Validate against existing navigation schema (default: true)
--report Generate detailed report (default: false)
--fix Auto-fix common issues (default: false)
--strict Fail generation when validation errors are found (default: false)
-l, --languages <langs> Comma-separated languages to process (en,es,pt) (default: "en,es,pt")
-s, --sections <sections> Comma-separated sections to process (leave empty for all)
-v, --verbose Show detailed log lines in terminal (default: false)
-b, --branch <branch> Git branch to clone (default: "main")
-f, --force Force overwrite existing content directory (default: false)
--log-file <file> Export detailed logs to file
--show-warnings Display detailed analysis of all warnings (default: false)
Validate a navigation.json file (schema + custom cross-node checks):
# Validate and print issues (non-zero exit only if --strict)
vtex-nav validate ./public/navigation.json
# Fail the build if any errors are found
vtex-nav validate ./public/navigation.json --strict
Whatβs validated:
- Structural JSON Schema (Draft-07)
- name and slug are LocalizedString objects with en, es, pt keys
- Categories: type=category, children min 1
- Documents: type=markdown, children must be empty
- Additional properties are rejected for safety
- Custom rule: sibling categories under the same parent must have unique english slug (slug.en)
Notes:
- Empty strings are allowed in LocalizedString fields to indicate a missing translation. This keeps the structure consistent while signalling gaps.
# Run the interactive viewer (downloads navigation.json if not present)
vtex-nav view
# Use a specific navigation file
vtex-nav view --file ./custom-navigation.json
# Start in a specific language
vtex-nav view --language es
Options:
--file, -f Path to navigation.json file
--language, -l Language to use (en, es, pt) [default: en]
--help Show help
β/β
- Navigate up/down through itemsPgUp/PgDn
- Navigate faster (10 items at a time)Space
orEnter
- Expand/collapse current itema
- Toggle all items expanded/collapsed
e
- Switch to Englishs
- Switch to Spanishp
- Switch to Portuguese
h
or?
- Toggle help screeni
- Toggle statistics viewq
orEsc
- Quit the application
You can configure the tool using environment variables:
Create a .env
file in your project root:
# URL to fetch navigation.json from
VTEX_NAVIGATION_URL=https://newhelp.vtex.com/navigation.json
# Default output path for downloaded navigation
DEFAULT_OUTPUT_PATH=./navigation.json
# Auto-format JSON output
AUTO_FORMAT_JSON=true
# Request timeout in milliseconds
REQUEST_TIMEOUT=30000
# Clone the repository
git clone https://github.com/yourusername/vtexhelp-nav-cli.git
cd vtexhelp-nav-cli
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev
This project clones content repositories locally for generation. These folders are temporary, ignored by Git, and can be safely deleted at any time:
- .vtexhelp-content β VTEX Help Center content clone
- .vtexhelp-known-issues β Known issues repository clone used for categorization
If either folder is missing, the generator will fetch it automatically when needed.
vtexhelp-nav-cli/
βββ source/
β βββ app.tsx # Main viewer app component
β βββ cli.tsx # CLI entry point and command routing
β βββ NavigationTree.tsx # Interactive tree component
β βββ commands/
β β βββ generate-simple.tsx # Simple mode generation command
β β βββ generateCommand.ts # Command definitions and options
β β βββ generate/ # Generation system
β β βββ index.ts # Main generation orchestrator
β β βββ simple-generator.ts # Simple mode generator (Ink-free)
β β βββ scanner.ts # Content repository scanner
β β βββ categorizer.ts # Category hierarchy builder
β β βββ linker.ts # Cross-language document linker
β β βββ transformer.ts # Navigation format transformer
β β βββ external-repositories.ts # Handles cloning/using external content repos
β β βββ validator.ts # Navigation validation engine
β β βββ types.ts # Generation-specific types
β β βββ ui/ # Interactive UI components
β β βββ GenerationDashboard.tsx # Main dashboard
β β βββ ProgressBar.tsx # Progress visualization
β β βββ StatsPanel.tsx # Statistics display
β β βββ logger.ts # Dual-mode logger
β βββ types/
β β βββ navigation.ts # Core navigation types
β βββ services/
β β βββ navigationService.ts # Navigation data service
β βββ config/
β β βββ config.ts # Configuration management
β βββ utils/
β βββ validateSchema.ts # Schema validation utilities
βββ source/schemas/
β βββ navigation.schema.json # JSON schema for validation
βββ dist/ # Compiled TypeScript output
# 1. Generate navigation (perfect for CI/CD)
vtex-nav gen --verbose --report --output production-nav.json
# 2. Generate with custom branch and specific languages
vtex-nav gen --branch develop --languages en,pt --force
# 3. Validate generated file
vtex-nav view --file production-nav.json
# 1. Quick view with auto-download
vtex-nav view
# 2. Browse specific navigation file
vtex-nav view --file ./my-navigation.json --language es
# 3. Compare different navigation structures
vtex-nav view --file ./old-nav.json
vtex-nav view --file ./new-nav.json
# Generate fresh navigation
vtex-nav gen --verbose --report --output latest-nav.json
# Inspect and validate the structure
vtex-nav view --file latest-nav.json
# Generate detailed report for review
vtex-nav gen --report --log-file generation.log
LocalizedString
- Keys: en, es, pt
- Value: string (can be empty to indicate missing translation)
NavigationNode
- name: LocalizedString
- slug: LocalizedString
- type: "category" | "markdown"
- children: NavigationNode[]
- Rules:
- category: children.length >= 1
- markdown: children.length == 0
Merging and duplicates
- Categories across languages are merged by their English slug (slug.en), treating categories as localized entities.
- Within the same parent, sibling category english slugs must be unique; duplicates are flagged by validation.
- Simple mode (gen): console logging, optimized performance, clean output
- Designed for CI/CD and automation
- Use --verbose for detailed logs and --show-warnings for in-depth analysis
- No interactive generation mode is available at the moment
- Repository Initialization: Clones VTEX Help Center content
- Content Scanning: Parses markdown files across all languages
- Category Building: Constructs hierarchical category structure
- Cross-language Linking: Links related documents across languages
- Navigation Transformation: Converts to VTEX navigation format
- Validation: Ensures schema compliance and content integrity
- Output Generation: Writes navigation JSON and optional reports
- Node.js >= 16
- Terminal with UTF-8 support for proper character display
- Git (for content repository cloning)
- ~100MB disk space for content cache
MIT