Pular para o conteúdo

Visão Geral

The Gaio CLI is a command-line interface tool designed to streamline the setup and management of development environments for Gaio projects. It provides commands to automate environment setup, generate LLM documentation, and validate configurations.

After cloning the repository and running npm install, the CLI is automatically available:

Terminal window
npm install # Auto-setup CLI and development environment
gaio --help # See available commands
gaio status # Check current setup status

Setup the development environment and generate LLM documentation with intelligent validation.

Terminal window
gaio setup # Smart setup (skips if already configured)
gaio setup --force # Force complete re-setup
gaio setup --status # Show setup status only

Generate LLM documentation from the docs/ directory.

Terminal window
gaio llm

Show CLI setup status and configuration information.

Terminal window
gaio status

Show enhanced help information with examples.

Terminal window
gaio help

The CLI automatically detects the project structure:

  • Source: docs/ for LLM documentation
  • Entry Points: AGENTS.md and CLAUDE.md symbolic links
  • State: .gaio.json for setup validation (includes hash for docs change detection)
Terminal window
npm run build -w @gaio/cli # Build CLI from TypeScript
npm run build:watch -w @gaio/cli # Watch mode for development
Terminal window
npm run dev -w @gaio/cli # Run CLI in development with tsx
npm run dev:watch -w @gaio/cli # Development with hot reload
Terminal window
npm run test -w @gaio/cli # Run CLI tests
npm run test:commands -w @gaio/cli # Test all CLI commands
Terminal window
npm run typecheck -w @gaio/cli # TypeScript type checking
  1. Installation: npm install triggers postinstall script
  2. Setup Detection: Checks for existing setup state and files
  3. Project Root Finding: Intelligently locates monorepo root
  4. LLM Generation: Processes documentation files and creates entry points
  5. State Saving: Records successful setup for future validation
  • Use npm run dev -w @gaio/cli for development work
  • Run gaio setup after pulling major changes
  • Use gaio status to debug setup issues
  • Use --force flag only when necessary changes are made
  • Check docs/ directory structure if LLM generation fails
  • Use gaio setup --force in CI environments for consistency
  • Validate setup with gaio status before running commands
  • Cache .llm/ directory to speed up builds when possible
Terminal window
npm install --workspace=@gaio/cli # Reinstall CLI workspace
npm run build -w @gaio/cli # Rebuild from source
Terminal window
chmod +x tools/cli/bin/cli.js # Fix executable permissions
npm run build -w @gaio/cli # Rebuild with proper permissions
Terminal window
gaio status # Check setup status
gaio setup --force # Force complete re-setup
rm .gaio.json && gaio setup # Reset and re-setup
Terminal window
# Ensure you're in a valid Gaio project directory
ls package.json docs/ # Verify required files exist
gaio setup --force # Force re-detection