spec-controller 0.1.0-alpha.31 → 0.1.0-alpha.33
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 +2 -0
- package/dist/cli-args.d.ts +17 -18
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +22 -21
- package/dist/cli-args.js.map +1 -1
- package/dist/cli-balance/cli.d.ts +11 -11
- package/dist/cli-balance/cli.d.ts.map +1 -1
- package/dist/cli-balance/cli.js +68 -161
- package/dist/cli-balance/cli.js.map +1 -1
- package/dist/cli-balance/exitStatus.d.ts +3 -0
- package/dist/cli-balance/exitStatus.d.ts.map +1 -0
- package/dist/cli-balance/exitStatus.js +12 -0
- package/dist/cli-balance/exitStatus.js.map +1 -0
- package/dist/cli-balance/reRender.d.ts +22 -0
- package/dist/cli-balance/reRender.d.ts.map +1 -0
- package/dist/cli-balance/reRender.js +36 -0
- package/dist/cli-balance/reRender.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +14 -13
- package/dist/cli.js.map +1 -1
- package/dist/run-management/keptRun.d.ts +16 -9
- package/dist/run-management/keptRun.d.ts.map +1 -1
- package/dist/run-management/keptRun.js +8 -4
- package/dist/run-management/keptRun.js.map +1 -1
- package/dist/storedRun.d.ts +18 -0
- package/dist/storedRun.d.ts.map +1 -0
- package/dist/storedRun.js +29 -0
- package/dist/storedRun.js.map +1 -0
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Commands: `balance` — the deterministic reconciliation of scenarios against
|
|
9
9
|
* observed evidence, standalone on the public core + app layer (no engine). It also polices the
|
|
10
|
-
* corpus's own scenario codes
|
|
10
|
+
* corpus's own scenario codes. `allocate` — a query, not a verdict: the next scenario code
|
|
11
11
|
* for a feature part, which keeps no run and so takes no host modifier. The
|
|
12
12
|
* `analyse` / `migrate` capabilities are a separate, closed offering built on the same core.
|
|
13
13
|
*
|
|
@@ -26,15 +26,15 @@ import { resolveSourceSha, resolveToolIdentity } from "./run-management/resolveR
|
|
|
26
26
|
import { executeKeptRun, resolveRunId, } from "./run-management/keptRun.js";
|
|
27
27
|
import { parseHostInvocation, wrapCommandArgv, peekFlag, answerUnknownCommand, modifiersNotTakenRefusal, } from "./host.js";
|
|
28
28
|
import { cliRegistry, renderTopLevelHelp } from "./cli-registry.js";
|
|
29
|
-
|
|
29
|
+
import { dispatchesUnstored, storedReRenderRefusal } from "./storedRun.js";
|
|
30
|
+
/** Dispatch a command to its handler with the given (clean or store-wrapped) argv; true when it wrote its report. */
|
|
30
31
|
function runCommand(command, argv) {
|
|
31
32
|
switch (command) {
|
|
32
33
|
case "balance":
|
|
33
|
-
runBalance(argv);
|
|
34
|
-
return;
|
|
34
|
+
return runBalance(argv);
|
|
35
35
|
case "allocate":
|
|
36
36
|
runAllocate(argv);
|
|
37
|
-
return;
|
|
37
|
+
return false;
|
|
38
38
|
default: {
|
|
39
39
|
const answer = answerUnknownCommand(command, renderTopLevelHelp(cliRegistry));
|
|
40
40
|
process.stderr.write(answer.stderr);
|
|
@@ -44,11 +44,11 @@ function runCommand(command, argv) {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Refuse, at the usage status, what the leading tokens get wrong, before any command or stored run
|
|
47
|
-
* starts, so nothing is written anywhere: a usage fault among them
|
|
48
|
-
* that would keep a run given to a command that keeps none.
|
|
47
|
+
* starts, so nothing is written anywhere: a usage fault among them, or modifiers
|
|
48
|
+
* that would keep a run given to a command, or a re-render, that keeps none.
|
|
49
49
|
*/
|
|
50
50
|
function refuseLeadingFaults(inv) {
|
|
51
|
-
const refusal = inv.refusal ?? modifiersNotTakenRefusal(inv);
|
|
51
|
+
const refusal = inv.refusal ?? modifiersNotTakenRefusal(inv) ?? storedReRenderRefusal(inv);
|
|
52
52
|
if (refusal === undefined)
|
|
53
53
|
return;
|
|
54
54
|
process.stderr.write(refusal + "\n");
|
|
@@ -62,8 +62,8 @@ function main(hostArgv) {
|
|
|
62
62
|
process.stdout.write(renderTopLevelHelp(cliRegistry) + "\n");
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
// No store directive → dispatch the command directly; its output is unchanged.
|
|
66
|
-
if (inv.store === undefined) {
|
|
65
|
+
// No store directive, or a request for help → dispatch the command directly; its output is unchanged.
|
|
66
|
+
if (dispatchesUnstored(inv) || inv.store === undefined) {
|
|
67
67
|
runCommand(command, inv.commandArgs);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
@@ -83,7 +83,7 @@ function main(hostArgv) {
|
|
|
83
83
|
const spec = { storeRoot: inv.store, target, runId };
|
|
84
84
|
// `mode` is the command's run kind; only `balance` ships today (analyse/migrate are the
|
|
85
85
|
// private engine's, added when it lands).
|
|
86
|
-
// The TOOL's own identity
|
|
86
|
+
// The TOOL's own identity — which spec-controller produced this run, read
|
|
87
87
|
// from the tool's OWN dir (never cwd, which is the target). "unknown" for a null SHA,
|
|
88
88
|
// matching sourceSha's own fallback so run.yaml is internally consistent.
|
|
89
89
|
const toolIdentity = resolveToolIdentity();
|
|
@@ -95,8 +95,9 @@ function main(hostArgv) {
|
|
|
95
95
|
date: new Date().toISOString(),
|
|
96
96
|
};
|
|
97
97
|
const plan = executeKeptRun(spec, meta, (formatSpecs) => runCommand(command, wrapCommandArgv(inv.commandArgs, [...formatSpecs])));
|
|
98
|
-
// The command's
|
|
99
|
-
|
|
98
|
+
// The command's report was routed into the run dir, so tell the operator where it landed.
|
|
99
|
+
if (plan !== undefined)
|
|
100
|
+
process.stdout.write(plan.runDir + "\n");
|
|
100
101
|
}
|
|
101
102
|
main(process.argv.slice(2));
|
|
102
103
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,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AAW,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CACxE,CAAC;IAEF,0FAA0F;IAC1F,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -94,12 +94,16 @@ export interface KeptRunPlan {
|
|
|
94
94
|
readonly reconciliationJsonPath: string;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Invokes the reconciliation tool with the given `--format <fmt>:<path>` specs
|
|
98
|
-
*
|
|
99
|
-
* `@integration` arm) and holds no opinion on
|
|
100
|
-
* land (the two file-dest paths the runner hands it).
|
|
97
|
+
* Invokes the reconciliation tool with the given `--format <fmt>:<path>` specs, and answers
|
|
98
|
+
* whether it wrote the report those specs name. INJECTED so the scaffold stays the tool's
|
|
99
|
+
* black-box caller (the real CLI subprocess in the `@integration` arm) and holds no opinion on
|
|
100
|
+
* HOW the tool is run — only WHERE its outputs land (the two file-dest paths the runner hands it).
|
|
101
|
+
*
|
|
102
|
+
* The answer is the command's own, and positive: only the command knows it wrote its report. The
|
|
103
|
+
* files' existence afterwards cannot say so, because an earlier run under the same run-id may
|
|
104
|
+
* have left them there.
|
|
101
105
|
*/
|
|
102
|
-
export type RouteOutputs = (formatSpecs: readonly string[]) =>
|
|
106
|
+
export type RouteOutputs = (formatSpecs: readonly string[]) => boolean;
|
|
103
107
|
/**
|
|
104
108
|
* PURE planner: yield the run dir `<storeRoot>/<target>/<runId>/` and the two file-dest
|
|
105
109
|
* paths (`<dir>/spec-reconciliation.md`, `<dir>/spec-reconciliation.json`) from the spec. No
|
|
@@ -143,9 +147,12 @@ export declare function serialiseRunManifest(manifest: RunManifest): string;
|
|
|
143
147
|
/**
|
|
144
148
|
* IMPURE runner: `mkdir -p` the run dir, route the tool's `--format` outputs into the two files
|
|
145
149
|
* via the injected `route` — the document as `md:<documentPath>`, the reconciliation JSON as
|
|
146
|
-
* `json:<reconciliationJsonPath>` — and
|
|
147
|
-
*
|
|
148
|
-
*
|
|
150
|
+
* `json:<reconciliationJsonPath>` — and, only when the route answers that it wrote them, stamp
|
|
151
|
+
* `run.yaml` from the spec + `meta` and return the plan it realised. A route that wrote nothing
|
|
152
|
+
* gets no manifest and no plan back, so nothing names a run that did not happen, and an earlier
|
|
153
|
+
* run's manifest under the same run-id is left as it was. The `mkdir` is load-bearing: the tool's
|
|
154
|
+
* writer creates no directories, so the scaffold creates the one the location-agnostic tool
|
|
155
|
+
* writes into.
|
|
149
156
|
*/
|
|
150
|
-
export declare function executeKeptRun(spec: KeptRunSpec, meta: RunManifestMeta, route: RouteOutputs): KeptRunPlan;
|
|
157
|
+
export declare function executeKeptRun(spec: KeptRunSpec, meta: RunManifestMeta, route: RouteOutputs): KeptRunPlan | undefined;
|
|
151
158
|
//# sourceMappingURL=keptRun.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keptRun.d.ts","sourceRoot":"","sources":["../../src/run-management/keptRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,8DAA8D;AAC9D,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,8CAA8C;AAC9C,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB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FAAmF;AACnF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAElE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,YAAY,GAClB,WAAW,GAAG,SAAS,CAYzB"}
|
|
@@ -112,14 +112,18 @@ export function serialiseRunManifest(manifest) {
|
|
|
112
112
|
/**
|
|
113
113
|
* IMPURE runner: `mkdir -p` the run dir, route the tool's `--format` outputs into the two files
|
|
114
114
|
* via the injected `route` — the document as `md:<documentPath>`, the reconciliation JSON as
|
|
115
|
-
* `json:<reconciliationJsonPath>` — and
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* `json:<reconciliationJsonPath>` — and, only when the route answers that it wrote them, stamp
|
|
116
|
+
* `run.yaml` from the spec + `meta` and return the plan it realised. A route that wrote nothing
|
|
117
|
+
* gets no manifest and no plan back, so nothing names a run that did not happen, and an earlier
|
|
118
|
+
* run's manifest under the same run-id is left as it was. The `mkdir` is load-bearing: the tool's
|
|
119
|
+
* writer creates no directories, so the scaffold creates the one the location-agnostic tool
|
|
120
|
+
* writes into.
|
|
118
121
|
*/
|
|
119
122
|
export function executeKeptRun(spec, meta, route) {
|
|
120
123
|
const plan = planKeptRun(spec);
|
|
121
124
|
writeOrRefuse("The stored run's directory could not be created", plan.runDir, () => mkdirSync(plan.runDir, { recursive: true }));
|
|
122
|
-
route([`md:${plan.documentPath}`, `json:${plan.reconciliationJsonPath}`])
|
|
125
|
+
if (!route([`md:${plan.documentPath}`, `json:${plan.reconciliationJsonPath}`]))
|
|
126
|
+
return undefined;
|
|
123
127
|
const manifest = planRunManifest({ runId: spec.runId, target: spec.target, ...meta });
|
|
124
128
|
const manifestPath = join(plan.runDir, RUN_MANIFEST);
|
|
125
129
|
writeOrRefuse("The stored run's run.yaml could not be written", manifestPath, () => writeFileSync(manifestPath, serialiseRunManifest(manifest)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keptRun.js","sourceRoot":"","sources":["../../src/run-management/keptRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAChE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"keptRun.js","sourceRoot":"","sources":["../../src/run-management/keptRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAChE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AA+E7C;;;;;GAKG;AACH,MAAM,UAAU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B;SACpC;KACF,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,oBAAoB,CAAC,QAAqB;IACxD,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAiB,EACjB,IAAqB,EACrB,KAAmB;IAEnB,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,aAAa,CAAC,iDAAiD,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CACjF,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAC5C,CAAC;IACF,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACjG,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACtF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrD,aAAa,CAAC,gDAAgD,EAAE,YAAY,EAAE,GAAG,EAAE,CACjF,aAAa,CAAC,YAAY,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAC5D,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host does with a command before a stored run starts: dispatch it unwrapped, or wrap it
|
|
3
|
+
* in the kept-run scaffold. Pure, so `cli.ts`'s dispatcher reads its answer rather than deciding.
|
|
4
|
+
*/
|
|
5
|
+
import type { HostInvocation } from "./host.js";
|
|
6
|
+
/**
|
|
7
|
+
* True when the host dispatches the command itself, never inside a stored run: no store was asked
|
|
8
|
+
* for, or the command's help was, which is answered before the store is touched.
|
|
9
|
+
*/
|
|
10
|
+
export declare function dispatchesUnstored(inv: HostInvocation): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The refusal for a re-render given a store, else undefined: a re-render writes only to stdout and
|
|
13
|
+
* keeps no run. It is the host's to refuse, not `balance`'s, because a stored run hands `balance` a
|
|
14
|
+
* `--format` for each report file, and `balance` cannot tell that one from a `--format` the operator
|
|
15
|
+
* typed; only the host knows which host modifiers were given.
|
|
16
|
+
*/
|
|
17
|
+
export declare function storedReRenderRefusal(inv: HostInvocation): string | undefined;
|
|
18
|
+
//# sourceMappingURL=storedRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedRun.d.ts","sourceRoot":"","sources":["../src/storedRun.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAS7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host does with a command before a stored run starts: dispatch it unwrapped, or wrap it
|
|
3
|
+
* in the kept-run scaffold. Pure, so `cli.ts`'s dispatcher reads its answer rather than deciding.
|
|
4
|
+
*/
|
|
5
|
+
import { asksForHelp } from "./cli-args.js";
|
|
6
|
+
/**
|
|
7
|
+
* True when the host dispatches the command itself, never inside a stored run: no store was asked
|
|
8
|
+
* for, or the command's help was, which is answered before the store is touched.
|
|
9
|
+
*/
|
|
10
|
+
export function dispatchesUnstored(inv) {
|
|
11
|
+
return inv.store === undefined || asksForHelp(inv.commandArgs);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The refusal for a re-render given a store, else undefined: a re-render writes only to stdout and
|
|
15
|
+
* keeps no run. It is the host's to refuse, not `balance`'s, because a stored run hands `balance` a
|
|
16
|
+
* `--format` for each report file, and `balance` cannot tell that one from a `--format` the operator
|
|
17
|
+
* typed; only the host knows which host modifiers were given.
|
|
18
|
+
*/
|
|
19
|
+
export function storedReRenderRefusal(inv) {
|
|
20
|
+
if (dispatchesUnstored(inv) || inv.command !== "balance")
|
|
21
|
+
return undefined;
|
|
22
|
+
if (!inv.commandArgs.includes("--render-from-json"))
|
|
23
|
+
return undefined;
|
|
24
|
+
const given = inv.runId === undefined ? ["--store"] : ["--store", "--run-id"];
|
|
25
|
+
return (`spec-controller: usage error — 'balance --render-from-json' re-renders a saved report to stdout and keeps no run, ` +
|
|
26
|
+
`and was given ${given.join(", ")}: a re-render is not stored.\n` +
|
|
27
|
+
`Run 'spec-controller balance --render-from-json <path>' without ${given.length === 1 ? "it" : "them"}.`);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=storedRun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedRun.js","sourceRoot":"","sources":["../src/storedRun.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAmB;IACpD,OAAO,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAmB;IACvD,IAAI,kBAAkB,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC3E,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,SAAS,CAAC;IACtE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC9E,OAAO,CACL,oHAAoH;QACpH,iBAAiB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC;QACjE,mEAAmE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CACzG,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-controller",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.33",
|
|
4
4
|
"description": "Reconcile the behaviour your scenarios name against the evidence that actually ran — the deterministic `balance` CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reconciliation",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@cucumber/gherkin": "^41.0.0",
|
|
26
26
|
"@cucumber/messages": "^34.0.1",
|
|
27
27
|
"yaml": "^2.9.0",
|
|
28
|
-
"@3f-consulting/spec-controller-core": "0.1.0-alpha.
|
|
28
|
+
"@3f-consulting/spec-controller-core": "0.1.0-alpha.33"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|