spec-controller 0.1.0-alpha.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -11
- 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 +61 -0
- package/dist/cli-allocate/cli.js.map +1 -0
- package/dist/cli-allocate/readHistory.d.ts +14 -0
- package/dist/cli-allocate/readHistory.d.ts.map +1 -0
- package/dist/cli-allocate/readHistory.js +109 -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 +23 -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 +35 -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 +23 -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 +32 -0
- package/dist/cli-allocate/stderr.js.map +1 -0
- package/dist/cli-allocate/unreadable.d.ts +13 -0
- package/dist/cli-allocate/unreadable.d.ts.map +1 -0
- package/dist/cli-allocate/unreadable.js +37 -0
- package/dist/cli-allocate/unreadable.js.map +1 -0
- package/dist/cli-args.d.ts +15 -70
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +167 -85
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +1 -82
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +86 -397
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/emit/format.d.ts +18 -39
- package/dist/cli-balance/emit/format.d.ts.map +1 -1
- package/dist/cli-balance/emit/format.js +32 -63
- package/dist/cli-balance/emit/format.js.map +1 -1
- package/dist/cli-balance/emit/writer.d.ts +2 -34
- package/dist/cli-balance/emit/writer.d.ts.map +1 -1
- package/dist/cli-balance/emit/writer.js +62 -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 +54 -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 +15 -0
- package/dist/cli-balance/unreadableInputs.d.ts.map +1 -0
- package/dist/cli-balance/unreadableInputs.js +100 -0
- package/dist/cli-balance/unreadableInputs.js.map +1 -0
- package/dist/cli-registry.d.ts +16 -71
- package/dist/cli-registry.d.ts.map +1 -1
- package/dist/cli-registry.js +71 -136
- 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 +1 -85
- 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 +99 -50
- package/dist/host.js.map +1 -1
- package/dist/ingest/ciSourcePaths.d.ts +0 -39
- package/dist/ingest/ciSourcePaths.d.ts.map +1 -1
- package/dist/ingest/ciSourcePaths.js +1 -39
- 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 +3 -82
- 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 +61 -224
- 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 +24 -110
- 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 +114 -0
- package/dist/ingest/inputShapes.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +93 -0
- package/dist/main.js.map +1 -0
- package/dist/messages.d.ts +223 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +319 -0
- package/dist/messages.js.map +1 -0
- package/dist/outputLocation.d.ts +23 -0
- package/dist/outputLocation.d.ts.map +1 -0
- package/dist/outputLocation.js +139 -0
- package/dist/outputLocation.js.map +1 -0
- package/dist/run-management/keptRun.d.ts +8 -109
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +49 -89
- 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 +13 -117
- 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 +27 -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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Shape } from "../ingest/inputShapes.js";
|
|
2
|
+
import { type ReRendered } from "./reRender.js";
|
|
3
|
+
export interface JsonInput {
|
|
4
|
+
readonly subject: string;
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly shape: Shape;
|
|
7
|
+
readonly writer: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function jsonInputsOf(args: Record<string, string>, exists: (path: string) => boolean): JsonInput[];
|
|
10
|
+
export declare function reasonOf(err: unknown): string;
|
|
11
|
+
export declare function checkInputShapes(inputs: readonly JsonInput[], read: (path: string) => string): string | null;
|
|
12
|
+
export declare function checkInputPaths(args: Record<string, string>): string | null;
|
|
13
|
+
export declare function checkSavedReconciliation(path: string, savedJson: string): string | null;
|
|
14
|
+
export declare function reRenderOrRefusal(path: string, savedJson: string, strict: boolean): ReRendered | string;
|
|
15
|
+
//# sourceMappingURL=unreadableInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadableInputs.d.ts","sourceRoot":"","sources":["../../src/cli-balance/unreadableInputs.ts"],"names":[],"mappings":"AAMA,OAAO,EAOL,KAAK,KAAK,EACX,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAG1D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA+BD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,EAAE,CASzG;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAE7C;AAoBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5G;AAMD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAkB3E;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,CAUvG"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ciReadFault, corpusReadFault, DEFAULT_PACKAGE_JSON, } from "../ingest/ingestQualityChecks.js";
|
|
2
|
+
import { CI_STEP_RECORD, CUCUMBER_REPORT, PACKAGE_MANIFEST, SAVED_RECONCILIATION, shapeFaultIn, VITEST_REPORT, } from "../ingest/inputShapes.js";
|
|
3
|
+
import { reRender } from "./reRender.js";
|
|
4
|
+
import { APP_MESSAGES, AppMessage } from "../messages.js";
|
|
5
|
+
const READ_SHAPES = {
|
|
6
|
+
vitest: {
|
|
7
|
+
subject: APP_MESSAGES[AppMessage.FlaggedReport],
|
|
8
|
+
writer: APP_MESSAGES[AppMessage.VitestReportShape](),
|
|
9
|
+
shape: VITEST_REPORT,
|
|
10
|
+
},
|
|
11
|
+
cucumber: {
|
|
12
|
+
subject: APP_MESSAGES[AppMessage.FlaggedReport],
|
|
13
|
+
writer: APP_MESSAGES[AppMessage.CucumberReportShape](),
|
|
14
|
+
shape: CUCUMBER_REPORT,
|
|
15
|
+
},
|
|
16
|
+
"ci-steps": {
|
|
17
|
+
subject: APP_MESSAGES[AppMessage.FlaggedRecord],
|
|
18
|
+
writer: APP_MESSAGES[AppMessage.CiStepRecordShape](),
|
|
19
|
+
shape: CI_STEP_RECORD,
|
|
20
|
+
},
|
|
21
|
+
"package-json": {
|
|
22
|
+
subject: APP_MESSAGES[AppMessage.FlaggedManifest],
|
|
23
|
+
writer: APP_MESSAGES[AppMessage.PackageManifestShape](),
|
|
24
|
+
shape: PACKAGE_MANIFEST,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export function jsonInputsOf(args, exists) {
|
|
28
|
+
const given = Object.entries(READ_SHAPES).flatMap(([flag, read]) => {
|
|
29
|
+
const path = args[flag];
|
|
30
|
+
if (path === undefined)
|
|
31
|
+
return [];
|
|
32
|
+
return [{ subject: read.subject(`--${flag}`), path, shape: read.shape, writer: read.writer }];
|
|
33
|
+
});
|
|
34
|
+
if (args["package-json"] !== undefined || !exists(DEFAULT_PACKAGE_JSON))
|
|
35
|
+
return given;
|
|
36
|
+
const { shape, writer } = READ_SHAPES["package-json"];
|
|
37
|
+
return [...given, { subject: APP_MESSAGES[AppMessage.DefaultPackageJson](), path: DEFAULT_PACKAGE_JSON, shape, writer }];
|
|
38
|
+
}
|
|
39
|
+
export function reasonOf(err) {
|
|
40
|
+
return err instanceof Error ? err.message : String(err);
|
|
41
|
+
}
|
|
42
|
+
function jsonInputFault(input, read) {
|
|
43
|
+
let text;
|
|
44
|
+
try {
|
|
45
|
+
text = read(input.path);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
return APP_MESSAGES[AppMessage.CouldNotBeReadAt](input.subject, input.path, reasonOf(err));
|
|
49
|
+
}
|
|
50
|
+
let document;
|
|
51
|
+
try {
|
|
52
|
+
document = JSON.parse(text);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
return APP_MESSAGES[AppMessage.NotValidJson](input.subject, input.path, reasonOf(err));
|
|
56
|
+
}
|
|
57
|
+
const fault = shapeFaultIn(document, input.shape);
|
|
58
|
+
if (fault === null)
|
|
59
|
+
return null;
|
|
60
|
+
return APP_MESSAGES[AppMessage.NotInShape](input.subject, input.writer, input.path, fault);
|
|
61
|
+
}
|
|
62
|
+
export function checkInputShapes(inputs, read) {
|
|
63
|
+
for (const input of inputs) {
|
|
64
|
+
const fault = jsonInputFault(input, read);
|
|
65
|
+
if (fault !== null)
|
|
66
|
+
return fault;
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function pathRefusal(subject, fault) {
|
|
71
|
+
return APP_MESSAGES[AppMessage.CouldNotBeReadAt](subject, fault.path, fault.reason);
|
|
72
|
+
}
|
|
73
|
+
export function checkInputPaths(args) {
|
|
74
|
+
const corpus = corpusReadFault(args["features"]);
|
|
75
|
+
if (corpus !== null) {
|
|
76
|
+
return pathRefusal(args["features"] === undefined
|
|
77
|
+
? APP_MESSAGES[AppMessage.DefaultFeatureCorpus]()
|
|
78
|
+
: APP_MESSAGES[AppMessage.FlaggedCorpus]("--features"), corpus);
|
|
79
|
+
}
|
|
80
|
+
const ci = ciReadFault(args["ci"]);
|
|
81
|
+
if (ci !== null) {
|
|
82
|
+
return pathRefusal(args["ci"] === undefined ? APP_MESSAGES[AppMessage.DefaultCiWorkflows]() : APP_MESSAGES[AppMessage.FlaggedWorkflows]("--ci"), ci);
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
export function checkSavedReconciliation(path, savedJson) {
|
|
87
|
+
const fault = shapeFaultIn(JSON.parse(savedJson), SAVED_RECONCILIATION);
|
|
88
|
+
if (fault === null)
|
|
89
|
+
return null;
|
|
90
|
+
return APP_MESSAGES[AppMessage.NotASavedReconciliation](APP_MESSAGES[AppMessage.FlaggedFile]("--render-from-json"), path, fault);
|
|
91
|
+
}
|
|
92
|
+
export function reRenderOrRefusal(path, savedJson, strict) {
|
|
93
|
+
try {
|
|
94
|
+
return reRender(savedJson, strict);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
return APP_MESSAGES[AppMessage.NotRenderableAsSaved](APP_MESSAGES[AppMessage.FlaggedFile]("--render-from-json"), path, reasonOf(err));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=unreadableInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadableInputs.js","sourceRoot":"","sources":["../../src/cli-balance/unreadableInputs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,GAErB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,aAAa,GAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAe1D,MAAM,WAAW,GAAwC;IACvD,MAAM,EAAE;QACN,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC;QAC/C,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;QACpD,KAAK,EAAE,aAAa;KACrB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC;QAC/C,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE;QACtD,KAAK,EAAE,eAAe;KACvB;IACD,UAAU,EAAE;QACV,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC;QAC/C,MAAM,EAAE,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AC,WAAW,CAAC,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACnI,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,SAAiB,EAAE,MAAe;IAChF,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,YAAY,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAClD,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,EAC1D,IAAI,EACJ,QAAQ,CAAC,GAAG,CAAC,CACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/cli-registry.d.ts
CHANGED
|
@@ -1,91 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The data-driven command/flag registry — the single source the CLI answers `--help`
|
|
3
|
-
* from (@SCN-CLI-006). Two scopes mirror the two help surfaces:
|
|
4
|
-
*
|
|
5
|
-
* - `global` — the host modifiers recognised BEFORE the command (`--store`,
|
|
6
|
-
* `--run-id`), consumed by the top-level dispatcher; rendered by
|
|
7
|
-
* `spec-controller --help` (the sibling @SCN-CLI-007 surface).
|
|
8
|
-
* - `commands` — the per-command scopes; each command's own flags (+ `--help`/`-h`),
|
|
9
|
-
* rendered by `<command> --help`. No count is written here: @SCN-CLI-008 holds
|
|
10
|
-
* registry and render together whatever the number is, and a figure repeated in
|
|
11
|
-
* prose is one nothing reads (3F-3277).
|
|
12
|
-
*
|
|
13
|
-
* A flag exists ⇒ a registry entry ⇒ it appears in help, by construction — the
|
|
14
|
-
* single-source discipline the completeness guard (@SCN-CLI-008) will enforce and the
|
|
15
|
-
* registry-bounded parser (@SCN-CLI-009) will reject against. Registry + renderers live in the
|
|
16
|
-
* CLI/app layer, never the domain.
|
|
17
|
-
*
|
|
18
|
-
* THE REGISTRY IS THE SOURCE OF TRUTH FOR A FLAG'S DESCRIPTION AND NOTHING RECONCILES THE DOC
|
|
19
|
-
* AGAINST IT. This docblock used to say the doc was reconciled by @SCN-CLI-007/008; it is not —
|
|
20
|
-
* those two are about the registry and the two RENDERERS, and nothing in `tests/` or `features/`
|
|
21
|
-
* reads doc/how_to_use.md at all (3F-3256 deleted the checks that read documentation). So the
|
|
22
|
-
* flag table in that page is kept in step by hand, and it has drifted in BOTH directions before
|
|
23
|
-
* now: ahead of the registry on one sentence and behind it on the next (3F-3083).
|
|
24
|
-
*/
|
|
25
|
-
/** One flag in a scope: its canonical name, optional aliases, value placeholder, help. */
|
|
26
1
|
export interface FlagSpec {
|
|
27
|
-
/** The canonical flag with dashes (e.g. "--features", "--help"). */
|
|
28
2
|
name: string;
|
|
29
|
-
/** Alternate spellings rendered after the name (e.g. ["-h"]); omit when none. */
|
|
30
3
|
aliases?: string[];
|
|
31
|
-
/** The value placeholder (e.g. "<dir>"); omit for boolean flags like `--help`. */
|
|
32
4
|
arg?: string;
|
|
33
|
-
/** True when the flag may be given more than once (`--format`); omit otherwise. */
|
|
34
5
|
repeatable?: boolean;
|
|
35
|
-
/** One-line help text — the description migrated from doc/how_to_use.md. */
|
|
36
6
|
description: string;
|
|
37
7
|
}
|
|
38
|
-
|
|
8
|
+
export interface PositionalSpec {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
39
12
|
export interface CommandSpec {
|
|
40
|
-
/** The command token (e.g. "balance"). */
|
|
41
13
|
name: string;
|
|
42
|
-
/** One-line summary for the top-level `spec-controller --help` (the CLI-007 surface). */
|
|
43
14
|
summary: string;
|
|
44
|
-
/** The command's per-command flag scope. */
|
|
45
15
|
flags: FlagSpec[];
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* verbatim after the flag list. It lives on the command's entry rather than in the
|
|
49
|
-
* renderer because a config field belongs to whichever command consumes it: appended
|
|
50
|
-
* unconditionally, `balance`'s `specController.deferralTags` block would document, under
|
|
51
|
-
* every later command, a field that command does not read (3F-3298). Omit when none.
|
|
52
|
-
*/
|
|
16
|
+
positionals?: PositionalSpec[];
|
|
17
|
+
acceptsHostModifiers?: false;
|
|
53
18
|
configHelp?: string[];
|
|
19
|
+
retiredFlags?: RetiredFlagSpec[];
|
|
20
|
+
}
|
|
21
|
+
interface RetiredFlagSpec {
|
|
22
|
+
name: string;
|
|
23
|
+
retiredIn: string;
|
|
24
|
+
replacement: string;
|
|
54
25
|
}
|
|
55
|
-
/** The two-scope registry: the global host-modifier scope, and the per-command scopes. */
|
|
56
26
|
export interface CliRegistry {
|
|
57
|
-
/** Host modifiers recognised before the command — the global scope (CLI-007). */
|
|
58
27
|
global: FlagSpec[];
|
|
59
|
-
/** The per-command scopes. */
|
|
60
28
|
commands: CommandSpec[];
|
|
61
29
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
30
|
+
export declare const balanceCommand: CommandSpec;
|
|
31
|
+
export declare const allocateCommand: CommandSpec;
|
|
65
32
|
export declare const cliRegistry: CliRegistry;
|
|
66
|
-
|
|
67
|
-
* Render THE NAMED command's per-command scope as help text: one line per registered flag
|
|
68
|
-
* (name + arg-placeholder + description), then whatever config lines that command's entry
|
|
69
|
-
* carries — driven BY the registry, so a flag that exists is a flag that appears, by
|
|
70
|
-
* construction. Returns the help block WITHOUT a trailing newline (the caller adds it,
|
|
71
|
-
* matching the writer's stdout convention).
|
|
72
|
-
*
|
|
73
|
-
* THE COMMAND IS A PARAMETER (3F-3298). It used to be the literal `"balance"`, found by name
|
|
74
|
-
* inside this function, which is what the single registered command made look general. A
|
|
75
|
-
* second command had no help surface at all under that signature — not an empty one; there
|
|
76
|
-
* was no argument by which to ask. What the renderer covers is now the registry's shape
|
|
77
|
-
* rather than the command set's size on the day it was written.
|
|
78
|
-
*/
|
|
79
|
-
export declare function renderCommandHelp(registry: CliRegistry, command: string): string;
|
|
80
|
-
/**
|
|
81
|
-
* Render the top-level `spec-controller --help` surface (@SCN-CLI-007) FROM the registry:
|
|
82
|
-
* a Commands section (each command's name + one-line summary) and a Host modifiers section
|
|
83
|
-
* (each global-scope flag: name + arg-placeholder + one-line description). The global-scope
|
|
84
|
-
* half of the two-scope registry — the counterpart to `renderCommandHelp`'s per-command
|
|
85
|
-
* half — so the top-level usage no longer hand-keeps (and can no longer silently drift
|
|
86
|
-
* from) the command set or the host modifiers; both are sourced from `cliRegistry`.
|
|
87
|
-
* Summaries and descriptions render on a single line (no wrapping) so a registered string
|
|
88
|
-
* appears verbatim. Returns the block WITHOUT a trailing newline (the caller adds it).
|
|
89
|
-
*/
|
|
33
|
+
export declare function renderCommandHelp(command: CommandSpec): string;
|
|
90
34
|
export declare function renderTopLevelHelp(registry: CliRegistry): string;
|
|
35
|
+
export {};
|
|
91
36
|
//# sourceMappingURL=cli-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-registry.d.ts","sourceRoot":"","sources":["../src/cli-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-registry.d.ts","sourceRoot":"","sources":["../src/cli-registry.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,oBAAoB,CAAC,EAAE,KAAK,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;CAClC;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAkGD,eAAO,MAAM,cAAc,EAAE,WAM5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WAc7B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAGzB,CAAC;AAOF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAgB9D;AAcD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CA0BhE"}
|
package/dist/cli-registry.js
CHANGED
|
@@ -1,219 +1,154 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The data-driven command/flag registry — the single source the CLI answers `--help`
|
|
3
|
-
* from (@SCN-CLI-006). Two scopes mirror the two help surfaces:
|
|
4
|
-
*
|
|
5
|
-
* - `global` — the host modifiers recognised BEFORE the command (`--store`,
|
|
6
|
-
* `--run-id`), consumed by the top-level dispatcher; rendered by
|
|
7
|
-
* `spec-controller --help` (the sibling @SCN-CLI-007 surface).
|
|
8
|
-
* - `commands` — the per-command scopes; each command's own flags (+ `--help`/`-h`),
|
|
9
|
-
* rendered by `<command> --help`. No count is written here: @SCN-CLI-008 holds
|
|
10
|
-
* registry and render together whatever the number is, and a figure repeated in
|
|
11
|
-
* prose is one nothing reads (3F-3277).
|
|
12
|
-
*
|
|
13
|
-
* A flag exists ⇒ a registry entry ⇒ it appears in help, by construction — the
|
|
14
|
-
* single-source discipline the completeness guard (@SCN-CLI-008) will enforce and the
|
|
15
|
-
* registry-bounded parser (@SCN-CLI-009) will reject against. Registry + renderers live in the
|
|
16
|
-
* CLI/app layer, never the domain.
|
|
17
|
-
*
|
|
18
|
-
* THE REGISTRY IS THE SOURCE OF TRUTH FOR A FLAG'S DESCRIPTION AND NOTHING RECONCILES THE DOC
|
|
19
|
-
* AGAINST IT. This docblock used to say the doc was reconciled by @SCN-CLI-007/008; it is not —
|
|
20
|
-
* those two are about the registry and the two RENDERERS, and nothing in `tests/` or `features/`
|
|
21
|
-
* reads doc/how_to_use.md at all (3F-3256 deleted the checks that read documentation). So the
|
|
22
|
-
* flag table in that page is kept in step by hand, and it has drifted in BOTH directions before
|
|
23
|
-
* now: ahead of the registry on one sentence and behind it on the next (3F-3083).
|
|
24
|
-
*/
|
|
25
1
|
import { DEFAULT_DEFERRAL_TAGS } from "./deferralTags.js";
|
|
26
|
-
|
|
27
|
-
* The `balance` command's per-command scope — its reconciliation flags plus `--help`/`-h`.
|
|
28
|
-
* This registry is where a flag's description LIVES; doc/how_to_use.md's flag table restates it
|
|
29
|
-
* by hand, reconciled by nobody (see the header).
|
|
30
|
-
*/
|
|
2
|
+
import { APP_MESSAGES, AppMessage } from "./messages.js";
|
|
31
3
|
const balanceFlags = [
|
|
32
4
|
{
|
|
33
5
|
name: "--features",
|
|
34
6
|
arg: "<dir>",
|
|
35
|
-
description:
|
|
7
|
+
description: APP_MESSAGES[AppMessage.FeaturesFlag](),
|
|
36
8
|
},
|
|
37
9
|
{
|
|
38
10
|
name: "--vitest",
|
|
39
11
|
arg: "<report.json>",
|
|
40
|
-
description:
|
|
12
|
+
description: APP_MESSAGES[AppMessage.VitestFlag](),
|
|
41
13
|
},
|
|
42
14
|
{
|
|
43
15
|
name: "--cucumber",
|
|
44
16
|
arg: "<report.json>",
|
|
45
|
-
description:
|
|
17
|
+
description: APP_MESSAGES[AppMessage.CucumberFlag](),
|
|
46
18
|
},
|
|
47
19
|
{
|
|
48
20
|
name: "--ci",
|
|
49
21
|
arg: "<ci.yml>",
|
|
50
|
-
description:
|
|
22
|
+
description: APP_MESSAGES[AppMessage.CiFlag](),
|
|
51
23
|
},
|
|
52
24
|
{
|
|
53
25
|
name: "--package-json",
|
|
54
26
|
arg: "<path>",
|
|
55
|
-
description:
|
|
27
|
+
description: APP_MESSAGES[AppMessage.PackageJsonFlag](),
|
|
56
28
|
},
|
|
57
29
|
{
|
|
58
30
|
name: "--ci-steps",
|
|
59
31
|
arg: "<record.json>",
|
|
60
|
-
description:
|
|
32
|
+
description: APP_MESSAGES[AppMessage.CiStepsFlag](),
|
|
61
33
|
},
|
|
62
34
|
{
|
|
63
35
|
name: "--target",
|
|
64
36
|
arg: "<name>",
|
|
65
|
-
description:
|
|
37
|
+
description: APP_MESSAGES[AppMessage.TargetFlag](),
|
|
66
38
|
},
|
|
67
39
|
{
|
|
68
40
|
name: "--source-sha",
|
|
69
41
|
arg: "<sha>",
|
|
70
|
-
description:
|
|
42
|
+
description: APP_MESSAGES[AppMessage.SourceShaFlag](),
|
|
71
43
|
},
|
|
72
44
|
{
|
|
73
45
|
name: "--format",
|
|
74
46
|
arg: "<fmt>[:<path>]",
|
|
75
47
|
repeatable: true,
|
|
76
|
-
description:
|
|
48
|
+
description: APP_MESSAGES[AppMessage.FormatFlag](),
|
|
77
49
|
},
|
|
78
50
|
{
|
|
79
51
|
name: "--render-from-json",
|
|
80
52
|
arg: "<path>",
|
|
81
|
-
description:
|
|
53
|
+
description: APP_MESSAGES[AppMessage.RenderFromJsonFlag](),
|
|
82
54
|
},
|
|
83
55
|
{
|
|
84
56
|
name: "--strict",
|
|
85
|
-
description:
|
|
57
|
+
description: APP_MESSAGES[AppMessage.StrictFlag](),
|
|
86
58
|
},
|
|
87
59
|
{
|
|
88
60
|
name: "--exit-zero",
|
|
89
|
-
description:
|
|
61
|
+
description: APP_MESSAGES[AppMessage.ExitZeroFlag](),
|
|
90
62
|
},
|
|
91
63
|
{
|
|
92
64
|
name: "--help",
|
|
93
65
|
aliases: ["-h"],
|
|
94
|
-
description:
|
|
66
|
+
description: APP_MESSAGES[AppMessage.HelpFlag](),
|
|
95
67
|
},
|
|
96
68
|
];
|
|
97
|
-
/**
|
|
98
|
-
* `balance`'s config block: the `specController.deferralTags` field it reads, with its
|
|
99
|
-
* recognised starter set SINGLE-SOURCED from DEFAULT_DEFERRAL_TAGS (@SCN-PND-021 / the
|
|
100
|
-
* 3F-1405 completeness discipline — the lines are built FROM the constant, never a
|
|
101
|
-
* hand-kept copy, so the documented set cannot drift from the recognised one). It hangs
|
|
102
|
-
* off balance's registry entry, not off the renderer, so it renders under `balance --help`
|
|
103
|
-
* and under nothing else.
|
|
104
|
-
*/
|
|
105
69
|
const balanceConfigHelp = [
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
`
|
|
70
|
+
APP_MESSAGES[AppMessage.ConfigurationHeading](),
|
|
71
|
+
` ${APP_MESSAGES[AppMessage.DeferralTagsKey]()}`,
|
|
72
|
+
` ${APP_MESSAGES[AppMessage.DeferralTagsExtend]()}`,
|
|
73
|
+
` ${APP_MESSAGES[AppMessage.DeferralTagsNeverReplace]()}`,
|
|
74
|
+
` ${APP_MESSAGES[AppMessage.BuiltInDeferralTags](DEFAULT_DEFERRAL_TAGS.map((tag) => `@${tag}`).join(", "))}`,
|
|
111
75
|
];
|
|
112
|
-
|
|
113
|
-
* The `tags` command's per-command scope (3F-3300). Two input flags and `--help`/`-h`, and the
|
|
114
|
-
* two are `balance`'s own spellings on purpose: a consumer pointing one command at a corpus and a
|
|
115
|
-
* manifest should not have to learn a second name for each when they point the other at the same
|
|
116
|
-
* two files. The descriptions are this command's — what it reads them FOR is not what `balance`
|
|
117
|
-
* reads them for — but the flags are the same flags.
|
|
118
|
-
*
|
|
119
|
-
* NO `configHelp`. A command's config block documents the `package.json` fields THAT command
|
|
120
|
-
* reads, and `tags` reads none yet: the check-tag union and the recognised deferral set arrive
|
|
121
|
-
* with the grammar rules (3F-3302 onward), and the entry gains its block then. Appending
|
|
122
|
-
* `balance`'s block here would document, under this command, fields this command does not read —
|
|
123
|
-
* which is the fault 3F-3298 moved that block onto a command entry to prevent.
|
|
124
|
-
*/
|
|
125
|
-
const tagsFlags = [
|
|
76
|
+
const balanceRetiredFlags = [
|
|
126
77
|
{
|
|
127
|
-
name: "--
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: "--package-json",
|
|
133
|
-
arg: "<path>",
|
|
134
|
-
description: "The target's package.json — its specController block, from which the words that name a check and the tags that park a scenario are resolved (default ./package.json).",
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: "--help",
|
|
138
|
-
aliases: ["-h"],
|
|
139
|
-
description: "Show this help and exit.",
|
|
78
|
+
name: "--measurements",
|
|
79
|
+
retiredIn: "0.1.0-alpha.5",
|
|
80
|
+
replacement: APP_MESSAGES[AppMessage.MeasurementsReplacement](),
|
|
140
81
|
},
|
|
141
82
|
];
|
|
142
|
-
/** The global host-modifier scope — recognised before the command; the CLI-007 surface. */
|
|
143
83
|
const globalFlags = [
|
|
144
84
|
{
|
|
145
85
|
name: "--store",
|
|
146
86
|
arg: "<root>",
|
|
147
|
-
description:
|
|
87
|
+
description: APP_MESSAGES[AppMessage.StoreModifier](),
|
|
148
88
|
},
|
|
149
89
|
{
|
|
150
90
|
name: "--run-id",
|
|
151
91
|
arg: "<id>",
|
|
152
|
-
description:
|
|
92
|
+
description: APP_MESSAGES[AppMessage.RunIdModifier](),
|
|
153
93
|
},
|
|
154
94
|
];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
95
|
+
export const balanceCommand = {
|
|
96
|
+
name: "balance",
|
|
97
|
+
summary: APP_MESSAGES[AppMessage.BalanceSummary](),
|
|
98
|
+
flags: balanceFlags,
|
|
99
|
+
configHelp: balanceConfigHelp,
|
|
100
|
+
retiredFlags: balanceRetiredFlags,
|
|
101
|
+
};
|
|
102
|
+
export const allocateCommand = {
|
|
103
|
+
name: "allocate",
|
|
104
|
+
summary: APP_MESSAGES[AppMessage.AllocateSummary](),
|
|
105
|
+
acceptsHostModifiers: false,
|
|
106
|
+
positionals: [
|
|
107
|
+
{ name: "<FFF>", description: APP_MESSAGES[AppMessage.FeaturePartArgument]() },
|
|
108
|
+
],
|
|
109
|
+
flags: [
|
|
167
110
|
{
|
|
168
|
-
name: "
|
|
169
|
-
|
|
170
|
-
flags: tagsFlags,
|
|
111
|
+
name: "--new",
|
|
112
|
+
description: APP_MESSAGES[AppMessage.NewFlag](),
|
|
171
113
|
},
|
|
114
|
+
{ name: "--help", aliases: ["-h"], description: APP_MESSAGES[AppMessage.HelpFlag]() },
|
|
172
115
|
],
|
|
173
116
|
};
|
|
174
|
-
|
|
117
|
+
export const cliRegistry = {
|
|
118
|
+
global: globalFlags,
|
|
119
|
+
commands: [balanceCommand, allocateCommand],
|
|
120
|
+
};
|
|
175
121
|
function flagLabel(flag) {
|
|
176
122
|
const names = [flag.name, ...(flag.aliases ?? [])].join(", ");
|
|
177
123
|
return flag.arg !== undefined ? `${names} ${flag.arg}` : names;
|
|
178
124
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
* (name + arg-placeholder + description), then whatever config lines that command's entry
|
|
182
|
-
* carries — driven BY the registry, so a flag that exists is a flag that appears, by
|
|
183
|
-
* construction. Returns the help block WITHOUT a trailing newline (the caller adds it,
|
|
184
|
-
* matching the writer's stdout convention).
|
|
185
|
-
*
|
|
186
|
-
* THE COMMAND IS A PARAMETER (3F-3298). It used to be the literal `"balance"`, found by name
|
|
187
|
-
* inside this function, which is what the single registered command made look general. A
|
|
188
|
-
* second command had no help surface at all under that signature — not an empty one; there
|
|
189
|
-
* was no argument by which to ask. What the renderer covers is now the registry's shape
|
|
190
|
-
* rather than the command set's size on the day it was written.
|
|
191
|
-
*/
|
|
192
|
-
export function renderCommandHelp(registry, command) {
|
|
193
|
-
const entry = registry.commands.find((c) => c.name === command);
|
|
194
|
-
const flags = entry?.flags ?? [];
|
|
125
|
+
export function renderCommandHelp(command) {
|
|
126
|
+
const flags = command.flags;
|
|
195
127
|
const gutter = 2;
|
|
196
128
|
const labelWidth = Math.max(0, ...flags.map((f) => flagLabel(f).length));
|
|
197
129
|
const lines = flags.map((flag) => ` ${flagLabel(flag).padEnd(labelWidth + gutter)}${flag.description}`);
|
|
198
|
-
const configHelp =
|
|
130
|
+
const configHelp = command.configHelp ?? [];
|
|
199
131
|
return [
|
|
200
|
-
`spec-controller ${command} — ${
|
|
132
|
+
`spec-controller ${command.name} — ${command.summary}`,
|
|
133
|
+
...positionalHelp(command.name, command.positionals ?? []),
|
|
201
134
|
"",
|
|
202
|
-
|
|
135
|
+
APP_MESSAGES[AppMessage.HelpOptions](),
|
|
203
136
|
...lines,
|
|
204
137
|
...(configHelp.length > 0 ? ["", ...configHelp] : []),
|
|
205
138
|
].join("\n");
|
|
206
139
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
140
|
+
function positionalHelp(command, positionals) {
|
|
141
|
+
if (positionals.length === 0)
|
|
142
|
+
return [];
|
|
143
|
+
const width = Math.max(...positionals.map((positional) => positional.name.length));
|
|
144
|
+
return [
|
|
145
|
+
"",
|
|
146
|
+
`${APP_MESSAGES[AppMessage.HelpUsage]()} spec-controller ${command} ${positionals.map((positional) => positional.name).join(" ")} [options]`,
|
|
147
|
+
"",
|
|
148
|
+
APP_MESSAGES[AppMessage.HelpArguments](),
|
|
149
|
+
...positionals.map((positional) => ` ${positional.name.padEnd(width + 2)}${positional.description}`),
|
|
150
|
+
];
|
|
151
|
+
}
|
|
217
152
|
export function renderTopLevelHelp(registry) {
|
|
218
153
|
const commandGutter = 4;
|
|
219
154
|
const commandWidth = Math.max(0, ...registry.commands.map((c) => c.name.length));
|
|
@@ -223,18 +158,18 @@ export function renderTopLevelHelp(registry) {
|
|
|
223
158
|
const modifierLines = registry.global.map((flag) => ` ${flagLabel(flag).padEnd(modifierWidth + modifierGutter)}${flag.description}`);
|
|
224
159
|
const modifierUsage = registry.global.map((flag) => `[${flagLabel(flag)}]`).join(" ");
|
|
225
160
|
return [
|
|
226
|
-
|
|
161
|
+
APP_MESSAGES[AppMessage.HelpTitle](),
|
|
227
162
|
"",
|
|
228
|
-
|
|
229
|
-
`
|
|
163
|
+
APP_MESSAGES[AppMessage.HelpUsage](),
|
|
164
|
+
` ${APP_MESSAGES[AppMessage.HelpUsageLine](modifierUsage)}`,
|
|
230
165
|
"",
|
|
231
|
-
|
|
166
|
+
APP_MESSAGES[AppMessage.HelpCommands](),
|
|
232
167
|
...commandLines,
|
|
233
168
|
"",
|
|
234
|
-
|
|
169
|
+
APP_MESSAGES[AppMessage.HelpHostModifiers](),
|
|
235
170
|
...modifierLines,
|
|
236
171
|
"",
|
|
237
|
-
|
|
172
|
+
APP_MESSAGES[AppMessage.HelpPointer](),
|
|
238
173
|
].join("\n");
|
|
239
174
|
}
|
|
240
175
|
//# sourceMappingURL=cli-registry.js.map
|
package/dist/cli-registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-registry.js","sourceRoot":"","sources":["../src/cli-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cli-registry.js","sourceRoot":"","sources":["../src/cli-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoCzD,MAAM,YAAY,GAAe;IAC/B;QACE,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,OAAO;QACZ,WAAW,EAAE,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;KACrD;IACD;QACE,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,eAAe;QACpB,WAAW,EAAE,YAAY,CAAC,UAAU,CAAC,U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,CAAC;IACtF,OAAO;QACL,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACpC,EAAE;QACF,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACpC,KAAK,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,EAAE;QAC5D,EAAE;QACF,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QACvC,GAAG,YAAY;QACf,EAAE;QACF,YAAY,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;QAC5C,GAAG,aAAa;QAChB,EAAE;QACF,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;KACvC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* The `spec-controller` binary — the top-level command host + dispatcher.
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* spec-controller [--store <root>] [--run-id <id>] <command> [command-args]
|
|
7
|
-
*
|
|
8
|
-
* Commands: `balance` — the deterministic reconciliation of scenarios against
|
|
9
|
-
* observed evidence, standalone on the public core + app layer (no engine); `tags` — the
|
|
10
|
-
* @SCN scheme policing itself over the same corpus, which is a fault about the corpus rather
|
|
11
|
-
* than a verdict about its evidence, and so has its own status ladder rather than a fifth
|
|
12
|
-
* meaning on balance's. The `analyse` / `migrate` capabilities are a separate, closed offering
|
|
13
|
-
* built on the same core.
|
|
14
|
-
*
|
|
15
|
-
* Storage is a CROSS-CUTTING host modifier, not a command. A leading `--store <root>`
|
|
16
|
-
* turns any command into a STORED run: the host wraps the command via the kept-run
|
|
17
|
-
* scaffold — a named `<root>/<target>/<run-id>/` directory, the command's outputs routed
|
|
18
|
-
* in, and a `run.yaml` manifest — and hands the command its own clean args, unchanged. So
|
|
19
|
-
* `balance` stays emit-only (its default, no-store output is byte-identical); the store
|
|
20
|
-
* opinion lives at the host, injected via `--store` (required — there is no default, a
|
|
21
|
-
* default would write inside the repo). `--run-id` defaults to a timestamp.
|
|
22
|
-
*/
|
|
23
2
|
export {};
|
|
24
3
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|