Skip to content

mcpx: make <command> --help print the command's help - #275

Merged
dezren39 merged 2 commits into
mainfrom
creator/274-command-help
Oct 18, 2026
Merged

dezren39 merged 2 commits into
mainfrom
creator/274-command-help

Conversation

@dezren39

Copy link
Copy Markdown
Member

Fixes #274. Port of dezren39/nix PR #380 (commit 32bb9ff, fixed nix#368) — the pre-fix files in this repo's pkgs/mcpx copy were verified byte-identical to nix's pre-fix versions, and the defect reproduced identically here.

Problem (on main 98da85ea)

  • mcpx call --help → Usage of call: + 290 lines of plumbing flags, not the command's help.
  • mcpx daemons --help → ignored the flag and listed daemons.

Fix

  • parseFlags answers a help flag in flag position with the same text as mcpx help <cmd> (new shared helpText), and installs that text as the flag set's usage so a parse error can't resurrect the dump. Generated op commands keep their own tailored usage. wantsHelp mirrors the parser: a help token consumed as a valued flag's value, after a positional, or after -- is not a request.
  • Handlers() wraps hand-written commands: a leading help flag is answered even for commands that never parse flags, and flag.ErrHelp becomes success; main treats flag.ErrHelp the same way.
  • internal/cli/help_test.go ported (refs re-pointed to mcpx: <command> --help prints every global flag instead of the command's help #274).

Verification

  • Full internal/cli suite green; go vet clean.
  • Built binary: call --help is now byte-identical to help call (97 curated lines vs 290-line dump); daemons --help prints help instead of listing daemons.
  • gofmt: no new diffs from this change (the one dispatch.go alignment hunk local Go 1.25 reports exists identically on unmodified main — toolchain-version artifact; this change's hunks are clean).

Port of dezren39/nix PR #380 (commit 32bb9ff, fixes nix#368): the
pre-fix files in this repo's pkgs/mcpx copy were byte-identical to
nix's, and the defect reproduced identically — mcpx call --help
printed a 290-line settings dump, mcpx daemons --help ran the command.

- parseFlags answers a help flag in flag position with the same text
  as mcpx help <cmd> (new helpText) and installs it as the flag set's
  usage; generated op commands keep their own usage.
- Handlers() wraps hand-written commands so a leading help flag is
  answered even for commands that never parse flags; flag.ErrHelp
  becomes success in dispatch and in main.
- help_test.go ported with refs re-pointed to #274.

Verified: full internal/cli suite green, go vet clean, built binary:
call --help is now byte-identical to help call (97 lines), daemons
--help prints help instead of listing daemons.
@dezren39
dezren39 requested a review from a team as a code owner October 18, 2026 11:04
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-18T11:04:24.913814Z 5c4d371 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d666da9f-f989-47c5-96b9-257a68f893bb
📥 Commits

Reviewing files that changed from the base of the PR and between 98da85e and a72a2fa.

📒 Files selected for processing: 4
  • pkgs/mcpx/cmd/mcpx/main.go
  • pkgs/mcpx/internal/cli/dispatch.go
  • pkgs/mcpx/internal/cli/help_test.go
  • pkgs/mcpx/internal/cli/root.go
+---------------------------------------------+
| These comments are outdated enough to vote. |
+---------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Pre-existing alignment that treefmt only checks on changed files;
formatting only, no behaviour change.
@dezren39
dezren39 merged commit 410275d into main Oct 18, 2026
13 of 15 checks passed
@dezren39
dezren39 deleted the creator/274-command-help branch October 18, 2026 11:07
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.

mcpx: <command> --help prints every global flag instead of the command's help

1 participant