@superdoc/cli 0.36.0-next.5 → 0.36.0-next.6

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/README.md CHANGED
@@ -64,6 +64,16 @@ If the password is missing or incorrect, the CLI returns a structured error with
64
64
 
65
65
  ## Choosing the Right Command
66
66
 
67
+ Search the CLI contract when you know the intent but not the operation name:
68
+
69
+ ```bash
70
+ superdoc discover "create a footnote"
71
+ superdoc discover "add an sdt"
72
+ superdoc discover "change table cell padding"
73
+ ```
74
+
75
+ `discover` uses the generated Document API contract plus CLI vocabulary and operation relationships. It returns an adaptive relevant set with at most ten results. The leading result includes a compact input shape, CLI parameters, a command template, and the exact `describe command` follow-up. Use `--limit <1-10>` to request a smaller ceiling.
76
+
67
77
  ### Which command should I use?
68
78
 
69
79
  | I want to... | Use this command |
@@ -159,7 +169,7 @@ superdoc save --in-place
159
169
  | history | `history get`, `history undo`, `history redo` |
160
170
  | lifecycle | `open`, `save`, `close` |
161
171
  | session | `session list`, `session save`, `session close`, `session set-default`, `session use` |
162
- | introspection | `status`, `describe`, `describe command` |
172
+ | introspection | `status`, `discover`, `describe`, `describe command` |
163
173
  | low-level | `call <operationId>` |
164
174
  | legacy compat | `search`, `replace-legacy <find> <to> <files...>`, `read` |
165
175
 
@@ -167,6 +177,7 @@ For full command help and examples, run:
167
177
 
168
178
  ```bash
169
179
  superdoc --help
180
+ superdoc discover "<natural-language intent>"
170
181
  superdoc save --help
171
182
  superdoc create paragraph --help
172
183
  superdoc describe command <command-name>
@@ -210,15 +221,30 @@ superdoc host --stdio
210
221
  ## API introspection commands
211
222
 
212
223
  ```bash
224
+ superdoc discover "set padding on one table cell"
213
225
  superdoc describe
214
226
  superdoc describe command doc.find
215
227
  superdoc status
216
228
  ```
217
229
 
218
- - `describe` returns contract + protocol metadata and the operation catalog.
230
+ - `discover <intent>` ranks relevant operations and expands the leading input shape without opening a document.
231
+ - `describe` returns contract + protocol metadata and the exhaustive operation catalog.
219
232
  - `describe command <operationId>` returns one operation definition (inputs, response schema, errors, examples).
220
233
  - `status` shows current session status and document metadata.
221
234
 
235
+ ## Discovery evaluation
236
+
237
+ The repository includes a canonical intent corpus with expected operations in `eval/discovery-cases.json`.
238
+
239
+ ```bash
240
+ pnpm eval:discovery
241
+ pnpm eval:discovery -- --case sdt-ambiguous-add
242
+ pnpm eval:discovery -- --query "add a repeating section control"
243
+ pnpm eval:discovery -- --json
244
+ ```
245
+
246
+ The suite reports Top-1 accuracy, MRR, Recall@3, Recall@10, mean result count, payload size, and p95 search latency. It exits nonzero when an expected ranking, result-set bound, command helper, or ambiguity classification fails.
247
+
222
248
  ## Stateful session commands
223
249
 
224
250
  ```bash
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/index.js
3
- size: 36505031 bytes
4
- sha256: 44fc3ee227526847c4e93f7860966c6680e08893fc5a589ec168ef357776a735
3
+ size: 36550942 bytes
4
+ sha256: 25d1070b3376607e2e2f4f78c78be877843f1eca8dee81f6d1bd9361778b27fa
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/cli",
3
- "version": "0.36.0-next.5",
3
+ "version": "0.36.0-next.6",
4
4
  "description": "Command-line interface for SuperDoc: inspect, convert, and edit .docx files from a terminal or a script.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@hocuspocus/server": "^2.13.6",
38
- "@superdoc/sdk": "2.13.0-next.5",
38
+ "@superdoc/sdk": "2.13.0-next.6",
39
39
  "@superdoc/document-api": "0.1.0-alpha.0",
40
40
  "@superdoc/docx-engine": "0.15.0-next.5",
41
41
  "@types/bun": "^1.3.8",
@@ -51,11 +51,11 @@
51
51
  "access": "public"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@superdoc/cli-darwin-arm64": "0.36.0-next.5",
55
- "@superdoc/cli-darwin-x64": "0.36.0-next.5",
56
- "@superdoc/cli-linux-x64": "0.36.0-next.5",
57
- "@superdoc/cli-linux-arm64": "0.36.0-next.5",
58
- "@superdoc/cli-windows-x64": "0.36.0-next.5"
54
+ "@superdoc/cli-darwin-arm64": "0.36.0-next.6",
55
+ "@superdoc/cli-darwin-x64": "0.36.0-next.6",
56
+ "@superdoc/cli-linux-x64": "0.36.0-next.6",
57
+ "@superdoc/cli-linux-arm64": "0.36.0-next.6",
58
+ "@superdoc/cli-windows-x64": "0.36.0-next.6"
59
59
  },
60
60
  "scripts": {
61
61
  "predev": "node scripts/ensure-superdoc-build.js",
@@ -78,6 +78,7 @@
78
78
  "test:docx-reference-integrity": "node --test scripts/docx-reference-integrity.mjs",
79
79
  "test:sdk-collaborative-close": "NODE_ENV=test bun test src/__tests__/sdk-collaborative-close.e2e.test.ts",
80
80
  "test:sdk-replace-file": "NODE_ENV=test bun test src/__tests__/sdk-replace-file.e2e.test.ts",
81
+ "eval:discovery": "bun run scripts/evaluate-discovery.ts",
81
82
  "lint": "pnpm -w exec vp lint apps/cli",
82
83
  "lint:fix": "pnpm -w exec vp lint --fix apps/cli",
83
84
  "format": "pnpm -w exec vp fmt apps/cli",
package/skill/SKILL.md CHANGED
@@ -10,17 +10,25 @@ Do not default to legacy commands unless explicitly needed for v0-style bulk wor
10
10
 
11
11
  Use `superdoc` if installed, or `npx @superdoc/cli@latest` as a fallback.
12
12
 
13
- ## First Step: Discover Exact Params
13
+ ## First Step: Discover the Operation
14
14
 
15
- For unknown commands or flags, inspect runtime metadata first:
15
+ When the operation is not already known, search by the user's exact intent:
16
16
 
17
17
  ```bash
18
- superdoc describe
19
- superdoc describe command find
20
- superdoc describe command "comments add"
18
+ superdoc discover "create a footnote"
19
+ superdoc discover "add an sdt"
20
+ superdoc discover "change table cell padding"
21
21
  ```
22
22
 
23
- Use `describe command` for per-command args and constraints.
23
+ Discovery returns an adaptive set of relevant operations, capped at ten. A clear intent may return one result. An ambiguous or broad intent may return more. The leading result includes its compact input shape and a command template.
24
+
25
+ Use the returned `schemaCommand` when the compact shape is not enough:
26
+
27
+ ```bash
28
+ superdoc describe command doc.footnotes.insert
29
+ ```
30
+
31
+ Do not run the full `superdoc describe` catalogue to discover an operation. Use it only when an exhaustive inventory is explicitly needed.
24
32
 
25
33
  ## Preferred Workflows
26
34