cdx-chores 0.1.8 → 0.1.9-canary.2

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
@@ -82,7 +82,7 @@ Use `cdx-chores doctor` before relying on a command in a script, a CI job, or a
82
82
  | `data extract` reviewed suggestions, `data query codex` | Codex-assisted source shaping, semantic header review, and natural-language SQL drafting | Codex support must be configured and an auth/session signal must be available | Run `cdx-chores doctor` |
83
83
  | `md pdf-profile codex`, `md pdf-template codex`, `md pdf-project codex` | Codex-assisted Markdown PDF profile, template, and coordinated project drafting | Codex support must be configured for Codex-assisted decisions; deterministic fallback paths remain available where documented | Run `cdx-chores doctor` |
84
84
 
85
- The Codex SDK baseline for `v0.1.8` is `@openai/codex-sdk` `0.153.4`.
85
+ The Codex SDK baseline for `v0.1.9-canary.2` is `@openai/codex-sdk` `0.155.0`.
86
86
 
87
87
  Adopted helper commands and explicit `interactive` sessions accept
88
88
  `--codex-model`, `--codex-provider`, and `--codex-reasoning-effort`. Model and
@@ -1,4 +1,4 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-y5ARvAq5.cjs");
2
2
  let node_fs = require("node:fs");
3
3
  let node_path = require("node:path");
4
4
  let node_child_process = require("node:child_process");
