documentation/automation/cli-command-tracking/TESTING.md
This guide explains how to test the CLI command tracking automation locally and in GitHub Actions.
cd /path/to/cli-command-tracking
# Set the goose repository path
export GOOSE_REPO=/path/to/goose
# Create output directory
mkdir -p output
Test the extraction with a specific version:
# Test with a release version
./scripts/extract-cli-structure.sh v1.19.0 > output/test-extraction.json
# Verify output
jq '.version, .commands | length' output/test-extraction.json
# Inspect a specific command
jq '.commands[] | select(.name == "session")' output/test-extraction.json
# Verify skipped commands are excluded
jq '.commands[].name' output/test-extraction.json | grep -v term
Expected output:
term)Common issues:
Compare two CLI structures:
# Extract from two versions
./scripts/extract-cli-structure.sh v1.14.0 > output/old-cli-structure.json
./scripts/extract-cli-structure.sh v1.15.0 > output/new-cli-structure.json
# Run diff
python3 scripts/diff-cli-structures.py \
output/old-cli-structure.json \
output/new-cli-structure.json \
> output/cli-changes.json
# Check results
jq '.has_changes, .summary' output/cli-changes.json
# View specific changes
jq '.changes.commands.added' output/cli-changes.json
jq '.changes.commands.modified[0]' output/cli-changes.json
jq '.breaking_changes' output/cli-changes.json
Expected output:
has_changes: true if versions differGenerate human-readable documentation:
cd output
# Run synthesis recipe
goose run --recipe ../recipes/synthesize-cli-changes.yaml
# Check output
ls -lh cli-changes.md
head -50 cli-changes.md
Expected output:
cli-changes.md file createdstore_comment tool does not contain triple-backtick code fences (```), even though regular backticks in markdown files like cli-changes.md are allowed.Update the actual documentation:
cd output
# Set path to documentation file
export CLI_COMMANDS_PATH=/path/to/goose/documentation/docs/guides/goose-cli-commands.md
# Run update recipe
goose run --recipe ../recipes/update-cli-commands.yaml
# Check outputs
ls -lh update-summary.md
cat update-summary.md
# Verify documentation was updated
git diff $CLI_COMMANDS_PATH
Run the complete end-to-end pipeline:
cd /path/to/cli-command-tracking
# Set documentation path (optional - only needed for update step)
export CLI_COMMANDS_PATH=/path/to/goose/documentation/docs/guides/goose-cli-commands.md
# Run pipeline
./scripts/run-pipeline.sh v1.14.0 v1.15.0
# Check all outputs
ls -lh output/
Expected output:
cli-changes.md generatedFork the repository (if not already done)
Copy automation files to your fork:
cp -r /path/to/cli-command-tracking \
/path/to/forked-goose/documentation/automation/
cp /path/to/goose/.github/workflows/docs-update-cli-ref.yml \
/path/to/forked-goose/.github/workflows/
Set up secrets in your fork:
ANTHROPIC_API_KEY secretSet up variables (optional):
GOOSE_PROVIDER variable (default: anthropic)GOOSE_MODEL variable (default: claude-opus-4-5)Trigger workflow manually:
dry_run: true for testingTest without creating PR:
dry_run: true| Input | Description | Default |
|---|---|---|
old_version | Previous version tag | Auto-detect from releases |
new_version | New version tag | HEAD |
dry_run | Generate files but don't create PR | true |
After workflow runs:
old-cli-structure.json - Previous CLI structurenew-cli-structure.json - New CLI structurecli-changes.json - Detected changescli-changes.md - Human-readable documentationpipeline.log - Execution logTo validate the automation works correctly, test with versions that have known CLI changes.
cd /path/to/goose
# Check git history for CLI changes
git log --oneline --all -- crates/goose-cli/src/cli.rs | head -20
# Look for commits that added/removed/modified commands
git show <commit-hash>:crates/goose-cli/src/cli.rs | grep "enum Command" -A 30
If you know a version added a new command:
./scripts/run-pipeline.sh v1.13.0 v1.14.0
jq '.changes.commands.added' output/cli-changes.json
If you know a version modified options:
./scripts/run-pipeline.sh v1.14.0 v1.15.0
jq '.changes.commands.modified' output/cli-changes.json
Test with same version (should show no changes):
./scripts/run-pipeline.sh v1.14.0 v1.14.0
jq '.has_changes' output/cli-changes.json
# Should output: false
Before considering the automation complete:
On macOS, running goose --help or goose --version may prompt for keychain access. This happens because goose tries to access stored credentials on startup.
Local workaround: Allow the keychain access when prompted.
CI consideration: GitHub Actions runners don't have a keychain, so this may need to be handled. Check existing goose workflows for patterns - there may be a keyring: false config option or environment variable to disable credential loading.
TODO: Investigate if this blocks CI execution and document the solution.
Some old versions may have different dependencies:
# Check if version exists
git tag | grep v1.14.0
# Try building manually
git worktree add /tmp/goose-test v1.14.0
cd /tmp/goose-test
cargo build --release
Increase timeout in extract-cli-structure.py:
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30) # Increase from 10
Check if help text formatting changed:
# Compare raw help output
./old-goose session --help > old-help.txt
./new-goose session --help > new-help.txt
diff old-help.txt new-help.txt
Check input files exist and are valid:
ls -lh output/cli-changes.json output/old-cli-structure.json output/new-cli-structure.json
jq empty output/cli-changes.json # Validates JSON
Ensure:
ANTHROPIC_API_KEY secret is setAfter automation runs, manually verify:
Keep test data for regression testing:
# Save known-good outputs
mkdir -p test-data
cp output/cli-changes.json test-data/v1.14.0-to-v1.15.0-changes.json
cp output/cli-changes.md test-data/v1.14.0-to-v1.15.0-changes.md
Use these to verify future changes don't break existing functionality.