spec-controller 0.1.0-alpha.45 → 0.1.0-alpha.46
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/dist/cli-allocate/cli.d.ts.map +1 -1
- package/dist/cli-allocate/cli.js +0 -5
- package/dist/cli-allocate/cli.js.map +1 -1
- package/dist/cli-allocate/readHistory.d.ts +0 -13
- package/dist/cli-allocate/readHistory.d.ts.map +1 -1
- package/dist/cli-allocate/readHistory.js +0 -33
- package/dist/cli-allocate/readHistory.js.map +1 -1
- package/dist/cli-allocate/readParts.d.ts +0 -1
- package/dist/cli-allocate/readParts.d.ts.map +1 -1
- package/dist/cli-allocate/readParts.js +0 -6
- package/dist/cli-allocate/readParts.js.map +1 -1
- package/dist/cli-allocate/readTree.d.ts +0 -11
- package/dist/cli-allocate/readTree.d.ts.map +1 -1
- package/dist/cli-allocate/readTree.js +0 -32
- package/dist/cli-allocate/readTree.js.map +1 -1
- package/dist/cli-allocate/refStore.d.ts +0 -1
- package/dist/cli-allocate/refStore.d.ts.map +1 -1
- package/dist/cli-allocate/refStore.js +0 -13
- package/dist/cli-allocate/refStore.js.map +1 -1
- package/dist/cli-allocate/request.d.ts +0 -2
- package/dist/cli-allocate/request.d.ts.map +1 -1
- package/dist/cli-allocate/request.js +0 -7
- package/dist/cli-allocate/request.js.map +1 -1
- package/dist/cli-allocate/stderr.d.ts +0 -7
- package/dist/cli-allocate/stderr.d.ts.map +1 -1
- package/dist/cli-allocate/stderr.js +0 -7
- package/dist/cli-allocate/stderr.js.map +1 -1
- package/dist/cli-allocate/unreadable.d.ts +0 -13
- package/dist/cli-allocate/unreadable.d.ts.map +1 -1
- package/dist/cli-allocate/unreadable.js +0 -13
- package/dist/cli-allocate/unreadable.js.map +1 -1
- package/dist/cli-args.d.ts +0 -113
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +0 -145
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +0 -85
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +0 -230
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +0 -52
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +0 -70
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +0 -17
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +0 -13
- package/dist/cli-balance/emit/writer.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +0 -1
- package/dist/cli-balance/exitStatus.d.ts.map +1 -1
- package/dist/cli-balance/exitStatus.js +0 -7
- package/dist/cli-balance/exitStatus.js.map +1 -1
- package/dist/cli-balance/inputsRead.d.ts +0 -12
- package/dist/cli-balance/inputsRead.d.ts.map +1 -1
- package/dist/cli-balance/inputsRead.js +0 -12
- package/dist/cli-balance/inputsRead.js.map +1 -1
- package/dist/cli-balance/reRender.d.ts +0 -14
- package/dist/cli-balance/reRender.d.ts.map +1 -1
- package/dist/cli-balance/reRender.js +0 -15
- package/dist/cli-balance/reRender.js.map +1 -1
- package/dist/cli-balance/unreadableInputs.d.ts +0 -21
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -1
- package/dist/cli-balance/unreadableInputs.js +0 -21
- package/dist/cli-balance/unreadableInputs.js.map +1 -1
- package/dist/cli-registry.d.ts +0 -86
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +0 -70
- package/dist/cli-registry.js.map +1 -1
- package/dist/cli.d.ts +0 -20
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +0 -21
- 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 +0 -61
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -84
- 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 -76
- package/dist/ingest/gherkinValidation.d.ts.map +1 -1
- package/dist/ingest/gherkinValidation.js +0 -76
- package/dist/ingest/gherkinValidation.js.map +1 -1
- package/dist/ingest/ingestQualityChecks.d.ts +0 -81
- package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
- package/dist/ingest/ingestQualityChecks.js +0 -194
- package/dist/ingest/ingestQualityChecks.js.map +1 -1
- package/dist/ingest/ingestScenarios.d.ts +0 -39
- package/dist/ingest/ingestScenarios.d.ts.map +1 -1
- package/dist/ingest/ingestScenarios.js +0 -70
- package/dist/ingest/ingestScenarios.js.map +1 -1
- package/dist/ingest/inputShapes.d.ts +0 -31
- package/dist/ingest/inputShapes.d.ts.map +1 -1
- package/dist/ingest/inputShapes.js +0 -30
- package/dist/ingest/inputShapes.js.map +1 -1
- package/dist/outputLocation.d.ts +0 -48
- package/dist/outputLocation.d.ts.map +1 -1
- package/dist/outputLocation.js +0 -48
- package/dist/outputLocation.js.map +1 -1
- package/dist/run-management/keptRun.d.ts +0 -107
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +0 -75
- 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 +0 -21
- package/dist/storedRun.d.ts.map +1 -1
- package/dist/storedRun.js +0 -21
- package/dist/storedRun.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A path allocate is meant to read and cannot. It is the invocation being wrong, the same as a
|
|
3
|
-
* malformed request, so it is refused as a usage error naming the path and the reason, and no code
|
|
4
|
-
* is given: an answer computed without the path could hand out a code the unread path carries.
|
|
5
|
-
*/
|
|
6
|
-
/** What allocate could not read: which input it was, where (when the read had a path), and the reason. */
|
|
7
1
|
export class UnreadableInput extends Error {
|
|
8
2
|
subject;
|
|
9
3
|
path;
|
|
@@ -16,11 +10,6 @@ export class UnreadableInput extends Error {
|
|
|
16
10
|
this.reason = reason;
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
|
-
/**
|
|
20
|
-
* The read's answer, or the refusal when the operating system refuses it. Any refusal the OS gives
|
|
21
|
-
* is the same fault here: not permitted, not the kind of path the read expects, or not there. A
|
|
22
|
-
* throw that carries no OS code is not a read failing, and is left to surface.
|
|
23
|
-
*/
|
|
24
13
|
export function readOrRefuse(subject, path, read) {
|
|
25
14
|
try {
|
|
26
15
|
return read();
|
|
@@ -29,14 +18,12 @@ export function readOrRefuse(subject, path, read) {
|
|
|
29
18
|
return refuse(subject, path, err);
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
|
-
/** Throw the refusal a failed read of `path` is, or the throw itself when it is not a read failing. */
|
|
33
21
|
export function refuse(subject, path, err) {
|
|
34
22
|
const errno = err;
|
|
35
23
|
if (!(err instanceof Error) || typeof errno.code !== "string")
|
|
36
24
|
throw err;
|
|
37
25
|
throw new UnreadableInput(subject, errno.path ?? path, err.message);
|
|
38
26
|
}
|
|
39
|
-
/** The one stderr line a refusal is written as, in allocate's usage-error form. */
|
|
40
27
|
export function refusalLine(refusal) {
|
|
41
28
|
return `spec-controller allocate: usage error — ${refusal.message}`;
|
|
42
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unreadable.js","sourceRoot":"","sources":["../../src/cli-allocate/unreadable.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"unreadable.js","sourceRoot":"","sources":["../../src/cli-allocate/unreadable.ts"],"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
|
-
* WHY IT IS ITS OWN MODULE. Both halves lived inside `cli-balance/cli.ts` while
|
|
5
|
-
* `balance` was the only command — `parseArgs` private to it, `checkUnknownFlags` exported for
|
|
6
|
-
* its own `@unit` arm. A second command needs both, and the two ways of giving it them were
|
|
7
|
-
* worse than moving them: copying `parseArgs` would put a second reading of argv in a tree whose
|
|
8
|
-
* whole subject is second readings, and importing them from `cli-balance/cli.ts` would have the
|
|
9
|
-
* corpus command pull the entire reconcile ingest chain into memory to answer a question about
|
|
10
|
-
* feature files.
|
|
11
|
-
*
|
|
12
|
-
* THE BOUNDING IS PER-COMMAND, which is what makes "accepted = registry = help" hold for every
|
|
13
|
-
* command rather than for the one this code was written beside. `checkUnknownFlags` took the
|
|
14
|
-
* registry and looked `balance` up inside itself; the command is a parameter now, exactly as it
|
|
15
|
-
* became one for `renderCommandHelp`. The unknown-flag scenario is unchanged and still
|
|
16
|
-
* asks about `balance`: a command added later gets the same bounding BY CONSTRUCTION.
|
|
17
|
-
*/
|
|
18
1
|
import type { CliRegistry, FlagSpec } from "./cli-registry.js";
|
|
19
|
-
/** True when a command's argv asks for its help, wherever `--help` or `-h` stands in it. */
|
|
20
2
|
export declare function asksForHelp(argv: readonly string[]): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Parse `--flag value` pairs from a command's argv into a record, keys with the `--` stripped.
|
|
23
|
-
*
|
|
24
|
-
* A flag whose next token is another flag (or absent) records the string `"true"`, which is how
|
|
25
|
-
* the boolean flags — `--strict`, `--help` — are recognised: presence is what matters, so callers
|
|
26
|
-
* read them with `!== undefined`.
|
|
27
|
-
*
|
|
28
|
-
* PERMISSIVE BY ITSELF, AND BOUNDED BY THE CALLER. It records whatever it is given — a flag no
|
|
29
|
-
* registry names, the last of two copies, a word after a flag that takes none — and drops a word
|
|
30
|
-
* that follows no flag. `checkArgvShape` and `checkUnknownFlags` below are what refuse those, before
|
|
31
|
-
* anything reads the record. The split is deliberate — the parse has no opinion about which
|
|
32
|
-
* command it is reading for, and the bounding has nothing else to do.
|
|
33
|
-
*/
|
|
34
3
|
export declare function parseArgs(argv: readonly string[]): Record<string, string>;
|
|
35
|
-
/**
|
|
36
|
-
* The value flags of one scope: every flag the registry gives a value placeholder (`arg`), by
|
|
37
|
-
* name and alias, dashes kept. Read from the registry alone, so a value flag added later is one.
|
|
38
|
-
*/
|
|
39
4
|
export declare function valueFlagsOf(flags: readonly FlagSpec[]): Map<string, FlagSpec>;
|
|
40
|
-
/**
|
|
41
|
-
* True when the token after a value flag is not a value: there is none, it is the next flag (the
|
|
42
|
-
* same `--` test `parseArgs` reads a flag by), or it is empty — an unset variable, quoted.
|
|
43
|
-
*/
|
|
44
5
|
export declare function isMissingValue(next: string | undefined): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* A flag that takes a value, given none, is a usage fault. It reads the
|
|
47
|
-
* RAW argv, because `parseArgs` has already turned a missing value into the string "true" — which a
|
|
48
|
-
* path flag then looked for on disk, `--target` recorded, and `--format` dropped on its way to a
|
|
49
|
-
* verdict `--exit-zero` turned green. Returns the refusal for the first such flag, else null.
|
|
50
|
-
*/
|
|
51
6
|
export declare function checkMissingValues(argv: readonly string[], registry: CliRegistry, command: string): string | null;
|
|
52
|
-
/** The refusal for a value flag given none: the flag, the value it takes, and where the flags are listed. */
|
|
53
7
|
export declare function missingValueRefusal(given: string, flag: FlagSpec, scope: string): string;
|
|
54
|
-
/**
|
|
55
|
-
* The shape of a command's argv, read against its registry scope: every token is a flag,
|
|
56
|
-
* or the value of the flag before it, or a usage fault. Returns the refusal for the first token that
|
|
57
|
-
* is neither, else null.
|
|
58
|
-
*/
|
|
59
8
|
export declare function checkArgvShape(argv: readonly string[], registry: CliRegistry, command: string): string | null;
|
|
60
|
-
/**
|
|
61
|
-
* The positional arguments in a command's argv, in order: every word that is no flag and no flag's
|
|
62
|
-
* value. A flag the registry gives no value placeholder takes none, so `--new ZZ` reads ZZ as the
|
|
63
|
-
* positional, never as `--new`'s value — which `parseArgs` alone would make it.
|
|
64
|
-
*/
|
|
65
9
|
export declare function positionalArguments(argv: readonly string[], registry: CliRegistry, command: string): string[];
|
|
66
|
-
/** The refusal for a flag given more than once that is read once: the flag, and where. */
|
|
67
10
|
export declare function givenTwiceRefusal(given: string, scope: string): string;
|
|
68
|
-
/** A flag written with its value after an `=`, as in `--format=json`: a form this CLI does not read. */
|
|
69
11
|
export declare function isEqualsForm(token: string): boolean;
|
|
70
|
-
/**
|
|
71
|
-
* The refusal for a flag written `--flag=value`: the form as given, and the
|
|
72
|
-
* spelling that is read — the flag and its value as two arguments, or the flag alone when it takes
|
|
73
|
-
* none. Never the unknown-flag pin advice: no version reads the form, so no pin cures it. Refused
|
|
74
|
-
* rather than split, by ruling: one spelling means one reader of argv, where splitting would teach
|
|
75
|
-
* every reader of it the same answer.
|
|
76
|
-
*/
|
|
77
12
|
export declare function equalsFormRefusal(token: string, flags: ReadonlyMap<string, FlagSpec>, scope: string): string;
|
|
78
|
-
/**
|
|
79
|
-
* A host modifier given after the command is out of place, not unknown: the
|
|
80
|
-
* flag exists, so the unknown-flag advice to bump a pin to a version that accepts it is false. Returns the
|
|
81
|
-
* refusal for the first such flag, else null.
|
|
82
|
-
*/
|
|
83
13
|
export declare function checkMisplacedHostModifiers(args: Record<string, string>, registry: CliRegistry, command: string): string | null;
|
|
84
|
-
/**
|
|
85
|
-
* The registry-bounded flag check at a command's CLI edge. A command accepts ONLY
|
|
86
|
-
* the flags its per-command registry scope LISTS (by `name` or `alias`); an unregistered flag — a
|
|
87
|
-
* typo like `--strcit`, a stray `--bogus` — is a usage error, where the permissive parse above would
|
|
88
|
-
* have recorded it. It bounds flag NAMES and nothing else: a word that is no flag, a value given to a
|
|
89
|
-
* flag that takes none, a second copy, a `--flag=value` form, are `checkArgvShape`'s, which runs
|
|
90
|
-
* first. This is the structural teeth behind "accepted = registry
|
|
91
|
-
* = help": a flag cannot affect behaviour without a registry entry, and so (by the help-completeness
|
|
92
|
-
* guard) without appearing in that command's help.
|
|
93
|
-
*
|
|
94
|
-
* PURE and `@unit`-testable: the parsed args (keys already `--`-stripped) plus the registry and
|
|
95
|
-
* the command to bound against, returning the FIRST unregistered flag as a typed usage error
|
|
96
|
-
* naming it WITH its dashes — routed to stderr and the enumerated usage status 2 by the caller,
|
|
97
|
-
* never 1, never a silent run — else null. The global `--store`/`--run-id` modifiers are consumed
|
|
98
|
-
* by the top-level dispatcher when they come BEFORE the command; written after it they reach the
|
|
99
|
-
* command, and `checkMisplacedHostModifiers` refuses them as out of place before this runs.
|
|
100
|
-
*
|
|
101
|
-
* A COMMAND THE REGISTRY DOES NOT NAME ACCEPTS NOTHING, which is the honest reading rather than a
|
|
102
|
-
* degenerate one: an unregistered command has no scope, so every flag given to it is outside it.
|
|
103
|
-
* The dispatcher refuses such a command before this is ever reached, so the case is unreachable
|
|
104
|
-
* today and stated here so it cannot become a silent "accept everything" later.
|
|
105
|
-
*
|
|
106
|
-
* IT NAMES THE VERSION THAT REFUSED, AND THAT IS FOR THE PINNED READER.
|
|
107
|
-
* A consumer pins spec-controller and then moves their own tree; the pinned reader is handed argv
|
|
108
|
-
* it was published too early — or too late — to understand, and an unadorned "unknown flag" is
|
|
109
|
-
* indistinguishable from a typo. Naming the running version makes version skew legible from the CI
|
|
110
|
-
* log alone, and naming the bump says what to do about it. `toolVersion` is a PARAMETER rather than
|
|
111
|
-
* a read performed here so this stays pure and `@unit`-testable; the callers pass
|
|
112
|
-
* `resolveToolIdentity().toolVersion`, the same value the report provenance carries.
|
|
113
|
-
*
|
|
114
|
-
* WHY THE PRODUCT SAYS THIS AND NOT THE CONSUMER. spec-controller's own repository is a consumer of
|
|
115
|
-
* its published self, and the ruling there is that it does NOT wrap itself — a dependency, a `run:`
|
|
116
|
-
* step, and the verdict its exit code gives. A consumer-side translator turning exit 2 into a skew
|
|
117
|
-
* refusal is exactly that forbidden wrapper, and no other adopter could write one either. So the
|
|
118
|
-
* refusal is the tool's own, which makes it universal rather than local.
|
|
119
|
-
*
|
|
120
|
-
* EXCEPT FOR A FLAG THE COMMAND HAS RETIRED, where the bump is false advice: `retiredFlagRefusal`
|
|
121
|
-
* below names the retirement and its replacement instead.
|
|
122
|
-
*
|
|
123
|
-
* THE STATUS DOES NOT MOVE. The caller still routes this to stderr and exit 2. A mistyped `--strcit`
|
|
124
|
-
* is still a usage fault, and giving skew its own status would cost every adopter the ordinary
|
|
125
|
-
* reading to serve the rarer one.
|
|
126
|
-
*/
|
|
127
14
|
export declare function checkUnknownFlags(args: Record<string, string>, registry: CliRegistry, command: string, toolVersion: string): string | null;
|
|
128
15
|
//# sourceMappingURL=cli-args.d.ts.map
|
package/dist/cli-args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAe,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAE5F,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE5D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBzE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAO9E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEhE;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAUf;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKxF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW7G;AAaD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAS7G;AA2BD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtE;AAcD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAW5G;AAsCD,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CASf;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAoBf"}
|
package/dist/cli-args.js
CHANGED
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THE ONE READING OF A COMMAND'S ARGV, and the one bounding of it against the registry.
|
|
3
|
-
*
|
|
4
|
-
* WHY IT IS ITS OWN MODULE. Both halves lived inside `cli-balance/cli.ts` while
|
|
5
|
-
* `balance` was the only command — `parseArgs` private to it, `checkUnknownFlags` exported for
|
|
6
|
-
* its own `@unit` arm. A second command needs both, and the two ways of giving it them were
|
|
7
|
-
* worse than moving them: copying `parseArgs` would put a second reading of argv in a tree whose
|
|
8
|
-
* whole subject is second readings, and importing them from `cli-balance/cli.ts` would have the
|
|
9
|
-
* corpus command pull the entire reconcile ingest chain into memory to answer a question about
|
|
10
|
-
* feature files.
|
|
11
|
-
*
|
|
12
|
-
* THE BOUNDING IS PER-COMMAND, which is what makes "accepted = registry = help" hold for every
|
|
13
|
-
* command rather than for the one this code was written beside. `checkUnknownFlags` took the
|
|
14
|
-
* registry and looked `balance` up inside itself; the command is a parameter now, exactly as it
|
|
15
|
-
* became one for `renderCommandHelp`. The unknown-flag scenario is unchanged and still
|
|
16
|
-
* asks about `balance`: a command added later gets the same bounding BY CONSTRUCTION.
|
|
17
|
-
*/
|
|
18
|
-
/** True when a command's argv asks for its help, wherever `--help` or `-h` stands in it. */
|
|
19
1
|
export function asksForHelp(argv) {
|
|
20
2
|
return argv.includes("--help") || argv.includes("-h");
|
|
21
3
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Parse `--flag value` pairs from a command's argv into a record, keys with the `--` stripped.
|
|
24
|
-
*
|
|
25
|
-
* A flag whose next token is another flag (or absent) records the string `"true"`, which is how
|
|
26
|
-
* the boolean flags — `--strict`, `--help` — are recognised: presence is what matters, so callers
|
|
27
|
-
* read them with `!== undefined`.
|
|
28
|
-
*
|
|
29
|
-
* PERMISSIVE BY ITSELF, AND BOUNDED BY THE CALLER. It records whatever it is given — a flag no
|
|
30
|
-
* registry names, the last of two copies, a word after a flag that takes none — and drops a word
|
|
31
|
-
* that follows no flag. `checkArgvShape` and `checkUnknownFlags` below are what refuse those, before
|
|
32
|
-
* anything reads the record. The split is deliberate — the parse has no opinion about which
|
|
33
|
-
* command it is reading for, and the bounding has nothing else to do.
|
|
34
|
-
*/
|
|
35
4
|
export function parseArgs(argv) {
|
|
36
5
|
const args = {};
|
|
37
6
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -50,10 +19,6 @@ export function parseArgs(argv) {
|
|
|
50
19
|
}
|
|
51
20
|
return args;
|
|
52
21
|
}
|
|
53
|
-
/**
|
|
54
|
-
* The value flags of one scope: every flag the registry gives a value placeholder (`arg`), by
|
|
55
|
-
* name and alias, dashes kept. Read from the registry alone, so a value flag added later is one.
|
|
56
|
-
*/
|
|
57
22
|
export function valueFlagsOf(flags) {
|
|
58
23
|
const valueFlags = new Map();
|
|
59
24
|
for (const flag of flags) {
|
|
@@ -64,19 +29,9 @@ export function valueFlagsOf(flags) {
|
|
|
64
29
|
}
|
|
65
30
|
return valueFlags;
|
|
66
31
|
}
|
|
67
|
-
/**
|
|
68
|
-
* True when the token after a value flag is not a value: there is none, it is the next flag (the
|
|
69
|
-
* same `--` test `parseArgs` reads a flag by), or it is empty — an unset variable, quoted.
|
|
70
|
-
*/
|
|
71
32
|
export function isMissingValue(next) {
|
|
72
33
|
return next === undefined || next === "" || next.startsWith("--");
|
|
73
34
|
}
|
|
74
|
-
/**
|
|
75
|
-
* A flag that takes a value, given none, is a usage fault. It reads the
|
|
76
|
-
* RAW argv, because `parseArgs` has already turned a missing value into the string "true" — which a
|
|
77
|
-
* path flag then looked for on disk, `--target` recorded, and `--format` dropped on its way to a
|
|
78
|
-
* verdict `--exit-zero` turned green. Returns the refusal for the first such flag, else null.
|
|
79
|
-
*/
|
|
80
35
|
export function checkMissingValues(argv, registry, command) {
|
|
81
36
|
const entry = registry.commands.find((c) => c.name === command);
|
|
82
37
|
const valueFlags = valueFlagsOf(entry?.flags ?? []);
|
|
@@ -88,16 +43,10 @@ export function checkMissingValues(argv, registry, command) {
|
|
|
88
43
|
}
|
|
89
44
|
return null;
|
|
90
45
|
}
|
|
91
|
-
/** The refusal for a value flag given none: the flag, the value it takes, and where the flags are listed. */
|
|
92
46
|
export function missingValueRefusal(given, flag, scope) {
|
|
93
47
|
return (`The ${given} flag of '${scope}' needs a value — ${given} ${flag.arg ?? ""} — and was given none.\n` +
|
|
94
48
|
`Run '${scope} --help' to see the flags this version accepts and the values they take.`);
|
|
95
49
|
}
|
|
96
|
-
/**
|
|
97
|
-
* The shape of a command's argv, read against its registry scope: every token is a flag,
|
|
98
|
-
* or the value of the flag before it, or a usage fault. Returns the refusal for the first token that
|
|
99
|
-
* is neither, else null.
|
|
100
|
-
*/
|
|
101
50
|
export function checkArgvShape(argv, registry, command) {
|
|
102
51
|
const scope = flagScopeOf(registry, command);
|
|
103
52
|
const seen = new Set();
|
|
@@ -111,15 +60,9 @@ export function checkArgvShape(argv, registry, command) {
|
|
|
111
60
|
}
|
|
112
61
|
return null;
|
|
113
62
|
}
|
|
114
|
-
/** The positional arguments a command takes, in order; none for a command that takes flags only. */
|
|
115
63
|
function positionalsOf(registry, command) {
|
|
116
64
|
return registry.commands.find((c) => c.name === command)?.positionals ?? [];
|
|
117
65
|
}
|
|
118
|
-
/**
|
|
119
|
-
* The positional arguments in a command's argv, in order: every word that is no flag and no flag's
|
|
120
|
-
* value. A flag the registry gives no value placeholder takes none, so `--new ZZ` reads ZZ as the
|
|
121
|
-
* positional, never as `--new`'s value — which `parseArgs` alone would make it.
|
|
122
|
-
*/
|
|
123
66
|
export function positionalArguments(argv, registry, command) {
|
|
124
67
|
const scope = flagScopeOf(registry, command);
|
|
125
68
|
const words = [];
|
|
@@ -132,7 +75,6 @@ export function positionalArguments(argv, registry, command) {
|
|
|
132
75
|
}
|
|
133
76
|
return words;
|
|
134
77
|
}
|
|
135
|
-
/** One token of the walk: the refusal it earns, or how many of the tokens after it are its value. */
|
|
136
78
|
function readToken(argv, i, walk, command) {
|
|
137
79
|
const token = argv[i] ?? "";
|
|
138
80
|
const next = argv[i + 1];
|
|
@@ -145,10 +87,6 @@ function readToken(argv, i, walk, command) {
|
|
|
145
87
|
return valueTokensAfter(undefined, next);
|
|
146
88
|
return registeredFlagRefusal(flag, token, next, walk, command) ?? valueTokensAfter(flag, next);
|
|
147
89
|
}
|
|
148
|
-
/**
|
|
149
|
-
* The refusal a registered flag earns where it stands: given a second time when the registry does not
|
|
150
|
-
* mark it `repeatable` (by name or alias, one flag), or given a value it does not take.
|
|
151
|
-
*/
|
|
152
90
|
function registeredFlagRefusal(flag, token, next, walk, command) {
|
|
153
91
|
if (walk.seen.has(flag) && flag.repeatable !== true)
|
|
154
92
|
return givenTwiceRefusal(token, `spec-controller ${command}`);
|
|
@@ -158,12 +96,10 @@ function registeredFlagRefusal(flag, token, next, walk, command) {
|
|
|
158
96
|
}
|
|
159
97
|
return undefined;
|
|
160
98
|
}
|
|
161
|
-
/** The refusal for a flag given more than once that is read once: the flag, and where. */
|
|
162
99
|
export function givenTwiceRefusal(given, scope) {
|
|
163
100
|
return (`The ${given} flag of '${scope}' was given more than once, and is read once: give it once.\n` +
|
|
164
101
|
`Run '${scope} --help' to see the flags this version accepts.`);
|
|
165
102
|
}
|
|
166
|
-
/** Every flag of one command's scope, by name and alias, dashes kept. */
|
|
167
103
|
function flagScopeOf(registry, command) {
|
|
168
104
|
const scope = new Map();
|
|
169
105
|
for (const flag of registry.commands.find((c) => c.name === command)?.flags ?? []) {
|
|
@@ -172,21 +108,12 @@ function flagScopeOf(registry, command) {
|
|
|
172
108
|
}
|
|
173
109
|
return scope;
|
|
174
110
|
}
|
|
175
|
-
/** A token read as a flag whether or not the scope has it: two dashes, as `parseArgs` reads one. */
|
|
176
111
|
function isFlagShaped(token) {
|
|
177
112
|
return token.startsWith("--");
|
|
178
113
|
}
|
|
179
|
-
/** A flag written with its value after an `=`, as in `--format=json`: a form this CLI does not read. */
|
|
180
114
|
export function isEqualsForm(token) {
|
|
181
115
|
return isFlagShaped(token) && token.includes("=");
|
|
182
116
|
}
|
|
183
|
-
/**
|
|
184
|
-
* The refusal for a flag written `--flag=value`: the form as given, and the
|
|
185
|
-
* spelling that is read — the flag and its value as two arguments, or the flag alone when it takes
|
|
186
|
-
* none. Never the unknown-flag pin advice: no version reads the form, so no pin cures it. Refused
|
|
187
|
-
* rather than split, by ruling: one spelling means one reader of argv, where splitting would teach
|
|
188
|
-
* every reader of it the same answer.
|
|
189
|
-
*/
|
|
190
117
|
export function equalsFormRefusal(token, flags, scope) {
|
|
191
118
|
const at = token.indexOf("=");
|
|
192
119
|
const name = token.slice(0, at);
|
|
@@ -196,23 +123,15 @@ export function equalsFormRefusal(token, flags, scope) {
|
|
|
196
123
|
return (`The ${token} form is not read by '${scope}': a flag and its value are two arguments, as in '${spelling}'.\n` +
|
|
197
124
|
`Run '${scope} --help' to see the flags this version accepts.`);
|
|
198
125
|
}
|
|
199
|
-
/**
|
|
200
|
-
* How many tokens after a flag are its value: one for a value flag given one, and — for a flag the
|
|
201
|
-
* scope does not have — one for the word after it, exactly as `parseArgs` pairs them, so an unknown
|
|
202
|
-
* flag and its word stay the unknown-flag check's to refuse. An empty value is consumed as one, so it
|
|
203
|
-
* stays a missing value rather than becoming a stray argument.
|
|
204
|
-
*/
|
|
205
126
|
function valueTokensAfter(flag, next) {
|
|
206
127
|
if (next === undefined || isFlagShaped(next))
|
|
207
128
|
return 0;
|
|
208
129
|
return flag === undefined || flag.arg !== undefined ? 1 : 0;
|
|
209
130
|
}
|
|
210
|
-
/** The refusal for a value given to a flag that takes none: the flag, and the value it was given. */
|
|
211
131
|
function takesNoValueRefusal(flag, value, command) {
|
|
212
132
|
return (`The ${flag} flag of 'spec-controller ${command}' takes no value, and was given one: '${value}'.\n` +
|
|
213
133
|
`Run 'spec-controller ${command} --help' to see the flags this version accepts and the values they take.`);
|
|
214
134
|
}
|
|
215
|
-
/** A word that is no flag fills the command's next positional slot, or is refused when none is left. */
|
|
216
135
|
function positionalRead(token, walk, command) {
|
|
217
136
|
if (walk.slotsLeft === 0) {
|
|
218
137
|
return walk.positionals.length === 0 ? notAFlagRefusal(token, command) : extraPositionalRefusal(token, walk, command);
|
|
@@ -220,23 +139,16 @@ function positionalRead(token, walk, command) {
|
|
|
220
139
|
walk.slotsLeft--;
|
|
221
140
|
return 0;
|
|
222
141
|
}
|
|
223
|
-
/** The refusal for a word beyond the positional arguments a command takes: the word, and what it takes. */
|
|
224
142
|
function extraPositionalRefusal(token, walk, command) {
|
|
225
143
|
const takes = walk.positionals.map((positional) => positional.name).join(" ");
|
|
226
144
|
return (`The argument '${token}' is more than 'spec-controller ${command}' takes: it takes ${takes} once, and its flags.\n` +
|
|
227
145
|
`Run 'spec-controller ${command} --help' to see what this version accepts.`);
|
|
228
146
|
}
|
|
229
|
-
/** The refusal for a token that is no flag and no flag's value: the token, and what the command takes. */
|
|
230
147
|
function notAFlagRefusal(token, command) {
|
|
231
148
|
return (`The argument '${token}' is not a flag, nor the value of the flag before it: ` +
|
|
232
149
|
`'spec-controller ${command}' takes only flags and their values.\n` +
|
|
233
150
|
`Run 'spec-controller ${command} --help' to see the flags this version accepts.`);
|
|
234
151
|
}
|
|
235
|
-
/**
|
|
236
|
-
* A host modifier given after the command is out of place, not unknown: the
|
|
237
|
-
* flag exists, so the unknown-flag advice to bump a pin to a version that accepts it is false. Returns the
|
|
238
|
-
* refusal for the first such flag, else null.
|
|
239
|
-
*/
|
|
240
152
|
export function checkMisplacedHostModifiers(args, registry, command) {
|
|
241
153
|
const modifiers = new Set(registry.global.map((flag) => flag.name.replace(/^-+/, "")));
|
|
242
154
|
const key = Object.keys(args).find((k) => modifiers.has(k));
|
|
@@ -246,54 +158,7 @@ export function checkMisplacedHostModifiers(args, registry, command) {
|
|
|
246
158
|
`'spec-controller --${key} <value> ${command} …', never after it.\n` +
|
|
247
159
|
`Run 'spec-controller --help' to see the host modifiers this version accepts.`);
|
|
248
160
|
}
|
|
249
|
-
/**
|
|
250
|
-
* The registry-bounded flag check at a command's CLI edge. A command accepts ONLY
|
|
251
|
-
* the flags its per-command registry scope LISTS (by `name` or `alias`); an unregistered flag — a
|
|
252
|
-
* typo like `--strcit`, a stray `--bogus` — is a usage error, where the permissive parse above would
|
|
253
|
-
* have recorded it. It bounds flag NAMES and nothing else: a word that is no flag, a value given to a
|
|
254
|
-
* flag that takes none, a second copy, a `--flag=value` form, are `checkArgvShape`'s, which runs
|
|
255
|
-
* first. This is the structural teeth behind "accepted = registry
|
|
256
|
-
* = help": a flag cannot affect behaviour without a registry entry, and so (by the help-completeness
|
|
257
|
-
* guard) without appearing in that command's help.
|
|
258
|
-
*
|
|
259
|
-
* PURE and `@unit`-testable: the parsed args (keys already `--`-stripped) plus the registry and
|
|
260
|
-
* the command to bound against, returning the FIRST unregistered flag as a typed usage error
|
|
261
|
-
* naming it WITH its dashes — routed to stderr and the enumerated usage status 2 by the caller,
|
|
262
|
-
* never 1, never a silent run — else null. The global `--store`/`--run-id` modifiers are consumed
|
|
263
|
-
* by the top-level dispatcher when they come BEFORE the command; written after it they reach the
|
|
264
|
-
* command, and `checkMisplacedHostModifiers` refuses them as out of place before this runs.
|
|
265
|
-
*
|
|
266
|
-
* A COMMAND THE REGISTRY DOES NOT NAME ACCEPTS NOTHING, which is the honest reading rather than a
|
|
267
|
-
* degenerate one: an unregistered command has no scope, so every flag given to it is outside it.
|
|
268
|
-
* The dispatcher refuses such a command before this is ever reached, so the case is unreachable
|
|
269
|
-
* today and stated here so it cannot become a silent "accept everything" later.
|
|
270
|
-
*
|
|
271
|
-
* IT NAMES THE VERSION THAT REFUSED, AND THAT IS FOR THE PINNED READER.
|
|
272
|
-
* A consumer pins spec-controller and then moves their own tree; the pinned reader is handed argv
|
|
273
|
-
* it was published too early — or too late — to understand, and an unadorned "unknown flag" is
|
|
274
|
-
* indistinguishable from a typo. Naming the running version makes version skew legible from the CI
|
|
275
|
-
* log alone, and naming the bump says what to do about it. `toolVersion` is a PARAMETER rather than
|
|
276
|
-
* a read performed here so this stays pure and `@unit`-testable; the callers pass
|
|
277
|
-
* `resolveToolIdentity().toolVersion`, the same value the report provenance carries.
|
|
278
|
-
*
|
|
279
|
-
* WHY THE PRODUCT SAYS THIS AND NOT THE CONSUMER. spec-controller's own repository is a consumer of
|
|
280
|
-
* its published self, and the ruling there is that it does NOT wrap itself — a dependency, a `run:`
|
|
281
|
-
* step, and the verdict its exit code gives. A consumer-side translator turning exit 2 into a skew
|
|
282
|
-
* refusal is exactly that forbidden wrapper, and no other adopter could write one either. So the
|
|
283
|
-
* refusal is the tool's own, which makes it universal rather than local.
|
|
284
|
-
*
|
|
285
|
-
* EXCEPT FOR A FLAG THE COMMAND HAS RETIRED, where the bump is false advice: `retiredFlagRefusal`
|
|
286
|
-
* below names the retirement and its replacement instead.
|
|
287
|
-
*
|
|
288
|
-
* THE STATUS DOES NOT MOVE. The caller still routes this to stderr and exit 2. A mistyped `--strcit`
|
|
289
|
-
* is still a usage fault, and giving skew its own status would cost every adopter the ordinary
|
|
290
|
-
* reading to serve the rarer one.
|
|
291
|
-
*/
|
|
292
161
|
export function checkUnknownFlags(args, registry, command, toolVersion) {
|
|
293
|
-
// The accepted set: every flag name AND alias in THIS command's scope, with the leading dashes
|
|
294
|
-
// stripped so it compares against the parse's `--`-stripped keys (e.g. "--features" and "-h"
|
|
295
|
-
// become "features" and "h"). Built from the registry alone — the single source — so
|
|
296
|
-
// "accepted = registry" holds by construction.
|
|
297
162
|
const entry = registry.commands.find((c) => c.name === command);
|
|
298
163
|
const accepted = new Set();
|
|
299
164
|
for (const flag of entry?.flags ?? []) {
|
|
@@ -301,9 +166,6 @@ export function checkUnknownFlags(args, registry, command, toolVersion) {
|
|
|
301
166
|
for (const alias of flag.aliases ?? [])
|
|
302
167
|
accepted.add(alias.replace(/^-+/, ""));
|
|
303
168
|
}
|
|
304
|
-
// The FIRST parsed flag not in the accepted set is the reported error (Object.keys is argv
|
|
305
|
-
// order, so this is deterministic). The message names the flag WITH its dashes, and the command
|
|
306
|
-
// whose scope refused it — a consumer running two commands needs to know which help to open.
|
|
307
169
|
for (const key of Object.keys(args)) {
|
|
308
170
|
if (!accepted.has(key)) {
|
|
309
171
|
return (retiredFlagRefusal(entry, key, command, toolVersion) ??
|
|
@@ -316,13 +178,6 @@ export function checkUnknownFlags(args, registry, command, toolVersion) {
|
|
|
316
178
|
}
|
|
317
179
|
return null;
|
|
318
180
|
}
|
|
319
|
-
/**
|
|
320
|
-
* THE REFUSAL FOR A FLAG THE COMMAND HAS RETIRED, or `undefined` when the
|
|
321
|
-
* flag is merely unregistered. The drift advice above is true of a flag newer than the pin and
|
|
322
|
-
* false of a retired one: every earlier version accepts it and no later one will, so the only pin
|
|
323
|
-
* that satisfies "bump the pin to a version that accepts it" is a downgrade back onto the route
|
|
324
|
-
* the retirement removed. So this names the retirement and the replacement, and offers no pin.
|
|
325
|
-
*/
|
|
326
181
|
function retiredFlagRefusal(entry, key, command, toolVersion) {
|
|
327
182
|
const retired = entry?.retiredFlags?.find((flag) => flag.name.replace(/^-+/, "") === key);
|
|
328
183
|
if (retired === undefined)
|
package/dist/cli-args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../src/cli-args.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,IAAuB;IACjD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAuB;IAC/C,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KA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The orchestration half of
|
|
3
|
-
* the old cli.ts: arg parsing, the render-from-JSON mode, and the reconcile →
|
|
4
|
-
* census → provenance → plan → write sequence. The impure file reads it calls
|
|
5
|
-
* (runReconcile + the read* siblings) live in ingest/ingestQualityChecks.ts; the output
|
|
6
|
-
* plan/write in ./emit; the git-derived run inputs in run-management/resolveRunInputs.ts.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* pnpm reconcile [--features <dir>] [--vitest <report.json>]
|
|
10
|
-
* [--cucumber <report.json>] [--ci-steps <record.json>]
|
|
11
|
-
* [--ci <ci.yml>]
|
|
12
|
-
* [--format <fmt>[:<path>]]
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* The legacy-`--json` guard at the CLI edge. The earlier
|
|
16
|
-
* `--json <path>` flag is removed; supplying it must fail fast with a migration hint to
|
|
17
|
-
* `--format json:<path>`, so the removed flag never silently no-ops and drops output. PURE
|
|
18
|
-
* and `@unit`-testable: the removed flag is NOT a `--format` spec (planOutput never sees
|
|
19
|
-
* it), so the guard reads the parsed args directly and returns the typed migration-hint
|
|
20
|
-
* error message when `--json` is present — routed to stderr + a non-zero exit by main(),
|
|
21
|
-
* the same handling planOutput's typed error gets (the shared error surface) — else null.
|
|
22
|
-
*/
|
|
23
1
|
export declare function checkLegacyJson(args: Record<string, string>): string | null;
|
|
24
|
-
/**
|
|
25
|
-
* Source the provenance "Target repo:" name for a run. The
|
|
26
|
-
* operator's `--target` is recorded VERBATIM — no resolution — defaulting to
|
|
27
|
-
* `"unknown-target"` when omitted (parallel to `sourceSha`'s `"unknown"`; the facts
|
|
28
|
-
* artefact is self-describing, so the line always renders). PURE and `@unit`-testable at
|
|
29
|
-
* the CLI edge, like `checkLegacyJson`. It never inspects `--features`: the prior
|
|
30
|
-
* `basename(dirname(--features))` resolution (the deleted `resolveTarget`) and its
|
|
31
|
-
* degenerate `.` are impossible now — the target is only ever the given value or the
|
|
32
|
-
* explicit default.
|
|
33
|
-
*/
|
|
34
2
|
export declare function sourceTarget(args: Record<string, string>): string;
|
|
35
|
-
/**
|
|
36
|
-
* Guard the supplied input-file/dir flags at the CLI edge. A
|
|
37
|
-
* mistyped `--vitest` / `--cucumber` / `--features` / `--ci` / `--package-json`
|
|
38
|
-
* pointing at a non-existent path used to reconcile silently against ZERO evidence —
|
|
39
|
-
* a terrifying false all-red report meaning "you forgot the reports", not "your code
|
|
40
|
-
* is broken" (the dogfooding fault). These flags are Examples of ONE boundary
|
|
41
|
-
* rule: a supplied-but-absent input path is a hard error, and a flag added to the set
|
|
42
|
-
* inherits it rather than restating it. Scope is existence only
|
|
43
|
-
* (readability / file-vs-dir type-correctness out of scope; `exists` covers the dir
|
|
44
|
-
* flag and the file flags alike).
|
|
45
|
-
*
|
|
46
|
-
* PURE and `@unit`-testable like `checkLegacyJson` / `sourceTarget`: reads the parsed
|
|
47
|
-
* args + an injected `exists` fn (no fs), returns the FIRST supplied-but-absent
|
|
48
|
-
* `(flag, path)` as a typed error naming both — routed to stderr + a non-zero exit by
|
|
49
|
-
* `refuseUnreadableInputs` (the shared typed-error surface) — else null. An OMITTED flag is not an
|
|
50
|
-
* error (legitimately optional: simply no evidence of that kind).
|
|
51
|
-
*/
|
|
52
3
|
export declare function checkInputsExist(args: Record<string, string>, exists: (path: string) => boolean): string | null;
|
|
53
|
-
/**
|
|
54
|
-
* Guard the READABILITY of the supplied JSON inputs at the CLI edge.
|
|
55
|
-
* `checkInputsExist` already guards their PRESENCE — but a path that is present yet
|
|
56
|
-
* UNPARSEABLE fell straight through it: the reader threw mid-parse, nothing caught it, and
|
|
57
|
-
* the process hit Node's default exit 1 — the code reserved for a genuine OUT-OF-BALANCE
|
|
58
|
-
* verdict. A crashed invocation was therefore indistinguishable, by exit code, from an
|
|
59
|
-
* honest disagreement. An input the tool cannot read is a USAGE fault: exit 2,
|
|
60
|
-
* sibling to a missing path and an unrecognised flag.
|
|
61
|
-
*
|
|
62
|
-
* PURE and `@unit`-testable like its sibling guards: reads the parsed args + an injected
|
|
63
|
-
* `read` fn (no fs), returns the FIRST supplied-but-unparseable `(flag, path, failure)` as
|
|
64
|
-
* a typed error naming all three — routed to stderr + exit 2 by `refuseUnreadableInputs` — else null.
|
|
65
|
-
* An omitted flag is not an error, and a file that cannot be read at all (a race after the
|
|
66
|
-
* existence check, a permission refused) is refused as one that could not be read, never as JSON
|
|
67
|
-
* that did not parse.
|
|
68
|
-
*/
|
|
69
4
|
export declare function checkInputsParse(args: Record<string, string>, read: (path: string) => string): string | null;
|
|
70
|
-
/**
|
|
71
|
-
* Guard the readability of `--render-from-json` at the CLI edge. The
|
|
72
|
-
* render-from-saved-JSON branch RETURNS before the input guards ever run, so it honoured
|
|
73
|
-
* NEITHER: a missing path crashed to `ENOENT` and a malformed file to `SyntaxError`, both
|
|
74
|
-
* landing on Node's default exit 1 — the out-of-balance code.
|
|
75
|
-
*
|
|
76
|
-
* The missing-path case was a live violation of the missing-input rule's own shipped principle: a
|
|
77
|
-
* supplied input path that does not exist is a hard error at exit 2, enforced for the five
|
|
78
|
-
* evidence flags and not for this one. The CLI shipped a guard that half-honoured its Rule.
|
|
79
|
-
*
|
|
80
|
-
* MISSING and UNPARSEABLE are two Examples of one boundary rule — an input the tool cannot
|
|
81
|
-
* read is a usage error, never a verdict — so one guard covers both. PURE and
|
|
82
|
-
* `@unit`-testable like its siblings: the parsed args + an injected `read` (no fs), which
|
|
83
|
-
* throws for an absent/unreadable path exactly as `readFileSync` does. An OMITTED flag is
|
|
84
|
-
* not an error (the ordinary reconcile path).
|
|
85
|
-
*/
|
|
86
5
|
export declare function checkRenderFromJson(args: Record<string, string>, read: (path: string) => string): string | null;
|
|
87
|
-
/**
|
|
88
|
-
* The `balance` command. A refusal leaves on the usage code and answers that no report was written,
|
|
89
|
-
* after everything already written has drained.
|
|
90
|
-
*/
|
|
91
6
|
export declare function runBalance(argv: string[]): boolean;
|
|
92
7
|
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAmDA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAS3E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEjE;AAaD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,GAAG,IAAI,CAWf;AAMD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAkBf;AAMD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAElD"}
|