Skip to content

[codex] fix CLI help for dynamic tool command#135

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
codex/fix-tool-help
Jun 27, 2026
Merged

[codex] fix CLI help for dynamic tool command#135
ScriptedAlchemy merged 1 commit into
masterfrom
codex/fix-tool-help

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

What changed

  • Handles tracedecay tool --help and tracedecay tool -h before dynamic tool dispatch so command-level help exits successfully.
  • Keeps per-tool schema help working for commands like tracedecay tool search --help.
  • Adds binary-level regression tests for top-level and representative nested subcommand help.
  • Adds recursive parser coverage so visible clap subcommands continue to return DisplayHelp for --help.

Why

tool disables clap's built-in help flag so --help can be forwarded to dynamic MCP tool schemas. That made tracedecay tool --help error at the command boundary instead of printing help.

Impact

Users can now ask for help at the tool command level consistently with the rest of the CLI, while dynamic per-tool help remains intact.

Validation

  • cargo fmt --check
  • cargo test -q --test cli_help_test
  • cargo test -q --bin tracedecay parse_tests
  • cargo run -q -- tool --help

@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4cfebce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy ScriptedAlchemy marked this pull request as ready for review June 27, 2026 04:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4cfebce69b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs

fn async_main() -> tracedecay::errors::Result<()> {
let cli = Cli::parse();
let args: Vec<String> = std::env::args().collect();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use OsString for argv pre-parsing

This switches every invocation through std::env::args(), which panics on Unix as soon as any argv item is not valid UTF-8. Previously Cli::parse() let clap read args_os() and reject/parse arguments through its normal error path; now commands that accept paths or pass-through tool values can abort before reaching clap even when they are unrelated to tool --help. Keep the help precheck on args_os()/OsStr and pass those values into clap instead of collecting Strings up front.

Useful? React with 👍 / 👎.

@ScriptedAlchemy ScriptedAlchemy merged commit f044855 into master Jun 27, 2026
19 of 22 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the codex/fix-tool-help branch June 27, 2026 04:45
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.

1 participant