Files
notescraft/specs/plugins-parity/briefs/20-web-capture-envelope.md
Marcos Paulo e8c8c06d1e
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: smart folder model, media time fragments, link card URL guard (MiniMax); specs for 10 more gaps (Codex) and the registry with bloat measurements
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 14:41:26 -03:00

2.5 KiB

TASK web-capture-envelope: web-clipper first-task model

Runs through OpenCode (specs/agents/opencode-runbook.md attached automatically). Task 1 of specs/plugins-parity/web-clipper/tasks.md.

OWNS

  • crates/engine/src/capture/web_model.rs (new, first write), unit tests inside it.
  • crates/engine/src/capture/mod.rs (one module declaration only).

FILES TO OPEN

  • specs/plugins-parity/web-clipper/spec.md D1.
  • crates/engine/src/capture/rules.rs and crates/engine/src/capture/mod.rs.

GOAL / API

Write crates/engine/src/capture/web_model.rs in your SECOND tool call: compiling stub plus ONE failing test first. Batch at most three relevant reads in first call, then make test pass. Module declarations listed in OWNS make unit tests discoverable.

Expose crate-private WebCapture::parse(&str) -> Result<Self, CommandError> with metadata, Target, Asset and named caps exactly from spec D1. Envelope v1 accepts Markdown, not arbitrary HTML. Source http(s) without credentials, safe target, title/control validation; base64 decode bounded and PNG/JPEG signatures checked. Eight assets maximum, <=256 KiB each, <=512 KiB aggregate, text <=256 KiB and wire <=1 MiB. Reject duplicate/missing asset ids. Recognize placeholders only in Markdown image destination spans; retain prose/code literal asset text. Reuse existing base64 decoder and Markdown parser; no dependencies. All invalid values return structured errors, never clamp/truncate.

TESTS

Minimal roundtrip; unknown version/field; malformed JSON/types; boundary/+1 for each cap; UTF-8 bytes; credentials/control characters; reserved/traversal target; malformed base64/signature/type; duplicate ids/missing placeholder; asset text inside fenced/inline code unchanged; whitespace-only invalid; valid PNG/JPEG accepted.

VERIFY

export PATH="$HOME/.cargo/bin:$PATH"
cargo test -p notescraft-engine capture::web_model
cargo clippy -p notescraft-engine --all-targets -- -D warnings
rustfmt --edition 2024 crates/engine/src/capture/web_model.rs

Format other owned Rust files individually too; no cargo fmt --all. Verification commands apply when implementing brief; current request is docs only.

DO NOT

Register commands, do IO, open sockets, fetch URLs, convert HTML, touch Cargo or add dependencies. No UI. Owner questions Q1-Q5 remain in spec; pure model needs no dependency decision. Do not edit outside OWNS, change Git state, commit, use unsafe, panic, unwrap/expect or input-derived indexing. No shared craft-libs API changes.