9.5 KiB
Tasks: icons and banners from properties (roadmap item 16)
One task = one agent's work (OpenCode brief template, specs/agents/opencode-runbook.md). [ ] open.
Spec: spec.md (D-numbers point into it). Rules for every task: AGENTS.md, docs/CODE-MAP.md.
No new crate: the resolver lives in notescraft-index (L1), the rest in engine and ui-egui.
First tool call rule: after at most three reads, your FIRST write is the first OWNS file: a compiling stub with the signatures from GOAL and ONE failing test. Then make it pass. Do not explore the repo.
Standing VERIFY: cargo test -p <pkg> ; cargo clippy -p <pkg> --all-targets -- -D warnings ;
rustfmt --edition 2024 <owned files>. UI/i18n tasks add cargo xtask i18n; the last task of a phase adds
cargo xtask layers and cargo xtask tree. Always export PATH="$HOME/.cargo/bin:$PATH".
Standing DO NOT: edit Cargo.toml/Cargo.lock, 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.
Owner/lead step 0 (not an agent task)
Answer Q1 (a real Iconize note: paste its frontmatter into the spec), Q2 and Q3 (catalogue size). Check
cargo xtask tree headroom: crates/index/src/ must stay at 12 loose files or fewer after decor.rs
(list the count in the report if it is 12; the agent adds the file under crates/index/src/decor/ if so).
Phase 1 - pure resolver
- 1. Parse
icon,iconColor,banner*intoDecor(briefbriefs/12-icon-property-resolver.md). OWNS:crates/index/src/decor.rs,crates/index/src/lib.rs(onemod decor;+pub use),crates/index/tests/decor.rs. FILES TO OPEN:spec.mdD1 and D2,crates/index/src/props.rs(the property value type andnote_props),crates/index/src/lib.rs. GOAL:IconRef,ColorRef,BannerRef,BannerTarget,Decor,pub fn parse_icon(&str) -> Option<IconRef>,pub fn parse_color(&str) -> Option<ColorRef>,pub fn decor_from_props(props, keys: &DecorKeys) -> DecorwhereDecorKeys { icon, color, banner }carry the configurable property names (defaults per D3). TESTS:LiRocket,lucide-rocket,rocket,Rocket,LiArrowRightnormalise; emoji (🚀,👩💻,❤️);[[icons/star.svg]],icons/star.png;#f80,#ff8800,accent; bad colour#12is None; banner wikilink,![[x.jpg]], path, https URL (Url target), quoted;banner_y0.2 parsed,"0.2"string parsed, -1 and NaN ignored (default 0.5); 2 KiB value ignored;banner_iconused only wheniconis absent. VERIFY: standing,-p notescraft-index. DO NOT: touch index data structures; read files.
Phase 2 - engine
- 2.
decor.list,decor.setand settings. OWNS:crates/engine/src/decor/mod.rs,.../commands.rs,.../resolve.rs, onemod decor;incrates/engine/src/lib.rs, oneregister_decor(reg)call incrates/engine/src/commands.rs::register_core,crates/engine/src/prefs/decor_config.rs,crates/engine/src/prefs/catalog/(listing entries),crates/engine/src/ai/assistant_gate.rs,crates/engine/tests/core_commands.rs(CORE_IDS),crates/engine/tests/decor.rs. FILES TO OPEN:spec.mdD3,crates/engine/src/bases/commands.rs(group to copy),crates/engine/src/vault/properties.rs(set),crates/engine/src/builtin/properties_commands.rs,crates/engine/src/prefs/files_config.rs+crates/engine/tests/files_config_viewers.rs,crates/engine/src/vault/folders.rs(folder note name). GOAL: D3 exactly; cache keyed by index generation; folder icon from folder note; banner target resolved with the wiki link resolver (find it incrates/engine/src/vault/before writing one). There is nodecor.iconscommand: the catalogue lives in ui-egui and the picker reads it directly. TESTS:decor.rson aTempVault: icon note listed, undecorated omitted, folder note icon on the folder, banner[[cover.jpg]]resolves toassets/cover.jpg,httpsbanner returned as url not path,decor.setwritesicon:with the body byte-identical, null removes the key, open buffer gets one undo step, custom property names setting honoured, out-of-rangebanner_heightrejected, read-only refusesset, no network (no HTTP code reachable). VERIFY: standing fornotescraft-engine+--test decor --test core_commands. DO NOT: add a per-note IO read (use the index props); touch the UI.
Phase 3 - UI (lead wires the dispatch lines; each task is a small file plus one hook)
- 3. Icon painter, Lucide catalogue and the decor snapshot.
OWNS:
crates/ui-egui/src/design/note_icon.rs,crates/ui-egui/src/design/icon_catalogue.rs,crates/ui-egui/assets/icons/lucide/*.svg(about 250 files, ISC licence header kept),crates/ui-egui/src/shell/app/decor.rs(snapshot in egui memory, refresh on index generation),crates/ui-egui/tests/note_icon.rs. FILES TO OPEN:crates/ui-egui/src/design/icons.rs(icon!,paint),crates/ui-egui/src/views/base_view/layouts/cover.rs(bounded texture cache pattern),crates/ui-egui/src/shell/app/window/commands.rs(engine_command). GOAL:pub fn paint(ui, &IconRef, rect, tint: Color32);Catalogue::get(name) -> Option<&[u8]>andnames(); File icons decode off the UI thread into a 256-entry cache;DecorSnapshot { get(path) -> Option<&Item> }. TESTS: kittest paints a Lucide, an emoji and a File icon without panic; unknown Lucide name returns the generic icon; the snapshot refreshes when the generation changes; 300 KB SVG rejected; texture cache never exceeds 256. VERIFY: standing +cargo xtask tree. DO NOT: call the engine per frame; add icons that are not Lucide (ISC). - 4. Explorer rows and tabs show icons.
OWNS:
crates/ui-egui/src/panels/tree.rs(the icon slot near line 672 only),crates/ui-egui/src/widgets/tabs/paint.rs(icon at lines ~35 and ~204 only),crates/ui-egui/tests/decor_tree.rs. FILES TO OPEN:crates/ui-egui/src/panels/tree.rs:655-680,crates/ui-egui/src/widgets/tabs/paint.rs,crates/ui-egui/src/design/note_icon.rs. GOAL: a decorated note/folder paints its icon instead offile-text/folder; folders keep the open/close Lottie toggle when undecorated; the row cache (panels/tree/rows.rs) is NOT invalidated per frame. TESTS: kittest: decorated note row differs from an undecorated one (pixel or shape counter), folder note icon on folder row, selection tint applied, scroll of 5 000 rows makes 0 engine calls (counter). VERIFY: standing; snapshot PNG read. DO NOT: change row heights; editrows.rs. - 5. Note view: icon above the title and the banner.
OWNS:
crates/ui-egui/src/views/note_view/banner.rs,crates/ui-egui/src/views/note_view/title_icon.rs,crates/ui-egui/src/text/views/banner.rs, new[ui.banner]table at the END ofcrates/i18n/locales/en.toml,crates/ui-egui/tests/banner.rs. FILES TO OPEN:spec.mdD4,crates/ui-egui/src/views/base_view/layouts/cover.rs,crates/ui-egui/src/views/note_view/(find where the document top is laid out:grep -n "fn show" views/note_view/edit.rs). GOAL: banner painted full width at the top (cover crop withx/yfocus, height from settings), icon above the title (40 px);httpsbanner shows the placeholder "Remote banners are off" with no request; missing file shows nothing. The two hook lines inedit.rsare listed in the report for the lead. TESTS: kittest: banner present for a fixture note (image texture requested once), crop focusy=0.2picks the right source rect (unit test on the pure crop function), URL banner makes no engine/network call, no banner key shows nothing. VERIFY: standing +cargo xtask i18n; snapshot at 1440x900 with a real jpg fixture, PNG read. DO NOT: hardcode strings; decode on the UI thread. - 6. Icon and banner picker, context menu and palette entries.
OWNS:
crates/ui-egui/src/views/icon_picker/mod.rs,.../grid.rs,.../colors.rs,crates/ui-egui/src/text/views/icon_picker/mod.rs,[ui.icon_picker]table at the END ofen.toml,crates/ui-egui/tests/icon_picker.rs. FILES TO OPEN:crates/ui-egui/src/widgets/context_menu.rs,crates/ui-egui/src/views/share_dialog/mod.rs(modal with a job),crates/ui-egui/src/shell/app/window/menus.rs(where Explorer context menus are built),.claude/skills/notescraft-egui-screen/. GOAL: popover with Icons (search + grid), Emoji (text field), File (pick a vault image) and colour swatches fromtokens.theme.colors; Remove button; every choice callsdecor.set; entries "Set icon...", "Set banner...", "Remove icon" in the Explorer note/folder menu and the palette. Menu/palette wiring lines are listed for the lead. TESTS: kittest: search "rock" shows rocket, click sendsdecor.set {icon:"rocket"}once, colour swatch sendsiconColor, Remove sends nulls. VERIFY: standing +cargo xtask i18n+cargo xtask tree. DO NOT: use raw egui widgets where a library widget exists. - 7. Quick switcher, search rows, Bases name column; docs and status.
OWNS:
crates/ui-egui/src/widgets/palette.rs(note rows only),crates/ui-egui/src/panels/search_panel.rs(row leading icon),crates/ui-egui/src/views/base_view/table/cell.rs(name cell icon),ROADMAP.md,docs/ARCHITECTURE.md,docs/CODE-MAP.md(decor rows),specs/plugins-parity/roadmap.md(mark 16). FILES TO OPEN: those four files at the icon-painting lines,crates/ui-egui/src/design/note_icon.rs. GOAL: the same icon wherever a note name is listed; docs updated. TESTS: snapshot-free unit tests per surface use theDecorSnapshotfake; Bases name cell paints the icon for a decorated row. VERIFY:cargo xtask ci(whole set). DO NOT: add surfaces beyond the three.