cdx-chores 0.2.1-canary.2 → 0.2.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.
- package/README.md +28 -24
- package/dist/cjs/docx-parser.cjs +28 -5
- package/dist/cjs/index.cjs +2 -2
- package/dist/esm/bin.mjs +1 -1
- package/dist/esm/docx-parser.mjs +29 -6
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +2 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ Use `cdx-chores doctor` before relying on a command in a script, a CI job, or a
|
|
|
83
83
|
| `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` |
|
|
84
84
|
| `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` |
|
|
85
85
|
|
|
86
|
-
The Codex SDK baseline for `v0.2.1
|
|
86
|
+
The Codex SDK baseline for `v0.2.1` is `@openai/codex-sdk` `0.163.0`.
|
|
87
87
|
|
|
88
88
|
Adopted helper commands and explicit `interactive` sessions accept
|
|
89
89
|
`--codex-model`, `--codex-provider`, and `--codex-reasoning-effort`. Model and
|
|
@@ -319,6 +319,8 @@ Codex-assisted batch rename preview:
|
|
|
319
319
|
cdx-chores rename batch ./images --prefix gallery --codex --dry-run
|
|
320
320
|
```
|
|
321
321
|
|
|
322
|
+
DOCX title suggestions use the package's internal reader to extract metadata, headings, and text. Extraction attempts are limited to 8 MiB inputs and a 5-second processing deadline, separate from the Codex request timeout. Files above 8 MiB through 10 MiB fail extraction; larger files are skipped. Extraction failures retain deterministic rename fallback. See [Rename scope and Codex capabilities](docs/guides/rename-scope-and-codex-capability-guide.md) and [DOCX extraction limits](docs/references/docx-extraction.md) for content and platform limits.
|
|
323
|
+
|
|
322
324
|
Give every Codex request attempt a two-minute deadline, with a shorter image
|
|
323
325
|
analyzer override:
|
|
324
326
|
|
|
@@ -450,41 +452,43 @@ Cross-feature:
|
|
|
450
452
|
|
|
451
453
|
- [Codex execution configuration and discovery](docs/guides/codex-execution-configuration.md)
|
|
452
454
|
- [Environment variables](docs/guides/environment-variables.md)
|
|
453
|
-
-
|
|
454
|
-
-
|
|
455
|
-
-
|
|
455
|
+
- [CLI output and color](docs/guides/cli-output-and-color.md)
|
|
456
|
+
- [Codex timeouts, retries, and recovery](docs/guides/codex-timeouts-retries-and-recovery.md)
|
|
457
|
+
- [Patterns, placeholders, and templates](docs/guides/patterns-placeholders-and-templates.md)
|
|
456
458
|
|
|
457
459
|
Rename:
|
|
458
460
|
|
|
459
|
-
-
|
|
460
|
-
-
|
|
461
|
-
-
|
|
461
|
+
- [Rename common usage](docs/guides/rename-common-usage.md)
|
|
462
|
+
- [Rename timestamp format matrix](docs/guides/rename-timestamp-format-matrix.md)
|
|
463
|
+
- [Rename scope and Codex capabilities](docs/guides/rename-scope-and-codex-capability-guide.md)
|
|
464
|
+
- [DOCX extraction limits and behavior](docs/references/docx-extraction.md)
|
|
462
465
|
|
|
463
466
|
Data:
|
|
464
467
|
|
|
465
|
-
-
|
|
466
|
-
-
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
-
|
|
471
|
-
-
|
|
472
|
-
-
|
|
473
|
-
-
|
|
468
|
+
- [Data preview usage](docs/guides/data-preview-usage.md)
|
|
469
|
+
- [Data extract usage](docs/guides/data-extract-usage.md)
|
|
470
|
+
- [Data stack usage](docs/guides/data-stack-usage.md)
|
|
471
|
+
- [Data source shape usage](docs/guides/data-source-shape-usage.md)
|
|
472
|
+
- [Data schema and mapping usage](docs/guides/data-schema-and-mapping-usage.md)
|
|
473
|
+
- [Data query usage](docs/guides/data-query-usage.md)
|
|
474
|
+
- [Interactive data query usage](docs/guides/data-query-interactive-usage.md)
|
|
475
|
+
- [Data DuckDB usage](docs/guides/data-duckdb-usage.md)
|
|
476
|
+
- [Data query Codex usage](docs/guides/data-query-codex-usage.md)
|
|
474
477
|
|
|
475
478
|
Video:
|
|
476
479
|
|
|
477
|
-
-
|
|
478
|
-
-
|
|
480
|
+
- [Video frames usage](docs/guides/video-frames-usage.md)
|
|
481
|
+
- [Video GIF usage and quality modes](docs/guides/video-gif-usage-and-quality-modes.md)
|
|
482
|
+
- [Video resize usage and UX](docs/guides/video-resize-usage-and-ux.md)
|
|
479
483
|
|
|
480
484
|
Markdown:
|
|
481
485
|
|
|
482
|
-
-
|
|
483
|
-
-
|
|
484
|
-
-
|
|
485
|
-
-
|
|
486
|
-
-
|
|
487
|
-
-
|
|
486
|
+
- [Markdown PDF usage](docs/guides/markdown-pdf-usage.md)
|
|
487
|
+
- [Interactive Markdown PDF usage](docs/guides/markdown-pdf-interactive-usage.md)
|
|
488
|
+
- [Markdown PDF Codex profile helper](docs/guides/markdown-pdf-codex-profile-helper.md)
|
|
489
|
+
- [Markdown PDF Codex template helper](docs/guides/markdown-pdf-codex-template-helper.md)
|
|
490
|
+
- [Markdown PDF Codex project helper](docs/guides/markdown-pdf-codex-project-helper.md)
|
|
491
|
+
- [Markdown frontmatter to JSON output contract](docs/guides/md-frontmatter-to-json-output-contract.md)
|
|
488
492
|
|
|
489
493
|
## Local Development
|
|
490
494
|
|
package/dist/cjs/docx-parser.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
|
3
3
|
const require_limits = require("./limits-gYOZoKwZ.cjs");
|
|
4
4
|
let dingbat_to_unicode = require("dingbat-to-unicode");
|
|
5
5
|
let fast_xml_parser = require("fast-xml-parser");
|
|
6
|
+
let fast_xml_validator = require("fast-xml-validator");
|
|
6
7
|
let node_path = require("node:path");
|
|
7
8
|
let yauzl = require("yauzl");
|
|
8
9
|
yauzl = require_rolldown_runtime.__toESM(yauzl, 1);
|
|
@@ -20,6 +21,28 @@ function readSymbol(node, diagnostics) {
|
|
|
20
21
|
return "";
|
|
21
22
|
}
|
|
22
23
|
//#endregion
|
|
24
|
+
//#region src/utils/xml-validation.ts
|
|
25
|
+
/** Keep syntax policy shared while callers own diagnostics and recovery. */
|
|
26
|
+
function isValidXml(xml) {
|
|
27
|
+
try {
|
|
28
|
+
const validationXml = xml.replace(/^(\uFEFF?)<\?xml(?=[^\x20\t\r\n?])/, "$1 <?xml");
|
|
29
|
+
return fast_xml_validator.SyntaxValidator.validate(validationXml, {
|
|
30
|
+
multipleRoots: true,
|
|
31
|
+
xmlDeclaraion: {
|
|
32
|
+
optional: true,
|
|
33
|
+
argPosition: false
|
|
34
|
+
},
|
|
35
|
+
invalidCharSequence: {
|
|
36
|
+
comment: false,
|
|
37
|
+
tagValue: false,
|
|
38
|
+
attrLt: false
|
|
39
|
+
}
|
|
40
|
+
}) === true;
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
23
46
|
//#region src/docx/xml-budget.ts
|
|
24
47
|
/** Checks structure and allocation bounds before either XML parser sees a part. */
|
|
25
48
|
var XmlBudget = class {
|
|
@@ -185,7 +208,7 @@ function element(value, inherited) {
|
|
|
185
208
|
/** Structural bounds and declaration policy run before parser allocation. */
|
|
186
209
|
function parseXml(xml, budget = new XmlBudget(require_limits.resolveDocxLimits()), part = "inline") {
|
|
187
210
|
budget.inspect(part, xml);
|
|
188
|
-
if (
|
|
211
|
+
if (!isValidXml(escapeBareAmpersandsForValidation(xml))) throw new Error("docx_xml_invalid");
|
|
189
212
|
let root;
|
|
190
213
|
for (const value of parser.parse(normalizeAttributeWhitespace(xml))) {
|
|
191
214
|
const cdata = cdataText(value);
|
|
@@ -1242,7 +1265,7 @@ function getElementText(value) {
|
|
|
1242
1265
|
}
|
|
1243
1266
|
function parseDocxCoreProperties(xml) {
|
|
1244
1267
|
try {
|
|
1245
|
-
if (
|
|
1268
|
+
if (!isValidXml(xml)) return;
|
|
1246
1269
|
const root = xmlParser$1.parse(xml).coreProperties;
|
|
1247
1270
|
if (!root || typeof root !== "object" || Array.isArray(root)) return;
|
|
1248
1271
|
const metadata = {
|
|
@@ -1262,7 +1285,7 @@ function parseDocxCoreProperties(xml) {
|
|
|
1262
1285
|
function parseDocxExtendedPropertiesApplication(xml) {
|
|
1263
1286
|
if (!xml) return;
|
|
1264
1287
|
try {
|
|
1265
|
-
if (
|
|
1288
|
+
if (!isValidXml(xml)) return;
|
|
1266
1289
|
return getElementText(xmlParser$1.parse(xml).Properties?.Application);
|
|
1267
1290
|
} catch {
|
|
1268
1291
|
return;
|
|
@@ -1354,7 +1377,7 @@ function asArray(value) {
|
|
|
1354
1377
|
}
|
|
1355
1378
|
function parseRelationshipTargets(xml) {
|
|
1356
1379
|
try {
|
|
1357
|
-
if (
|
|
1380
|
+
if (!isValidXml(xml)) return;
|
|
1358
1381
|
const relationships = asArray(xmlParser.parse(xml).Relationships?.Relationship);
|
|
1359
1382
|
const targets = /* @__PURE__ */ new Set();
|
|
1360
1383
|
for (const relationship of relationships) {
|
|
@@ -1371,7 +1394,7 @@ function parseRelationshipTargets(xml) {
|
|
|
1371
1394
|
}
|
|
1372
1395
|
function parseContentTypeTargetPaths(xml) {
|
|
1373
1396
|
try {
|
|
1374
|
-
if (
|
|
1397
|
+
if (!isValidXml(xml)) return;
|
|
1375
1398
|
const overrides = asArray(xmlParser.parse(xml).Types?.Override);
|
|
1376
1399
|
const targets = {
|
|
1377
1400
|
appPropertiesPaths: [],
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -28452,7 +28452,7 @@ function configureCliProgramOutput(program, runtime) {
|
|
|
28452
28452
|
}
|
|
28453
28453
|
//#endregion
|
|
28454
28454
|
//#region src/cli/program/version-embedded.ts
|
|
28455
|
-
const EMBEDDED_PACKAGE_VERSION = "0.2.1
|
|
28455
|
+
const EMBEDDED_PACKAGE_VERSION = "0.2.1";
|
|
28456
28456
|
//#endregion
|
|
28457
28457
|
//#region src/cli/program/version.ts
|
|
28458
28458
|
function* candidateSearchRoots() {
|
|
@@ -28485,7 +28485,7 @@ function normalizeVersion(value) {
|
|
|
28485
28485
|
return trimmed;
|
|
28486
28486
|
}
|
|
28487
28487
|
function resolvePackageVersion(options = {}) {
|
|
28488
|
-
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.2.1
|
|
28488
|
+
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.2.1");
|
|
28489
28489
|
if (embeddedVersion) return embeddedVersion;
|
|
28490
28490
|
const maxLevels = options.maxLevels ?? 8;
|
|
28491
28491
|
const resolveFromPath = options.resolveFromPath ?? resolveVersionFromPath;
|
package/dist/esm/bin.mjs
CHANGED
|
@@ -40714,7 +40714,7 @@ function normalizeVersion(value) {
|
|
|
40714
40714
|
return trimmed;
|
|
40715
40715
|
}
|
|
40716
40716
|
function resolvePackageVersion(options = {}) {
|
|
40717
|
-
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.2.1
|
|
40717
|
+
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.2.1");
|
|
40718
40718
|
if (embeddedVersion) return embeddedVersion;
|
|
40719
40719
|
const maxLevels = options.maxLevels ?? 8;
|
|
40720
40720
|
const resolveFromPath = options.resolveFromPath ?? resolveVersionFromPath;
|
package/dist/esm/docx-parser.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { i as resolveDocxLimits, n as DocxLimitError, r as checkDocxLimit } from "./limits-BBxswqKh.mjs";
|
|
2
2
|
import { hex } from "dingbat-to-unicode";
|
|
3
|
-
import { XMLParser
|
|
3
|
+
import { XMLParser } from "fast-xml-parser";
|
|
4
|
+
import { SyntaxValidator } from "fast-xml-validator";
|
|
4
5
|
import { posix } from "node:path";
|
|
5
6
|
import yauzl from "yauzl";
|
|
6
7
|
import { finished } from "node:stream/promises";
|
|
@@ -17,6 +18,28 @@ function readSymbol(node, diagnostics) {
|
|
|
17
18
|
return "";
|
|
18
19
|
}
|
|
19
20
|
//#endregion
|
|
21
|
+
//#region src/utils/xml-validation.ts
|
|
22
|
+
/** Keep syntax policy shared while callers own diagnostics and recovery. */
|
|
23
|
+
function isValidXml(xml) {
|
|
24
|
+
try {
|
|
25
|
+
const validationXml = xml.replace(/^(\uFEFF?)<\?xml(?=[^\x20\t\r\n?])/, "$1 <?xml");
|
|
26
|
+
return SyntaxValidator.validate(validationXml, {
|
|
27
|
+
multipleRoots: true,
|
|
28
|
+
xmlDeclaraion: {
|
|
29
|
+
optional: true,
|
|
30
|
+
argPosition: false
|
|
31
|
+
},
|
|
32
|
+
invalidCharSequence: {
|
|
33
|
+
comment: false,
|
|
34
|
+
tagValue: false,
|
|
35
|
+
attrLt: false
|
|
36
|
+
}
|
|
37
|
+
}) === true;
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
20
43
|
//#region src/docx/xml-budget.ts
|
|
21
44
|
/** Checks structure and allocation bounds before either XML parser sees a part. */
|
|
22
45
|
var XmlBudget = class {
|
|
@@ -182,7 +205,7 @@ function element(value, inherited) {
|
|
|
182
205
|
/** Structural bounds and declaration policy run before parser allocation. */
|
|
183
206
|
function parseXml(xml, budget = new XmlBudget(resolveDocxLimits()), part = "inline") {
|
|
184
207
|
budget.inspect(part, xml);
|
|
185
|
-
if (
|
|
208
|
+
if (!isValidXml(escapeBareAmpersandsForValidation(xml))) throw new Error("docx_xml_invalid");
|
|
186
209
|
let root;
|
|
187
210
|
for (const value of parser.parse(normalizeAttributeWhitespace(xml))) {
|
|
188
211
|
const cdata = cdataText(value);
|
|
@@ -1239,7 +1262,7 @@ function getElementText(value) {
|
|
|
1239
1262
|
}
|
|
1240
1263
|
function parseDocxCoreProperties(xml) {
|
|
1241
1264
|
try {
|
|
1242
|
-
if (
|
|
1265
|
+
if (!isValidXml(xml)) return;
|
|
1243
1266
|
const root = xmlParser$1.parse(xml).coreProperties;
|
|
1244
1267
|
if (!root || typeof root !== "object" || Array.isArray(root)) return;
|
|
1245
1268
|
const metadata = {
|
|
@@ -1259,7 +1282,7 @@ function parseDocxCoreProperties(xml) {
|
|
|
1259
1282
|
function parseDocxExtendedPropertiesApplication(xml) {
|
|
1260
1283
|
if (!xml) return;
|
|
1261
1284
|
try {
|
|
1262
|
-
if (
|
|
1285
|
+
if (!isValidXml(xml)) return;
|
|
1263
1286
|
return getElementText(xmlParser$1.parse(xml).Properties?.Application);
|
|
1264
1287
|
} catch {
|
|
1265
1288
|
return;
|
|
@@ -1351,7 +1374,7 @@ function asArray(value) {
|
|
|
1351
1374
|
}
|
|
1352
1375
|
function parseRelationshipTargets(xml) {
|
|
1353
1376
|
try {
|
|
1354
|
-
if (
|
|
1377
|
+
if (!isValidXml(xml)) return;
|
|
1355
1378
|
const relationships = asArray(xmlParser.parse(xml).Relationships?.Relationship);
|
|
1356
1379
|
const targets = /* @__PURE__ */ new Set();
|
|
1357
1380
|
for (const relationship of relationships) {
|
|
@@ -1368,7 +1391,7 @@ function parseRelationshipTargets(xml) {
|
|
|
1368
1391
|
}
|
|
1369
1392
|
function parseContentTypeTargetPaths(xml) {
|
|
1370
1393
|
try {
|
|
1371
|
-
if (
|
|
1394
|
+
if (!isValidXml(xml)) return;
|
|
1372
1395
|
const overrides = asArray(xmlParser.parse(xml).Types?.Override);
|
|
1373
1396
|
const targets = {
|
|
1374
1397
|
appPropertiesPaths: [],
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -14,7 +14,7 @@ interface RunCliOptions {
|
|
|
14
14
|
export declare function runCli(argv?: string[], runtime?: RunCliOptions): Promise<void>;
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/cli/program/version-embedded.d.ts
|
|
17
|
-
export declare const EMBEDDED_PACKAGE_VERSION = "0.2.1
|
|
17
|
+
export declare const EMBEDDED_PACKAGE_VERSION = "0.2.1";
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/utils/csv.d.ts
|
|
20
20
|
type CsvRecord = Record<string, unknown>;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -28447,7 +28447,7 @@ function configureCliProgramOutput(program, runtime) {
|
|
|
28447
28447
|
}
|
|
28448
28448
|
//#endregion
|
|
28449
28449
|
//#region src/cli/program/version-embedded.ts
|
|
28450
|
-
const EMBEDDED_PACKAGE_VERSION = "0.2.1
|
|
28450
|
+
const EMBEDDED_PACKAGE_VERSION = "0.2.1";
|
|
28451
28451
|
//#endregion
|
|
28452
28452
|
//#region src/cli/program/version.ts
|
|
28453
28453
|
function* candidateSearchRoots() {
|
|
@@ -28480,7 +28480,7 @@ function normalizeVersion(value) {
|
|
|
28480
28480
|
return trimmed;
|
|
28481
28481
|
}
|
|
28482
28482
|
function resolvePackageVersion(options = {}) {
|
|
28483
|
-
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.2.1
|
|
28483
|
+
const embeddedVersion = normalizeVersion(options.embeddedVersion ?? "0.2.1");
|
|
28484
28484
|
if (embeddedVersion) return embeddedVersion;
|
|
28485
28485
|
const maxLevels = options.maxLevels ?? 8;
|
|
28486
28486
|
const resolveFromPath = options.resolveFromPath ?? resolveVersionFromPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cdx-chores",
|
|
3
|
-
"version": "0.2.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"automation",
|
|
6
6
|
"cli",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"commander": "^15.0.0",
|
|
61
61
|
"dingbat-to-unicode": "1.0.2",
|
|
62
62
|
"fast-xml-parser": "5.11.2",
|
|
63
|
+
"fast-xml-validator": "1.4.2",
|
|
63
64
|
"papaparse": "^5.7.0",
|
|
64
65
|
"parse5": "^8.0.1",
|
|
65
66
|
"pdfjs-dist": "^6.4.299",
|