Files
Marcos Paulo b32650767c
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
docs: specs and briefs for smart folders, version diff, media timestamps, clean paste, link cards, spaced repetition
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 12:18:00 -03:00

4.8 KiB

Tasks: smart folders (roadmap 26)

One task = one agent (specs/agents/opencode-runbook.md). [ ] open. Spec: spec.md. Rules: AGENTS.md, docs/CODE-MAP.md. No new crate. First tool call rule: after at most three reads, write the first OWNS file in your SECOND tool call: a compiling stub with the GOAL signatures and ONE failing test, then make it pass. Standing VERIFY: export PATH="$HOME/.cargo/bin:$PATH"; cargo test -p <pkg>; cargo clippy -p <pkg> --all-targets -- -D warnings; rustfmt --edition 2024 <owned files>; UI/i18n tasks add cargo xtask i18n; last task of a phase adds cargo xtask layers and cargo xtask tree. Standing DO NOT: edit Cargo files, files outside OWNS, git state, cargo fmt --all; add allow attributes; use unwrap/expect/panic/[i]/[a..b] on input-derived data; add a dependency; write outside .notescraft/ via write_private.

Phase 1 - pure model

  • 1. Smart folder model, validation, JSON (brief briefs/13-smart-folder-model.md). OWNS: crates/engine/src/smart_folders/model.rs, crates/engine/src/smart_folders/mod.rs, one mod smart_folders; in crates/engine/src/lib.rs, crates/engine/tests/smart_folders_model.rs (only if the module is pub; else unit tests in model.rs). FILES TO OPEN: spec.md D1, crates/engine/src/bases/mod.rs (how a sub-module is declared), crates/engine/src/activity/outbox.rs (versioned JSON + write_private pattern). GOAL: SmartFolder, Store { version, folders }, Store::parse(&str) -> Result<Store>, Store::to_json, validate(&SmartFolder), new_id(existing) -> String. TESTS: round trip; both yaml and path -> error; neither -> error; 201 folders -> error; name 81 chars; yaml 16 KiB + 1; bad id; unknown version; corrupt JSON returns Err, never panics; yaml that fails notescraft_bases::Base::parse -> error. VERIFY: standing, -p notescraft-engine. DO NOT: do IO (task 2).

Phase 2 - engine

  • 2. Store IO and the four commands. OWNS: crates/engine/src/smart_folders/store.rs, .../commands.rs, .../mod.rs, one register_smart_folders(reg) call in crates/engine/src/commands.rs::register_core, crates/engine/src/ai/assistant_gate.rs, crates/engine/tests/core_commands.rs (CORE_IDS), crates/engine/tests/smart_folders.rs. FILES TO OPEN: spec.md D2, crates/engine/src/bases/commands.rs (query, copy the group shape, extract pub(crate) run_query only if needed: then list it in the report), crates/engine/src/bases/source.rs, crates/engine/tests/common/mod.rs. GOAL: D2 table exactly; read-only refuses writes; corrupt file untouched. TESTS: TempVault with 3 tagged notes: items match; untagged excluded; save/list/delete; count; paging; corrupt file byte-identical after a failed save attempt; read-only. VERIFY: standing + --test smart_folders --test core_commands. DO NOT: touch UI; copy the query engine.

Phase 3 - UI

  • 3. Virtual group and rows in the Explorer. OWNS: crates/ui-egui/src/panels/tree/smart.rs (new), crates/ui-egui/src/panels/tree/rows.rs (a Virtual row kind only), crates/ui-egui/src/panels/tree.rs (paint arm only), crates/ui-egui/src/shell/app/smart_folders.rs (snapshot), crates/ui-egui/tests/smart_folders_tree.rs. FILES TO OPEN: crates/ui-egui/src/panels/tree/rows.rs, crates/ui-egui/src/panels/tree.rs:640-700, crates/ui-egui/src/shell/app/window/commands.rs (engine_command), docs/CODE-MAP.md UI table. GOAL: group header + folder rows + item rows; click opens the note; items fetched on expand; snapshot refreshed on index generation. TESTS: kittest: group absent when none; present with 2; expand fetches once (counter); scroll of 5 000 rows 0 calls; click opens tab. VERIFY: standing + snapshot PNG read. DO NOT: change row height; call the engine per row.
  • 4. Create, edit, rename, delete; "Save as smart folder" on a Base tab. OWNS: crates/ui-egui/src/views/smart_folder_dialog/mod.rs, crates/ui-egui/src/text/views/smart_folders.rs, [ui.smart_folders] at END of crates/i18n/locales/en.toml, crates/ui-egui/tests/smart_folder_dialog.rs. FILES TO OPEN: crates/ui-egui/src/views/share_dialog/mod.rs, crates/ui-egui/src/widgets/context_menu.rs, crates/ui-egui/src/views/base_view/menus/, .claude/skills/notescraft-egui-screen/. GOAL: Modal with name + filter template (Tag, Folder, Property) generating inline yaml; ConfirmModal delete; the menu wiring lines are listed for the lead. TESTS: kittest: create sends smartfolder.save once with valid yaml; empty name disabled; delete asks confirm. VERIFY: standing + cargo xtask i18n tree. DO NOT: use raw egui buttons/inputs; hardcode strings.
  • 5. Docs and status. OWNS: ROADMAP.md, docs/ARCHITECTURE.md, docs/CODE-MAP.md (smart folder rows), specs/plugins-parity/roadmap.md (mark 26). VERIFY: cargo xtask ci. DO NOT: add features.