Skip to content

Commit 02d77ae

Browse files
committed
fix(#757): --permission-mode invalid and --allowedTools missing now emit typed error_kind and hint
1 parent 4df1461 commit 02d77ae

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7679,3 +7679,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
76797679
755. **`claw -p hello --model sonnet` swallowed `--model sonnet` into the prompt string** — gaebal-gajae pinpoint on `e9327135` (#117 revival). `-p` used `args[index+1..].join(" ")`, consuming all remaining tokens as prompt. Fix: capture exactly one token via `args.get(index+1)`, reject flag-like tokens (`starts_with('-')`) as `missing_prompt`, support `--` sentinel for literal flag-text, then `continue` the flag loop so `--model`/`--output-format`/etc. parse normally. Dispatch via `short_p_prompt` after full flag scan. Regression guard: `short_p_flag_swallows_no_flags_755` asserts `--output-format json` is parsed (not swallowed) and `--model` as prompt-arg is rejected. Source: gaebal-gajae dogfood on `e9327135`, 2026-05-26.
76807680

76817681
756. **`--reasoning-effort bogus`, `--model` (no value), and sibling missing/invalid flag-value errors all returned `error_kind:"unknown"` + `hint:null`** — gaebal-gajae pinpoint on `0e8a449e`. All `missing value for --X` and `invalid value for --reasoning-effort` error strings were single-line with no classifier arm. Fix: (a) prefix all with `missing_flag_value:` / `invalid_flag_value:` + `\n` usage hint; (b) add `message.starts_with("missing_flag_value:")` → `"missing_flag_value"` and `message.starts_with("invalid_flag_value:")` → `"invalid_flag_value"` classifier arms. Covers `--model`, `--output-format`, `--permission-mode`, `--base-commit`, `--reasoning-effort`. Regression guard: `flag_value_errors_have_error_kind_and_hint_756` — invalid `--reasoning-effort HIGH` → `invalid_flag_value` + hint with valid values; missing `--model` → `missing_flag_value` + non-null hint. Source: gaebal-gajae dogfood on `0e8a449e`, 2026-05-26.
7682+
7683+
757. **`--permission-mode bogus` and `--allowedTools` (no value) returned `error_kind:"unknown"` + `hint:null`** — dogfooded 2026-05-26 on `4df14618`. `parse_permission_mode_arg()` error format had no prefix and no `\n`; `--allowedTools` missing-value string was plain. Fix: prefix `parse_permission_mode_arg` error with `invalid_flag_value:` + `\n` valid-values hint (both call sites); prefix `--allowedTools` missing-value with `missing_flag_value:` + `\n` usage hint. Both now classified by existing `missing_flag_value`/`invalid_flag_value` arms added in #756. Source: Jobdori dogfood on `4df14618`, 2026-05-26.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
921921
"--allowedTools" | "--allowed-tools" => {
922922
let value = args
923923
.get(index + 1)
924-
.ok_or_else(|| "missing value for --allowedTools".to_string())?;
924+
.ok_or_else(|| "missing_flag_value: missing value for --allowedTools.\nUsage: --allowedTools <tool-name> e.g. --allowedTools Bash".to_string())?;
925925
allowed_tool_values.push(value.clone());
926926
index += 2;
927927
}
@@ -1851,7 +1851,7 @@ fn parse_permission_mode_arg(value: &str) -> Result<PermissionMode, String> {
18511851
normalize_permission_mode(value)
18521852
.ok_or_else(|| {
18531853
format!(
1854-
"unsupported permission mode '{value}'. Use read-only, workspace-write, or danger-full-access."
1854+
"invalid_flag_value: unsupported permission mode '{value}'.\nUsage: --permission-mode read-only|workspace-write|danger-full-access"
18551855
)
18561856
})
18571857
.map(permission_mode_from_label)
@@ -5954,7 +5954,7 @@ impl LiveCli {
59545954

59555955
let normalized = normalize_permission_mode(&mode).ok_or_else(|| {
59565956
format!(
5957-
"unsupported permission mode '{mode}'. Use read-only, workspace-write, or danger-full-access."
5957+
"invalid_flag_value: unsupported permission mode '{mode}'.\nUsage: --permission-mode read-only|workspace-write|danger-full-access"
59585958
)
59595959
})?;
59605960

0 commit comments

Comments
 (0)