Skip to content

Surface cg commands in CLI help for agent discovery#21

Open
khooihzhz wants to merge 3 commits intomainfrom
docs/surface-commands-in-help
Open

Surface cg commands in CLI help for agent discovery#21
khooihzhz wants to merge 3 commits intomainfrom
docs/surface-commands-in-help

Conversation

@khooihzhz
Copy link
Collaborator

@khooihzhz khooihzhz commented Mar 21, 2026

Summary

Un-hide the cg commands command so it appears naturally in cg --help, enabling AI agents and users to discover the machine-readable command catalog without any manual advertising.

Links

  • Linear: N/A

Changes

  • Why: Agents interacting with cg had no way to discover cg commands since it was hidden from --help. Surfacing it gives them (~4k tokens) a complete command catalog with examples on the first invocation.
  • What it adds: Nothing new — the commands command already existed.
  • What it modifies: cmd/commands.go — removes Hidden: true from commandsCmd so it appears in the standard cg --help command list.
  • What it removes: The Hidden: true flag that was keeping commands out of help output.

Pre-release Checklist

  • Tests pass
  • No new warnings or lint errors
  • (If UI/UX changes) Visual review done
  • (If new ENV added) Environment variables documented

Rollback Steps

  • Revert this PR's merge commit on main — no migrations, feature flags, or environment changes involved.

The hidden `cg commands` endpoint outputs a machine-readable JSON
catalog of all commands, flags, enums, and API mappings — useful for
agents and tooling. Until now it was only discoverable via CLAUDE.md.

Add a footer line to `cg --help` so users and agents can find it.
Surface the machine-readable catalog command in the interactive
welcome box so agents and users discover it on first launch.
@khooihzhz khooihzhz requested a review from a team March 21, 2026 09:45
Remove Hidden: true from commandsCmd so it appears naturally in
`cg --help` alongside every other command. This replaces the previous
approach of keeping it hidden while manually adding hints to the usage
template and welcome banner — simpler, more conventional, and zero
additional code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant