documentation/automation/cli-command-tracking/README.md
Automated pipeline for detecting and documenting CLI command changes between goose releases.
This automation keeps the CLI Commands Guide synchronized with code changes by:
--help output (deterministic)The automation runs automatically on new releases via GitHub Actions, or can be run manually for testing.
The automation runs automatically when a new release is published. See TESTING.md for testing instructions.
# Set the goose repository path
export GOOSE_REPO=/path/to/goose
# Run the complete pipeline with auto-detected versions
./scripts/run-pipeline.sh
# Or specify versions explicitly
./scripts/run-pipeline.sh v1.17.0 v1.19.0
# Or run individual steps:
# 1. Extract CLI structures
./scripts/extract-cli-structure.sh v1.17.0 > output/old-cli-structure.json
./scripts/extract-cli-structure.sh v1.19.0 > output/new-cli-structure.json
# 2. Detect changes
python3 scripts/diff-cli-structures.py output/old-cli-structure.json \
output/new-cli-structure.json \
> output/cli-changes.json
# 3. Generate human-readable change documentation
cd output && goose run --recipe ../recipes/synthesize-cli-changes.yaml
# 4. Update goose-cli-commands.md
cd output && goose run --recipe ../recipes/update-cli-commands.yaml
The pipeline automatically detects versions when not specified:
gh release list)RELEASE_TAG env var (for CI)gh CLI not availableTo test unreleased changes, explicitly pass HEAD:
./scripts/run-pipeline.sh v1.19.0 HEAD
The automation uses a hybrid approach: deterministic scripts for data extraction/diffing, AI recipes for analysis and documentation updates.
┌─────────────────────────────────────────────────────────────────┐
│ EXTRACTION (Deterministic) │
├─────────────────────────────────────────────────────────────────┤
│ extract-cli-structure.sh → extract-cli-structure.py │
│ ↓ │
│ cli-structure.json (commands, options, subcommands, aliases) │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ DIFFING (Deterministic) │
├─────────────────────────────────────────────────────────────────┤
│ diff-cli-structures.py │
│ ↓ │
│ cli-changes.json (added, removed, modified commands/options) │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ SYNTHESIS (AI-Powered) │
├─────────────────────────────────────────────────────────────────┤
│ synthesize-cli-changes.yaml │
│ ↓ │
│ cli-changes.md (human-readable) │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ UPDATE (AI-Powered) │
├─────────────────────────────────────────────────────────────────┤
│ update-cli-commands.yaml │
│ ↓ │
│ goose-cli-commands.md (updated) + update-summary.md │
└─────────────────────────────────────────────────────────────────┘
Scripts handle deterministic tasks:
--help commands and parsing outputAI recipes handle synthesis and updates:
Benefits:
All stages communicate via JSON/Markdown files in the output/ directory:
| File | Producer | Consumer | Purpose |
|---|---|---|---|
old-cli-structure.json | extract-cli-structure.sh | diff-cli-structures.py | Previous version CLI structure |
new-cli-structure.json | extract-cli-structure.sh | diff-cli-structures.py | Current version CLI structure |
cli-changes.json | diff-cli-structures.py | synthesize-cli-changes.yaml | Detected changes (structured) |
cli-changes.md | synthesize-cli-changes.yaml | update-cli-commands.yaml | Human-readable change documentation |
update-summary.md | update-cli-commands.yaml | Human review | Summary of documentation updates |
| Variable | Required | Default | Description |
|---|---|---|---|
GOOSE_REPO | Yes (local) | - | Path to goose repository root |
CLI_COMMANDS_PATH | No | $GOOSE_REPO/documentation/docs/guides/goose-cli-commands.md | Full path to target doc file |
RELEASE_TAG | No | - | Used by GitHub Actions to specify the new version |
Example:
export GOOSE_REPO=/Users/you/goose
# CLI_COMMANDS_PATH is auto-constructed from GOOSE_REPO
Some commands are intentionally excluded from extraction and documentation tracking. These are configured in config/skip-commands.json:
{
"description": "Commands to skip during extraction (not documented intentionally)",
"skip_commands": [
{
"name": "term",
"reason": "Terminal integration documented via @goose/@g aliases"
}
]
}
To add or remove skipped commands, edit the config file - no code changes required.
extract-cli-structure.shBuilds goose from a specific git tag and extracts CLI structure using --help output.
Usage:
./scripts/extract-cli-structure.sh [version] > output/cli-structure.json
Arguments:
version (optional): Git tag or commit to extract from (default: HEAD)Output: JSON with complete command tree including options, subcommands, aliases
Example:
# Extract from current code
./scripts/extract-cli-structure.sh HEAD > output/new-cli-structure.json
# Extract from specific version
./scripts/extract-cli-structure.sh v1.15.0 > output/old-cli-structure.json
diff-cli-structures.pyCompares two CLI structure files and outputs detected changes.
Usage:
python3 scripts/diff-cli-structures.py <old-file> <new-file> > output/cli-changes.json
Arguments:
old-file: Path to old CLI structure JSONnew-file: Path to new CLI structure JSONOutput: JSON with categorized changes:
commands.added: New commandscommands.removed: Deleted commandscommands.modified: Changed commands (options, description, aliases)breaking_changes: Categorized breaking changesExample:
python3 scripts/diff-cli-structures.py \
output/old-cli-structure.json \
output/new-cli-structure.json \
> output/cli-changes.json
synthesize-cli-changes.yamlAnalyzes detected changes and generates human-readable documentation.
Inputs:
output/cli-changes.json - Detected changes from diff scriptoutput/old-cli-structure.json - Previous version structureoutput/new-cli-structure.json - Current version structureOutput:
output/cli-changes.md - Human-readable change documentation with:
Usage:
cd output
goose run --recipe ../recipes/synthesize-cli-changes.yaml
update-cli-commands.yamlUpdates the CLI Commands Guide based on synthesized changes.
Inputs:
output/cli-changes.md - Change documentation from synthesis recipegoose-cli-commands.md - Target documentation file (path from CLI_COMMANDS_PATH or GOOSE_REPO env var)Outputs:
goose-cli-commands.md with changes appliedoutput/update-summary.md - Summary of changes for reviewUsage:
export CLI_COMMANDS_PATH=/path/to/goose-cli-commands.md
cd output
goose run --recipe ../recipes/update-cli-commands.yaml
cli-command-tracking/
├── README.md # This file
├── TESTING.md # Testing guide for GitHub Actions workflow
├── .gitignore # Excludes output/ directory
├── config/ # Configuration files
│ └── skip-commands.json # Commands to exclude from tracking
├── scripts/ # Extraction and diff scripts
│ ├── extract-cli-structure.sh # Wrapper that builds goose and runs Python
│ ├── extract-cli-structure.py # Python script to parse --help output
│ ├── diff-cli-structures.py # Compare structures and detect changes
│ └── run-pipeline.sh # End-to-end pipeline runner
├── recipes/ # AI recipes
│ ├── synthesize-cli-changes.yaml # Generate change docs
│ └── update-cli-commands.yaml # Update documentation
├── .github/workflows/ # GitHub Actions workflow
│ └── docs-update-cli-ref.yml # Workflow definition
└── output/ # Generated files (gitignored)
├── old-cli-structure.json # Previous version structure
├── new-cli-structure.json # Current version structure
├── cli-changes.json # Detected changes (structured)
├── cli-changes.md # Change documentation (human-readable)
├── update-summary.md # Documentation update summary
└── pipeline.log # Pipeline execution log
The automation runs via .github/workflows/docs-update-cli-ref.yml:
goose-cli-commands.md if changes detectedWhen modifying the automation:
./scripts/run-pipeline.sh with test versions