Skip to content

Generate command help and shell completions from shared command metadata #4571

Description

@Widthdom

Summary

Eliminate drift between accepted flags/subcommands, usage grammar, next-step suggestions, and generated shell completions.

Current v1.38.0 evidence / reproduction

  • --strict-not-found is accepted by excerpt/inspect but absent from command help and flag help.
  • index --help omits accepted --parallelism and --no-progress flags.
  • deps results recommend accepted --suppress-noise, --symbol, and --symbol-family flags that deps --help does not list.
  • Search Usage makes recipe-only --include-query appear applicable to named queries.
  • Zsh completion omits workspace clear and workspace deactivate, both present in help.

Impact

Users cannot discover supported controls and can construct invalid commands from authoritative-looking help.

Suggested direction / acceptance criteria

  • Model per-command flags, exclusivity, usage forms, and subcommands in one schema.
  • Generate help, usage, next-step flags, and shell completion from that schema.
  • Add a consistency test comparing parser acceptance with rendered help/completion inventories.

Additional consolidated evidence

status --json exposes sqlite_connection_policy, but status --explain sqlite_connection_policy --json rejects that field even though it is an operator-facing readiness and risk contract.

Additional acceptance criterion

  • Generate the status explain registry from the same metadata as emitted status fields, including sqlite_connection_policy.

Dogfooding candidate IDs: Q029, Q037, R003, R006, R008, M077. Verified against cdidx v1.38.0 at commit 2919bfc9b1b83cfa7ae1d964845d0f9ffca002d1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions