spec-controller 0.1.258 → 0.1.260

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.
Files changed (3) hide show
  1. package/README.md +1 -6
  2. package/dist/cli.js +107 -644
  3. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -87,43 +87,26 @@ var messages_en_default;
87
87
  var init_messages_en = __esm({
88
88
  "src/messages.en.json"() {
89
89
  messages_en_default = {
90
- "format-names-stored-run-manifest": "A --format output names {formatPath}, which is this stored run's own {manifestPath}. Give the report a path outside {runDir}.",
91
- "stored-run-reads-its-manifest": "A file this stored run reads is its own {manifestPath}: {inputPath} is {inputSubject}. Give the store a root outside the files the run reads.",
92
- "see-commands-and-modifiers": "Run 'spec-controller --help' to see the commands and host modifiers this version accepts.",
93
- "see-modifiers": "Run 'spec-controller --help' to see the host modifiers this version accepts.",
90
+ "see-commands": "Run 'spec-controller --help' to see the commands this version accepts.",
94
91
  "see-flags": "Run ''{scope} --help' to see the flags this version accepts.",
95
92
  "see-flags-and-values": "Run ''{scope} --help' to see the flags this version accepts and the values they take.",
96
93
  "see-arguments": "Run ''{scope} --help' to see what this version accepts.",
97
- "no-command-after-modifiers": "No command followed the host modifiers given ({modifiers}), so nothing ran: a host modifier needs a command after it, or --help.",
98
- "modifier-took-command": "The {modifier} host modifier took ''{command}'', a command, as its value, and left no command to run.",
99
- "give-modifier-its-own-value": "Give {modifier} its own value, as in 'spec-controller {modifier} {arg} {command} \u2026'.",
100
- "flag-before-command": "The {flag} flag was given before the command. Before the command, spec-controller takes only its host modifiers ({modifiers}); a command's own flags go after it, as in 'spec-controller <command> {flag}''.",
94
+ "flag-before-command": "The {flag} flag was given before the command. A command's own flags go after it, as in 'spec-controller <command> {flag}''.",
101
95
  "unknown-command": 'unknown command "{command}".',
102
- "modifiers-not-taken": "''{command}'' takes no host modifier, and was given {modifiers}: it answers a query and keeps no run.",
103
- "run-without-modifiers": "Run 'spec-controller {command} \u2026' without them.",
104
96
  "missing-value": "The {flag} flag of ''{scope}'' needs a value \u2014 {flag} {arg} \u2014 and was given none.",
105
97
  "given-twice": "The {flag} flag of ''{scope}'' was given more than once, and is read once: give it once.",
106
98
  "equals-form": "The {token} form is not read by ''{scope}'': a flag and its value are two arguments, as in ''{spelling}''.",
107
99
  "takes-no-value": "The {flag} flag of ''{scope}'' takes no value, and was given one: ''{value}''.",
108
100
  "extra-argument": "The argument ''{token}'' is more than ''{scope}'' takes: it takes {takes} once, and its flags.",
109
101
  "not-a-flag": "The argument ''{token}'' is not a flag, nor the value of the flag before it: ''{scope}'' takes only flags and their values.",
110
- "misplaced-modifier": "The {modifier} flag is a host modifier: it goes before the command, as in 'spec-controller {modifier} <value> {command} \u2026', never after it.",
111
102
  "unknown-flag": "Unknown flag {flag} for ''{scope}'' \u2014 this is spec-controller {toolVersion}, and that flag is not in its {command} scope.",
112
103
  "pin-drifted": "If this version is pinned, the pin and the tree it is reading have drifted apart: bump the pin to a version whose ''{command}'' accepts {flag}.",
113
104
  "otherwise-see-flags": "Otherwise run ''{scope} --help' to see the flags this version accepts.",
114
- "retired-flag": "Retired flag {flag} for ''{scope}'' \u2014 retired in spec-controller {retiredIn}, and no later version accepts it (this is spec-controller {toolVersion}).",
115
- "do-not-pin-retired": "Do not pin an earlier version to get it back: that restores the route it was retired with.",
116
- "re-render-not-stored": "'balance --render-from-json' re-renders a saved report to stdout and keeps no run, and was given {modifiers}: a re-render is not stored.",
117
- "re-render-without": "{count, plural, one {Run 'spec-controller balance --render-from-json <path>' without it.} other {Run 'spec-controller balance --render-from-json <path>' without them.}}",
118
- "run-id-without-store": "--run-id names a stored run, and was given ''{runId}'' with no --store, so no run is kept under it.",
119
- "keep-run-under-name": "To keep the run under that name, give --store <root> as well; otherwise run ''{command}'' without --run-id.",
120
105
  "legacy-json-removed": "The --json <path> flag has been removed. Use --format json:<path> to write the JSON report to a file (e.g. --format json:spec-reconciliation.json).",
121
- "re-render-reads-only": "--render-from-json re-renders a saved report and reads only --strict and --exit-zero beside it; {ignored} would be ignored. Remove it, or run balance without --render-from-json.",
122
106
  "unknown-format": "Unknown --format {formats}. Supported formats are {supported} (e.g. --format md, --format json:report.json).",
123
107
  "more-than-one-to-stdout": "More than one output routes to stdout ({formats}); at most one may. Give one of them a :<path> to write it to a file instead (e.g. --format json:report.json).",
124
108
  "outputs-share-file": "Two outputs name the same file: {first} and {second}. Give each output a file of its own.",
125
109
  "output-overwrites-input": "An output would overwrite a file this run reads: {output} is {subject}, {path}. Give the report a file of its own.",
126
- "output-overwrites-stored-run": "A --format output names {path}, a file of the earlier stored run in {runDir}. Give the report a path outside that run's directory.",
127
110
  "unknown-part-refused": "unknown part \u2014 no feature file's header carries {part}.\nThe parts this corpus's feature files carry: {parts}.",
128
111
  "no-parts-carried": "none",
129
112
  "no-feature-part-given": "no feature part was given: 'spec-controller allocate <FFF>' takes one, a feature file's header code.",
@@ -148,13 +131,10 @@ var init_messages_en = __esm({
148
131
  "could-not-be-read": "{subject} could not be read: {path} ({reason})",
149
132
  "git-exited": "git {command} exited {status}: {said}",
150
133
  "feature-corpus-directory-missing": "The feature corpus directory does not exist: {directory}",
151
- "stored-run-directory-not-created": "The stored run's directory could not be created: {path} ({reason})",
152
134
  "input-path-missing": "The {flag} path does not exist: {path}",
153
- "flagged-file": "The {flag} file",
154
135
  "flagged-report": "The {flag} report",
155
136
  "flagged-record": "The {flag} record",
156
137
  "flagged-manifest": "The {flag} manifest",
157
- "flagged-saved-report": "The {flag} saved report",
158
138
  "flagged-corpus": "The {flag} corpus",
159
139
  "flagged-workflows": "The {flag} workflows",
160
140
  "default-package-json": "The package.json read by default",
@@ -173,8 +153,6 @@ var init_messages_en = __esm({
173
153
  "not-valid-xml": "{subject} is not valid XML, so not in the shape {shape}: {path} ({reason})",
174
154
  "xml-fault-at-line": "{fault} at line {line}",
175
155
  "not-in-shape": "{subject} is not in the shape {shape}: {path} ({fault})",
176
- "not-a-saved-reconciliation": "{subject} is not a saved reconciliation: {path} ({fault}). Run balance again to save one.",
177
- "not-renderable-as-saved": "{subject} could not be rendered as a saved reconciliation: {path} ({reason})",
178
156
  "corpus-file-unparseable": "{corpus} contains a feature file that could not be parsed: {file}\n{message}",
179
157
  "workflow-not-yaml": "{workflows} contain a workflow that is not valid YAML: {file}\n{message}",
180
158
  "report-not-written": "The {format} report could not be written: {path} ({reason})",
@@ -189,13 +167,10 @@ var init_messages_en = __esm({
189
167
  "help-title": "spec-controller \u2014 reconcile scenarios against observed evidence",
190
168
  "help-usage": "Usage:",
191
169
  "help-commands": "Commands:",
192
- "help-host-modifiers": "Host modifiers (before the command):",
193
170
  "help-options": "Options:",
194
171
  "help-arguments": "Arguments:",
195
172
  "help-pointer": "Full flags, examples, and CI wiring: docs/user-guide.md.",
196
173
  "help-flag": "Show this help and exit.",
197
- "store-modifier": "Store the run: write <root>/<target>/<run-id>/ with the reconciliation outputs + a run.yaml manifest. Required to store; there is no default (a default would write inside the repo).",
198
- "run-id-modifier": "Name the stored run (default: an ISO-8601 UTC timestamp). Read only with --store: given without it, the run is refused, since no run would be kept under the name.",
199
174
  "balance-summary": "Reconcile Gherkin scenarios against test/CI evidence and emit the Evidence Reconciliation (Markdown to stdout by default).",
200
175
  "features-flag": "Directory of Gherkin .feature files \u2014 the scenarios, and the `@`-tags naming what each must prove (@unit, @integration, @fitness, \u2026).",
201
176
  "vitest-flag": "A Vitest JSON report \u2014 runtime test evidence.",
@@ -210,14 +185,12 @@ var init_messages_en = __esm({
210
185
  "target-flag": "A name recorded verbatim in the report's provenance (which project this run reconciled).",
211
186
  "source-sha-flag": "Override the git commit SHA recorded in provenance (defaults to the resolved HEAD).",
212
187
  "format-flag": "Where to send output (md or json, optionally :<path> to write to a file). Repeatable.",
213
- "render-from-json-flag": "Re-render Markdown from a previously saved Evidence Reconciliation JSON \u2014 no reconcile, no live inputs.",
214
188
  "strict-flag": "Fail the run (exit 3) when it carries Pending Items \u2014 the opt-in that escalates otherwise-run-neutral deferred obligations.",
215
189
  "exit-zero-flag": "Print the same report but exit 0 on an out-of-balance or claim-code-error (1) or --strict pending (3) verdict \u2014 the on-ramp before gating. Usage (2), unsound (4) and nothing-to-reconcile (5) still fail.",
216
190
  "configuration-heading": "Configuration (in the target repo's package.json):",
217
191
  "deferral-tags-key": "specController.deferralTags: string[]",
218
192
  "deferral-tags-explanation": "Extra recognised deferral tags. A scenario carrying one defers every obligation it\nnames to a Pending Item, extending (never replacing) the built-in set.",
219
193
  "built-in-deferral-tags": "Built-in deferral tags: {tags}",
220
- "measurements-replacement": "A fitness function's evidence observation is the outcome of its own CI step: put the check's claim code on that step's `id:` and hand balance the run's step record with --ci-steps.",
221
194
  "allocate-summary": "Print the next claim code for a feature part: one past the highest the repository has ever carried, the code alone on stdout.",
222
195
  "feature-part-argument": "The feature part: a feature file's header code, two to five of A-Z and 0-9.",
223
196
  "new-flag": "Start a part no feature file's header carries yet: its first code, or one past any number the repository already carries for it.",
@@ -229,7 +202,7 @@ var init_messages_en = __esm({
229
202
  "highest-seen-in-tree": "highest seen: {code}, {path}:{line}",
230
203
  "highest-seen-in-commit": "highest seen: {code}, {path}:{line} in {commit}",
231
204
  "part-already-headed": "note: a feature file's header already carries {part}, so --new was not needed",
232
- "help-usage-line": "spec-controller {modifierUsage} <command> [command-args]",
205
+ "help-usage-line": "spec-controller <command> [command-args]",
233
206
  "help-command-title": "spec-controller {command} \u2014 {summary}",
234
207
  "help-command-usage-line": "spec-controller {command} {arguments} [options]"
235
208
  };
@@ -383,7 +356,7 @@ function readFaultOf(err, path) {
383
356
  if (!(err instanceof Error) || typeof errno.code !== "string") return null;
384
357
  return { path: errno.path ?? path, reason: err.message };
385
358
  }
386
- function readingOf(path, read, parse5) {
359
+ function readingOf(path, read, parse4) {
387
360
  let sources;
388
361
  try {
389
362
  sources = read();
@@ -392,7 +365,7 @@ function readingOf(path, read, parse5) {
392
365
  if (fault === null) throw err;
393
366
  return { kind: "read-fault", fault };
394
367
  }
395
- return parse5(sources);
368
+ return parse4(sources);
396
369
  }
397
370
  function readUtf8(path) {
398
371
  return readFileSync(path, "utf8");
@@ -11678,12 +11651,12 @@ var init_scenarioObligations = __esm({
11678
11651
  });
11679
11652
 
11680
11653
  // ../core/dist/parse/sourceParse.js
11681
- function parseSources(sources, parse5, read) {
11654
+ function parseSources(sources, parse4, read) {
11682
11655
  const documents = [];
11683
11656
  const faults = [];
11684
11657
  for (const { file, source } of sources) {
11685
11658
  try {
11686
- documents.push({ file, source, document: parse5(source) });
11659
+ documents.push({ file, source, document: parse4(source) });
11687
11660
  } catch (err) {
11688
11661
  faults.push({ file, message: err instanceof Error ? err.message : String(err) });
11689
11662
  }
@@ -15607,11 +15580,11 @@ var init_lexer = __esm({
15607
15580
  // followed by ")" also terminates the body, resuming at the ")" — bash treats
15608
15581
  // the substitution's closing paren as end-of-file for its heredocs.
15609
15582
  // `join` crosses `\`+newline pairs, which an unquoted delimiter may straddle.
15610
- matchHereDocDelimiter(delimiter, lineStart, end, join11) {
15583
+ matchHereDocDelimiter(delimiter, lineStart, end, join10) {
15611
15584
  const src = this.src;
15612
15585
  let pos = lineStart;
15613
15586
  for (let i = 0; i < delimiter.length; ) {
15614
- if (join11 && src.charCodeAt(pos) === CH_BACKSLASH && pos + 1 < end && src.charCodeAt(pos + 1) === CH_NL) {
15587
+ if (join10 && src.charCodeAt(pos) === CH_BACKSLASH && pos + 1 < end && src.charCodeAt(pos + 1) === CH_NL) {
15615
15588
  pos += 2;
15616
15589
  continue;
15617
15590
  }
@@ -15623,11 +15596,11 @@ var init_lexer = __esm({
15623
15596
  return pos;
15624
15597
  }
15625
15598
  // A `\` consumes the next character, so `\`+newline continues the line and `\\` does not.
15626
- logicalLineEnd(from, end, join11) {
15599
+ logicalLineEnd(from, end, join10) {
15627
15600
  const src = this.src;
15628
15601
  let lineEnd = src.indexOf("\n", from);
15629
15602
  while (lineEnd !== -1 && lineEnd < end) {
15630
- if (!join11)
15603
+ if (!join10)
15631
15604
  return lineEnd;
15632
15605
  let backslashes = lineEnd;
15633
15606
  while (backslashes > from && src.charCodeAt(backslashes - 1) === CH_BACKSLASH)
@@ -21697,7 +21670,7 @@ var require_stringify = __commonJS({
21697
21670
  props.push(doc.directives.tagString(tag));
21698
21671
  return props.join(" ");
21699
21672
  }
21700
- function stringify2(item, ctx, onComment, onChompKeep) {
21673
+ function stringify(item, ctx, onComment, onChompKeep) {
21701
21674
  if (identity.isPair(item))
21702
21675
  return item.toString(ctx, onComment, onChompKeep);
21703
21676
  if (identity.isAlias(item)) {
@@ -21726,7 +21699,7 @@ var require_stringify = __commonJS({
21726
21699
  ${ctx.indent}${str}`;
21727
21700
  }
21728
21701
  exports2.createStringifyContext = createStringifyContext;
21729
- exports2.stringify = stringify2;
21702
+ exports2.stringify = stringify;
21730
21703
  }
21731
21704
  });
21732
21705
 
@@ -21736,7 +21709,7 @@ var require_stringifyPair = __commonJS({
21736
21709
  "use strict";
21737
21710
  var identity = require_identity();
21738
21711
  var Scalar = require_Scalar();
21739
- var stringify2 = require_stringify();
21712
+ var stringify = require_stringify();
21740
21713
  var stringifyComment = require_stringifyComment();
21741
21714
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
21742
21715
  const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
@@ -21758,7 +21731,7 @@ var require_stringifyPair = __commonJS({
21758
21731
  });
21759
21732
  let keyCommentDone = false;
21760
21733
  let chompKeep = false;
21761
- let str = stringify2.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
21734
+ let str = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
21762
21735
  if (!explicitKey && !ctx.inFlow && str.length > 1024) {
21763
21736
  if (simpleKeys)
21764
21737
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
@@ -21810,7 +21783,7 @@ ${indent}:`;
21810
21783
  ctx.indent = ctx.indent.substring(2);
21811
21784
  }
21812
21785
  let valueCommentDone = false;
21813
- const valueStr = stringify2.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
21786
+ const valueStr = stringify.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
21814
21787
  let ws = " ";
21815
21788
  if (keyComment || vsb || vcb) {
21816
21789
  ws = vsb ? "\n" : "";
@@ -21951,7 +21924,7 @@ var require_addPairToJSMap = __commonJS({
21951
21924
  "use strict";
21952
21925
  var log = require_log();
21953
21926
  var merge = require_merge();
21954
- var stringify2 = require_stringify();
21927
+ var stringify = require_stringify();
21955
21928
  var identity = require_identity();
21956
21929
  var toJS = require_toJS();
21957
21930
  function addPairToJSMap(ctx, map, { key, value }) {
@@ -21987,7 +21960,7 @@ var require_addPairToJSMap = __commonJS({
21987
21960
  if (typeof jsKey !== "object")
21988
21961
  return String(jsKey);
21989
21962
  if (identity.isNode(key) && ctx?.doc) {
21990
- const strCtx = stringify2.createStringifyContext(ctx.doc, {});
21963
+ const strCtx = stringify.createStringifyContext(ctx.doc, {});
21991
21964
  strCtx.anchors = /* @__PURE__ */ new Set();
21992
21965
  for (const node of ctx.anchors.keys())
21993
21966
  strCtx.anchors.add(node.anchor);
@@ -22054,12 +22027,12 @@ var require_stringifyCollection = __commonJS({
22054
22027
  "../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports2) {
22055
22028
  "use strict";
22056
22029
  var identity = require_identity();
22057
- var stringify2 = require_stringify();
22030
+ var stringify = require_stringify();
22058
22031
  var stringifyComment = require_stringifyComment();
22059
22032
  function stringifyCollection(collection, ctx, options) {
22060
22033
  const flow = ctx.inFlow ?? collection.flow;
22061
- const stringify3 = flow ? stringifyFlowCollection : stringifyBlockCollection;
22062
- return stringify3(collection, ctx, options);
22034
+ const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
22035
+ return stringify2(collection, ctx, options);
22063
22036
  }
22064
22037
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
22065
22038
  const { indent, options: { commentString } } = ctx;
@@ -22084,7 +22057,7 @@ var require_stringifyCollection = __commonJS({
22084
22057
  }
22085
22058
  }
22086
22059
  chompKeep = false;
22087
- let str2 = stringify2.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
22060
+ let str2 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
22088
22061
  if (comment2)
22089
22062
  str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment2));
22090
22063
  if (chompKeep && comment2)
@@ -22151,7 +22124,7 @@ ${indent}${line}` : "\n";
22151
22124
  }
22152
22125
  if (comment)
22153
22126
  reqNewline = true;
22154
- let str = stringify2.stringify(item, itemCtx, () => comment = null);
22127
+ let str = stringify.stringify(item, itemCtx, () => comment = null);
22155
22128
  reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
22156
22129
  if (i < items.length - 1) {
22157
22130
  str += ",";
@@ -23512,7 +23485,7 @@ var require_stringifyDocument = __commonJS({
23512
23485
  "../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports2) {
23513
23486
  "use strict";
23514
23487
  var identity = require_identity();
23515
- var stringify2 = require_stringify();
23488
+ var stringify = require_stringify();
23516
23489
  var stringifyComment = require_stringifyComment();
23517
23490
  function stringifyDocument(doc, options) {
23518
23491
  const lines = [];
@@ -23527,7 +23500,7 @@ var require_stringifyDocument = __commonJS({
23527
23500
  }
23528
23501
  if (hasDirectives)
23529
23502
  lines.push("---");
23530
- const ctx = stringify2.createStringifyContext(doc, options);
23503
+ const ctx = stringify.createStringifyContext(doc, options);
23531
23504
  const { commentString } = ctx.options;
23532
23505
  if (doc.commentBefore) {
23533
23506
  if (lines.length !== 1)
@@ -23549,7 +23522,7 @@ var require_stringifyDocument = __commonJS({
23549
23522
  contentComment = doc.contents.comment;
23550
23523
  }
23551
23524
  const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
23552
- let body = stringify2.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
23525
+ let body = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
23553
23526
  if (contentComment)
23554
23527
  body += stringifyComment.lineComment(body, "", commentString(contentComment));
23555
23528
  if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
@@ -23557,7 +23530,7 @@ var require_stringifyDocument = __commonJS({
23557
23530
  } else
23558
23531
  lines.push(body);
23559
23532
  } else {
23560
- lines.push(stringify2.stringify(doc.contents, ctx));
23533
+ lines.push(stringify.stringify(doc.contents, ctx));
23561
23534
  }
23562
23535
  if (doc.directives?.docEnd) {
23563
23536
  if (doc.comment) {
@@ -25692,7 +25665,7 @@ var require_cst_scalar = __commonJS({
25692
25665
  var require_cst_stringify = __commonJS({
25693
25666
  "../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js"(exports2) {
25694
25667
  "use strict";
25695
- var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
25668
+ var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
25696
25669
  function stringifyToken(token) {
25697
25670
  switch (token.type) {
25698
25671
  case "block-scalar": {
@@ -25745,7 +25718,7 @@ var require_cst_stringify = __commonJS({
25745
25718
  res += stringifyToken(value);
25746
25719
  return res;
25747
25720
  }
25748
- exports2.stringify = stringify2;
25721
+ exports2.stringify = stringify;
25749
25722
  }
25750
25723
  });
25751
25724
 
@@ -27456,7 +27429,7 @@ var require_public_api = __commonJS({
27456
27429
  }
27457
27430
  return doc;
27458
27431
  }
27459
- function parse5(src, reviver, options) {
27432
+ function parse4(src, reviver, options) {
27460
27433
  let _reviver = void 0;
27461
27434
  if (typeof reviver === "function") {
27462
27435
  _reviver = reviver;
@@ -27475,7 +27448,7 @@ var require_public_api = __commonJS({
27475
27448
  }
27476
27449
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
27477
27450
  }
27478
- function stringify2(value, replacer, options) {
27451
+ function stringify(value, replacer, options) {
27479
27452
  let _replacer = null;
27480
27453
  if (typeof replacer === "function" || Array.isArray(replacer)) {
27481
27454
  _replacer = replacer;
@@ -27497,10 +27470,10 @@ var require_public_api = __commonJS({
27497
27470
  return value.toString(options);
27498
27471
  return new Document.Document(value, _replacer, options).toString(options);
27499
27472
  }
27500
- exports2.parse = parse5;
27473
+ exports2.parse = parse4;
27501
27474
  exports2.parseAllDocuments = parseAllDocuments;
27502
27475
  exports2.parseDocument = parseDocument;
27503
- exports2.stringify = stringify2;
27476
+ exports2.stringify = stringify;
27504
27477
  }
27505
27478
  });
27506
27479
 
@@ -28373,26 +28346,6 @@ var init_evidenceReconciliationFromSources = __esm({
28373
28346
  }
28374
28347
  });
28375
28348
 
28376
- // ../core/dist/assemble/savedReport.js
28377
- function assembleSavedReport(saved, strictGiven) {
28378
- const strict = saved.runProvenance.strict === true || strictGiven;
28379
- return {
28380
- ...saved,
28381
- runProvenance: { ...saved.runProvenance, strict },
28382
- summary: concludedSummary(saved.summary, {
28383
- ledger: { claimReconciliations: saved.claimReconciliations },
28384
- claimCodeErrors: saved.errorsInTheInputs?.claimCodeErrors,
28385
- strict
28386
- })
28387
- };
28388
- }
28389
- var init_savedReport = __esm({
28390
- "../core/dist/assemble/savedReport.js"() {
28391
- "use strict";
28392
- init_renderInput2();
28393
- }
28394
- });
28395
-
28396
28349
  // ../core/dist/model.js
28397
28350
  var init_model = __esm({
28398
28351
  "../core/dist/model.js"() {
@@ -32631,7 +32584,6 @@ var init_composers = __esm({
32631
32584
  "../core/dist/assemble/composers.js"() {
32632
32585
  "use strict";
32633
32586
  init_renderInput2();
32634
- init_savedReport();
32635
32587
  init_markdown();
32636
32588
  init_provenanceFacts();
32637
32589
  init_provenance();
@@ -32659,7 +32611,6 @@ var init_dist3 = __esm({
32659
32611
  init_renderInput2();
32660
32612
  init_evidenceReconciliationFromSources();
32661
32613
  init_composers();
32662
- init_savedReport();
32663
32614
  init_markdown();
32664
32615
  init_provenance();
32665
32616
  init_provenanceFacts();
@@ -32755,11 +32706,11 @@ function sourcesOf(featuresDir) {
32755
32706
  }
32756
32707
  }
32757
32708
  function parsedCorpusOf(featuresDir, files) {
32758
- const parse5 = parseFeatureCorpus(files.map(({ relativePath, source }) => ({ file: relativePath, source })));
32759
- if (parse5.kind === "parsed") return { kind: "read", corpus: parse5.parsed };
32709
+ const parse4 = parseFeatureCorpus(files.map(({ relativePath, source }) => ({ file: relativePath, source })));
32710
+ if (parse4.kind === "parsed") return { kind: "read", corpus: parse4.parsed };
32760
32711
  return {
32761
32712
  kind: "unparseable",
32762
- faults: parse5.faults.map(({ file, message: message2 }) => ({ file: corpusPathOf(featuresDir, file), message: message2 }))
32713
+ faults: parse4.faults.map(({ file, message: message2 }) => ({ file: corpusPathOf(featuresDir, file), message: message2 }))
32763
32714
  };
32764
32715
  }
32765
32716
  function readCorpus(featuresDir) {
@@ -32779,10 +32730,10 @@ function workflowSourcesOf(path, read) {
32779
32730
  return { paths, sources: paths.map((source) => readWorkflowSource(source, read)) };
32780
32731
  }
32781
32732
  function parsedWorkflowsOf({ paths, sources }) {
32782
- const parse5 = parseWorkflows(sources);
32783
- if (parse5.kind === "parsed") return { kind: "read", workflows: parse5.parsed };
32733
+ const parse4 = parseWorkflows(sources);
32734
+ if (parse4.kind === "parsed") return { kind: "read", workflows: parse4.parsed };
32784
32735
  const pathOf3 = new Map(paths.map((read) => [basename(read), read]));
32785
- return { kind: "unparseable", faults: parse5.faults.map(({ file, message: message2 }) => ({ file: pathOf3.get(file) ?? file, message: message2 })) };
32736
+ return { kind: "unparseable", faults: parse4.faults.map(({ file, message: message2 }) => ({ file: pathOf3.get(file) ?? file, message: message2 })) };
32786
32737
  }
32787
32738
  function readWorkflows(ciPath, read = readUtf8) {
32788
32739
  const path = ciPath ?? DEFAULT_CI_PATH;
@@ -32876,7 +32827,6 @@ function shapeFaultIn(value, shape) {
32876
32827
  return faultAt(value, shape, TOP);
32877
32828
  }
32878
32829
  function faultAt(value, shape, where) {
32879
- if (shape === "anything") return null;
32880
32830
  const found = kindOf2(value);
32881
32831
  const expected = expectedKindOf(shape);
32882
32832
  if (found !== expected)
@@ -32894,9 +32844,6 @@ function listFault(items, item, where) {
32894
32844
  return null;
32895
32845
  }
32896
32846
  function fieldsFault(record, shape, where) {
32897
- for (const [old, replacement] of Object.entries(shape.retired ?? {}))
32898
- if (record[old] !== void 0 && record[replacement] === void 0)
32899
- return message("shape-field-missing" /* ShapeFieldMissing */, { path: fieldOf(where, replacement).path });
32900
32847
  for (const [key, field] of Object.entries(shape.fields)) {
32901
32848
  const position = fieldOf(where, key);
32902
32849
  if (record[key] === void 0) {
@@ -32916,7 +32863,7 @@ function entriesFault(record, shape, where) {
32916
32863
  }
32917
32864
  return null;
32918
32865
  }
32919
- var VITEST_REPORT, JUNIT_REPORT, RSPEC_REPORT, CUCUMBER_REPORT, CI_STEP_RECORD, PACKAGE_MANIFEST, SCENARIO_NAME, SAVED_RECONCILIATION, TOP;
32866
+ var VITEST_REPORT, JUNIT_REPORT, RSPEC_REPORT, CUCUMBER_REPORT, CI_STEP_RECORD, PACKAGE_MANIFEST, TOP;
32920
32867
  var init_inputShapes = __esm({
32921
32868
  "src/ingest/inputShapes.ts"() {
32922
32869
  "use strict";
@@ -32979,60 +32926,6 @@ var init_inputShapes = __esm({
32979
32926
  keys: (key) => featureCodeOf(key) !== null
32980
32927
  };
32981
32928
  PACKAGE_MANIFEST = { fields: { scripts: { entries: "string" } } };
32982
- SCENARIO_NAME = { fields: { title: "string" }, required: ["title"] };
32983
- SAVED_RECONCILIATION = {
32984
- fields: {
32985
- runProvenance: { fields: { corpus: "string" }, required: ["corpus"] },
32986
- summary: {
32987
- fields: {
32988
- reconciliationTotals: {
32989
- fields: {
32990
- reconciliationLines: {
32991
- fields: {
32992
- missingByQualityCheckKind: { list: { fields: { qualityCheckKind: "string" }, required: ["qualityCheckKind"] } }
32993
- }
32994
- }
32995
- }
32996
- },
32997
- evidenceObservations: { fields: {} },
32998
- claimCodes: {
32999
- fields: {
33000
- untaggedScenarios: { list: SCENARIO_NAME },
33001
- sharedClaimCodes: { list: { fields: { scenarios: { list: SCENARIO_NAME } } } }
33002
- }
33003
- }
33004
- },
33005
- required: ["reconciliationTotals", "evidenceObservations", "claimCodes"]
33006
- },
33007
- claimReconciliations: {
33008
- list: {
33009
- fields: {
33010
- qualityCheckReconciliations: {
33011
- list: { fields: { evidenceObligation: { fields: { qualityCheckKind: "anything" }, required: ["qualityCheckKind"] } } }
33012
- },
33013
- pendingItems: { list: { fields: { qualityCheckKind: "anything" }, required: ["qualityCheckKind"] } }
33014
- }
33015
- }
33016
- },
33017
- errorsInTheInputs: {
33018
- fields: {
33019
- claimCodeErrors: { list: "anything" },
33020
- configurationNotRead: {
33021
- fields: {
33022
- keysNotRead: { list: "anything" },
33023
- ofWrongKind: { list: "anything" },
33024
- runnerKeysNotALayer: { list: "anything" },
33025
- nonChecksMatchingNoStep: { list: "anything" },
33026
- nonChecksNotAStepName: { list: "anything" }
33027
- }
33028
- }
33029
- },
33030
- retired: { configuration: "configurationNotRead" }
33031
- }
33032
- },
33033
- required: ["runProvenance", "summary", "claimReconciliations"],
33034
- retired: { errors: "errorsInTheInputs" }
33035
- };
33036
32929
  TOP = { kind: "top" };
33037
32930
  }
33038
32931
  });
@@ -33261,11 +33154,11 @@ var init_format = __esm({
33261
33154
  });
33262
33155
 
33263
33156
  // src/outputLocation.ts
33264
- import { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync, realpathSync, statSync as statSync2, unlinkSync } from "node:fs";
33157
+ import { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync, realpathSync, statSync as statSync2 } from "node:fs";
33265
33158
  import { dirname, resolve, sep } from "node:path";
33266
33159
  function unwritableRefusal(what, path, err) {
33267
33160
  const reason = err instanceof Error ? err.message : String(err);
33268
- return what.kind === "report" ? refusal("report-not-written" /* ReportNotWritten */, { format: what.format, path, reason }) : refusal("stored-run-directory-not-created" /* StoredRunDirectoryNotCreated */, { path, reason });
33161
+ return refusal("report-not-written" /* ReportNotWritten */, { format: what.format, path, reason });
33269
33162
  }
33270
33163
  function writeOrRefuse(what, path, write) {
33271
33164
  try {
@@ -33296,28 +33189,6 @@ function probeDestination(path) {
33296
33189
  const identity = identityOf2(openSync(path, constants.O_WRONLY | constants.O_CREAT));
33297
33190
  return { identity, created: realpathSync(path) };
33298
33191
  }
33299
- function firstSharingFile(file, others) {
33300
- const created = [];
33301
- try {
33302
- const identity = identityOrNone(file, created);
33303
- if (identity === void 0) return void 0;
33304
- return others.find((other) => sameIdentity(identityOrNone(other, created), identity));
33305
- } finally {
33306
- for (const path of created) unlinkSync(path);
33307
- }
33308
- }
33309
- function identityOrNone(path, created) {
33310
- try {
33311
- const probed = probeDestination(path);
33312
- if (probed.created !== void 0) created.push(probed.created);
33313
- return probed.identity;
33314
- } catch {
33315
- }
33316
- return void 0;
33317
- }
33318
- function sameIdentity(a, b) {
33319
- return a !== void 0 && a.dev === b.dev && a.ino === b.ino;
33320
- }
33321
33192
  function regularFileIdentity(path) {
33322
33193
  try {
33323
33194
  return regularIdentity(statSync2(path, { bigint: true }));
@@ -33325,11 +33196,6 @@ function regularFileIdentity(path) {
33325
33196
  }
33326
33197
  return void 0;
33327
33198
  }
33328
- function inputAt(path, inputs) {
33329
- const identity = regularFileIdentity(path);
33330
- if (identity === void 0) return void 0;
33331
- return inputs.find((input) => sameIdentity(regularFileIdentity(input.path), identity));
33332
- }
33333
33199
  function stdoutIdentity() {
33334
33200
  try {
33335
33201
  return regularIdentity(fstatSync(1, { bigint: true }));
@@ -33415,13 +33281,13 @@ var init_exitStatus = __esm({
33415
33281
  });
33416
33282
 
33417
33283
  // src/cli-balance/emit/writer.ts
33418
- import { unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
33284
+ import { unlinkSync, writeFileSync } from "node:fs";
33419
33285
  function render(fmt, p) {
33420
33286
  return fmt === "json" ? renderJson(p.balance, p.ctx, p.evidenceObligations, p.featureNames) : renderMarkdown(p.balance, p.ctx, reportedExitCodeOf, p.evidenceObligations, p.featureNames);
33421
33287
  }
33422
- function writeOutputs(plan, payloads, stdoutFile, inputs, earlierStoredRunDirOf2) {
33288
+ function writeOutputs(plan, payloads, stdoutFile, inputs) {
33423
33289
  const emissions = plan.outputs.map((output) => ({ output, text: render(output.fmt, payloads) + "\n" }));
33424
- const refused = vetDestinations(plan.outputs, stdoutFile, inputs) ?? earlierStoredRunRefusal(plan.outputs, earlierStoredRunDirOf2);
33290
+ const refused = vetDestinations(plan.outputs, stdoutFile, inputs);
33425
33291
  if (refused !== void 0) refuse(refused);
33426
33292
  for (const { output, text } of emissions) emit(output, text);
33427
33293
  }
@@ -33436,16 +33302,8 @@ function vetDestinations(outputs, stdoutFile, inputs) {
33436
33302
  }
33437
33303
  return sharedFileRefusal(identified) ?? inputOverwriteRefusal(identified, inputs);
33438
33304
  } finally {
33439
- for (const path of created) unlinkSync2(path);
33440
- }
33441
- }
33442
- function earlierStoredRunRefusal(outputs, earlierStoredRunDirOf2) {
33443
- for (const { dest } of outputs) {
33444
- if (dest.kind === "stdout") continue;
33445
- const runDir = earlierStoredRunDirOf2(dest.path);
33446
- if (runDir !== void 0) return refusal("output-overwrites-stored-run" /* OutputOverwritesStoredRun */, { path: dest.path, runDir });
33305
+ for (const path of created) unlinkSync(path);
33447
33306
  }
33448
- return void 0;
33449
33307
  }
33450
33308
  function identify(output, stdoutFile, created) {
33451
33309
  const dest = output.dest;
@@ -33476,8 +33334,6 @@ var init_writer = __esm({
33476
33334
  init_dist3();
33477
33335
  init_format();
33478
33336
  init_outputLocation();
33479
- init_messages();
33480
- init_refusal();
33481
33337
  init_exitStatus();
33482
33338
  }
33483
33339
  });
@@ -37861,9 +37717,9 @@ var init_junitXml = __esm({
37861
37717
  });
37862
37718
 
37863
37719
  // src/ingest/reportReading.ts
37864
- function documentOf(text, parse5) {
37720
+ function documentOf(text, parse4) {
37865
37721
  try {
37866
- return { kind: "parsed", document: parse5(text) };
37722
+ return { kind: "parsed", document: parse4(text) };
37867
37723
  } catch (err) {
37868
37724
  return { kind: "unparseable", reason: reasonOf(err) };
37869
37725
  }
@@ -37893,33 +37749,6 @@ var init_reportReading = __esm({
37893
37749
  }
37894
37750
  });
37895
37751
 
37896
- // src/cli-balance/reRender.ts
37897
- function reRender(document, strictGiven) {
37898
- const report = assembleSavedReport(document, strictGiven);
37899
- return {
37900
- markdown: renderReport(report, INPUT_NAMES, reportedExitCodeOf),
37901
- verdict: report.summary.runVerdict
37902
- };
37903
- }
37904
- function checkReRenderFlags(args) {
37905
- if (args["render-from-json"] === void 0) return null;
37906
- const ignored = Object.keys(args).find((key) => !READ_BY_A_RE_RENDER.has(key));
37907
- if (ignored === void 0) return null;
37908
- return refusal("re-render-reads-only" /* ReRenderReadsOnly */, { ignored: `--${ignored}` });
37909
- }
37910
- var READ_BY_A_RE_RENDER;
37911
- var init_reRender = __esm({
37912
- "src/cli-balance/reRender.ts"() {
37913
- "use strict";
37914
- init_dist3();
37915
- init_messages();
37916
- init_refusal();
37917
- init_exitStatus();
37918
- init_evidenceInputs();
37919
- READ_BY_A_RE_RENDER = /* @__PURE__ */ new Set(["render-from-json", "strict", "exit-zero"]);
37920
- }
37921
- });
37922
-
37923
37752
  // src/cli-balance/unreadableInputs.ts
37924
37753
  import { statSync as statSync3 } from "node:fs";
37925
37754
  function jsonInputsOf(args, exists) {
@@ -37993,33 +37822,6 @@ function checkInputPaths(args, corpusReading, workflowReading) {
37993
37822
  }
37994
37823
  return null;
37995
37824
  }
37996
- function savedReportRefusal(path, reading) {
37997
- return refusal("could-not-be-read" /* CouldNotBeRead */, {
37998
- subject: message("flagged-saved-report" /* FlaggedSavedReport */, { flag: "--render-from-json" }),
37999
- path,
38000
- reason: reading.kind === "read-fault" ? reading.fault.reason : reading.reason
38001
- });
38002
- }
38003
- function checkSavedReconciliation(path, saved) {
38004
- const fault = shapeFaultIn(saved, SAVED_RECONCILIATION);
38005
- if (fault === null) return null;
38006
- return refusal("not-a-saved-reconciliation" /* NotASavedReconciliation */, {
38007
- subject: message("flagged-file" /* FlaggedFile */, { flag: "--render-from-json" }),
38008
- path,
38009
- fault
38010
- });
38011
- }
38012
- function reRenderOrRefusal(path, saved, strict) {
38013
- try {
38014
- return reRender(saved, strict);
38015
- } catch (err) {
38016
- return refusal("not-renderable-as-saved" /* NotRenderableAsSaved */, {
38017
- subject: message("flagged-file" /* FlaggedFile */, { flag: "--render-from-json" }),
38018
- path,
38019
- reason: reasonOf(err)
38020
- });
38021
- }
38022
- }
38023
37825
  function workflowsSubjectOf(args) {
38024
37826
  return args["ci"] === void 0 ? message("default-ci-workflows" /* DefaultCiWorkflows */) : message("flagged-workflows" /* FlaggedWorkflows */, { flag: "--ci" });
38025
37827
  }
@@ -38038,10 +37840,8 @@ var init_unreadableInputs = __esm({
38038
37840
  "use strict";
38039
37841
  init_ingestQualityChecks();
38040
37842
  init_inputReading();
38041
- init_inputShapes();
38042
37843
  init_junitReportPaths();
38043
37844
  init_reportReading();
38044
- init_reRender();
38045
37845
  init_messages();
38046
37846
  init_appText();
38047
37847
  init_refusal();
@@ -38248,103 +38048,6 @@ var init_resolveRunInputs = __esm({
38248
38048
  }
38249
38049
  });
38250
38050
 
38251
- // src/run-management/keptRun.ts
38252
- import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync4, realpathSync as realpathSync2, writeFileSync as writeFileSync2 } from "node:fs";
38253
- import { dirname as dirname3, join as join6 } from "node:path";
38254
- function earlierStoredRunDirOf(path, ownRunDir) {
38255
- const dir = existsSync3(path) ? dirname3(realpathSync2(path)) : realpathSync2(dirname3(path));
38256
- if (ownRunDir !== void 0 && dir === realpathSync2(ownRunDir)) return void 0;
38257
- return holdsRunManifest(dir) ? dir : void 0;
38258
- }
38259
- function holdsRunManifest(dir) {
38260
- return readsAsRunManifest(runManifestDocumentIn(dir));
38261
- }
38262
- function runManifestDocumentIn(dir) {
38263
- try {
38264
- return (0, import_yaml2.parse)(readFileSync4(join6(dir, RUN_MANIFEST), "utf8"));
38265
- } catch {
38266
- }
38267
- return void 0;
38268
- }
38269
- function readsAsRunManifest(document) {
38270
- if (typeof document !== "object" || document === null) return false;
38271
- const fields = document;
38272
- return fields["schema_version"] !== void 0 && fields["run_id"] !== void 0 && typeof fields["artefacts"] === "object" && fields["artefacts"] !== null;
38273
- }
38274
- function planKeptRun(spec) {
38275
- const runDir = join6(spec.storeRoot, spec.target, spec.runId);
38276
- return {
38277
- runDir,
38278
- documentPath: join6(runDir, RECONCILIATION_DOCUMENT),
38279
- reconciliationJsonPath: join6(runDir, RECONCILIATION_JSON)
38280
- };
38281
- }
38282
- function resolveRunId(options) {
38283
- if (options.runId !== void 0) {
38284
- return options.runId;
38285
- }
38286
- return formatRunTimestamp(options.now);
38287
- }
38288
- function formatRunTimestamp(instant) {
38289
- return instant.toISOString().replace(/\.\d+Z/, "Z").replace(/:/g, "-");
38290
- }
38291
- function planRunManifest(input) {
38292
- return {
38293
- schema_version: RUN_MANIFEST_SCHEMA_VERSION,
38294
- run_id: input.runId,
38295
- target: input.target,
38296
- source_sha: input.sourceSha,
38297
- tool_sha: input.toolSha,
38298
- tool_version: input.toolVersion,
38299
- mode: input.mode,
38300
- date: input.date,
38301
- purpose: [],
38302
- links: [],
38303
- artefacts: {
38304
- document: RECONCILIATION_DOCUMENT,
38305
- reconciliation: RECONCILIATION_JSON
38306
- }
38307
- };
38308
- }
38309
- function serialiseRunManifest(manifest) {
38310
- return (0, import_yaml2.stringify)(manifest);
38311
- }
38312
- function executeKeptRun(spec, meta, route) {
38313
- const plan = planKeptRun(spec);
38314
- writeOrRefuse(
38315
- { kind: "stored-run-directory" },
38316
- plan.runDir,
38317
- () => mkdirSync(plan.runDir, { recursive: true })
38318
- );
38319
- const manifestPath = join6(plan.runDir, RUN_MANIFEST);
38320
- const sharesManifest = firstSharingFile(manifestPath, spec.formatPaths ?? []);
38321
- if (sharesManifest !== void 0) {
38322
- refuse(refusal("format-names-stored-run-manifest" /* FormatNamesStoredRunManifest */, { formatPath: sharesManifest, manifestPath, runDir: plan.runDir }));
38323
- }
38324
- const readManifest = inputAt(manifestPath, spec.inputs ?? []);
38325
- if (readManifest !== void 0) {
38326
- refuse(refusal("stored-run-reads-its-manifest" /* StoredRunReadsItsManifest */, { manifestPath, inputPath: readManifest.path, inputSubject: readManifest.subject }));
38327
- }
38328
- if (!route([`md:${plan.documentPath}`, `json:${plan.reconciliationJsonPath}`], plan.runDir)) return void 0;
38329
- const manifest = planRunManifest({ runId: spec.runId, target: spec.target, ...meta });
38330
- writeFileSync2(manifestPath, serialiseRunManifest(manifest));
38331
- return plan;
38332
- }
38333
- var import_yaml2, RECONCILIATION_DOCUMENT, RECONCILIATION_JSON, RUN_MANIFEST, RUN_MANIFEST_SCHEMA_VERSION;
38334
- var init_keptRun = __esm({
38335
- "src/run-management/keptRun.ts"() {
38336
- "use strict";
38337
- import_yaml2 = __toESM(require_dist(), 1);
38338
- init_messages();
38339
- init_refusal();
38340
- init_outputLocation();
38341
- RECONCILIATION_DOCUMENT = "spec-reconciliation.md";
38342
- RECONCILIATION_JSON = "spec-reconciliation.json";
38343
- RUN_MANIFEST = "run.yaml";
38344
- RUN_MANIFEST_SCHEMA_VERSION = 2;
38345
- }
38346
- });
38347
-
38348
38051
  // src/cliRegistry.ts
38349
38052
  function explainingLines(entry) {
38350
38053
  return entry.split("\n").map((line) => ` ${line}`);
@@ -38387,28 +38090,19 @@ function renderTopLevelHelp(registry) {
38387
38090
  const commandLines = registry.commands.map(
38388
38091
  (command) => ` ${command.name.padEnd(commandWidth + commandGutter)}${command.summary}`
38389
38092
  );
38390
- const modifierGutter = 3;
38391
- const modifierWidth = Math.max(0, ...registry.global.map((f) => flagLabel(f).length));
38392
- const modifierLines = registry.global.map(
38393
- (flag) => ` ${flagLabel(flag).padEnd(modifierWidth + modifierGutter)}${flag.description}`
38394
- );
38395
- const modifierUsage = registry.global.map((flag) => `[${flagLabel(flag)}]`).join(" ");
38396
38093
  return [
38397
38094
  message("help-title" /* HelpTitle */),
38398
38095
  "",
38399
38096
  message("help-usage" /* HelpUsage */),
38400
- ` ${message("help-usage-line" /* HelpUsageLine */, { modifierUsage })}`,
38097
+ ` ${message("help-usage-line" /* HelpUsageLine */)}`,
38401
38098
  "",
38402
38099
  message("help-commands" /* HelpCommands */),
38403
38100
  ...commandLines,
38404
38101
  "",
38405
- message("help-host-modifiers" /* HelpHostModifiers */),
38406
- ...modifierLines,
38407
- "",
38408
38102
  message("help-pointer" /* HelpPointer */)
38409
38103
  ].join("\n");
38410
38104
  }
38411
- var balanceFlags, balanceConfigHelp, balanceRetiredFlags, globalFlags, balanceCommand, allocateCommand, cliRegistry;
38105
+ var balanceFlags, balanceConfigHelp, balanceCommand, allocateCommand, cliRegistry;
38412
38106
  var init_cliRegistry = __esm({
38413
38107
  "src/cliRegistry.ts"() {
38414
38108
  "use strict";
@@ -38434,11 +38128,6 @@ var init_cliRegistry = __esm({
38434
38128
  repeatable: true,
38435
38129
  description: message("format-flag" /* FormatFlag */)
38436
38130
  },
38437
- {
38438
- name: "--render-from-json",
38439
- arg: "<path>",
38440
- description: message("render-from-json-flag" /* RenderFromJsonFlag */)
38441
- },
38442
38131
  {
38443
38132
  name: "--strict",
38444
38133
  description: message("strict-flag" /* StrictFlag */)
@@ -38459,36 +38148,15 @@ var init_cliRegistry = __esm({
38459
38148
  ...explainingLines(message("deferral-tags-explanation" /* DeferralTagsExplanation */)),
38460
38149
  ...explainingLines(message("built-in-deferral-tags" /* BuiltInDeferralTags */, { tags: BUILT_IN_DEFERRAL_TAGS.map((tag) => `@${tag}`).join(", ") }))
38461
38150
  ];
38462
- balanceRetiredFlags = [
38463
- {
38464
- name: "--measurements",
38465
- retiredIn: "0.1.0-alpha.5",
38466
- replacement: message("measurements-replacement" /* MeasurementsReplacement */)
38467
- }
38468
- ];
38469
- globalFlags = [
38470
- {
38471
- name: "--store",
38472
- arg: "<root>",
38473
- description: message("store-modifier" /* StoreModifier */)
38474
- },
38475
- {
38476
- name: "--run-id",
38477
- arg: "<id>",
38478
- description: message("run-id-modifier" /* RunIdModifier */)
38479
- }
38480
- ];
38481
38151
  balanceCommand = {
38482
38152
  name: "balance",
38483
38153
  summary: message("balance-summary" /* BalanceSummary */),
38484
38154
  flags: balanceFlags,
38485
- configHelp: balanceConfigHelp,
38486
- retiredFlags: balanceRetiredFlags
38155
+ configHelp: balanceConfigHelp
38487
38156
  };
38488
38157
  allocateCommand = {
38489
38158
  name: "allocate",
38490
38159
  summary: message("allocate-summary" /* AllocateSummary */),
38491
- acceptsHostModifiers: false,
38492
38160
  positionals: [
38493
38161
  { name: "<FFF>", description: message("feature-part-argument" /* FeaturePartArgument */) }
38494
38162
  ],
@@ -38501,7 +38169,6 @@ var init_cliRegistry = __esm({
38501
38169
  ]
38502
38170
  };
38503
38171
  cliRegistry = {
38504
- global: globalFlags,
38505
38172
  commands: [balanceCommand, allocateCommand]
38506
38173
  };
38507
38174
  }
@@ -38659,12 +38326,6 @@ function notAFlagRefusal(token, command) {
38659
38326
  const scope = `spec-controller ${command}`;
38660
38327
  return refusal("not-a-flag" /* NotAFlag */, { token, scope }, [message("see-flags" /* SeeFlags */, { scope })]);
38661
38328
  }
38662
- function checkMisplacedHostModifiers(args, registry, command) {
38663
- const modifiers = new Set(registry.global.map((flag) => bareName(flag.name)));
38664
- const key = Object.keys(args).find((k) => modifiers.has(k));
38665
- if (key === void 0) return null;
38666
- return refusal("misplaced-modifier" /* MisplacedModifier */, { modifier: `--${key}`, command }, [message("see-modifiers" /* SeeModifiers */)]);
38667
- }
38668
38329
  function checkUnknownFlags(args, registry, command, toolVersion) {
38669
38330
  const entry = commandEntry(registry, command);
38670
38331
  const accepted = /* @__PURE__ */ new Set();
@@ -38674,7 +38335,7 @@ function checkUnknownFlags(args, registry, command, toolVersion) {
38674
38335
  }
38675
38336
  for (const key of Object.keys(args)) {
38676
38337
  if (!accepted.has(key)) {
38677
- return retiredFlagRefusal(entry, key, command, toolVersion) ?? unknownFlagRefusal(`--${key}`, command, toolVersion);
38338
+ return unknownFlagRefusal(`--${key}`, command, toolVersion);
38678
38339
  }
38679
38340
  }
38680
38341
  return null;
@@ -38686,15 +38347,6 @@ function unknownFlagRefusal(flag, command, toolVersion) {
38686
38347
  message("otherwise-see-flags" /* OtherwiseSeeFlags */, { scope })
38687
38348
  ]);
38688
38349
  }
38689
- function retiredFlagRefusal(entry, key, command, toolVersion) {
38690
- const retired = entry.retiredFlags?.find((flag) => bareName(flag.name) === key);
38691
- if (retired === void 0) return void 0;
38692
- const scope = `spec-controller ${command}`;
38693
- return refusal("retired-flag" /* RetiredFlag */, { flag: retired.name, scope, retiredIn: retired.retiredIn, toolVersion }, [
38694
- `${message("do-not-pin-retired" /* DoNotPinRetired */)} ${retired.replacement}`,
38695
- message("see-flags" /* SeeFlags */, { scope })
38696
- ]);
38697
- }
38698
38350
  var argumentsOf;
38699
38351
  var init_cliArgs = __esm({
38700
38352
  "src/cliArgs.ts"() {
@@ -38711,8 +38363,8 @@ var init_cliArgs = __esm({
38711
38363
  });
38712
38364
 
38713
38365
  // src/cli-balance/cli.ts
38714
- import { existsSync as existsSync4 } from "node:fs";
38715
- import { dirname as dirname4 } from "node:path";
38366
+ import { existsSync as existsSync3 } from "node:fs";
38367
+ import { dirname as dirname3 } from "node:path";
38716
38368
  function collectFormatSpecs(argv) {
38717
38369
  return argv.flatMap((token, i) => token === "--format" ? [argv[i + 1]] : []);
38718
38370
  }
@@ -38742,28 +38394,25 @@ function checkInputsParse(reports) {
38742
38394
  }
38743
38395
  return null;
38744
38396
  }
38745
- function runBalance(argv, ownRunDir) {
38746
- return settlingRefusal(() => balance(argv, ownRunDir), false);
38397
+ function runBalance(argv) {
38398
+ return settlingRefusal(() => balance(argv), false);
38747
38399
  }
38748
- function balance(argv, ownRunDir) {
38400
+ function balance(argv) {
38749
38401
  const helped = asksForHelp(argv);
38750
38402
  if (helped) process.stdout.write(renderCommandHelp(balanceCommand) + "\n");
38751
- return !helped && reconcile2(argv, ownRunDir);
38403
+ return !helped && reconcile2(argv);
38752
38404
  }
38753
- function reconcile2(argv, ownRunDir) {
38405
+ function reconcile2(argv) {
38754
38406
  const runStart = /* @__PURE__ */ new Date();
38755
38407
  const args = parseArgs(argv);
38756
38408
  const legacyJsonError = checkLegacyJson(args);
38757
38409
  if (legacyJsonError) refuse(legacyJsonError);
38758
- const misplacedModifierError = checkMisplacedHostModifiers(args, cliRegistry, "balance");
38759
- if (misplacedModifierError) refuse(misplacedModifierError);
38760
38410
  const shapeError = checkArgvShape(argv, cliRegistry, "balance");
38761
38411
  if (shapeError) refuse(shapeError);
38762
38412
  const unknownFlagError = checkUnknownFlags(args, cliRegistry, "balance", resolveToolIdentity().toolVersion);
38763
38413
  if (unknownFlagError) refuse(unknownFlagError);
38764
38414
  const missingValueError = checkMissingValues(argv, cliRegistry, "balance");
38765
38415
  if (missingValueError) refuse(missingValueError);
38766
- if (renderSavedReport(args)) return true;
38767
38416
  const { corpus, workflows, reports } = refuseUnreadableInputs(args);
38768
38417
  const inputs = inputPathsOf(args);
38769
38418
  const root = resolveTargetRoot({ features: inputs.features });
@@ -38776,32 +38425,16 @@ function reconcile2(argv, ownRunDir) {
38776
38425
  planResult.plan,
38777
38426
  payloads,
38778
38427
  stdoutIdentity,
38779
- identifiedInputs(inputsReadBy(args, NODE_INPUT_READER)),
38780
- (path) => earlierStoredRunDirOf(path, ownRunDir)
38428
+ identifiedInputs(inputsReadBy(args, NODE_INPUT_READER))
38781
38429
  );
38782
38430
  const verdict = assembleRenderInput(balance2, ctx).summary.runVerdict;
38783
38431
  endRunOn({ kind: "verdict", code: exitCodeOf(verdict, args["exit-zero"] !== void 0) });
38784
38432
  return true;
38785
38433
  }
38786
- function renderSavedReport(args) {
38787
- const ignoredFlagError = checkReRenderFlags(args);
38788
- if (ignoredFlagError) refuse(ignoredFlagError);
38789
- const rehydratePath = args["render-from-json"];
38790
- if (rehydratePath === void 0) return false;
38791
- const savedReading = readDocument(rehydratePath, "json");
38792
- if (savedReading.kind !== "parsed") refuse(savedReportRefusal(rehydratePath, savedReading));
38793
- const notSavedError = checkSavedReconciliation(rehydratePath, savedReading.document);
38794
- if (notSavedError) refuse(notSavedError);
38795
- const saved = reRenderOrRefusal(rehydratePath, savedReading.document, args["strict"] !== void 0);
38796
- if ("code" in saved) refuse(saved);
38797
- process.stdout.write(saved.markdown + "\n");
38798
- endRunOn({ kind: "verdict", code: exitCodeOf(saved.verdict, args["exit-zero"] !== void 0) });
38799
- return true;
38800
- }
38801
38434
  function refuseUnreadableInputs(args) {
38802
- const missingInputError = checkInputsExist(args, existsSync4);
38435
+ const missingInputError = checkInputsExist(args, existsSync3);
38803
38436
  if (missingInputError) refuse(missingInputError);
38804
- const reportsReading = readReports(jsonInputsOf(args, existsSync4));
38437
+ const reportsReading = readReports(jsonInputsOf(args, existsSync3));
38805
38438
  const unparseableInputError = checkInputsParse(reportsReading);
38806
38439
  if (unparseableInputError) refuse(unparseableInputError);
38807
38440
  const corpusDir = corpusDirOf(args);
@@ -38816,7 +38449,7 @@ function refuseUnreadableInputs(args) {
38816
38449
  return { corpus: corpusReading.corpus, workflows: workflowReading.workflows, reports: reportsReading.reports };
38817
38450
  }
38818
38451
  function runContextOf(args, inputs, runStart, root) {
38819
- const targetDir = args["features"] !== void 0 ? dirname4(args["features"]) : void 0;
38452
+ const targetDir = args["features"] !== void 0 ? dirname3(args["features"]) : void 0;
38820
38453
  const targetOrigin = args["target"] === void 0 ? resolveTargetOrigin(targetDir) : null;
38821
38454
  return {
38822
38455
  target: sourceTarget(args),
@@ -38841,14 +38474,11 @@ var init_cli = __esm({
38841
38474
  init_inputsRead();
38842
38475
  init_defaultCorpus();
38843
38476
  init_corpusDir();
38844
- init_reRender();
38845
38477
  init_unreadableInputs();
38846
- init_reportReading();
38847
38478
  init_exitStatus();
38848
38479
  init_exitCode();
38849
38480
  init_dist3();
38850
38481
  init_resolveRunInputs();
38851
- init_keptRun();
38852
38482
  init_cliRegistry();
38853
38483
  init_cliArgs();
38854
38484
  init_messages();
@@ -38923,15 +38553,15 @@ var init_unreadable = __esm({
38923
38553
  });
38924
38554
 
38925
38555
  // src/cli-allocate/readParts.ts
38926
- import { readFileSync as readFileSync5 } from "node:fs";
38556
+ import { readFileSync as readFileSync4 } from "node:fs";
38927
38557
  function readHeaderCodes(featuresDir) {
38928
38558
  const sources = featureFilesIn(featuresDir).map(({ path }) => ({
38929
38559
  file: path,
38930
- source: readOrRefuse("feature-file" /* FeatureFile */, path, () => readFileSync5(path, "utf8"))
38560
+ source: readOrRefuse("feature-file" /* FeatureFile */, path, () => readFileSync4(path, "utf8"))
38931
38561
  }));
38932
- const parse5 = parseFeatureCorpus(sources);
38933
- if (parse5.kind === "unparseable") throw new UnparseableFeatureFiles(parse5.faults);
38934
- return parse5.parsed.flatMap(({ featureCode }) => featureCode === null ? [] : [featureCode]);
38562
+ const parse4 = parseFeatureCorpus(sources);
38563
+ if (parse4.kind === "unparseable") throw new UnparseableFeatureFiles(parse4.faults);
38564
+ return parse4.parsed.flatMap(({ featureCode }) => featureCode === null ? [] : [featureCode]);
38935
38565
  }
38936
38566
  function featureFilesIn(dir) {
38937
38567
  try {
@@ -38959,7 +38589,7 @@ function readRequest(argv, registry, toolVersion) {
38959
38589
  }
38960
38590
  function argvRefusal(argv, registry, toolVersion) {
38961
38591
  const args = parseArgs(argv);
38962
- return checkMisplacedHostModifiers(args, registry, "allocate") ?? checkArgvShape(argv, registry, "allocate") ?? checkUnknownFlags(args, registry, "allocate", toolVersion);
38592
+ return checkArgvShape(argv, registry, "allocate") ?? checkUnknownFlags(args, registry, "allocate", toolVersion);
38963
38593
  }
38964
38594
  function partRefusal(part) {
38965
38595
  if (part === void 0) return refusal("no-feature-part-given" /* NoFeaturePartGiven */, {});
@@ -38978,11 +38608,11 @@ var init_request = __esm({
38978
38608
 
38979
38609
  // src/cli-allocate/refStore.ts
38980
38610
  import { spawnSync } from "node:child_process";
38981
- import { lstatSync as lstatSync2, readdirSync as readdirSync3, readFileSync as readFileSync6 } from "node:fs";
38982
- import { join as join7 } from "node:path";
38611
+ import { lstatSync as lstatSync2, readdirSync as readdirSync3, readFileSync as readFileSync5 } from "node:fs";
38612
+ import { join as join6 } from "node:path";
38983
38613
  function proveRefsReadable(cwd) {
38984
38614
  for (const gitDir of gitDirsOf(cwd)) {
38985
- for (const store of REF_STORES) readEveryEntry(join7(gitDir, store));
38615
+ for (const store of REF_STORES) readEveryEntry(join6(gitDir, store));
38986
38616
  }
38987
38617
  }
38988
38618
  function gitDirsOf(cwd) {
@@ -38998,9 +38628,9 @@ function readEveryEntry(path) {
38998
38628
  if (kind === void 0) return;
38999
38629
  if (kind.isDirectory()) {
39000
38630
  const names = readOrRefuse("history" /* History */, path, () => readdirSync3(path));
39001
- for (const name of names) readEveryEntry(join7(path, name));
38631
+ for (const name of names) readEveryEntry(join6(path, name));
39002
38632
  } else if (kind.isFile()) {
39003
- readOrRefuse("history" /* History */, path, () => readFileSync6(path));
38633
+ readOrRefuse("history" /* History */, path, () => readFileSync5(path));
39004
38634
  }
39005
38635
  }
39006
38636
  var REF_STORES;
@@ -39015,8 +38645,8 @@ var init_refStore = __esm({
39015
38645
 
39016
38646
  // src/cli-allocate/readHistory.ts
39017
38647
  import { spawnSync as spawnSync2 } from "node:child_process";
39018
- import { lstatSync as lstatSync3, readFileSync as readFileSync7 } from "node:fs";
39019
- import { dirname as dirname5, join as join8 } from "node:path";
38648
+ import { lstatSync as lstatSync3, readFileSync as readFileSync6 } from "node:fs";
38649
+ import { dirname as dirname4, join as join7 } from "node:path";
39020
38650
  function readHistory(cwd, part) {
39021
38651
  proveRefsReadable(cwd);
39022
38652
  const args = ["log", "--all", "-p", "-U0", "--no-color", "--no-ext-diff", "--format=%x01%h", "-G", `(${ALLOCATION_COUNTED_PREFIXES.join("|")})-${part}-`];
@@ -39040,10 +38670,10 @@ function repositoryTop(cwd) {
39040
38670
  throw new UnreadableInput("repository" /* Repository */, gitEntry, gitExited(args, result.status, result.stderr));
39041
38671
  }
39042
38672
  function gitEntryAtOrAbove(dir) {
39043
- for (let at2 = dir; ; at2 = dirname5(at2)) {
39044
- const entry = join8(at2, ".git");
38673
+ for (let at2 = dir; ; at2 = dirname4(at2)) {
38674
+ const entry = join7(at2, ".git");
39045
38675
  if (lstatSync3(entry, { throwIfNoEntry: false }) !== void 0) return entry;
39046
- if (dirname5(at2) === at2) return null;
38676
+ if (dirname4(at2) === at2) return null;
39047
38677
  }
39048
38678
  }
39049
38679
  function isGitRepository(cwd) {
@@ -39056,7 +38686,7 @@ function historyBoundaryOf(cwd) {
39056
38686
  }
39057
38687
  function shallowBoundaryOf(cwd) {
39058
38688
  const shallowPath = shallowRecordPath(cwd);
39059
- const record = readOrRefuse("history" /* History */, shallowPath, () => readFileSync7(shallowPath, "utf8"));
38689
+ const record = readOrRefuse("history" /* History */, shallowPath, () => readFileSync6(shallowPath, "utf8"));
39060
38690
  const edge = record.split("\n")[0] ?? "";
39061
38691
  return { kind: "shallow", before: gitAnswer(cwd, ["rev-parse", "--short", edge]) ?? edge };
39062
38692
  }
@@ -39116,8 +38746,8 @@ var init_readHistory = __esm({
39116
38746
 
39117
38747
  // src/cli-allocate/readTree.ts
39118
38748
  import { spawnSync as spawnSync3 } from "node:child_process";
39119
- import { accessSync, constants as constants2, lstatSync as lstatSync4, readdirSync as readdirSync4, readFileSync as readFileSync8 } from "node:fs";
39120
- import { join as join9, relative as relative2, sep as sep4 } from "node:path";
38749
+ import { accessSync, constants as constants2, lstatSync as lstatSync4, readdirSync as readdirSync4, readFileSync as readFileSync7 } from "node:fs";
38750
+ import { join as join8, relative as relative2, sep as sep4 } from "node:path";
39121
38751
  function readTree(top, part) {
39122
38752
  const listed = gitListing(top, ["ls-files", "-z", "--cached", "--others", "--exclude-standard"]);
39123
38753
  const ignored = gitListing(top, ["ls-files", "-z", "--others", "--ignored", "--exclude-standard", "--directory"]);
@@ -39136,7 +38766,7 @@ function isDirectoryEntry(entry) {
39136
38766
  return entry.endsWith("/");
39137
38767
  }
39138
38768
  function proveListable(top, dir, ignored) {
39139
- const path = join9(top, dir);
38769
+ const path = join8(top, dir);
39140
38770
  const entries = readOrRefuse("tree-directory" /* TreeDirectory */, path, () => listedAndEntered(path));
39141
38771
  if (dir !== "" && entries.some((entry) => entry.name === ".git")) return;
39142
38772
  for (const entry of entries) {
@@ -39152,10 +38782,10 @@ function needlesFor(part) {
39152
38782
  return ALLOCATION_COUNTED_PREFIXES.map((prefix) => `${prefix}-${part}-`);
39153
38783
  }
39154
38784
  function occurrencesInListed(top, path, needles) {
39155
- const file = join9(top, path);
38785
+ const file = join8(top, path);
39156
38786
  const kind = readOrRefuse("tree-file" /* TreeFile */, file, () => lstatSync4(file, { throwIfNoEntry: false }));
39157
38787
  if (kind === void 0 || !kind.isFile()) return [];
39158
- return linesCarrying(path, readOrRefuse("tree-file" /* TreeFile */, file, () => readFileSync8(file)), needles);
38788
+ return linesCarrying(path, readOrRefuse("tree-file" /* TreeFile */, file, () => readFileSync7(file)), needles);
39159
38789
  }
39160
38790
  function linesCarrying(path, content, needles) {
39161
38791
  if (content.subarray(0, BINARY_PROBE_BYTES).includes(0)) return [];
@@ -39166,14 +38796,14 @@ function isWalkedDirectory(name) {
39166
38796
  }
39167
38797
  function walkTree(root, part) {
39168
38798
  return filesUnder(root).flatMap((file) => {
39169
- const content = readOrRefuse("tree-file" /* TreeFile */, file, () => readFileSync8(file));
38799
+ const content = readOrRefuse("tree-file" /* TreeFile */, file, () => readFileSync7(file));
39170
38800
  return linesCarrying(relative2(root, file).split(sep4).join("/"), content, needlesFor(part));
39171
38801
  });
39172
38802
  }
39173
38803
  function filesUnder(dir) {
39174
38804
  const entries = readOrRefuse("tree-directory" /* TreeDirectory */, dir, () => readdirSync4(dir, { withFileTypes: true }));
39175
38805
  return entries.flatMap((entry) => {
39176
- const path = join9(dir, entry.name);
38806
+ const path = join8(dir, entry.name);
39177
38807
  if (entry.isDirectory()) return isWalkedDirectory(entry.name) ? filesUnder(path) : [];
39178
38808
  return entry.isFile() ? [path] : [];
39179
38809
  });
@@ -39242,7 +38872,7 @@ var init_stderr = __esm({
39242
38872
  });
39243
38873
 
39244
38874
  // src/cli-allocate/cli.ts
39245
- import { join as join10 } from "node:path";
38875
+ import { join as join9 } from "node:path";
39246
38876
  function shown() {
39247
38877
  return standardError(process.stderr, "allocate");
39248
38878
  }
@@ -39275,7 +38905,7 @@ function refuseUsage(error) {
39275
38905
  function answerRequest({ part, isNew }) {
39276
38906
  const cwd = readOrRefuse("working-directory" /* WorkingDirectory */, "", () => process.cwd());
39277
38907
  const top = repositoryTop(cwd);
39278
- const headerCodes = readHeaderCodes(join10(top ?? cwd, DEFAULT_FEATURES_DIR));
38908
+ const headerCodes = readHeaderCodes(join9(top ?? cwd, DEFAULT_FEATURES_DIR));
39279
38909
  const answer = nextClaimCode({ part, headerCodes, isNew }, occurrencesFrom(cwd, part, top));
39280
38910
  if (answer.kind === "unknown-part") {
39281
38911
  refuseUsage(unknownPartRefusal(answer));
@@ -39312,81 +38942,24 @@ var init_cli2 = __esm({
39312
38942
  });
39313
38943
 
39314
38944
  // src/host.ts
39315
- function parseHostInvocation(argv, globalFlags2 = cliRegistry.global, commands = cliRegistry.commands.map((command) => command.name)) {
39316
- const read = readHostTokens(argv, globalFlags2, commands);
39317
- const help = argv.slice(0, hostTokenCount(argv, read)).find((token) => TOP_LEVEL_HELP.has(token));
39318
- return help === void 0 ? read : { command: help, commandArgs: [] };
39319
- }
39320
- function hostTokenCount(argv, read) {
39321
- if (read.refusal !== void 0 || read.command === void 0) return argv.length;
39322
- return argv.length - read.commandArgs.length - 1;
39323
- }
39324
- function readHostTokens(argv, globalFlags2, commands) {
39325
- const modifiers = valueFlagsOf(globalFlags2);
39326
- const values = /* @__PURE__ */ new Map();
39327
- let i = 0;
39328
- for (; i < argv.length; i++) {
39329
- const token = argv[i] ?? "";
39330
- const modifier = modifiers.get(token);
39331
- if (modifier === void 0) {
39332
- const refusal2 = leadingFlagRefusal(token, modifiers, globalFlags2);
39333
- if (refusal2 !== void 0) return { commandArgs: [], refusal: refusal2 };
39334
- break;
39335
- }
39336
- const read = readModifier(token, modifier, argv.slice(i + 1, i + 3), { values, commands });
39337
- if ("refusal" in read) return { commandArgs: [], refusal: read.refusal };
39338
- values.set(modifier.name, read.value);
39339
- i++;
39340
- }
39341
- if (i === argv.length && values.size > 0) return { commandArgs: [], refusal: noCommandRefusal([...values.keys()]) };
39342
- return {
39343
- store: values.get("--store"),
39344
- runId: values.get("--run-id"),
39345
- command: argv[i],
39346
- commandArgs: argv.slice(i + 1)
39347
- };
39348
- }
39349
- function readModifier(token, modifier, [next, after], read) {
39350
- if (read.values.has(modifier.name)) return { refusal: givenTwiceRefusal(token, "spec-controller") };
39351
- const value = givenValue(next);
39352
- if (value === void 0) return { refusal: missingValueRefusal(token, modifier, "spec-controller") };
39353
- if (read.commands.includes(value) && (after === void 0 || after.startsWith("-"))) {
39354
- return { refusal: commandAsValueRefusal(token, modifier, value) };
39355
- }
39356
- return { value };
39357
- }
39358
- function noCommandRefusal(given) {
39359
- return refusal("no-command-after-modifiers" /* NoCommandAfterModifiers */, { modifiers: given.join(", ") }, [message("see-commands-and-modifiers" /* SeeCommandsAndModifiers */)]);
39360
- }
39361
- function commandAsValueRefusal(token, modifier, command) {
39362
- return refusal("modifier-took-command" /* ModifierTookCommand */, { modifier: token, command }, [
39363
- `${message("give-modifier-its-own-value" /* GiveModifierItsOwnValue */, { modifier: token, arg: modifier.arg, command })} ` + message("see-commands-and-modifiers" /* SeeCommandsAndModifiers */)
39364
- ]);
39365
- }
39366
- function leadingFlagRefusal(token, modifiers, globalFlags2) {
39367
- if (isEqualsForm(token)) return equalsFormRefusal(token, modifiers, "spec-controller");
39368
- if (isFlagOutOfPlace(token)) return flagBeforeCommandRefusal(token, globalFlags2);
38945
+ function parseHostInvocation(argv) {
38946
+ const [first, ...rest] = argv;
38947
+ if (first === void 0) return { commandArgs: [] };
38948
+ const refusal2 = leadingFlagRefusal(first);
38949
+ if (refusal2 === void 0) return { command: first, commandArgs: rest };
38950
+ const help = argv.find((token) => TOP_LEVEL_HELP.has(token));
38951
+ return help === void 0 ? { commandArgs: [], refusal: refusal2 } : { command: help, commandArgs: [] };
38952
+ }
38953
+ function leadingFlagRefusal(token) {
38954
+ if (isEqualsForm(token)) return equalsFormRefusal(token, /* @__PURE__ */ new Map(), "spec-controller");
38955
+ if (isFlagOutOfPlace(token)) return flagBeforeCommandRefusal(token);
39369
38956
  return void 0;
39370
38957
  }
39371
38958
  function isFlagOutOfPlace(token) {
39372
38959
  return token.length > 1 && token.startsWith("-") && !TOP_LEVEL_HELP.has(token);
39373
38960
  }
39374
- function flagBeforeCommandRefusal(flag, globalFlags2) {
39375
- const modifiers = globalFlags2.map((modifier) => modifier.name).join(", ");
39376
- return refusal("flag-before-command" /* FlagBeforeCommand */, { flag, modifiers }, [message("see-commands-and-modifiers" /* SeeCommandsAndModifiers */)]);
39377
- }
39378
- function wrapCommandArgv(commandArgs, formatSpecs) {
39379
- return [...commandArgs, ...formatSpecs.flatMap((spec) => ["--format", spec])];
39380
- }
39381
- function peekFlag(argv, name) {
39382
- const flag = `--${name}`;
39383
- for (let i = 0; i < argv.length; i++) {
39384
- if (argv[i] === flag) {
39385
- const value = argv[i + 1];
39386
- return value !== void 0 && !value.startsWith("--") ? value : void 0;
39387
- }
39388
- }
39389
- return void 0;
38961
+ function flagBeforeCommandRefusal(flag) {
38962
+ return refusal("flag-before-command" /* FlagBeforeCommand */, { flag }, [message("see-commands" /* SeeCommands */)]);
39390
38963
  }
39391
38964
  function answerUnknownCommand(command, help) {
39392
38965
  return {
@@ -39394,33 +38967,11 @@ function answerUnknownCommand(command, help) {
39394
38967
  refusal: refusal("unknown-command" /* UnknownCommand */, { command }, ["", help])
39395
38968
  };
39396
38969
  }
39397
- function modifiersNotTakenRefusal(inv, commands = cliRegistry.commands) {
39398
- const entry = commands.find((command) => command.name === inv.command);
39399
- if (entry?.acceptsHostModifiers !== false || asksForHelp(inv.commandArgs)) return void 0;
39400
- const given = [inv.store === void 0 ? [] : ["--store"], inv.runId === void 0 ? [] : ["--run-id"]].flat();
39401
- if (given.length === 0) return void 0;
39402
- return refusal(
39403
- "modifiers-not-taken" /* ModifiersNotTaken */,
39404
- { command: entry.name, modifiers: given.join(", ") },
39405
- [message("run-without-modifiers" /* RunWithoutModifiers */, { command: entry.name })]
39406
- );
39407
- }
39408
- function formatFilePaths(argv) {
39409
- const paths = [];
39410
- argv.forEach((token, index) => {
39411
- const value = argv[index + 1];
39412
- if (token !== "--format" || value === void 0) return;
39413
- const colon = value.indexOf(":");
39414
- if (colon !== -1) paths.push(value.slice(colon + 1));
39415
- });
39416
- return paths;
39417
- }
39418
38970
  var TOP_LEVEL_HELP;
39419
38971
  var init_host = __esm({
39420
38972
  "src/host.ts"() {
39421
38973
  "use strict";
39422
38974
  init_cliArgs();
39423
- init_cliRegistry();
39424
38975
  init_messages();
39425
38976
  init_appText();
39426
38977
  init_refusal();
@@ -39429,52 +38980,15 @@ var init_host = __esm({
39429
38980
  }
39430
38981
  });
39431
38982
 
39432
- // src/storedRun.ts
39433
- function dispatchesUnstored(inv) {
39434
- return inv.store === void 0 || asksForHelp(inv.commandArgs);
39435
- }
39436
- function storedReRenderRefusal(inv) {
39437
- if (inv.command !== "balance" || asksForHelp(inv.commandArgs)) return void 0;
39438
- if (!inv.commandArgs.includes("--render-from-json")) return void 0;
39439
- const given = [inv.store === void 0 ? [] : ["--store"], inv.runId === void 0 ? [] : ["--run-id"]].flat();
39440
- if (given.length === 0) return void 0;
39441
- return refusal(
39442
- "re-render-not-stored" /* ReRenderNotStored */,
39443
- { modifiers: given.join(", ") },
39444
- [message("re-render-without" /* ReRenderWithout */, { count: given.length })]
39445
- );
39446
- }
39447
- function unstoredRunIdRefusal(inv, commands = cliRegistry.commands) {
39448
- if (inv.runId === void 0 || inv.store !== void 0 || asksForHelp(inv.commandArgs)) return void 0;
39449
- const entry = commands.find((command) => command.name === inv.command);
39450
- if (entry === void 0 || entry.acceptsHostModifiers === false) return void 0;
39451
- return refusal(
39452
- "run-id-without-store" /* RunIdWithoutStore */,
39453
- { runId: inv.runId },
39454
- [message("keep-run-under-name" /* KeepRunUnderName */, { command: entry.name })]
39455
- );
39456
- }
39457
- var init_storedRun = __esm({
39458
- "src/storedRun.ts"() {
39459
- "use strict";
39460
- init_cliArgs();
39461
- init_cliRegistry();
39462
- init_messages();
39463
- init_appText();
39464
- init_refusal();
39465
- }
39466
- });
39467
-
39468
38983
  // src/main.ts
39469
38984
  var main_exports = {};
39470
38985
  __export(main_exports, {
39471
38986
  main: () => main
39472
38987
  });
39473
- import { dirname as dirname6 } from "node:path";
39474
- function runCommand(command, argv, ownRunDir) {
38988
+ function runCommand(command, argv) {
39475
38989
  switch (command) {
39476
38990
  case "balance":
39477
- return runBalance(argv, ownRunDir);
38991
+ return runBalance(argv);
39478
38992
  case "allocate":
39479
38993
  runAllocate(argv);
39480
38994
  return false;
@@ -39487,15 +39001,11 @@ function runCommand(command, argv, ownRunDir) {
39487
39001
  }
39488
39002
  }
39489
39003
  function refuseLeadingFaults(inv) {
39490
- const refusal2 = leadingRefusal(inv);
39491
- if (refusal2 === void 0) return false;
39492
- standardError(process.stderr).error(refusal2);
39004
+ if (inv.refusal === void 0) return false;
39005
+ standardError(process.stderr).error(inv.refusal);
39493
39006
  endRunOn(USAGE_REFUSAL);
39494
39007
  return true;
39495
39008
  }
39496
- function leadingRefusal(inv) {
39497
- return inv.refusal ?? modifiersNotTakenRefusal(inv) ?? storedReRenderRefusal(inv) ?? unstoredRunIdRefusal(inv);
39498
- }
39499
39009
  function main(hostArgv) {
39500
39010
  beginRun();
39501
39011
  try {
@@ -39512,65 +39022,18 @@ function run2(hostArgv) {
39512
39022
  process.stdout.write(renderTopLevelHelp(cliRegistry) + "\n");
39513
39023
  return;
39514
39024
  }
39515
- dispatch(inv, command);
39025
+ if (runCommand(command, inv.commandArgs)) markRunFinished();
39516
39026
  }
39517
39027
  function asksForHelp3(command) {
39518
39028
  return command === "help" || command === "--help" || command === "-h";
39519
39029
  }
39520
- function dispatch(inv, command) {
39521
- if (dispatchesUnstored(inv) || inv.store === void 0) {
39522
- if (runCommand(command, inv.commandArgs)) markRunFinished();
39523
- return;
39524
- }
39525
- runKept(inv, command, inv.store);
39526
- }
39527
- function runKept(inv, command, storeRoot) {
39528
- const runId = resolveRunId({ runId: inv.runId, now: /* @__PURE__ */ new Date() });
39529
- const target = peekFlag(inv.commandArgs, "target") ?? "unknown-target";
39530
- const sourceSha = sourceShaOf(inv.commandArgs);
39531
- const spec = {
39532
- storeRoot,
39533
- target,
39534
- runId,
39535
- formatPaths: formatFilePaths(inv.commandArgs),
39536
- inputs: inputsReadBy(parseArgs(inv.commandArgs), NODE_INPUT_READER)
39537
- };
39538
- const meta = manifestMeta(sourceSha);
39539
- const route = (formatSpecs, runDir) => runCommand(command, wrapCommandArgv(inv.commandArgs, [...formatSpecs]), runDir);
39540
- const plan = settlingRefusal(() => executeKeptRun(spec, meta, route), void 0);
39541
- if (plan === void 0) return;
39542
- markRunFinished();
39543
- process.stdout.write(plan.runDir + "\n");
39544
- }
39545
- function sourceShaOf(commandArgs) {
39546
- const features = peekFlag(commandArgs, "features");
39547
- return resolveSourceSha({
39548
- sourceSha: peekFlag(commandArgs, "source-sha"),
39549
- targetDir: features !== void 0 ? dirname6(features) : void 0
39550
- }) ?? "unknown";
39551
- }
39552
- function manifestMeta(sourceSha) {
39553
- const toolIdentity = resolveToolIdentity();
39554
- return {
39555
- sourceSha,
39556
- toolSha: toolIdentity.toolSha ?? "unknown",
39557
- toolVersion: toolIdentity.toolVersion,
39558
- mode: "balance",
39559
- date: (/* @__PURE__ */ new Date()).toISOString()
39560
- };
39561
- }
39562
39030
  var init_main = __esm({
39563
39031
  "src/main.ts"() {
39564
39032
  "use strict";
39565
39033
  init_cli();
39566
- init_inputsRead();
39567
- init_cliArgs();
39568
39034
  init_cli2();
39569
- init_resolveRunInputs();
39570
- init_keptRun();
39571
39035
  init_host();
39572
39036
  init_cliRegistry();
39573
- init_storedRun();
39574
39037
  init_outputLocation();
39575
39038
  init_crashGuards();
39576
39039
  init_exitCode();