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:
asepharyana
2026-07-13 08:12:12 +07:00
parent be921d6836
commit 29a9fae3f6
79 changed files with 826 additions and 904 deletions
+3 -3
View File
@@ -69,19 +69,19 @@ impl Tool for DirCacheUpdate {
// Create a one-shot runtime so this tool works from any thread (the
// agent turn runs on a std::thread that has no tokio context).
let rt = tokio::runtime::Runtime::new()
.map_err(|e| anyhow!("failed to create temp runtime: {}", e))?;
.map_err(|e| anyhow!("failed to create temp runtime: {e}"))?;
rt.block_on(async {
let cache = dc.write().await;
cache.set(entries).await;
});
Ok(format!("cached {} entries for {}", count, rel))
Ok(format!("cached {count} entries for {rel}"))
}
}
/// Non-recursively list the immediate entries of `path`.
///
/// Flow: read_dir → flatten Ok entries → collect their paths.
/// Flow: `read_dir` → flatten Ok entries → collect their paths.
///
/// Why: silently skips unreadable entries (e.g. permission errors)
/// rather than failing the whole cache update.
+4 -4
View File
@@ -67,13 +67,13 @@ impl Tool for DirList {
}
let entries: Vec<String> = fs::read_dir(&path)
.map_err(|e| anyhow!("failed to read directory '{}': {}", rel, e))?
.filter_map(|e| e.ok())
.map_err(|e| anyhow!("failed to read directory '{rel}': {e}"))?
.filter_map(std::result::Result::ok)
.map(|e| {
let name = e.file_name().to_string_lossy().to_string();
let is_dir = e.file_type().map(|t| t.is_dir()).unwrap_or(false);
let is_dir = e.file_type().is_ok_and(|t| t.is_dir());
if is_dir {
format!("{}/", name)
format!("{name}/")
} else {
name
}
+1 -1
View File
@@ -39,6 +39,6 @@ impl Tool for Pong {
let msg = args.get("message")
.and_then(|v| v.as_str())
.unwrap_or("pong");
Ok(format!("pong: {}", msg))
Ok(format!("pong: {msg}"))
}
}
+4 -4
View File
@@ -36,9 +36,9 @@ impl Tool for Todofinish {
}
let content = std::fs::read_to_string(&path)
.map_err(|e| anyhow!("failed to read todo.md: {}", e))?;
.map_err(|e| anyhow!("failed to read todo.md: {e}"))?;
let task_index = args.get("task_index").and_then(|v| v.as_i64());
let task_index = args.get("task_index").and_then(serde_json::Value::as_i64);
let mut new_content = String::new();
let mut task_count = 0;
@@ -70,10 +70,10 @@ impl Tool for Todofinish {
}
std::fs::write(&path, new_content)
.map_err(|e| anyhow!("failed to write to todo.md: {}", e))?;
.map_err(|e| anyhow!("failed to write to todo.md: {e}"))?;
if let Some(idx) = task_index {
Ok(format!("Successfully marked task {} as finished.", idx))
Ok(format!("Successfully marked task {idx} as finished."))
} else {
Ok("Successfully marked ALL tasks as finished.".to_string())
}
+4 -4
View File
@@ -59,17 +59,17 @@ impl Tool for Todowrite {
let path: PathBuf = ctx.session_dir.join("todo.md");
let now = chrono::Utc::now();
let timestamp = now.format("%Y-%m-%d %H:%M:%S");
let line = format!("- [ ] {} ({})\n", task, timestamp);
let line = format!("- [ ] {task} ({timestamp})\n");
fs::OpenOptions::new()
.create(true)
.append(true)
.open(&path)
.map_err(|e| anyhow!("failed to open todo.md: {}", e))?
.map_err(|e| anyhow!("failed to open todo.md: {e}"))?
.write_all(line.as_bytes())
.map_err(|e| anyhow!("failed to write to todo.md: {}", e))?;
.map_err(|e| anyhow!("failed to write to todo.md: {e}"))?;
Ok(format!("added task to todo.md: {}", task))
Ok(format!("added task to todo.md: {task}"))
}
}