From 53cf2bc4d65e13ec492c5b98fbeedc4bb485a3f5 Mon Sep 17 00:00:00 2001 From: lucaronin Date: Mon, 23 Feb 2026 20:17:01 +0100 Subject: [PATCH] docs: update ARCHITECTURE.md with vault module structure Add new "Vault Module Structure" section documenting the 6 submodules, their responsibilities, and CodeScene health scores. Co-Authored-By: Claude Opus 4.6 --- docs/ARCHITECTURE.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 754aa19d..10d93825 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -43,7 +43,7 @@ Laputa is a personal knowledge and life management desktop app. It reads a vault │ ┌──────────────▼────┐ ┌──▼───────────────────────────┐ │ │ │ Rust Backend │ │ External Services │ │ │ │ lib.rs → 10 cmds │ │ Anthropic API (Claude) │ │ -│ │ vault.rs │ │ MCP Server (ws://9710) │ │ +│ │ vault/ │ │ MCP Server (ws://9710) │ │ │ │ frontmatter.rs │ │ │ │ │ │ git.rs │ └──────────────────────────────┘ │ │ │ ai_chat.rs │ │ @@ -224,6 +224,21 @@ User clicks Commit button → CommitDialog opens → Toast: "Committed and pushed" ``` +## Vault Module Structure + +The vault backend (`src-tauri/src/vault/`) is split into focused submodules: + +| File | Purpose | CodeScene Health | +|------|---------|-----------------| +| `mod.rs` | Core types (`VaultEntry`, `Frontmatter`), `parse_md_file`, `scan_vault`, relationship extraction | 10.0 | +| `parsing.rs` | Text processing: snippet extraction, markdown stripping, ISO date parsing, `extract_title` | 9.68 | +| `cache.rs` | Git-based incremental vault caching (`scan_vault_cached`), git helpers | 9.68 | +| `trash.rs` | `purge_trash` — deletes trashed notes older than 30 days | 9.38 | +| `rename.rs` | `rename_note` — renames files and updates wikilinks across the vault | 9.68 | +| `image.rs` | `save_image` — saves base64-encoded attachments with sanitized filenames | 10.0 | + +Public API (re-exported from `mod.rs`): `scan_vault_cached`, `save_image`, `rename_note`, `RenameResult`, `purge_trash`, `get_note_content`, `parse_md_file`, `VaultEntry`. + ## Tauri IPC Commands All commands are defined in `src-tauri/src/lib.rs` and registered via `tauri::generate_handler![]`.