@superdoc/cli 0.35.0-next.23 → 0.35.0-next.25

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
@@ -322018,6 +322018,35 @@ var init_context2 = __esm(() => {
322018
322018
  STATE_DIR_OVERRIDE_STORAGE = new AsyncLocalStorage;
322019
322019
  });
322020
322020
 
322021
+ // src/lib/text-input.ts
322022
+ import { readFile as readFile3 } from "node:fs/promises";
322023
+ async function resolveTextInput({ inlineValue, filePath, flag, doc }, context) {
322024
+ if (filePath === undefined)
322025
+ return inlineValue;
322026
+ if (inlineValue !== undefined) {
322027
+ throw new CliError("INVALID_ARGUMENT", `Use only one of --${flag} or --${flag}-file.`);
322028
+ }
322029
+ if (filePath.length === 0) {
322030
+ throw new CliError("INVALID_ARGUMENT", `--${flag}-file requires a non-empty path or '-' for stdin.`);
322031
+ }
322032
+ if (filePath === "-" && doc === "-") {
322033
+ throw new CliError("INVALID_ARGUMENT", `Cannot read both DOCX bytes and --${flag}-file content from stdin.`);
322034
+ }
322035
+ if (filePath === "-" && context.executionMode === "host") {
322036
+ throw new CliError("INVALID_ARGUMENT", `--${flag}-file cannot read stdin in host mode. Use a file path or inline content.`);
322037
+ }
322038
+ try {
322039
+ return filePath === "-" ? Buffer.from(await context.io.readStdinBytes()).toString("utf8") : await readFile3(filePath, "utf8");
322040
+ } catch (error4) {
322041
+ throw new CliError("FILE_READ_ERROR", `Could not read --${flag}-file ${filePath === "-" ? "from stdin" : filePath}.`, {
322042
+ message: error4 instanceof Error ? error4.message : String(error4)
322043
+ });
322044
+ }
322045
+ }
322046
+ var init_text_input = __esm(() => {
322047
+ init_errors();
322048
+ });
322049
+
322021
322050
  // src/cli/operation-hints.ts
