@superdoc-dev/cli 0.3.0-next.10 → 0.3.0-next.13

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.
Files changed (4) hide show
  1. package/README.md +5 -4
  2. package/dist/index.js +128439 -90615
  3. package/package.json +9 -9
  4. package/skill/SKILL.md +66 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.10",
3
+ "version": "0.3.0-next.13",
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/super-editor": "0.0.1",
25
- "superdoc": "1.19.0",
26
- "@superdoc/document-api": "0.0.1"
24
+ "@superdoc/pm-adapter": "0.0.0",
25
+ "@superdoc/document-api": "0.0.1",
26
+ "superdoc": "1.19.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.3.0-next.10",
34
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.10",
35
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.10",
36
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.10",
37
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.10"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.13",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.13",
35
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.13",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.13",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.13"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",
package/skill/SKILL.md CHANGED
@@ -5,7 +5,7 @@ description: Edit, query, and transform Word documents with the SuperDoc CLI v1
5
5
 
6
6
  # SuperDoc CLI (v1)
7
7
 
8
- Use SuperDoc CLI for DOCX work. Prefer canonical v1 commands.
8
+ Use SuperDoc CLI for DOCX work. Use v1 commands (canonical operations and their helper wrappers).
9
9
  Do not default to legacy commands unless explicitly needed for v0-style bulk workflows.
10
10
 
11
11
  Use `superdoc` if installed, or `npx @superdoc-dev/cli@latest` as a fallback.
@@ -28,12 +28,13 @@ Use `describe command` for per-command args and constraints.
28
28
 
29
29
  ```bash
30
30
  superdoc open ./contract.docx
31
- superdoc find --type text --pattern "termination"
31
+ superdoc query match --select-json '{"type":"text","pattern":"termination"}' --require exactlyOne
32
32
  superdoc replace --target-json '{"kind":"text","blockId":"p1","range":{"start":0,"end":11}}' --text "expiration"
33
33
  superdoc save --in-place
34
34
  superdoc close
35
35
  ```
36
36
 
37
+ - Always use `query match` (not `find`) to discover mutation targets — it returns exact addresses with cardinality guarantees.
37
38
  - After `open`, commands run against the active/default session when `<doc>` is omitted.
38
39
  - Use `superdoc session list|set-default|save|close` for explicit session control.
39
40
  - `close` on dirty state requires `--discard` or a prior `save`.
@@ -57,28 +58,80 @@ superdoc replace ./proposal.docx \
57
58
 
58
59
  - In stateless mode (`<doc>` provided), mutating commands require `--out` unless using `--dry-run`.
59
60
 
61
+ ### Safety: preview before apply
62
+
63
+ - Use `--dry-run` to preview any mutation without applying it.
64
+ - Use `--expected-revision <n>` with stateful mutations for optimistic concurrency checks.
65
+
60
66
  ## Common v1 Commands
61
67
 
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`
68
+ ### Query & inspect
69
+
70
+ - Search/browse content: `find --type text --pattern "..."` or `find --query-json '{...}'`
71
+ - Find mutation target: `query match --select-json '{...}' --require exactlyOne`
72
+ - Inspect blocks: `blocks list`, `get-node`, `get-node-by-id`
66
73
  - Extract content: `get-text`, `get-markdown`, `get-html`
67
- - Low-level direct invoke: `call <operationId> --input-json '{...}'`
74
+
75
+ ### Mutate
76
+
77
+ - Replace text: `replace --target-json '{...}' --text "..."`
78
+ - Insert inline text: `insert --block-id <id> --offset <n> --value "..."`
79
+ - Delete text/node: `delete --target-json '{...}'`
80
+ - Delete blocks: `blocks delete`, `blocks delete-range`
81
+ - Batch mutations: `mutations apply --steps-json '[...]' --atomic true --change-mode direct`
82
+ - Create paragraph: `create paragraph --text "..."` (with optional `--at-json`)
83
+ - Create heading: `create heading --input-json '{"level":<n>,"text":"..."}'`
84
+
85
+ ### Format
86
+
87
+ - Apply formatting: `format apply --block-id <id> --start <n> --end <n> --inline-json '{"bold":true}'`
88
+ - Shortcuts: `format bold`, `format italic`, `format underline`, `format strikethrough`
89
+
90
+ ### Lists
91
+
92
+ - List items: `lists list`, `lists get`
93
+ - Insert list item: `lists insert --node-id <id> --position after --text "..."`
94
+ - Modify: `lists indent`, `lists outdent`, `lists set-level`, `lists set-type`, `lists convert-to-text`
95
+
96
+ ### Comments
97
+
98
+ - Add/reply: `comments add`, `comments reply`
99
+ - Read: `comments get`, `comments list`
100
+ - Edit/resolve/move: `comments edit`, `comments resolve`, `comments move`, `comments set-internal`
101
+ - Delete: `comments delete` (canonical) or `comments remove` (alias)
102
+
103
+ ### Track changes
104
+
105
+ - List: `track-changes list`, `track-changes get`
106
+ - Decide: `track-changes accept`, `track-changes reject`, `track-changes accept-all`, `track-changes reject-all`
107
+
108
+ ### History
109
+
110
+ - `history get`, `history undo`, `history redo`
111
+
112
+ ### Low-level
113
+
114
+ - Direct invoke: `call <operationId> --input-json '{...}'` (JSON output only — `--pretty` is not supported)
68
115
 
69
116
  ## JSON/File Payload Flags
70
117
 
71
- Use one of each pair (not both):
118
+ Not all `--*-file` variants are available on every command. Use `describe command <name>` to check.
119
+
120
+ Always supported alongside their `-json` counterpart (use one, not both):
121
+
122
+ | Flag pair | Available on |
123
+ |-----------|-------------|
124
+ | `--query-json` / `--query-file` | `find`, `lists list` |
125
+ | `--address-json` / `--address-file` | `get-node`, `lists get` |
126
+ | `--input-json` / `--input-file` | `call`, `create paragraph` |
127
+ | `--at-json` / `--at-file` | `create paragraph` |
72
128
 
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`)
129
+ `--target-json` is widely available on mutation commands but has **no** `--target-file` counterpart. Use flat flags (`--block-id`, `--start`, `--end`) as an alternative to `--target-json`.
77
130
 
78
131
  ## Output and Global Flags
79
132
 
80
133
  - Default output is JSON envelope.
81
- - Use `--pretty` for human-readable output.
134
+ - Use `--pretty` for human-readable output (not supported by `call`).
82
135
  - Global flags: `--output <json|pretty>`, `--session <id>`, `--timeout-ms <n>`.
83
136
  - `<doc>` can be `-` to read DOCX bytes from stdin.
84
137