spec-controller 0.1.0-alpha.31 → 0.1.0-alpha.32

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 CHANGED
@@ -74,6 +74,8 @@ The whole report is written before the code is set, so a failing run still tells
74
74
 
75
75
  `--exit-zero` moves `1` and `3` to `0` and leaves every other code alone: see *Report first, gate later*.
76
76
 
77
+ `balance --render-from-json <saved.json>` re-renders a saved report and exits the code its verdict names, from the same table: a saved run that failed fails again when it is read back. A report saved under `--strict` records it, so its re-render exits `3` too, and `--strict` or `--exit-zero` beside the re-render work as they do live. Any other flag beside it is refused at `2`, because a re-render reads no live input and writes only to stdout.
78
+
77
79
  **Node's default is never one of these.** A run that cannot reconcile ends on an enumerated code of
78
80
  its own rather than falling out of the process — a crash that exits `1` would be indistinguishable,
79
81
  by status, from an honest disagreement. **An input the tool cannot read is part of `2`**: a mistyped
@@ -12,7 +12,7 @@
12
12
  * [--format <fmt>[:<path>]]
13
13
  */
14
14
  /**
15
- * The legacy-`--json` guard at the CLI edge (@SCN-FMT-006). The earlier
15
+ * The legacy-`--json` guard at the CLI edge. The earlier
16
16
  * `--json <path>` flag is removed; supplying it must fail fast with a migration hint to
17
17
  * `--format json:<path>`, so the removed flag never silently no-ops and drops output. PURE
18
18
  * and `@unit`-testable: the removed flag is NOT a `--format` spec (planOutput never sees
@@ -22,8 +22,8 @@
22
22
  */
23
23
  export declare function checkLegacyJson(args: Record<string, string>): string | null;
24
24
  /**
25
- * Source the provenance "Target repo:" name for a run (@SCN-RPT-001 Update —
26
- * Fork A). The operator's `--target` is recorded VERBATIM — no resolution — defaulting to
25
+ * Source the provenance "Target repo:" name for a run. The
26
+ * operator's `--target` is recorded VERBATIM — no resolution — defaulting to
27
27
  * `"unknown-target"` when omitted (parallel to `sourceSha`'s `"unknown"`; the facts
28
28
  * artefact is self-describing, so the line always renders). PURE and `@unit`-testable at
29
29
  * the CLI edge, like `checkLegacyJson`. It never inspects `--features`: the prior
@@ -33,7 +33,7 @@ export declare function checkLegacyJson(args: Record<string, string>): string |
33
33
  */
34
34
  export declare function sourceTarget(args: Record<string, string>): string;
35
35
  /**
36
- * Guard the supplied input-file/dir flags at the CLI edge (@SCN-CLI-002). A
36
+ * Guard the supplied input-file/dir flags at the CLI edge. A
37
37
  * mistyped `--vitest` / `--cucumber` / `--features` / `--ci` / `--package-json`
38
38
  * pointing at a non-existent path used to reconcile silently against ZERO evidence —
39
39
  * a terrifying false all-red report meaning "you forgot the reports", not "your code
@@ -51,13 +51,13 @@ export declare function sourceTarget(args: Record<string, string>): string;
51
51
  */
52
52
  export declare function checkInputsExist(args: Record<string, string>, exists: (path: string) => boolean): string | null;
53
53
  /**
54
- * Guard the READABILITY of the supplied JSON inputs at the CLI edge (@SCN-CLI-014).
54
+ * Guard the READABILITY of the supplied JSON inputs at the CLI edge.
55
55
  * `checkInputsExist` already guards their PRESENCE — but a path that is present yet
56
56
  * UNPARSEABLE fell straight through it: the reader threw mid-parse, nothing caught it, and
57
57
  * the process hit Node's default exit 1 — the code reserved for a genuine OUT-OF-BALANCE
58
58
  * verdict. A crashed invocation was therefore indistinguishable, by exit code, from an
59
- * honest disagreement (3F-1742). An input the tool cannot read is a USAGE fault: exit 2,
60
- * sibling to a missing path (@SCN-CLI-002) and an unrecognised flag (@SCN-CLI-009).
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
61
  *
62
62
  * PURE and `@unit`-testable like its sibling guards: reads the parsed args + an injected
63
63
  * `read` fn (no fs), returns the FIRST supplied-but-unparseable `(flag, path, failure)` as
@@ -67,12 +67,12 @@ export declare function checkInputsExist(args: Record<string, string>, exists: (
67
67
  */
68
68
  export declare function checkInputsParse(args: Record<string, string>, read: (path: string) => string): string | null;
