fix(cli): surface resolved path in dump-manifests error — ROADMAP #45 partial

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.
This commit is contained in:
YeonGyu-Kim
2026-04-10 01:01:53 +09:00
parent 47aa1a57ca
commit d95149b347
2 changed files with 13 additions and 2 deletions

View File

@@ -1933,6 +1933,13 @@ fn looks_like_slash_command_token(token: &str) -> bool {
fn dump_manifests(output_format: CliOutputFormat) -> Result<(), Box<dyn std::error::Error>> {
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<dyn std::err
}
Ok(())
}
Err(error) => Err(format!("failed to extract manifests: {error}").into()),
Err(error) => Err(format!(
"failed to extract manifests: {error}\n looked in: {}",
resolved.display()
)
.into()),
}
}