ci: add GitHub Actions workflows with semantic-release auto-versioning
chore: fix all 702 clippy warnings across codebase - auto-fix 475 via cargo clippy --fix - fix remaining 227 manually: uninlined_format_args, redundant_closure, match_same_arms, underscore_binding, format_push_string, items_after_statements, needless_pass_by_value, clone_on_copy, case_sensitive_extension, single_match/let-else, write_with_newline, and other clippy lints
This commit is contained in:
+21
-22
@@ -51,12 +51,13 @@ impl Tool for SpawnAgents {
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
use std::sync::{Arc, Mutex};
|
||||
let agents: Vec<String> = args.get("agents")
|
||||
.and_then(|v| v.as_array())
|
||||
.ok_or_else(|| anyhow!("missing required argument: agents"))?
|
||||
.iter()
|
||||
.filter_map(|v| v.as_str().map(|s| s.to_string()))
|
||||
.filter_map(|v| v.as_str().map(std::string::ToString::to_string))
|
||||
.collect();
|
||||
|
||||
if agents.is_empty() {
|
||||
@@ -67,9 +68,8 @@ impl Tool for SpawnAgents {
|
||||
}
|
||||
|
||||
let max_concurrency = args.get("max_concurrency")
|
||||
.and_then(|v| v.as_u64())
|
||||
.map(|v| v.min(10) as usize)
|
||||
.unwrap_or(10);
|
||||
.and_then(serde_json::Value::as_u64)
|
||||
.map_or(10, |v| v.min(10) as usize);
|
||||
|
||||
let agent_count = agents.len();
|
||||
let primitives: Vec<ScriptPrimitive> = agents
|
||||
@@ -78,8 +78,8 @@ impl Tool for SpawnAgents {
|
||||
.collect();
|
||||
|
||||
let wf = WorkflowScript {
|
||||
name: format!("parallel-{}-agents", agent_count),
|
||||
description: format!("Auto-spawned parallel workflow with {} agents", agent_count),
|
||||
name: format!("parallel-{agent_count}-agents"),
|
||||
description: format!("Auto-spawned parallel workflow with {agent_count} agents"),
|
||||
script: ScriptPrimitive::Parallel(primitives),
|
||||
options: ScriptOptions {
|
||||
max_concurrency,
|
||||
@@ -88,8 +88,7 @@ impl Tool for SpawnAgents {
|
||||
},
|
||||
};
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
let live: Option<crate::app::workflow::engine::LiveStateFn> = _ctx.turn_events.as_ref().map(|turn_events| {
|
||||
let live: Option<crate::app::workflow::engine::LiveStateFn> = ctx.turn_events.as_ref().map(|turn_events| {
|
||||
let turn_events = turn_events.clone();
|
||||
let f: crate::app::workflow::engine::LiveStateFn = Arc::new(move |agent_id: String, agent_name: String, status| {
|
||||
if let Ok(mut q) = turn_events.lock() {
|
||||
@@ -113,12 +112,12 @@ impl Tool for SpawnAgents {
|
||||
max_concurrency,
|
||||
true,
|
||||
live.as_ref(),
|
||||
&_ctx.session_dir,
|
||||
&_ctx.workspaces,
|
||||
&ctx.session_dir,
|
||||
&ctx.workspaces,
|
||||
&findings,
|
||||
None, // no per-agent timeout for spawn_agents
|
||||
)?;
|
||||
format_results(results, "parallel")
|
||||
Ok(format_results(&results, "parallel"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,12 +149,13 @@ impl Tool for SpawnPipeline {
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
use std::sync::{Arc, Mutex};
|
||||
let stages: Vec<String> = args.get("stages")
|
||||
.and_then(|v| v.as_array())
|
||||
.ok_or_else(|| anyhow!("missing required argument: stages"))?
|
||||
.iter()
|
||||
.filter_map(|v| v.as_str().map(|s| s.to_string()))
|
||||
.filter_map(|v| v.as_str().map(std::string::ToString::to_string))
|
||||
.collect();
|
||||
|
||||
if stages.is_empty() {
|
||||
@@ -178,8 +178,7 @@ impl Tool for SpawnPipeline {
|
||||
},
|
||||
};
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
let live: Option<crate::app::workflow::engine::LiveStateFn> = _ctx.turn_events.as_ref().map(|turn_events| {
|
||||
let live: Option<crate::app::workflow::engine::LiveStateFn> = ctx.turn_events.as_ref().map(|turn_events| {
|
||||
let turn_events = turn_events.clone();
|
||||
let f: crate::app::workflow::engine::LiveStateFn = Arc::new(move |agent_id: String, agent_name: String, status| {
|
||||
if let Ok(mut q) = turn_events.lock() {
|
||||
@@ -202,24 +201,24 @@ impl Tool for SpawnPipeline {
|
||||
1,
|
||||
false,
|
||||
live.as_ref(),
|
||||
&_ctx.session_dir,
|
||||
&_ctx.workspaces,
|
||||
&ctx.session_dir,
|
||||
&ctx.workspaces,
|
||||
&findings,
|
||||
None, // no per-agent timeout for spawn_pipeline
|
||||
)?;
|
||||
format_results(results, "pipeline")
|
||||
Ok(format_results(&results, "pipeline"))
|
||||
}
|
||||
}
|
||||
|
||||
/// Format a list of agent results into a readable summary string.
|
||||
fn format_results(results: Vec<String>, mode: &str) -> Result<String> {
|
||||
fn format_results(results: &[String], mode: &str) -> String {
|
||||
if results.is_empty() {
|
||||
return Ok(format!("{} workflow completed with no output", mode));
|
||||
return format!("{mode} workflow completed with no output");
|
||||
}
|
||||
let formatted: Vec<String> = results
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, r)| format!("=== Agent {} ===\n{}", i + 1, r.trim()))
|
||||
.collect();
|
||||
Ok(formatted.join("\n\n"))
|
||||
formatted.join("\n\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user