CLI
CLI Reference
Complete reference for the AFA command-line interface.
CLI Reference
The afa CLI is the primary developer interface for code analysis and enhancement.
Global flags
These flags apply to all commands:
| Flag | Values | Default | Description |
|---|---|---|---|
--format | table, json, sarif | table | Output format |
--provider | anthropic, openai, gemini | anthropic | LLM provider |
--config | path | .afa.yaml | Config file path |
Commands
| Command | Description |
|---|---|
analyze | Analyze functions for security, performance, maintainability, documentation |
enhance | Generate and validate enhancement candidates |
halt | Stop all in-flight enhancements (kill switch) |
status | Show current AFA status and configuration |
history | Query the audit trail |
explain | Explain a specific enhancement decision |
config | View or set configuration values |
serve | Start the MCP server or REST API |
Quick examples
# Analyze a directory
afa analyze src/
# Analyze with JSON output using Gemini
afa --format json --provider gemini analyze src/
# Dry-run enhancement
afa enhance src/ --dry-run
# Stop everything
afa halt
# Show last 10 audit records
afa history --last 10
# Explain why an enhancement was rejected
afa explain <enhancement-id>
# Set a config value
afa config gates.entropy_floor 0.30
# Start the REST API server
afa serve --transport http --port 8080
# Start the MCP server for IDE integration
afa serve --transport stdio