style: format seluruh workspace dengan cargo fmt

Menyeragamkan format kode sesuai rustfmt (126 file). Sebelumnya
lefthook pre-commit 'cargo fmt --check' akan gagal pada commit apa pun.
This commit is contained in:
asepharyana
2026-08-27 22:10:28 +07:00
parent 884b19ccb5
commit 7b0b53671f
127 changed files with 1271 additions and 1156 deletions
@@ -42,28 +42,33 @@ impl Tool for Todofinish {
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let item = crate::tools::arg_str(args, "item")?;
info!(item, "todofinish invoked");
let todo_path = ctx.session_dir.join("TODO.md");
let mut content = std::fs::read_to_string(&todo_path).unwrap_or_default();
// Very basic replace to mark as finished
let mut replaced = false;
let lines: Vec<&str> = content.lines().collect();
let mut new_lines = Vec::new();
for line in lines {
if line.contains(&item) && line.starts_with("- [") {
let s = line.replacen("- [high]", "- [x]", 1)
.replacen("- [medium]", "- [x]", 1)
.replacen("- [low]", "- [x]", 1);
let s = line
.replacen("- [high]", "- [x]", 1)
.replacen("- [medium]", "- [x]", 1)
.replacen("- [low]", "- [x]", 1);
// if it didn't match those, just replace the first `[`
let s = if s == line { line.replacen("[ ]", "[x]", 1) } else { s };
let s = if s == line {
line.replacen("[ ]", "[x]", 1)
} else {
s
};
new_lines.push(s);
replaced = true;
} else {
new_lines.push(line.to_string());
}
}
if replaced {
content = new_lines.join("\n") + "\n";
let _ = std::fs::write(&todo_path, &content);
@@ -76,7 +81,7 @@ impl Tool for Todofinish {
} else {
info!(item, "TODO item not found in TODO.md — nothing to mark");
}
Ok(format!("TODO completed: {}", item))
}
}
@@ -54,11 +54,11 @@ impl Tool for Todowrite {
info!(item, priority, "todowrite invoked");
let todo_line = format!("- [{}] {}\n", priority, item);
let todo_path = ctx.session_dir.join("TODO.md");
let mut content = std::fs::read_to_string(&todo_path).unwrap_or_default();
content.push_str(&todo_line);
let _ = std::fs::write(&todo_path, &content);
if let Some(events) = &ctx.turn_events {