@superdoc-dev/cli 0.2.0-next.100 → 0.2.0-next.101

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.
package/dist/index.js CHANGED
@@ -121914,9 +121914,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
121914
121914
  init_remark_gfm_z_sDF4ss_es();
121915
121915
  });
121916
121916
 
121917
- // ../../packages/superdoc/dist/chunks/src-DDewAWSX.es.js
121918
- var exports_src_DDewAWSX_es = {};
121919
- __export(exports_src_DDewAWSX_es, {
121917
+ // ../../packages/superdoc/dist/chunks/src-CK4nCjzb.es.js
121918
+ var exports_src_CK4nCjzb_es = {};
121919
+ __export(exports_src_CK4nCjzb_es, {
121920
121920
  zt: () => defineMark,
121921
121921
  z: () => cM,
121922
121922
  yt: () => removeAwarenessStates,
@@ -199196,7 +199196,7 @@ var Node$13 = class Node$14 {
199196
199196
  trackedChanges: context.trackedChanges ?? []
199197
199197
  });
199198
199198
  }, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
199199
- var init_src_DDewAWSX_es = __esm(() => {
199199
+ var init_src_CK4nCjzb_es = __esm(() => {
199200
199200
  init_rolldown_runtime_B2q5OVn9_es();
199201
199201
  init_SuperConverter_DSgQEo7o_es();
199202
199202
  init_jszip_ChlR43oI_es();
@@ -218949,10 +218949,9 @@ function print() { __p += __j.call(arguments, '') }
218949
218949
  if (transaction) {
218950
218950
  this.#epochMapper.recordTransaction(transaction);
218951
218951
  this.#selectionSync.setDocEpoch(this.#epochMapper.getCurrentEpoch());
218952
- if (transaction.getMeta?.(ySyncPluginKey)?.isChangeOrigin && transaction.docChanged)
218953
- this.#flowBlockCache?.setHasExternalChanges(true);
218954
218952
  const inputType = transaction.getMeta?.("inputType");
218955
- if ((inputType === "historyUndo" || inputType === "historyRedo") && transaction.docChanged)
218953
+ const ySyncMeta = transaction.getMeta?.(ySyncPluginKey);
218954
+ if (transaction.docChanged && (ySyncMeta?.isChangeOrigin || inputType === "historyUndo" || inputType === "historyRedo"))
218956
218955
  this.#flowBlockCache?.setHasExternalChanges(true);
218957
218956
  }
218958
218957
  if (trackedChangesChanged || transaction?.docChanged) {
@@ -230954,8 +230953,8 @@ function print() { __p += __j.call(arguments, '') }
230954
230953
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
230955
230954
  };
230956
230955
  stubFalse_default = stubFalse;
230957
- freeExports$2 = typeof exports_src_DDewAWSX_es == "object" && exports_src_DDewAWSX_es && !exports_src_DDewAWSX_es.nodeType && exports_src_DDewAWSX_es;
230958
- freeModule$2 = freeExports$2 && typeof module_src_DDewAWSX_es == "object" && module_src_DDewAWSX_es && !module_src_DDewAWSX_es.nodeType && module_src_DDewAWSX_es;
230956
+ freeExports$2 = typeof exports_src_CK4nCjzb_es == "object" && exports_src_CK4nCjzb_es && !exports_src_CK4nCjzb_es.nodeType && exports_src_CK4nCjzb_es;
230957
+ freeModule$2 = freeExports$2 && typeof module_src_CK4nCjzb_es == "object" && module_src_CK4nCjzb_es && !module_src_CK4nCjzb_es.nodeType && module_src_CK4nCjzb_es;
230959
230958
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
230960
230959
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
230961
230960
  typedArrayTags = {};
@@ -230963,8 +230962,8 @@ function print() { __p += __j.call(arguments, '') }
230963
230962
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
230964
230963
  _baseIsTypedArray_default = baseIsTypedArray;
230965
230964
  _baseUnary_default = baseUnary;
230966
- freeExports$1 = typeof exports_src_DDewAWSX_es == "object" && exports_src_DDewAWSX_es && !exports_src_DDewAWSX_es.nodeType && exports_src_DDewAWSX_es;
230967
- freeModule$1 = freeExports$1 && typeof module_src_DDewAWSX_es == "object" && module_src_DDewAWSX_es && !module_src_DDewAWSX_es.nodeType && module_src_DDewAWSX_es;
230965
+ freeExports$1 = typeof exports_src_CK4nCjzb_es == "object" && exports_src_CK4nCjzb_es && !exports_src_CK4nCjzb_es.nodeType && exports_src_CK4nCjzb_es;
230966
+ freeModule$1 = freeExports$1 && typeof module_src_CK4nCjzb_es == "object" && module_src_CK4nCjzb_es && !module_src_CK4nCjzb_es.nodeType && module_src_CK4nCjzb_es;
230968
230967
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
230969
230968
  _nodeUtil_default = function() {
230970
230969
  try {
@@ -231069,8 +231068,8 @@ function print() { __p += __j.call(arguments, '') }
231069
231068
  Stack.prototype.has = _stackHas_default;
231070
231069
  Stack.prototype.set = _stackSet_default;
231071
231070
  _Stack_default = Stack;
231072
- freeExports = typeof exports_src_DDewAWSX_es == "object" && exports_src_DDewAWSX_es && !exports_src_DDewAWSX_es.nodeType && exports_src_DDewAWSX_es;
231073
- freeModule = freeExports && typeof module_src_DDewAWSX_es == "object" && module_src_DDewAWSX_es && !module_src_DDewAWSX_es.nodeType && module_src_DDewAWSX_es;
231071
+ freeExports = typeof exports_src_CK4nCjzb_es == "object" && exports_src_CK4nCjzb_es && !exports_src_CK4nCjzb_es.nodeType && exports_src_CK4nCjzb_es;
231072
+ freeModule = freeExports && typeof module_src_CK4nCjzb_es == "object" && module_src_CK4nCjzb_es && !module_src_CK4nCjzb_es.nodeType && module_src_CK4nCjzb_es;
231074
231073
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
231075
231074
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
231076
231075
  _cloneBuffer_default = cloneBuffer;
@@ -239150,7 +239149,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
239150
239149
 
239151
239150
  // ../../packages/superdoc/dist/super-editor.es.js
239152
239151
  var init_super_editor_es = __esm(() => {
239153
- init_src_DDewAWSX_es();
239152
+ init_src_CK4nCjzb_es();
239154
239153
  init_SuperConverter_DSgQEo7o_es();
239155
239154
  init_jszip_ChlR43oI_es();
239156
239155
  init_xml_js_DLE8mr0n_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.100",
3
+ "version": "0.2.0-next.101",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -20,21 +20,21 @@
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
- "@superdoc/pm-adapter": "0.0.0",
24
23
  "@superdoc/document-api": "0.0.1",
25
- "superdoc": "1.18.0",
26
- "@superdoc/super-editor": "0.0.1"
24
+ "@superdoc/pm-adapter": "0.0.0",
25
+ "@superdoc/super-editor": "0.0.1",
26
+ "superdoc": "1.18.0"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.100",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.100",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.100",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.100",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.100"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.101",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.101",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.101",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.101",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.101"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",
package/skill/SKILL.md CHANGED
@@ -1,45 +1,96 @@
1
1
  ---
2
2
  name: editing-docx
3
- description: Searches, replaces, and reads text in Word documents. Use when the user asks to edit, search, or extract text from .docx files.
3
+ description: Edit, query, and transform Word documents with the SuperDoc CLI v1 operation surface. Use when the user asks to read, search, modify, comment, or review changes in .docx files.
4
4
  ---
5
5
 
6
- # SuperDoc CLI
6
+ # SuperDoc CLI (v1)
7
7
 
8
- Edit Word documents from the command line. Use instead of python-docx.
8
+ Use SuperDoc CLI for DOCX work. Prefer canonical v1 commands.
9
+ Do not default to legacy commands unless explicitly needed for v0-style bulk workflows.
9
10
 
10
- ## Commands
11
+ Use `superdoc` if installed, or `npx @superdoc-dev/cli@latest` as a fallback.
11
12
 
12
- | Command | Description |
13
- |---------|-------------|
14
- | `npx @superdoc-dev/cli@latest search <pattern> <files...>` | Find text across documents |
15
- | `npx @superdoc-dev/cli@latest replace-legacy <find> <to> <files...>` | Find and replace text |
16
- | `npx @superdoc-dev/cli@latest read <file>` | Extract plain text |
13
+ ## First Step: Discover Exact Params
17
14
 
18
- ## When to Use
15
+ For unknown commands or flags, inspect runtime metadata first:
19
16
 
20
- Use superdoc when the user asks to:
21
- - Search text in .docx files
22
- - Find and replace text in Word documents
23
- - Extract text content from .docx files
24
- - Bulk edit multiple Word documents
17
+ ```bash
18
+ superdoc describe
19
+ superdoc describe command find
20
+ superdoc describe command "comments add"
21
+ ```
22
+
23
+ Use `describe command` for per-command args and constraints.
25
24
 
26
- ## Examples
25
+ ## Preferred Workflows
26
+
27
+ ### 1) Stateful multi-step edits (recommended)
27
28
 
28
29
  ```bash
29
- # Search across documents
30
- npx @superdoc-dev/cli@latest search "indemnification" ./contracts/*.docx
30
+ superdoc open ./contract.docx
31
+ superdoc find --type text --pattern "termination"
32
+ superdoc replace --target-json '{"kind":"text","blockId":"p1","range":{"start":0,"end":11}}' --text "expiration"
33
+ superdoc save --in-place
34
+ superdoc close
35
+ ```
31
36
 
32
- # Find and replace
33
- npx @superdoc-dev/cli@latest replace-legacy "ACME Corp" "Globex Inc" ./merger/*.docx
37
+ - After `open`, commands run against the active/default session when `<doc>` is omitted.
38
+ - Use `superdoc session list|set-default|save|close` for explicit session control.
39
+ - `close` on dirty state requires `--discard` or a prior `save`.
34
40
 
35
- # Extract text
36
- npx @superdoc-dev/cli@latest read ./proposal.docx
41
+ ### 2) Stateless one-off reads
37
42
 
38
- # JSON output for scripting
39
- npx @superdoc-dev/cli@latest search "Article 7" ./**/*.docx --json
43
+ ```bash
44
+ superdoc get-text ./proposal.docx
45
+ superdoc get-markdown ./proposal.docx
46
+ superdoc info ./proposal.docx
40
47
  ```
41
48
 
42
- ## Options
49
+ ### 3) Stateless one-off mutations
50
+
51
+ ```bash
52
+ superdoc replace ./proposal.docx \
53
+ --target-json '{"kind":"text","blockId":"p1","range":{"start":0,"end":5}}' \
54
+ --text "Updated" \
55
+ --out ./proposal.updated.docx
56
+ ```
57
+
58
+ - In stateless mode (`<doc>` provided), mutating commands require `--out` unless using `--dry-run`.
59
+
60
+ ## Common v1 Commands
61
+
62
+ - Search text/nodes: `find --type text --pattern "..."` or `find --query-json '{...}'`
63
+ - Replace text: `replace --target-json '{...}' --text "..."`
64
+ - Add/edit comments: `comments add|reply|edit|resolve|remove`
65
+ - Review tracked changes: `track-changes list|accept|reject|accept-all|reject-all`
66
+ - Extract content: `get-text`, `get-markdown`, `get-html`
67
+ - Low-level direct invoke: `call <operationId> --input-json '{...}'`
68
+
69
+ ## JSON/File Payload Flags
70
+
71
+ Use one of each pair (not both):
72
+
73
+ - `--query-json` or `--query-file`
74
+ - `--target-json` or `--target-file`
75
+ - `--address-json` or `--address-file`
76
+ - `--input-json` or `--input-file` (for `call`)
77
+
78
+ ## Output and Global Flags
79
+
80
+ - Default output is JSON envelope.
81
+ - Use `--pretty` for human-readable output.
82
+ - Global flags: `--output <json|pretty>`, `--session <id>`, `--timeout-ms <n>`.
83
+ - `<doc>` can be `-` to read DOCX bytes from stdin.
84
+
85
+ ## Legacy Compatibility (Use Sparingly)
86
+
87
+ Legacy v0.x bridge commands still exist:
88
+
89
+ ```bash
90
+ superdoc search <pattern> <files...>
91
+ superdoc replace-legacy <find> <to> <files...>
92
+ superdoc read <file>
93
+ ```
43
94
 
44
- - `--json` Machine-readable output
45
- - `--help` Show help
95
+ Use these only when you specifically need v0-style behavior (especially multi-file glob search/replace).
96
+ For new automations, prefer v1 operations.