spec-controller 0.1.0-alpha.36 → 0.1.0-alpha.38
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 +7 -3
- package/dist/cli-allocate/cli.d.ts.map +1 -1
- package/dist/cli-allocate/cli.js +17 -5
- package/dist/cli-allocate/cli.js.map +1 -1
- package/dist/cli-allocate/readHistory.d.ts +10 -2
- package/dist/cli-allocate/readHistory.d.ts.map +1 -1
- package/dist/cli-allocate/readHistory.js +45 -6
- package/dist/cli-allocate/readHistory.js.map +1 -1
- package/dist/cli-allocate/readParts.d.ts.map +1 -1
- package/dist/cli-allocate/readParts.js +5 -2
- package/dist/cli-allocate/readParts.js.map +1 -1
- package/dist/cli-allocate/readTree.d.ts +4 -5
- package/dist/cli-allocate/readTree.d.ts.map +1 -1
- package/dist/cli-allocate/readTree.js +75 -32
- package/dist/cli-allocate/readTree.js.map +1 -1
- package/dist/cli-allocate/refStore.d.ts +3 -0
- package/dist/cli-allocate/refStore.d.ts.map +1 -0
- package/dist/cli-allocate/refStore.js +47 -0
- package/dist/cli-allocate/refStore.js.map +1 -0
- package/dist/cli-allocate/unreadable.d.ts +24 -0
- package/dist/cli-allocate/unreadable.d.ts.map +1 -0
- package/dist/cli-allocate/unreadable.js +43 -0
- package/dist/cli-allocate/unreadable.js.map +1 -0
- package/dist/cli-balance/cli.d.ts +3 -2
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +36 -13
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/unreadableInputs.d.ts +35 -0
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -0
- package/dist/cli-balance/unreadableInputs.js +101 -0
- package/dist/cli-balance/unreadableInputs.js.map +1 -0
- package/dist/ingest/ingestQualityChecks.d.ts +25 -8
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +93 -33
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +4 -4
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +21 -8
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +47 -0
- package/dist/ingest/inputShapes.d.ts.map +1 -0
- package/dist/ingest/inputShapes.js +143 -0
- package/dist/ingest/inputShapes.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4DH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAS3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEjE;AAqBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,GAAG,IAAI,CAcf;AAUD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAmBf;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAcf;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAwGlD"}
|
package/dist/cli-balance/cli.js
CHANGED
|
@@ -16,7 +16,8 @@ import { dirname } from "node:path";
|
|
|
16
16
|
import { runReconcile, readEvidenceObligations, readFeatureNames, featureCorpusParseErrors, } from "../ingest/ingestQualityChecks.js";
|
|
17
17
|
import { planOutput } from "./emit/format.js";
|
|
18
18
|
import { writeOutputs } from "./emit/writer.js";
|
|
19
|
-
import { checkReRenderFlags
|
|
19
|
+
import { checkReRenderFlags } from "./reRender.js";
|
|
20
|
+
import { checkInputPaths, checkInputShapes, checkSavedReconciliation, jsonInputsOf, reRenderOrRefusal, } from "./unreadableInputs.js";
|
|
20
21
|
import { statusFor } from "./exitStatus.js";
|
|
21
22
|
import { verdictCode, } from "@3f-consulting/spec-controller-core";
|
|
22
23
|
import { resolveSourceSha, resolveTargetRoot, resolveToolIdentity } from "../run-management/resolveRunInputs.js";
|
|
@@ -125,10 +126,8 @@ export function checkInputsExist(args, exists) {
|
|
|
125
126
|
return null;
|
|
126
127
|
}
|
|
127
128
|
/**
|
|
128
|
-
* The JSON-BEARING input flags — the ones whose content is `JSON.parse`d
|
|
129
|
-
*
|
|
130
|
-
* read as raw TEXT and scanned for `run:` steps — neither is JSON, neither can crash the
|
|
131
|
-
* process, and on garbage both reconcile normally (verified).
|
|
129
|
+
* The JSON-BEARING input flags — the ones whose content is `JSON.parse`d. `--features` and `--ci`
|
|
130
|
+
* are read as Gherkin and YAML files on disk, and whether they can be read is `checkInputPaths`'s.
|
|
132
131
|
*/
|
|
133
132
|
const JSON_INPUT_FLAGS = [
|
|
134
133
|
"vitest", "cucumber", "package-json", "ci-steps",
|
|
@@ -145,26 +144,35 @@ const JSON_INPUT_FLAGS = [
|
|
|
145
144
|
* PURE and `@unit`-testable like its sibling guards: reads the parsed args + an injected
|
|
146
145
|
* `read` fn (no fs), returns the FIRST supplied-but-unparseable `(flag, path, failure)` as
|
|
147
146
|
* a typed error naming all three — routed to stderr + exit 2 by `refuseUnreadableInputs` — else null.
|
|
148
|
-
* An omitted flag is not an error, and
|
|
149
|
-
* check)
|
|
147
|
+
* An omitted flag is not an error, and a file that cannot be read at all (a race after the
|
|
148
|
+
* existence check, a permission refused) is refused as one that could not be read, never as JSON
|
|
149
|
+
* that did not parse.
|
|
150
150
|
*/
|
|
151
151
|
export function checkInputsParse(args, read) {
|
|
152
152
|
for (const flag of JSON_INPUT_FLAGS) {
|
|
153
153
|
const path = args[flag];
|
|
154
154
|
if (path === undefined)
|
|
155
155
|
continue;
|
|
156
|
+
let text;
|
|
156
157
|
try {
|
|
157
|
-
|
|
158
|
+
text = read(path);
|
|
158
159
|
}
|
|
159
160
|
catch (err) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
return `The --${flag} file could not be read: ${path} (${failureOf(err)})`;
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
JSON.parse(text);
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
// Anything that escapes this catch lands on Node's default exit 1 — the collision itself.
|
|
168
|
+
return `The --${flag} report is not valid JSON: ${path} (${failureOf(err)})`;
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
171
|
return null;
|
|
167
172
|
}
|
|
173
|
+
function failureOf(err) {
|
|
174
|
+
return err instanceof Error ? err.message : String(err);
|
|
175
|
+
}
|
|
168
176
|
/**
|
|
169
177
|
* Guard the readability of `--render-from-json` at the CLI edge. The
|
|
170
178
|
* render-from-saved-JSON branch RETURNS before the input guards ever run, so it honoured
|
|
@@ -319,7 +327,13 @@ function renderSavedReport(args) {
|
|
|
319
327
|
const rehydratePath = args["render-from-json"];
|
|
320
328
|
if (rehydratePath === undefined)
|
|
321
329
|
return false;
|
|
322
|
-
const
|
|
330
|
+
const savedJson = readFileSync(rehydratePath, "utf8");
|
|
331
|
+
const notSavedError = checkSavedReconciliation(rehydratePath, savedJson);
|
|
332
|
+
if (notSavedError)
|
|
333
|
+
exitUsage(notSavedError);
|
|
334
|
+
const saved = reRenderOrRefusal(rehydratePath, savedJson, args["strict"] !== undefined);
|
|
335
|
+
if (typeof saved === "string")
|
|
336
|
+
exitUsage(saved);
|
|
323
337
|
process.stdout.write(saved.markdown + "\n");
|
|
324
338
|
const code = statusFor(saved.code, args["exit-zero"] !== undefined);
|
|
325
339
|
if (code !== 0)
|
|
@@ -351,6 +365,15 @@ function refuseUnreadableInputs(args) {
|
|
|
351
365
|
const unparseableInputError = checkInputsParse(args, (path) => readFileSync(path, "utf8"));
|
|
352
366
|
if (unparseableInputError)
|
|
353
367
|
exitUsage(unparseableInputError);
|
|
368
|
+
// A corpus or workflow path that is not the kind its flag reads, or may not be read, cannot be read at all.
|
|
369
|
+
const unreadablePathError = checkInputPaths(args);
|
|
370
|
+
if (unreadablePathError)
|
|
371
|
+
exitUsage(unreadablePathError);
|
|
372
|
+
// Parsing is not reading: a report that parses but is not in the shape its reader expects would
|
|
373
|
+
// be read as nothing, or read until it threw, so it is refused here with where its shape is wrong.
|
|
374
|
+
const misshapenInputError = checkInputShapes(jsonInputsOf(args, existsSync), (path) => readFileSync(path, "utf8"));
|
|
375
|
+
if (misshapenInputError)
|
|
376
|
+
exitUsage(misshapenInputError);
|
|
354
377
|
// The FEATURE-CORPUS integrity checkpoint. The feature corpus is an
|
|
355
378
|
// input too — the ledger's DEBIT side — and it was read by a hand-rolled TAG-LINE SCAN that
|
|
356
379
|
// never consulted a parser. So a malformed tag line simply stopped being a tag line and its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SA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CAAC,QAAQ,EAAE,CAAC;QACtD,2DAA2D;QAC3D,sFAAsF;QACtF,oFAAoF;QACpF,yBAAyB;QACzB,GAAG,mBAAmB,EAAE;QACxB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS;KACrC,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,mFAAmF;AACnF,mEAAmE;AACnE,MAAM,eAAe,GACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,eAAe;IAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input guards that decide, before anything is reconciled, whether the run can read what it
|
|
3
|
+
* was handed. Each returns the refusal to print or null, and `refuseUnreadableInputs` in ./cli.ts
|
|
4
|
+
* turns a refusal into exit 2: an input the tool cannot read is a usage error, never a verdict.
|
|
5
|
+
*/
|
|
6
|
+
import { type Shape } from "../ingest/inputShapes.js";
|
|
7
|
+
import { type ReRendered } from "./reRender.js";
|
|
8
|
+
/** One JSON input the run will read: how a refusal names it, where it is, and the shape it must have. */
|
|
9
|
+
export interface JsonInput {
|
|
10
|
+
readonly subject: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly shape: Shape;
|
|
13
|
+
readonly writer: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The JSON inputs this invocation hands the readers, in flag order: each one given, and the
|
|
17
|
+
* package.json the run reads by default when none is given and there is one to read.
|
|
18
|
+
*/
|
|
19
|
+
export declare function jsonInputsOf(args: Record<string, string>, exists: (path: string) => boolean): JsonInput[];
|
|
20
|
+
/** The first input that cannot be read in the shape its reader expects, as the refusal; else null. */
|
|
21
|
+
export declare function checkInputShapes(inputs: readonly JsonInput[], read: (path: string) => string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The feature corpus or CI workflow path the run cannot read, as the refusal: a path that is not
|
|
24
|
+
* the kind its flag reads, or one the operating system will not let it read. Else null. Both are
|
|
25
|
+
* read here by the same discovery the reconcile reads them by.
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkInputPaths(args: Record<string, string>): string | null;
|
|
28
|
+
/** The saved file given to `--render-from-json`, refused when it is not a saved reconciliation at its top; else null. */
|
|
29
|
+
export declare function checkSavedReconciliation(path: string, savedJson: string): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The re-render of a saved reconciliation, or the refusal naming the file when the renderer cannot
|
|
32
|
+
* read it. The file is this path's only input, so a render that fails is a file the tool cannot read.
|
|
33
|
+
*/
|
|
34
|
+
export declare function reRenderOrRefusal(path: string, savedJson: string, strict: boolean): ReRendered | string;
|
|
35
|
+
//# sourceMappingURL=unreadableInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadableInputs.d.ts","sourceRoot":"","sources":["../../src/cli-balance/unreadableInputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAOL,KAAK,KAAK,EACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE1D,yGAAyG;AACzG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAgBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,EAAE,CASzG;AAwBD,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5G;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAQ3E;AAED,yHAAyH;AACzH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,CAMvG"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input guards that decide, before anything is reconciled, whether the run can read what it
|
|
3
|
+
* was handed. Each returns the refusal to print or null, and `refuseUnreadableInputs` in ./cli.ts
|
|
4
|
+
* turns a refusal into exit 2: an input the tool cannot read is a usage error, never a verdict.
|
|
5
|
+
*/
|
|
6
|
+
import { ciReadFault, corpusReadFault, DEFAULT_PACKAGE_JSON, } from "../ingest/ingestQualityChecks.js";
|
|
7
|
+
import { CI_STEP_RECORD, CUCUMBER_REPORT, PACKAGE_MANIFEST, SAVED_RECONCILIATION, shapeFaultIn, VITEST_REPORT, } from "../ingest/inputShapes.js";
|
|
8
|
+
import { reRender } from "./reRender.js";
|
|
9
|
+
/** Each JSON-bearing flag whose reader expects a shape, keyed by the flag without its dashes. */
|
|
10
|
+
const READ_SHAPES = {
|
|
11
|
+
vitest: { noun: "report", writer: "the Vitest JSON reporter writes", shape: VITEST_REPORT },
|
|
12
|
+
cucumber: { noun: "report", writer: "the Cucumber JSON formatter writes", shape: CUCUMBER_REPORT },
|
|
13
|
+
"ci-steps": { noun: "record", writer: "of a CI run's record of its steps", shape: CI_STEP_RECORD },
|
|
14
|
+
"package-json": { noun: "manifest", writer: "of a package.json manifest", shape: PACKAGE_MANIFEST },
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The JSON inputs this invocation hands the readers, in flag order: each one given, and the
|
|
18
|
+
* package.json the run reads by default when none is given and there is one to read.
|
|
19
|
+
*/
|
|
20
|
+
export function jsonInputsOf(args, exists) {
|
|
21
|
+
const given = Object.entries(READ_SHAPES).flatMap(([flag, read]) => {
|
|
22
|
+
const path = args[flag];
|
|
23
|
+
if (path === undefined)
|
|
24
|
+
return [];
|
|
25
|
+
return [{ subject: `The --${flag} ${read.noun}`, path, shape: read.shape, writer: read.writer }];
|
|
26
|
+
});
|
|
27
|
+
if (args["package-json"] !== undefined || !exists(DEFAULT_PACKAGE_JSON))
|
|
28
|
+
return given;
|
|
29
|
+
const { shape, writer } = READ_SHAPES["package-json"];
|
|
30
|
+
return [...given, { subject: "The package.json read by default", path: DEFAULT_PACKAGE_JSON, shape, writer }];
|
|
31
|
+
}
|
|
32
|
+
function reasonOf(err) {
|
|
33
|
+
return err instanceof Error ? err.message : String(err);
|
|
34
|
+
}
|
|
35
|
+
function jsonInputFault(input, read) {
|
|
36
|
+
let text;
|
|
37
|
+
try {
|
|
38
|
+
text = read(input.path);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return `${input.subject} could not be read: ${input.path} (${reasonOf(err)})`;
|
|
42
|
+
}
|
|
43
|
+
let document;
|
|
44
|
+
try {
|
|
45
|
+
document = JSON.parse(text);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
return `${input.subject} is not valid JSON: ${input.path} (${reasonOf(err)})`;
|
|
49
|
+
}
|
|
50
|
+
const fault = shapeFaultIn(document, input.shape);
|
|
51
|
+
if (fault === null)
|
|
52
|
+
return null;
|
|
53
|
+
return `${input.subject} is not in the shape ${input.writer}: ${input.path} (${fault})`;
|
|
54
|
+
}
|
|
55
|
+
/** The first input that cannot be read in the shape its reader expects, as the refusal; else null. */
|
|
56
|
+
export function checkInputShapes(inputs, read) {
|
|
57
|
+
for (const input of inputs) {
|
|
58
|
+
const fault = jsonInputFault(input, read);
|
|
59
|
+
if (fault !== null)
|
|
60
|
+
return fault;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
function pathRefusal(subject, fault) {
|
|
65
|
+
return `${subject} could not be read: ${fault.path} (${fault.reason})`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The feature corpus or CI workflow path the run cannot read, as the refusal: a path that is not
|
|
69
|
+
* the kind its flag reads, or one the operating system will not let it read. Else null. Both are
|
|
70
|
+
* read here by the same discovery the reconcile reads them by.
|
|
71
|
+
*/
|
|
72
|
+
export function checkInputPaths(args) {
|
|
73
|
+
const corpus = corpusReadFault(args["features"]);
|
|
74
|
+
if (corpus !== null) {
|
|
75
|
+
return pathRefusal(args["features"] === undefined ? "The feature corpus read by default" : "The --features corpus", corpus);
|
|
76
|
+
}
|
|
77
|
+
const ci = ciReadFault(args["ci"]);
|
|
78
|
+
if (ci !== null)
|
|
79
|
+
return pathRefusal(args["ci"] === undefined ? "The CI workflows read by default" : "The --ci workflows", ci);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
/** The saved file given to `--render-from-json`, refused when it is not a saved reconciliation at its top; else null. */
|
|
83
|
+
export function checkSavedReconciliation(path, savedJson) {
|
|
84
|
+
const fault = shapeFaultIn(JSON.parse(savedJson), SAVED_RECONCILIATION);
|
|
85
|
+
if (fault === null)
|
|
86
|
+
return null;
|
|
87
|
+
return `The --render-from-json file is not a saved reconciliation: ${path} (${fault})`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The re-render of a saved reconciliation, or the refusal naming the file when the renderer cannot
|
|
91
|
+
* read it. The file is this path's only input, so a render that fails is a file the tool cannot read.
|
|
92
|
+
*/
|
|
93
|
+
export function reRenderOrRefusal(path, savedJson, strict) {
|
|
94
|
+
try {
|
|
95
|
+
return reRender(savedJson, strict);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
return `The --render-from-json file could not be rendered as a saved reconciliation: ${path} (${reasonOf(err)})`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=unreadableInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadableInputs.js","sourceRoot":"","sources":["../../src/cli-balance/unreadableInputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,GAErB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,aAAa,GAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAgB1D,iGAAiG;AACjG,MAAM,WAAW,GAAwC;IACvD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,iCAAiC,EAAE,KAAK,EAAE,aAAa,EAAE;IAC3F,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,oCAAoC,EAAE,KAAK,EAAE,eAAe,EAAE;IAClG,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,cAAc,EAAE;IAClG,cAAc,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,4BAA4B,EAAE,KAAK,EAAE,gBAAgB,EAAE;CACpG,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAA4B,EAAE,MAAiC;IAC1F,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAA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EAAE,KAAK,IAAI;QAAE,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAC9H,OAAO,IAAI,CAAC;AACd,CAAC;AAED,yHAAyH;AACzH,MAAM,UAAU,wBAAwB,CAAC,IAAY,EAAE,SAAiB;IACtE,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC;IACxE,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,8DAA8D,IAAI,KAAK,KAAK,GAAG,CAAC;AACzF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,SAAiB,EAAE,MAAe;IAChF,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,gFAAgF,IAAI,KAAK,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;IACnH,CAAC;AACH,CAAC"}
|
|
@@ -19,7 +19,7 @@ import type { EvidenceReconciliation } from "@3f-consulting/spec-controller-core
|
|
|
19
19
|
* The reconciler's resolved input paths — the CLI options threaded to the readers.
|
|
20
20
|
* Every path is optional; a missing result file is tolerated (its evidence is
|
|
21
21
|
* simply absent). `packageJson` is the EXTERNALLY-SPECIFIED package.json the static
|
|
22
|
-
* static-check reader reads `exists` from (the --package-json seam
|
|
22
|
+
* static-check reader reads `exists` from (the --package-json seam):
|
|
23
23
|
* default the tool's own cwd `package.json`; set it to reconcile ANOTHER repo's
|
|
24
24
|
* static checks — required to render the historical watermelon correctly.
|
|
25
25
|
*/
|
|
@@ -30,7 +30,7 @@ export interface ReconcileOptions {
|
|
|
30
30
|
ci?: string;
|
|
31
31
|
packageJson?: string;
|
|
32
32
|
/**
|
|
33
|
-
* The CI RUN'S OWN RECORD of what each of its steps did
|
|
33
|
+
* The CI RUN'S OWN RECORD of what each of its steps did — the credit
|
|
34
34
|
* side of every CONVERTED fitness check, written by the consumer's own pipeline and by neither
|
|
35
35
|
* party to this reconciliation.
|
|
36
36
|
*
|
|
@@ -43,8 +43,12 @@ export interface ReconcileOptions {
|
|
|
43
43
|
*/
|
|
44
44
|
ciSteps?: string;
|
|
45
45
|
}
|
|
46
|
+
/** Where the CI workflows are read from when `--ci` is not given. */
|
|
47
|
+
export declare const DEFAULT_CI_PATH = ".github/workflows";
|
|
48
|
+
/** The target's manifest when `--package-json` is not given: the one in the directory the run is in. */
|
|
49
|
+
export declare const DEFAULT_PACKAGE_JSON = "package.json";
|
|
46
50
|
/**
|
|
47
|
-
* The feature corpus's INTEGRITY CHECKPOINT
|
|
51
|
+
* The feature corpus's INTEGRITY CHECKPOINT — validate every discovered
|
|
48
52
|
* `.feature` with the REAL Gherkin parser and report the files it cannot read.
|
|
49
53
|
*
|
|
50
54
|
* The feature corpus is the ledger's DEBIT side, and it used to be read by a tag-line scan that
|
|
@@ -52,7 +56,7 @@ export interface ReconcileOptions {
|
|
|
52
56
|
* spec could read BALANCED. A file the parser rejects is one cucumber would refuse to run: the
|
|
53
57
|
* CLI halts on it (exit 2) rather than reconciling a corpus that is a fiction.
|
|
54
58
|
*
|
|
55
|
-
* THIS IS NOW THE CATCH SITE, NOT THE CALL SITE
|
|
59
|
+
* THIS IS NOW THE CATCH SITE, NOT THE CALL SITE. The validation moved
|
|
56
60
|
* into `discoverFeatures`, which REFUSES an unreadable corpus rather than returning one, so every
|
|
57
61
|
* corpus reader inherits the refusal instead of each restating it. What is left here is the
|
|
58
62
|
* translation back into the list this CLI edge already prints — same files, same order, same
|
|
@@ -60,9 +64,22 @@ export interface ReconcileOptions {
|
|
|
60
64
|
* refusal is not ours to interpret and rethrows.
|
|
61
65
|
*/
|
|
62
66
|
export declare function featureCorpusParseErrors(featuresDir: string | undefined): GherkinParseError[];
|
|
67
|
+
/** A read of the feature corpus or the CI workflows that the operating system refused. */
|
|
68
|
+
export interface InputReadFault {
|
|
69
|
+
readonly path: string;
|
|
70
|
+
readonly reason: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The read of the feature corpus that failed, taken by the same discovery the reconcile uses, or
|
|
74
|
+
* null when it reads. A file the Gherkin parser rejects is not this fault: it is reported by
|
|
75
|
+
* `featureCorpusParseErrors`, after this.
|
|
76
|
+
*/
|
|
77
|
+
export declare function corpusReadFault(featuresDir: string | undefined): InputReadFault | null;
|
|
78
|
+
/** The read of a CI workflow that failed, over the same files the reconcile reads, or null when they all read. */
|
|
79
|
+
export declare function ciReadFault(ciPath: string | undefined): InputReadFault | null;
|
|
63
80
|
/**
|
|
64
81
|
* Read the target's `feature-code → slug` map over the same `discoverFeatures` corpus
|
|
65
|
-
*
|
|
82
|
+
* — each coded feature file's `@<FFF>` header (`featureCode`)
|
|
66
83
|
* mapped to its filename `slug`, the full feature name. This is the mapping
|
|
67
84
|
* `scenariosFromFeatures` discards (it keeps only the parsed scenarios). A sibling read to
|
|
68
85
|
* the balance, threaded to `renderMarkdown` (via `writeOutputs`) as the 5th sibling arg
|
|
@@ -70,7 +87,7 @@ export declare function featureCorpusParseErrors(featuresDir: string | undefined
|
|
|
70
87
|
* Uncoded files (`featureCode === null`) are omitted, so the by-feature emitter falls
|
|
71
88
|
* back to the bare `FFF` for any id whose code no file registers. When two files carry one
|
|
72
89
|
* code the map keeps the last, and that run lists `duplicate-feature-code` under Scenario code
|
|
73
|
-
* errors and fails
|
|
90
|
+
* errors and fails, so a report whose map is ambiguous never passes.
|
|
74
91
|
*/
|
|
75
92
|
export declare function readFeatureNames(featuresDir?: string): Map<string, string>;
|
|
76
93
|
/**
|
|
@@ -78,8 +95,8 @@ export declare function readFeatureNames(featuresDir?: string): Map<string, stri
|
|
|
78
95
|
* `discoverFeatures` corpus `scenariosFromFeatures` reads): sum the raw @SCN
|
|
79
96
|
* occurrences (`countScnOccurrences`) and the scenario count
|
|
80
97
|
* (`parseScenarios(...).length`) across every file, and build the `EvidenceObligations`
|
|
81
|
-
* sibling
|
|
82
|
-
*
|
|
98
|
+
* sibling. Also collects the UNTAGGED scenarios
|
|
99
|
+
* — `parseUntaggedScenarios` per file, each paired with its feature-file
|
|
83
100
|
* locator, sorted by (feature, scenario). Read alongside the balance in `main()` and
|
|
84
101
|
* threaded to the renderers via `writeOutputs`; `runReconcile` stays unchanged.
|
|
85
102
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingestQualityChecks.d.ts","sourceRoot":"","sources":["../../src/ingest/ingestQualityChecks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAaH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,qCAAqC,CAAC;AAkB7C,OAAO,KAAK,EAIV,sBAAsB,EACvB,MAAM,qCAAqC,CAAC;AA4B7C;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"ingestQualityChecks.d.ts","sourceRoot":"","sources":["../../src/ingest/ingestQualityChecks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAaH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,qCAAqC,CAAC;AAkB7C,OAAO,KAAK,EAIV,sBAA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