mirror of
https://github.com/instructkr/claude-code.git
synced 2026-05-28 16:36:45 +00:00
fix(#779): resumed /skills invocation returns interactive_only error_kind + non-null hint
This commit is contained in:
@@ -4512,9 +4512,12 @@ fn run_resume_command(
|
||||
}
|
||||
SlashCommand::Skills { args } => {
|
||||
if let SkillSlashDispatch::Invoke(_) = classify_skills_slash_command(args.as_deref()) {
|
||||
return Err(
|
||||
"resumed /skills invocations are interactive-only; start `claw` and run `/skills <skill>` in the REPL".into(),
|
||||
);
|
||||
// #779: use interactive_only: prefix + \n hint so #776 classify/split emits
|
||||
// error_kind:interactive_only + non-null hint instead of unknown+null.
|
||||
let skill_name = args.as_deref().unwrap_or("<skill>");
|
||||
return Err(format!(
|
||||
"interactive_only: /skills {skill_name} invocation requires a live session.\nStart `claw` and run `/skills {skill_name}` inside the REPL, or use `claw -p <prompt>` with skill context."
|
||||
).into());
|
||||
}
|
||||
let cwd = env::current_dir()?;
|
||||
Ok(ResumeCommandOutcome {
|
||||
|
||||
@@ -2275,3 +2275,57 @@ fn resume_plugin_mutations_are_typed_interactive_only_777() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resume_skills_invocation_is_typed_interactive_only_779() {
|
||||
// #779: `/skills <skill>` invocation in resume mode returned bare prose;
|
||||
// after #776 classify/split it fell to error_kind:"unknown" + hint:null.
|
||||
// Fix: use interactive_only: prefix + \n hint so callers get typed fields.
|
||||
let root = unique_temp_dir("resume-skills-invocation-779");
|
||||
fs::create_dir_all(&root).expect("temp dir should exist");
|
||||
std::process::Command::new("git")
|
||||
.args(["init", "-q"])
|
||||
.current_dir(&root)
|
||||
.output()
|
||||
.ok();
|
||||
let session_file = write_session_fixture(&root, "resume-skills-779", None);
|
||||
|
||||
// A non-empty skills arg that would classify as Invoke
|
||||
let output = run_claw(
|
||||
&root,
|
||||
&[
|
||||
"--resume",
|
||||
session_file.to_str().unwrap(),
|
||||
"--output-format",
|
||||
"json",
|
||||
"/skills my-skill",
|
||||
],
|
||||
&[],
|
||||
);
|
||||
assert!(
|
||||
!output.status.success(),
|
||||
"/skills <skill> in resume mode should exit non-zero"
|
||||
);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
let json_line = stderr
|
||||
.lines()
|
||||
.find(|l| l.trim_start().starts_with('{'))
|
||||
.unwrap_or_else(|| {
|
||||
panic!("/skills invocation should emit JSON error, got stderr: {stderr}")
|
||||
});
|
||||
let parsed: serde_json::Value = serde_json::from_str(json_line).unwrap();
|
||||
assert_eq!(
|
||||
parsed["error_kind"], "interactive_only",
|
||||
"resumed /skills invocation must return interactive_only, got {:?}",
|
||||
parsed["error_kind"]
|
||||
);
|
||||
let hint = parsed["hint"].as_str().unwrap_or("");
|
||||
assert!(
|
||||
!hint.is_empty(),
|
||||
"resumed /skills invocation must have non-null hint (#779)"
|
||||
);
|
||||
assert!(
|
||||
hint.contains("claw") || hint.contains("REPL") || hint.contains("skills"),
|
||||
"hint must reference live session or CLI, got: {hint:?}"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user