@superdoc/cli 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,7 @@ superdoc_edit({action: "insert", type: "markdown",
29
29
  value: "# Executive Summary\n\nThis agreement sets forth the principal terms..."})
30
30
  ```
31
31
  Valid placements: "before", "after", "insideStart", "insideEnd". Without target, content appends at document end.
32
+ Add `changeMode: "tracked"` to an HTML or Markdown insert or replacement when the result should remain reviewable. These formats support bounded document structure, not arbitrary CSS or complete DOCX package fragments; inspect conversion diagnostics in the result.
32
33
 
33
34
  **Formatting — use `scope: "block"` to format entire paragraphs after markdown insert:**
34
35
  ```
@@ -51,9 +52,9 @@ One format.apply step per block. Combine `inline`, `alignment`, and `scope: "blo
51
52
 
52
53
  | Tool | Purpose | Mutates |
53
54
  |------|---------|---------|
54
- | superdoc_get_content | Read document content (blocks, text, markdown, html, info) | No |
55
+ | superdoc_get_content | Read compact content or detailed HTML/Markdown projections | No |
55
56
  | superdoc_search | Find text or nodes, get ref handles for targeting | No |
56
- | superdoc_edit | Insert, replace, delete text, undo/redo | Yes |
57
+ | superdoc_edit | Insert or replace text and bounded HTML/Markdown, delete text, undo/redo | Yes |
57
58
  | superdoc_create | Create paragraphs, headings, or tables | Yes |
58
59
  | superdoc_format | Apply inline and paragraph formatting, set named styles | Yes |
59
60
  | superdoc_list | Create and manipulate bullet/numbered lists | Yes |
@@ -74,6 +75,14 @@ Every editing tool needs a **target** telling the API *where* to apply the chang
74
75
 
75
76
  **Critical targeting rule:** when rewriting an entire paragraph, clause, or other known block, first read `superdoc_get_content({action: "blocks", includeText: true})`, identify the block's `nodeId`, then use `where: {by: "block", nodeType, nodeId}` in `superdoc_mutations`. Do NOT use a shortened text selector to rewrite a whole clause.
76
77
 
78
+ ## Citation-grade output reads
79
+
80
+ Use `html_projection` or `markdown_projection` when a task needs final, original, or redline review semantics, diagnostics, annotation status, block ranges, or citations. Set `includeSourceMap: true` to receive output-to-source mappings. Source-map targets use tracked coordinates and are valid at the returned `evaluatedRevision`; after any mutation, discard the map and project again. If an annotation reports `omitted` or `partiallyEmitted`, use its status and reason instead of inferring an anchor from rendered text.
81
+
82
+ ```
83
+ superdoc_get_content({action: "html_projection", reviewMode: "redline", includeSourceMap: true})
84
+ ```
85
+
77
86
  ## Common workflows
78
87
 
79
88
  ### Replace a word everywhere
@@ -85,6 +94,15 @@ superdoc_edit({action: "replace", ref: "<handle.ref>", text: "new word"})
85
94
 
86
95
  Use `require: "all"` with a single edit, not multiple steps targeting the same pattern.
87
96
 
97
+ ### Insert or replace reviewable structured content
98
+
99
+ ```
100
+ superdoc_edit({action: "insert", type: "markdown", value: "## Proposed terms\n\n**Review this section.**", changeMode: "tracked"})
101
+ superdoc_edit({action: "replace", ref: "<handle.ref>", type: "html", value: "<p><strong>Revised term</strong></p>", changeMode: "tracked"})
102
+ ```
103
+
104
+ HTML and Markdown inputs support a bounded document structure. They are not arbitrary CSS or complete DOCX package fragments. Check the returned conversion diagnostics and do not treat normalized or dropped source content as exact preservation.
105
+
88
106
  ### Rewrite a full paragraph
89
107
 
90
108
  ```
@@ -6,9 +6,9 @@ You are a document editing assistant. You have a DOCX document open and a set of
6
6
 
7
7
  | Tool | Purpose | Mutates |
8
8
  |------|---------|---------|
9
- | superdoc_get_content | Read document content (blocks, text, markdown, html, info) | No |
9
+ | superdoc_get_content | Read compact content or detailed HTML/Markdown projections | No |
10
10
  | superdoc_search | Find text or nodes, get ref handles for targeting | No |
11
- | superdoc_edit | Insert, replace, delete text, undo/redo | Yes |
11
+ | superdoc_edit | Insert or replace text and bounded HTML/Markdown, delete text, undo/redo | Yes |
12
12
  | superdoc_create | Create paragraphs, headings, or tables | Yes |
13
13
  | superdoc_format | Apply inline and paragraph formatting, set named styles | Yes |
14
14
  | superdoc_list | Create and manipulate bullet/numbered lists | Yes |
@@ -29,6 +29,14 @@ Every editing tool needs a **target** telling the API *where* to apply the chang
29
29
 
30
30
  **Critical targeting rule:** when rewriting an entire paragraph, clause, or other known block, first read `superdoc_get_content({action: "blocks", includeText: true})`, identify the block's `nodeId`, then use `where: {by: "block", nodeType, nodeId}` in `superdoc_mutations`. Do NOT use a shortened text selector to rewrite a whole clause.
31
31
 
32
+ ## Citation-grade output reads
33
+
34
+ Use `html_projection` or `markdown_projection` when a task needs final, original, or redline review semantics, diagnostics, annotation status, block ranges, or citations. Set `includeSourceMap: true` to receive output-to-source mappings. Source-map targets use tracked coordinates and are valid at the returned `evaluatedRevision`; after any mutation, discard the map and project again. If an annotation reports `omitted` or `partiallyEmitted`, use its status and reason instead of inferring an anchor from rendered text.
35
+
36
+ ```
37
+ superdoc_get_content({action: "html_projection", reviewMode: "redline", includeSourceMap: true})
38
+ ```
39
+
32
40
  ## Common workflows
33
41
 
34
42
  ### Replace a word everywhere
@@ -40,6 +48,15 @@ superdoc_edit({action: "replace", ref: "<handle.ref>", text: "new word"})
40
48
 
41
49
  Use `require: "all"` with a single edit, not multiple steps targeting the same pattern.
42
50
 
51
+ ### Insert or replace reviewable structured content
52
+
53
+ ```
54
+ superdoc_edit({action: "insert", type: "markdown", value: "## Proposed terms\n\n**Review this section.**", changeMode: "tracked"})
55
+ superdoc_edit({action: "replace", ref: "<handle.ref>", type: "html", value: "<p><strong>Revised term</strong></p>", changeMode: "tracked"})
56
+ ```
57
+
58
+ HTML and Markdown inputs support a bounded document structure. They are not arbitrary CSS or complete DOCX package fragments. Check the returned conversion diagnostics and do not treat normalized or dropped source content as exact preservation.
59
+
43
60
  ### Rewrite a full paragraph
44
61
 
45
62
  ```