@@ -43,7 +43,8 @@ function resolveDiscoveryExecutable(env) {
43
43
  if (!targetPlatform || !targetArch) throw new Error("Codex discovery is unsupported on this platform.");
44
44
  try {
45
45
  const sdkRequire = node_module.createRequire(resolveSdkPackage());
46
- const root = (0, node_path.join)((0, node_path.dirname)(node_module.createRequire(sdkRequire.resolve("@openai/codex/package.json")).resolve(`@openai/codex-${platform}-${process.arch}/package.json`)), "vendor", `${targetArch}-${targetPlatform}`);
46
+ const packagePath = node_module.createRequire(sdkRequire.resolve("@openai/codex/package.json")).resolve(`@openai/codex-${platform}-${process.arch}/package.json`);
47
+ const root = (0, node_path.join)((0, node_path.dirname)(packagePath), "vendor", `${targetArch}-${targetPlatform}`);
47
48
  const name = platform === "win32" ? "codex.exe" : "codex";
48
49
  const modern = (0, node_path.join)(root, "bin", name);
49
50
  const isModern = hasType(modern, "file") && hasType((0, node_path.join)(root, "codex-package.json"), "file");
@@ -66,8 +67,8 @@ function resolveDiscoveryExecutable(env) {
66
67
  }
67
68
  //#endregion
68
69
  //#region src/adapters/codex/discovery/transport.ts
69
- const MAX_LINE_BYTES = 1024 * 1024;
70
- const MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
70
+ const MAX_LINE_BYTES = 1048576;
71
+ const MAX_OUTPUT_BYTES = 8388608;
71
72
  function isRecord(value) {
72
73
  return value !== null && typeof value === "object" && !Array.isArray(value);
73
74
  }
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.cjs");
3
- const require_template_codex = require("./template-codex-C9NY6pKv.cjs");
2
+ const require_rolldown_runtime = require("./rolldown-runtime-y5ARvAq5.cjs");
3
+ const require_template_codex = require("./template-codex-B32Uj59l.cjs");
4
4
  let commander = require("commander");
5
5
  let node_fs = require("node:fs");
6
6
  let node_fs_promises = require("node:fs/promises");
@@ -1347,7 +1347,8 @@ async function readDataHeaderMappingArtifact(path) {
1347
1347
  try {
1348
1348
  raw = await (0, node_fs_promises.readFile)(path, "utf8");
1349
1349
  } catch (error) {
1350
- throw new require_template_codex.CliError(`Failed to read header mapping artifact: ${path} (${error instanceof Error ? error.message : String(error)})`, {
1350
+ const message = error instanceof Error ? error.message : String(error);
1351
+ throw new require_template_codex.CliError(`Failed to read header mapping artifact: ${path} (${message})`, {
1351
1352
  code: "FILE_READ_ERROR",
1352
1353
  exitCode: 2
1353
1354
  });
@@ -1356,7 +1357,8 @@ async function readDataHeaderMappingArtifact(path) {
1356
1357
  try {
1357
1358
  parsed = JSON.parse(raw);
1358
1359
  } catch (error) {
1359
- throw new require_template_codex.CliError(`Invalid header mapping artifact JSON: ${path} (${error instanceof Error ? error.message : String(error)})`, {
1360
+ const message = error instanceof Error ? error.message : String(error);
1361
+ throw new require_template_codex.CliError(`Invalid header mapping artifact JSON: ${path} (${message})`, {
1360
1362
  code: "INVALID_INPUT",
1361
1363
  exitCode: 2
1362
1364
  });
@@ -1405,7 +1407,8 @@ async function writeDataHeaderMappingArtifact(path, artifact, options = {}) {
1405
1407
  try {
1406
1408
  await (0, node_fs_promises.writeFile)(path, `${JSON.stringify(contentArtifact, null, 2)}\n`, "utf8");
1407
1409
  } catch (error) {
1408
- throw new require_template_codex.CliError(`Failed to write file: ${path} (${error instanceof Error ? error.message : String(error)})`, {
1410
+ const message = error instanceof Error ? error.message : String(error);
1411
+ throw new require_template_codex.CliError(`Failed to write file: ${path} (${message})`, {
1409
1412
  code: "FILE_WRITE_ERROR",
1410
1413
  exitCode: 2
1411
1414
  });
@@ -2545,7 +2548,8 @@ function assertMarkdownPdfRendererCapabilities(input) {
2545
2548
  const minimum = capability ? capability.minimumVersion : "unknown";
2546
2549
  return `${request.capabilityId} (${request.requestedBy.join(", ")}; minimum ${minimum})`;
2547
2550
  }).join("; ");
2548
- throw new require_template_codex.CliError(`WeasyPrint ${input.assessment.renderer.version ?? "unknown"} cannot provide the effectively requested Markdown PDF renderer capabilities: ${requested}.`, {
2551
+ const version = input.assessment.renderer.version ?? "unknown";
2552
+ throw new require_template_codex.CliError(`WeasyPrint ${version} cannot provide the effectively requested Markdown PDF renderer capabilities: ${requested}.`, {
2549
2553
  code: first?.capability?.diagnosticConditionId ?? MARKDOWN_PDF_DIAGNOSTIC_CONDITION_IDS.rendererCapabilityUnknown,
2550
2554
  exitCode: 2
2551
2555
  });
@@ -3557,7 +3561,8 @@ function createJsonPreviewSource(text) {
3557
3561
  try {
3558
3562
  parsed = JSON.parse(text);
3559
3563
  } catch (error) {
3560
- throw new require_template_codex.CliError(`Invalid JSON: ${error instanceof Error ? error.message : String(error)}`, {
3564
+ const message = error instanceof Error ? error.message : String(error);
3565
+ throw new require_template_codex.CliError(`Invalid JSON: ${message}`, {
3561
3566
  code: "INVALID_JSON",
3562
3567
  exitCode: 2
3563
3568
  });
@@ -4355,7 +4360,8 @@ async function readDataSourceShapeArtifact(path) {
4355
4360
  try {
4356
4361
  raw = await (0, node_fs_promises.readFile)(path, "utf8");
4357
4362
  } catch (error) {
4358
- throw new require_template_codex.CliError(`Failed to read source shape artifact: ${path} (${error instanceof Error ? error.message : String(error)})`, {
4363
+ const message = error instanceof Error ? error.message : String(error);
4364
+ throw new require_template_codex.CliError(`Failed to read source shape artifact: ${path} (${message})`, {
4359
4365
  code: "FILE_READ_ERROR",
4360
4366
  exitCode: 2
4361
4367
  });
@@ -4364,7 +4370,8 @@ async function readDataSourceShapeArtifact(path) {
4364
4370
  try {
4365
4371
  parsed = JSON.parse(raw);
4366
4372
  } catch (error) {
4367
- throw new require_template_codex.CliError(`Invalid source shape artifact JSON: ${path} (${error instanceof Error ? error.message : String(error)})`, {
4373
+ const message = error instanceof Error ? error.message : String(error);
4374
+ throw new require_template_codex.CliError(`Invalid source shape artifact JSON: ${path} (${message})`, {
4368
4375
  code: "INVALID_INPUT",
4369
4376
  exitCode: 2
4370
4377
  });
@@ -4412,7 +4419,8 @@ async function writeDataSourceShapeArtifact(path, artifact, options = {}) {
4412
4419
  try {
4413
4420
  await (0, node_fs_promises.writeFile)(path, `${JSON.stringify(contentArtifact, null, 2)}\n`, "utf8");
4414
4421
  } catch (error) {
4415
- throw new require_template_codex.CliError(`Failed to write file: ${path} (${error instanceof Error ? error.message : String(error)})`, {
4422
+ const message = error instanceof Error ? error.message : String(error);
4423
+ throw new require_template_codex.CliError(`Failed to write file: ${path} (${message})`, {
4416
4424
  code: "FILE_WRITE_ERROR",
4417
4425
  exitCode: 2
4418
4426
  });
@@ -4894,11 +4902,12 @@ async function actionDataExtract(runtime, options) {
4894
4902
  const result = await executeDataQueryForAllRows(connection, "select * from file");
4895
4903
  const normalizedOutputPath = require_template_codex.assertNonEmpty(outputPath, "Output path");
4896
4904
  const outputFormat = normalizeOutputFormat(normalizedOutputPath);
4897
- await require_template_codex.writeTextFileSafe(normalizedOutputPath, stringifyMaterializedRows({
4905
+ const text = stringifyMaterializedRows({
4898
4906
  columns: result.columns,
4899
4907
  format: outputFormat,
4900
4908
  rows: result.rows
4901
- }), { overwrite: options.overwrite });
4909
+ });
4910
+ await require_template_codex.writeTextFileSafe(normalizedOutputPath, text, { overwrite: options.overwrite });
4902
4911
  require_template_codex.printLine(runtime.stderr, `Wrote ${outputFormat.toUpperCase()}: ${require_template_codex.displayPath(runtime, normalizedOutputPath)}`);
4903
4912
  require_template_codex.printLine(runtime.stderr, `Rows: ${result.rows.length}`);
4904
4913
  } finally {
@@ -5332,7 +5341,8 @@ async function readDataStackPlanArtifact(path) {
5332
5341
  try {
5333
5342
  raw = await (0, node_fs_promises.readFile)(path, "utf8");
5334
5343
  } catch (error) {
5335
- throw new require_template_codex.CliError(`Failed to read data stack plan artifact: ${path} (${error instanceof Error ? error.message : String(error)})`, {
5344
+ const message = error instanceof Error ? error.message : String(error);
5345
+ throw new require_template_codex.CliError(`Failed to read data stack plan artifact: ${path} (${message})`, {
5336
5346
  code: "FILE_READ_ERROR",
5337
5347
  exitCode: 2
5338
5348
  });
@@ -5341,7 +5351,8 @@ async function readDataStackPlanArtifact(path) {
5341
5351
  try {
5342
5352
  parsed = JSON.parse(raw);
5343
5353
  } catch (error) {
5344
- throw new require_template_codex.CliError(`Invalid data stack plan artifact JSON: ${path} (${error instanceof Error ? error.message : String(error)})`, {
5354
+ const message = error instanceof Error ? error.message : String(error);
5355
+ throw new require_template_codex.CliError(`Invalid data stack plan artifact JSON: ${path} (${message})`, {
5345
5356
  code: "INVALID_INPUT",
5346
5357
  exitCode: 2
5347
5358
  });
@@ -5363,7 +5374,8 @@ async function writeDataStackPlanArtifact(path, artifact, options = {}) {
5363
5374
  try {
5364
5375
  await (0, node_fs_promises.writeFile)(path, serializeDataStackPlanArtifact(artifact), "utf8");
5365
5376
  } catch (error) {
5366
- throw new require_template_codex.CliError(`Failed to write file: ${path} (${error instanceof Error ? error.message : String(error)})`, {
5377
+ const message = error instanceof Error ? error.message : String(error);
5378
+ throw new require_template_codex.CliError(`Failed to write file: ${path} (${message})`, {
5367
5379
  code: "FILE_WRITE_ERROR",
5368
5380
  exitCode: 2
5369
5381
  });
@@ -5532,9 +5544,7 @@ function applyPatchToPlan(plan, patch) {
5532
5544
  case "/duplicates/uniqueBy":
5533
5545
  next.duplicates.uniqueBy = [...patch.value];
5534
5546
  break;
5535
- case "/duplicates/policy":
5536
- next.duplicates.policy = patch.value;
5537
- break;
5547
+ case "/duplicates/policy": next.duplicates.policy = patch.value;
5538
5548
  }
5539
5549
  return parseDataStackPlanArtifact(next);
5540
5550
  }
@@ -6587,7 +6597,8 @@ function ensureUniformFormat(files, renderPath) {
6587
6597
  return first.format;
6588
6598
  }
6589
6599
  function createAutoSchemaModeFailure(error) {
6590
- return new require_template_codex.CliError(`--schema-mode auto could not choose a safe schema mode. Use --schema-mode strict to fail on schema drift, use --schema-mode union-by-name after resolving ambiguous names, or revise the inputs. Last error: ${error instanceof Error ? error.message : String(error)}`, {
6600
+ const reason = error instanceof Error ? error.message : String(error);
6601
+ return new require_template_codex.CliError(`--schema-mode auto could not choose a safe schema mode. Use --schema-mode strict to fail on schema drift, use --schema-mode union-by-name after resolving ambiguous names, or revise the inputs. Last error: ${reason}`, {
6591
6602
  code: "INVALID_INPUT",
6592
6603
  exitCode: 2
6593
6604
  });
@@ -7802,7 +7813,8 @@ function validateDataQueryCodexOptions(options) {
7802
7813
  async function actionDataQueryCodex(runtime, options) {
7803
7814
  const codexExecution = require_template_codex.resolveCodexExecution(options.codexExecution);
7804
7815
  validateDataQueryCodexOptions(options);
7805
- const inputPath = require_template_codex.resolveFromCwd(runtime, require_template_codex.assertNonEmpty(options.input, "Input path"));
7816
+ const input = require_template_codex.assertNonEmpty(options.input, "Input path");
7817
+ const inputPath = require_template_codex.resolveFromCwd(runtime, input);
7806
7818
  await require_template_codex.ensureFileExists(inputPath, "Input");
7807
7819
  const intent = normalizeDataQueryCodexIntent(require_template_codex.assertNonEmpty(options.intent, "Intent"));
7808
7820
  const format = detectDataQueryInputFormat(inputPath, options.inputFormat);
@@ -7891,13 +7903,15 @@ async function actionJsonToDelimited(runtime, options, targetFormat) {
7891
7903
  try {
7892
7904
  parsed = JSON.parse(raw);
7893
7905
  } catch (error) {
7894
- throw new require_template_codex.CliError(`Invalid JSON: ${error instanceof Error ? error.message : String(error)}`, {
7906
+ const message = error instanceof Error ? error.message : String(error);
7907
+ throw new require_template_codex.CliError(`Invalid JSON: ${message}`, {
7895
7908
  code: "INVALID_JSON",
7896
7909
  exitCode: 2
7897
7910
  });
7898
7911
  }
7899
7912
  const rows = normalizeRowsFromJson(parsed);
7900
- await require_template_codex.writeTextFileSafe(outputPath, stringifyDelimitedRecords(rows, targetFormat), { overwrite: options.overwrite });
7913
+ const text = stringifyDelimitedRecords(rows, targetFormat);
7914
+ await require_template_codex.writeTextFileSafe(outputPath, text, { overwrite: options.overwrite });
7901
7915
  require_template_codex.printLine(runtime.stdout, `Wrote ${getDelimitedDisplayLabel(targetFormat)}: ${require_template_codex.displayPath(runtime, outputPath)}`);
7902
7916
  require_template_codex.printLine(runtime.stdout, `Rows: ${rows.length}`);
7903
7917
  }
@@ -7906,7 +7920,8 @@ async function actionDelimitedToJson(runtime, options, sourceFormat) {
7906
7920
  const outputPath = require_template_codex.resolveFromCwd(runtime, options.output?.trim() || defaultOutputPath(inputPath, ".json"));
7907
7921
  await require_template_codex.ensureFileExists(inputPath, "Input");
7908
7922
  const records = delimitedRowsToObjects(parseDelimited(await require_template_codex.readTextFileRequired(inputPath), sourceFormat));
7909
- await require_template_codex.writeTextFileSafe(outputPath, stringifyJsonOutput$1(records, options.pretty), { overwrite: options.overwrite });
7923
+ const json = stringifyJsonOutput$1(records, options.pretty);
7924
+ await require_template_codex.writeTextFileSafe(outputPath, json, { overwrite: options.overwrite });
7910
7925
  require_template_codex.printLine(runtime.stdout, `Wrote JSON: ${require_template_codex.displayPath(runtime, outputPath)}`);
7911
7926
  require_template_codex.printLine(runtime.stdout, `Rows: ${records.length}`);
7912
7927
  }
@@ -7915,7 +7930,8 @@ async function actionDelimitedToDelimited(runtime, options, sourceFormat, target
7915
7930
  const outputPath = require_template_codex.resolveFromCwd(runtime, options.output?.trim() || defaultOutputPath(inputPath, `.${targetFormat}`));
7916
7931
  await require_template_codex.ensureFileExists(inputPath, "Input");
7917
7932
  const rows = parseDelimited(await require_template_codex.readTextFileRequired(inputPath), sourceFormat);
7918
- await require_template_codex.writeTextFileSafe(outputPath, stringifyDelimitedRows(rows, targetFormat), { overwrite: options.overwrite });
7933
+ const text = stringifyDelimitedRows(rows, targetFormat);
7934
+ await require_template_codex.writeTextFileSafe(outputPath, text, { overwrite: options.overwrite });
7919
7935
  require_template_codex.printLine(runtime.stdout, `Wrote ${getDelimitedDisplayLabel(targetFormat)}: ${require_template_codex.displayPath(runtime, outputPath)}`);
7920
7936
  require_template_codex.printLine(runtime.stdout, `Rows: ${countDelimitedDataRows(rows)}`);
7921
7937
  }
@@ -7945,7 +7961,8 @@ function stringifyJsonOutput(value, pretty = false) {
7945
7961
  async function actionMdFrontmatterToJson(runtime, options) {
7946
7962
  const inputPath = require_template_codex.resolveFromCwd(runtime, require_template_codex.assertNonEmpty(options.input, "Input path"));
7947
7963
  await require_template_codex.ensureFileExists(inputPath, "Input");
7948
- const parsed = require_template_codex.parseMarkdown(await require_template_codex.readTextFileRequired(inputPath));
7964
+ const raw = await require_template_codex.readTextFileRequired(inputPath);
7965
+ const parsed = require_template_codex.parseMarkdown(raw);
7949
7966
  if (parsed.frontmatterType === null || parsed.frontmatter === null) throw new require_template_codex.CliError(`No frontmatter found in Markdown file: ${inputPath}`, {
7950
7967
  code: "FRONTMATTER_NOT_FOUND",
7951
7968
  exitCode: 2
@@ -8113,7 +8130,7 @@ const PROJECT_PROFILE_BASENAME = "profile.yml";
8113
8130
  const PROJECT_TEMPLATE_BASENAME = "template.html";
8114
8131
  const PROJECT_CSS_BASENAME = "style.css";
8115
8132
  const PROJECT_REPORT_BASENAME = "project.codex-report.json";
8116
- const REPORT_DISCRIMINATOR_READ_LIMIT_BYTES$1 = 64 * 1024;
8133
+ const REPORT_DISCRIMINATOR_READ_LIMIT_BYTES$1 = 65536;
8117
8134
  const PROFILE_ROOT_KEYS$1 = new Set(require_template_codex.MARKDOWN_PDF_PROFILE_ROOT_KEYS);
8118
8135
  const PROJECT_WRITABLE_TOP_LEVEL_ENTRIES = /* @__PURE__ */ new Set([
8119
8136
  PROJECT_PROFILE_BASENAME,
@@ -8158,7 +8175,8 @@ async function classifyProjectProfile(path) {
8158
8175
  }
8159
8176
  }
8160
8177
  async function inspectManagedAssets(directory) {
8161
- const entries = await (0, node_fs_promises.readdir)((0, node_path.join)(directory, "assets"), { withFileTypes: true });
8178
+ const assetsDirectory = (0, node_path.join)(directory, "assets");
8179
+ const entries = await (0, node_fs_promises.readdir)(assetsDirectory, { withFileTypes: true });
8162
8180
  const accepted = [];
8163
8181
  const unrelated = [];
8164
8182
  for (const entry of entries) {
@@ -9935,7 +9953,8 @@ async function highlightMarkdownPdfCodeBlocks(html, options) {
9935
9953
  try {
9936
9954
  document = (0, parse5.parse)(html);
9937
9955
  } catch (error) {
9938
- throw new require_template_codex.CliError(`Failed to parse Markdown PDF HTML for code highlighting: ${error instanceof Error ? error.message : String(error)}`, {
9956
+ const message = error instanceof Error ? error.message : String(error);
9957
+ throw new require_template_codex.CliError(`Failed to parse Markdown PDF HTML for code highlighting: ${message}`, {
9939
9958
  code: "INVALID_INPUT",
9940
9959
  exitCode: 1
9941
9960
  });
@@ -9961,7 +9980,8 @@ async function highlightMarkdownPdfCodeBlocks(html, options) {
9961
9980
  return transformCodeBlocks(document, options, renderer);
9962
9981
  } catch (error) {
9963
9982
  if (error instanceof require_template_codex.CliError) throw error;
9964
- throw new require_template_codex.CliError(`Failed to highlight Markdown PDF code blocks: ${error instanceof Error ? error.message : String(error)}`, {
9983
+ const message = error instanceof Error ? error.message : String(error);
9984
+ throw new require_template_codex.CliError(`Failed to highlight Markdown PDF code blocks: ${message}`, {
9965
9985
  code: "MARKDOWN_PDF_CODE_HIGHLIGHT_FAILED",
9966
9986
  exitCode: 1
9967
9987
  });
@@ -10470,7 +10490,7 @@ const PROFILE_EXTENSIONS = /* @__PURE__ */ new Set([
10470
10490
  const PROFILE_ROOT_KEYS = new Set(require_template_codex.MARKDOWN_PDF_PROFILE_ROOT_KEYS);
10471
10491
  const MARKDOWN_PDF_PROFILE_CODEX_REPORT_TYPE = "markdown-pdf-codex-profile-report";
10472
10492
  const MARKDOWN_PDF_TEMPLATE_PROJECT_CODEX_REPORT_TYPES = /* @__PURE__ */ new Set(["markdown-pdf-codex-template-report", "markdown-pdf-codex-project-report"]);
10473
- const REPORT_DISCRIMINATOR_READ_LIMIT_BYTES = 64 * 1024;
10493
+ const REPORT_DISCRIMINATOR_READ_LIMIT_BYTES = 65536;
10474
10494
  function isNodeErrorCode$1(error, code) {
10475
10495
  return error instanceof Error && "code" in error && error.code === code;
10476
10496
  }
@@ -10598,7 +10618,8 @@ async function inspectMarkdownPdfRenderBundle(directory, options = {}) {
10598
10618
  candidates.ignoredProfileFiles.sort();
10599
10619
  if (!preview && candidates.profile.length === 0 && candidates.template.length === 0 && candidates.css.length === 0) {
10600
10620
  const ignoredFiles = candidates.ignoredProfileFiles;
10601
- throw new require_template_codex.CliError(`No Markdown PDF render artifacts found in bundle: ${directory}${ignoredFiles.length === 0 ? "" : `\n\nIgnored unclassified YAML or JSON files:\n${ignoredFiles.map((filename) => `- ${filename}`).join("\n")}`}`, {
10621
+ const ignoredSection = ignoredFiles.length === 0 ? "" : `\n\nIgnored unclassified YAML or JSON files:\n${ignoredFiles.map((filename) => `- ${filename}`).join("\n")}`;
10622
+ throw new require_template_codex.CliError(`No Markdown PDF render artifacts found in bundle: ${directory}${ignoredSection}`, {
10602
10623
  code: "MARKDOWN_PDF_BUNDLE_EMPTY",
10603
10624
  exitCode: 2
10604
10625
  });
@@ -11370,7 +11391,8 @@ function safeInteger(value, input) {
11370
11391
  return value;
11371
11392
  }
11372
11393
  function profileIdentity(input) {
11373
- const identity = require_template_codex.normalizeMarkdownPdfProfileIdentity(plainObject(input.profilePhase.finalProfile, "final Project Profile").profile);
11394
+ const finalProfile = plainObject(input.profilePhase.finalProfile, "final Project Profile");
11395
+ const identity = require_template_codex.normalizeMarkdownPdfProfileIdentity(finalProfile.profile);
11374
11396
  if (!identity || identity.id !== input.outputPlan.identity.profileId) return invalidProjection("Final Project Profile identity does not match the output plan.");
11375
11397
  return identity.id;
11376
11398
  }
@@ -11830,7 +11852,7 @@ function topLevelProfileFields(profile) {
11830
11852
  }
11831
11853
  function createFinalProfileSummary(profilePhase) {
11832
11854
  const { basedOn: _basedOn, preset: _preset, ...selectedSummary } = profilePhase.selectedCandidate.summary;
11833
- return require_template_codex.createMdPdfTemplateCodexBaseProfileSummary({
11855
+ const summary = {
11834
11856
  ...selectedSummary,
11835
11857
  ...profilePhase.identity.basedOn ? { basedOn: profilePhase.identity.basedOn } : {},
11836
11858
  ...profilePhase.identity.preset ? { preset: profilePhase.identity.preset } : {},
@@ -11838,7 +11860,8 @@ function createFinalProfileSummary(profilePhase) {
11838
11860
  id: profilePhase.identity.id,
11839
11861
  label: "Final project profile",
11840
11862
  presetBacked: Boolean(profilePhase.identity.preset)
11841
- });
11863
+ };
11864
+ return require_template_codex.createMdPdfTemplateCodexBaseProfileSummary(summary);
11842
11865
  }
11843
11866
  function createTemplateSignalsFromProject(input) {
11844
11867
  return {
@@ -11877,7 +11900,7 @@ async function suggestProjectTemplateWithCodexProgress(input) {
11877
11900
  codexProgress.begin("Requesting Codex Markdown PDF project template recommendation");
11878
11901
  let codexProgressStatus = "error";
11879
11902
  try {
11880
- const { suggestMarkdownPdfTemplateWithCodex } = await Promise.resolve().then(() => require("./markdown-pdf-template-OZ9pfDu1.cjs"));
11903
+ const { suggestMarkdownPdfTemplateWithCodex } = await Promise.resolve().then(() => require("./markdown-pdf-template-I3bsHLH-.cjs"));
11881
11904
  const result = input.templateCodexRunner ? await suggestMarkdownPdfTemplateWithCodex({
11882
11905
  intent: input.intent,
11883
11906
  outputPlan: input.outputPlan,
@@ -13118,13 +13141,15 @@ async function writePreparedMarkdownPdfTemplateInit(destination) {
13118
13141
  staged
13119
13142
  });
13120
13143
  } catch (rollbackError) {
13121
- throw new require_template_codex.CliError(`Failed to restore Markdown PDF template bundle: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`, {
13144
+ const message = rollbackError instanceof Error ? rollbackError.message : String(rollbackError);
13145
+ throw new require_template_codex.CliError(`Failed to restore Markdown PDF template bundle: ${message}`, {
13122
13146
  code: "FILE_WRITE_ERROR",
13123
13147
  exitCode: 2
13124
13148
  });
13125
13149
  }
13126
13150
  if (error instanceof require_template_codex.CliError) throw error;
13127
- throw new require_template_codex.CliError(`Failed to write Markdown PDF template bundle: ${error instanceof Error ? error.message : String(error)}`, {
13151
+ const message = error instanceof Error ? error.message : String(error);
13152
+ throw new require_template_codex.CliError(`Failed to write Markdown PDF template bundle: ${message}`, {
13128
13153
  code: "FILE_WRITE_ERROR",
13129
13154
  exitCode: 2
13130
13155
  });
@@ -13218,9 +13243,11 @@ async function prepareMarkdownPdfRender(runtime, input) {
13218
13243
  customCssPath = resolvedBundle.css?.path;
13219
13244
  }
13220
13245
  await require_template_codex.ensureFileExists(inputPath, "Input");
13221
- const parsedMarkdown = require_template_codex.parseMarkdown(await require_template_codex.readTextFileRequired(inputPath));
13246
+ const rawMarkdown = await require_template_codex.readTextFileRequired(inputPath);
13247
+ const parsedMarkdown = require_template_codex.parseMarkdown(rawMarkdown);
13248
+ const profileData = profilePath ? await require_template_codex.readMarkdownPdfProfileFile(profilePath) : void 0;
13222
13249
  const normalizedProfile = require_template_codex.normalizeMarkdownPdfProfile({
13223
- profile: profilePath ? await require_template_codex.readMarkdownPdfProfileFile(profilePath) : void 0,
13250
+ profile: profileData,
13224
13251
  frontmatter: parsedMarkdown.data,
13225
13252
  meta: input.meta
13226
13253
  });
@@ -13652,7 +13679,7 @@ async function applyRenamePlanCsv(runtime, csvPathInput) {
13652
13679
  const executableRows = rows.filter((row) => row.status === "planned");
13653
13680
  await applyPlannedRenames(plans);
13654
13681
  const appliedAt = runtime.now().toISOString();
13655
- await require_template_codex.writeTextFileSafe(csvPath, stringifyRenamePlanCsv(rows.map((row) => {
13682
+ const updatedRows = rows.map((row) => {
13656
13683
  if (row.status !== "planned") return row;
13657
13684
  return {
13658
13685
  ...row,
@@ -13661,7 +13688,8 @@ async function applyRenamePlanCsv(runtime, csvPathInput) {
13661
13688
  changed_at: appliedAt,
13662
13689
  reason: row.reason
13663
13690
  };
13664
- })), { overwrite: true });
13691
+ });
13692
+ await require_template_codex.writeTextFileSafe(csvPath, stringifyRenamePlanCsv(updatedRows), { overwrite: true });
13665
13693
  return {
13666
13694
  csvPath,
13667
13695
  totalRows: rows.length,
@@ -14363,7 +14391,8 @@ function getPreparedRenamePattern(options) {
14363
14391
  try {
14364
14392
  parsed = parseSerialToken(serialTokens[0] ?? "serial");
14365
14393
  } catch (error) {
14366
- throw new require_template_codex.CliError(`Invalid --pattern serial token: ${error instanceof Error ? error.message : String(error)}`, {
14394
+ const message = error instanceof Error ? error.message : String(error);
14395
+ throw new require_template_codex.CliError(`Invalid --pattern serial token: ${message}`, {
14367
14396
  code: "INVALID_INPUT",
14368
14397
  exitCode: 2
14369
14398
  });
@@ -14401,7 +14430,8 @@ function getPreparedRenamePattern(options) {
14401
14430
  try {
14402
14431
  parseSerialToken(token);
14403
14432
  } catch (error) {
14404
- throw new require_template_codex.CliError(`Invalid --pattern serial token: ${error instanceof Error ? error.message : String(error)}`, {
14433
+ const message = error instanceof Error ? error.message : String(error);
14434
+ throw new require_template_codex.CliError(`Invalid --pattern serial token: ${message}`, {
14405
14435
  code: "INVALID_INPUT",
14406
14436
  exitCode: 2
14407
14437
  });
@@ -14683,7 +14713,7 @@ function normalizePackagePartPath(value) {
14683
14713
  }
14684
14714
  //#endregion
14685
14715
  //#region src/adapters/docx/ooxml-package.ts
14686
- const MAX_DOCX_METADATA_PART_BYTES = 256 * 1024;
14716
+ const MAX_DOCX_METADATA_PART_BYTES = 262144;
14687
14717
  function shouldReadXmlLikePart(entry) {
14688
14718
  if (entry.fileName.endsWith("/")) return false;
14689
14719
  if (entry.uncompressedSize > MAX_DOCX_METADATA_PART_BYTES) return false;
@@ -15467,7 +15497,7 @@ async function extractEvidenceForPath(path) {
15467
15497
  }
15468
15498
  async function suggestSingleBatch$1(options, startThread = require_template_codex.startCodexReadOnlyThread) {
15469
15499
  if (options.evidences.length === 0) return { suggestions: [] };
15470
- const suggestionsByFilename = require_template_codex.parseFilenameTitleSuggestions((await (await startThread(options.workingDirectory, { codexExecution: options.codexExecution })).run([{
15500
+ const turn = await (await startThread(options.workingDirectory, { codexExecution: options.codexExecution })).run([{
15471
15501
  type: "text",
15472
15502
  text: buildDocumentPrompt({
15473
15503
  evidences: options.evidences.map((item) => ({
@@ -15479,7 +15509,8 @@ async function suggestSingleBatch$1(options, startThread = require_template_code
15479
15509
  }], {
15480
15510
  outputSchema: require_template_codex.CODEX_FILENAME_TITLE_OUTPUT_SCHEMA,
15481
15511
  signal: AbortSignal.timeout(options.timeoutMs ?? 3e4)
15482
- })).finalResponse);
15512
+ });
15513
+ const suggestionsByFilename = require_template_codex.parseFilenameTitleSuggestions(turn.finalResponse);
15483
15514
  const suggestions = [];
15484
15515
  for (const item of options.evidences) {
15485
15516
  const title = suggestionsByFilename.get(item.promptFilename);
@@ -15522,8 +15553,9 @@ async function suggestDocumentRenameTitles(options, suggestBatch) {
15522
15553
  });
15523
15554
  const batchSize = Math.max(1, Math.trunc(options.batchSize ?? evidenceItems.length));
15524
15555
  const retries = Math.max(0, Math.trunc(options.retries ?? 0));
15556
+ const batches = require_template_codex.chunkItems(evidenceItems, batchSize);
15525
15557
  const { suggestions, batchFailures } = await require_template_codex.executeBatchesWithRetries({
15526
- batches: require_template_codex.chunkItems(evidenceItems, batchSize),
15558
+ batches,
15527
15559
  retries,
15528
15560
  runBatch: async (batch) => suggestBatch({
15529
15561
  evidences: batch,
@@ -15586,10 +15618,11 @@ async function suggestSingleBatch(options, startThread = require_template_codex.
15586
15618
  type: "local_image",
15587
15619
  path
15588
15620
  }))];
15589
- const suggestionsByFilename = require_template_codex.parseFilenameTitleSuggestions((await thread.run(input, {
15621
+ const turn = await thread.run(input, {
15590
15622
  outputSchema: require_template_codex.CODEX_FILENAME_TITLE_OUTPUT_SCHEMA,
15591
15623
  signal: AbortSignal.timeout(options.timeoutMs ?? 3e4)
15592
- })).finalResponse);
15624
+ });
15625
+ const suggestionsByFilename = require_template_codex.parseFilenameTitleSuggestions(turn.finalResponse);
15593
15626
  const suggestions = [];
15594
15627
  for (const path of options.imagePaths) {
15595
15628
  const filename = (0, node_path.basename)(path);
@@ -15609,8 +15642,9 @@ async function suggestImageRenameTitles(options, suggestBatch) {
15609
15642
  const timeoutMs = options.timeoutMs ?? 3e4;
15610
15643
  const batchSize = Math.max(1, Math.trunc(options.batchSize ?? options.imagePaths.length));
15611
15644
  const retries = Math.max(0, Math.trunc(options.retries ?? 0));
15645
+ const batches = require_template_codex.chunkItems(options.imagePaths, batchSize);
15612
15646
  const { suggestions, batchFailures } = await require_template_codex.executeBatchesWithRetries({
15613
- batches: require_template_codex.chunkItems(options.imagePaths, batchSize),
15647
+ batches,
15614
15648
  retries,
15615
15649
  runBatch: async (batch) => suggestBatch({
15616
15650
  imagePaths: batch,
@@ -15653,7 +15687,7 @@ const IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
15653
15687
  ".tiff",
15654
15688
  ".avif"
15655
15689
  ]);
15656
- const CODEX_MAX_IMAGE_BYTES = 20 * 1024 * 1024;
15690
+ const CODEX_MAX_IMAGE_BYTES = 20971520;
15657
15691
  const CODEX_STATIC_IMAGE_EXTENSIONS = new Set([...IMAGE_EXTENSIONS].filter((ext) => ext !== ".gif"));
15658
15692
  const CODEX_TEXT_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([
15659
15693
  ".md",
@@ -15669,9 +15703,9 @@ const CODEX_TEXT_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([
15669
15703
  ]);
15670
15704
  const CODEX_PDF_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([".pdf"]);
15671
15705
  const CODEX_DOCX_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set([".docx"]);
15672
- const CODEX_MAX_TEXT_DOCUMENT_BYTES = 512 * 1024;
15673
- const CODEX_MAX_PDF_DOCUMENT_BYTES = 20 * 1024 * 1024;
15674
- const CODEX_MAX_DOCX_DOCUMENT_BYTES = 10 * 1024 * 1024;
15706
+ const CODEX_MAX_TEXT_DOCUMENT_BYTES = 524288;
15707
+ const CODEX_MAX_PDF_DOCUMENT_BYTES = 20971520;
15708
+ const CODEX_MAX_DOCX_DOCUMENT_BYTES = 10485760;
15675
15709
  async function selectCodexStaticImageCandidates(plans) {
15676
15710
  const eligiblePaths = [];
15677
15711
  let candidateCount = 0;
@@ -16003,7 +16037,8 @@ function compileOptionalRegex(value, label) {
16003
16037
  try {
16004
16038
  return new RegExp(pattern);
16005
16039
  } catch (error) {
16006
- throw new require_template_codex.CliError(`Invalid ${label}: ${error instanceof Error ? error.message : String(error)}`, {
16040
+ const message = error instanceof Error ? error.message : String(error);
16041
+ throw new require_template_codex.CliError(`Invalid ${label}: ${message}`, {
16007
16042
  code: "INVALID_INPUT",
16008
16043
  exitCode: 2
16009
16044
  });
@@ -18409,7 +18444,8 @@ async function promptRequiredPathWithConfig(message, options = {}) {
18409
18444
  });
18410
18445
  }
18411
18446
  function formatDefaultOutputPathHint(runtime, inputPath, nextExtension) {
18412
- return require_template_codex.formatPathForDisplay(runtime, require_template_codex.resolveFromCwd(runtime, defaultOutputPath(inputPath, nextExtension)));
18447
+ const derived = defaultOutputPath(inputPath, nextExtension);
18448
+ return require_template_codex.formatPathForDisplay(runtime, require_template_codex.resolveFromCwd(runtime, derived));
18413
18449
  }
18414
18450
  //#endregion
18415
18451
  //#region src/cli/interactive/shared.ts
@@ -19159,8 +19195,9 @@ async function reviewInteractiveHeaderMappings(options) {
19159
19195
  value: mapping.from
19160
19196
  }))
19161
19197
  });
19198
+ const currentMapping = workingMappings.find((mapping) => mapping.from === selectedFrom);
19162
19199
  const updatedTarget = await (0, _inquirer_prompts.input)({
19163
- default: workingMappings.find((mapping) => mapping.from === selectedFrom)?.to ?? "",
19200
+ default: currentMapping?.to ?? "",
19164
19201
  message: `Header for ${selectedFrom}`,
19165
19202
  validate: (value) => validateInteractiveHeaderMappings(workingMappings.map((mapping) => mapping.from === selectedFrom ? {
19166
19203
  ...mapping,
@@ -19211,8 +19248,9 @@ async function promptOptionalSourceSelection(format, sources) {
19211
19248
  if (!sources || sources.length === 0) return;
19212
19249
  const multiObjectFormat = format === "sqlite" || format === "duckdb" || format === "excel" ? format : void 0;
19213
19250
  if (!multiObjectFormat) return;
19251
+ const sourcePromptMessage = multiObjectFormat === "excel" ? "Choose an Excel sheet" : `Choose a ${getMultiObjectSourceDisplayLabel(multiObjectFormat)} source`;
19214
19252
  return await (0, _inquirer_prompts.select)({
19215
- message: multiObjectFormat === "excel" ? "Choose an Excel sheet" : `Choose a ${getMultiObjectSourceDisplayLabel(multiObjectFormat)} source`,
19253
+ message: sourcePromptMessage,
19216
19254
  choices: sources.map((source) => ({
19217
19255
  name: source,
19218
19256
  value: source
@@ -19595,15 +19633,16 @@ async function runCodexInteractiveQuery(runtime, pathPromptContext, options) {
19595
19633
  workingDirectory: runtime.cwd
19596
19634
  });
19597
19635
  status.stop();
19598
- if (!draftResult.draft) if (draftResult.failureKind === "timeout") {
19599
- require_template_codex.printLine(runtime.stderr, require_template_codex.formatCodexTimeoutFailure({
19600
- attemptsUsed: 1,
19601
- requestLabel: "Codex data-query drafting request",
19602
- timeoutMs: options.timeoutMs
19603
- }));
19604
- require_template_codex.printLine(runtime.stderr, "Regenerate this request, revise the intent, or restart with a longer limit: cdx-chores interactive --codex-timeout <duration>.");
19605
- } else require_template_codex.printLine(runtime.stderr, `Codex drafting failed: ${draftResult.errorMessage ?? "Unknown error."}`);
19606
- else {
19636
+ if (!draftResult.draft) {
19637
+ if (draftResult.failureKind === "timeout") {
19638
+ require_template_codex.printLine(runtime.stderr, require_template_codex.formatCodexTimeoutFailure({
19639
+ attemptsUsed: 1,
19640
+ requestLabel: "Codex data-query drafting request",
19641
+ timeoutMs: options.timeoutMs
19642
+ }));
19643
+ require_template_codex.printLine(runtime.stderr, "Regenerate this request, revise the intent, or restart with a longer limit: cdx-chores interactive --codex-timeout <duration>.");
19644
+ } else require_template_codex.printLine(runtime.stderr, `Codex drafting failed: ${draftResult.errorMessage ?? "Unknown error."}`);
19645
+ } else {
19607
19646
  const executionResult = await executeInteractiveCandidate(runtime, pathPromptContext, {
19608
19647
  format: options.format,
19609
19648
  headerMappings: options.headerMappings,
@@ -23918,9 +23957,7 @@ async function reviseCandidate(candidate, group, pathPromptContext) {
23918
23957
  case "page-numbers":
23919
23958
  revised = await reviseMarkdownPdfFormalGuidePageNumbers(answers, prompts);
23920
23959
  break;
23921
- case "page-chrome":
23922
- revised = await reviseMarkdownPdfFormalGuidePageChrome(answers, prompts);
23923
- break;
23960
+ case "page-chrome": revised = await reviseMarkdownPdfFormalGuidePageChrome(answers, prompts);
23924
23961
  }
23925
23962
  return prepareMarkdownPdfDeterministicRecipe({
23926
23963
  artifact: "profile",
@@ -24223,11 +24260,12 @@ async function promptMarkdownPdfInteractiveFontHintIntendedUse(artifact) {
24223
24260
  //#region src/cli/interactive/markdown/font-hints/suggestions.ts
24224
24261
  function buildMarkdownPdfInteractiveFontHintPreferenceChoices(input) {
24225
24262
  const typedValue = input.term ?? input.current ?? "";
24226
- const matches = require_template_codex.rankSearchableFontFamilies(input.records ?? (input.families ?? []).map((family) => ({
24263
+ const records = input.records ?? (input.families ?? []).map((family) => ({
24227
24264
  family,
24228
24265
  aliases: [],
24229
24266
  fullNames: []
24230
- })), input.term ?? "", 6);
24267
+ }));
24268
+ const matches = require_template_codex.rankSearchableFontFamilies(records, input.term ?? "", 6);
24231
24269
  const normalizedTypedValue = normalizeMarkdownPdfInteractiveFontHintFamilyName(typedValue);
24232
24270
  const filteredMatches = matches.filter((family) => normalizeMarkdownPdfInteractiveFontHintFamilyName(family) !== normalizedTypedValue);
24233
24271
  if (!normalizeMarkdownPdfInteractiveFontHintText(typedValue)) return filteredMatches;
@@ -25857,13 +25895,14 @@ function renderMarkdownPdfRecipeReview(runtime, selection) {
25857
25895
  //#region src/cli/interactive/markdown/to-pdf/output-review.ts
25858
25896
  async function promptMarkdownPdfOutput(runtime, pathPromptContext, selection) {
25859
25897
  while (true) {
25898
+ const defaultHint = formatDefaultOutputPathHint(runtime, selection.prepared.inputPath, ".pdf");
25860
25899
  const destination = await (0, _inquirer_prompts.select)({
25861
25900
  message: "PDF output destination",
25862
25901
  choices: [
25863
25902
  {
25864
25903
  name: "Use default output",
25865
25904
  value: "default",
25866
- description: formatDefaultOutputPathHint(runtime, selection.prepared.inputPath, ".pdf")
25905
+ description: defaultHint
25867
25906
  },
25868
25907
  {
25869
25908
  name: "Custom output path",
@@ -26136,11 +26175,12 @@ async function handleMarkdownPdfRecipesInteractiveAction(runtime, pathPromptCont
26136
26175
  group: "md"
26137
26176
  };
26138
26177
  if (outcome.kind === "saved-recipe") {
26178
+ const artifact = MARKDOWN_PDF_CODEX_ARTIFACT_LABELS[outcome.artifact].toLowerCase();
26139
26179
  const next = await (0, _inquirer_prompts.select)({
26140
26180
  message: "What next?",
26141
26181
  choices: [
26142
26182
  {
26143
- name: `Render a PDF with this ${MARKDOWN_PDF_CODEX_ARTIFACT_LABELS[outcome.artifact].toLowerCase()}`,
26183
+ name: `Render a PDF with this ${artifact}`,
26144
26184
  value: "render"
26145
26185
  },
26146
26186
  {
@@ -28103,7 +28143,7 @@ async function actionCodexInfo(runtime, options = {}) {
28103
28143
  code: "INVALID_INPUT",
28104
28144
  exitCode: 2
28105
28145
  });
28106
- const report = buildCodexInfoReport(await (options.discover ?? (await Promise.resolve().then(() => require("./discovery-PJ50-Wex.cjs"))).discoverCodexInfo)({
28146
+ const report = buildCodexInfoReport(await (options.discover ?? (await Promise.resolve().then(() => require("./discovery-zdpL5Pn9.cjs"))).discoverCodexInfo)({
28107
28147
  cwd: runtime.cwd,
28108
28148
  view,
28109
28149
  env
@@ -28494,7 +28534,7 @@ function configureCliProgramOutput(program, runtime) {
28494
28534
  }
28495
28535
  //#endregion
28496
28536
  //#region src/cli/program/version-embedded.ts
28497
- const EMBEDDED_PACKAGE_VERSION = "0.1.8";
28537
+ const EMBEDDED_PACKAGE_VERSION = "0.1.9-canary.2";
28498
28538
  //#endregion
28499
28539
  //#region src/cli/program/version.ts
28500
28540
  function* candidateSearchRoots() {
@@ -28527,7 +28567,7 @@ function normalizeVersion(value) {
28527
28567
  return trimmed;
28528
28568
  }
28529
28569
  function resolvePackageVersion(options = {}) {
28530
- const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.1.8");
28570
+ const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.1.9-canary.2");
28531
28571
  if (embeddedVersion) return embeddedVersion;
28532
28572
  const maxLevels = options.maxLevels ?? 8;
28533
28573
  const resolveFromPath = options.resolveFromPath ?? resolveVersionFromPath;
@@ -1,4 +1,4 @@
1
- const require_template_codex = require("./template-codex-C9NY6pKv.cjs");
1
+ const require_template_codex = require("./template-codex-B32Uj59l.cjs");
2
2
  //#region src/adapters/codex/markdown-pdf-template/decision.ts
3
3
  const COVER_STYLE_VALUES$1 = ["none", "media"];
4
4
  const ORIENTATION_BUCKET_VALUES$1 = [