Skip to content

fix(cli): align call and resource help descriptions in one column - #523

Open
KrasimirKralev wants to merge 1 commit into
openclaw:mainfrom
KrasimirKralev:fix/call-help-columns
Open

KrasimirKralev wants to merge 1 commit into
openclaw:mainfrom
KrasimirKralev:fix/call-help-columns

Conversation

@KrasimirKralev

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: in mcporter call --help and mcporter resource --help, some flag descriptions start outside the column the other rows use, so the reader has to work out where a flag ends and its description begins.

  • In call --help, --args, --params <json> starts its description 2 columns right of the rest of the Arguments block, and --output text|markdown|json|raw runs 10 columns past the Runtime flags block. In resource --help, the four flags start at three different columns (38, 39, 40).
  • What did NOT change: flag names, descriptions, the Examples section, parsing, and every other command's help. list and auth keep their own ad-hoc help widths.
  • Requested by a maintainer? No. Same class as the global-help column fix in fix(cli): keep --log-level help from running into its description #404.

User Impact

User impact: every row in call --help and resource --help now starts its description in one column, two spaces after the longest flag, the rule the top-level help has used since #404. The only layout change is that the shared call --help column moves from 25 to 35 so that --output text|markdown|json|raw fits.

Why This Change Was Made

  • What changed: a small formatHelpRows / helpFlagWidth helper (src/cli/help-rows.ts) pads each flag to the longest flag in the help and adds a two-space gap. printCallHelp passes one width across Selectors, Arguments, Runtime flags and Ad-hoc servers, and printResourceHelp uses the helper for its Flags block. The call-help rows are now [flag, description] tuples in call-help.ts.
  • Root cause: the rows were hand-padded strings with a fixed 23-character flag field, so any flag longer than 21 characters, or a mistyped pad, moved its description.
  • Missing detection: no test checked these columns. The new it.each case in tests/cli-call-help.test.ts runs call --help and resource --help through runCli and requires every row before Examples to share one description column after a gap of at least two spaces. With the upstream help sources it fails for both commands (expected 3 to be 1); on this branch it passes (run 3 times).
  • Sweep: running a column check over the built --help of the root command and list auth generate-cli inspect-cli emit-ts config daemon serve record replay resource call found misaligned rows only in call and resource.
  • Gates: pnpm check passes. pnpm test: 2,464 pass, and 8 fail in tests/cli-generate-cli.integration.test.ts and tests/generate-cli.test.ts. Those 8 are Bun-compile cases that need Bun ≥ 1.4.4, and this machine has Bun 1.4.0; none of them touches help output.

Evidence

  • Behavior or issue addressed: misaligned description columns in call --help and resource --help.
  • Real environment tested: Linux, Node 24, pnpm build of upstream aa8d0c5 and of this branch.
  • Exact steps or command run after this patch: node dist/cli.js call --help and node dist/cli.js resource --help, once on the upstream build and once on the branch build (Arguments, Runtime flags and resource Flags blocks shown).
  • Evidence after fix:
# before: node dist/cli.js call --help / resource --help (upstream aa8d0c5)
Arguments:
  key=value / key:value  Flag-style named arguments.
  key=@path              Read a UTF-8 string value from a file; use @@ for a literal @.
  function-call syntax   'server.tool(arg: "value", other: 1)'.
  --args, --params <json>  Provide a JSON object payload.
  positional values      Accepted when schema order is known.
  --                     Treat remaining tokens as literal positional values.

Runtime flags:
  --timeout <ms>         Override the call timeout.
  --output text|markdown|json|raw  Control formatting.
  --save-images <dir>    Save image content blocks to a directory.
  --no-oauth             Never start OAuth; use cached tokens only.
  --raw-strings          Keep numeric-looking argument values as strings.
  --no-coerce            Keep all key/value and positional arguments as raw strings.
  --tail-log             Stream returned log handles.

Flags:
  --output auto|text|markdown|json|raw  Choose output rendering.
  --json                               Shortcut for --output json.
  --raw                                Shortcut for --output raw.
  --no-oauth                          Never start OAuth; use cached tokens only.

# after: node dist/cli.js call --help / resource --help (this branch)
Arguments:
  key=value / key:value            Flag-style named arguments.
  key=@path                        Read a UTF-8 string value from a file; use @@ for a literal @.
  function-call syntax             'server.tool(arg: "value", other: 1)'.
  --args, --params <json>          Provide a JSON object payload.
  positional values                Accepted when schema order is known.
  --                               Treat remaining tokens as literal positional values.

Runtime flags:
  --timeout <ms>                   Override the call timeout.
  --output text|markdown|json|raw  Control formatting.
  --save-images <dir>              Save image content blocks to a directory.
  --no-oauth                       Never start OAuth; use cached tokens only.
  --raw-strings                    Keep numeric-looking argument values as strings.
  --no-coerce                      Keep all key/value and positional arguments as raw strings.
  --tail-log                       Stream returned log handles.

