Summary
Suggestions usage errors expose the internal literal placeholder <cmd> instead of an executable help command. The defect appears in both human and structured JSON errors.
Environment
origin/main: c642bc4c3dda4ef659df8e6b699e10f61da3c836
cdidx v1.44.3, locally built
- full net8.0 and net9.0 suites pass
Reproduction
Human output:
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll suggestions list \
--bogus --db .cdidx/codeindex.db
Error: --bogus is not supported for suggestions.
Hint: Run '<cmd> --help' for usage information.
Structured output:
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll suggestions show \
--db .cdidx/codeindex.db --json
{
"message": "suggestions show requires an id.",
"hint": "Run '<cmd> --help' for usage information."
}
The same placeholder also appears in option-compatibility errors such as using --actor outside suggestions update.
Expected behavior
Use the nearest executable help surface, for example:
Run `cdidx suggestions --help` for usage information.
If command identity is unavailable, fall back truthfully to cdidx --help.
Root cause
src/CodeIndex/Cli/CommandErrorWriter.cs:9 defines DefaultHint as the final literal Run '<cmd> --help' for usage information.
- Suggestions preflight and usage paths pass that constant directly.
- Some error-writer paths already know the canonical command, but the default-hint API does not consume it.
Focused PR scope
One PR should:
- replace the literal constant with a command-aware hint builder;
- pass canonical command identity from suggestions usage/preflight paths;
- provide a safe global fallback;
- keep human and JSON hints equivalent;
- audit current callers for the same placeholder exposure;
- add a bilingual changelog fragment.
Non-goals
- Do not redesign all CLI diagnostics.
- Do not infer commands from arbitrary error text.
- Do not expand this into help-content generation.
Implementation guidance and cautions
- Accept a canonical bounded command identifier, not untrusted free text.
- Use existing diagnostic quoting/formatting helpers.
- Do not perform a global post-serialization replacement.
- Preserve error codes, exit codes, categories, and usage blocks.
- Prefer the nearest actually supported help surface for nested commands.
Required tests
- Suggestions unknown option in human mode.
- Missing suggestions ID and invalid option combinations in JSON mode.
- Known-command and unknown-command fallback paths.
- Assert no user-facing output contains literal
<cmd>.
- Preserve existing error/usage contracts.
Acceptance criteria
- No user-facing error emits
<cmd>.
- Suggestions errors point to an executable help command.
- Human and JSON paths agree.
- Existing structured error contracts do not regress.
Duplicate preflight
No exact open or closed issue was found for the literal default-hint placeholder.
Summary
Suggestions usage errors expose the internal literal placeholder
<cmd>instead of an executable help command. The defect appears in both human and structured JSON errors.Environment
origin/main:c642bc4c3dda4ef659df8e6b699e10f61da3c836cdidx v1.44.3, locally builtReproduction
Human output:
Structured output:
{ "message": "suggestions show requires an id.", "hint": "Run '<cmd> --help' for usage information." }The same placeholder also appears in option-compatibility errors such as using
--actoroutsidesuggestions update.Expected behavior
Use the nearest executable help surface, for example:
If command identity is unavailable, fall back truthfully to
cdidx --help.Root cause
src/CodeIndex/Cli/CommandErrorWriter.cs:9definesDefaultHintas the final literalRun '<cmd> --help' for usage information.Focused PR scope
One PR should:
Non-goals
Implementation guidance and cautions
Required tests
<cmd>.Acceptance criteria
<cmd>.Duplicate preflight
No exact open or closed issue was found for the literal default-hint placeholder.