Expand description
§jubarte-edit
The edit product of the jubarte engine: edit::apply_plan /
apply_plan_json write an edit plan as tracked changes (rewrite,
insert, tables, lists, run formatting, footnotes, images, page setup,
content controls, watermark, redact, settings, field updates),
text_diff renders text diffs as the agent view prints them,
expect checks plans against their schema, capabilities names what
the bindings expose, and publication stages host filesystem output.
The composed markdown module adds the patch, redline and unified
views to the markdown crate’s reader and writer.
§Example
use jubarte_edit::edit::apply_plan_json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let source = std::fs::read("contract.docx")?;
// Paragraph ids (`p12`) are the ones `jubarte read contract.docx` prints.
let plan = r#"{
"schema_version": 1,
"author": "Reviewer",
"operations": [{
"id": "term",
"kind": "replace",
"paragraph": "p12",
"find": "two years",
"replacement": "three years"
}]
}"#;
let result = apply_plan_json(&source, plan)?;
std::fs::write("contract_redline.docx", &result.redline)?;
std::fs::write("contract_clean.docx", &result.clean)?;
Ok(())
}Modules§
- admission
- Input admission: budgets, refusal reasons, and the limits types the bindings and CLI expose. Resource admission for untrusted DOCX input: bound the ZIP container before anything inflates it without limits.
- capabilities
- What the bindings expose, feature by feature.
What this build can do. Agents read it before choosing an operation:
jubarte capabilities --json,jubarte_redlines.capabilities(). - changes
- Tracked changes one at a time: list, accept or reject a selection. Tracked changes one at a time: list each with an id, accept or reject a selection and keep the rest tracked, as Word’s Accept/Reject This Change does.
- comments
- Comment threads across the parts that hold them. Comment threads: list every comment with its thread position and the text it is anchored to, and write the comment part family whole.
- comparer
- The comparison core: atomizing, matching, and the redline writer.
WmlComparer core (M4). Port of
WmlComparer.ts. - debug
- Maintainer triage views.
jubarte debug: triage a.docxthat Word refuses, or compare two builds of one. Every report is short on purpose. It counts findings by kind, shows a few examples of each (limit), and with two files prints only what differs. - document_
comparer - One-call document comparison and revision accept/reject.
DocumentComparer façade (M5). Port of
DocumentComparer.ts(compare path). - edit
- Tracked-change editing: plans in, redlines and clean copies out. Guarded document editing for agents and tools.
- expect
- The
--expectplan checker. V2-13 (issue #845): the checker core for--expectevaluations. - ids
- The one grammar of the ids jubarte prints and reads:
ShortId(src/ids/short.rs, spec 2026-10-13 §2 and §2.1). The functions here are the options’ views of it: a change (r12,r1+2,header1.r1), a comment (c27), the text a comment covers (c27.text), and what-ptakes (a paragraphp12, a storyheader1or its paragraphheader1.p2, a cellt0.row1.cell2[.p1], a comment, or changes). - inspect
- Read-only paragraph/package views and the Markdown projection. Read-only views of a DOCX for agents and tools: body paragraphs an edit can address, package facts, and a Markdown projection that carries paragraph ids so the reader’s coordinates are the editor’s coordinates.
- markdown
- The composed markdown module (A6): the markdown crate’s module plus
this crate’s patch, redline and unified modules, reproducing the
facade’s historical
markdownfrom one place. - namespaces
- WordprocessingML and related namespace /
XNameconstants. WordprocessingML and related namespace /XNameconstants ported fromPtOpenXmlUtil.ts(the subset the comparer references) — M1.7. - opc
- Open Packaging Conventions adapter (
PartFs). OPC (Open Packaging Conventions) layer — M1.5. - publication
- Host filesystem publication, capability-confined and staged. Host filesystem publication is unavailable to browser/WASM byte APIs. Stage complete bytes before replacing outputs. A set has one commit per file; errors name any files already committed. No rollback or delete-old fallback is attempted. Native host filesystems only.
- result
- Stable result codes the bindings print.
Machine result envelope for the v2 routes (
edit apply,edit template,review accept, and friends). - revision_
processor - Accept and reject tracked revisions across a package. Revision accept / reject pipeline (M3).
- settings
- Settings application (
w:settings). Document settings an edit plan writes intoword/settings.xml: Track Changes on or off,updateFieldson open, and editing restrictions. - strict_
translation - ISO Strict → Transitional package normalization. ISO/IEC 29500 Strict → Transitional namespace normalization (M8).
- text_
diff - Text diff views (agent view and CriticMarkup). Git/GitHub unified patches of complete document text snapshots, and other review presentations.
- util
- Shared small utilities.
Small shared utilities, ported from
PtUtil.ts(M1.6). - validate
- Check that Word will open a package, and repair it. Word-validity findings beyond the schema: what makes Word refuse or repair a package, as data.
- xmllinq
- Arena DOM (
xmllinq) used by the comparer. LINQ-to-XML-style mutable XML tree, ported fromlib/xml-linq.ts.