mirror of
https://github.com/instructkr/claude-code.git
synced 2026-06-02 10:46:45 +00:00
Compare commits
5 Commits
061e1e949b
...
fix/mcp-ok
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eee6f43ebf | ||
|
|
64f92b1560 | ||
|
|
caeac828b5 | ||
|
|
85435ad4b5 | ||
|
|
5eb4b8a944 |
@@ -877,13 +877,17 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
|
|||||||
// `missing Anthropic credentials` even though the command is purely
|
// `missing Anthropic credentials` even though the command is purely
|
||||||
// local introspection. Mirror `agents`/`mcp`/`skills`: action is the
|
// local introspection. Mirror `agents`/`mcp`/`skills`: action is the
|
||||||
// first positional arg, target is the second.
|
// first positional arg, target is the second.
|
||||||
"plugins" => {
|
// `plugin` (singular) and `marketplace` are aliases for `plugins`.
|
||||||
|
// All three must route to the same local handler so that no form
|
||||||
|
// falls through to the LLM/prompt path.
|
||||||
|
"plugins" | "plugin" | "marketplace" => {
|
||||||
let tail = &rest[1..];
|
let tail = &rest[1..];
|
||||||
let action = tail.first().cloned();
|
let action = tail.first().cloned();
|
||||||
let target = tail.get(1).cloned();
|
let target = tail.get(1).cloned();
|
||||||
if tail.len() > 2 {
|
if tail.len() > 2 {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"unexpected extra arguments after `claw plugins {}`: {}",
|
"unexpected extra arguments after `claw {} {}`: {}",
|
||||||
|
rest[0],
|
||||||
tail[..2].join(" "),
|
tail[..2].join(" "),
|
||||||
tail[2..].join(" ")
|
tail[2..].join(" ")
|
||||||
));
|
));
|
||||||
@@ -926,6 +930,14 @@ fn parse_args(args: &[String]) -> Result<CliAction, String> {
|
|||||||
}
|
}
|
||||||
Ok(CliAction::Diff { output_format })
|
Ok(CliAction::Diff { output_format })
|
||||||
}
|
}
|
||||||
|
// `claw permissions <mode>` falls through to the LLM when called
|
||||||
|
// with a subcommand argument because parse_single_word_command_alias
|
||||||
|
// only intercepts the bare single-word form. Catch all multi-word
|
||||||
|
// forms here and return a structured guidance error so no network
|
||||||
|
// call or session is created.
|
||||||
|
"permissions" => Err(format!(
|
||||||
|
"`claw permissions` is a slash command. Start `claw` and run `/permissions` inside the REPL.\n Usage /permissions [read-only|workspace-write|danger-full-access]"
|
||||||
|
)),
|
||||||
"skills" => {
|
"skills" => {
|
||||||
let args = join_optional_args(&rest[1..]);
|
let args = join_optional_args(&rest[1..]);
|
||||||
match classify_skills_slash_command(args.as_deref()) {
|
match classify_skills_slash_command(args.as_deref()) {
|
||||||
@@ -5095,10 +5107,17 @@ impl LiveCli {
|
|||||||
let cwd = env::current_dir()?;
|
let cwd = env::current_dir()?;
|
||||||
match output_format {
|
match output_format {
|
||||||
CliOutputFormat::Text => println!("{}", handle_mcp_slash_command(args, &cwd)?),
|
CliOutputFormat::Text => println!("{}", handle_mcp_slash_command(args, &cwd)?),
|
||||||
CliOutputFormat::Json => println!(
|
CliOutputFormat::Json => {
|
||||||
"{}",
|
let value = handle_mcp_slash_command_json(args, &cwd)?;
|
||||||
serde_json::to_string_pretty(&handle_mcp_slash_command_json(args, &cwd)?)?
|
// Propagate ok:false → non-zero exit so automation callers
|
||||||
),
|
// can rely on exit code instead of inspecting the envelope.
|
||||||
|
// (#68: mcp error envelopes previously always exited 0.)
|
||||||
|
let is_error = value.get("ok").and_then(|v| v.as_bool()) == Some(false);
|
||||||
|
println!("{}", serde_json::to_string_pretty(&value)?);
|
||||||
|
if is_error {
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
38
scripts/dogfood-build.sh
Executable file
38
scripts/dogfood-build.sh
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# dogfood-build.sh — Build claw from current checkout and verify provenance.
|
||||||
|
# Usage: bash scripts/dogfood-build.sh
|
||||||
|
# On success: prints the verified binary path. Use as:
|
||||||
|
# CLAW=$(bash scripts/dogfood-build.sh) && $CLAW version --output-format json
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
RUST_DIR="$REPO_ROOT/rust"
|
||||||
|
BINARY="$RUST_DIR/target/debug/claw"
|
||||||
|
EXPECTED_SHA="$(git -C "$REPO_ROOT" rev-parse --short HEAD)"
|
||||||
|
|
||||||
|
echo "▶ Building claw from $REPO_ROOT ($(git -C "$REPO_ROOT" log --oneline -1))..." >&2
|
||||||
|
cargo build --manifest-path "$RUST_DIR/Cargo.toml" -p rusty-claude-cli -q
|
||||||
|
|
||||||
|
if [[ ! -x "$BINARY" ]]; then
|
||||||
|
echo "✗ Build succeeded but binary not found at $BINARY" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
BINARY_SHA=$("$BINARY" version --output-format json 2>/dev/null \
|
||||||
|
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('git_sha','null'))" 2>/dev/null || echo "null")
|
||||||
|
|
||||||
|
if [[ "$BINARY_SHA" == "null" || -z "$BINARY_SHA" ]]; then
|
||||||
|
echo "✗ Provenance check failed: binary reports git_sha: null" >&2
|
||||||
|
echo " Binary: $BINARY" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$BINARY_SHA" != "$EXPECTED_SHA" ]]; then
|
||||||
|
echo "✗ Provenance mismatch: binary=$BINARY_SHA, HEAD=$EXPECTED_SHA" >&2
|
||||||
|
echo " Rerun after 'git pull' or check for uncommitted changes." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✓ Binary verified: $BINARY_SHA == HEAD ($EXPECTED_SHA)" >&2
|
||||||
|
echo " To dogfood: export CLAW=$BINARY" >&2
|
||||||
|
echo "$BINARY"
|
||||||
Reference in New Issue
Block a user