mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-07 00:24:50 +08:00
fix: resolve merge conflicts between commands-parity and stub-commands branches
- Fix Commit/DebugToolCall variant mismatch (unit variants, not struct) - Apply cargo fmt
This commit is contained in:
@@ -1749,8 +1749,8 @@ impl LiveCli {
|
|||||||
self.run_bughunter(scope.as_deref())?;
|
self.run_bughunter(scope.as_deref())?;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
SlashCommand::Commit { args } => {
|
SlashCommand::Commit => {
|
||||||
self.run_commit(args.as_deref())?;
|
self.run_commit(None)?;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
SlashCommand::Pr { context } => {
|
SlashCommand::Pr { context } => {
|
||||||
@@ -1769,8 +1769,8 @@ impl LiveCli {
|
|||||||
self.run_teleport(target.as_deref())?;
|
self.run_teleport(target.as_deref())?;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
SlashCommand::DebugToolCall { args } => {
|
SlashCommand::DebugToolCall => {
|
||||||
self.run_debug_tool_call(args.as_deref())?;
|
self.run_debug_tool_call(None)?;
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
SlashCommand::Sandbox => {
|
SlashCommand::Sandbox => {
|
||||||
@@ -2272,10 +2272,7 @@ impl LiveCli {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_debug_tool_call(
|
fn run_debug_tool_call(&self, args: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
&self,
|
|
||||||
args: Option<&str>,
|
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
|
||||||
validate_no_args("/debug-tool-call", args)?;
|
validate_no_args("/debug-tool-call", args)?;
|
||||||
println!("{}", render_last_tool_debug_report(self.runtime.session())?);
|
println!("{}", render_last_tool_debug_report(self.runtime.session())?);
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -2291,12 +2288,16 @@ impl LiveCli {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("{}", format_commit_preflight_report(branch.as_deref(), summary));
|
println!(
|
||||||
|
"{}",
|
||||||
|
format_commit_preflight_report(branch.as_deref(), summary)
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_pr(&self, context: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
fn run_pr(&self, context: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let branch = resolve_git_branch_for(&env::current_dir()?).unwrap_or_else(|| "unknown".to_string());
|
let branch =
|
||||||
|
resolve_git_branch_for(&env::current_dir()?).unwrap_or_else(|| "unknown".to_string());
|
||||||
println!("{}", format_pr_report(&branch, context));
|
println!("{}", format_pr_report(&branch, context));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -3017,7 +3018,10 @@ fn indent_block(value: &str, spaces: usize) -> String {
|
|||||||
.join("\n")
|
.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_no_args(command_name: &str, args: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
|
fn validate_no_args(
|
||||||
|
command_name: &str,
|
||||||
|
args: Option<&str>,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if let Some(args) = args.map(str::trim).filter(|value| !value.is_empty()) {
|
if let Some(args) = args.map(str::trim).filter(|value| !value.is_empty()) {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
"{command_name} does not accept arguments. Received: {args}\nUsage: {command_name}"
|
"{command_name} does not accept arguments. Received: {args}\nUsage: {command_name}"
|
||||||
@@ -4853,9 +4857,9 @@ mod tests {
|
|||||||
permission_policy, print_help_to, push_output_block, render_config_report,
|
permission_policy, print_help_to, push_output_block, render_config_report,
|
||||||
render_diff_report, render_memory_report, render_repl_help, render_resume_usage,
|
render_diff_report, render_memory_report, render_repl_help, render_resume_usage,
|
||||||
resolve_model_alias, resolve_session_reference, response_to_events,
|
resolve_model_alias, resolve_session_reference, response_to_events,
|
||||||
resume_supported_slash_commands, run_resume_command, validate_no_args,
|
resume_supported_slash_commands, run_resume_command,
|
||||||
slash_command_completion_candidates_with_sessions, status_context, CliAction,
|
slash_command_completion_candidates_with_sessions, status_context, validate_no_args,
|
||||||
CliOutputFormat, GitWorkspaceSummary, InternalPromptProgressEvent,
|
CliAction, CliOutputFormat, GitWorkspaceSummary, InternalPromptProgressEvent,
|
||||||
InternalPromptProgressState, LiveCli, SlashCommand, StatusUsage, DEFAULT_MODEL,
|
InternalPromptProgressState, LiveCli, SlashCommand, StatusUsage, DEFAULT_MODEL,
|
||||||
};
|
};
|
||||||
use api::{MessageResponse, OutputContentBlock, Usage};
|
use api::{MessageResponse, OutputContentBlock, Usage};
|
||||||
@@ -5590,14 +5594,16 @@ mod tests {
|
|||||||
assert!(preflight.contains("Result ready"));
|
assert!(preflight.contains("Result ready"));
|
||||||
assert!(preflight.contains("Branch feature/ux"));
|
assert!(preflight.contains("Branch feature/ux"));
|
||||||
assert!(preflight.contains("Workspace dirty · 2 files · 1 staged, 1 unstaged"));
|
assert!(preflight.contains("Workspace dirty · 2 files · 1 staged, 1 unstaged"));
|
||||||
assert!(preflight.contains("Action create a git commit from the current workspace changes"));
|
assert!(preflight
|
||||||
|
.contains("Action create a git commit from the current workspace changes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn commit_skipped_report_points_to_next_steps() {
|
fn commit_skipped_report_points_to_next_steps() {
|
||||||
let report = format_commit_skipped_report();
|
let report = format_commit_skipped_report();
|
||||||
assert!(report.contains("Reason no workspace changes"));
|
assert!(report.contains("Reason no workspace changes"));
|
||||||
assert!(report.contains("Action create a git commit from the current workspace changes"));
|
assert!(report
|
||||||
|
.contains("Action create a git commit from the current workspace changes"));
|
||||||
assert!(report.contains("/status to inspect context"));
|
assert!(report.contains("/status to inspect context"));
|
||||||
assert!(report.contains("/diff to inspect repo changes"));
|
assert!(report.contains("/diff to inspect repo changes"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3157,8 +3157,8 @@ mod tests {
|
|||||||
.expect_err("unknown plugin permission should fail");
|
.expect_err("unknown plugin permission should fail");
|
||||||
assert!(unknown_permission.contains("unsupported plugin permission: admin"));
|
assert!(unknown_permission.contains("unsupported plugin permission: admin"));
|
||||||
|
|
||||||
let empty_permission = permission_mode_from_plugin("")
|
let empty_permission =
|
||||||
.expect_err("empty plugin permission should fail");
|
permission_mode_from_plugin("").expect_err("empty plugin permission should fail");
|
||||||
assert!(empty_permission.contains("unsupported plugin permission: "));
|
assert!(empty_permission.contains("unsupported plugin permission: "));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user