@superdoc/cli 0.35.0-next.1 → 0.35.0-next.3

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 (3) hide show
  1. package/README.md +5 -0
  2. package/dist/index.js +69 -19
  3. package/package.json +8 -8
package/README.md CHANGED
@@ -167,9 +167,14 @@ For full command help and examples, run:
167
167
 
168
168
  ```bash
169
169
  superdoc --help
170
+ superdoc save --help
171
+ superdoc create paragraph --help
170
172
  superdoc describe command <command-name>
173
+ superdoc describe command doc.save
171
174
  ```
172
175
 
176
+ Use `--help` or `-h` with a command to read its usage without opening a document or executing the command. Operation help includes `schemaCommand`, an executable command for retrieving the complete parameter schema. Add `--pretty` for terminal-readable output.
177
+
173
178
  ## v1 Breaking Changes
174
179
 
175
180
  This CLI replaces the previous `@superdoc-dev/cli` package surface with the v1 contract-driven command set.
package/dist/index.js CHANGED
@@ -26288,12 +26288,6 @@ var init_input_readers = __esm(() => {
26288
26288
  init_errors();
26289
26289
  });
26290
26290
 
26291
- // src/lib/collaboration/types.ts
26292
- var ENV_VAR_NAME_PATTERN;
26293
- var init_types3 = __esm(() => {
26294
- ENV_VAR_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
26295
- });
26296
-
26297
26291
  // src/lib/guards.ts
26298
26292
  import { constants } from "node:fs";
26299
26293
  import { access } from "node:fs/promises";
@@ -26315,6 +26309,12 @@ async function pathExists(path) {
26315
26309
  }
26316
26310
  var init_guards = () => {};
26317
26311
 
26312
+ // src/lib/collaboration/types.ts
26313
+ var ENV_VAR_NAME_PATTERN;
26314
+ var init_types3 = __esm(() => {
26315
+ ENV_VAR_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
26316
+ });
26317
+
26318
26318
  // src/lib/collaboration/parse.ts