69
69
  /**
70
- * Guard the readability of `--render-from-json` at the CLI edge (@SCN-CLI-015). The
70
+ * Guard the readability of `--render-from-json` at the CLI edge. The
71
71
  * render-from-saved-JSON branch RETURNS before the input guards ever run, so it honoured
72
72
  * NEITHER: a missing path crashed to `ENOENT` and a malformed file to `SyntaxError`, both
73
- * landing on Node's default exit 1 — the out-of-balance code (3F-1764).
73
+ * landing on Node's default exit 1 — the out-of-balance code.
74
74
  *
75
- * The missing-path case was a live violation of @SCN-CLI-002's own shipped principle: a
75
+ * The missing-path case was a live violation of the missing-input rule's own shipped principle: a
76
76
  * supplied input path that does not exist is a hard error at exit 2, enforced for the five
77
77
  * evidence flags and not for this one. The CLI shipped a guard that half-honoured its Rule.
78
78
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAuDH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAS3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEjE;AAqBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,GAAG,IAAI,CAcf;AAYD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAef;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAcf;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAoK/C"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoDH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAS3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAEjE;AAqBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,GAAG,IAAI,CAcf;AAYD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAef;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC7B,MAAM,GAAG,IAAI,CAcf;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAwG/C"}
@@ -16,18 +16,20 @@ import { dirname } from "node:path";
16
16
  import { runReconcile, readEvidenceObligations, readFeatureNames, featureCorpusParseErrors, } from "../ingest/ingestQualityChecks.js";
17
17
  import { planOutput } from "./emit/format.js";
18
18
  import { writeOutputs } from "./emit/writer.js";
19
- import { renderReportFromJson, isBalanced, hasPendingItems, hasBrokenEvidence, hasNothingToReconcile, hasScenarioCodeErrors, } from "@3f-consulting/spec-controller-core";
19
+ import { checkReRenderFlags, reRender } from "./reRender.js";
20
+ import { statusFor } from "./exitStatus.js";
21
+ import { verdictCode, } from "@3f-consulting/spec-controller-core";
20
22
  import { resolveSourceSha, resolveTargetRoot, resolveToolIdentity } from "../run-management/resolveRunInputs.js";
21
23
  import { cliRegistry, renderCommandHelp } from "../cli-registry.js";
22
- // THE ARGV READING AND ITS REGISTRY BOUNDING, SHARED WITH EVERY OTHER COMMAND (3F-3300). Both
24
+ // THE ARGV READING AND ITS REGISTRY BOUNDING, SHARED WITH EVERY OTHER COMMAND. Both
23
25
  // lived here while `balance` was the only command; a second command needs them, and a second
24
26
  // copy of "what did the operator type" is the one thing this tree least wants two of.
25
27
  import { parseArgs, checkArgvShape, checkUnknownFlags, checkMissingValues, checkMisplacedHostModifiers, } from "../cli-args.js";
26
28
  /**
27
29
  * Collect the `--format <spec>` values from argv in order (the flag is REPEATABLE, unlike
28
30
  * the single-valued flags `parseArgs` records) — the raw specs `planOutput` parses. Empty
29
- * when no `--format` was given, which `planOutput` reads as the md→stdout default
30
- * (@SCN-FMT-001). Later sub-issues (FMT-004) route several specs in one invocation.
31
+ * when no `--format` was given, which `planOutput` reads as the md→stdout default.
32
+ * Several specs route in one invocation.
31
33
  */
