Skip to content

Generate command-reference.md from the Typer app (zero-drift reference for help docs + plugin) #498

Description

@padak

Why

The new help-docs CLI section (keboola/connection-docs#1015) hand-copies the command reference, and @jordanrburger raised the canonical-source question there: keboola/connection-docs#1015 (comment)

Today there is NO zero-drift machine-readable command reference in this repo. Every existing surface is hand-maintained: kbagent context (curated f-string in commands/context.py), CLAUDE.md "All CLI Commands", plugins/kbagent/skills/kbagent/references/commands-reference.md, and now the help-docs pages. Convention #17 already documents these as silent-drift risks — and the review of connection-docs#1015 found real drift in both directions (CLAUDE.md missing init --read-only / config delete; docs/error-codes.md 20 codes stale, fixed in #490).

The only source that cannot drift is the Typer app itself.

What

scripts/gen_command_reference.py:

  • Introspect the root Typer app (walk groups → subcommands → params) and emit command-reference.md: one section per group, per-command usage line, flags with help text, categorized by the existing rich_help_panel values.
  • Deterministic output (stable ordering) so diffs are reviewable.
  • Wire into the release workflow: attach command-reference.md as a GitHub Release asset next to the wheel, so consumers (help docs, plugin, third parties) can fetch it pinned to a released version instead of scraping --help.
  • Optional follow-up: a CI check that regenerates and diffs against a committed copy, turning silent drift of the hand-curated surfaces into a visible failure (same pattern as check_error_codes.py after docs: complete error-codes.md (46 -> 66 codes) + enforce enum-doc sync #490).

Consumer

keboola/connection-docs plans a scheduled action that pulls the asset from the latest release and opens an auto-PR into their cli/commands page (see the PR discussion). The hand-written narrative pages stay hand-written; only the fact layer gets generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions