Skip to content

Per-subcommand --help and bench discoverability guardrails #716

@rymalia

Description

@rymalia

Background

Documentation for these surfaces is being handled in the CLI/MCP reference PR (#715),
but two issues need code changes, which is what this issue tracks:

  1. --help is identical for every command. Every --help invocation
    (qmd query --help, qmd get --help, qmd collection --help, qmd embed --help,
    …) emits the same ~97-line block. There is no per-command help; the EBNF grammar
    appears even for embed and mcp where it's irrelevant.

  2. qmd bench fails silently. If the fixture's collection isn't indexed, bench
    runs all queries to completion and prints a wall of 0.00 with no warning — ~2
    minutes of wasted work that reads as "search is broken." The usage message also
    points to a source path (src/bench/fixtures/example.json) that npm/npx users
    can't reach, and the fixture isn't shipped in the package.

Proposed changes

Progressive --help

Adopt the tiered/contextual help pattern used by uv, cargo, gh, rg:

  • Top-level qmd --help = command directory (commands + one-line descriptions +
    global options).
  • Per-command --help = only that command's flags, usage, and 1–2 examples.
  • EBNF grammar lives in query --help only.
  • Add --intent and --from to the relevant per-command help (currently missing
    from --help even though they work).
  • Keep help text adjacent to each command handler so community PRs don't drift; add a
    test that asserts each help block's mentioned flags exist in the arg parser.

Note: bare qmd collection (no args) already shows a subcommand directory — extend
that pattern rather than replacing it.

bench guardrails

  • Validate the fixture's collection exists before running; error early with the
    setup hint, mirroring qmd search -c <missing>.
  • Warn on all-zero results (collection likely unindexed; suggest
    qmd ls <collection>).
  • Make the example reachable for installed usersqmd bench --example to print
    the fixture JSON to stdout, and/or ship the example fixture as package data so the
    source-path reference resolves outside a git checkout.

Scope / non-goals

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions