[codex] fix CLI help for dynamic tool command#135
Conversation
|
4bfc96d to
4cfebce
Compare
There was a problem hiding this comment.
💡 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".
|
|
||
| fn async_main() -> tracedecay::errors::Result<()> { | ||
| let cli = Cli::parse(); | ||
| let args: Vec<String> = std::env::args().collect(); |
There was a problem hiding this comment.
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 👍 / 👎.
What changed
tracedecay tool --helpandtracedecay tool -hbefore dynamic tool dispatch so command-level help exits successfully.tracedecay tool search --help.DisplayHelpfor--help.Why
tooldisables clap's built-in help flag so--helpcan be forwarded to dynamic MCP tool schemas. That madetracedecay tool --helperror at the command boundary instead of printing help.Impact
Users can now ask for help at the
toolcommand level consistently with the rest of the CLI, while dynamic per-tool help remains intact.Validation
cargo fmt --checkcargo test -q --test cli_help_testcargo test -q --bin tracedecay parse_testscargo run -q -- tool --help