AFAdocs
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:

FlagValuesDefaultDescription
--formattable, json, sariftableOutput format
--provideranthropic, openai, geminianthropicLLM provider
--configpath.afa.yamlConfig file path

Commands

CommandDescription
analyzeAnalyze functions for security, performance, maintainability, documentation
enhanceGenerate and validate enhancement candidates
haltStop all in-flight enhancements (kill switch)
statusShow current AFA status and configuration
historyQuery the audit trail
explainExplain a specific enhancement decision
configView or set configuration values
serveStart 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

On this page