Files
Marcos Paulo 7f432138df
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: Obsidian plugin parity research, Bases spec and tasks, empty notescraft-bases crate
Inventory of the 29 core plugins (22 done, 2 partial, 5 missing), 80 community plugins with a verdict each, a ranked roadmap with 8 ready briefs, the Bases spec (D1-D13) and 20 tasks, ASCII wireframes of the Bases screens (PaperCraft was not running). crates/bases is registered at layer L2.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 00:30:28 -03:00

2.6 KiB

TASK uri-open: parse notescraft:// links and the uri.resolve command (Advanced URI)

Runs through OpenCode (specs/agents/opencode-runbook.md is attached automatically).

OWNS

  • crates/engine/src/uri/mod.rs, crates/engine/src/uri/parse.rs, crates/engine/src/uri/commands.rs (new folder), one mod uri; line in crates/engine/src/lib.rs, one register_uri(reg) call in crates/engine/src/commands.rs::register_core
  • crates/engine/src/ai/assistant_gate.rs (READ list), crates/engine/tests/core_commands.rs (CORE_IDS), crates/engine/tests/uri.rs

FILES TO OPEN

  • pattern: crates/engine/src/builtin/bookmark_commands.rs; crates/engine/src/vault/external.rs (how paths are validated against the vault)
  • crates/engine/src/vaults/ or vaults.list handler in crates/engine/src/commands.rs (vault names) for the vault field
  • crates/ui-egui/src/shell/app/window/menus.rs ("Copy Obsidian URL" shows the existing URL shape)

GOAL / API

Grammar: notescraft://open?vault=<name>&file=<path>[&heading=<h>][&block=<id>][&line=<n>], notescraft://new?vault=&name=<path>&content=<text> (content at most 8 KiB), notescraft://daily?vault=, notescraft://search?vault=&query=. Percent-decoding by hand (UTF-8, + is not a space); no dependency.

  • parse(&str) -> Result<UriAction> with UriAction { Open{vault, file, heading, block, line}, New{..}, Daily{..}, Search{..} }.
  • uri.resolve {url} (read-only) -> {action, vault, path, exists}; it never executes anything. new returns needs_confirmation: true so the UI asks before creating a note (an external link must not write silently).
  • Hostile input: path traversal (.., absolute, .obsidian/, .notescraft/) -> invalid_params; control characters; URL over 4 KiB; unknown action -> invalid_params.
  • notescraft://command is NOT supported (security): documented in rustdoc.

TESTS

crates/engine/tests/uri.rs: every action, percent-encoded UTF-8, .. refused, .notescraft/x refused, 5 KiB URL refused, unknown vault not_found, new flagged for confirmation, round trip with a format_open_uri(vault, file, heading) helper the UI will use for "Copy NotesCraft URL".

VERIFY

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

DO NOT

Register an OS URL scheme handler (apps/notescraft packaging is a follow-up for the lead); execute commands from a URL; touch apps/.