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

5.0 KiB

Tasks: rich link bookmark cards (roadmap 30)

One task = one agent (specs/agents/opencode-runbook.md). 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 (compiling stub + 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 tasks add cargo xtask i18n; last task adds cargo xtask layers and cargo xtask tree. Standing DO NOT: edit Cargo files (except where OWNS lists them), files outside OWNS, git state, cargo fmt --all; add allow; unwrap/expect/panic/[i]/[a..b] on input-derived data; add a dependency; make any network call outside linkcard/fetch.rs.

Owner/lead step 0

Answer Q1 to Q3. Tasks 2+ need clean-paste task 1 merged (crate notescraft-htmlmd); task 1 does not.

Phase 1 - pure engine pieces

  • 1. URL guard, normalisation and cache key (brief briefs/17-linkcard-url-guard.md). OWNS: crates/engine/src/linkcard/url.rs, crates/engine/src/linkcard/mod.rs, one mod linkcard; in crates/engine/src/lib.rs, unit tests inside url.rs.
  • 2. OpenGraph extraction. OWNS: crates/engine/Cargo.toml (one dep line notescraft-htmlmd = { workspace = true }), crates/engine/src/linkcard/og.rs, crates/engine/src/linkcard/mod.rs (one mod og;), unit tests in og.rs. FILES TO OPEN: spec.md D3 and acceptance 6, crates/htmlmd/src/tokens.rs. GOAL: pub(crate) fn parse_card(html_head: &str, final_url: &str) -> Card with clipped fields; relative favicon/image URLs resolved against final_url (kept as strings, never fetched); og:* preferred, then twitter:*, <title>, meta description. TESTS: full OG page; only <title>; relative favicon; attribute order variants; entities in title; 1 MiB title clipped; 10 000 metas bounded; garbage input -> empty card. VERIFY: standing -p notescraft-engine. DO NOT: network; DOM building.
  • 3. Cache store. OWNS: crates/engine/src/linkcard/cache.rs, tests inside. FILES TO OPEN: spec.md D2, crates/engine/src/bases/tiles/mod.rs (cache folder pattern), crates/engine/src/activity/outbox.rs (write_private), sha2 use: git grep -n "sha2" crates/engine/src | head. GOAL: get(&Session, &str) -> Option<Card>, put, clear, eviction beyond 2 000 by fetched_ms; corrupt entry ignored and removed. TESTS: round trip, eviction, corrupt file, path stays inside .notescraft/cache/web/. VERIFY: standing. DO NOT: write outside the cache folder.

Phase 2 - fetch and commands

  • 4. fetch, commands, setting. OWNS: crates/engine/src/linkcard/fetch.rs, .../commands.rs, one register_linkcard(reg) call in commands.rs::register_core, crates/engine/src/prefs/web_config.rs, crates/engine/src/prefs/catalog/ entry, crates/engine/src/ai/assistant_gate.rs (linkcard.get READ, linkcard.clear WRITE; linkcard.fetch deliberately absent, add a comment saying so), crates/engine/tests/core_commands.rs, crates/engine/tests/linkcard.rs. FILES TO OPEN: spec.md D1 and D3, crates/engine/src/bases/tiles/ (the existing opt-in fetcher: copy its switch, timeouts and test stub), crates/engine/tests/publish_stub/ (in-process HTTP stub). GOAL: D1 rules exactly, redirects re-checked by hand (ureq agent with redirects 0, loop of 3). TESTS: acceptance 1, 3, 4, 5 against the stub (including a redirect to 127.0.0.1 and a 5 MiB body); concurrency cap; network_disabled error code; assistant gate test proves linkcard.fetch is not callable by the assistant. VERIFY: standing + --test linkcard --test core_commands. DO NOT: fetch images; fetch from get.

Phase 3 - UI

  • 5. Card block, fetch action, settings. OWNS: crates/ui-egui/src/views/note_view/blocks/link_card.rs, crates/ui-egui/src/shell/app/link_cards.rs (worker + memory snapshot), crates/ui-egui/src/views/settings_view/categories/web.rs, crates/ui-egui/src/text/views/link_cards.rs, [ui.link_cards] at END of en.toml, crates/ui-egui/tests/link_cards.rs. FILES TO OPEN: spec.md D4, crates/ui-egui/src/views/note_view/blocks/ (a finished block, e.g. embed_data.rs), crates/ui-egui/src/views/settings_view/categories/maps.rs (opt-in card to copy), crates/ui-egui/src/views/share_dialog/mod.rs (worker), .claude/skills/notescraft-egui-screen/. GOAL: D4; standalone-URL detection is a pure fn with tests; hook lines in the block dispatcher and the context menu are listed for the lead. TESTS: kittest: cached URL paints card; uncached paints plain link; disabled setting shows notice and Fetch sends nothing; 50 URLs -> 0 fetch calls; click opens URL. VERIFY: standing + cargo xtask i18n tree; snapshot PNG read. DO NOT: auto-fetch; hardcode strings; raw widgets.
  • 6. Docs and status. OWNS: ROADMAP.md, docs/ARCHITECTURE.md, docs/CODE-MAP.md, specs/plugins-parity/roadmap.md (mark 30 and update the Network policy reminder). VERIFY: cargo xtask ci.