@jasonbelmonti/markdown-engine 3.8.0 → 4.0.0
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/CHANGELOG.md +8 -2
- package/README.md +37 -28
- package/SECURITY.md +6 -4
- package/dist/cli/validate-args.d.ts +1 -1
- package/dist/cli/validate-args.d.ts.map +1 -1
- package/dist/cli/validate-args.js +8 -7
- package/dist/cli/validate-args.js.map +1 -1
- package/dist/cli/validation-output.d.ts.map +1 -1
- package/dist/cli/validation-output.js +7 -6
- package/dist/cli/validation-output.js.map +1 -1
- package/dist/cli/validation-report-cache.d.ts +3 -0
- package/dist/cli/validation-report-cache.d.ts.map +1 -0
- package/dist/cli/validation-report-cache.js +41 -0
- package/dist/cli/validation-report-cache.js.map +1 -0
- package/dist/internal/package-version.d.ts +1 -1
- package/dist/internal/package-version.js +1 -1
- package/dist-bundled/markdown-engine-cli.mjs +322 -286
- package/docs/contracts/declarative-validation.md +31 -13
- package/package.json +1 -1
- package/scripts/install-markdown-engine-cli.sh +2 -2
- package/skills/profile-backed-markdown/SKILL.md +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 4.0.0 - 2026-09-27
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Breaking CLI default:** validation now emits compact summaries and saves full
|
|
8
|
+
reports automatically in a private cache. Use `--output full` for complete,
|
|
9
|
+
repeatable stdout or `--report-file <new-file>` for caller-managed evidence.
|
|
10
|
+
Automatic reports older than seven days are pruned on later automatic writes.
|
|
11
|
+
Validation verdicts, exit semantics and engine API result types are unchanged.
|
|
6
12
|
|
|
7
13
|
## 3.8.0 - 2026-09-27
|
|
8
14
|
|
package/README.md
CHANGED
|
@@ -6,13 +6,14 @@ profile and runtime work.
|
|
|
6
6
|
Package release state:
|
|
7
7
|
|
|
8
8
|
- package name: `@jasonbelmonti/markdown-engine`
|
|
9
|
-
- package metadata version: `
|
|
9
|
+
- package metadata version: `4.0.0`
|
|
10
10
|
- published npm versions before this release: `0.1.0`, `1.0.0`, `2.0.0`,
|
|
11
11
|
`3.0.0`, `3.1.0`, `3.1.1`, `3.2.0`, `3.3.0`, `3.4.0`, `3.5.0`, `3.6.0`
|
|
12
|
-
- npm release target: `
|
|
12
|
+
- npm release target: `4.0.0` on `latest`
|
|
13
13
|
- website: <https://jasonbelmonti.github.io/markdown-engine/>
|
|
14
|
-
- release focus:
|
|
15
|
-
preserving
|
|
14
|
+
- release focus: compact validation output by default with automatic full reports,
|
|
15
|
+
preserving the `documentVersion: "1.0.0"` rich IR contract
|
|
16
|
+
- CLI migration: use `--output full` for the previous complete stdout format
|
|
16
17
|
- maintainer documentation map: [docs/README.md](docs/README.md)
|
|
17
18
|
- design reference:
|
|
18
19
|
[Markdown Engine 1.0 Rich IR design](docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md)
|
|
@@ -30,7 +31,7 @@ Package release state:
|
|
|
30
31
|
Out of scope for this package: profile compiler behavior, runtime lenses, MCP
|
|
31
32
|
transport, agent adapters, semantic or LLM evaluation, arbitrary rule plugins,
|
|
32
33
|
network services, persistent workflow state, and raw parser AST as a public contract.
|
|
33
|
-
The CLI
|
|
34
|
+
The validation CLI caches complete reports by default; the engine API remains
|
|
34
35
|
free of filesystem writes.
|
|
35
36
|
|
|
36
37
|
## Public API
|
|
@@ -153,38 +154,46 @@ markdown-engine validate --file node_modules/@jasonbelmonti/markdown-engine/fixt
|
|
|
153
154
|
`--format json` is accepted for validation, is the default, and is the only
|
|
154
155
|
supported format. The validation command reads and checks the profile before
|
|
155
156
|
reading the Markdown file. Profile parse/config/compile failures exit with code
|
|
156
|
-
`1` and emit JSON with `stage: "profile"
|
|
157
|
-
and no `evidence`. Markdown read errors and usage errors exit with code `2`.
|
|
157
|
+
`1` and emit JSON with `stage: "profile"`. Their full reports contain empty
|
|
158
|
+
`ruleResults`, no `profile`, and no `evidence`. Markdown read errors and usage errors exit with code `2`.
|
|
158
159
|
Successful validation exits with code `0`; validation or normalization error
|
|
159
|
-
diagnostics exit with code `1`.
|
|
160
|
+
diagnostics exit with code `1`. Full validation JSON includes `profile`,
|
|
160
161
|
`ruleResults`, `diagnostics`, and `evidence`.
|
|
161
162
|
|
|
162
|
-
|
|
163
|
+
Validation now returns compact JSON by default and automatically retains the
|
|
164
|
+
complete result in a unique local report. No extra output flags are needed.
|
|
165
|
+
The summary includes the verdict, stage, exit code, runtime/profile identities,
|
|
166
|
+
diagnostic counts, at most ten located diagnostics (errors first), and a report
|
|
167
|
+
reference with its absolute path, byte count and SHA-256. Omitted diagnostics and
|
|
168
|
+
shortened fields are explicitly counted. Full details remain in the report.
|
|
169
|
+
|
|
170
|
+
Automatic reports live under `$XDG_CACHE_HOME/markdown-engine/validation-reports`
|
|
171
|
+
when `XDG_CACHE_HOME` is absolute; otherwise `~/.cache/markdown-engine/validation-reports`.
|
|
172
|
+
The CLI creates this private cache. Reports older than seven days are pruned on
|
|
173
|
+
later automatic writes; cleanup is best-effort and external cache cleanup may
|
|
174
|
+
remove reports sooner. Reserve this directory for disposable automatic reports.
|
|
175
|
+
|
|
176
|
+
For durable evidence, choose a new filename outside the automatic cache:
|
|
163
177
|
|
|
164
178
|
```sh
|
|
165
179
|
mkdir -p reports
|
|
166
180
|
markdown-engine validate \
|
|
167
181
|
--file node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/pass.md \
|
|
168
182
|
--profile node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/profile.yaml \
|
|
169
|
-
--
|
|
183
|
+
--report-file reports/validation-001.json
|
|
170
184
|
```
|
|
171
185
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
input. A report-write failure exits `2`, prints an error to stderr and emits
|
|
184
|
-
no validation JSON to stdout. `--report-file` can also accompany full output.
|
|
185
|
-
Usage and input-read failures keep their existing stderr behavior and do not
|
|
186
|
-
create a report. Summary output is presentation only; it does not change any
|
|
187
|
-
validation result or establish semantic acceptance. See the
|
|
186
|
+
The parent of an explicit report must exist. Existing destinations, including
|
|
187
|
+
inputs, are never overwritten. A report-write failure exits `2`, writes stderr,
|
|
188
|
+
and emits no validation JSON. Usage and input-read errors create no report.
|
|
189
|
+
|
|
190
|
+
For complete JSON on stdout, use `--output full`. It preserves the earlier full
|
|
191
|
+
JSON layout and needs no writable cache unless `--report-file` is also supplied.
|
|
192
|
+
Scripts inspecting `ruleResults`, complete diagnostics or evidence arrays, or
|
|
193
|
+
comparing result bytes across invocations, must request full output. Automatic
|
|
194
|
+
summary paths are unique, so summaries are not byte-identical across invocations.
|
|
195
|
+
`--output summary` explicitly selects the default. This is a breaking CLI default
|
|
196
|
+
change; engine API results and validation semantics are unchanged. See the
|
|
188
197
|
[compact output contract](docs/contracts/declarative-validation.md#compact-validation-output).
|
|
189
198
|
|
|
190
199
|
Declarative validation compatibility is syntax-versioned. Existing v1 profiles
|
|
@@ -318,13 +327,13 @@ By default, the installer places the CLI under
|
|
|
318
327
|
and writes the wrapper to
|
|
319
328
|
`${MARKDOWN_ENGINE_BIN_DIR:-$HOME/.local/bin}/markdown-engine`. The installer
|
|
320
329
|
uses a local bundled artifact only when it matches the pinned artifact hash.
|
|
321
|
-
Otherwise it downloads `@jasonbelmonti/markdown-engine@
|
|
330
|
+
Otherwise it downloads `@jasonbelmonti/markdown-engine@4.0.0` with `npm pack
|
|
322
331
|
--ignore-scripts` and extracts only
|
|
323
332
|
`package/dist-bundled/markdown-engine-cli.mjs` from the tarball. It verifies the
|
|
324
333
|
pinned artifact hash before installing:
|
|
325
334
|
|
|
326
335
|
```text
|
|
327
|
-
|
|
336
|
+
afc4dfe3846f30f1e8ad70d77e818bd3bcfc9d62ef844a857c523ebaf758c97f
|
|
328
337
|
```
|
|
329
338
|
|
|
330
339
|
The installed wrapper is:
|
package/SECURITY.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
## Supported Versions
|
|
4
4
|
|
|
5
5
|
Security fixes target the latest published major version of
|
|
6
|
-
`@jasonbelmonti/markdown-engine`. As of the
|
|
7
|
-
to land on the latest `
|
|
8
|
-
Older `0.x`, `1.x`, and `
|
|
6
|
+
`@jasonbelmonti/markdown-engine`. As of the 4.0 release line, fixes are expected
|
|
7
|
+
to land on the latest `4.x` package unless a release note states otherwise.
|
|
8
|
+
Older `0.x`, `1.x`, `2.x`, and `3.x` lines are not maintained unless an explicit
|
|
9
9
|
backport is announced.
|
|
10
10
|
|
|
11
11
|
## Reporting A Vulnerability
|
|
@@ -27,4 +27,6 @@ This package parses Markdown and YAML frontmatter, normalizes engine-owned IR,
|
|
|
27
27
|
evaluates deterministic validation rules, and serializes public result objects.
|
|
28
28
|
|
|
29
29
|
It does not execute raw HTML, fetch network resources, call LLM providers,
|
|
30
|
-
run plugins, start services,
|
|
30
|
+
run plugins, start services, or evaluate semantic rules. The CLI writes full
|
|
31
|
+
validation reports to its private local cache by default, or to an explicit
|
|
32
|
+
`--report-file` destination; `--output full` avoids automatic report writes.
|
|
@@ -15,6 +15,6 @@ export type ValidateCliArgsResult = ValidateCliArgs | {
|
|
|
15
15
|
message: string;
|
|
16
16
|
usage: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const validateCliUsage = "Usage: markdown-engine validate --file <markdown-file> --profile <profile-file> [--format json] [--output full|summary] [--report-file <new-file>]\n\nRuns declarative validation for one Markdown file and one validation profile.\n\nOptions:\n --file <markdown-file> Markdown file to validate.\n --profile <profile-file> Declarative validation profile to apply.\n --format json Output JSON. This is the default and only supported format.\n --output full|summary
|
|
18
|
+
export declare const validateCliUsage = "Usage: markdown-engine validate --file <markdown-file> --profile <profile-file> [--format json] [--output full|summary] [--report-file <new-file>]\n\nRuns declarative validation for one Markdown file and one validation profile.\n\nOptions:\n --file <markdown-file> Markdown file to validate.\n --profile <profile-file> Declarative validation profile to apply.\n --format json Output JSON. This is the default and only supported format.\n --output full|summary Compact summary (default) or full JSON.\n --report-file <new-file> Save full JSON at a caller-managed new path. Never overwrites.\n -h, --help Show this help message.\n\nSummary includes at most 10 top-level diagnostics, errors first, with explicit\nomission/truncation counts. Without --report-file, summary saves a unique report\nin $XDG_CACHE_HOME/markdown-engine/validation-reports (default ~/.cache). Reports\nolder than seven days are pruned on later automatic writes. Explicit report\nparents must exist. Keep durable reports outside the automatic cache. Full output\nneeds no cache.\n\nExit status:\n 0 Validation completed with no error diagnostics.\n 1 Profile/config/compile or validation diagnostics failed.\n 2 Usage, unsupported format, unknown args, or file read/write error.\n";
|
|
19
19
|
export declare function parseValidateCliArgs(args: string[]): ValidateCliArgsResult;
|
|
20
20
|
//# sourceMappingURL=validate-args.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-args.d.ts","sourceRoot":"","sources":["../../src/cli/validate-args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAE1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,uBAAuB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"validate-args.d.ts","sourceRoot":"","sources":["../../src/cli/validate-args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAE1F,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,uBAAuB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,qBAAqB,GAC7B,eAAe,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,eAAO,MAAM,gBAAgB,24CAuB5B,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,qBAAqB,CAiD1E"}
|
|
@@ -6,12 +6,16 @@ Options:
|
|
|
6
6
|
--file <markdown-file> Markdown file to validate.
|
|
7
7
|
--profile <profile-file> Declarative validation profile to apply.
|
|
8
8
|
--format json Output JSON. This is the default and only supported format.
|
|
9
|
-
--output full|summary
|
|
10
|
-
--report-file <new-file> Save full JSON
|
|
9
|
+
--output full|summary Compact summary (default) or full JSON.
|
|
10
|
+
--report-file <new-file> Save full JSON at a caller-managed new path. Never overwrites.
|
|
11
11
|
-h, --help Show this help message.
|
|
12
12
|
|
|
13
13
|
Summary includes at most 10 top-level diagnostics, errors first, with explicit
|
|
14
|
-
omission/truncation counts.
|
|
14
|
+
omission/truncation counts. Without --report-file, summary saves a unique report
|
|
15
|
+
in $XDG_CACHE_HOME/markdown-engine/validation-reports (default ~/.cache). Reports
|
|
16
|
+
older than seven days are pruned on later automatic writes. Explicit report
|
|
17
|
+
parents must exist. Keep durable reports outside the automatic cache. Full output
|
|
18
|
+
needs no cache.
|
|
15
19
|
|
|
16
20
|
Exit status:
|
|
17
21
|
0 Validation completed with no error diagnostics.
|
|
@@ -65,14 +69,11 @@ export function parseValidateCliArgs(args) {
|
|
|
65
69
|
return validateError("File path cannot be empty.");
|
|
66
70
|
if (profilePath.trim() === "")
|
|
67
71
|
return validateError("Profile path cannot be empty.");
|
|
68
|
-
const output = (values["--output"][0] ?? "
|
|
72
|
+
const output = (values["--output"][0] ?? "summary");
|
|
69
73
|
const reportFile = values["--report-file"][0];
|
|
70
74
|
if (reportFile !== undefined && reportFile.trim() === "") {
|
|
71
75
|
return validateError("Report file path cannot be empty.");
|
|
72
76
|
}
|
|
73
|
-
if (output === "summary" && reportFile === undefined) {
|
|
74
|
-
return validateError("--output summary requires --report-file to retain the full result.");
|
|
75
|
-
}
|
|
76
77
|
return {
|
|
77
78
|
kind: "validate", filePath, profilePath, format: "json", output,
|
|
78
79
|
...(reportFile !== undefined ? { reportFile } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-args.js","sourceRoot":"","sources":["../../src/cli/validate-args.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,gBAAgB,GAAG
|
|
1
|
+
{"version":3,"file":"validate-args.js","sourceRoot":"","sources":["../../src/cli/validate-args.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuB/B,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,IAAc;IACjD,MAAM,MAAM,GAA6B;QACvC,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE;KACnF,CAAC;IACF,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,M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,UAAU,GAAG,MAAM,CAAC,eAAe,CAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACzD,OAAO,aAAa,CAAC,mCAAmC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO;QACL,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;QAC/D,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-output.d.ts","sourceRoot":"","sources":["../../src/cli/validation-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"validation-output.d.ts","sourceRoot":"","sources":["../../src/cli/validation-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAMrG,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,kCAAkC,EAC1C,QAAQ,EAAE,CAAC,GAAG,CAAC,EACf,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAoBjC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { normalizeStableJsonValue } from "../internal/stable-json.js";
|
|
2
|
+
import { saveAutomaticValidationReport } from "./validation-report-cache.js";
|
|
2
3
|
import { saveValidationReport } from "./validation-report.js";
|
|
3
4
|
import { createValidationSummary } from "./validation-summary.js";
|
|
4
5
|
export async function outputValidationResult(result, exitCode, options) {
|
|
5
6
|
const output = JSON.stringify(normalizeStableJsonValue(result), null, 2) ?? "null";
|
|
7
|
+
const summary = (options.output ?? "summary") === "summary";
|
|
6
8
|
try {
|
|
7
|
-
const report = options.reportFile
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw new Error("--output summary requires --report-file.");
|
|
9
|
+
const report = options.reportFile !== undefined
|
|
10
|
+
? await saveValidationReport(options.cwd, options.reportFile, `${output}\n`)
|
|
11
|
+
: summary ? await saveAutomaticValidationReport(`${output}\n`) : undefined;
|
|
12
|
+
if (summary && report !== undefined) {
|
|
12
13
|
return {
|
|
13
14
|
kind: "output", exitCode,
|
|
14
15
|
output: JSON.stringify(normalizeStableJsonValue(createValidationSummary(result, exitCode, report))),
|
|
@@ -19,7 +20,7 @@ export async function outputValidationResult(result, exitCode, options) {
|
|
|
19
20
|
catch (error) {
|
|
20
21
|
return {
|
|
21
22
|
kind: "fileError",
|
|
22
|
-
message: `Unable to save validation report "${options.reportFile ?? ""}": ${error instanceof Error ? error.message : String(error)}`,
|
|
23
|
+
message: `Unable to save validation report "${options.reportFile ?? "automatic cache"}": ${error instanceof Error ? error.message : String(error)}`,
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-output.js","sourceRoot":"","sources":["../../src/cli/validation-output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAYlE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAA0C,EAC1C,QAAe,EACf,OAAgC;IAEhC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS
|
|
1
|
+
{"version":3,"file":"validation-output.js","sourceRoot":"","sources":["../../src/cli/validation-output.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAYlE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAA0C,EAC1C,QAAe,EACf,OAAgC;IAEhC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC;IACnF,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,SAAS,CAAC,KAAK,SAAS,CAAC;IAC5D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS;YAC7C,CAAC,CAAC,MAAM,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC;YAC5E,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,6BAA6B,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,IAAI,OAAO,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO;gBACL,IAAI,EAAE,QAAQ,EAAE,QAAQ;gBACxB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,uBAAuB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;aACpG,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,qCAAqC,OAAO,CAAC,UAAU,IAAI,iBAAiB,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SACpJ,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Automatic reports are disposable; caller-selected report paths bypass this cache. */
|
|
2
|
+
export declare function saveAutomaticValidationReport(content: string): Promise<import("./validation-report.js").ValidationReportReference>;
|
|
3
|
+
//# sourceMappingURL=validation-report-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-report-cache.d.ts","sourceRoot":"","sources":["../../src/cli/validation-report-cache.ts"],"names":[],"mappings":"AASA,wFAAwF;AACxF,wBAAsB,6BAA6B,CAAC,OAAO,EAAE,MAAM,uEASlE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { lstat, mkdir, readdir, unlink } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { isAbsolute, join } from "node:path";
|
|
5
|
+
import { saveValidationReport } from "./validation-report.js";
|
|
6
|
+
const retentionMs = 7 * 24 * 60 * 60 * 1000;
|
|
7
|
+
const reportName = /^report-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.json$/;
|
|
8
|
+
/** Automatic reports are disposable; caller-selected report paths bypass this cache. */
|
|
9
|
+
export async function saveAutomaticValidationReport(content) {
|
|
10
|
+
const configuredRoot = process.env.XDG_CACHE_HOME;
|
|
11
|
+
const root = configuredRoot && isAbsolute(configuredRoot)
|
|
12
|
+
? configuredRoot : join(homedir(), ".cache");
|
|
13
|
+
const directory = join(root, "markdown-engine", "validation-reports");
|
|
14
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
15
|
+
const report = await saveValidationReport(directory, `report-${randomUUID()}.json`, content);
|
|
16
|
+
await pruneExpiredReports(directory, report.path);
|
|
17
|
+
return report;
|
|
18
|
+
}
|
|
19
|
+
async function pruneExpiredReports(directory, currentReport) {
|
|
20
|
+
// Cache maintenance must not invalidate an otherwise complete validation result.
|
|
21
|
+
try {
|
|
22
|
+
const cutoff = Date.now() - retentionMs;
|
|
23
|
+
for (const name of await readdir(directory)) {
|
|
24
|
+
const path = join(directory, name);
|
|
25
|
+
if (path === currentReport || !reportName.test(name))
|
|
26
|
+
continue;
|
|
27
|
+
try {
|
|
28
|
+
const metadata = await lstat(path);
|
|
29
|
+
if (metadata.isFile() && metadata.mtimeMs < cutoff)
|
|
30
|
+
await unlink(path);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Another validation or external cache cleanup may already have removed it.
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Unreadable caches still permit publication when the directory is writable.
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=validation-report-cache.js.map
|
|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AC,SAAiB,EAAE,aAAqB;IACzE,iFAAiF;IACjF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;QACxC,KAAK,MAAM,IAAI,IAAI,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACnC,IAAI,IAAI,KAAK,aAAa,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,SAAS;YAC/D,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnC,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,QAAQ,CAAC,OAAO,GAAG,MAAM;oBAAE,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YACzE,CAAC;YAAC,MAAM,CAAC;gBACP,4EAA4E;YAC9E,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,6EAA6E;IAC/E,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MARKDOWN_ENGINE_PACKAGE_VERSION = "
|
|
1
|
+
export declare const MARKDOWN_ENGINE_PACKAGE_VERSION = "4.0.0";
|
|
2
2
|
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const MARKDOWN_ENGINE_PACKAGE_VERSION = "
|
|
1
|
+
export const MARKDOWN_ENGINE_PACKAGE_VERSION = "4.0.0";
|
|
2
2
|
//# sourceMappingURL=package-version.js.map
|