From d95149b3477deff6c503f47e483e2ba92165d815 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 10 Apr 2026 01:01:53 +0900 Subject: [PATCH] =?UTF-8?q?fix(cli):=20surface=20resolved=20path=20in=20du?= =?UTF-8?q?mp-manifests=20error=20=E2=80=94=20ROADMAP=20#45=20partial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: error: failed to extract manifests: No such file or directory (os error 2) After: error: failed to extract manifests: No such file or directory (os error 2) looked in: /Users/yeongyu/clawd/claw-code/rust The workspace_dir is computed from CARGO_MANIFEST_DIR at compile time and only resolves correctly when running from the build tree. Surfacing the resolved path lets users understand immediately why it fails outside the build context. ROADMAP #45 root cause (build-tree-only path) remains open. --- ROADMAP.md | 2 +- rust/crates/rusty-claude-cli/src/main.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index d75e727..ffa2eb2 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -515,7 +515,7 @@ Model name prefix now wins unconditionally over env-var presence. Regression tes 44. **Broad-CWD guardrail is warning-only; needs policy-level enforcement** — dogfooded 2026-04-09. `5f6f453` added a stderr warning when claw starts from `$HOME` or filesystem root (live user kapcomunica scanned their whole machine). Warning is a mitigation, not a guardrail: the agent still proceeds with unbounded scope. Follow-up fix shape: (a) add `--allow-broad-cwd` flag to suppress the warning explicitly (for legitimate home-dir use cases); (b) in default interactive mode, prompt "You are running from your home directory — continue? [y/N]" and exit unless confirmed; (c) in `--output-format json` or piped mode, treat broad-CWD as a hard error (exit 1) with `{"type":"error","error":"broad CWD: running from home directory requires --allow-broad-cwd"}`. Source: kapcomunica in #claw-code 2026-04-09; gaebal-gajae ROADMAP note same cycle. -45. **`claw dump-manifests` fails with opaque "No such file or directory"** — dogfooded 2026-04-09. `claw dump-manifests` emits `error: failed to extract manifests: No such file or directory (os error 2)` with no indication of which file or directory is missing, what manifests are, or how to fix it. Fix shape: (a) surface the missing path in the error message; (b) add a pre-check that explains what manifests are and where they should be (e.g. `.claw/manifests/` or the plugins directory); (c) if the command is only valid after `claw init` or after installing plugins, say so explicitly. Source: Jobdori dogfood 2026-04-09. +45. **`claw dump-manifests` fails with opaque "No such file or directory"** — dogfooded 2026-04-09. `claw dump-manifests` emits `error: failed to extract manifests: No such file or directory (os error 2)` with no indication of which file or directory is missing. **Partial fix at `47aa1a5`+1**: error message now includes `looked in: ` so the build-tree path is visible, what manifests are, or how to fix it. Fix shape: (a) surface the missing path in the error message; (b) add a pre-check that explains what manifests are and where they should be (e.g. `.claw/manifests/` or the plugins directory); (c) if the command is only valid after `claw init` or after installing plugins, say so explicitly. Source: Jobdori dogfood 2026-04-09. 46. **`/tokens`, `/cache`, `/stats` were dead spec — parse arms missing** — dogfooded 2026-04-09. All three had spec entries with `resume_supported: true` but no parse arms, producing the circular error "Unknown slash command: /tokens — Did you mean /tokens". Also `SlashCommand::Stats` existed but was unimplemented in both REPL and resume dispatch. **Done at `60ec2ae` 2026-04-09**: `"tokens" | "cache"` now alias to `SlashCommand::Stats`; `Stats` is wired in both REPL and resume path with full JSON output. Source: Jobdori dogfood 2026-04-09. diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 22b12ea..3b875ee 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -1933,6 +1933,13 @@ fn looks_like_slash_command_token(token: &str) -> bool { fn dump_manifests(output_format: CliOutputFormat) -> Result<(), Box> { let workspace_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../.."); + // Surface the resolved path in the error so users can diagnose missing + // manifest files without guessing what path the binary expected. + // ROADMAP #45: this path is only correct when running from the build tree; + // a proper fix would ship manifests alongside the binary. + let resolved = workspace_dir + .canonicalize() + .unwrap_or_else(|_| workspace_dir.clone()); let paths = UpstreamPaths::from_workspace_dir(&workspace_dir); match extract_manifest(&paths) { Ok(manifest) => { @@ -1954,7 +1961,11 @@ fn dump_manifests(output_format: CliOutputFormat) -> Result<(), Box Err(format!("failed to extract manifests: {error}").into()), + Err(error) => Err(format!( + "failed to extract manifests: {error}\n looked in: {}", + resolved.display() + ) + .into()), } }