7f432138df
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>
2.6 KiB
2.6 KiB
TASK export-pandoc: export.pandoc through an installed pandoc binary (Pandoc plugin)
Runs through OpenCode (specs/agents/opencode-runbook.md is attached automatically).
OWNS
crates/engine/src/pandoc/mod.rs,crates/engine/src/pandoc/run.rs,crates/engine/src/pandoc/commands.rs(new folder), onemod pandoc;line incrates/engine/src/lib.rs, oneregister_pandoc(reg)call incrates/engine/src/commands.rs::register_corecrates/engine/tests/pandoc.rs,crates/engine/tests/core_commands.rs(CORE_IDS),crates/engine/src/ai/assistant_gate.rs(WRITE list)
FILES TO OPEN
- pattern:
crates/engine/src/builtin/export_commands.rs(export.pdf:out_path,reject_outside_vault,write_without_overwrite) crates/engine/src/vault/external.rs(spawning external programs, if any),crates/engine/src/vault/pdf_preview.rs(howpdftoppmis discovered and degraded)
GOAL / API
export.pandoc {path, format: docx|epub|html|odt|latex|rst, out?, resolve_embeds?: bool}:
- Finds
pandocon PATH (and/opt/homebrew/bin,/usr/local/bin); not found -> errortool_missingwith a message naming pandoc andhttps://pandoc.org/installing.html; the command isenabledonly when it is found. - Runs
pandoc -f gfm+wikilinks_title_after_pipe -t <format> -o <out>with the note text on stdin (wikilinks[[a|b]]become links to titles; embeds replaced by their text whenresolve_embeds, up to depth 3), a 60 s timeout, working dir = the note's folder, stderr captured (4 KiB cap) into the error. outdefaults to<note>.<ext>beside the note;reject_outside_vaultasexport.pdf; never overwrites (suffix2).- Arguments are passed as an argv array (never through a shell);
formatis matched against the list above, so no injection. - No network: add
--sandboxto the pandoc call.
TESTS
crates/engine/tests/pandoc.rs: use a fake pandoc shell script placed in a temp dir put FIRST on a PATH override parameter (add Session-free function run_pandoc(bin: &Path, ...) and test that; do not depend on a real pandoc): argv exactly as specified, timeout kills a sleeping fake, stderr surfaced, tool_missing when absent, out outside the vault refused, no overwrite, bad format refused.
VERIFY
export PATH="$HOME/.cargo/bin:$PATH"
cargo test -p notescraft-engine --test pandoc
cargo test -p notescraft-engine --test core_commands
cargo clippy -p notescraft-engine --all-targets -- -D warnings
rustfmt --edition 2024 crates/engine/src/pandoc/*.rs crates/engine/tests/pandoc.rs
DO NOT
Add a dependency (use std::process::Command); bundle pandoc; add UI (an Export submenu entry is a follow-up); run through sh -c.