Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the rocm CLI’s usability by expanding help/documentation text across commands and by adding a “did you mean” hint path for mistyped single-word freeform invocations.
Changes:
- Expanded top-level and per-command help text (
long_about,after_help) with clearer guidance and examples. - Added unknown-command hinting for single-token freeform requests, including Levenshtein-based suggestions.
- Added unit tests validating the unknown-command hint behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The .chars().all(...) predicate already rejects whitespace, so the preceding str::contains(char::is_whitespace) check was redundant. Addresses review feedback on PR #48. Signed-off-by: Roman <roman.sirokov@amd.com>
rominf
left a comment
There was a problem hiding this comment.
I haven't yet check all the commands in the examples. I recommend you verify they all operational.
Expand top-level and per-command help (long_about/after_help) with clearer guidance and verified examples for examine, install, model, serve, services, chat, update, logs, and engines. Route botched command invocations to clap's built-in suggestions engine (the "suggestions" feature) so a mistyped subcommand -- whether it stands alone (`instal`) or is followed by flags (`doctorgdfg --help`) -- surfaces a friendly "did you mean"/usage error and exits, instead of a hand-rolled Levenshtein matcher or a raw planner request plan. Genuine natural-language requests still flow to the planner. Addresses review feedback on PR #48: - replace the custom unknown-command hint with clap suggestions - reference `rocm examine` instead of the removed `rocm doctor` Signed-off-by: Roman <roman.sirokov@amd.com>
|
@rominf Verified using an agent that all commands in the example are operational |
rominf
left a comment
There was a problem hiding this comment.
Review: typo-routing has a gap, and one help string names a non-existent command
CI is green and the leak scan is clean. Two concrete issues, plus a refactor that fixes the bigger one and removes a fragility in the same move.
1. Mistyped subcommand + argument bypasses clap suggestions (logic bug)
rocm automatios list falls through to the natural-language planner instead of surfacing clap's "did you mean automations":
$ rocm automatios list
request plan
...
note: No ROCm action matched this request.
note: Run `rocm --help` to see available commands, or rephrase ...
Root cause in command_invocation_error (apps/rocm/src/main.rs:855):
let has_flag = request_args.iter().any(|arg| arg.starts_with('-'));
if request_args.len() > 1 && !has_flag {
return None; // <- "automatios list" exits here, never reaching clap
}A near-miss subcommand followed by a normal argument (no flag) is treated as prose. It should still get a suggestion. instal works only because it is a single token; instal list would fail the same way.
2. Daemon help references a command that does not exist
apps/rocm/src/main.rs:347 says the daemon is "normally started on demand by rocm automations enable and rocm managed serve". There is no rocm managed serve command — the managed path is the --managed flag on serve (serve --managed, cf. main.rs:3760 and main.rs:10810). Should read rocm serve --managed.
3. Suggested refactor (fixes #1 and drops a fragility)
The lone-token branch keys off err.to_string().contains("similar") (main.rs:864), matching clap's human-readable wording. clap exposes this structurally via err.get(ContextKind::SuggestedSubcommand). Switching to it lets the helper collapse to a single rule: surface clap's error when it carries a suggestion, or when a flag is present (e.g. doctorgdfg --help); otherwise fall through to the planner. That removes both the len() > 1 && !has_flag early-return (cause of #1) and the string match, and keeps the existing tests green — instal still suggests, prose like please install still routes to the planner.
|
One more, on commit hygiene: both commits on this branch are unsigned ( |
…help Address review feedback (PR #48): - command_invocation_error now surfaces clap's error whenever clap carries a subcommand suggestion (via ContextKind::SuggestedSubcommand) or the request contains a flag, instead of bailing out for any multi-word request. This fixes `rocm automatios list` (and `instal list`), which previously fell through to the natural-language planner, and drops the fragile `err.to_string().contains("similar")` match. - Daemon help referenced a non-existent `rocm managed serve`; corrected to `rocm serve --managed`. Signed-off-by: Roman <roman.sirokov@amd.com>
|
Thanks for the detailed review — all three addressed in 6fac2ab. 1 & 3 (typo-routing gap + refactor). Adopted the suggested refactor. Prose ( 2 (daemon help). Fixed
On commit signing: good flag — happy to align if signed commits are expected here. As you noted it needs a history rewrite to re-sign the existing commits rather than a follow-up, so I'll leave the existing history in place pending the separate PR you mentioned; let me know if you'd prefer I rewrite + |
Expand top-level and per-command help (long_about/after_help) with clearer guidance and verified examples for examine, install, model, serve, services, chat, update, logs, and engines. Route botched command invocations to clap's built-in suggestions engine (the "suggestions" feature) so a mistyped subcommand -- whether it stands alone (`instal`) or is followed by flags (`doctorgdfg --help`) -- surfaces a friendly "did you mean"/usage error and exits, instead of a hand-rolled Levenshtein matcher or a raw planner request plan. Genuine natural-language requests still flow to the planner. Addresses review feedback on PR #48: - replace the custom unknown-command hint with clap suggestions - reference `rocm examine` instead of the removed `rocm doctor` Signed-off-by: Roman <roman.sirokov@amd.com>
…help Address review feedback (PR #48): - command_invocation_error now surfaces clap's error whenever clap carries a subcommand suggestion (via ContextKind::SuggestedSubcommand) or the request contains a flag, instead of bailing out for any multi-word request. This fixes `rocm automatios list` (and `instal list`), which previously fell through to the natural-language planner, and drops the fragile `err.to_string().contains("similar")` match. - Daemon help referenced a non-existent `rocm managed serve`; corrected to `rocm serve --managed`. Signed-off-by: Roman <roman.sirokov@amd.com>
|
Review — approve with nits. Help/doc-only + clap 4.5→4.6 (
The per-variant and |
Expand top-level and per-command help (long_about/after_help) with clearer guidance and verified examples for examine, install, model, serve, services, chat, update, logs, and engines. Route botched command invocations to clap's built-in suggestions engine (the "suggestions" feature) so a mistyped subcommand -- whether it stands alone (`instal`) or is followed by flags (`doctorgdfg --help`) -- surfaces a friendly "did you mean"/usage error and exits, instead of a hand-rolled Levenshtein matcher or a raw planner request plan. Genuine natural-language requests still flow to the planner. Addresses review feedback on PR #48: - replace the custom unknown-command hint with clap suggestions - reference `rocm examine` instead of the removed `rocm doctor` Signed-off-by: Roman <roman.sirokov@amd.com>
Signed-off-by: Roman <roman.sirokov@amd.com>
…help Address review feedback (PR #48): - command_invocation_error now surfaces clap's error whenever clap carries a subcommand suggestion (via ContextKind::SuggestedSubcommand) or the request contains a flag, instead of bailing out for any multi-word request. This fixes `rocm automatios list` (and `instal list`), which previously fell through to the natural-language planner, and drops the fragile `err.to_string().contains("similar")` match. - Daemon help referenced a non-existent `rocm managed serve`; corrected to `rocm serve --managed`. Signed-off-by: Roman <roman.sirokov@amd.com>
Address review feedback (PR #48): the hand-written `[possible values: ...]` help on `serve --engine`/`--device` could drift from the real accept-set. Keep both flags free-form (`--engine` is unconstrained, `--device` accepts aliases like `auto`/`gpu` and intentionally rejects `cpu_only` per the no-CPU-fallback policy), so a ValueEnum would change accepted input. Instead add tests asserting the rendered help lists stay in sync with their sources of truth (`builtin_engine_inventory()` and `DevicePolicy` names), and fix the existing drift where the engine list omitted `atom`. Signed-off-by: Roman <roman.sirokov@amd.com>
|
Thanks @michaelroy-amd — both addressed in 21f8873. [MEDIUM]
So instead there are now two sync tests that render the actual
Writing the test surfaced an existing drift: the engine list was missing [LOW] Branch behind main. Rebased onto current
|
|
@rominf follow-up on the signing note — I went ahead with the rewrite rather than waiting for a separate PR. The branch history is now rewritten: all four commits are SSH-signed and carry DCO Full-transparency caveat: GitHub still shows them Unverified ( |
This pull request significantly improves the usability and user guidance of the
rocmCLI by enhancing command documentation, providing better help messages, and introducing intelligent suggestions for mistyped commands. The changes focus on making the CLI more approachable for new users and easier to navigate, especially when encountering errors or seeking help.Enhanced CLI documentation and help:
Expanded the main CLI help and individual command help texts, including detailed
long_aboutandafter_helpsections with usage examples for commands likechat,update,model,serve,logs,install sdk, andengines install. This provides users with clear instructions and practical command usage patterns. [1] [2] [3] [4] [5] [6] [7]Added descriptive comments to enum variants such as
InstallFormat,Provider,WatcherModeArg, andTelemetryModeArgto clarify their intent and possible values.Improved error handling and user guidance:
Implemented logic to detect unrecognized single-word commands, providing a helpful error message that suggests the closest known command (using Levenshtein distance) and directs users to available help resources. This includes a new
unknown_command_hintfunction and supporting logic.Updated the fallback notes for unmatched freeform requests to direct users to
rocm --helpand suggest including an action word in their request.Testing and reliability: