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, onemod smart_folders;incrates/engine/src/lib.rs,crates/engine/tests/smart_folders_model.rs(only if the module ispub; else unit tests inmodel.rs). FILES TO OPEN:spec.mdD1,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; bothyamlandpath-> 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 failsnotescraft_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, oneregister_smart_folders(reg)call incrates/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.mdD2,crates/engine/src/bases/commands.rs(query, copy the group shape, extractpub(crate) run_queryonly 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:TempVaultwith 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(aVirtualrow 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.mdUI 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 ofcrates/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 sendssmartfolder.saveonce 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.