Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions rust/crates/commands/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3627,6 +3627,7 @@ fn render_agents_report_json(cwd: &Path, agents: &[AgentSummary]) -> Value {
"kind": "agents",
"status": "ok",
"action": "list",
"status": "ok",
"working_directory": cwd.display().to_string(),
"count": agents.len(),
"summary": {
Expand Down Expand Up @@ -3710,6 +3711,7 @@ fn render_skills_report_json(skills: &[SkillSummary]) -> Value {
"kind": "skills",
"status": "ok",
"action": "list",
"status": "ok",
"summary": {
"total": skills.len(),
"active": active,
Expand Down Expand Up @@ -3744,6 +3746,7 @@ fn render_skill_install_report_json(skill: &InstalledSkill) -> Value {
json!({
"kind": "skills",
"action": "install",
"status": "ok",
"result": "installed",
"invocation_name": &skill.invocation_name,
"invoke_as": format!("${}", skill.invocation_name),
Expand Down Expand Up @@ -5312,6 +5315,7 @@ mod tests {

assert_eq!(report["kind"], "agents");
assert_eq!(report["action"], "list");
assert_eq!(report["status"], "ok");
assert_eq!(report["working_directory"], workspace.display().to_string());
assert_eq!(report["count"], 3);
assert_eq!(report["summary"]["active"], 2);
Expand All @@ -5327,6 +5331,7 @@ mod tests {
let help = handle_agents_slash_command_json(Some("help"), &workspace).expect("agents help");
assert_eq!(help["kind"], "agents");
assert_eq!(help["action"], "help");
assert_eq!(help["status"], "ok");
assert_eq!(help["usage"]["direct_cli"], "claw agents [list|help]");

// Unknown agents subcommands now return Err so CLI layer can exit 1.
Expand Down Expand Up @@ -5441,6 +5446,7 @@ mod tests {
);
assert_eq!(report["kind"], "skills");
assert_eq!(report["action"], "list");
assert_eq!(report["status"], "ok");
assert_eq!(report["summary"]["active"], 3);
assert_eq!(report["summary"]["shadowed"], 1);
assert_eq!(report["skills"][0]["name"], "plan");
Expand All @@ -5452,6 +5458,7 @@ mod tests {
let help = handle_skills_slash_command_json(Some("help"), &workspace).expect("skills help");
assert_eq!(help["kind"], "skills");
assert_eq!(help["action"], "help");
assert_eq!(help["status"], "ok");
assert_eq!(help["usage"]["aliases"][0], "/skill");
assert_eq!(
help["usage"]["direct_cli"],
Expand Down Expand Up @@ -5516,6 +5523,7 @@ mod tests {
let sources = skills_help_json["usage"]["sources"]
.as_array()
.expect("skills help sources");
assert_eq!(skills_help_json["status"], "ok");
assert_eq!(skills_help_json["usage"]["aliases"][0], "/skill");
assert!(sources.iter().any(|value| value == ".omc/skills"));
assert!(sources.iter().any(|value| value == ".agents/skills"));
Expand Down Expand Up @@ -5901,6 +5909,13 @@ mod tests {
assert!(report.contains("Invoke as $help"));
assert!(report.contains(&install_root.display().to_string()));

let json_report = super::render_skill_install_report_json(&installed);
assert_eq!(json_report["kind"], "skills");
assert_eq!(json_report["action"], "install");
assert_eq!(json_report["status"], "ok");
assert_eq!(json_report["invocation_name"], "help");
assert_eq!(json_report["invoke_as"], "$help");

let roots = vec![SkillRoot {
source: DefinitionSource::UserCodexHome,
path: install_root.clone(),
Expand Down
Loading