refactor: migrate monolithic crate to Cargo Workspace with Clean Architecture

Transform the single binary crate into a 9-crate workspace monorepo:

- Root Cargo.toml as [workspace] manager with resolver = "2"
- zesdex-entities: Domain entity types (session, settings, store, message, etc.)
- zesdex-utils: Pure utility functions (error, logger, pagination, slug, clipboard)
- zesdex-dto: Data Transfer Objects for LLM provider API communication
- zesdex-ipc: Unix-socket IPC layer (client/server/framing/protocol)
- zesdex-iam: Identity & Access Management (Clean Architecture: domain/application/infrastructure)
- zesdex-cms: Content Management (Clean Architecture: domain/application/infrastructure)
- zesdex-middleware: HTTP middleware (Auth, CORS, Rate Limiting)
- zesdex-libs: Composition root (AppContext, DB init, JWT, Argon2)
- zesdex-backend: Main binary entry point + seed/migrate binaries
- DevOps: Dockerfile, docker-compose, Nix (flake/shell/default), CI/CD updates
- Remove dead root src/ and src-misc/ directories

All crate re-exports maintain backward compatibility with original
crate::model::*, crate::dto::*, crate::ipc::* module paths.
Feature crates enforce strict layer separation: domain -> application
-> infrastructure with generic trait-based dependency injection.
This commit is contained in:
asepharyana
2026-07-17 09:08:41 +07:00
parent 86cc412395
commit be0a9582bb
248 changed files with 7901 additions and 1505 deletions
@@ -0,0 +1,80 @@
//! Tool for marking tasks as finished in the session's todo list.
use super::super::{Tool, ToolCtx};
use anyhow::{anyhow, Result};
use serde_json::{json, Value};
use std::path::PathBuf;
/// Tool that marks tasks as finished in the session's todo.md.
pub struct Todofinish;
impl Tool for Todofinish {
fn name(&self) -> &'static str {
"todofinish"
}
fn description(&self) -> &'static str {
"Mark tasks as finished in the session todo list (todo.md). You can mark all tasks as finished by leaving the 'task_index' empty, or specify a 1-based index to finish a specific task."
}
fn parameters(&self) -> Value {
json!({
"type": "object",
"properties": {
"task_index": {
"type": "integer",
"description": "Optional 1-based index of the task to mark as finished. If omitted, ALL unfinished tasks will be marked as finished."
}
}
})
}
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let path: PathBuf = ctx.session_dir.join("todo.md");
if !path.exists() {
return Ok("No todo.md found in session directory. Nothing to finish.".to_string());
}
let content =
std::fs::read_to_string(&path).map_err(|e| anyhow!("failed to read todo.md: {e}"))?;
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;
let mut modified = false;
for line in content.lines() {
if line.trim_start().starts_with("- [ ]") {
task_count += 1;
if let Some(target) = task_index {
if task_count == target {
new_content.push_str(&line.replacen("- [ ]", "- [x]", 1));
modified = true;
} else {
new_content.push_str(line);
}
} else {
// Mark all as finished
new_content.push_str(&line.replacen("- [ ]", "- [x]", 1));
modified = true;
}
} else {
new_content.push_str(line);
}
new_content.push('\n');
}
if !modified {
return Ok("No unfinished tasks found or index out of bounds.".to_string());
}
std::fs::write(&path, new_content)
.map_err(|e| anyhow!("failed to write to todo.md: {e}"))?;
if let Some(idx) = task_index {
Ok(format!("Successfully marked task {idx} as finished."))
} else {
Ok("Successfully marked ALL tasks as finished.".to_string())
}
}
}