mirror of
https://github.com/instructkr/claw-code.git
synced 2026-11-21 00:00:00 +08:00
Compare commits
1
Commits
v0.1.12
...
lane/gjc-s32
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7129954d22 |
No files matched your search
@@ -198,6 +198,13 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
|||||||
argument_hint: Some("[task]"),
|
argument_hint: Some("[task]"),
|
||||||
resume_supported: false,
|
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 {
|
SlashCommandSpec {
|
||||||
name: "teleport",
|
name: "teleport",
|
||||||
aliases: &[],
|
aliases: &[],
|
||||||
@@ -212,6 +219,20 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
|||||||
argument_hint: None,
|
argument_hint: None,
|
||||||
resume_supported: false,
|
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 {
|
SlashCommandSpec {
|
||||||
name: "export",
|
name: "export",
|
||||||
aliases: &[],
|
aliases: &[],
|
||||||
@@ -1063,10 +1084,19 @@ pub enum SlashCommand {
|
|||||||
Ultraplan {
|
Ultraplan {
|
||||||
task: Option<String>,
|
task: Option<String>,
|
||||||
},
|
},
|
||||||
|
Ultragoal {
|
||||||
|
args: Option<String>,
|
||||||
|
},
|
||||||
Teleport {
|
Teleport {
|
||||||
target: Option<String>,
|
target: Option<String>,
|
||||||
},
|
},
|
||||||
DebugToolCall,
|
DebugToolCall,
|
||||||
|
Dump {
|
||||||
|
scope: Option<String>,
|
||||||
|
},
|
||||||
|
Trace {
|
||||||
|
mode: Option<String>,
|
||||||
|
},
|
||||||
Model {
|
Model {
|
||||||
model: Option<String>,
|
model: Option<String>,
|
||||||
},
|
},
|
||||||
@@ -1248,8 +1278,11 @@ impl SlashCommand {
|
|||||||
Self::Init => "/init",
|
Self::Init => "/init",
|
||||||
Self::Bughunter { .. } => "/bughunter",
|
Self::Bughunter { .. } => "/bughunter",
|
||||||
Self::Ultraplan { .. } => "/ultraplan",
|
Self::Ultraplan { .. } => "/ultraplan",
|
||||||
|
Self::Ultragoal { .. } => "/ultragoal",
|
||||||
Self::Teleport { .. } => "/teleport",
|
Self::Teleport { .. } => "/teleport",
|
||||||
Self::DebugToolCall { .. } => "/debug-tool-call",
|
Self::DebugToolCall { .. } => "/debug-tool-call",
|
||||||
|
Self::Dump { .. } => "/dump",
|
||||||
|
Self::Trace { .. } => "/trace",
|
||||||
Self::Resume { .. } => "/resume",
|
Self::Resume { .. } => "/resume",
|
||||||
Self::Model { .. } => "/model",
|
Self::Model { .. } => "/model",
|
||||||
Self::Permissions { .. } => "/permissions",
|
Self::Permissions { .. } => "/permissions",
|
||||||
@@ -1349,6 +1382,7 @@ pub fn validate_slash_command_input(
|
|||||||
"pr" => SlashCommand::Pr { context: remainder },
|
"pr" => SlashCommand::Pr { context: remainder },
|
||||||
"issue" => SlashCommand::Issue { context: remainder },
|
"issue" => SlashCommand::Issue { context: remainder },
|
||||||
"ultraplan" => SlashCommand::Ultraplan { task: remainder },
|
"ultraplan" => SlashCommand::Ultraplan { task: remainder },
|
||||||
|
"ultragoal" => SlashCommand::Ultragoal { args: remainder },
|
||||||
"teleport" => SlashCommand::Teleport {
|
"teleport" => SlashCommand::Teleport {
|
||||||
target: Some(require_remainder(command, remainder, "<symbol-or-path>")?),
|
target: Some(require_remainder(command, remainder, "<symbol-or-path>")?),
|
||||||
},
|
},
|
||||||
@@ -1356,6 +1390,12 @@ pub fn validate_slash_command_input(
|
|||||||
validate_no_args(command, &args)?;
|
validate_no_args(command, &args)?;
|
||||||
SlashCommand::DebugToolCall
|
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" => SlashCommand::Model {
|
||||||
model: optional_single_arg(command, &args, "[model]")?,
|
model: optional_single_arg(command, &args, "[model]")?,
|
||||||
},
|
},
|
||||||
@@ -5340,8 +5380,11 @@ pub fn handle_slash_command(
|
|||||||
| SlashCommand::Pr { .. }
|
| SlashCommand::Pr { .. }
|
||||||
| SlashCommand::Issue { .. }
|
| SlashCommand::Issue { .. }
|
||||||
| SlashCommand::Ultraplan { .. }
|
| SlashCommand::Ultraplan { .. }
|
||||||
|
| SlashCommand::Ultragoal { .. }
|
||||||
| SlashCommand::Teleport { .. }
|
| SlashCommand::Teleport { .. }
|
||||||
| SlashCommand::DebugToolCall
|
| SlashCommand::DebugToolCall
|
||||||
|
| SlashCommand::Dump { .. }
|
||||||
|
| SlashCommand::Trace { .. }
|
||||||
| SlashCommand::Sandbox
|
| SlashCommand::Sandbox
|
||||||
| SlashCommand::Model { .. }
|
| SlashCommand::Model { .. }
|
||||||
| SlashCommand::Permissions { .. }
|
| SlashCommand::Permissions { .. }
|
||||||
@@ -5579,6 +5622,36 @@ mod tests {
|
|||||||
SlashCommand::parse("/debug-tool-call"),
|
SlashCommand::parse("/debug-tool-call"),
|
||||||
Ok(Some(SlashCommand::DebugToolCall))
|
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!(
|
assert_eq!(
|
||||||
SlashCommand::parse("/bughunter runtime"),
|
SlashCommand::parse("/bughunter runtime"),
|
||||||
Ok(Some(SlashCommand::Bughunter {
|
Ok(Some(SlashCommand::Bughunter {
|
||||||
@@ -6020,7 +6093,10 @@ mod tests {
|
|||||||
assert!(!help.contains("/login"));
|
assert!(!help.contains("/login"));
|
||||||
assert!(!help.contains("/logout"));
|
assert!(!help.contains("/logout"));
|
||||||
assert!(help.contains("/setup"));
|
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);
|
assert!(resume_supported_slash_commands().len() >= 39);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6989,8 +6989,11 @@ fn run_resume_command(
|
|||||||
| SlashCommand::Pr { .. }
|
| SlashCommand::Pr { .. }
|
||||||
| SlashCommand::Issue { .. }
|
| SlashCommand::Issue { .. }
|
||||||
| SlashCommand::Ultraplan { .. }
|
| SlashCommand::Ultraplan { .. }
|
||||||
|
| SlashCommand::Ultragoal { .. }
|
||||||
| SlashCommand::Teleport { .. }
|
| SlashCommand::Teleport { .. }
|
||||||
| SlashCommand::DebugToolCall { .. }
|
| SlashCommand::DebugToolCall { .. }
|
||||||
|
| SlashCommand::Dump { .. }
|
||||||
|
| SlashCommand::Trace { .. }
|
||||||
| SlashCommand::Resume { .. }
|
| SlashCommand::Resume { .. }
|
||||||
| SlashCommand::Permissions { .. }
|
| SlashCommand::Permissions { .. }
|
||||||
| SlashCommand::Login
|
| SlashCommand::Login
|
||||||
@@ -8231,6 +8234,10 @@ impl LiveCli {
|
|||||||
self.run_ultraplan(task.as_deref())?;
|
self.run_ultraplan(task.as_deref())?;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
SlashCommand::Ultragoal { args } => {
|
||||||
|
self.run_ultragoal(args.as_deref())?;
|
||||||
|
false
|
||||||
|
}
|
||||||
SlashCommand::Teleport { target } => {
|
SlashCommand::Teleport { target } => {
|
||||||
Self::run_teleport(target.as_deref())?;
|
Self::run_teleport(target.as_deref())?;
|
||||||
false
|
false
|
||||||
@@ -8239,6 +8246,14 @@ impl LiveCli {
|
|||||||
self.run_debug_tool_call(None)?;
|
self.run_debug_tool_call(None)?;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
SlashCommand::Dump { scope } => {
|
||||||
|
self.run_dump(scope.as_deref())?;
|
||||||
|
false
|
||||||
|
}
|
||||||
|
SlashCommand::Trace { mode } => {
|
||||||
|
self.run_trace(mode.as_deref())?;
|
||||||
|
false
|
||||||
|
}
|
||||||
SlashCommand::Sandbox => {
|
SlashCommand::Sandbox => {
|
||||||
Self::print_sandbox_status();
|
Self::print_sandbox_status();
|
||||||
false
|
false
|
||||||
@@ -9260,6 +9275,21 @@ impl LiveCli {
|
|||||||
Ok(())
|
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>> {
|
fn run_commit(&mut self, args: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
validate_no_args("/commit", args)?;
|
validate_no_args("/commit", args)?;
|
||||||
let status = git_output(&["status", "--short", "--branch"])?;
|
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 {
|
fn format_pr_report(branch: &str, context: Option<&str>) -> String {
|
||||||
format!(
|
format!(
|
||||||
"PR
|
"PR
|
||||||
|
|||||||
Reference in new issue
Block a user