mirror of
https://github.com/instructkr/claw-code.git
synced 2026-10-14 00:00:19 +08:00
Compare commits
1
Commits
main
...
lane/gjc-s32
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7129954d22 |
@@ -198,6 +198,13 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
||||
argument_hint: Some("[task]"),
|
||||
resume_supported: false,
|
||||
},
|
||||
SlashCommandSpec {
|
||||
name: "ultragoal",
|
||||
aliases: &[],
|
||||
summary: "Start or manage a durable goal ledger with ultragoal workflow",
|
||||
argument_hint: Some("[op|args]"),
|
||||
resume_supported: false,
|
||||
},
|
||||
SlashCommandSpec {
|
||||
name: "teleport",
|
||||
aliases: &[],
|
||||
@@ -212,6 +219,20 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
||||
argument_hint: None,
|
||||
resume_supported: false,
|
||||
},
|
||||
SlashCommandSpec {
|
||||
name: "dump",
|
||||
aliases: &[],
|
||||
summary: "Dump debugging information for the current session",
|
||||
argument_hint: Some("[scope]"),
|
||||
resume_supported: true,
|
||||
},
|
||||
SlashCommandSpec {
|
||||
name: "trace",
|
||||
aliases: &[],
|
||||
summary: "Enable or disable execution tracing",
|
||||
argument_hint: Some("[on|off]"),
|
||||
resume_supported: true,
|
||||
},
|
||||
SlashCommandSpec {
|
||||
name: "export",
|
||||
aliases: &[],
|
||||
@@ -1063,10 +1084,19 @@ pub enum SlashCommand {
|
||||
Ultraplan {
|
||||
task: Option<String>,
|
||||
},
|
||||
Ultragoal {
|
||||
args: Option<String>,
|
||||
},
|
||||
Teleport {
|
||||
target: Option<String>,
|
||||
},
|
||||
DebugToolCall,
|
||||
Dump {
|
||||
scope: Option<String>,
|
||||
},
|
||||
Trace {
|
||||
mode: Option<String>,
|
||||
},
|
||||
Model {
|
||||
model: Option<String>,
|
||||
},
|
||||
@@ -1248,8 +1278,11 @@ impl SlashCommand {
|
||||
Self::Init => "/init",
|
||||
Self::Bughunter { .. } => "/bughunter",
|
||||
Self::Ultraplan { .. } => "/ultraplan",
|
||||
Self::Ultragoal { .. } => "/ultragoal",
|
||||
Self::Teleport { .. } => "/teleport",
|
||||
Self::DebugToolCall { .. } => "/debug-tool-call",
|
||||
Self::Dump { .. } => "/dump",
|
||||
Self::Trace { .. } => "/trace",
|
||||
Self::Resume { .. } => "/resume",
|
||||
Self::Model { .. } => "/model",
|
||||
Self::Permissions { .. } => "/permissions",
|
||||
@@ -1349,6 +1382,7 @@ pub fn validate_slash_command_input(
|
||||
"pr" => SlashCommand::Pr { context: remainder },
|
||||
"issue" => SlashCommand::Issue { context: remainder },
|
||||
"ultraplan" => SlashCommand::Ultraplan { task: remainder },
|
||||
"ultragoal" => SlashCommand::Ultragoal { args: remainder },
|
||||
"teleport" => SlashCommand::Teleport {
|
||||
target: Some(require_remainder(command, remainder, "<symbol-or-path>")?),
|
||||
},
|
||||
@@ -1356,6 +1390,12 @@ pub fn validate_slash_command_input(
|
||||
validate_no_args(command, &args)?;
|
||||
SlashCommand::DebugToolCall
|
||||
}
|
||||
"dump" => SlashCommand::Dump {
|
||||
scope: optional_single_arg(command, &args, "[scope]")?,
|
||||
},
|
||||
"trace" => SlashCommand::Trace {
|
||||
mode: optional_single_arg(command, &args, "[on|off]")?,
|
||||
},
|
||||
"model" => SlashCommand::Model {
|
||||
model: optional_single_arg(command, &args, "[model]")?,
|
||||
},
|
||||
@@ -5340,8 +5380,11 @@ pub fn handle_slash_command(
|
||||
| SlashCommand::Pr { .. }
|
||||
| SlashCommand::Issue { .. }
|
||||
| SlashCommand::Ultraplan { .. }
|
||||
| SlashCommand::Ultragoal { .. }
|
||||
| SlashCommand::Teleport { .. }
|
||||
| SlashCommand::DebugToolCall
|
||||
| SlashCommand::Dump { .. }
|
||||
| SlashCommand::Trace { .. }
|
||||
| SlashCommand::Sandbox
|
||||
| SlashCommand::Model { .. }
|
||||
| SlashCommand::Permissions { .. }
|
||||
@@ -5579,6 +5622,36 @@ mod tests {
|
||||
SlashCommand::parse("/debug-tool-call"),
|
||||
Ok(Some(SlashCommand::DebugToolCall))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/dump"),
|
||||
Ok(Some(SlashCommand::Dump { scope: None }))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/dump session"),
|
||||
Ok(Some(SlashCommand::Dump {
|
||||
scope: Some("session".to_string())
|
||||
}))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/trace"),
|
||||
Ok(Some(SlashCommand::Trace { mode: None }))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/trace on"),
|
||||
Ok(Some(SlashCommand::Trace {
|
||||
mode: Some("on".to_string())
|
||||
}))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/ultragoal"),
|
||||
Ok(Some(SlashCommand::Ultragoal { args: None }))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/ultragoal create my-goal"),
|
||||
Ok(Some(SlashCommand::Ultragoal {
|
||||
args: Some("create my-goal".to_string())
|
||||
}))
|
||||
);
|
||||
assert_eq!(
|
||||
SlashCommand::parse("/bughunter runtime"),
|
||||
Ok(Some(SlashCommand::Bughunter {
|
||||
@@ -6020,7 +6093,10 @@ mod tests {
|
||||
assert!(!help.contains("/login"));
|
||||
assert!(!help.contains("/logout"));
|
||||
assert!(help.contains("/setup"));
|
||||
assert_eq!(slash_command_specs().len(), 140);
|
||||
assert!(help.contains("/ultragoal [op|args]"));
|
||||
assert!(help.contains("/dump [scope]"));
|
||||
assert!(help.contains("/trace [on|off]"));
|
||||
assert_eq!(slash_command_specs().len(), 143);
|
||||
assert!(resume_supported_slash_commands().len() >= 39);
|
||||
}
|
||||
|
||||
|
||||
@@ -6989,8 +6989,11 @@ fn run_resume_command(
|
||||
| SlashCommand::Pr { .. }
|
||||
| SlashCommand::Issue { .. }
|
||||
| SlashCommand::Ultraplan { .. }
|
||||
| SlashCommand::Ultragoal { .. }
|
||||
| SlashCommand::Teleport { .. }
|
||||
| SlashCommand::DebugToolCall { .. }
|
||||
| SlashCommand::Dump { .. }
|
||||
| SlashCommand::Trace { .. }
|
||||
| SlashCommand::Resume { .. }
|
||||
| SlashCommand::Permissions { .. }
|
||||
| SlashCommand::Login
|
||||
@@ -8231,6 +8234,10 @@ impl LiveCli {
|
||||
self.run_ultraplan(task.as_deref())?;
|
||||
false
|
||||
}
|
||||
SlashCommand::Ultragoal { args } => {
|
||||
self.run_ultragoal(args.as_deref())?;
|
||||
false
|
||||
}
|
||||
SlashCommand::Teleport { target } => {
|
||||
Self::run_teleport(target.as_deref())?;
|
||||
false
|
||||
@@ -8239,6 +8246,14 @@ impl LiveCli {
|
||||
self.run_debug_tool_call(None)?;
|
||||
false
|
||||
}
|
||||
SlashCommand::Dump { scope } => {
|
||||
self.run_dump(scope.as_deref())?;
|
||||
false
|
||||
}
|
||||
SlashCommand::Trace { mode } => {
|
||||
self.run_trace(mode.as_deref())?;
|
||||
false
|
||||
}
|
||||
SlashCommand::Sandbox => {
|
||||
Self::print_sandbox_status();
|
||||
false
|
||||
@@ -9260,6 +9275,21 @@ impl LiveCli {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_ultragoal(&self, args: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("{}", format_ultragoal_report(args));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_dump(&self, scope: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("{}", format_dump_report(scope));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_trace(&self, mode: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("{}", format_trace_report(mode));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_commit(&mut self, args: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||
validate_no_args("/commit", args)?;
|
||||
let status = git_output(&["status", "--short", "--branch"])?;
|
||||
@@ -11620,6 +11650,36 @@ fn format_ultraplan_report(task: Option<&str>) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
fn format_ultragoal_report(args: Option<&str>) -> String {
|
||||
format!(
|
||||
"Ultragoal
|
||||
Args {}
|
||||
Action start or manage a durable goal ledger with ultragoal workflow
|
||||
Output goal ledger state and operations on the goal tracking system",
|
||||
args.unwrap_or("none")
|
||||
)
|
||||
}
|
||||
|
||||
fn format_dump_report(scope: Option<&str>) -> String {
|
||||
format!(
|
||||
"Dump
|
||||
Scope {}
|
||||
Action dump debugging information for the current session
|
||||
Output session state, messages, and internal debugging data",
|
||||
scope.unwrap_or("session")
|
||||
)
|
||||
}
|
||||
|
||||
fn format_trace_report(mode: Option<&str>) -> String {
|
||||
format!(
|
||||
"Trace
|
||||
Mode {}
|
||||
Action enable or disable execution tracing
|
||||
Output execution trace information or confirmation of trace state",
|
||||
mode.unwrap_or("current state")
|
||||
)
|
||||
}
|
||||
|
||||
fn format_pr_report(branch: &str, context: Option<&str>) -> String {
|
||||
format!(
|
||||
"PR
|
||||
|
||||
Reference in New Issue
Block a user