Files
ai-context-generator-cli/.ai-context-generator-cli/CLI.md
7000pctAUTO ea8e70a0ca
Some checks failed
CI / test (push) Failing after 5s
fix: resolve CI test failures
2026-02-01 01:42:29 +00:00

4.4 KiB

CLI Command Reference

Quick Reference

ai-context [options]

Global Options

Option Type Default Description
--dir string process.cwd() Project directory to analyze
--output string ai-context Output file path (without extension)
--format string json Output format: json or yaml
--template string default Template: default, cursor, copilot, generic
--config string auto-detected Config file path
--verbose boolean false Enable verbose output
--no-conventions boolean false Skip convention analysis
--include-dev boolean false Include dev dependencies
--no-gitignore boolean false Do not respect .gitignore

Detailed Options

--dir, -d

Specifies the project directory to analyze.

ai-context --dir /path/to/project
ai-context -d ./my-project

If not specified, uses the current working directory.

--output, -o

Specifies the output file path. The file extension is automatically added based on the format.

ai-context --output my-context
# Creates my-context.json or my-context.yaml

ai-context --output /absolute/path/output
# Creates /absolute/path/output.json

--format, -f

Specifies the output format.

# JSON output (default)
ai-context --format json

# YAML output
ai-context --format yaml

--template, -t

Specifies the template for context output.

# Default template
ai-context --template default

# Cursor-optimized template
ai-context --template cursor

# Copilot-optimized template
ai-context --template copilot

# Generic template
ai-context --template generic

--config, -c

Specifies a custom config file path.

ai-context --config /path/to/config.json
ai-context -c ./custom-config.json

If not specified, automatically looks for .ai-context-config.json in the project directory.

--verbose, -v

Enables verbose output for debugging.

ai-context --verbose
ai-context -v

Output includes:

  • Analyzed directory
  • Output file path
  • Format and template selection
  • Analysis progress

--no-conventions

Skips convention analysis for faster processing.

ai-context --no-conventions

--include-dev

Includes development dependencies in the analysis.

ai-context --include-dev

--no-gitignore

Disables .gitignore pattern matching.

ai-context --no-gitignore

Exit Codes

Code Description
0 Success
1 Error (see error message for details)

Examples

Basic Analysis

# Analyze current directory
ai-context

# Analyze specific directory with verbose output
ai-context --dir ./my-project --verbose

# Generate YAML output
ai-context --format yaml --output project-context

Custom Output

# Custom output file name
ai-context --output my-ai-context

# Different format
ai-context --format yaml --output context

# Use specific template
ai-context --template cursor --output cursor-context

Advanced Options

# Full analysis with all options
ai-context --dir ./project --verbose --include-dev

# Skip conventions for speed
ai-context --no-conventions --output quick-context

# Ignore gitignore
ai-context --no-gitignore --output all-files-context

Combined Options

# Analyze Python project with conventions
ai-context --dir ./python-app --format yaml --no-conventions

# Analyze with dev dependencies
ai-context --dir ./node-app --include-dev --template copilot

# Full verbose analysis
ai-context --dir ./full-stack-app --verbose --format json --include-dev --template cursor

Troubleshooting

Command Not Found

If ai-context is not found after installation:

# Re-link the CLI
npm unlink
npm link

# Or use npx
npx ai-context-generator-cli --dir ./project

Permission Denied

On Unix systems, you may need to make the script executable:

chmod +x dist/index.js

Or run with node directly:

node dist/index.js --dir ./project

Slow Analysis

For large projects, use:

# Skip conventions
ai-context --no-conventions

# Skip dev dependencies
ai-context --no-include-dev

# Limit file patterns
ai-context --dir ./project --format json

Environment Variables

Currently, the CLI does not use environment variables. All configuration is done via CLI options or config files.