322022
322051
  function buildFormatInlineAliasRecord(value2) {
322023
322052
  return Object.fromEntries(FORMAT_INLINE_ALIAS_OPERATION_IDS.map((operationId) => [operationId, value2]));
@@ -324386,7 +324415,7 @@ function blankDocxCandidates({
324386
324415
  var init_blank_docx = () => {};
324387
324416
 
324388
324417
  // src/lib/document-source.ts
324389
- import { readFile as readFile3, stat as stat3 } from "node:fs/promises";
324418
+ import { readFile as readFile4, stat as stat3 } from "node:fs/promises";
324390
324419
  import path3 from "node:path";
324391
324420
  import { fileURLToPath } from "node:url";
324392
324421
  async function fileExists(filePath) {
@@ -324397,7 +324426,7 @@ async function readBlankDocx() {
324397
324426
  const candidates = blankDocxCandidates({ moduleDir: MODULE_DIR });
324398
324427
  for (const candidate of candidates) {
324399
324428
  if (await fileExists(candidate)) {
324400
- const bytes = await readFile3(candidate);
324429
+ const bytes = await readFile4(candidate);
324401
324430
  return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
324402
324431
  }
324403
324432
  }
@@ -324424,7 +324453,7 @@ async function resolveDocumentSource(doc, io) {
324424
324453
  };
324425
324454
  }
324426
324455
  try {
324427
- const data = await readFile3(doc);
324456
+ const data = await readFile4(doc);
324428
324457
  const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
324429
324458
  return {
324430
324459
  bytes,
@@ -324882,7 +324911,7 @@ var init_document_v2 = __esm(() => {
324882
324911
 
324883
324912
  // src/lib/document.ts
324884
324913
  import { createHash as createHash4 } from "node:crypto";
324885
- import { readFile as readFile4 } from "node:fs/promises";
324914
+ import { readFile as readFile5 } from "node:fs/promises";
324886
324915
  async function openSessionDocument(doc, io, metadata, options = {}) {
324887
324916
  const { executionMode, sessionPool, sessionId } = options;
324888
324917
  const runtime = metadata.runtime ?? "v2";
@@ -324947,7 +324976,7 @@ function loadV2Runtime() {
324947
324976
  async function getFileChecksum(path5) {
324948
324977
  let bytes;
324949
324978
  try {
324950
- const data = await readFile4(path5);
324979
+ const data = await readFile5(path5);
324951
324980
  bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
324952
324981
  } catch (error4) {
324953
324982
  const message = error4 instanceof Error ? error4.message : String(error4);
@@ -447340,6 +447369,8 @@ var init_command_examples = __esm(() => {
447340
447369
  htmlToFragment: ['superdoc html-to-fragment --html "<h2>Summary</h2><p><strong>Approved</strong></p>"'],
447341
447370
  markdownToFragment: ['superdoc markdown-to-fragment --markdown "## Summary\\n\\n**Approved**"'],
447342
447371
  insert: [
447372
+ "superdoc insert --type html --value-file body.html",
447373
+ "superdoc insert --type markdown --value-file -",
447343
447374
  'superdoc insert --value "Hello, world!"',
447344
447375
  'superdoc insert --block-id abc123 --value "Appended text"',
447345
447376
  'superdoc insert --type markdown --value "## New Section"',
@@ -447560,6 +447591,8 @@ var init_commands = __esm(() => {
447560
447591
  mutates: true,
447561
447592
  examples: [
447562
447593
  "superdoc open my-doc.docx",
447594
+ "superdoc open --content-override-file body.md --override-type markdown",
447595
+ "superdoc open --content-override-file - --override-type html",
447563
447596
  'superdoc open --content-override "# Title\\n\\nBody text" --override-type markdown',
447564
447597
  "superdoc open template.docx --content-override '<p>ALPHA01</p><p>BRAVO02</p>' --override-type html",
447565
447598
  `superdoc open my-doc.docx --collaboration-json '{"url":"wss://collab.example.com"}'`
@@ -448329,6 +448362,14 @@ var init_operation_params = __esm(() => {
448329
448362
  ],
448330
448363
  "doc.insert": [
448331
448364
  ...TEXT_TARGET_FLAT_PARAMS_AGENT_HIDDEN,
448365
+ {
448366
+ name: "valueFile",
448367
+ kind: "flag",
448368
+ flag: "value-file",
448369
+ type: "string",
448370
+ description: "Read content from a UTF-8 file, or '-' for stdin. Use instead of --value with --type text, html, or markdown.",
448371
+ agentVisible: false
448372
+ },
448332
448373
  {
448333
448374
  name: "offset",
448334
448375
  kind: "flag",
@@ -448790,12 +448831,20 @@ var init_operation_params = __esm(() => {
448790
448831
  type: "string",
448791
448832
  description: "Complete main-body content. Requires --override-type and cannot be combined with collaboration."
448792
448833
  },
448834
+ {
448835
+ name: "contentOverrideFile",
448836
+ kind: "flag",
448837
+ flag: "content-override-file",
448838
+ type: "string",
448839
+ description: "Read main-body content from a UTF-8 file, or '-' for stdin. Use instead of --content-override. Requires --override-type and cannot be combined with collaboration.",
448840
+ agentVisible: false
448841
+ },
448793
448842
  {
448794
448843
  name: "overrideType",
448795
448844
  kind: "flag",
448796
448845
  flag: "override-type",
448797
448846
  type: "string",
448798
- description: "Content format for --content-override: markdown, html, or text. Required when --content-override is present."
448847
+ description: "Content format: markdown, html, or text. Required with --content-override or --content-override-file."
448799
448848
  },
448800
448849
  {
448801
448850
  name: "roomMode",
@@ -449236,6 +449285,7 @@ function buildOperationDetail(spec, metadata) {
449236
449285
  flag: p.flag,
449237
449286
  type: p.type,
449238
449287
  required: p.required,
449288
+ description: p.description,
449239
449289
  schema: p.schema
449240
449290
  })),
449241
449291
  constraints: metadata.constraints
@@ -449427,7 +449477,9 @@ function buildDescribeCommandPretty(data) {
449427
449477
  const formatted = params4.map((param) => {
449428
449478
  const label = paramLabel(param);
449429
449479
  const detailParts = [];
449430
- if (param.kind === "doc" && param.name === "doc") {
449480
+ if (param.description)
449481
+ detailParts.push(param.description);
449482
+ if (param.kind === "doc" && param.name === "doc" && !param.description) {
449431
449483
  detailParts.push("Document path or stdin");
449432
449484
  }
449433
449485
  const oneOfGroup = requiresOneOf?.find((group) => group.includes(param.name));
@@ -451041,7 +451093,7 @@ function resolvePassword(explicit, allowEnvFallback = true) {
451041
451093
  }
451042
451094
 
451043
451095
  // src/commands/open.ts
451044
- import { open as openFile, readFile as readFile5, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
451096
+ import { open as openFile, readFile as readFile6, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
451045
451097
  function contextDocumentFromRuntime(opened) {
451046
451098
  return {
451047
451099
  meta: opened.meta,
@@ -451056,7 +451108,7 @@ async function applyContentOverride(invoke, content3, type, context) {
451056
451108
  }
451057
451109
  async function captureOpenContextFile(path5) {
451058
451110
  try {
451059
- return { path: path5, bytes: await readFile5(path5) };
451111
+ return { path: path5, bytes: await readFile6(path5) };
451060
451112
  } catch (error4) {
451061
451113
  if (error4?.code === "ENOENT")
451062
451114
  return { path: path5 };
@@ -451132,20 +451184,26 @@ async function runOpen(tokens, context) {
451132
451184
  usage: [
451133
451185
  "superdoc open [doc] [--session <id>] [--password <password>]",
451134
451186
  "superdoc open [doc] --content-override <content> --override-type <markdown|html|text>",
451187
+ "superdoc open [doc] --content-override-file <path> --override-type <markdown|html|text>",
451188
+ "superdoc open --content-override-file - --override-type html",
451135
451189
  'superdoc open [doc] --collaboration-json "{...}" [--session <id>]',
451136
451190
  "",
451137
451191
  "Encrypted documents: use --password or set SUPERDOC_DOC_PASSWORD env var.",
451138
- "Content override replaces the main body while preserving the rest of a template DOCX."
451192
+ "Content override replaces the main body while preserving the rest of a template DOCX.",
451193
+ "Use --content-override-file for UTF-8 files; - reads stdin. Choose one content source."
451139
451194
  ]
451140
451195
  },
451141
451196
  pretty: [
451142
451197
  "Usage:",
451143
451198
  " superdoc open [doc] [--session <id>] [--password <password>]",
451144
451199
  " superdoc open [doc] --content-override <content> --override-type <markdown|html|text>",
451200
+ " superdoc open [doc] --content-override-file <path> --override-type <markdown|html|text>",
451201
+ " superdoc open --content-override-file - --override-type html",
451145
451202
  ' superdoc open [doc] --collaboration-json "{...}" [--session <id>]',
451146
451203
  "",
451147
451204
  "Encrypted documents: use --password or set SUPERDOC_DOC_PASSWORD env var.",
451148
- "Content override replaces the main body while preserving the rest of a template DOCX."
451205
+ "Content override replaces the main body while preserving the rest of a template DOCX.",
451206
+ "Use --content-override-file for UTF-8 files; - reads stdin. Choose one content source."
451149
451207
  ].join(`
451150
451208
  `)
451151
451209
  };
@@ -451155,7 +451213,9 @@ async function runOpen(tokens, context) {
451155
451213
  const collaborationPayload = await resolveJsonInput(parsed, "collaboration");
451156
451214
  const collabUrl = getStringOption(parsed, "collab-url");
451157
451215
  const collabDocumentId = getStringOption(parsed, "collab-document-id");
451158
- const contentOverride = getStringOption(parsed, "content-override");
451216
+ const inlineContentOverride = getStringOption(parsed, "content-override");
451217
+ const contentOverrideFile = getStringOption(parsed, "content-override-file");
451218
+ const hasContentOverride = inlineContentOverride != null || contentOverrideFile != null;
451159
451219
  const overrideType = getStringOption(parsed, "override-type");
451160
451220
  const roomMode = getStringOption(parsed, "room-mode");
451161
451221
  const bootstrapSettlingMs = getNumberOption(parsed, "bootstrap-settling-ms");
@@ -451166,11 +451226,11 @@ async function runOpen(tokens, context) {
451166
451226
  const allowEnvFallback = context.executionMode !== "host";
451167
451227
  const password = resolvePassword(getStringOption(parsed, "password"), allowEnvFallback);
451168
451228
  const trackChanges = normalizeTrackChangesOpenConfig(args2.trackChanges);
451169
- if (contentOverride != null && !overrideType) {
451170
- throw new CliError("INVALID_ARGUMENT", "open: --content-override requires --override-type.");
451229
+ if (hasContentOverride && !overrideType) {
451230
+ throw new CliError("INVALID_ARGUMENT", "open: --content-override or --content-override-file requires --override-type.");
451171
451231
  }
451172
- if (overrideType && contentOverride == null) {
451173
- throw new CliError("INVALID_ARGUMENT", "open: --override-type requires --content-override.");
451232
+ if (overrideType && !hasContentOverride) {
451233
+ throw new CliError("INVALID_ARGUMENT", "open: --override-type requires --content-override or --content-override-file.");
451174
451234
  }
451175
451235
  if (overrideType && !VALID_OVERRIDE_TYPES.has(overrideType)) {
451176
451236
  throw new CliError("INVALID_ARGUMENT", `open: --override-type must be one of: markdown, html, text. Got "${overrideType}".`);
@@ -451181,7 +451241,7 @@ async function runOpen(tokens, context) {
451181
451241
  if (collaborationPayload != null && (collabUrl || collabDocumentId)) {
451182
451242
  throw new CliError("INVALID_ARGUMENT", "open: do not combine --collaboration-json with --collab-url / --collab-document-id.");
451183
451243
  }
451184
- if (contentOverride != null && (collaborationPayload != null || collabUrl)) {
451244
+ if (hasContentOverride && (collaborationPayload != null || collabUrl)) {
451185
451245
  throw new CliError("INVALID_ARGUMENT", "open: --content-override is incompatible with collaboration mode. Content override is a template-initialization operation.");
451186
451246
  }
451187
451247
  let collaborationInput;
@@ -451232,6 +451292,7 @@ async function runOpen(tokens, context) {
451232
451292
  editorOpenOptions.trackChanges = trackChanges;
451233
451293
  editorOpenOptions.modules = { ...editorOpenOptions.modules, trackChanges };
451234
451294
  }
451295
+ const contentOverride = await resolveTextInput({ inlineValue: inlineContentOverride, filePath: contentOverrideFile, flag: "content-override", doc }, context);
451235
451296
  return withContextLock(context.io, "open", async (paths) => {
451236
451297
  const existing = await readContextMetadata(paths);
451237
451298
  if (existing && existing.projectRoot !== getProjectRoot()) {
@@ -451267,7 +451328,7 @@ async function runOpen(tokens, context) {
451267
451328
  } else if (options.initializedBaseline) {
451268
451329
  contextRevision = await opened2.currentRevision();
451269
451330
  await opened2.exportToPath(paths.workingDocPath, true);
451270
- await writeBytesToPath(await readFile5(paths.workingDocPath), paths.originalDocPath, true);
451331
+ await writeBytesToPath(await readFile6(paths.workingDocPath), paths.originalDocPath, true);
451271
451332
  } else {
451272
451333
  contextRevision = await opened2.currentRevision();
451273
451334
  await opened2.copySourceToPath(paths.originalDocPath, true);
@@ -451448,6 +451509,7 @@ var init_open = __esm(() => {
451448
451509
  init_document_source();
451449
451510
  init_file_output();
451450
451511
  init_mutation_orchestrator();
451512
+ init_text_input();
451451
451513
  init_operation_args();
451452
451514
  init_session();
451453
451515
  init_types9();
@@ -454758,6 +454820,8 @@ var init_contract4 = __esm(() => {
454758
454820
  ],
454759
454821
  aliases: [],
454760
454822
  examples: [
454823
+ "superdoc insert --type html --value-file body.html",
454824
+ "superdoc insert --type markdown --value-file -",
454761
454825
  'superdoc insert --value "Hello, world!"',
454762
454826
  'superdoc insert --block-id abc123 --value "Appended text"',
454763
454827
  'superdoc insert --type markdown --value "## New Section"',
@@ -465146,6 +465210,8 @@ var init_contract4 = __esm(() => {
465146
465210
  aliases: [],
465147
465211
  examples: [
465148
465212
  "superdoc open my-doc.docx",
465213
+ "superdoc open --content-override-file body.md --override-type markdown",
465214
+ "superdoc open --content-override-file - --override-type html",
465149
465215
  'superdoc open --content-override "# Title\\n\\nBody text" --override-type markdown',
465150
465216
  "superdoc open template.docx --content-override '<p>ALPHA01</p><p>BRAVO02</p>' --override-type html",
465151
465217
  `superdoc open my-doc.docx --collaboration-json '{"url":"wss://collab.example.com"}'`
@@ -480260,6 +480326,14 @@ var init_contract4 = __esm(() => {
480260
480326
  description: "End offset within the block (character index).",
480261
480327
  agentVisible: false
480262
480328
  },
480329
+ {
480330
+ name: "valueFile",
480331
+ kind: "flag",
480332
+ type: "string",
480333
+ flag: "value-file",
480334
+ description: "Read content from a UTF-8 file, or '-' for stdin. Use instead of --value with --type text, html, or markdown.",
480335
+ agentVisible: false
480336
+ },
480263
480337
  {
480264
480338
  name: "offset",
480265
480339
  kind: "flag",
@@ -763127,12 +763201,20 @@ var init_contract4 = __esm(() => {
763127
763201
  flag: "content-override",
763128
763202
  description: "Complete main-body content. Requires --override-type and cannot be combined with collaboration."
763129
763203
  },
763204
+ {
763205
+ name: "contentOverrideFile",
763206
+ kind: "flag",
763207
+ type: "string",
763208
+ flag: "content-override-file",
763209
+ description: "Read main-body content from a UTF-8 file, or '-' for stdin. Use instead of --content-override. Requires --override-type and cannot be combined with collaboration.",
763210
+ agentVisible: false
763211
+ },
763130
763212
  {
763131
763213
  name: "overrideType",
763132
763214
  kind: "flag",
763133
763215
  type: "string",
763134
763216
  flag: "override-type",
763135
- description: "Content format for --content-override: markdown, html, or text. Required when --content-override is present."
763217
+ description: "Content format: markdown, html, or text. Required with --content-override or --content-override-file."
763136
763218
  },
763137
763219
  {
763138
763220
  name: "roomMode",
@@ -763366,7 +763448,7 @@ var init_contract4 = __esm(() => {
763366
763448
  },
763367
763449
  overrideType: {
763368
763450
  type: "string",
763369
- description: "Content format for --content-override: markdown, html, or text. Required when --content-override is present."
763451
+ description: "Content format: markdown, html, or text. Required with --content-override or --content-override-file."
763370
763452
  },
763371
763453
  roomMode: {
763372
763454
  type: "string",
@@ -767434,7 +767516,7 @@ var init_host2 = __esm(() => {
767434
767516
  });
767435
767517
 
767436
767518
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
767437
- var SDK_VERSION = "2.12.0-next.23";
767519
+ var SDK_VERSION = "2.12.0-next.25";
767438
767520
 
767439
767521
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
767440
767522
  import { chmodSync, existsSync } from "node:fs";
@@ -767740,6 +767822,7 @@ function detailParam(param) {
767740
767822
  ...Object.prototype.hasOwnProperty.call(param, "flag") ? { flag: param.flag } : {},
767741
767823
  type: param.type,
767742
767824
  ...Object.prototype.hasOwnProperty.call(param, "required") ? { required: param.required } : {},
767825
+ ...Object.prototype.hasOwnProperty.call(param, "description") ? { description: param.description } : {},
767743
767826
  ...Object.prototype.hasOwnProperty.call(param, "schema") ? { schema: param.schema } : {}
767744
767827
  };
767745
767828
  }
@@ -801397,7 +801480,7 @@ var init_embedded_tools_generated = __esm(() => {
801397
801480
  });
801398
801481
 
801399
801482
  // ../../packages/sdk/langs/node/src/presets/legacy.ts
801400
- import { readFile as readFile6 } from "node:fs/promises";
801483
+ import { readFile as readFile7 } from "node:fs/promises";
801401
801484
  import path8 from "node:path";
801402
801485
  import { fileURLToPath as fileURLToPath4 } from "node:url";
801403
801486
  function isRecord12(value2) {
@@ -801428,7 +801511,7 @@ async function readToolFile(fileName, message, candidateDirs = TOOLS_DIR_CANDIDA
801428
801511
  const filePath = path8.join(toolsDir, fileName);
801429
801512
  tried.push(filePath);
801430
801513
  try {
801431
- return { filePath, raw: await readFile6(filePath, "utf8") };
801514
+ return { filePath, raw: await readFile7(filePath, "utf8") };
801432
801515
  } catch (error4) {
801433
801516
  lastError = error4;
801434
801517
  }
@@ -813850,7 +813933,7 @@ OPERATING RULES
813850
813933
  });
813851
813934
 
813852
813935
  // ../../packages/sdk/langs/node/src/presets/core.ts
813853
- import { readFile as readFile7 } from "node:fs/promises";
813936
+ import { readFile as readFile8 } from "node:fs/promises";
813854
813937
  import path9 from "node:path";
813855
813938
  import { fileURLToPath as fileURLToPath5 } from "node:url";
813856
813939
  async function readPromptFile(fileName, label, candidateDirs = PROMPT_DIR_CANDIDATES) {
@@ -813860,7 +813943,7 @@ async function readPromptFile(fileName, label, candidateDirs = PROMPT_DIR_CANDID
813860
813943
  const promptPath = path9.join(dir, fileName);
813861
813944
  tried.push(promptPath);
813862
813945
  try {
813863
- return await readFile7(promptPath, "utf8");
813946
+ return await readFile8(promptPath, "utf8");
813864
813947
  } catch (err2) {
813865
813948
  const ioError = err2;
813866
813949
  if (ioError?.code !== "ENOENT") {
@@ -815825,6 +815908,18 @@ async function executeOperation(request) {
815825
815908
  maybeRemapInputValidationError(request, error4);
815826
815909
  }
815827
815910
  }
815911
+ if (request.operationId === "doc.insert" && input.valueFile != null) {
815912
+ const { valueFile, ...rest } = input;
815913
+ input = {
815914
+ ...rest,
815915
+ value: await resolveTextInput({
815916
+ inlineValue: input.value,
815917
+ filePath: valueFile,
815918
+ flag: "value",
815919
+ doc: input.doc
815920
+ }, baseContext)
815921
+ };
815922
+ }
815828
815923
  await preflightCallContext(request.operationId, input, baseContext);
815829
815924
  const effectiveContext = applySessionInputToContext(baseContext, input);
815830
815925
  const docApiId = toDocApiId(request.operationId);
@@ -815854,6 +815949,7 @@ var MANUAL_OPERATION_ALLOWLIST_SET, CALL_VALIDATION_COMMAND_FAILED_DOC_API_IDS,
815854
815949
  var init_operation_executor = __esm(() => {
815855
815950
  init_context2();
815856
815951
  init_errors();
815952
+ init_text_input();
815857
815953
  init_input_readers();
815858
815954
  init_generic_dispatch();
815859
815955
  init_introspection_dispatch();
@@ -816217,7 +816313,7 @@ var init_document_runtime_session = __esm(() => {
816217
816313
  });
816218
816314
 
816219
816315
  // src/lib/local-document-runtime-sessions.ts
816220
- import { readFile as readFile8 } from "node:fs/promises";
816316
+ import { readFile as readFile9 } from "node:fs/promises";
816221
816317
  function resolveAuthor2(user) {
816222
816318
  const name = user?.name?.trim() || "CLI";
816223
816319
  const email = user?.email?.trim();
@@ -816413,7 +816509,7 @@ function createCliLocalDocumentRuntimeSessions(manager = _0x51cc97()) {
816413
816509
  if (sourceBytes !== undefined) {
816414
816510
  bytes = new Uint8Array(sourceBytes);
816415
816511
  } else if (source.source === "path") {
816416
- bytes = await readFile8(source.path);
816512
+ bytes = await readFile9(source.path);
816417
816513
  } else {
816418
816514
  throw new CliError("FILE_READ_ERROR", "The local document source bytes are unavailable.");
816419
816515
  }
@@ -816516,7 +816612,7 @@ var init_local_document_runtime_sessions = __esm(() => {
816516
816612
 
816517
816613
  // src/host/session-pool.ts
816518
816614
  import { createHash as createHash5 } from "node:crypto";
816519
- import { readFile as readFile9 } from "node:fs/promises";
816615
+ import { readFile as readFile10 } from "node:fs/promises";
816520
816616
  function stableStringify2(value2) {
816521
816617
  if (value2 === null || typeof value2 !== "object")
816522
816618
  return JSON.stringify(value2);
@@ -816585,7 +816681,7 @@ class InMemorySessionPool {
816585
816681
  } : undefined;
816586
816682
  let byteLength2;
816587
816683
  let revision;
816588
- const replacementBytes = new Uint8Array(await readFile9(path10));
816684
+ const replacementBytes = new Uint8Array(await readFile10(path10));
816589
816685
  if (session.sessionType === "local") {
816590
816686
  const initialRevision = Math.max(session.metadataRevision, publicRevisionForMetadata(session.opened)) + 1;
816591
816687
  const prepared = await this.localRuntimeSessions.prepare(sessionId, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/cli",
3
- "version": "0.35.0-next.23",
3
+ "version": "0.35.0-next.25",
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.12.0-next.23",
38
+ "@superdoc/sdk": "2.12.0-next.25",
39
39
  "@superdoc/document-api": "0.1.0-alpha.0",
40
40
  "@superdoc/docx-engine": "0.14.0-next.13",
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.23",
55
- "@superdoc/cli-darwin-x64": "0.35.0-next.23",
56
- "@superdoc/cli-linux-x64": "0.35.0-next.23",
57
- "@superdoc/cli-linux-arm64": "0.35.0-next.23",
58
- "@superdoc/cli-windows-x64": "0.35.0-next.23"
54
+ "@superdoc/cli-darwin-arm64": "0.35.0-next.25",
55
+ "@superdoc/cli-darwin-x64": "0.35.0-next.25",
56
+ "@superdoc/cli-linux-x64": "0.35.0-next.25",
57
+ "@superdoc/cli-linux-arm64": "0.35.0-next.25",
58
+ "@superdoc/cli-windows-x64": "0.35.0-next.25"
59
59
  },
60
60
  "scripts": {
61
61
  "predev": "node scripts/ensure-superdoc-build.js",
package/skill/SKILL.md CHANGED
@@ -58,7 +58,7 @@ superdoc close
58
58
  ```
59
59
 
60
60
  - `--content-override` is the fastest way to seed paragraphs, headings, lists, and `<br/>` line breaks.
61
- - Use `--override-type markdown|html|text` explicitly. `open` rejects `--content-override` without it.
61
+ - Use `--override-type markdown|html|text` explicitly with either `--content-override` or `--content-override-file`.
62
62
  - For generation, do not start with `query match` unless you are modifying content that already exists.
63
63
 
64
64
  ### 3) Generate incrementally, then reuse the insert receipt target
@@ -167,6 +167,29 @@ superdoc insert tab --block-id p1 --offset 12
167
167
 
168
168
  - Direct invoke: `call <operationId> --input-json '{...}'` (JSON output only — `--pretty` is not supported)
169
169
 
170
+ ## Text, HTML, and Markdown Files
171
+
172
+ For large content, use a UTF-8 file or pipe stdin with `-`. File content follows the same conversion and validation as inline content.
173
+
174
+ ```bash
175
+ superdoc open --content-override-file ./body.md --override-type markdown
176
+ superdoc insert --type html --value-file ./section.html
177
+ superdoc save --out ./generated.docx
178
+ superdoc close
179
+ ```
180
+
181
+ ```bash
182
+ superdoc open --content-override-file - --override-type html < ./body.html
183
+ superdoc insert --type text --value-file - < ./appendix.txt
184
+ superdoc save --out ./generated.docx
185
+ superdoc close
186
+ ```
187
+
188
+ - Use `--value-file <path|->` for `insert --type text|html|markdown`.
189
+ - Use `--content-override-file <path|->` for blank or template initialization with `open --override-type text|html|markdown`.
190
+ - Choose one content source: inline or file/stdin. An empty file is an explicit empty payload.
191
+ - Relative paths resolve from the current working directory. DOCX input and content input cannot both use stdin in the same command.
192
+
170
193
  ## JSON/File Payload Flags
171
194
 
172
195
  Not all `--*-file` variants are available on every command. Use `describe command <name>` to check.