32
34
  function collectFormatSpecs(argv) {
33
35
  const specs = [];
@@ -43,7 +45,7 @@ function collectFormatSpecs(argv) {
43
45
  return specs;
44
46
  }
45
47
  /**
46
- * The legacy-`--json` guard at the CLI edge (@SCN-FMT-006). The earlier
48
+ * The legacy-`--json` guard at the CLI edge. The earlier
47
49
  * `--json <path>` flag is removed; supplying it must fail fast with a migration hint to
48
50
  * `--format json:<path>`, so the removed flag never silently no-ops and drops output. PURE
49
51
  * and `@unit`-testable: the removed flag is NOT a `--format` spec (planOutput never sees
@@ -60,8 +62,8 @@ export function checkLegacyJson(args) {
60
62
  return null;
61
63
  }
62
64
  /**
63
- * Source the provenance "Target repo:" name for a run (@SCN-RPT-001 Update —
64
- * Fork A). The operator's `--target` is recorded VERBATIM — no resolution — defaulting to
65
+ * Source the provenance "Target repo:" name for a run. The
66
+ * operator's `--target` is recorded VERBATIM — no resolution — defaulting to
65
67
  * `"unknown-target"` when omitted (parallel to `sourceSha`'s `"unknown"`; the facts
66
68
  * artefact is self-describing, so the line always renders). PURE and `@unit`-testable at
67
69
  * the CLI edge, like `checkLegacyJson`. It never inspects `--features`: the prior
@@ -91,7 +93,7 @@ function reconcileInputsOf(args) {
91
93
  };
92
94
  }
93
95
  /**
94
- * Guard the supplied input-file/dir flags at the CLI edge (@SCN-CLI-002). A
96
+ * Guard the supplied input-file/dir flags at the CLI edge. A
95
97
  * mistyped `--vitest` / `--cucumber` / `--features` / `--ci` / `--package-json`
96
98
  * pointing at a non-existent path used to reconcile silently against ZERO evidence —
97
99
  * a terrifying false all-red report meaning "you forgot the reports", not "your code
@@ -126,19 +128,19 @@ export function checkInputsExist(args, exists) {
126
128
  * The JSON-BEARING input flags — the ones whose content is `JSON.parse`d, and so the only
127
129
  * ones whose content can throw. `--features` is Gherkin (parsed tolerantly) and `--ci` is
128
130
  * read as raw TEXT and scanned for `run:` steps — neither is JSON, neither can crash the
129
- * process, and on garbage both reconcile normally (verified, 3F-1742 Discovery).
131
+ * process, and on garbage both reconcile normally (verified).
130
132
  */
131
133
  const JSON_INPUT_FLAGS = [
132
134
  "vitest", "cucumber", "package-json", "ci-steps",
133
135
  ];
134
136
  /**
135
- * Guard the READABILITY of the supplied JSON inputs at the CLI edge (@SCN-CLI-014).
137
+ * Guard the READABILITY of the supplied JSON inputs at the CLI edge.
136
138
  * `checkInputsExist` already guards their PRESENCE — but a path that is present yet
137
139
  * UNPARSEABLE fell straight through it: the reader threw mid-parse, nothing caught it, and
138
140
  * the process hit Node's default exit 1 — the code reserved for a genuine OUT-OF-BALANCE
139
141
  * verdict. A crashed invocation was therefore indistinguishable, by exit code, from an
140
- * honest disagreement (3F-1742). An input the tool cannot read is a USAGE fault: exit 2,
141
- * sibling to a missing path (@SCN-CLI-002) and an unrecognised flag (@SCN-CLI-009).
142
+ * honest disagreement. An input the tool cannot read is a USAGE fault: exit 2,
143
+ * sibling to a missing path and an unrecognised flag.
142
144
  *
143
145
  * PURE and `@unit`-testable like its sibling guards: reads the parsed args + an injected
144
146
  * `read` fn (no fs), returns the FIRST supplied-but-unparseable `(flag, path, failure)` as
@@ -164,12 +166,12 @@ export function checkInputsParse(args, read) {
164
166
  return null;
165
167
  }
166
168
  /**
167
- * Guard the readability of `--render-from-json` at the CLI edge (@SCN-CLI-015). The
169
+ * Guard the readability of `--render-from-json` at the CLI edge. The
168
170
  * render-from-saved-JSON branch RETURNS before the input guards ever run, so it honoured
169
171
  * NEITHER: a missing path crashed to `ENOENT` and a malformed file to `SyntaxError`, both
170
- * landing on Node's default exit 1 — the out-of-balance code (3F-1764).
172
+ * landing on Node's default exit 1 — the out-of-balance code.
171
173
  *
172
- * The missing-path case was a live violation of @SCN-CLI-002's own shipped principle: a
174
+ * The missing-path case was a live violation of the missing-input rule's own shipped principle: a
173
175
  * supplied input path that does not exist is a hard error at exit 2, enforced for the five
174
176
  * evidence flags and not for this one. The CLI shipped a guard that half-honoured its Rule.
175
177
  *
@@ -196,7 +198,7 @@ export function checkRenderFromJson(args, read) {
196
198
  return null;
197
199
  }
198
200
  export function runBalance(argv) {
199
- // Answer `--help`/`-h` from the command/flag registry (@SCN-CLI-006) BEFORE any
201
+ // Answer `--help`/`-h` from the command/flag registry BEFORE any
200
202
  // parse or reconcile: render the balance command's per-command scope (a line per
201
203
  // registered flag — name + arg + description), leave process.exitCode at its default 0,
202
204
  // and return. This intercepts --help so it never falls through parseArgs as a stray flag
@@ -210,7 +212,7 @@ export function runBalance(argv) {
210
212
  // threaded through ctx.runStart to the renderers.
211
213
  const runStart = new Date();
212
214
  const args = parseArgs(argv);
213
- // Legacy-`--json` guard (@SCN-FMT-006): the earlier `--json <path>` flag is
215
+ // Legacy-`--json` guard: the earlier `--json <path>` flag is
214
216
  // removed. Reject it fast — before any reconcile or write — with a migration hint to
215
217
  // `--format json:<path>`, so the removed flag never silently no-ops and drops output. The
216
218
  // guard's typed error is routed to stderr + a non-zero exit, exactly as planOutput's error
@@ -218,21 +220,21 @@ export function runBalance(argv) {
218
220
  const legacyJsonError = checkLegacyJson(args);
219
221
  if (legacyJsonError)
220
222
  exitUsage(legacyJsonError);
221
- // A host modifier after the command is out of place, not unknown (@SCN-CLI-061, 3F-3639), so it is
223
+ // A host modifier after the command is out of place, not unknown, so it is
222
224
  // refused before the drift advice, through `process.exit` so a stored run is never stamped.
223
225
  const misplacedModifierError = checkMisplacedHostModifiers(args, cliRegistry, "balance");
224
226
  if (misplacedModifierError)
225
227
  exitUsage(misplacedModifierError);
226
- // Every token is a flag or the value of the flag before it (3F-3672), refused through
228
+ // Every token is a flag or the value of the flag before it, refused through
227
229
  // `process.exit` so a stored run is never stamped, and before the unknown-flag check below.
228
230
  const shapeError = checkArgvShape(argv, cliRegistry, "balance");
229
231
  if (shapeError)
230
232
  exitUsage(shapeError);
231
- // Registry-bounded flag NAMES (@SCN-CLI-009): `balance` accepts ONLY the flags its registry
233
+ // Registry-bounded flag NAMES: `balance` accepts ONLY the flags its registry
232
234
  // scope LISTS. An unregistered flag — a typo `--strcit`, a stray `--bogus` — is a USAGE error:
233
- // name it on stderr, set process.exitCode = 2 (the enumerated usage code, 3F-1414's 0/1/2
235
+ // name it on stderr, set process.exitCode = 2 (the enumerated usage code, the 0/1/2
234
236
  // taxonomy — never 1, never 0), and RETURN before any reconcile. It bounds names only; that every
235
- // other token is read or refused is the argv-shape check above (@SCN-CLI-062–066, 3F-3672).
237
+ // other token is read or refused is the argv-shape check above.
236
238
  // Runs AFTER the legacy-`--json` guard so `--json` keeps its specific migration hint, after the
237
239
  // misplaced-modifier refusal, so a `--store` / `--run-id` written after the command is named as
238
240
  // out of place rather than given pin advice, and after the argv-shape check, so `--format=json` is
@@ -244,9 +246,9 @@ export function runBalance(argv) {
244
246
  process.exitCode = 2;
245
247
  return;
246
248
  }
247
- // A flag that takes a value, given none (@SCN-CLI-058, 3F-3639), refused before anything reads
249
+ // A flag that takes a value, given none, refused before anything reads
248
250
  // the value `parseArgs` made up for it. `process.exit`, never a set status and a return: inside a
249
- // stored run the return would reach the kept-run scaffold, which stamps a run.yaml (3F-3650).
251
+ // stored run the return would reach the kept-run scaffold, which stamps a run.yaml.
250
252
  const missingValueError = checkMissingValues(argv, cliRegistry, "balance");
251
253
  if (missingValueError)
252
254
  exitUsage(missingValueError);
@@ -256,105 +258,45 @@ export function runBalance(argv) {
256
258
  const inputs = reconcileInputsOf(args);
257
259
  // Reconcile the obligation-vs-observation evidence into the Ledger. The runtime evidence-observation
258
260
  // views (Test volume, the evidence grid) are FOLDS the renderers derive off this Ledger's posted
259
- // credits (@SCN-RPT-010 / 3F-2103 — the census is retired), so they cannot drift from the
261
+ // credits (the census is retired), so they cannot drift from the
260
262
  // reconciler's verdict: they ARE the same rows. `withRuntimeObservations: true` (below) tells the
261
263
  // renderers the axis is in play.
262
264
  const balance = runReconcile(inputs);
263
- // Read the scenario-corpus census alongside the balance (@SCN-RPT-008) —
265
+ // Read the scenario-corpus census alongside the balance —
264
266
  // the raw-vs-parsed @SCN-occurrence delta over the same discovered feature corpus.
265
267
  // A sibling to the balance, threaded to the renderers via writeOutputs like ctx.
266
268
  const evidenceObligations = readEvidenceObligations(args["features"]);
267
- // The static-check kind-counts are a FOLD OVER THE LEDGER (@SCN-USG-001 / 3F-2118) — the
269
+ // The static-check kind-counts are a FOLD OVER THE LEDGER — the
268
270
  // renderers count the balance's own posted static-check credits (`staticObservationTally`), so
269
271
  // they cannot drift from the reconciler's verdict: they ARE the same rows. The parallel static
270
272
  // census is RETIRED; `withStaticChecks: true` (below) tells the renderers the axis is in play.
271
- // Read the target's feature-code→slug map alongside the balance (@SCN-RPT-006)
273
+ // Read the target's feature-code→slug map alongside the balance
272
274
  // — the by-feature cut's full-name labels. The 5th sibling, threaded to the MARKDOWN
273
275
  // renderer via writeOutputs only (markdown-only; the by-feature cut isn't on JSON).
274
276
  const featureNames = readFeatureNames(args["features"]);
275
277
  const ctx = runContextOf(args, inputs, runStart);
276
278
  // Plan the outputs from the --format specs (no flag → md→stdout) and write them via
277
- // the writer — the pure plan / impure writer split (@SCN-FMT-001). The plan
279
+ // the writer — the pure plan / impure writer split. The plan
278
280
  // parse+validate is pure; the writer is the only IO for the emitted report. This is
279
281
  // the SOLE output path: the tool emits via --format and holds no storage opinion — the
280
- // legacy runs/<target>/<ISO>/ auto-archive was removed with @SCN-RUN-001, the
282
+ // legacy runs/<target>/<ISO>/ auto-archive was removed, the
281
283
  // caller now routes stored runs (spec-controller's run-management layer).
282
284
  const planResult = planOutput(collectFormatSpecs(argv));
283
285
  if (!planResult.ok)
284
286
  exitUsage(planResult.error);
285
287
  writeOutputs(planResult.plan, { balance, ctx, evidenceObligations, withRuntimeObservations: true, withStaticChecks: true, featureNames });
286
- // The CI gate (@SCN-CLI-004): `balance` is a GATE, not just a reporter. AFTER the report
287
- // is written in full, map the whole-run verdict to the process exit code. Out-of-balance
288
- // (ANY reconciling item anywhere: an out-of-balance scenario OR a suspense-row item such
289
- // as a no-evidence-obligation static-check watermelon) sets process.exitCode = 1 and RETURNS — set,
290
- // never `process.exit(1)`, so the buffered report is flushed intact rather than truncated
291
- // mid-write. It exits EXACTLY 1 so it reds a CI build and can't masquerade as the usage
292
- // error (2, above). An ENUMERATED status, never a count (8-bit wrap → false pass). A
293
- // balanced run leaves process.exitCode at its default 0 and returns.
294
- //
295
- // The --strict escalation (@SCN-CLI-011): Pending Items are run-neutral by DEFAULT
296
- // (@SCN-PND-008 — they never red a build), but `--strict` is the OPT-IN that fails an
297
- // OTHERWISE-BALANCED run carrying them, exiting the DISTINCT code 3 (taxonomy 0 balanced /
298
- // 1 out-of-balance / 2 usage / 3 pending-under-strict / 4 unsound / 5 nothing to reconcile —
299
- // a Pending Item is not out-of-balance,
300
- // so it must NEVER share code 1). Out-of-balance DOMINATES: the escalation is checked ONLY in
301
- // the `isBalanced` branch, so an out-of-balance run exits 1 regardless of --strict. Like the
302
- // CLI-004 gate this SETS process.exitCode (never process.exit) AFTER writeOutputs, so the
303
- // buffered report is flushed intact. `--strict` is a registry-LISTED boolean, recorded by
304
- // parseArgs as the string "true" — presence is what matters, so `!== undefined` reads it.
305
- //
306
- // The UNSOUND pre-emption (@SCN-CLI-012): a run carrying BROKEN evidence — a proving suite
307
- // that failed to COLLECT, so the behaviour was never exercised — exits the DISTINCT code 4
308
- // (taxonomy 0 balanced / 1 out-of-balance / 2 usage / 3 pending-under-strict / 4 unsound /
309
- // 5 nothing to reconcile).
310
- // Exit 1 says "the ledger disagrees"; exit 4 says "the ledger could not be TRUSTED to
311
- // disagree" — you cannot trust a reconciliation whose evidence never materialised, so
312
- // unsound DOMINATES.
313
- //
314
- // THE ORDER IS LOAD-BEARING, NOT COSMETIC. A broken run is ALWAYS out-of-balance: its
315
- // `broken` item sits on the SUSPENSE row, so `isBalanced` is already false. Check it AFTER
316
- // `isBalanced` and the branch is UNREACHABLE — every broken run would exit 1 and the
317
- // collection failure would stay masked as an honest disagreement (the AWTY dogfood fault,
318
- // 3F-1642). So `hasBrokenEvidence` is checked FIRST, PRE-EMPTING the balance verdict it
319
- // would otherwise be swallowed by. @SCN-CLI-004 is a BYSTANDER, not an Update: its fixture
320
- // is a SOUND out-of-balance run (no broken item), so it falls through this branch and still
321
- // exits exactly 1 — the pre-emption fires only when evidence genuinely failed to collect.
322
- //
323
- // THE NOTHING-TO-RECONCILE PRE-EMPTION (@SCN-CLI-019): a run whose ledger carries ZERO Scenario
324
- // Reconciliation rows — a target that declared nothing AND produced nothing — exits the DISTINCT
325
- // code 5. It is its own state: not balanced (no accounts to agree), not out-of-balance (nothing
326
- // disagrees), not a usage fault (the invocation was valid and `new-client` is a supported
327
- // adoption state), not unsound (no proof failed; none was owed).
328
- //
329
- // IT IS NOT THE UNSOUND PRE-EMPTION ONE CODE FURTHER ON, THOUGH IT LOOKS LIKE IT — measured,
330
- // because the ticket predicted it was. An empty ledger is MUTUALLY EXCLUSIVE with all three
331
- // predicates above: with no rows there is no row to carry a broken item, a reconciling item or a
332
- // Pending Item, so it fires none of them. Moved below `!isBalanced`, this branch STILL returns 5
333
- // (the prescribed plant stayed green). Its position among the predicates is free, and it is
334
- // first only so this ladder and `runVerdictSection` read in the SAME order — the shape
335
- // @SCN-CLI-013's invariant leans on.
336
- //
337
- // WHAT IS LOAD-BEARING is its position against the DEFAULT below. "Balanced" is not a branch
338
- // here, it is the `return 0` a run reaches by failing every test — so there is no "after the
339
- // balanced case" to append a fifth code to. Appended after that return the branch is dead code
340
- // and an empty run exits 0 (measured: the plant that DID red). That is why the fault survived a
341
- // taxonomy that had already grown twice: a fifth code cannot be ADDED to this chain, it has to
342
- // DISPLACE the default, and nothing about the other three says so.
343
- //
344
- // Keyed on the EMPTY LEDGER, never on the empty corpus: a corpus-less run carrying uncited
345
- // credits HAS a row — its suspense row — and is an ordinary out-of-balance report at exit 1
346
- // (@SCN-CLI-020). @SCN-CLI-004/005/010/012 are BYSTANDERS: every one of their fixtures carries
347
- // rows, so none reaches this branch.
348
- const verdict = verdictExitCode(balance, args["strict"] !== undefined);
349
- const code = args["exit-zero"] !== undefined ? exitZeroStatus(verdict) : verdict;
288
+ // Set after the report is written in full, never `process.exit`, so the buffered report is
289
+ // flushed intact rather than truncated mid-write.
290
+ const verdict = verdictCode({ ...balance, strict: ctx.strict === true });
291
+ const code = statusFor(verdict, args["exit-zero"] !== undefined);
350
292
  // Assigned only when NON-ZERO, so a balanced run still LEAVES process.exitCode at its default
351
- // rather than writing a 0 over it — the distinction @SCN-CLI-005 and @SCN-CLI-010 both rest on.
293
+ // rather than writing a 0 over it — the distinction the balanced-exit scenarios rest on.
352
294
  if (code !== 0)
353
295
  process.exitCode = code;
354
296
  }
355
297
  /**
356
298
  * A usage or input fault: the message on stderr, then exit 2 — the enumerated usage code
357
- * (@SCN-CLI-002), distinct from the out-of-balance verdict code 1 (@SCN-CLI-004). An
299
+ *, distinct from the out-of-balance verdict code 1. An
358
300
  * out-of-balance run must never masquerade as a usage error, nor the reverse.
359
301
  */
360
302
  function exitUsage(message) {
@@ -362,28 +304,26 @@ function exitUsage(message) {
362
304
  process.exit(2);
363
305
  }
364
306
  /**
365
- * Render-from-saved-JSON mode (@SCN-RMD-007): regenerate the human markdown from a
366
- * banked spec-reconciliation.json ALONE — no reconcile, no live inputs, no RunContext. Reads
367
- * the file, JSON.parses it back into the whole-document report model, renders the markdown via
368
- * renderReport, and writes it to stdout (the same trailing-newline convention as the writer's
369
- * stdout path). The load-bearing proof that the JSON IS the model — true when it answered the
370
- * run, so `runBalance` returns before any reconcile.
307
+ * Render-from-saved-JSON mode: the markdown a banked spec-reconciliation.json renders to, on
308
+ * stdout, and the exit its saved verdict names — no reconcile, no live inputs. True when it
309
+ * answered the run, so `runBalance` returns before any reconcile.
371
310
  */
372
311
  function renderSavedReport(args) {
373
- // Saved-report READABILITY guard (@SCN-CLI-015). This mode RETURNS before
374
- // `refuseUnreadableInputs` ever runs, so it honoured NEITHER of its guards: a missing path
375
- // crashed to ENOENT and a malformed file to SyntaxError, both landing on Node's default exit 1
376
- // — the out-of-balance code. The missing-path case was a live violation of @SCN-CLI-002's own
377
- // shipped principle, which the CLI enforced for the five evidence flags and not for this
378
- // one. The guard therefore runs INSIDE this mode, ahead of the read (3F-1764).
312
+ // Here rather than with the live-input guards, because this mode returns before they run.
313
+ const ignoredFlagError = checkReRenderFlags(args);
314
+ if (ignoredFlagError)
315
+ exitUsage(ignoredFlagError);
379
316
  const unreadableSavedReportError = checkRenderFromJson(args, (path) => readFileSync(path, "utf8"));
380
317
  if (unreadableSavedReportError)
381
318
  exitUsage(unreadableSavedReportError);
382
319
  const rehydratePath = args["render-from-json"];
383
320
  if (rehydratePath === undefined)
384
321
  return false;
385
- const savedReport = readFileSync(rehydratePath, "utf8");
386
- process.stdout.write(renderReportFromJson(savedReport) + "\n");
322
+ const saved = reRender(readFileSync(rehydratePath, "utf8"), args["strict"] !== undefined);
323
+ process.stdout.write(saved.markdown + "\n");
324
+ const code = statusFor(saved.code, args["exit-zero"] !== undefined);
325
+ if (code !== 0)
326
+ process.exitCode = code;
387
327
  return true;
388
328
  }
389
329
  /**
@@ -391,7 +331,7 @@ function renderSavedReport(args) {
391
331
  * because an input the tool cannot read is a usage error, never a verdict.
392
332
  */
393
333
  function refuseUnreadableInputs(args) {
394
- // Input-existence guard (@SCN-CLI-002): a supplied input-file/dir flag pointing at a
334
+ // Input-existence guard: a supplied input-file/dir flag pointing at a
395
335
  // non-existent path is a HARD ERROR — halt BEFORE reconciling, with a typed message
396
336
  // naming the flag + path, never the silent zero-evidence all-red report a mistyped
397
337
  // path used to produce (the dogfooding fault). Routed to stderr + a non-zero exit,
@@ -400,18 +340,18 @@ function refuseUnreadableInputs(args) {
400
340
  const missingInputError = checkInputsExist(args, existsSync);
401
341
  if (missingInputError)
402
342
  exitUsage(missingInputError);
403
- // Input-READABILITY guard (@SCN-CLI-014): existence is not enough. A report that is
343
+ // Input-READABILITY guard: existence is not enough. A report that is
404
344
  // PRESENT but UNPARSEABLE (`--vitest /dev/null`, truncated JSON, non-JSON) used to throw
405
345
  // mid-parse inside reconcileWithCensus, uncaught — and Node's default exit code is 1, the
406
- // code reserved for a genuine OUT-OF-BALANCE verdict (@SCN-CLI-004). So a tool that
346
+ // code reserved for a genuine OUT-OF-BALANCE verdict. So a tool that
407
347
  // CRASHED before reconciling was indistinguishable, by exit code, from an honest
408
- // disagreement (3F-1742). Runs immediately after the existence guard and BEFORE any
348
+ // disagreement. Runs immediately after the existence guard and BEFORE any
409
349
  // reconcile, routing to the same stderr + exit 2 lane: an input the tool cannot read is a
410
350
  // usage fault, sibling to a missing path and an unrecognised flag — never a verdict.
411
351
  const unparseableInputError = checkInputsParse(args, (path) => readFileSync(path, "utf8"));
412
352
  if (unparseableInputError)
413
353
  exitUsage(unparseableInputError);
414
- // The FEATURE-CORPUS integrity checkpoint (@SCN-CLI-016, 3F-1767). The feature corpus is an
354
+ // The FEATURE-CORPUS integrity checkpoint. The feature corpus is an
415
355
  // input too — the ledger's DEBIT side — and it was read by a hand-rolled TAG-LINE SCAN that
416
356
  // never consulted a parser. So a malformed tag line simply stopped being a tag line and its
417
357
  // scenario CEASED TO EXIST: one stray character deleted a failing row and turned an
@@ -422,10 +362,10 @@ function refuseUnreadableInputs(args) {
422
362
  // Validated with the REAL Gherkin parser (cucumber's own), so a file the tool would reconcile is
423
363
  // at least a file cucumber would RUN. A file it rejects is an input we CANNOT READ: exit 2,
424
364
  // halting BEFORE any reconcile, naming the file and the parse failure — the same Rule as
425
- // @SCN-CLI-014 and @SCN-CLI-015 ("an input the tool cannot read is a usage error, never a
365
+ // the unparseable-report and unreadable-saved-report guards ("an input the tool cannot read is a usage error, never a
426
366
  // verdict"), now on the obligation side. Never a verdict, and never a green.
427
367
  //
428
- // The corpus is EXTRACTED from the same real AST (@SCN-LDG-020), so what the tool reconciles is
368
+ // The corpus is EXTRACTED from the same real AST, so what the tool reconciles is
429
369
  // what cucumber runs — Feature/Rule tag inheritance included. This guard decides whether the file
430
370
  // can be read at all; parseScenarios then reads it exactly as cucumber would.
431
371
  const featureParseErrors = featureCorpusParseErrors(args["features"]);
@@ -453,52 +393,19 @@ function runContextOf(args, inputs, runStart) {
453
393
  targetDir: args["features"] !== undefined ? dirname(args["features"]) : undefined,
454
394
  }),
455
395
  // The TARGET repo root the recorded input paths are made portable against (fixed to
456
- // the target root, not the run cwd, by @SCN-RPT-016) — the SAME
396
+ // the target root, not the run cwd) — the SAME
457
397
  // root readEvidenceObservations passes to countRuntimeEvidenceObservationKinds, derived from
458
398
  // --features, so a cross-repo reconcile records inputs relative (`features`) rather
459
399
  // than leaking the target's absolute path.
460
400
  root: resolveTargetRoot({ features: inputs.features }),
461
- // The TOOL's own identity (@SCN-RPT-026, 3F-1916) — which spec-controller produced
401
+ // The TOOL's own identity — which spec-controller produced
462
402
  // this run, distinct from the target's sourceSha. Read from the tool's OWN dir, never
463
403
  // cwd (which is the target). One call, spread into the ctx; the same identity feeds
464
404
  // the run.yaml manifest.
465
405
  ...resolveToolIdentity(),
406
+ strict: args["strict"] !== undefined,
466
407
  };
467
408
  }
468
- /**
469
- * THE DOMINANCE LADDER — the whole-run verdict as the enumerated status a consumer's CI branches
470
- * on, and the ONE place the order argued for above is written down. Extracted from `runBalance`
471
- * (3F-3344) so the ladder is a named thing with its own reading rather than a tail the reader
472
- * arrives at, and so the pre-emption argument sits ON it.
473
- *
474
- * ENUMERATED, NEVER A COUNT — a count would 8-bit `& 0xFF` wrap into a false pass. Returns 0 for a
475
- * balanced run; the caller leaves the process's default alone rather than writing that 0 back.
476
- */
477
- function verdictExitCode(balance, strict) {
478
- const { ledger } = balance;
479
- if (hasNothingToReconcile(ledger))
480
- return 5;
481
- if (hasBrokenEvidence(ledger))
482
- return 4;
483
- // A misfiled code (3F-3635): every account still reconciles, so `isBalanced` alone would pass it.
484
- if (hasScenarioCodeErrors(balance))
485
- return 1;
486
- if (!isBalanced(ledger))
487
- return 1;
488
- if (strict && hasPendingItems(ledger))
489
- return 3;
490
- return 0;
491
- }
492
- /**
493
- * The codes `--exit-zero` moves to 0 (@SCN-CLI-021, 3F-3100): the two VERDICTS on the target —
494
- * out-of-balance and pending-under-`--strict`. Enumerated rather than "anything non-zero", because
495
- * unsound (4) and nothing-to-reconcile (5) are not verdicts but the absence of a trustworthy one,
496
- * and suppressing a verdict never suppresses that. Usage (2) exits before the ladder is reached.
497
- */
498
- const VERDICT_CODES = new Set([1, 3]);
499
- function exitZeroStatus(code) {
500
- return VERDICT_CODES.has(code) ? 0 : code;
501
- }
502
409
  // Only run the balance command when this module is executed directly
503
410
  // (`tsx cli-balance/cli.ts`), NOT when imported by the top-level `spec-controller`
504
411
  // bin dispatcher or by a test that exercises the pure edge guards.
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli-balance/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,GAEzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,8FAA8F;AAC9F,6FAA6F;AAC7F,sFAAsF;AACtF,OAAO,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAGxB;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,IAAc;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;YAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,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ACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CACnB,IAA4B,EAC5B,MAAwB,EACxB,QAAc;IAEd,OAAO;QACL,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;QAC1B,MAAM;QACN,QAAQ;QACR,SAAS,EAAE,gBAAgB,CAAC;YAC1B,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;YAC7B,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;SAClF,CAAC;QACF,oFAAoF;QACpF,+CAA+C;QAC/C,6FAA6F;QAC7F,oFAAoF;QACpF,2CAA2C;QAC3C,IAAI,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtD,2DAA2D;QAC3D,sFAAsF;QACtF,oFAAoF;QACpF,yBAAyB;QACzB,GAAG,mBAAmB,EAAE;QACxB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS;KACrC,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,mFAAmF;AACnF,mEAAmE;AACnE,MAAM,eAAe,GACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,eAAe;IAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The status the process leaves for a verdict code, live or re-rendered, with or without `--exit-zero`. */
2
+ export declare function statusFor(code: number, exitZero: boolean): number;
3
+ //# sourceMappingURL=exitStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exitStatus.d.ts","sourceRoot":"","sources":["../../src/cli-balance/exitStatus.ts"],"names":[],"mappings":"AAQA,4GAA4G;AAC5G,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAEjE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The codes `--exit-zero` moves to 0: the two VERDICTS on the target —
3
+ * out-of-balance and pending-under-`--strict`. Enumerated rather than "anything non-zero", because
4
+ * unsound (4) and nothing-to-reconcile (5) are not verdicts but the absence of a trustworthy one,
5
+ * and suppressing a verdict never suppresses that. Usage (2) exits before the ladder is reached.
6
+ */
7
+ const VERDICT_CODES = new Set([1, 3]);
8
+ /** The status the process leaves for a verdict code, live or re-rendered, with or without `--exit-zero`. */
9
+ export function statusFor(code, exitZero) {
10
+ return exitZero && VERDICT_CODES.has(code) ? 0 : code;
11
+ }
12
+ //# sourceMappingURL=exitStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exitStatus.js","sourceRoot":"","sources":["../../src/cli-balance/exitStatus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE3D,4GAA4G;AAC5G,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,QAAiB;IACvD,OAAO,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Re-rendering a saved Evidence Reconciliation: the markdown the saved report renders to, and the
3
+ * verdict it carries. Pure over the saved bytes; the CLI does the reading and the writing.
4
+ */
5
+ import type { VerdictCode } from "@3f-consulting/spec-controller-core";
6
+ export interface ReRendered {
7
+ readonly markdown: string;
8
+ readonly code: VerdictCode;
9
+ }
10
+ /**
11
+ * `strictGiven` is `--strict` on the re-render. The run is strict when the saved run was or the
12
+ * re-render asks, and that one value is written onto the report before it renders, so the headline
13
+ * names the same code the re-render exits.
14
+ */
15
+ export declare function reRender(savedJson: string, strictGiven: boolean): ReRendered;
16
+ /**
17
+ * The first flag given beside `--render-from-json` that a re-render would silently ignore, as the
18
+ * usage message that refuses it; null when there is none, or no re-render was asked for. Any flag
19
+ * outside the three it reads is refused, so one added to balance later is refused by default.
20
+ */
21
+ export declare function checkReRenderFlags(args: Record<string, string>): string | null;
22
+ //# sourceMappingURL=reRender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reRender.d.ts","sourceRoot":"","sources":["../../src/cli-balance/reRender.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEpF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,UAAU,CAQ5E;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAU9E"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Re-rendering a saved Evidence Reconciliation: the markdown the saved report renders to, and the
3
+ * verdict it carries. Pure over the saved bytes; the CLI does the reading and the writing.
4
+ */
5
+ import { renderReport, verdictCode } from "@3f-consulting/spec-controller-core";
6
+ /**
7
+ * `strictGiven` is `--strict` on the re-render. The run is strict when the saved run was or the
8
+ * re-render asks, and that one value is written onto the report before it renders, so the headline
9
+ * names the same code the re-render exits.
10
+ */
11
+ export function reRender(savedJson, strictGiven) {
12
+ const saved = JSON.parse(savedJson);
13
+ const strict = saved.runProvenance.strict === true || strictGiven;
14
+ const report = { ...saved, runProvenance: { ...saved.runProvenance, strict } };
15
+ return {
16
+ markdown: renderReport(report),
17
+ code: verdictCode({ ledger: report.ledger, scenarioCodeErrors: report.scenarioCodeErrors, strict }),
18
+ };
19
+ }
20
+ /** The flags a re-render reads; `--help` answers before any of this runs. */
21
+ const READ_BY_A_RE_RENDER = new Set(["render-from-json", "strict", "exit-zero"]);
22
+ /**
23
+ * The first flag given beside `--render-from-json` that a re-render would silently ignore, as the
24
+ * usage message that refuses it; null when there is none, or no re-render was asked for. Any flag
25
+ * outside the three it reads is refused, so one added to balance later is refused by default.
26
+ */
27
+ export function checkReRenderFlags(args) {
28
+ if (args["render-from-json"] === undefined)
29
+ return null;
30
+ const ignored = Object.keys(args).find((key) => !READ_BY_A_RE_RENDER.has(key));
31
+ if (ignored === undefined)
32
+ return null;
33
+ const stored = ignored === "format" ? " A run under --store passes --format for its report files, so a re-render is not stored." : "";
34
+ return (`--render-from-json re-renders a saved report and reads only --strict and --exit-zero beside it; ` +
35
+ `--${ignored} would be ignored. Remove it, or run balance without --render-from-json.${stored}`);
36
+ }
37
+ //# sourceMappingURL=reRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reRender.js","sourceRoot":"","sources":["../../src/cli-balance/reRender.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAQhF;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB,EAAE,WAAoB;IAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAgB,CAAC;IACnD,MAAM,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,KAAK,IAAI,IAAI,WAAW,CAAC;IAClE,MAAM,MAAM,GAAgB,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC5F,OAAO;QACL,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC;QAC9B,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC;KACpG,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAEtG;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAA4B;IAC7D,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/E,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,MAAM,GACV,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,0FAA0F,CAAC,CAAC,CAAC,EAAE,CAAC;IACzH,OAAO,CACL,kGAAkG;QAClG,KAAK,OAAO,2EAA2E,MAAM,EAAE,CAChG,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.0-alpha.31",
3
+ "version": "0.1.0-alpha.32",
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.31"
28
+ "@3f-consulting/spec-controller-core": "0.1.0-alpha.32"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"