spec-controller 0.1.0-alpha.5 → 0.1.0-alpha.50
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 +34 -6
- package/dist/cli-allocate/cli.d.ts +2 -0
- package/dist/cli-allocate/cli.d.ts.map +1 -0
- package/dist/cli-allocate/cli.js +60 -0
- package/dist/cli-allocate/cli.js.map +1 -0
- package/dist/cli-allocate/readHistory.d.ts +15 -0
- package/dist/cli-allocate/readHistory.d.ts.map +1 -0
- package/dist/cli-allocate/readHistory.js +108 -0
- package/dist/cli-allocate/readHistory.js.map +1 -0
- package/dist/cli-allocate/readParts.d.ts +2 -0
- package/dist/cli-allocate/readParts.d.ts.map +1 -0
- package/dist/cli-allocate/readParts.js +22 -0
- package/dist/cli-allocate/readParts.js.map +1 -0
- package/dist/cli-allocate/readTree.d.ts +5 -0
- package/dist/cli-allocate/readTree.d.ts.map +1 -0
- package/dist/cli-allocate/readTree.js +74 -0
- package/dist/cli-allocate/readTree.js.map +1 -0
- package/dist/cli-allocate/refStore.d.ts +2 -0
- package/dist/cli-allocate/refStore.d.ts.map +1 -0
- package/dist/cli-allocate/refStore.js +34 -0
- package/dist/cli-allocate/refStore.js.map +1 -0
- package/dist/cli-allocate/request.d.ts +9 -0
- package/dist/cli-allocate/request.d.ts.map +1 -0
- package/dist/cli-allocate/request.js +22 -0
- package/dist/cli-allocate/request.js.map +1 -0
- package/dist/cli-allocate/stderr.d.ts +7 -0
- package/dist/cli-allocate/stderr.d.ts.map +1 -0
- package/dist/cli-allocate/stderr.js +26 -0
- package/dist/cli-allocate/stderr.js.map +1 -0
- package/dist/cli-allocate/unreadable.d.ts +11 -0
- package/dist/cli-allocate/unreadable.d.ts.map +1 -0
- package/dist/cli-allocate/unreadable.js +30 -0
- package/dist/cli-allocate/unreadable.js.map +1 -0
- package/dist/cli-args.d.ts +12 -70
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +158 -81
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +1 -81
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +71 -357
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +16 -38
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +31 -58
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +2 -32
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +50 -37
- package/dist/cli-balance/emit/writer.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +2 -0
- package/dist/cli-balance/exitStatus.d.ts.map +1 -0
- package/dist/cli-balance/exitStatus.js +5 -0
- package/dist/cli-balance/exitStatus.js.map +1 -0
- package/dist/cli-balance/inputsRead.d.ts +11 -0
- package/dist/cli-balance/inputsRead.d.ts.map +1 -0
- package/dist/cli-balance/inputsRead.js +53 -0
- package/dist/cli-balance/inputsRead.js.map +1 -0
- package/dist/cli-balance/reRender.d.ts +8 -0
- package/dist/cli-balance/reRender.d.ts.map +1 -0
- package/dist/cli-balance/reRender.js +21 -0
- package/dist/cli-balance/reRender.js.map +1 -0
- package/dist/cli-balance/unreadableInputs.d.ts +14 -0
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -0
- package/dist/cli-balance/unreadableInputs.js +80 -0
- package/dist/cli-balance/unreadableInputs.js.map +1 -0
- package/dist/cli-registry.d.ts +12 -70
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +37 -97
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli.d.ts +0 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +62 -55
- package/dist/cli.js.map +1 -1
- package/dist/deferralTags.d.ts +0 -14
- package/dist/deferralTags.d.ts.map +1 -1
- package/dist/deferralTags.js +0 -14
- package/dist/deferralTags.js.map +1 -1
- package/dist/host.d.ts +10 -41
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +103 -50
- package/dist/host.js.map +1 -1
- package/dist/ingest/ciSourcePaths.d.ts +0 -38
- package/dist/ingest/ciSourcePaths.d.ts.map +1 -1
- package/dist/ingest/ciSourcePaths.js +0 -38
- package/dist/ingest/ciSourcePaths.js.map +1 -1
- package/dist/ingest/gherkinValidation.d.ts +0 -80
- package/dist/ingest/gherkinValidation.d.ts.map +1 -1
- package/dist/ingest/gherkinValidation.js +0 -80
- package/dist/ingest/gherkinValidation.js.map +1 -1
- package/dist/ingest/ingestQualityChecks.d.ts +8 -93
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +57 -214
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +0 -45
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +28 -108
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +16 -0
- package/dist/ingest/inputShapes.d.ts.map +1 -0
- package/dist/ingest/inputShapes.js +113 -0
- package/dist/ingest/inputShapes.js.map +1 -0
- package/dist/outputLocation.d.ts +27 -0
- package/dist/outputLocation.d.ts.map +1 -0
- package/dist/outputLocation.js +135 -0
- package/dist/outputLocation.js.map +1 -0
- package/dist/run-management/keptRun.d.ts +5 -105
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +16 -82
- package/dist/run-management/keptRun.js.map +1 -1
- package/dist/run-management/resolveRunInputs.d.ts +0 -67
- package/dist/run-management/resolveRunInputs.d.ts.map +1 -1
- package/dist/run-management/resolveRunInputs.js +0 -88
- package/dist/run-management/resolveRunInputs.js.map +1 -1
- package/dist/storedRun.d.ts +6 -0
- package/dist/storedRun.d.ts.map +1 -0
- package/dist/storedRun.js +28 -0
- package/dist/storedRun.js.map +1 -0
- package/package.json +2 -2
- package/dist/corpus/cli.d.ts +0 -34
- package/dist/corpus/cli.d.ts.map +0 -1
- package/dist/corpus/cli.js +0 -125
- package/dist/corpus/cli.js.map +0 -1
package/dist/host.d.ts
CHANGED
|
@@ -1,50 +1,19 @@
|
|
|
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. */
|
|
1
|
+
import { type CommandSpec, type FlagSpec } from "./cli-registry.js";
|
|
16
2
|
export interface HostInvocation {
|
|
17
|
-
/** The injected store root from a leading `--store <root>`, or undefined (no store). */
|
|
18
3
|
store?: string;
|
|
19
|
-
/** The mnemonic from a leading `--run-id <id>`, or undefined (→ the timestamp default). */
|
|
20
4
|
runId?: string;
|
|
21
|
-
/** The command token (e.g. "balance"), or undefined when none was given. */
|
|
22
5
|
command?: string;
|
|
23
|
-
/** The command's own args — everything after the command token, verbatim. */
|
|
24
6
|
commandArgs: string[];
|
|
7
|
+
refusal?: string;
|
|
25
8
|
}
|
|
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
|
-
*/
|
|
9
|
+
export declare function parseHostInvocation(argv: readonly string[], globalFlags?: readonly FlagSpec[], commands?: readonly string[]): HostInvocation;
|
|
42
10
|
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
11
|
export declare function peekFlag(argv: readonly string[], name: string): string | undefined;
|
|
12
|
+
export interface UnknownCommandAnswer {
|
|
13
|
+
exitCode: number;
|
|
14
|
+
stderr: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function answerUnknownCommand(command: string, help: string): UnknownCommandAnswer;
|
|
17
|
+
export declare function modifiersNotTakenRefusal(inv: HostInvocation, commands?: readonly CommandSpec[]): string | undefined;
|
|
18
|
+
export declare function formatFilePaths(argv: readonly string[]): string[];
|
|
50
19
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjF,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,WAAW,GAAE,SAAS,QAAQ,EAAuB,EACrD,QAAQ,GAAE,SAAS,MAAM,EAAwD,GAChF,cAAc,CAIhB;AAmGD,wBAAgB,eAAe,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAExG;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASlF;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAKxF;AAED,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,cAAc,EACnB,QAAQ,GAAE,SAAS,WAAW,EAAyB,GACtD,MAAM,GAAG,SAAS,CAUpB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CASjE"}
|
package/dist/host.js
CHANGED
|
@@ -1,61 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
1
|
+
import { asksForHelp, equalsFormRefusal, givenTwiceRefusal, isEqualsForm, isMissingValue, missingValueRefusal, valueFlagsOf, } from "./cli-args.js";
|
|
2
|
+
import { cliRegistry } from "./cli-registry.js";
|
|
3
|
+
export function parseHostInvocation(argv, globalFlags = cliRegistry.global, commands = cliRegistry.commands.map((command) => command.name)) {
|
|
4
|
+
const read = readHostTokens(argv, globalFlags, commands);
|
|
5
|
+
const help = argv.slice(0, hostTokenCount(argv, read)).find((token) => TOP_LEVEL_HELP.has(token));
|
|
6
|
+
return help === undefined ? read : { command: help, commandArgs: [] };
|
|
7
|
+
}
|
|
8
|
+
function hostTokenCount(argv, read) {
|
|
9
|
+
if (read.refusal !== undefined || read.command === undefined)
|
|
10
|
+
return argv.length;
|
|
11
|
+
return argv.length - read.commandArgs.length - 1;
|
|
12
|
+
}
|
|
13
|
+
function readHostTokens(argv, globalFlags, commands) {
|
|
14
|
+
const modifiers = valueFlagsOf(globalFlags);
|
|
15
|
+
const values = new Map();
|
|
27
16
|
let i = 0;
|
|
28
17
|
for (; i < argv.length; i++) {
|
|
29
|
-
const token = argv[i];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
const token = argv[i] ?? "";
|
|
19
|
+
const modifier = modifiers.get(token);
|
|
20
|
+
if (modifier === undefined) {
|
|
21
|
+
const refusal = leadingFlagRefusal(token, modifiers, globalFlags);
|
|
22
|
+
if (refusal !== undefined)
|
|
23
|
+
return { commandArgs: [], refusal };
|
|
24
|
+
break;
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
const value = argv[i + 1];
|
|
27
|
+
const refusal = modifierRefusal(token, modifier, argv.slice(i + 1, i + 3), { values, commands });
|
|
28
|
+
if (refusal !== undefined)
|
|
29
|
+
return { commandArgs: [], refusal };
|
|
30
|
+
values.set(modifier.name, value ?? "");
|
|
31
|
+
i++;
|
|
32
|
+
}
|
|
33
|
+
if (i === argv.length && values.size > 0)
|
|
34
|
+
return { commandArgs: [], refusal: noCommandRefusal([...values.keys()]) };
|
|
35
|
+
return {
|
|
36
|
+
store: values.get("--store"),
|
|
37
|
+
runId: values.get("--run-id"),
|
|
38
|
+
command: argv[i],
|
|
39
|
+
commandArgs: argv.slice(i + 1),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function modifierRefusal(token, modifier, [value, after], read) {
|
|
43
|
+
if (read.values.has(modifier.name))
|
|
44
|
+
return givenTwiceRefusal(token, "spec-controller");
|
|
45
|
+
if (isMissingValue(value))
|
|
46
|
+
return missingValueRefusal(token, modifier, "spec-controller");
|
|
47
|
+
if (read.commands.includes(value ?? "") && (after === undefined || after.startsWith("-"))) {
|
|
48
|
+
return commandAsValueRefusal(token, modifier, value ?? "");
|
|
41
49
|
}
|
|
42
|
-
return
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function noCommandRefusal(given) {
|
|
53
|
+
return (`No command followed the host modifiers given (${given.join(", ")}), so nothing ran: ` +
|
|
54
|
+
`a host modifier needs a command after it, or --help.\n` +
|
|
55
|
+
`Run 'spec-controller --help' to see the commands and host modifiers this version accepts.`);
|
|
56
|
+
}
|
|
57
|
+
function commandAsValueRefusal(token, modifier, command) {
|
|
58
|
+
return (`The ${token} host modifier took '${command}', a command, as its value, and left no command to run.\n` +
|
|
59
|
+
`Give ${token} its own value, as in 'spec-controller ${token} ${modifier.arg ?? ""} ${command} …'. ` +
|
|
60
|
+
`Run 'spec-controller --help' to see the commands and host modifiers this version accepts.`);
|
|
61
|
+
}
|
|
62
|
+
function leadingFlagRefusal(token, modifiers, globalFlags) {
|
|
63
|
+
if (isEqualsForm(token))
|
|
64
|
+
return equalsFormRefusal(token, modifiers, "spec-controller");
|
|
65
|
+
if (isFlagOutOfPlace(token))
|
|
66
|
+
return flagBeforeCommandRefusal(token, globalFlags);
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const TOP_LEVEL_HELP = new Set(["--help", "-h"]);
|
|
70
|
+
function isFlagOutOfPlace(token) {
|
|
71
|
+
return token.length > 1 && token.startsWith("-") && !TOP_LEVEL_HELP.has(token);
|
|
72
|
+
}
|
|
73
|
+
function flagBeforeCommandRefusal(flag, globalFlags) {
|
|
74
|
+
const modifiers = globalFlags.map((modifier) => modifier.name).join(", ");
|
|
75
|
+
return (`The ${flag} flag was given before the command. Before the command, spec-controller takes ` +
|
|
76
|
+
`only its host modifiers (${modifiers}); a command's own flags go after it, as in ` +
|
|
77
|
+
`'spec-controller <command> ${flag}'.\n` +
|
|
78
|
+
`Run 'spec-controller --help' to see the commands and host modifiers this version accepts.`);
|
|
43
79
|
}
|
|
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
80
|
export function wrapCommandArgv(commandArgs, formatSpecs) {
|
|
51
81
|
return [...commandArgs, ...formatSpecs.flatMap((spec) => ["--format", spec])];
|
|
52
82
|
}
|
|
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
83
|
export function peekFlag(argv, name) {
|
|
60
84
|
const flag = `--${name}`;
|
|
61
85
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -66,4 +90,33 @@ export function peekFlag(argv, name) {
|
|
|
66
90
|
}
|
|
67
91
|
return undefined;
|
|
68
92
|
}
|
|
93
|
+
export function answerUnknownCommand(command, help) {
|
|
94
|
+
return {
|
|
95
|
+
exitCode: 2,
|
|
96
|
+
stderr: `spec-controller: unknown command "${command}".\n\n${help}\n`,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function modifiersNotTakenRefusal(inv, commands = cliRegistry.commands) {
|
|
100
|
+
const entry = commands.find((command) => command.name === inv.command);
|
|
101
|
+
if (entry?.acceptsHostModifiers !== false || asksForHelp(inv.commandArgs))
|
|
102
|
+
return undefined;
|
|
103
|
+
const given = [inv.store === undefined ? [] : ["--store"], inv.runId === undefined ? [] : ["--run-id"]].flat();
|
|
104
|
+
if (given.length === 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
return (`spec-controller: usage error — '${entry.name}' takes no host modifier, and was given ${given.join(", ")}: ` +
|
|
107
|
+
`it answers a query and keeps no run.\n` +
|
|
108
|
+
`Run 'spec-controller ${entry.name} …' without them.`);
|
|
109
|
+
}
|
|
110
|
+
export function formatFilePaths(argv) {
|
|
111
|
+
const paths = [];
|
|
112
|
+
argv.forEach((token, index) => {
|
|
113
|
+
const value = argv[index + 1];
|
|
114
|
+
if (token !== "--format" || value === undefined)
|
|
115
|
+
return;
|
|
116
|
+
const colon = value.indexOf(":");
|
|
117
|
+
if (colon !== -1)
|
|
118
|
+
paths.push(value.slice(colon + 1));
|
|
119
|
+
});
|
|
120
|
+
return paths;
|
|
121
|
+
}
|
|
69
122
|
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAmC,MAAM,mBAAmB,CAAC;AAUjF,MAAM,UAAU,mBAAmB,CACjC,IAAuB,EACvB,cAAmC,WAAW,CAAC,MAAM,EACrD,WAA8B,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAEjF,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAClG,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACxE,CAAC;AAED,SAAS,cAAc,CAAC,IAAuB,EAAE,IAAoB;IACnE,IAAI,IAA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AK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/G,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,OAAO,CACL,mCAAmC,KAAK,CAAC,IAAI,2CAA2C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QAC5G,wCAAwC;QACxC,wBAAwB,KAAK,CAAC,IAAI,mBAAmB,CACtD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAuB;IACrD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO;QACxD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,46 +1,8 @@
|
|
|
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
1
|
export interface CiPathReader {
|
|
22
2
|
exists(path: string): boolean;
|
|
23
3
|
isDirectory(path: string): boolean;
|
|
24
4
|
readDir(path: string): string[];
|
|
25
5
|
}
|
|
26
|
-
/** The real filesystem, for the CLI edge. */
|
|
27
6
|
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
7
|
export declare function ciSourcePathsOf(ciPath: string, reader?: CiPathReader): string[];
|
|
46
8
|
//# sourceMappingURL=ciSourcePaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciSourcePaths.d.ts","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ciSourcePaths.d.ts","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAGA,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,eAAO,MAAM,mBAAmB,EAAE,YAIjC,CAAC;AAIF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,YAAkC,GACzC,MAAM,EAAE,CAQV"}
|
|
@@ -1,49 +1,11 @@
|
|
|
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
1
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
21
2
|
import { join } from "node:path";
|
|
22
|
-
/** The real filesystem, for the CLI edge. */
|
|
23
3
|
export const NODE_CI_PATH_READER = {
|
|
24
4
|
exists: existsSync,
|
|
25
5
|
isDirectory: (path) => statSync(path).isDirectory(),
|
|
26
6
|
readDir: readdirSync,
|
|
27
7
|
};
|
|
28
|
-
/** Both YAML spellings: a target picks one, and the tool does not get to mind which. */
|
|
29
8
|
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
9
|
export function ciSourcePathsOf(ciPath, reader = NODE_CI_PATH_READER) {
|
|
48
10
|
if (!reader.exists(ciPath))
|
|
49
11
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciSourcePaths.js","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ciSourcePaths.js","sourceRoot":"","sources":["../../src/ingest/ciSourcePaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,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,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,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"}
|
|
@@ -1,93 +1,13 @@
|
|
|
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 v1 contract surface downstream consumers
|
|
27
|
-
* build on. Since 3F-3449 nothing reds when a symbol is added there — the guard that reconciled it
|
|
28
|
-
* both directions is gone — so keeping it narrow is a discipline rather than a gate. This validator
|
|
29
|
-
* is an INGEST concern (it decides whether an input can be read at all), not part of the
|
|
30
|
-
* reconciliation contract, so it belongs with the other readers at the app edge and the v1 surface
|
|
31
|
-
* stays untouched.
|
|
32
|
-
*/
|
|
33
|
-
/** A Gherkin parse failure: the file could not be read as Gherkin at all. */
|
|
34
1
|
export interface GherkinParseError {
|
|
35
|
-
/** The offending file, as supplied (the operator's locator — what to go and fix). */
|
|
36
2
|
file: string;
|
|
37
|
-
/** The parser's own message, verbatim — WHAT broke, in the parser's words. */
|
|
38
3
|
message: string;
|
|
39
4
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Validate one `.feature` source with the real Gherkin parser. Returns the parse errors it
|
|
42
|
-
* reports — empty when the file is well-formed Gherkin.
|
|
43
|
-
*
|
|
44
|
-
* The parser is authoritative BY CONSTRUCTION: it is cucumber's own. A file it rejects is one
|
|
45
|
-
* cucumber would refuse to RUN, so a scenario corpus built from it would be a FICTION — which is
|
|
46
|
-
* precisely how a corrupt spec used to read balanced.
|
|
47
|
-
*
|
|
48
|
-
* A parse failure is reported, never thrown: the CLI edge routes it to stderr + exit 2 (the
|
|
49
|
-
* shared typed-error surface), so it can never reach Node's default exit 1 and masquerade as an
|
|
50
|
-
* out-of-balance verdict (@SCN-CLI-014's collision, on the obligation side).
|
|
51
|
-
*
|
|
52
|
-
* @SCN-CLI-016 (3F-1773).
|
|
53
|
-
*/
|
|
54
5
|
export declare function parseErrorsIn(file: string, source: string): GherkinParseError[];
|
|
55
|
-
/**
|
|
56
|
-
* The corpus-level REFUSAL (@SCN-GPG-001, 3F-2817). A parse failure is reported per file by
|
|
57
|
-
* `parseErrorsIn` above; this is how a reader of the WHOLE corpus says no.
|
|
58
|
-
*
|
|
59
|
-
* WHY IT CARRIES EVERY FILE. The balance CLI already names every unparseable file it found
|
|
60
|
-
* (@SCN-CLI-016), and a refusal raised at the first bad one would silently narrow that message —
|
|
61
|
-
* a behaviour change dressed as an implementation detail. So the discovery collects the corpus
|
|
62
|
-
* and refuses ONCE, carrying the lot in discovery order.
|
|
63
|
-
*
|
|
64
|
-
* The rendered message is the parser's words, per file, verbatim: a reader must be told WHAT
|
|
65
|
-
* broke by the parser rather than by our paraphrase of it.
|
|
66
|
-
*/
|
|
67
6
|
export declare class UnreadableFeatureCorpusError extends Error {
|
|
68
7
|
readonly errors: readonly GherkinParseError[];
|
|
69
8
|
constructor(errors: readonly GherkinParseError[]);
|
|
70
9
|
}
|
|
71
|
-
/**
|
|
72
|
-
* The corpus-level ABSENCE refusal (@SCN-CLI-017, 3F-3345) — sibling to the parse refusal above,
|
|
73
|
-
* and deliberately the same shape: the reader refuses ONCE, and each command decides what the
|
|
74
|
-
* refusal means for it.
|
|
75
|
-
*
|
|
76
|
-
* WHY A TYPED ERROR RATHER THAN AN EMPTY CORPUS. The obvious fix is for `discoverFeatures` to hand
|
|
77
|
-
* back `[]` when the directory is not there. Measured, that would ship a NEW false green in a
|
|
78
|
-
* second command: `spec-controller tags` reaches the same reader through `readCorpusInputs`, whose
|
|
79
|
-
* GENERIC catch is the only thing turning an absent corpus — and, since `tags` carries no
|
|
80
|
-
* `checkInputsExist`, a supplied-but-absent `--features` too — into `The corpus could not be
|
|
81
|
-
* read: …` at exit 2. Tolerance at the reader turns both into `tags: OK …` at exit 0, inside the
|
|
82
|
-
* slice whose whole purpose is killing a vacuous certification. Typed, both survive untouched:
|
|
83
|
-
* this IS an `Error`, so it still lands in that generic catch.
|
|
84
|
-
*
|
|
85
|
-
* IT CARRIES THE DIRECTORY because the report is owed the name of what it examined — "I found no
|
|
86
|
-
* record" and "I found no regression" must never wear one word (3F-2947), and a consumer told
|
|
87
|
-
* their corpus is empty deserves to know which directory was read to reach that.
|
|
88
|
-
*/
|
|
89
10
|
export declare class MissingFeatureCorpusError extends Error {
|
|
90
|
-
/** The directory that is not there — as resolved, so a reader can print the path examined. */
|
|
91
11
|
readonly directory: string;
|
|
92
12
|
constructor(directory: string);
|
|
93
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkinValidation.d.ts","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gherkinValidation.d.ts","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAU/E;AAED,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;gBAElC,MAAM,EAAE,SAAS,iBAAiB,EAAE;CAUjD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAK9B"}
|
|
@@ -1,51 +1,5 @@
|
|
|
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 v1 contract surface downstream consumers
|
|
27
|
-
* build on. Since 3F-3449 nothing reds when a symbol is added there — the guard that reconciled it
|
|
28
|
-
* both directions is gone — so keeping it narrow is a discipline rather than a gate. This validator
|
|
29
|
-
* is an INGEST concern (it decides whether an input can be read at all), not part of the
|
|
30
|
-
* reconciliation contract, so it belongs with the other readers at the app edge and the v1 surface
|
|
31
|
-
* stays untouched.
|
|
32
|
-
*/
|
|
33
1
|
import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
|
|
34
2
|
import { IdGenerator } from "@cucumber/messages";
|
|
35
|
-
/**
|
|
36
|
-
* Validate one `.feature` source with the real Gherkin parser. Returns the parse errors it
|
|
37
|
-
* reports — empty when the file is well-formed Gherkin.
|
|
38
|
-
*
|
|
39
|
-
* The parser is authoritative BY CONSTRUCTION: it is cucumber's own. A file it rejects is one
|
|
40
|
-
* cucumber would refuse to RUN, so a scenario corpus built from it would be a FICTION — which is
|
|
41
|
-
* precisely how a corrupt spec used to read balanced.
|
|
42
|
-
*
|
|
43
|
-
* A parse failure is reported, never thrown: the CLI edge routes it to stderr + exit 2 (the
|
|
44
|
-
* shared typed-error surface), so it can never reach Node's default exit 1 and masquerade as an
|
|
45
|
-
* out-of-balance verdict (@SCN-CLI-014's collision, on the obligation side).
|
|
46
|
-
*
|
|
47
|
-
* @SCN-CLI-016 (3F-1773).
|
|
48
|
-
*/
|
|
49
3
|
export function parseErrorsIn(file, source) {
|
|
50
4
|
const parser = new Parser(new AstBuilder(IdGenerator.uuid()), new GherkinClassicTokenMatcher());
|
|
51
5
|
try {
|
|
@@ -53,25 +7,10 @@ export function parseErrorsIn(file, source) {
|
|
|
53
7
|
return [];
|
|
54
8
|
}
|
|
55
9
|
catch (err) {
|
|
56
|
-
// The parser raises a CompositeParserException carrying every error it found; its message
|
|
57
|
-
// is the operator's actionable payload (line, column, and what it expected). Reported
|
|
58
|
-
// verbatim — the tool must not paraphrase the parser and risk describing a fault wrongly.
|
|
59
10
|
const message = err instanceof Error ? err.message : String(err);
|
|
60
11
|
return [{ file, message }];
|
|
61
12
|
}
|
|
62
13
|
}
|
|
63
|
-
/**
|
|
64
|
-
* The corpus-level REFUSAL (@SCN-GPG-001, 3F-2817). A parse failure is reported per file by
|
|
65
|
-
* `parseErrorsIn` above; this is how a reader of the WHOLE corpus says no.
|
|
66
|
-
*
|
|
67
|
-
* WHY IT CARRIES EVERY FILE. The balance CLI already names every unparseable file it found
|
|
68
|
-
* (@SCN-CLI-016), and a refusal raised at the first bad one would silently narrow that message —
|
|
69
|
-
* a behaviour change dressed as an implementation detail. So the discovery collects the corpus
|
|
70
|
-
* and refuses ONCE, carrying the lot in discovery order.
|
|
71
|
-
*
|
|
72
|
-
* The rendered message is the parser's words, per file, verbatim: a reader must be told WHAT
|
|
73
|
-
* broke by the parser rather than by our paraphrase of it.
|
|
74
|
-
*/
|
|
75
14
|
export class UnreadableFeatureCorpusError extends Error {
|
|
76
15
|
errors;
|
|
77
16
|
constructor(errors) {
|
|
@@ -83,26 +22,7 @@ export class UnreadableFeatureCorpusError extends Error {
|
|
|
83
22
|
this.errors = errors;
|
|
84
23
|
}
|
|
85
24
|
}
|
|
86
|
-
/**
|
|
87
|
-
* The corpus-level ABSENCE refusal (@SCN-CLI-017, 3F-3345) — sibling to the parse refusal above,
|
|
88
|
-
* and deliberately the same shape: the reader refuses ONCE, and each command decides what the
|
|
89
|
-
* refusal means for it.
|
|
90
|
-
*
|
|
91
|
-
* WHY A TYPED ERROR RATHER THAN AN EMPTY CORPUS. The obvious fix is for `discoverFeatures` to hand
|
|
92
|
-
* back `[]` when the directory is not there. Measured, that would ship a NEW false green in a
|
|
93
|
-
* second command: `spec-controller tags` reaches the same reader through `readCorpusInputs`, whose
|
|
94
|
-
* GENERIC catch is the only thing turning an absent corpus — and, since `tags` carries no
|
|
95
|
-
* `checkInputsExist`, a supplied-but-absent `--features` too — into `The corpus could not be
|
|
96
|
-
* read: …` at exit 2. Tolerance at the reader turns both into `tags: OK …` at exit 0, inside the
|
|
97
|
-
* slice whose whole purpose is killing a vacuous certification. Typed, both survive untouched:
|
|
98
|
-
* this IS an `Error`, so it still lands in that generic catch.
|
|
99
|
-
*
|
|
100
|
-
* IT CARRIES THE DIRECTORY because the report is owed the name of what it examined — "I found no
|
|
101
|
-
* record" and "I found no regression" must never wear one word (3F-2947), and a consumer told
|
|
102
|
-
* their corpus is empty deserves to know which directory was read to reach that.
|
|
103
|
-
*/
|
|
104
25
|
export class MissingFeatureCorpusError extends Error {
|
|
105
|
-
/** The directory that is not there — as resolved, so a reader can print the path examined. */
|
|
106
26
|
directory;
|
|
107
27
|
constructor(directory) {
|
|
108
28
|
super(`The feature corpus directory does not exist: ${directory}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkinValidation.js","sourceRoot":"","sources":["../../src/ingest/gherkinValidation.ts"],"names":[],"mappings":"AAA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