Skip to content

fix(cli): put id argument first in report/release usage lines - #3135

Closed
lunetics wants to merge 1 commit into
herdrdev:masterfrom
lunetics:fix/report-metadata-help-arg-order
Closed

fix(cli): put id argument first in report/release usage lines#3135
lunetics wants to merge 1 commit into
herdrdev:masterfrom
lunetics:fix/report-metadata-help-arg-order

Conversation

@lunetics

Copy link
Copy Markdown

Root Cause: herdr pane report-agent, report-agent-session, release-agent, report-metadata, and herdr workspace report-metadata each take their id as the first positional argument in a hand-written parser (args.first()). clap's default usage synopsis renders required options before positionals, so --help shows the id last, e.g. Usage: herdr pane report-metadata [OPTIONS] --source <ID> <PANE_ID>. Following that order (--source foo bar) makes the parser treat --source itself as the id, then fail on the next token with unknown option: bar — a misleading error unrelated to the actual problem.

The Fix: Add .override_usage(...) to each of the five affected Command builders in src/cli/spec.rs, listing the id first, matching the convention already used for several agent subcommands (read/prompt/rename/wait/attach) in the same file. No parser or behavior change — only the displayed usage line.

Validation: Added pane_and_workspace_id_reporting_commands_show_id_before_required_options, checking the exact Usage: line for all five commands via write_requested_help. cargo fmt --check and cargo clippy --all-targets --locked -- -D warnings are clean. Full cargo nextest run passes except 5 pre-existing, unrelated failures (locale-dependent git-error-text assertions in the worktree test suite — reproduced identically against pristine origin/master before this change).

References: none — no existing issue or PR covers this; found while working on an unrelated feature branch.

herdr pane report-agent, report-agent-session, release-agent,
report-metadata, and herdr workspace report-metadata all take their id
as the first positional argument in their hand-written parsers, but
clap's default usage synopsis renders required options before
positionals, so --help shows the id at the end.

Following that usage line's argument order (options first, id last)
produces a confusing "unknown option" error, because the parser
unconditionally treats the first token as the id.

Each command's usage line is now overridden to show the id first,
matching an existing convention already used for several `agent`
subcommands (read/prompt/rename/wait/attach) in this same file. A
regression test checks all five usage lines.
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 40438256-6fbb-47ef-9a1c-13b03544ab0f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kangal-bot

Copy link
Copy Markdown
Collaborator

Hi @lunetics, thanks for your interest in contributing.

Herdr does not accept unsolicited implementation pull requests from contributors who are not listed in .github/APPROVED_CONTRIBUTORS.

The pull request author is not an approved contributor.

If you encountered a reproducible bug, report the observed behavior through the bug issue template. A report does not reserve the work or authorize a pull request; accepted fixes are normally implemented by Herdr’s maintainer-controlled agents.

Feature requests, behavior changes, and other proposals belong in GitHub Discussions. Do not open an issue merely to justify an implementation that was already written.

If a maintainer explicitly wants this implementation, they can reopen the pull request. Reopening by anyone else will be closed again automatically.

See https://github.com/herdrdev/herdr/blob/master/CONTRIBUTING.md for the contribution policy.

@kangal-bot kangal-bot closed this Aug 22, 2026
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.

2 participants