26319
26319
  function expectNonEmptyString(value, path) {
26320
26320
  if (typeof value !== "string" || value.trim().length === 0) {
@@ -440169,6 +440169,11 @@ function buildAllSpecs() {
440169
440169
  }
440170
440170
  function buildHelpText() {
440171
440171
  const lines = ["Usage: superdoc <command> [options]", ""];
440172
+ lines.push("Command help and schemas:");
440173
+ lines.push(" superdoc <command> --help");
440174
+ lines.push(" superdoc describe command <operationId>");
440175
+ lines.push(" superdoc describe command doc.save");
440176
+ lines.push("");
440172
440177
  lines.push("Common tasks:");
440173
440178
  lines.push(" Find mutation target → query match");
440174
440179
  lines.push(" Seed a synthetic doc → open --content-override ...");
@@ -440254,7 +440259,7 @@ var init_commands = __esm(() => {
440254
440259
  ]
440255
440260
  },
440256
440261
  status: { mutates: false, examples: ["superdoc status"] },
440257
- describe: { mutates: false, examples: ["superdoc describe"] },
440262
+ describe: { mutates: false, examples: ["superdoc describe", "superdoc describe command doc.save"] },
440258
440263
  describeCommand: { mutates: false, examples: ["superdoc describe command find"] },
440259
440264
  "session.list": { mutates: false, examples: ["superdoc session list"] },
440260
440265
  "session.save": {
@@ -443661,11 +443666,27 @@ var init_legacy_compat = __esm(() => {
443661
443666
  });
443662
443667
 
443663
443668
  // src/commands/insert-inline-special.ts
443664
- var runInsertTab, runInsertLineBreak;
443669
+ function unavailableHelp(command) {
443670
+ const note = `${command} is not available in the v2-only CLI.`;
443671
+ return {
443672
+ command,
443673
+ data: { usage: [`superdoc ${command}`], note },
443674
+ pretty: `Usage: superdoc ${command}
443675
+ ${note}`
443676
+ };
443677
+ }
443678
+ async function runInsertTab(tokens, context) {
443679
+ if (tokens.includes("--help") || tokens.includes("-h"))
443680
+ return unavailableHelp("insert tab");
443681
+ return runLegacyInsertTab(tokens, context);
443682
+ }
443683
+ async function runInsertLineBreak(tokens, context) {
443684
+ if (tokens.includes("--help") || tokens.includes("-h"))
443685
+ return unavailableHelp("insert line-break");
443686
+ return runLegacyInsertLineBreak(tokens, context);
443687
+ }
443665
443688
  var init_insert_inline_special = __esm(() => {
443666
443689
  init_legacy_compat();
443667
- runInsertTab = runLegacyInsertTab;
443668
- runInsertLineBreak = runLegacyInsertLineBreak;
443669
443690
  });
443670
443691
 
443671
443692
  // src/lib/open-password.ts
@@ -457907,7 +457928,8 @@ var init_contract4 = __esm(() => {
457907
457928
  capabilities: [],
457908
457929
  aliases: [],
457909
457930
  examples: [
457910
- "superdoc describe"
457931
+ "superdoc describe",
457932
+ "superdoc describe command doc.save"
457911
457933
  ],
457912
457934
  errors: []
457913
457935
  },
@@ -759679,7 +759701,7 @@ var init_host2 = __esm(() => {
759679
759701
  });
759680
759702
 
759681
759703
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
759682
- var SDK_VERSION = "2.12.0-next.1";
759704
+ var SDK_VERSION = "2.12.0-next.3";
759683
759705
 
759684
759706
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
759685
759707
  import { chmodSync, existsSync } from "node:fs";
@@ -807242,7 +807264,7 @@ async function runSessionList(tokens, _context) {
807242
807264
  return {
807243
807265
  command: "session list",
807244
807266
  data: {
807245
- usage: "superdoc session list"
807267
+ usage: ["superdoc session list"]
807246
807268
  },
807247
807269
  pretty: "Usage: superdoc session list"
807248
807270
  };
@@ -809822,10 +809844,10 @@ function parseInvocation(argv) {
809822
809844
  return { globals, rest };
809823
809845
  }
809824
809846
  async function executeParsedInvocation(parsed, io, executionMode, sessionPool, ambientTimeoutMs, collaborationAuth) {
809825
- if (parsed.globals.help) {
809847
+ if (parsed.globals.help && parsed.rest.length === 0) {
809826
809848
  return { helpText: HELP };
809827
809849
  }
809828
- if (parsed.globals.version) {
809850
+ if (parsed.globals.version && !parsed.globals.help) {
809829
809851
  return {
809830
809852
  versionText: resolveCliPackageVersion()
809831
809853
  };
@@ -809833,7 +809855,17 @@ async function executeParsedInvocation(parsed, io, executionMode, sessionPool, a
809833
809855
  if (parsed.rest.length === 0) {
809834
809856
  return { helpText: HELP };
809835
809857
  }
809836
- const { key: key2, args: args2 } = parseCommand(parsed.rest);
809858
+ let command;
809859
+ try {
809860
+ command = parseCommand(parsed.rest);
809861
+ } catch (error4) {
809862
+ if (parsed.globals.help && error4 instanceof CliError && error4.code === "UNKNOWN_COMMAND") {
809863
+ return { helpText: HELP };
809864
+ }
809865
+ throw error4;
809866
+ }
809867
+ const { key: key2, args: args2 } = command;
809868
+ const commandArgs = parsed.globals.help ? ["--help"] : args2;
809837
809869
  const context = {
809838
809870
  io,
809839
809871
  timeoutMs: parsed.globals.timeoutMs ?? ambientTimeoutMs,
@@ -809845,14 +809877,31 @@ async function executeParsedInvocation(parsed, io, executionMode, sessionPool, a
809845
809877
  const execution = await executeWithTimeout(async () => {
809846
809878
  if (MANUAL_COMMAND_KEY_SET.has(key2)) {
809847
809879
  const handler = MANUAL_COMMANDS[key2];
809848
- return handler(args2, context);
809880
+ return handler(commandArgs, context);
809849
809881
  }
809850
809882
  if (CLI_COMMAND_KEY_SET.has(key2)) {
809851
- return runCommandWrapper(key2, args2, context);
809883
+ return runCommandWrapper(key2, commandArgs, context);
809852
809884
  }
809853
809885
  throw new CliError("UNKNOWN_COMMAND", `Unknown command: ${key2}`);
809854
809886
  }, parsed.globals.timeoutMs);
809855
809887
  const operationId = COMMAND_OPERATION_ID_BY_KEY.get(key2);
809888
+ if (parsed.globals.help) {
809889
+ if (!operationId)
809890
+ return { execution };
809891
+ if (!isRecord4(execution.data)) {
809892
+ throw new CliError("COMMAND_FAILED", `Invalid help response for ${key2}.`);
809893
+ }
809894
+ const schemaCommand = `superdoc describe command ${operationId}`;
809895
+ return {
809896
+ execution: {
809897
+ ...execution,
809898
+ data: { ...execution.data, schemaCommand },
809899
+ pretty: `${execution.pretty}
809900
+
809901
+ Schema: ${schemaCommand}`
809902
+ }
809903
+ };
809904
+ }
809856
809905
  const shouldValidateResponse = operationId != null && !hasCommandHelpFlag(args2);
809857
809906
  if (!shouldValidateResponse) {
809858
809907
  return { execution };
@@ -809913,7 +809962,7 @@ async function run(argv, ioOverrides, options = {}) {
809913
809962
  if (parsed.rest[0] === "uninstall" && !parsed.globals.help) {
809914
809963
  return await runUninstall(parsed.rest.slice(1), io);
809915
809964
  }
809916
- if (parsed.rest[0] === "call" && outputMode !== "json") {
809965
+ if (parsed.rest[0] === "call" && outputMode !== "json" && !parsed.globals.help) {
809917
809966
  throw new CliError("INVALID_ARGUMENT", "call: only --output json is supported.");
809918
809967
  }
809919
809968
  if (!parsed.globals.help) {
@@ -809952,6 +810001,7 @@ var init_src8 = __esm(async () => {
809952
810001
  init_envelope();
809953
810002
  init_errors();
809954
810003
  init_input_readers();
810004
+ init_guards();
809955
810005
  init_call();
809956
810006
  init_close();
809957
810007
  init_execute_code2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/cli",
3
- "version": "0.35.0-next.1",
3
+ "version": "0.35.0-next.3",
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",
@@ -29,13 +29,13 @@
29
29
  "fast-glob": "^3.3.3",
30
30
  "happy-dom": "^20.3.4",
31
31
  "ws": "^8.18.0",
32
- "superdoc": "2.15.0-next.2",
32
+ "superdoc": "2.15.0-next.3",
33
33
  "y-websocket": "^3.0.0",
34
34
  "yjs": "13.6.31"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@hocuspocus/server": "^2.13.6",
38
- "@superdoc/sdk": "2.12.0-next.1",
38
+ "@superdoc/sdk": "2.12.0-next.3",
39
39
  "@superdoc/document-api": "0.1.0-alpha.0",
40
40
  "@superdoc/docx-engine": "0.14.0-next.2",
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.35.0-next.1",
55
- "@superdoc/cli-darwin-x64": "0.35.0-next.1",
56
- "@superdoc/cli-linux-x64": "0.35.0-next.1",
57
- "@superdoc/cli-linux-arm64": "0.35.0-next.1",
58
- "@superdoc/cli-windows-x64": "0.35.0-next.1"
54
+ "@superdoc/cli-darwin-arm64": "0.35.0-next.3",
55
+ "@superdoc/cli-darwin-x64": "0.35.0-next.3",
56
+ "@superdoc/cli-linux-x64": "0.35.0-next.3",
57
+ "@superdoc/cli-linux-arm64": "0.35.0-next.3",
58
+ "@superdoc/cli-windows-x64": "0.35.0-next.3"
59
59
  },
60
60
  "scripts": {
61
61
  "predev": "node scripts/ensure-superdoc-build.js",