spec-controller 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cli-balance/cli.d.ts +87 -0
- package/dist/cli-balance/cli.d.ts.map +1 -0
- package/dist/cli-balance/cli.js +486 -0
- package/dist/cli-balance/cli.js.map +1 -0
- package/dist/cli-balance/emit/format.d.ts +60 -0
- package/dist/cli-balance/emit/format.d.ts.map +1 -0
- package/dist/cli-balance/emit/format.js +90 -0
- package/dist/cli-balance/emit/format.js.map +1 -0
- package/dist/cli-balance/emit/writer.d.ts +45 -0
- package/dist/cli-balance/emit/writer.d.ts.map +1 -0
- package/dist/cli-balance/emit/writer.js +48 -0
- package/dist/cli-balance/emit/writer.js.map +1 -0
- package/dist/cli-registry.d.ts +68 -0
- package/dist/cli-registry.d.ts.map +1 -0
- package/dist/cli-registry.js +181 -0
- package/dist/cli-registry.js.map +1 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +82 -0
- package/dist/cli.js.map +1 -0
- package/dist/deferralTags.d.ts +16 -0
- package/dist/deferralTags.d.ts.map +1 -0
- package/dist/deferralTags.js +22 -0
- package/dist/deferralTags.js.map +1 -0
- package/dist/host.d.ts +50 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +69 -0
- package/dist/host.js.map +1 -0
- package/dist/ingest/ciSourcePaths.d.ts +46 -0
- package/dist/ingest/ciSourcePaths.d.ts.map +1 -0
- package/dist/ingest/ciSourcePaths.js +58 -0
- package/dist/ingest/ciSourcePaths.js.map +1 -0
- package/dist/ingest/gherkinValidation.d.ts +70 -0
- package/dist/ingest/gherkinValidation.d.ts.map +1 -0
- package/dist/ingest/gherkinValidation.js +85 -0
- package/dist/ingest/gherkinValidation.js.map +1 -0
- package/dist/ingest/ingestQualityChecks.d.ts +119 -0
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -0
- package/dist/ingest/ingestQualityChecks.js +331 -0
- package/dist/ingest/ingestQualityChecks.js.map +1 -0
- package/dist/ingest/ingestScenarios.d.ts +52 -0
- package/dist/ingest/ingestScenarios.d.ts.map +1 -0
- package/dist/ingest/ingestScenarios.js +119 -0
- package/dist/ingest/ingestScenarios.js.map +1 -0
- package/dist/mutation-ratchet/index.d.ts +48 -0
- package/dist/mutation-ratchet/index.d.ts.map +1 -0
- package/dist/mutation-ratchet/index.js +48 -0
- package/dist/mutation-ratchet/index.js.map +1 -0
- package/dist/mutation-ratchet/ratchet.d.ts +129 -0
- package/dist/mutation-ratchet/ratchet.d.ts.map +1 -0
- package/dist/mutation-ratchet/ratchet.js +222 -0
- package/dist/mutation-ratchet/ratchet.js.map +1 -0
- package/dist/mutation-ratchet/ratchetCli.d.ts +57 -0
- package/dist/mutation-ratchet/ratchetCli.d.ts.map +1 -0
- package/dist/mutation-ratchet/ratchetCli.js +139 -0
- package/dist/mutation-ratchet/ratchetCli.js.map +1 -0
- package/dist/mutation-ratchet/reconcile.d.ts +82 -0
- package/dist/mutation-ratchet/reconcile.d.ts.map +1 -0
- package/dist/mutation-ratchet/reconcile.js +67 -0
- package/dist/mutation-ratchet/reconcile.js.map +1 -0
- package/dist/mutation-ratchet/record.d.ts +210 -0
- package/dist/mutation-ratchet/record.d.ts.map +1 -0
- package/dist/mutation-ratchet/record.js +330 -0
- package/dist/mutation-ratchet/record.js.map +1 -0
- package/dist/mutation-ratchet/report.d.ts +83 -0
- package/dist/mutation-ratchet/report.d.ts.map +1 -0
- package/dist/mutation-ratchet/report.js +148 -0
- package/dist/mutation-ratchet/report.js.map +1 -0
- package/dist/mutation-ratchet/verdict.d.ts +177 -0
- package/dist/mutation-ratchet/verdict.d.ts.map +1 -0
- package/dist/mutation-ratchet/verdict.js +387 -0
- package/dist/mutation-ratchet/verdict.js.map +1 -0
- package/dist/run-management/keptRun.d.ts +156 -0
- package/dist/run-management/keptRun.d.ts.map +1 -0
- package/dist/run-management/keptRun.js +133 -0
- package/dist/run-management/keptRun.js.map +1 -0
- package/dist/run-management/resolveRunInputs.d.ts +70 -0
- package/dist/run-management/resolveRunInputs.d.ts.map +1 -0
- package/dist/run-management/resolveRunInputs.js +144 -0
- package/dist/run-management/resolveRunInputs.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single-sourced STARTER set of recognised community deferral tags — bare names
|
|
3
|
+
* (the `@` is tag-line syntax). A scenario whose tag block carries one of these DEFERS
|
|
4
|
+
* every obligation it raises to a Pending Item (scenario-scope). These are the
|
|
5
|
+
* established Cucumber deferral conventions.
|
|
6
|
+
*
|
|
7
|
+
* This is **product policy, not a core-domain invariant** — an evolvable list of tag
|
|
8
|
+
* strings, so it lives in the application layer, NOT on the frozen v1 core barrel
|
|
9
|
+
* (@SCN-API-001). The core `parseScenarios` recognises only the deferral set it is
|
|
10
|
+
* handed (its default is `[]`, a policy-free pure core); the app is the single source
|
|
11
|
+
* of the starter policy and always passes the resolved set (starter ∪ configured) into
|
|
12
|
+
* the parser at the ingest edge. Both `resolveDeferralTags` (the `@SCN-PND-021` config
|
|
13
|
+
* union) and `renderBalanceHelp`'s `--help` listing source this constant.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_DEFERRAL_TAGS: readonly string[];
|
|
16
|
+
//# sourceMappingURL=deferralTags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deferralTags.d.ts","sourceRoot":"","sources":["../src/deferralTags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAMlD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single-sourced STARTER set of recognised community deferral tags — bare names
|
|
3
|
+
* (the `@` is tag-line syntax). A scenario whose tag block carries one of these DEFERS
|
|
4
|
+
* every obligation it raises to a Pending Item (scenario-scope). These are the
|
|
5
|
+
* established Cucumber deferral conventions.
|
|
6
|
+
*
|
|
7
|
+
* This is **product policy, not a core-domain invariant** — an evolvable list of tag
|
|
8
|
+
* strings, so it lives in the application layer, NOT on the frozen v1 core barrel
|
|
9
|
+
* (@SCN-API-001). The core `parseScenarios` recognises only the deferral set it is
|
|
10
|
+
* handed (its default is `[]`, a policy-free pure core); the app is the single source
|
|
11
|
+
* of the starter policy and always passes the resolved set (starter ∪ configured) into
|
|
12
|
+
* the parser at the ingest edge. Both `resolveDeferralTags` (the `@SCN-PND-021` config
|
|
13
|
+
* union) and `renderBalanceHelp`'s `--help` listing source this constant.
|
|
14
|
+
*/
|
|
15
|
+
export const DEFAULT_DEFERRAL_TAGS = [
|
|
16
|
+
"wip",
|
|
17
|
+
"ignore",
|
|
18
|
+
"skip",
|
|
19
|
+
"todo",
|
|
20
|
+
"pending",
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=deferralTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deferralTags.js","sourceRoot":"","sources":["../src/deferralTags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,SAAS;CACV,CAAC"}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host-invocation parse — the pure half of the `spec-controller` command host.
|
|
3
|
+
*
|
|
4
|
+
* The shipped binary is `spec-controller [--store <root>] [--run-id <id>] <command>
|
|
5
|
+
* [command-args]`. `--store` / `--run-id` are CROSS-CUTTING host options recognised
|
|
6
|
+
* ONLY in leading position, before the command: storage applies across balance /
|
|
7
|
+
* analyse / migrate, so it belongs at the host (wrapping any command via the kept-run
|
|
8
|
+
* scaffold), not as a peer command and never as a flag inside `balance`. This module
|
|
9
|
+
* holds the pure rules the impure dispatcher (`cli.ts`) drives — parsing the leading
|
|
10
|
+
* options, building the wrapped command argv, and peeking the conventional provenance
|
|
11
|
+
* flags — so the whole host contract is `@unit`-testable with no IO.
|
|
12
|
+
*
|
|
13
|
+
* @SCN-RMG-004 — features/run-management.feature.
|
|
14
|
+
*/
|
|
15
|
+
/** A parsed host invocation: leading global options, then the command and its clean args. */
|
|
16
|
+
export interface HostInvocation {
|
|
17
|
+
/** The injected store root from a leading `--store <root>`, or undefined (no store). */
|
|
18
|
+
store?: string;
|
|
19
|
+
/** The mnemonic from a leading `--run-id <id>`, or undefined (→ the timestamp default). */
|
|
20
|
+
runId?: string;
|
|
21
|
+
/** The command token (e.g. "balance"), or undefined when none was given. */
|
|
22
|
+
command?: string;
|
|
23
|
+
/** The command's own args — everything after the command token, verbatim. */
|
|
24
|
+
commandArgs: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse the host argv into its leading global options (`--store`, `--run-id`) and the
|
|
28
|
+
* command + its clean args. Global options are recognised ONLY before the command: the
|
|
29
|
+
* first token that is not a consumed global option (or its value) is the command, and
|
|
30
|
+
* everything after it is the command's own args, verbatim. So `--store /s balance
|
|
31
|
+
* --features f` yields the store + `balance` + `[--features, f]`, while `balance --store
|
|
32
|
+
* /s` leaves `--store` in the command's args (a `--store` AFTER the command is the
|
|
33
|
+
* command's own arg, never a host store directive) — the "global before command" contract.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseHostInvocation(argv: readonly string[]): HostInvocation;
|
|
36
|
+
/**
|
|
37
|
+
* Build the wrapped command argv: the command's clean args followed by a repeated
|
|
38
|
+
* `--format <spec>` per store-dir output spec. Pure — the impure runner hands the result
|
|
39
|
+
* straight to the command, so the command's OWN writer produces the stored artefacts
|
|
40
|
+
* (byte-identical to a bare `--format` run; no writer duplication).
|
|
41
|
+
*/
|
|
42
|
+
export declare function wrapCommandArgv(commandArgs: readonly string[], formatSpecs: readonly string[]): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Read a `--<name> <value>` flag's value from an arg list WITHOUT consuming it — the host
|
|
45
|
+
* peeks the conventional cross-cutting provenance flags (`--target`, `--features`,
|
|
46
|
+
* `--source-sha`) to name the run dir + stamp run.yaml, while the command still receives
|
|
47
|
+
* them in its own args. Returns undefined when the flag is absent or has no value.
|
|
48
|
+
*/
|
|
49
|
+
export declare function peekFlag(argv: readonly string[], name: string): string | undefined;
|
|
50
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC7B,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAmB3E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAExG;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASlF"}
|
package/dist/host.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host-invocation parse — the pure half of the `spec-controller` command host.
|
|
3
|
+
*
|
|
4
|
+
* The shipped binary is `spec-controller [--store <root>] [--run-id <id>] <command>
|
|
5
|
+
* [command-args]`. `--store` / `--run-id` are CROSS-CUTTING host options recognised
|
|
6
|
+
* ONLY in leading position, before the command: storage applies across balance /
|
|
7
|
+
* analyse / migrate, so it belongs at the host (wrapping any command via the kept-run
|
|
8
|
+
* scaffold), not as a peer command and never as a flag inside `balance`. This module
|
|
9
|
+
* holds the pure rules the impure dispatcher (`cli.ts`) drives — parsing the leading
|
|
10
|
+
* options, building the wrapped command argv, and peeking the conventional provenance
|
|
11
|
+
* flags — so the whole host contract is `@unit`-testable with no IO.
|
|
12
|
+
*
|
|
13
|
+
* @SCN-RMG-004 — features/run-management.feature.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Parse the host argv into its leading global options (`--store`, `--run-id`) and the
|
|
17
|
+
* command + its clean args. Global options are recognised ONLY before the command: the
|
|
18
|
+
* first token that is not a consumed global option (or its value) is the command, and
|
|
19
|
+
* everything after it is the command's own args, verbatim. So `--store /s balance
|
|
20
|
+
* --features f` yields the store + `balance` + `[--features, f]`, while `balance --store
|
|
21
|
+
* /s` leaves `--store` in the command's args (a `--store` AFTER the command is the
|
|
22
|
+
* command's own arg, never a host store directive) — the "global before command" contract.
|
|
23
|
+
*/
|
|
24
|
+
export function parseHostInvocation(argv) {
|
|
25
|
+
let store;
|
|
26
|
+
let runId;
|
|
27
|
+
let i = 0;
|
|
28
|
+
for (; i < argv.length; i++) {
|
|
29
|
+
const token = argv[i];
|
|
30
|
+
if (token === "--store" && i + 1 < argv.length) {
|
|
31
|
+
store = argv[i + 1];
|
|
32
|
+
i++;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (token === "--run-id" && i + 1 < argv.length) {
|
|
36
|
+
runId = argv[i + 1];
|
|
37
|
+
i++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
break; // first non-global-option token is the command
|
|
41
|
+
}
|
|
42
|
+
return { store, runId, command: argv[i], commandArgs: argv.slice(i + 1) };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build the wrapped command argv: the command's clean args followed by a repeated
|
|
46
|
+
* `--format <spec>` per store-dir output spec. Pure — the impure runner hands the result
|
|
47
|
+
* straight to the command, so the command's OWN writer produces the stored artefacts
|
|
48
|
+
* (byte-identical to a bare `--format` run; no writer duplication).
|
|
49
|
+
*/
|
|
50
|
+
export function wrapCommandArgv(commandArgs, formatSpecs) {
|
|
51
|
+
return [...commandArgs, ...formatSpecs.flatMap((spec) => ["--format", spec])];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Read a `--<name> <value>` flag's value from an arg list WITHOUT consuming it — the host
|
|
55
|
+
* peeks the conventional cross-cutting provenance flags (`--target`, `--features`,
|
|
56
|
+
* `--source-sha`) to name the run dir + stamp run.yaml, while the command still receives
|
|
57
|
+
* them in its own args. Returns undefined when the flag is absent or has no value.
|
|
58
|
+
*/
|
|
59
|
+
export function peekFlag(argv, name) {
|
|
60
|
+
const flag = `--${name}`;
|
|
61
|
+
for (let i = 0; i < argv.length; i++) {
|
|
62
|
+
if (argv[i] === flag) {
|
|
63
|
+
const value = argv[i + 1];
|
|
64
|
+
return value !== undefined && !value.startsWith("--") ? value : undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,IAAI,KAAyB,CAAC;IAC9B,IAAI,KAAyB,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,KAAK,KAAK,SAAS,IAAI,C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CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a CI input to the workflow files it names (@SCN-USG-006, 3F-2497).
|
|
3
|
+
*
|
|
4
|
+
* A target's pipeline is routinely split across files — a nightly sweep, a security
|
|
5
|
+
* scan — and reading one of them scores the rest against the target twice over: a
|
|
6
|
+
* NAMED check enforced elsewhere is called a watermelon it is not, an UNNAMED one
|
|
7
|
+
* never reaches the books at all (3F-2238).
|
|
8
|
+
*
|
|
9
|
+
* THIS IS THE ONLY PLACE THAT KNOWS A CI INPUT CAN BE A DIRECTORY. The core takes
|
|
10
|
+
* anonymous source strings so a second ecosystem can supply its own; teaching it to
|
|
11
|
+
* walk a folder would import a filesystem and one provider's layout into a pure
|
|
12
|
+
* parser and close that seam for good. So the walk lives here, at the edge that
|
|
13
|
+
* already resolved `.github/workflows/ci.yml`, and the edge knows exactly as much
|
|
14
|
+
* about GitHub after this slice as it did before.
|
|
15
|
+
*
|
|
16
|
+
* Pure, with the filesystem injected — the resolution rules are the part worth
|
|
17
|
+
* asserting directly, and a fixture tree can only show one of them going wrong at a
|
|
18
|
+
* time.
|
|
19
|
+
*/
|
|
20
|
+
/** The filesystem reads the resolution needs, injected so the rules stay pure. */
|
|
21
|
+
export interface CiPathReader {
|
|
22
|
+
exists(path: string): boolean;
|
|
23
|
+
isDirectory(path: string): boolean;
|
|
24
|
+
readDir(path: string): string[];
|
|
25
|
+
}
|
|
26
|
+
/** The real filesystem, for the CLI edge. */
|
|
27
|
+
export declare const NODE_CI_PATH_READER: CiPathReader;
|
|
28
|
+
/**
|
|
29
|
+
* The workflow files a CI input names: every workflow in a directory, or the single
|
|
30
|
+
* file itself.
|
|
31
|
+
*
|
|
32
|
+
* Sorted, so two runs over one tree cannot differ and a diff of two reports never
|
|
33
|
+
* turns on `readdir` ordering.
|
|
34
|
+
*
|
|
35
|
+
* A FILE RESOLVES TO ITSELF ALONE. Sweeping its parent directory would silently widen
|
|
36
|
+
* a caller's deliberate scope, which is the promise @SCN-USG-008 pins at the report level.
|
|
37
|
+
*
|
|
38
|
+
* An absent path resolves to nothing — no sources, no commands, every static check
|
|
39
|
+
* read as unenforced. That over-reports gaps and hides none, the same fail-safe
|
|
40
|
+
* direction `ciRunCommands` takes on a document it cannot parse. The HARD error for a
|
|
41
|
+
* path the caller SUPPLIED and that does not exist is @SCN-CLI-002's, raised upstream;
|
|
42
|
+
* reaching here with nothing means the DEFAULT found no workflows, which is a fact
|
|
43
|
+
* about the target rather than a mistake by its author.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ciSourcePathsOf(ciPath: string, reader?: CiPathReader): string[];
|
|
46
|
+
//# sourceMappingURL=ciSourcePaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ciSourcePaths.d.ts","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjC;AAED,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,EAAE,YAIjC,CAAC;AAKF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,YAAkC,GACzC,MAAM,EAAE,CAQV"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a CI input to the workflow files it names (@SCN-USG-006, 3F-2497).
|
|
3
|
+
*
|
|
4
|
+
* A target's pipeline is routinely split across files — a nightly sweep, a security
|
|
5
|
+
* scan — and reading one of them scores the rest against the target twice over: a
|
|
6
|
+
* NAMED check enforced elsewhere is called a watermelon it is not, an UNNAMED one
|
|
7
|
+
* never reaches the books at all (3F-2238).
|
|
8
|
+
*
|
|
9
|
+
* THIS IS THE ONLY PLACE THAT KNOWS A CI INPUT CAN BE A DIRECTORY. The core takes
|
|
10
|
+
* anonymous source strings so a second ecosystem can supply its own; teaching it to
|
|
11
|
+
* walk a folder would import a filesystem and one provider's layout into a pure
|
|
12
|
+
* parser and close that seam for good. So the walk lives here, at the edge that
|
|
13
|
+
* already resolved `.github/workflows/ci.yml`, and the edge knows exactly as much
|
|
14
|
+
* about GitHub after this slice as it did before.
|
|
15
|
+
*
|
|
16
|
+
* Pure, with the filesystem injected — the resolution rules are the part worth
|
|
17
|
+
* asserting directly, and a fixture tree can only show one of them going wrong at a
|
|
18
|
+
* time.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
/** The real filesystem, for the CLI edge. */
|
|
23
|
+
export const NODE_CI_PATH_READER = {
|
|
24
|
+
exists: existsSync,
|
|
25
|
+
isDirectory: (path) => statSync(path).isDirectory(),
|
|
26
|
+
readDir: readdirSync,
|
|
27
|
+
};
|
|
28
|
+
/** Both YAML spellings: a target picks one, and the tool does not get to mind which. */
|
|
29
|
+
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
30
|
+
/**
|
|
31
|
+
* The workflow files a CI input names: every workflow in a directory, or the single
|
|
32
|
+
* file itself.
|
|
33
|
+
*
|
|
34
|
+
* Sorted, so two runs over one tree cannot differ and a diff of two reports never
|
|
35
|
+
* turns on `readdir` ordering.
|
|
36
|
+
*
|
|
37
|
+
* A FILE RESOLVES TO ITSELF ALONE. Sweeping its parent directory would silently widen
|
|
38
|
+
* a caller's deliberate scope, which is the promise @SCN-USG-008 pins at the report level.
|
|
39
|
+
*
|
|
40
|
+
* An absent path resolves to nothing — no sources, no commands, every static check
|
|
41
|
+
* read as unenforced. That over-reports gaps and hides none, the same fail-safe
|
|
42
|
+
* direction `ciRunCommands` takes on a document it cannot parse. The HARD error for a
|
|
43
|
+
* path the caller SUPPLIED and that does not exist is @SCN-CLI-002's, raised upstream;
|
|
44
|
+
* reaching here with nothing means the DEFAULT found no workflows, which is a fact
|
|
45
|
+
* about the target rather than a mistake by its author.
|
|
46
|
+
*/
|
|
47
|
+
export function ciSourcePathsOf(ciPath, reader = NODE_CI_PATH_READER) {
|
|
48
|
+
if (!reader.exists(ciPath))
|
|
49
|
+
return [];
|
|
50
|
+
if (!reader.isDirectory(ciPath))
|
|
51
|
+
return [ciPath];
|
|
52
|
+
return reader
|
|
53
|
+
.readDir(ciPath)
|
|
54
|
+
.filter((name) => WORKFLOW_EXTENSIONS.some((ext) => name.endsWith(ext)))
|
|
55
|
+
.sort()
|
|
56
|
+
.map((name) => join(ciPath, name));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=ciSourcePaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ciSourcePaths.js","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASjC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,MAAM,EAAE,UAAU;IAClB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IACnD,OAAO,EAAE,WAAW;CACrB,CAAC;AAEF,wFAAwF;AACxF,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAc,EACd,SAAuB,mBAAmB;IAE1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,MAAM;SACV,OAAO,CAAC,MAAM,CAAC;SACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;SACvE,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Gherkin VALIDATOR — the feature corpus's integrity checkpoint (@SCN-CLI-016, 3F-1767).
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. The feature corpus is the ledger's DEBIT side, and it was read by a
|
|
5
|
+
* hand-rolled TAG-LINE SCAN (`parseScenarios`) that never looked for a `Scenario:` header at
|
|
6
|
+
* all: a scenario EXISTED purely because an `@SCN-FFF-NNN` tag line did. So a
|
|
7
|
+
* malformed tag line simply STOPPED BEING A TAG LINE, and its scenario ceased to exist —
|
|
8
|
+
* silently. One stray character, in a file cucumber itself rejects, deleted a failing row and
|
|
9
|
+
* turned an out-of-balance run (exit 1) into a clean BALANCED (exit 0). A dropped scenario
|
|
10
|
+
* cannot even reconcile `missing`, because it was never raised to be missing: the run reads
|
|
11
|
+
* CLEANER THAN REALITY. That is the false-green this tool exists to prevent, aimed at itself.
|
|
12
|
+
*
|
|
13
|
+
* THE FIX (this slice). VALIDATE every feature file with the REAL Gherkin parser — the same one
|
|
14
|
+
* cucumber uses. A file the parser rejects is an input the tool CANNOT READ, and the CLI refuses
|
|
15
|
+
* it: exit 2, halting before reconciling (@SCN-CLI-014/015's Rule — "an input the tool cannot read
|
|
16
|
+
* is a usage error, never a verdict" — extended from the OBSERVATION side to the OBLIGATION side).
|
|
17
|
+
*
|
|
18
|
+
* VALIDATION IS HALF THE STORY. This decides whether a feature file can be READ at all; the corpus
|
|
19
|
+
* is then EXTRACTED from the same real AST by `parseScenarios` (@SCN-LDG-020, 3F-1775), so the
|
|
20
|
+
* scenarios spec-controller reconciles carry exactly the tags cucumber gives them — Feature/Rule
|
|
21
|
+
* tag inheritance included. One reading of the file, not two.
|
|
22
|
+
*
|
|
23
|
+
* PURE: `string → parse errors`. No fs, no process — the file READ lives beside it at the ingest
|
|
24
|
+
* edge, as it does for every other input.
|
|
25
|
+
*
|
|
26
|
+
* WHY IT LIVES IN THE APP, NOT CORE. Core's barrel is the FROZEN v1 contract surface, guarded
|
|
27
|
+
* both directions by @SCN-API-001 — a symbol added there reds CI. This validator is an INGEST
|
|
28
|
+
* concern (it decides whether an input can be read at all), not part of the reconciliation
|
|
29
|
+
* contract downstream consumers build on, so it belongs with the other readers at the app edge
|
|
30
|
+
* and the frozen surface stays untouched.
|
|
31
|
+
*/
|
|
32
|
+
/** A Gherkin parse failure: the file could not be read as Gherkin at all. */
|
|
33
|
+
export interface GherkinParseError {
|
|
34
|
+
/** The offending file, as supplied (the operator's locator — what to go and fix). */
|
|
35
|
+
file: string;
|
|
36
|
+
/** The parser's own message, verbatim — WHAT broke, in the parser's words. */
|
|
37
|
+
message: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate one `.feature` source with the real Gherkin parser. Returns the parse errors it
|
|
41
|
+
* reports — empty when the file is well-formed Gherkin.
|
|
42
|
+
*
|
|
43
|
+
* The parser is authoritative BY CONSTRUCTION: it is cucumber's own. A file it rejects is one
|
|
44
|
+
* cucumber would refuse to RUN, so a scenario corpus built from it would be a FICTION — which is
|
|
45
|
+
* precisely how a corrupt spec used to read balanced.
|
|
46
|
+
*
|
|
47
|
+
* A parse failure is reported, never thrown: the CLI edge routes it to stderr + exit 2 (the
|
|
48
|
+
* shared typed-error surface), so it can never reach Node's default exit 1 and masquerade as an
|
|
49
|
+
* out-of-balance verdict (@SCN-CLI-014's collision, on the obligation side).
|
|
50
|
+
*
|
|
51
|
+
* @SCN-CLI-016 (3F-1773).
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseErrorsIn(file: string, source: string): GherkinParseError[];
|
|
54
|
+
/**
|
|
55
|
+
* The corpus-level REFUSAL (@SCN-GPG-001, 3F-2817). A parse failure is reported per file by
|
|
56
|
+
* `parseErrorsIn` above; this is how a reader of the WHOLE corpus says no.
|
|
57
|
+
*
|
|
58
|
+
* WHY IT CARRIES EVERY FILE. The balance CLI already names every unparseable file it found
|
|
59
|
+
* (@SCN-CLI-016), and a refusal raised at the first bad one would silently narrow that message —
|
|
60
|
+
* a behaviour change dressed as an implementation detail. So the discovery collects the corpus
|
|
61
|
+
* and refuses ONCE, carrying the lot in discovery order.
|
|
62
|
+
*
|
|
63
|
+
* The rendered message is the parser's words, per file, verbatim: a reader must be told WHAT
|
|
64
|
+
* broke by the parser rather than by our paraphrase of it.
|
|
65
|
+
*/
|
|
66
|
+
export declare class UnreadableFeatureCorpusError extends Error {
|
|
67
|
+
readonly errors: readonly GherkinParseError[];
|
|
68
|
+
constructor(errors: readonly GherkinParseError[]);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=gherkinValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gherkinValidation.d.ts","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAa/E;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;gBAElC,MAAM,EAAE,SAAS,iBAAiB,EAAE;CAUjD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Gherkin VALIDATOR — the feature corpus's integrity checkpoint (@SCN-CLI-016, 3F-1767).
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS. The feature corpus is the ledger's DEBIT side, and it was read by a
|
|
5
|
+
* hand-rolled TAG-LINE SCAN (`parseScenarios`) that never looked for a `Scenario:` header at
|
|
6
|
+
* all: a scenario EXISTED purely because an `@SCN-FFF-NNN` tag line did. So a
|
|
7
|
+
* malformed tag line simply STOPPED BEING A TAG LINE, and its scenario ceased to exist —
|
|
8
|
+
* silently. One stray character, in a file cucumber itself rejects, deleted a failing row and
|
|
9
|
+
* turned an out-of-balance run (exit 1) into a clean BALANCED (exit 0). A dropped scenario
|
|
10
|
+
* cannot even reconcile `missing`, because it was never raised to be missing: the run reads
|
|
11
|
+
* CLEANER THAN REALITY. That is the false-green this tool exists to prevent, aimed at itself.
|
|
12
|
+
*
|
|
13
|
+
* THE FIX (this slice). VALIDATE every feature file with the REAL Gherkin parser — the same one
|
|
14
|
+
* cucumber uses. A file the parser rejects is an input the tool CANNOT READ, and the CLI refuses
|
|
15
|
+
* it: exit 2, halting before reconciling (@SCN-CLI-014/015's Rule — "an input the tool cannot read
|
|
16
|
+
* is a usage error, never a verdict" — extended from the OBSERVATION side to the OBLIGATION side).
|
|
17
|
+
*
|
|
18
|
+
* VALIDATION IS HALF THE STORY. This decides whether a feature file can be READ at all; the corpus
|
|
19
|
+
* is then EXTRACTED from the same real AST by `parseScenarios` (@SCN-LDG-020, 3F-1775), so the
|
|
20
|
+
* scenarios spec-controller reconciles carry exactly the tags cucumber gives them — Feature/Rule
|
|
21
|
+
* tag inheritance included. One reading of the file, not two.
|
|
22
|
+
*
|
|
23
|
+
* PURE: `string → parse errors`. No fs, no process — the file READ lives beside it at the ingest
|
|
24
|
+
* edge, as it does for every other input.
|
|
25
|
+
*
|
|
26
|
+
* WHY IT LIVES IN THE APP, NOT CORE. Core's barrel is the FROZEN v1 contract surface, guarded
|
|
27
|
+
* both directions by @SCN-API-001 — a symbol added there reds CI. This validator is an INGEST
|
|
28
|
+
* concern (it decides whether an input can be read at all), not part of the reconciliation
|
|
29
|
+
* contract downstream consumers build on, so it belongs with the other readers at the app edge
|
|
30
|
+
* and the frozen surface stays untouched.
|
|
31
|
+
*/
|
|
32
|
+
import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
|
|
33
|
+
import { IdGenerator } from "@cucumber/messages";
|
|
34
|
+
/**
|
|
35
|
+
* Validate one `.feature` source with the real Gherkin parser. Returns the parse errors it
|
|
36
|
+
* reports — empty when the file is well-formed Gherkin.
|
|
37
|
+
*
|
|
38
|
+
* The parser is authoritative BY CONSTRUCTION: it is cucumber's own. A file it rejects is one
|
|
39
|
+
* cucumber would refuse to RUN, so a scenario corpus built from it would be a FICTION — which is
|
|
40
|
+
* precisely how a corrupt spec used to read balanced.
|
|
41
|
+
*
|
|
42
|
+
* A parse failure is reported, never thrown: the CLI edge routes it to stderr + exit 2 (the
|
|
43
|
+
* shared typed-error surface), so it can never reach Node's default exit 1 and masquerade as an
|
|
44
|
+
* out-of-balance verdict (@SCN-CLI-014's collision, on the obligation side).
|
|
45
|
+
*
|
|
46
|
+
* @SCN-CLI-016 (3F-1773).
|
|
47
|
+
*/
|
|
48
|
+
export function parseErrorsIn(file, source) {
|
|
49
|
+
const parser = new Parser(new AstBuilder(IdGenerator.uuid()), new GherkinClassicTokenMatcher());
|
|
50
|
+
try {
|
|
51
|
+
parser.parse(source);
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
// The parser raises a CompositeParserException carrying every error it found; its message
|
|
56
|
+
// is the operator's actionable payload (line, column, and what it expected). Reported
|
|
57
|
+
// verbatim — the tool must not paraphrase the parser and risk describing a fault wrongly.
|
|
58
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
59
|
+
return [{ file, message }];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The corpus-level REFUSAL (@SCN-GPG-001, 3F-2817). A parse failure is reported per file by
|
|
64
|
+
* `parseErrorsIn` above; this is how a reader of the WHOLE corpus says no.
|
|
65
|
+
*
|
|
66
|
+
* WHY IT CARRIES EVERY FILE. The balance CLI already names every unparseable file it found
|
|
67
|
+
* (@SCN-CLI-016), and a refusal raised at the first bad one would silently narrow that message —
|
|
68
|
+
* a behaviour change dressed as an implementation detail. So the discovery collects the corpus
|
|
69
|
+
* and refuses ONCE, carrying the lot in discovery order.
|
|
70
|
+
*
|
|
71
|
+
* The rendered message is the parser's words, per file, verbatim: a reader must be told WHAT
|
|
72
|
+
* broke by the parser rather than by our paraphrase of it.
|
|
73
|
+
*/
|
|
74
|
+
export class UnreadableFeatureCorpusError extends Error {
|
|
75
|
+
errors;
|
|
76
|
+
constructor(errors) {
|
|
77
|
+
super([
|
|
78
|
+
"The feature corpus contains a file that could not be parsed as Gherkin:",
|
|
79
|
+
...errors.map(({ file, message }) => `${file}\n${message}`),
|
|
80
|
+
].join("\n"));
|
|
81
|
+
this.name = "UnreadableFeatureCorpusError";
|
|
82
|
+
this.errors = errors;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=gherkinValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gherkinValidation.js","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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inputs — the IMPURE reads behind the balance
|
|
3
|
+
* command (split out of the old cli.ts). Reads evidence
|
|
4
|
+
* obligations from the repo's feature files, observed evidence from the Vitest +
|
|
5
|
+
* Cucumber result JSON, and the static-check evidence from the CI config + package.json,
|
|
6
|
+
* turning each into the engine's in-memory model. The orchestration (arg parsing, the
|
|
7
|
+
* output plan/write, main) stays in cli-balance/cli.ts; these are the file reads it calls.
|
|
8
|
+
*
|
|
9
|
+
* Configurable input paths (no adapter registry in v1 — the readers are named, not
|
|
10
|
+
* registered). Missing result files are tolerated: their evidence is simply absent
|
|
11
|
+
* (the scenario reconciles as missing for that level). The static check kind reads
|
|
12
|
+
* `--ci` (a workflow file or a directory of them, default `.github/workflows`) +
|
|
13
|
+
* `package.json` to observe each fitness check the corpus cites.
|
|
14
|
+
*/
|
|
15
|
+
import { type GherkinParseError } from "./gherkinValidation.js";
|
|
16
|
+
import { type EvidenceObligations } from "@3f-consulting/spec-controller-core";
|
|
17
|
+
import type { EvidenceReconciliation } from "@3f-consulting/spec-controller-core";
|
|
18
|
+
/**
|
|
19
|
+
* A reader over ONE resolution pass's records.
|
|
20
|
+
*
|
|
21
|
+
* EACH RECORD IS OPENED ONCE, WHICH IS WHY THIS IS A CLOSURE AND NOT A FUNCTION PER REFERENCE. A
|
|
22
|
+
* manifest may name several gates of one record, and a reader opening it per entry would let two
|
|
23
|
+
* references answer for two different states of the same file — a rewrite landing mid-pass, a gate
|
|
24
|
+
* present for one and gone for the next. One read makes the pass's bars one reading of one record.
|
|
25
|
+
*
|
|
26
|
+
* THE REFUSAL IS REMEMBERED TOO. Cacheing only the successes would re-open an absent or unreadable
|
|
27
|
+
* record per reference, which is the same disagreement by the other door — and the likelier door,
|
|
28
|
+
* since a record being rewritten is unreadable for exactly the window that matters.
|
|
29
|
+
*
|
|
30
|
+
* THE SUBTRACTION IS THE RECORD'S, NOT THIS EDGE'S. `killFloorOf` spends the allowance; an edge
|
|
31
|
+
* computing `detected - slack` itself would be a second place holding a fact about the record.
|
|
32
|
+
*/
|
|
33
|
+
export declare function killFloorReaderFor(root: string): (reference: {
|
|
34
|
+
readonly mutationGate: string;
|
|
35
|
+
readonly recordFile?: string;
|
|
36
|
+
}) => number | null;
|
|
37
|
+
/**
|
|
38
|
+
* The reconciler's resolved input paths — the CLI options threaded to the readers.
|
|
39
|
+
* Every path is optional; a missing result file is tolerated (its evidence is
|
|
40
|
+
* simply absent). `packageJson` is the EXTERNALLY-SPECIFIED package.json the static
|
|
41
|
+
* (guard) reader reads `exists` from (the --package-json seam, @SCN-LNT-005):
|
|
42
|
+
* default the tool's own cwd `package.json`; set it to reconcile ANOTHER repo's
|
|
43
|
+
* static checks — required to render the historical watermelon correctly.
|
|
44
|
+
*/
|
|
45
|
+
export interface ReconcileOptions {
|
|
46
|
+
features?: string;
|
|
47
|
+
vitest?: string;
|
|
48
|
+
cucumber?: string;
|
|
49
|
+
ci?: string;
|
|
50
|
+
packageJson?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The measurement artefact (@SCN-CIP-003) — the number each measured check posted, and
|
|
53
|
+
* the credit side of every measured fitness check. Optional like the other result files: absent,
|
|
54
|
+
* it contributes nothing, and each measured obligation it would have answered reads `missing`.
|
|
55
|
+
*/
|
|
56
|
+
measurements?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The feature corpus's INTEGRITY CHECKPOINT (@SCN-CLI-016, 3F-1767) — validate every discovered
|
|
60
|
+
* `.feature` with the REAL Gherkin parser and report the files it cannot read.
|
|
61
|
+
*
|
|
62
|
+
* The feature corpus is the ledger's DEBIT side, and it used to be read by a tag-line scan that
|
|
63
|
+
* never consulted a parser — so a malformed tag line silently deleted its scenario, and a corrupt
|
|
64
|
+
* spec could read BALANCED. A file the parser rejects is one cucumber would refuse to run: the
|
|
65
|
+
* CLI halts on it (exit 2) rather than reconciling a corpus that is a fiction.
|
|
66
|
+
*
|
|
67
|
+
* THIS IS NOW THE CATCH SITE, NOT THE CALL SITE (@SCN-GPG-001, 3F-2817). The validation moved
|
|
68
|
+
* into `discoverFeatures`, which REFUSES an unreadable corpus rather than returning one, so every
|
|
69
|
+
* corpus reader inherits the refusal instead of each restating it. What is left here is the
|
|
70
|
+
* translation back into the list this CLI edge already prints — same files, same order, same
|
|
71
|
+
* verbatim parser messages, so `balance`'s behaviour is unchanged. Anything that is not a corpus
|
|
72
|
+
* refusal is not ours to interpret and rethrows.
|
|
73
|
+
*/
|
|
74
|
+
export declare function featureCorpusParseErrors(featuresDir: string | undefined): GherkinParseError[];
|
|
75
|
+
/**
|
|
76
|
+
* The `@SCN` ids the feature corpus CARRIES MORE THAN ONCE (@SCN-LDG-020's guardrail, 3F-1775).
|
|
77
|
+
*
|
|
78
|
+
* An `@SCN` identifies exactly ONE scenario — that is the whole basis of attributing evidence to
|
|
79
|
+
* it. If two scenarios carry the same id, a test citing it could be proving EITHER, and the tool
|
|
80
|
+
* cannot know which: the corpus is ambiguous, and any verdict over it is a guess.
|
|
81
|
+
*
|
|
82
|
+
* WHY THIS EXISTS. Tag inheritance made this reachable: an `@SCN` hoisted to a `Feature:`/`Rule:`
|
|
83
|
+
* is inherited by every scenario beneath it (cucumber does this, so we do — parity). Left
|
|
84
|
+
* unhandled, ONE passing test then marked EVERY scenario sharing that id `balanced`, including
|
|
85
|
+
* scenarios nothing proves — a BALANCED-WHEN-BROKEN run, exit 0. A new silent false-green,
|
|
86
|
+
* introduced by the very fix that closed the last one.
|
|
87
|
+
*
|
|
88
|
+
* Refused at the edge (exit 2) rather than reconciled, under the Rule already shipped for the
|
|
89
|
+
* observed side and the corrupt corpus (@SCN-CLI-014/015/016): an input the tool cannot read is a
|
|
90
|
+
* usage error, never a verdict. Whether hoisting an `@SCN` is an authoring fault worth a richer
|
|
91
|
+
* diagnostic is the deferred policy question (3F-1774's sibling); refusing to reconcile a corpus we
|
|
92
|
+
* cannot read is not a policy — it is the floor.
|
|
93
|
+
*/
|
|
94
|
+
export declare function featureCorpusDuplicateScnIds(featuresDir: string | undefined): string[];
|
|
95
|
+
/**
|
|
96
|
+
* Read the target's `feature-code → slug` map over the same `discoverFeatures` corpus
|
|
97
|
+
* (@SCN-RPT-006) — each coded feature file's `@<FFF>` header (`featureCode`)
|
|
98
|
+
* mapped to its filename `slug`, the full feature name. This is the mapping
|
|
99
|
+
* `scenariosFromFeatures` discards (it keeps only the parsed scenarios). A sibling read to
|
|
100
|
+
* the balance, threaded to `renderMarkdown` (via `writeOutputs`) as the 5th sibling arg
|
|
101
|
+
* (markdown-only — the by-feature cut is markdown-only, so it is NOT serialised to JSON).
|
|
102
|
+
* Uncoded files (`featureCode === null`) are omitted, so the by-feature emitter falls
|
|
103
|
+
* back to the bare `FFF` for any id whose code no file registers. One-prefix-one-file holds
|
|
104
|
+
* by invariant (`lintFeatureCodes` flags a duplicate code), so the map is unambiguous.
|
|
105
|
+
*/
|
|
106
|
+
export declare function readFeatureNames(featuresDir?: string): Map<string, string>;
|
|
107
|
+
/**
|
|
108
|
+
* Read the scenario-corpus census over the discovered feature files (the same
|
|
109
|
+
* `discoverFeatures` corpus `scenariosFromFeatures` reads): sum the raw @SCN
|
|
110
|
+
* occurrences (`countScnOccurrences`) and the scenario count
|
|
111
|
+
* (`parseScenarios(...).length`) across every file, and build the `EvidenceObligations`
|
|
112
|
+
* sibling (@SCN-RPT-008). Also collects the UNTAGGED scenarios
|
|
113
|
+
* (@SCN-RPT-014) — `parseUntaggedScenarios` per file, each paired with its feature-file
|
|
114
|
+
* locator, sorted by (feature, scenario). Read alongside the balance in `main()` and
|
|
115
|
+
* threaded to the renderers via `writeOutputs`; `runReconcile` stays unchanged.
|
|
116
|
+
*/
|
|
117
|
+
export declare function readEvidenceObligations(features?: string): EvidenceObligations;
|
|
118
|
+
export declare function runReconcile(opts: ReconcileOptions): EvidenceReconciliation;
|
|
119
|
+
//# sourceMappingURL=ingestQualityChecks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingestQualityChecks.d.ts","sourceRoot":"","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