@superdoc-dev/cli 0.2.0-next.99 → 0.3.0-next.1

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 +129 -22
  2. package/dist/index.js +168497 -139070
  3. package/package.json +8 -8
  4. package/skill/SKILL.md +78 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.99",
3
+ "version": "0.3.0-next.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,20 +21,20 @@
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/pm-adapter": "0.0.0",
24
- "superdoc": "1.18.0",
24
+ "@superdoc/document-api": "0.0.1",
25
25
  "@superdoc/super-editor": "0.0.1",
26
- "@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.2.0-next.99",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.99",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.99",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.99",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.99"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.1",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.1",
35
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.1",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.1",
37
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.1"
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.