@jasonbelmonti/markdown-engine 3.6.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 +27 -2
- package/README.md +52 -14
- package/SECURITY.md +6 -4
- package/dist/cli/declarative-validation.d.ts +3 -9
- package/dist/cli/declarative-validation.d.ts.map +1 -1
- package/dist/cli/declarative-validation.js +6 -16
- package/dist/cli/declarative-validation.js.map +1 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +2 -0
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/validate-args.d.ts +3 -1
- package/dist/cli/validate-args.d.ts.map +1 -1
- package/dist/cli/validate-args.js +46 -92
- package/dist/cli/validate-args.js.map +1 -1
- package/dist/cli/validation-output.d.ts +16 -0
- package/dist/cli/validation-output.d.ts.map +1 -0
- package/dist/cli/validation-output.js +27 -0
- package/dist/cli/validation-output.js.map +1 -0
- 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/cli/validation-report.d.ts +8 -0
- package/dist/cli/validation-report.d.ts.map +1 -0
- package/dist/cli/validation-report.js +24 -0
- package/dist/cli/validation-report.js.map +1 -0
- package/dist/cli/validation-summary.d.ts +47 -0
- package/dist/cli/validation-summary.d.ts.map +1 -0
- package/dist/cli/validation-summary.js +55 -0
- package/dist/cli/validation-summary.js.map +1 -0
- package/dist/declarative-validation/assertions/evaluator.d.ts.map +1 -1
- package/dist/declarative-validation/assertions/evaluator.js +3 -0
- package/dist/declarative-validation/assertions/evaluator.js.map +1 -1
- package/dist/declarative-validation/assertions/table-rows-complete.d.ts +4 -0
- package/dist/declarative-validation/assertions/table-rows-complete.d.ts.map +1 -0
- package/dist/declarative-validation/assertions/table-rows-complete.js +40 -0
- package/dist/declarative-validation/assertions/table-rows-complete.js.map +1 -0
- package/dist/declarative-validation/compiler/assertion-builders.d.ts.map +1 -1
- package/dist/declarative-validation/compiler/assertion-builders.js +2 -0
- package/dist/declarative-validation/compiler/assertion-builders.js.map +1 -1
- package/dist/declarative-validation/compiler/assertions.d.ts.map +1 -1
- package/dist/declarative-validation/compiler/assertions.js +1 -0
- package/dist/declarative-validation/compiler/assertions.js.map +1 -1
- package/dist/declarative-validation/compiler/compatibility.d.ts.map +1 -1
- package/dist/declarative-validation/compiler/compatibility.js +1 -0
- package/dist/declarative-validation/compiler/compatibility.js.map +1 -1
- package/dist/declarative-validation/compiler/plan.d.ts +2 -0
- package/dist/declarative-validation/compiler/plan.d.ts.map +1 -1
- package/dist/declarative-validation/compiler/table-rows-complete.d.ts +3 -0
- package/dist/declarative-validation/compiler/table-rows-complete.d.ts.map +1 -0
- package/dist/declarative-validation/compiler/table-rows-complete.js +17 -0
- package/dist/declarative-validation/compiler/table-rows-complete.js.map +1 -0
- package/dist/declarative-validation/profile/assertion-schema.d.ts.map +1 -1
- package/dist/declarative-validation/profile/assertion-schema.js +14 -0
- package/dist/declarative-validation/profile/assertion-schema.js.map +1 -1
- package/dist/declarative-validation/profile/index.d.ts +1 -0
- package/dist/declarative-validation/profile/index.d.ts.map +1 -1
- package/dist/internal/package-version.d.ts +1 -1
- package/dist/internal/package-version.js +1 -1
- package/dist-bundled/markdown-engine-cli.mjs +575 -422
- package/docs/contracts/declarative-validation.md +143 -9
- package/fixtures/declarative-validation/examples/table-rows-complete/README.md +65 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/blockquote.md +3 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/complete.md +3 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/consumer-missing.md +50 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/consumer-repaired.md +50 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/excess.md +3 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/explicit-empty.md +3 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/header-only.md +2 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/legacy.yaml +10 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/missing.md +3 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/multiple.md +5 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/oracle.json +85 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/profile.yaml +11 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/shape.yaml +8 -0
- package/fixtures/declarative-validation/examples/table-rows-complete/syntax.md +3 -0
- package/package.json +2 -2
- 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,33 @@
|
|
|
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.
|
|
12
|
+
|
|
13
|
+
## 3.8.0 - 2026-09-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Added opt-in validation CLI `--output summary --report-file <new-file>`:
|
|
18
|
+
bounded JSON diagnostics and verdict/identity metadata on stdout, with the
|
|
19
|
+
complete existing JSON result retained in an exclusive report file and
|
|
20
|
+
identified by its byte digest. Default full output is unchanged; report
|
|
21
|
+
publication errors exit 2 without printing a successful validation result.
|
|
22
|
+
|
|
23
|
+
## 3.7.0 - 2026-09-26
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- Added the opt-in V2 `tableRowsComplete` assertion to require each selected
|
|
28
|
+
table body row to match the header cell count, with located diagnostics for
|
|
29
|
+
missing and excess cells. Explicit empty cells remain a separate nonblank
|
|
30
|
+
content concern, and existing profiles retain their behavior by default.
|
|
6
31
|
|
|
7
32
|
## 3.6.0 - 2026-09-13
|
|
8
33
|
|
package/README.md
CHANGED
|
@@ -6,14 +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
|
-
`3.0.0`, `3.1.0`, `3.1.1`, `3.2.0`, `3.3.0`, `3.4.0`, `3.5.0`
|
|
12
|
-
- npm release target: `
|
|
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: `4.0.0` on `latest`
|
|
13
13
|
- website: <https://jasonbelmonti.github.io/markdown-engine/>
|
|
14
|
-
- release focus:
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
17
17
|
- maintainer documentation map: [docs/README.md](docs/README.md)
|
|
18
18
|
- design reference:
|
|
19
19
|
[Markdown Engine 1.0 Rich IR design](docs/design/markdown-engine-1.0-rich-ir-operational-design-spec.md)
|
|
@@ -30,7 +30,9 @@ Package release state:
|
|
|
30
30
|
|
|
31
31
|
Out of scope for this package: profile compiler behavior, runtime lenses, MCP
|
|
32
32
|
transport, agent adapters, semantic or LLM evaluation, arbitrary rule plugins,
|
|
33
|
-
network services,
|
|
33
|
+
network services, persistent workflow state, and raw parser AST as a public contract.
|
|
34
|
+
The validation CLI caches complete reports by default; the engine API remains
|
|
35
|
+
free of filesystem writes.
|
|
34
36
|
|
|
35
37
|
## Public API
|
|
36
38
|
|
|
@@ -85,7 +87,7 @@ console.log(validationResult.valid);
|
|
|
85
87
|
console.log(serialize(validationResult, { pretty: true }));
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
Package 3.
|
|
90
|
+
Package 3.8 retains the serialized document contract at
|
|
89
91
|
`documentVersion: "1.0.0"` and makes that rich IR path the default for
|
|
90
92
|
`normalize(parsed)`. Callers may still pass
|
|
91
93
|
`normalize(parsed, { documentVersion: "1.0.0" })` explicitly. That path adds
|
|
@@ -152,12 +154,48 @@ markdown-engine validate --file node_modules/@jasonbelmonti/markdown-engine/fixt
|
|
|
152
154
|
`--format json` is accepted for validation, is the default, and is the only
|
|
153
155
|
supported format. The validation command reads and checks the profile before
|
|
154
156
|
reading the Markdown file. Profile parse/config/compile failures exit with code
|
|
155
|
-
`1` and emit JSON with `stage: "profile"
|
|
156
|
-
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`.
|
|
157
159
|
Successful validation exits with code `0`; validation or normalization error
|
|
158
|
-
diagnostics exit with code `1`.
|
|
160
|
+
diagnostics exit with code `1`. Full validation JSON includes `profile`,
|
|
159
161
|
`ruleResults`, `diagnostics`, and `evidence`.
|
|
160
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:
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
mkdir -p reports
|
|
180
|
+
markdown-engine validate \
|
|
181
|
+
--file node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/pass.md \
|
|
182
|
+
--profile node_modules/@jasonbelmonti/markdown-engine/fixtures/declarative-validation/examples/operational-spec/profile.yaml \
|
|
183
|
+
--report-file reports/validation-001.json
|
|
184
|
+
```
|
|
185
|
+
|
|
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
|
|
197
|
+
[compact output contract](docs/contracts/declarative-validation.md#compact-validation-output).
|
|
198
|
+
|
|
161
199
|
Declarative validation compatibility is syntax-versioned. Existing v1 profiles
|
|
162
200
|
remain on the v1 result and evidence shape by keeping:
|
|
163
201
|
|
|
@@ -289,13 +327,13 @@ By default, the installer places the CLI under
|
|
|
289
327
|
and writes the wrapper to
|
|
290
328
|
`${MARKDOWN_ENGINE_BIN_DIR:-$HOME/.local/bin}/markdown-engine`. The installer
|
|
291
329
|
uses a local bundled artifact only when it matches the pinned artifact hash.
|
|
292
|
-
Otherwise it downloads `@jasonbelmonti/markdown-engine@
|
|
330
|
+
Otherwise it downloads `@jasonbelmonti/markdown-engine@4.0.0` with `npm pack
|
|
293
331
|
--ignore-scripts` and extracts only
|
|
294
332
|
`package/dist-bundled/markdown-engine-cli.mjs` from the tarball. It verifies the
|
|
295
333
|
pinned artifact hash before installing:
|
|
296
334
|
|
|
297
335
|
```text
|
|
298
|
-
|
|
336
|
+
afc4dfe3846f30f1e8ad70d77e818bd3bcfc9d62ef844a857c523ebaf758c97f
|
|
299
337
|
```
|
|
300
338
|
|
|
301
339
|
The installed wrapper is:
|
|
@@ -304,7 +342,7 @@ The installed wrapper is:
|
|
|
304
342
|
"${MARKDOWN_ENGINE_BIN_DIR:-$HOME/.local/bin}/markdown-engine" validate --file <file.md> --profile <profile.yaml> --format json
|
|
305
343
|
```
|
|
306
344
|
|
|
307
|
-
Package 3.
|
|
345
|
+
Package 3.8 keeps the 2.0 API normalization default: callers that invoke
|
|
308
346
|
`normalize(parsed)` receive the rich IR `1.0.0` document shape. Consumers that
|
|
309
347
|
still need the legacy `0.0.0` shape should consume the rich IR fields
|
|
310
348
|
(`target`, `sections`, `textSpans`, `tables`, `lists`, and `links`) or pin
|
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.
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { DeclarativeOutputFormat } from "../declarative-validation/profile/index.js";
|
|
2
|
+
import { type ValidationOutputOptions, type ValidationOutputResult } from "./validation-output.js";
|
|
2
3
|
/** @internal Declarative validation CLI behavior is not part of the package API. */
|
|
3
|
-
export interface DeclarativeValidationCliAdapterOptions {
|
|
4
|
+
export interface DeclarativeValidationCliAdapterOptions extends ValidationOutputOptions {
|
|
4
5
|
cwd: string;
|
|
5
6
|
filePath: string;
|
|
6
7
|
profilePath: string;
|
|
7
8
|
format: DeclarativeOutputFormat;
|
|
8
9
|
}
|
|
9
|
-
export type DeclarativeValidationCliAdapterResult =
|
|
10
|
-
kind: "output";
|
|
11
|
-
exitCode: 0 | 1;
|
|
12
|
-
output: string;
|
|
13
|
-
} | {
|
|
14
|
-
kind: "fileError";
|
|
15
|
-
message: string;
|
|
16
|
-
};
|
|
10
|
+
export type DeclarativeValidationCliAdapterResult = ValidationOutputResult;
|
|
17
11
|
export declare function runDeclarativeValidationCli(input: DeclarativeValidationCliAdapterOptions): Promise<DeclarativeValidationCliAdapterResult>;
|
|
18
12
|
//# sourceMappingURL=declarative-validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarative-validation.d.ts","sourceRoot":"","sources":["../../src/cli/declarative-validation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"declarative-validation.d.ts","sourceRoot":"","sources":["../../src/cli/declarative-validation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,4CAA4C,CAAC;AASpD,OAAO,EAA0B,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAE3H,oFAAoF;AACpF,MAAM,WAAW,sCAAuC,SAAQ,uBAAuB;IACrF,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,uBAAuB,CAAC;CACjC;AAED,MAAM,MAAM,qCAAqC,GAAG,sBAAsB,CAAC;AAE3E,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,sCAAsC,GAC5C,OAAO,CAAC,qCAAqC,CAAC,CA8EhD"}
|
|
@@ -3,9 +3,9 @@ import { compileValidationProfile } from "../declarative-validation/compiler/ind
|
|
|
3
3
|
import { parseValidationProfileInput } from "../declarative-validation/profile/index.js";
|
|
4
4
|
import { createDeclarativeValidationResult } from "../declarative-validation/results/index.js";
|
|
5
5
|
import { cloneDiagnostics, hasErrorDiagnostic } from "../diagnostics/index.js";
|
|
6
|
-
import { normalizeStableJsonValue } from "../internal/stable-json.js";
|
|
7
6
|
import { readCliFile } from "./files.js";
|
|
8
7
|
import { normalizeMarkdown } from "./normalize-markdown.js";
|
|
8
|
+
import { outputValidationResult } from "./validation-output.js";
|
|
9
9
|
export async function runDeclarativeValidationCli(input) {
|
|
10
10
|
const profileText = await readValidationFile(input.profilePath, input.cwd);
|
|
11
11
|
if (profileText.kind === "fileError") {
|
|
@@ -16,11 +16,11 @@ export async function runDeclarativeValidationCli(input) {
|
|
|
16
16
|
});
|
|
17
17
|
if (profileResult.profile === undefined ||
|
|
18
18
|
hasErrorDiagnostic(profileResult.diagnostics)) {
|
|
19
|
-
return
|
|
19
|
+
return outputValidationResult(profileStageResult(profileResult.diagnostics), 1, input);
|
|
20
20
|
}
|
|
21
21
|
const compileDiagnostics = compileProfileForCli(profileResult.profile);
|
|
22
22
|
if (hasErrorDiagnostic(compileDiagnostics)) {
|
|
23
|
-
return
|
|
23
|
+
return outputValidationResult(profileStageResult([...profileResult.diagnostics, ...compileDiagnostics]), 1, input);
|
|
24
24
|
}
|
|
25
25
|
const markdown = await readValidationFile(input.filePath, input.cwd);
|
|
26
26
|
if (markdown.kind === "fileError") {
|
|
@@ -36,14 +36,14 @@ export async function runDeclarativeValidationCli(input) {
|
|
|
36
36
|
...normalizeResult.diagnostics,
|
|
37
37
|
];
|
|
38
38
|
if (hasErrorDiagnostic(normalizeResult.diagnostics)) {
|
|
39
|
-
return
|
|
39
|
+
return outputValidationResult(documentDiagnosticsResult(normalizeResult.document, profileResult.profile, markdown.content, [
|
|
40
40
|
...documentDiagnostics,
|
|
41
41
|
...documentVersionDiagnostics(profileResult.profile, normalizeResult.document.version),
|
|
42
|
-
]), 1);
|
|
42
|
+
]), 1, input);
|
|
43
43
|
}
|
|
44
44
|
const validationResult = validateWithProfile(normalizeResult.document, profileResult.profile, { includeEvidence: true, sourceText: markdown.content });
|
|
45
45
|
const result = mergeDocumentDiagnostics(validationResult, documentDiagnostics);
|
|
46
|
-
return
|
|
46
|
+
return outputValidationResult(result, hasErrorDiagnostic(result.diagnostics) ? 1 : 0, input);
|
|
47
47
|
}
|
|
48
48
|
function compileProfileForCli(profile) {
|
|
49
49
|
return compileValidationProfile(profile).diagnostics;
|
|
@@ -99,16 +99,6 @@ function mergeDocumentDiagnostics(validationResult, documentDiagnostics) {
|
|
|
99
99
|
: {}),
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function outputResult(result, exitCode) {
|
|
103
|
-
return {
|
|
104
|
-
kind: "output",
|
|
105
|
-
exitCode,
|
|
106
|
-
output: serializeDeclarativeValidationCliJsonResult(result),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function serializeDeclarativeValidationCliJsonResult(result) {
|
|
110
|
-
return JSON.stringify(normalizeStableJsonValue(result), null, 2) ?? "null";
|
|
111
|
-
}
|
|
112
102
|
async function readValidationFile(path, cwd) {
|
|
113
103
|
try {
|
|
114
104
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarative-validation.js","sourceRoot":"","sources":["../../src/cli/declarative-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAKzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"declarative-validation.js","sourceRoot":"","sources":["../../src/cli/declarative-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAKzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAK/F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAA6D,MAAM,wBAAwB,CAAC;AAY3H,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,KAA6C;IAE7C,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAE3E,IAAI,WAAW,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACrC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,aAA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["../../src/cli/run.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAsB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAqDhE"}
|
package/dist/cli/run.js
CHANGED
|
@@ -20,6 +20,8 @@ export async function runCli(input) {
|
|
|
20
20
|
filePath: argsResult.filePath,
|
|
21
21
|
format: argsResult.format,
|
|
22
22
|
profilePath: argsResult.profilePath,
|
|
23
|
+
output: argsResult.output,
|
|
24
|
+
...(argsResult.reportFile !== undefined ? { reportFile: argsResult.reportFile } : {}),
|
|
23
25
|
});
|
|
24
26
|
if (validationResult.kind === "fileError") {
|
|
25
27
|
input.stderr.write(`${validationResult.message}\n`);
|
package/dist/cli/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,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,CAAC,CAAC;QACX,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,MAAM,IAAI,CAAC,CAAC;QACnD,OAAO,gBAAgB,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1E,MAAM,eAAe,GAAG,iBAAiB,CAAC;YACxC,eAAe,EAAE,UAAU,CAAC,eAAe;YAC3C,QAAQ;YACR,IAAI,EAAE,UAAU,CAAC,UAAU;SAC5B,CAAC,CAAC;QAEH,KAAK,CAAC,MAAM,CAAC,KAAK,CAChB,GAAG,SAAS,CAAC,eAAe,EAAE;YAC5B,iBAAiB,EAAE,mCAAmC,CACpD,UAAU,CAAC,eAAe,CAC3B;YACD,MAAM,EAAE,IAAI;SACb,CAAC,IAAI,CACP,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -4,6 +4,8 @@ export interface ValidateCliArgs {
|
|
|
4
4
|
filePath: string;
|
|
5
5
|
format: DeclarativeOutputFormat;
|
|
6
6
|
profilePath: string;
|
|
7
|
+
output: "full" | "summary";
|
|
8
|
+
reportFile?: string;
|
|
7
9
|
}
|
|
8
10
|
export type ValidateCliArgsResult = ValidateCliArgs | {
|
|
9
11
|
kind: "help";
|
|
@@ -13,6 +15,6 @@ export type ValidateCliArgsResult = ValidateCliArgs | {
|
|
|
13
15
|
message: string;
|
|
14
16
|
usage: string;
|
|
15
17
|
};
|
|
16
|
-
export declare const validateCliUsage = "Usage: markdown-engine validate --file <markdown-file> --profile <profile-file> [--format json]\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 -h, --help Show this help message.\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 error.\n";
|
|
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";
|
|
17
19
|
export declare function parseValidateCliArgs(args: string[]): ValidateCliArgsResult;
|
|
18
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;
|
|
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"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
const fileAssignmentPrefix = `${fileFlag}=`;
|
|
3
|
-
const profileFlag = "--profile";
|
|
4
|
-
const profileAssignmentPrefix = `${profileFlag}=`;
|
|
5
|
-
const formatFlag = "--format";
|
|
6
|
-
const formatAssignmentPrefix = `${formatFlag}=`;
|
|
7
|
-
export const validateCliUsage = `Usage: markdown-engine validate --file <markdown-file> --profile <profile-file> [--format json]
|
|
1
|
+
export const validateCliUsage = `Usage: markdown-engine validate --file <markdown-file> --profile <profile-file> [--format json] [--output full|summary] [--report-file <new-file>]
|
|
8
2
|
|
|
9
3
|
Runs declarative validation for one Markdown file and one validation profile.
|
|
10
4
|
|
|
@@ -12,119 +6,79 @@ Options:
|
|
|
12
6
|
--file <markdown-file> Markdown file to validate.
|
|
13
7
|
--profile <profile-file> Declarative validation profile to apply.
|
|
14
8
|
--format json Output JSON. This is the default and only supported format.
|
|
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.
|
|
15
11
|
-h, --help Show this help message.
|
|
16
12
|
|
|
13
|
+
Summary includes at most 10 top-level diagnostics, errors first, with explicit
|
|
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.
|
|
19
|
+
|
|
17
20
|
Exit status:
|
|
18
21
|
0 Validation completed with no error diagnostics.
|
|
19
22
|
1 Profile/config/compile or validation diagnostics failed.
|
|
20
|
-
2 Usage, unsupported format, unknown args, or file read error.
|
|
23
|
+
2 Usage, unsupported format, unknown args, or file read/write error.
|
|
21
24
|
`;
|
|
22
25
|
export function parseValidateCliArgs(args) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
const values = {
|
|
27
|
+
"--file": [], "--profile": [], "--format": [], "--output": [], "--report-file": [],
|
|
28
|
+
};
|
|
26
29
|
for (let index = 0; index < args.length; index += 1) {
|
|
27
30
|
const arg = args[index];
|
|
28
31
|
if (arg === "-h" || arg === "--help") {
|
|
29
32
|
return { kind: "help", usage: validateCliUsage };
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
continue;
|
|
34
|
+
const equals = arg.indexOf("=");
|
|
35
|
+
const flag = equals === -1 ? arg : arg.slice(0, equals);
|
|
36
|
+
if (!Object.hasOwn(values, flag))
|
|
37
|
+
return validateError(`Unknown argument: ${arg}`);
|
|
38
|
+
const entries = values[flag];
|
|
39
|
+
if (flag !== "--file" && flag !== "--profile" && entries.length > 0) {
|
|
40
|
+
return validateError(`Expected at most one ${flag} selector.`);
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const value = equals === -1 ? args[index + 1] : arg.slice(equals + 1);
|
|
43
|
+
if (value === undefined || (equals === -1 && value.startsWith("-"))) {
|
|
44
|
+
return validateError(`Missing value for ${flag}.`);
|
|
43
45
|
}
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
if (value.kind === "error") {
|
|
47
|
-
return validateError(value.message);
|
|
48
|
-
}
|
|
49
|
-
profilePaths.push(value.value);
|
|
50
|
-
index += 1;
|
|
51
|
-
continue;
|
|
46
|
+
if (flag === "--format" && value !== "json") {
|
|
47
|
+
return validateError(`Unsupported validation output format: ${value}.`);
|
|
52
48
|
}
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
continue;
|
|
49
|
+
if (flag === "--output" && value !== "full" && value !== "summary") {
|
|
50
|
+
return validateError(`Unsupported validation output mode: ${value}.`);
|
|
56
51
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return validateError("Expected at most one --format selector.");
|
|
60
|
-
}
|
|
61
|
-
const value = readRequiredFlagValue(arg, args, index);
|
|
62
|
-
if (value.kind === "error") {
|
|
63
|
-
return validateError(value.message);
|
|
64
|
-
}
|
|
65
|
-
const parsedFormat = parseDeclarativeOutputFormat(value.value);
|
|
66
|
-
if (parsedFormat.kind === "error") {
|
|
67
|
-
return validateError(parsedFormat.message);
|
|
68
|
-
}
|
|
69
|
-
format = parsedFormat.format;
|
|
52
|
+
entries.push(value);
|
|
53
|
+
if (equals === -1)
|
|
70
54
|
index += 1;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (arg?.startsWith(formatAssignmentPrefix) === true) {
|
|
74
|
-
if (format !== undefined) {
|
|
75
|
-
return validateError("Expected at most one --format selector.");
|
|
76
|
-
}
|
|
77
|
-
const parsedFormat = parseDeclarativeOutputFormat(arg.slice(formatAssignmentPrefix.length));
|
|
78
|
-
if (parsedFormat.kind === "error") {
|
|
79
|
-
return validateError(parsedFormat.message);
|
|
80
|
-
}
|
|
81
|
-
format = parsedFormat.format;
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
return validateError(`Unknown argument: ${arg ?? ""}`);
|
|
85
55
|
}
|
|
86
|
-
|
|
56
|
+
const files = values["--file"];
|
|
57
|
+
const profiles = values["--profile"];
|
|
58
|
+
if (files.length === 0)
|
|
87
59
|
return validateError("Expected exactly one --file target.");
|
|
88
|
-
|
|
89
|
-
if (filePaths.length > 1) {
|
|
60
|
+
if (files.length > 1)
|
|
90
61
|
return validateError("Expected one Markdown file target, received multiple.");
|
|
91
|
-
|
|
92
|
-
if (profilePaths.length === 0) {
|
|
62
|
+
if (profiles.length === 0)
|
|
93
63
|
return validateError("Expected exactly one --profile target.");
|
|
94
|
-
|
|
95
|
-
if (profilePaths.length > 1) {
|
|
64
|
+
if (profiles.length > 1)
|
|
96
65
|
return validateError("Expected one profile file target, received multiple.");
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
if (filePath === undefined || filePath.trim() === "") {
|
|
66
|
+
const filePath = files[0];
|
|
67
|
+
const profilePath = profiles[0];
|
|
68
|
+
if (filePath.trim() === "")
|
|
101
69
|
return validateError("File path cannot be empty.");
|
|
102
|
-
|
|
103
|
-
if (profilePath === undefined || profilePath.trim() === "") {
|
|
70
|
+
if (profilePath.trim() === "")
|
|
104
71
|
return validateError("Profile path cannot be empty.");
|
|
72
|
+
const output = (values["--output"][0] ?? "summary");
|
|
73
|
+
const reportFile = values["--report-file"][0];
|
|
74
|
+
if (reportFile !== undefined && reportFile.trim() === "") {
|
|
75
|
+
return validateError("Report file path cannot be empty.");
|
|
105
76
|
}
|
|
106
77
|
return {
|
|
107
|
-
kind: "validate",
|
|
108
|
-
|
|
109
|
-
format: format ?? "json",
|
|
110
|
-
profilePath,
|
|
78
|
+
kind: "validate", filePath, profilePath, format: "json", output,
|
|
79
|
+
...(reportFile !== undefined ? { reportFile } : {}),
|
|
111
80
|
};
|
|
112
81
|
}
|
|
113
|
-
function readRequiredFlagValue(arg, args, index) {
|
|
114
|
-
const value = args[index + 1];
|
|
115
|
-
if (value === undefined || value.startsWith("-")) {
|
|
116
|
-
return { kind: "error", message: `Missing value for ${arg}.` };
|
|
117
|
-
}
|
|
118
|
-
return { kind: "ok", value };
|
|
119
|
-
}
|
|
120
|
-
function parseDeclarativeOutputFormat(value) {
|
|
121
|
-
return value === "json"
|
|
122
|
-
? { kind: "ok", format: value }
|
|
123
|
-
: {
|
|
124
|
-
kind: "error",
|
|
125
|
-
message: `Unsupported validation output format: ${value}.`,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
82
|
function validateError(message) {
|
|
129
83
|
return { kind: "error", message, usage: validateCliUsage };
|
|
130
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-args.js","sourceRoot":"","sources":["../../src/cli/validate-args.ts"],"names":[],"mappings":"
|
|
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,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC;QACzB,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,QAAQ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ACzD,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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DeclarativeValidationCliJsonResult } from "../declarative-validation/results/index.js";
|
|
2
|
+
export interface ValidationOutputOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
output?: "full" | "summary";
|
|
5
|
+
reportFile?: string;
|
|
6
|
+
}
|
|
7
|
+
export type ValidationOutputResult = {
|
|
8
|
+
kind: "output";
|
|
9
|
+
exitCode: 0 | 1;
|
|
10
|
+
output: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "fileError";
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function outputValidationResult(result: DeclarativeValidationCliJsonResult, exitCode: 0 | 1, options: ValidationOutputOptions): Promise<ValidationOutputResult>;
|
|
16
|
+
//# sourceMappingURL=validation-output.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { normalizeStableJsonValue } from "../internal/stable-json.js";
|
|
2
|
+
import { saveAutomaticValidationReport } from "./validation-report-cache.js";
|
|
3
|
+
import { saveValidationReport } from "./validation-report.js";
|
|
4
|
+
import { createValidationSummary } from "./validation-summary.js";
|
|
5
|
+
export async function outputValidationResult(result, exitCode, options) {
|
|
6
|
+
const output = JSON.stringify(normalizeStableJsonValue(result), null, 2) ?? "null";
|
|
7
|
+
const summary = (options.output ?? "summary") === "summary";
|
|
8
|
+
try {
|
|
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) {
|
|
13
|
+
return {
|
|
14
|
+
kind: "output", exitCode,
|
|
15
|
+
output: JSON.stringify(normalizeStableJsonValue(createValidationSummary(result, exitCode, report))),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return { kind: "output", exitCode, output };
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
kind: "fileError",
|
|
23
|
+
message: `Unable to save validation report "${options.reportFile ?? "automatic cache"}": ${error instanceof Error ? error.message : String(error)}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=validation-output.js.map
|
|
@@ -0,0 +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,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"}
|