Flags:
  --output auto|text|markdown|json|raw  Choose output rendering.
  --json                                Shortcut for --output json.
  --raw                                 Shortcut for --output raw.
  --no-oauth                            Never start OAuth; use cached tokens only.
  • Observed result after fix: in the node dist/cli.js output, every description in each block starts in the same column. Before the change, the description columns in the upstream build were 25/27 (Arguments), 25/35 (Runtime flags) and 38/39/40 (resource Flags).
  • What was not tested: narrow terminals; the help output is not wrapped either before or after this change.
  • Proof limitations or environment constraints: the 8 Bun-compile failures described above are caused by this machine's Bun version.

Size the call and resource help columns from their longest flag with a two-space gap, as the global help does, so --args/--params, --output and resource --no-oauth stop drifting off the column.
@clawsweeper

clawsweeper Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T07:18:37.191759Z e530774 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 22, 2026
@clawsweeper

clawsweeper Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR aligns call and resource help descriptions using the longest flag and a two-space separator.

Example: Run mcporter call --help.

  • Before: The --timeout and --output descriptions start at different columns.
  • After: Both descriptions start at the same column with at least two separating spaces.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct help-formatting repair with direct CLI proof, meaningful regression coverage, and passing reviewed-head checks.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The contributor's Linux Node 24 built-CLI transcript exercises call and resource help after the patch and shows aligned descriptions; exact spacing agrees with the changed formatter.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Uneven description columns make call and resource help harder to scan.
Reason: A narrow readability repair fits the repository vision and preserves the CLI contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: current main still has uneven help columns, and the focused patch fixes them without changing command behavior; no actionable defect was found.

Priority: P3
Reviewed head: e5307745ecaff92ae28ae398c8a982db252622a3

Before merge

None.

Findings

None.

Agent review details

How this fits together

The CLI routes help requests to command-specific printers, which turn flag labels and descriptions into terminal output before command execution.

flowchart LR
  A[CLI arguments] --> B[Help routing]
  B --> C[Call help rows]
  B --> D[Resource help rows]
  C --> E[Shared column formatter]
  D --> E
  E --> F[Terminal output]
Loading

Technical review

Best possible solution:

Land the focused shared formatter and command-level regression coverage through ordinary repository review.

Do we have a high-confidence way to reproduce the issue?

Current-main strings establish the uneven columns, and the contributor supplies before-and-after output from both built CLI help commands; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Longest-flag sizing fixes the formatting cause, preserves existing help content, and follows the merged global-help approach with a small helper shared by two command printers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against aa8d0c5ac6cd.

Provenance checked

  • Call help labels and section rendering changes intended behavior with a stated reason (83cc3b9: The helper extraction carried existing help strings into a dedicated module; later changes documented file-backed arguments, aliases, and OAuth suppression.)
  • Shared ad-hoc help entries keeps the original intent (69c98e8: The CLI refactor centralized ad-hoc help content; this patch retains that content owner and changes only call-specific padding.)
  • Resource help flags changes intended behavior with a stated reason (75dba26: The resource command shipped with manually spaced help rows; this patch explains and repairs their uneven alignment while preserving wording.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still needs the fix: The default branch remains aa8d0c5; call help uses manually padded strings, including the wider --output row. (src/cli/call-help.ts:12, aa8d0c5ac6cd)
  • Introduced fix: The pinned introduced diff computes one call-help width across all sections and formats resource flags through the same small helper; flag names, descriptions, examples, and parsing remain intact. (src/cli/call-command.ts:236, e5307745ecaf)
  • Supplied shipped CLI proof: The full PR body supplies Linux Node 24 before-and-after output from node dist/cli.js call --help and resource --help. Exact spacing inspection confirms a common description offset within each command. (e5307745ecaf)
  • Focused regression coverage: The added parameterized test routes both help requests through runCli and checks a shared description column and separating gap; the contributor reports both cases fail against upstream help sources and pass with the patch. (tests/cli-call-help.test.ts:44, e5307745ecaf)
  • Earlier merged formatting precedent: fix(cli): keep --log-level help from running into its description #404 fixed the separate global-help formatter using longest-flag sizing and a two-space gap; its merge commit verifies the author's prior contribution in this area. (src/cli/help-output.ts:171, b27eec09ee04)
  • Feature history and local limit: History identifies Peter Steinberger's call-help extraction, resource-command addition, and CLI refactoring, with later contributions from Sebastian B Otaegui and Krasimir Kralev. Some older-content searches and global-help blame encountered unavailable historical blobs; the relevant base and head files were readable. (src/cli/resource-command.ts:68, aa8d0c5ac6cd)

Likely related people:

  • Peter Steinberger: Raw commit 75dba26 adds src/cli/resource-command.ts:31 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 75dba26173fb; files: src/cli/resource-command.ts)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P3: The change improves CLI help readability without affecting command execution.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: The change improves CLI help readability without affecting command execution.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 22, 2026, 2:29 AM ET / 07:29 UTC.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant