From 31dfe696420d0603c597ada62fe7579d843574f5 Mon Sep 17 00:00:00 2001 From: Amolith Date: Thu, 26 Feb 2026 13:17:35 -0700 Subject: [PATCH] Update AGENTS.md to reflect Loro storage and current module layout --- AGENTS.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index a3e8f41b5e6283e2d237731a78fef1cf96bed005..f727844dff1cd5ab55a0c4f8f80def035cd2c7c4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,17 +15,18 @@ ## Implementation details - Project resolution: most commands resolve the project via `db::resolve_project_name()` which checks `--project` flag, `TD_PROJECT` env var, or the directory binding in `~/.local/share/td/bindings.json`. Without a resolved project, commands fail with "no project selected". Only `project` and `skill` subcommands avoid this check. -- DB schema is created in `src/db.rs` (`SCHEMA`): -- Foreign keys are explicitly enabled on each connection (`PRAGMA foreign_keys = ON`). -- Task IDs: - - top-level: generated short IDs (`td-xxxxxx`) via `db::gen_id()` - - subtasks: `.` generated by counting existing children in `create`. +- Storage is Loro CRDT documents (`base.loro` + incremental changes in `changes/`). There is no SQL database; `src/db.rs` is the Loro document store and task model, not a database layer. +- Schema versioning lives in `src/migrate.rs` (`CURRENT_SCHEMA_VERSION`); migrations operate on the Loro document structure. +- Task IDs: all tasks (top-level and subtasks) get ULIDs via `db::gen_id()`, displayed to the user as short `td-XXXXXXX` forms. Subtasks link to their parent via a `parent` field. ## Command/module map - CLI definition and argument shapes: `src/cli.rs` - Dispatch wiring: `src/cmd/mod.rs` -- Command implementations live in `src/cmd/*.rs` (one module per subcommand, including `skill`). -- Shared DB/domain helpers and structs (`Task`, `TaskDetail`, loaders): `src/db.rs` +- Command implementations live in `src/cmd/*.rs` (one module per subcommand: `create`, `dep`, `doctor`, `done`, `export`, `import`, `label`, `list`, `log`, `next`, `project`, `ready`, `reopen`, `rm`, `search`, `show`, `skill`, `stats`, `sync`, `tidy`, `update`). +- Loro document store, task model, and domain helpers (`Task`, `TaskId`, `Status`, etc.): `src/db.rs` +- Schema migrations for the Loro document structure: `src/migrate.rs` +- Priority/readiness scoring logic: `src/score.rs` +- Terminal colour helpers: `src/color.rs` ## Testing approach - Integration-style CLI tests in `tests/cli_*.rs` using: @@ -46,7 +47,6 @@ ## Gotchas - Running commands without a project binding (and without `--project` or `TD_PROJECT`) yields `no project selected`. Tests should set `current_dir` to directories with initialized bindings. -- `Cargo.toml` uses `rusqlite` with `bundled` feature, so SQLite is vendored; build behavior differs from system-SQLite setups. ## Contributions