Skip to content

Commit ac925ed

Browse files
committed
fix(#750): claw prompt (no arg) now emits error_kind:missing_prompt with non-null hint
1 parent 2dfb7af commit ac925ed

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7665,3 +7665,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
76657665
748. **`claw mcp bogussubcmd --output-format json` returned `error_kind: null` when an unknown subcommand was passed — `render_mcp_usage_json(Some("bogus"))` set `status:"error"` but left `error_kind` absent — while `agents bogussubcmd` emits `error_kind:"unknown_agents_subcommand"`** — dogfooded 2026-05-26 on `04eb661e`. Fix: add `error_kind: "unknown_mcp_action"` to `render_mcp_usage_json` when `unexpected.is_some()`; remains `null` for the `help` path (`unexpected: null`). Source: Jobdori dogfood on `04eb661e`, 2026-05-26.
76667666

76677667
749. **`claw compact --output-format json` returned `hint: null` — `compact_interactive_only_error()` returned a single-line string with no `\n` between short error and remediation text, so `split_error_hint` couldn't populate the hint field** — identified by gaebal-gajae on `04eb661e`. Same class as #738 / #745 / #746. Fix: add `\n` before the remediation text in `compact_interactive_only_error`. Regression guard: extended `compact_subcommand_json_help_fails_fast_when_stdin_closed` to also assert `hint` is non-empty and mentions `/compact` or `--resume`. Source: gaebal-gajae dogfood on `04eb661e`, 2026-05-26.
7668+
7669+
750. **`claw prompt --output-format json` (no text argument) returned `error_kind:"unknown"` and `hint: null`** — dogfooded 2026-05-26 on `2dfb7af6`. The error string `"prompt subcommand requires a prompt string"` had no prefix prefix for classifier and no `\n` for hint extraction. Fix: (a) prefix with `"missing_prompt: "` + newline before usage hint; (b) add `message.starts_with("missing_prompt:")` → `"missing_prompt"` classifier arm. Result: `error_kind:"missing_prompt"`, `hint:"Usage: claw prompt <text> or echo '<text>' | claw"`. Source: Jobdori dogfood on `2dfb7af6`, 2026-05-26.

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ fn classify_error_kind(message: &str) -> &'static str {
316316
"unsupported_config_section"
317317
} else if message.contains("unknown_plugins_action") {
318318
"unknown_plugins_action"
319+
} else if message.starts_with("missing_prompt:") {
320+
"missing_prompt"
319321
} else if message.contains("is a slash command")
320322
|| message.starts_with("interactive_only:")
321323
// #735: "slash command /X is interactive-only" emitted by interactive-only guard
@@ -1147,7 +1149,8 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
11471149
"prompt" => {
11481150
let prompt = rest[1..].join(" ");
11491151
if prompt.trim().is_empty() {
1150-
return Err("prompt subcommand requires a prompt string".to_string());
1152+
// #750: provide error_kind-compatible prefix + \n for hint extraction
1153+
return Err("missing_prompt: prompt subcommand requires a prompt string.\nUsage: claw prompt <text> or echo '<text>' | claw".to_string());
11511154
}
11521155
Ok(CliAction::Prompt {
11531156
prompt,

0 commit comments

Comments
 (0)