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
+2 -2
View File
@@ -43,8 +43,8 @@ impl Tool for Forget {
.ok_or_else(|| anyhow!("missing required argument: name"))?;
Memory::remove(&ctx.memory_dir, name)
.map_err(|e| anyhow!("failed to remove memory '{}': {}", name, e))?;
.map_err(|e| anyhow!("failed to remove memory '{name}': {e}"))?;
Ok(format!("removed memory '{}'", name))
Ok(format!("removed memory '{name}'"))
}
}
+10 -9
View File
@@ -1,5 +1,6 @@
//! Tool for reading a single memory entry or listing the whole memory index.
use std::fmt::Write;
use serde_json::{json, Value};
use anyhow::{Result, anyhow};
use super::super::Tool;
@@ -39,10 +40,10 @@ impl Tool for Recall {
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
if let Some(name) = args.get("name").and_then(|v| v.as_str()) {
if name.is_empty() {
return list_all(ctx);
return Ok(list_all(ctx));
}
let memory = Memory::read(&ctx.memory_dir, name)
.map_err(|e| anyhow!("memory '{}' not found: {}", name, e))?;
.map_err(|e| anyhow!("memory '{name}' not found: {e}"))?;
Ok(format!(
"---\nname: {}\ndescription: {}\nkind: {}\nlifecycle: {}\n---\n\n{}",
memory.name,
@@ -52,7 +53,7 @@ impl Tool for Recall {
memory.content,
))
} else {
list_all(ctx)
Ok(list_all(ctx))
}
}
}
@@ -63,18 +64,18 @@ impl Tool for Recall {
/// fall back to bare name if the file can't be parsed.
///
/// Return: `Ok` with the formatted index (never fails; missing dir yields "(no memory entries)").
fn list_all(ctx: &ToolCtx) -> Result<String> {
fn list_all(ctx: &ToolCtx) -> String {
let names = Memory::list(&ctx.memory_dir);
if names.is_empty() {
return Ok("(no memory entries)".to_string());
return "(no memory entries)".to_string();
}
let mut lines = format!("Memory index ({} entries):\n", names.len());
let mut lines = String::new();
for name in &names {
if let Ok(mem) = Memory::read(&ctx.memory_dir, name) {
lines.push_str(&format!("- {} [{}]: {}\n", name, mem.kind, mem.description));
let _ = writeln!(lines, "- {} [{}]: {}", name, mem.kind, mem.description);
} else {
lines.push_str(&format!("- {}\n", name));
let _ = writeln!(lines, "- {name}");
}
}
Ok(lines)
lines
}
+2 -2
View File
@@ -89,8 +89,8 @@ impl Tool for Remember {
};
memory.write(&ctx.memory_dir)
.map_err(|e| anyhow!("failed to write memory '{}': {}", name, e))?;
.map_err(|e| anyhow!("failed to write memory '{name}': {e}"))?;
Ok(format!("saved memory '{}' ({})", name, kind))
Ok(format!("saved memory '{name}' ({kind})"))
}
}