spec-controller 0.1.208 → 0.1.210

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 (2) hide show
  1. package/dist/cli.js +492 -457
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -83,123 +83,70 @@ var init_exitCode = __esm({
83
83
  });
84
84
 
85
85
  // src/messages.ts
86
- var APP_MESSAGES, Unreadable, UNREADABLE_SUBJECTS;
86
+ var APP_MESSAGES, Unreadable;
87
87
  var init_messages = __esm({
88
88
  "src/messages.ts"() {
89
89
  "use strict";
90
90
  APP_MESSAGES = {
91
- [0 /* History */]: () => "the repository's history",
92
- [1 /* Repository */]: () => "the repository",
93
- [2 /* Tree */]: () => "the tree",
94
- [3 /* TreeDirectory */]: () => "a directory in the tree",
95
- [4 /* TreeFile */]: () => "a file in the tree",
96
- [5 /* FeatureFile */]: () => "a feature file",
97
- [6 /* FeatureCorpus */]: () => "the feature corpus",
98
- [7 /* WorkingDirectory */]: () => "the working directory",
99
- [8 /* CouldNotBeRead */]: (subject, reason) => `${subject} could not be read (${reason})`,
100
- [9 /* CouldNotBeReadAt */]: (subject, path, reason) => `${subject} could not be read: ${path} (${reason})`,
101
- [10 /* GitExited */]: (args, status, said) => `git ${args[0]} exited ${status}: ${said}`,
102
- [11 /* FeatureCorpusDirectoryMissing */]: (directory) => `The feature corpus directory does not exist: ${directory}`,
103
- [12 /* StoredRunDirectoryNotCreated */]: () => "The stored run's directory could not be created",
104
- [13 /* HelpTitle */]: () => "spec-controller \u2014 reconcile scenarios against observed evidence",
105
- [14 /* HelpUsage */]: () => "Usage:",
106
- [15 /* HelpCommands */]: () => "Commands:",
107
- [16 /* HelpHostModifiers */]: () => "Host modifiers (before the command):",
108
- [17 /* HelpOptions */]: () => "Options:",
109
- [18 /* HelpArguments */]: () => "Arguments:",
110
- [19 /* HelpPointer */]: () => "Full flags, examples, and CI wiring: docs/user-guide.md.",
111
- [20 /* HelpFlag */]: () => "Show this help and exit.",
112
- [21 /* StoreModifier */]: () => "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).",
113
- [22 /* RunIdModifier */]: () => "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.",
114
- [23 /* BalanceSummary */]: () => "Reconcile Gherkin scenarios against test/CI evidence and emit the Evidence Reconciliation (Markdown to stdout by default).",
115
- [24 /* FeaturesFlag */]: () => "Directory of Gherkin .feature files \u2014 the scenarios, and the `@`-tags naming what each must prove (@unit, @integration, @fitness, \u2026).",
116
- [25 /* VitestFlag */]: () => "A Vitest JSON report \u2014 runtime test evidence.",
117
- [26 /* PytestFlag */]: () => "A pytest JUnit XML report (pytest --junitxml) \u2014 runtime unit test evidence.",
118
- [27 /* JestFlag */]: () => "A Jest JSON report (jest --json --outputFile) \u2014 runtime unit test evidence.",
119
- [28 /* JunitFlag */]: () => "A JUnit XML report from any test runner that writes one, such as gotestsum --junitfile, or a directory of them, such as Maven Surefire's \u2014 runtime unit test evidence.",
120
- [29 /* RspecFlag */]: () => "An RSpec JSON report (rspec --format json --out) \u2014 runtime unit test evidence.",
121
- [30 /* CucumberFlag */]: () => "A Cucumber JSON report \u2014 runtime test evidence.",
122
- [31 /* CiFlag */]: () => "Your CI workflows \u2014 a file, or a directory of them (default .github/workflows). Where a fitness function you have not converted is found running over the real source, and where a check step's `id:` supplies the @SCN its result cites.",
123
- [32 /* PackageJsonFlag */]: () => "The target's package.json \u2014 its `scripts`, and its specController.runners, specController.notChecks and specController.deferralTags. A fitness function is named by its @fitness scenario and the CI step whose id: is that scenario's @SCN; no manifest key names one.",
124
- [33 /* CiStepsFlag */]: () => "The CI run's own record of what each of its steps did \u2014 your pipeline's `toJSON(steps)` dump, evidence for the converted fitness functions. Omit it if you have converted none.",
125
- [34 /* TargetFlag */]: () => "A name recorded verbatim in the report's provenance (which project this run reconciled).",
126
- [35 /* SourceShaFlag */]: () => "Override the git commit SHA recorded in provenance (defaults to the resolved HEAD).",
127
- [36 /* FormatFlag */]: () => "Where to send output (md or json, optionally :<path> to write to a file). Repeatable.",
128
- [37 /* RenderFromJsonFlag */]: () => "Re-render Markdown from a previously saved Evidence Reconciliation JSON \u2014 no reconcile, no live inputs.",
129
- [38 /* StrictFlag */]: () => "Fail the run (exit 3) when it carries Pending Items \u2014 the opt-in that escalates otherwise-run-neutral deferred obligations.",
130
- [39 /* ExitZeroFlag */]: () => "Print the same report but exit 0 on an out-of-balance or scenario-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.",
131
- [40 /* ConfigurationHeading */]: () => "Configuration (in the target repo's package.json):",
132
- [41 /* DeferralTagsKey */]: () => "specController.deferralTags: string[]",
133
- [42 /* DeferralTagsExtend */]: () => "Extra recognised deferral tags. A scenario carrying one defers every obligation it",
134
- [43 /* DeferralTagsNeverReplace */]: () => "names to a Pending Item, extending (never replacing) the built-in set.",
135
- [44 /* BuiltInDeferralTags */]: (tags) => `Built-in deferral tags: ${tags}`,
136
- [45 /* MeasurementsReplacement */]: () => "A fitness function's evidence observation is the outcome of its own CI step: put the check's @SCN on that step's `id:` and hand balance the run's step record with --ci-steps.",
137
- [46 /* AllocateSummary */]: () => "Print the next @SCN code for a feature part: one past the highest the repository has ever carried, the code alone on stdout.",
138
- [47 /* FeaturePartArgument */]: () => "The feature part: a feature file's header code, two to five of A-Z and 0-9.",
139
- [48 /* NewFlag */]: () => "Start a part no feature file's header carries yet: its first code, or one past any number the repository already carries for it.",
140
- [49 /* InputPathMissing */]: (flag, path) => `The ${flag} path does not exist: ${path}`,
141
- [50 /* FlaggedFile */]: (flag) => `The ${flag} file`,
142
- [51 /* FlaggedReport */]: (flag) => `The ${flag} report`,
143
- [52 /* FlaggedRecord */]: (flag) => `The ${flag} record`,
144
- [53 /* FlaggedManifest */]: (flag) => `The ${flag} manifest`,
145
- [54 /* FlaggedSavedReport */]: (flag) => `The ${flag} saved report`,
146
- [55 /* FlaggedCorpus */]: (flag) => `The ${flag} corpus`,
147
- [56 /* FlaggedWorkflows */]: (flag) => `The ${flag} workflows`,
148
- [57 /* DefaultPackageJson */]: () => "The package.json read by default",
149
- [58 /* DefaultFeatureCorpus */]: () => "The feature corpus read by default",
150
- [59 /* DefaultCiWorkflows */]: () => "The CI workflows read by default",
151
- [60 /* VitestReportShape */]: () => "the Vitest JSON reporter writes",
152
- [61 /* JunitReportShape */]: () => "of the JUnit XML report pytest --junitxml writes",
153
- [62 /* JestReportShape */]: () => "of the JSON report jest --json writes",
154
- [63 /* JunitXmlReportShape */]: () => "of a JUnit XML report",
155
- [64 /* RspecReportShape */]: () => "of the JSON report rspec --format json writes",
156
- [65 /* CucumberReportShape */]: () => "the Cucumber JSON formatter writes",
157
- [66 /* CiStepRecordShape */]: () => "of a CI run's record of its steps",
158
- [67 /* PackageManifestShape */]: () => "of a package.json manifest",
159
- [68 /* NotValidJson */]: (subject, path, reason) => `${subject} is not valid JSON: ${path} (${reason})`,
160
- [69 /* NotValidJsonInShape */]: (subject, shape, path, reason) => `${subject} is not valid JSON, so not in the shape ${shape}: ${path} (${reason})`,
161
- [70 /* NotValidXml */]: (subject, shape, path, reason) => `${subject} is not valid XML, so not in the shape ${shape}: ${path} (${reason})`,
162
- [71 /* XmlFaultAtLine */]: (fault, line) => `${fault} at line ${line}`,
163
- [72 /* NotInShape */]: (subject, shape, path, fault) => `${subject} is not in the shape ${shape}: ${path} (${fault})`,
164
- [73 /* NotASavedReconciliation */]: (subject, path, fault) => `${subject} is not a saved reconciliation: ${path} (${fault}). Run balance again to save one.`,
165
- [74 /* NotRenderableAsSaved */]: (subject, path, reason) => `${subject} could not be rendered as a saved reconciliation: ${path} (${reason})`,
166
- [75 /* CorpusFileUnparseable */]: (corpus, file, message2) => `${corpus} contains a feature file that could not be parsed: ${file}
167
- ${message2}`,
168
- [76 /* WorkflowNotYaml */]: (workflows, file, message2) => `${workflows} contain a workflow that is not valid YAML: ${file}
169
- ${message2}`,
170
- [77 /* ReportNotWritten */]: (format) => `The ${format} report could not be written`,
171
- [78 /* HistoryBoundary */]: (unread, risk) => `history: ${unread}; ${risk} may have been used before`,
172
- [79 /* ShallowHistoryUnread */]: (before) => `shallow clone \u2014 history before ${before} unread`,
173
- [80 /* NoRepositoryHistoryRead */]: () => "not a git repository \u2014 none read",
174
- [81 /* RiskOfPartCode */]: (part) => `a code of ${part}`,
175
- [82 /* RiskAboveCode */]: (code) => `a code above ${code}`,
176
- [83 /* HighestSeenNone */]: () => "highest seen: none",
177
- [84 /* HighestSeenInTree */]: (code, path, line) => `highest seen: ${code}, ${path}:${line}`,
178
- [85 /* HighestSeenInCommit */]: (code, path, line, commit) => `highest seen: ${code}, ${path}:${line} in ${commit}`,
179
- [86 /* PartAlreadyHeaded */]: (part) => `note: a feature file's header already carries ${part}, so --new was not needed`,
180
- [87 /* ShapeKindList */]: () => "a list",
181
- [88 /* ShapeKindObject */]: () => "an object",
182
- [89 /* ShapeKindOfType */]: (type) => `a ${type}`,
183
- [90 /* ShapeTopLevel */]: () => "the top level",
184
- [91 /* ShapeWrongKind */]: (where, found, expected) => `${where} is ${found}, not ${expected}`,
185
- [92 /* ShapeFieldMissing */]: (path) => `${path} is missing`,
186
- [93 /* HelpUsageLine */]: (modifierUsage) => `spec-controller ${modifierUsage} <command> [command-args]`,
187
- [94 /* UnexpectedError */]: (name, firstLine2) => `spec-controller stopped on an unexpected error, and gives no verdict: ${name}: ${firstLine2}`,
188
- [95 /* UnexpectedErrorAfterVerdict */]: (name, firstLine2) => `spec-controller hit an unexpected error after its verdict: ${name}: ${firstLine2}`
91
+ [0 /* HelpTitle */]: () => "spec-controller \u2014 reconcile scenarios against observed evidence",
92
+ [1 /* HelpUsage */]: () => "Usage:",
93
+ [2 /* HelpCommands */]: () => "Commands:",
94
+ [3 /* HelpHostModifiers */]: () => "Host modifiers (before the command):",
95
+ [4 /* HelpOptions */]: () => "Options:",
96
+ [5 /* HelpArguments */]: () => "Arguments:",
97
+ [6 /* HelpPointer */]: () => "Full flags, examples, and CI wiring: docs/user-guide.md.",
98
+ [7 /* HelpFlag */]: () => "Show this help and exit.",
99
+ [8 /* StoreModifier */]: () => "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).",
100
+ [9 /* RunIdModifier */]: () => "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.",
101
+ [10 /* BalanceSummary */]: () => "Reconcile Gherkin scenarios against test/CI evidence and emit the Evidence Reconciliation (Markdown to stdout by default).",
102
+ [11 /* FeaturesFlag */]: () => "Directory of Gherkin .feature files \u2014 the scenarios, and the `@`-tags naming what each must prove (@unit, @integration, @fitness, \u2026).",
103
+ [12 /* VitestFlag */]: () => "A Vitest JSON report \u2014 runtime test evidence.",
104
+ [13 /* PytestFlag */]: () => "A pytest JUnit XML report (pytest --junitxml) \u2014 runtime unit test evidence.",
105
+ [14 /* JestFlag */]: () => "A Jest JSON report (jest --json --outputFile) \u2014 runtime unit test evidence.",
106
+ [15 /* JunitFlag */]: () => "A JUnit XML report from any test runner that writes one, such as gotestsum --junitfile, or a directory of them, such as Maven Surefire's \u2014 runtime unit test evidence.",
107
+ [16 /* RspecFlag */]: () => "An RSpec JSON report (rspec --format json --out) \u2014 runtime unit test evidence.",
108
+ [17 /* CucumberFlag */]: () => "A Cucumber JSON report \u2014 runtime test evidence.",
109
+ [18 /* CiFlag */]: () => "Your CI workflows \u2014 a file, or a directory of them (default .github/workflows). Where a fitness function you have not converted is found running over the real source, and where a check step's `id:` supplies the @SCN its result cites.",
110
+ [19 /* PackageJsonFlag */]: () => "The target's package.json \u2014 its `scripts`, and its specController.runners, specController.notChecks and specController.deferralTags. A fitness function is named by its @fitness scenario and the CI step whose id: is that scenario's @SCN; no manifest key names one.",
111
+ [20 /* CiStepsFlag */]: () => "The CI run's own record of what each of its steps did \u2014 your pipeline's `toJSON(steps)` dump, evidence for the converted fitness functions. Omit it if you have converted none.",
112
+ [21 /* TargetFlag */]: () => "A name recorded verbatim in the report's provenance (which project this run reconciled).",
113
+ [22 /* SourceShaFlag */]: () => "Override the git commit SHA recorded in provenance (defaults to the resolved HEAD).",
114
+ [23 /* FormatFlag */]: () => "Where to send output (md or json, optionally :<path> to write to a file). Repeatable.",
115
+ [24 /* RenderFromJsonFlag */]: () => "Re-render Markdown from a previously saved Evidence Reconciliation JSON \u2014 no reconcile, no live inputs.",
116
+ [25 /* StrictFlag */]: () => "Fail the run (exit 3) when it carries Pending Items \u2014 the opt-in that escalates otherwise-run-neutral deferred obligations.",
117
+ [26 /* ExitZeroFlag */]: () => "Print the same report but exit 0 on an out-of-balance or scenario-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.",
118
+ [27 /* ConfigurationHeading */]: () => "Configuration (in the target repo's package.json):",
119
+ [28 /* DeferralTagsKey */]: () => "specController.deferralTags: string[]",
120
+ [29 /* DeferralTagsExtend */]: () => "Extra recognised deferral tags. A scenario carrying one defers every obligation it",
121
+ [30 /* DeferralTagsNeverReplace */]: () => "names to a Pending Item, extending (never replacing) the built-in set.",
122
+ [31 /* BuiltInDeferralTags */]: (tags) => `Built-in deferral tags: ${tags}`,
123
+ [32 /* MeasurementsReplacement */]: () => "A fitness function's evidence observation is the outcome of its own CI step: put the check's @SCN on that step's `id:` and hand balance the run's step record with --ci-steps.",
124
+ [33 /* AllocateSummary */]: () => "Print the next @SCN code for a feature part: one past the highest the repository has ever carried, the code alone on stdout.",
125
+ [34 /* FeaturePartArgument */]: () => "The feature part: a feature file's header code, two to five of A-Z and 0-9.",
126
+ [35 /* NewFlag */]: () => "Start a part no feature file's header carries yet: its first code, or one past any number the repository already carries for it.",
127
+ [36 /* HistoryBoundary */]: (unread, risk) => `history: ${unread}; ${risk} may have been used before`,
128
+ [37 /* ShallowHistoryUnread */]: (before) => `shallow clone \u2014 history before ${before} unread`,
129
+ [38 /* NoRepositoryHistoryRead */]: () => "not a git repository \u2014 none read",
130
+ [39 /* RiskOfPartCode */]: (part) => `a code of ${part}`,
131
+ [40 /* RiskAboveCode */]: (code) => `a code above ${code}`,
132
+ [41 /* HighestSeenNone */]: () => "highest seen: none",
133
+ [42 /* HighestSeenInTree */]: (code, path, line) => `highest seen: ${code}, ${path}:${line}`,
134
+ [43 /* HighestSeenInCommit */]: (code, path, line, commit) => `highest seen: ${code}, ${path}:${line} in ${commit}`,
135
+ [44 /* PartAlreadyHeaded */]: (part) => `note: a feature file's header already carries ${part}, so --new was not needed`,
136
+ [45 /* HelpUsageLine */]: (modifierUsage) => `spec-controller ${modifierUsage} <command> [command-args]`,
137
+ ["unexpected-error" /* UnexpectedError */]: (name, firstLine2) => `spec-controller stopped on an unexpected error [${"unexpected-error" /* UnexpectedError */}], and gives no verdict: ${name}: ${firstLine2}`,
138
+ ["unexpected-error-after-verdict" /* UnexpectedErrorAfterVerdict */]: (name, firstLine2) => `spec-controller hit an unexpected error [${"unexpected-error-after-verdict" /* UnexpectedErrorAfterVerdict */}] after its verdict: ${name}: ${firstLine2}`
189
139
  };
190
140
  Unreadable = {
191
- History: 0 /* History */,
192
- Repository: 1 /* Repository */,
193
- Tree: 2 /* Tree */,
194
- TreeDirectory: 3 /* TreeDirectory */,
195
- TreeFile: 4 /* TreeFile */,
196
- FeatureFile: 5 /* FeatureFile */,
197
- FeatureCorpus: 6 /* FeatureCorpus */,
198
- WorkingDirectory: 7 /* WorkingDirectory */
141
+ History: "history" /* History */,
142
+ Repository: "repository" /* Repository */,
143
+ Tree: "tree" /* Tree */,
144
+ TreeDirectory: "tree-directory" /* TreeDirectory */,
145
+ TreeFile: "tree-file" /* TreeFile */,
146
+ FeatureFile: "feature-file" /* FeatureFile */,
147
+ FeatureCorpus: "feature-corpus" /* FeatureCorpus */,
148
+ WorkingDirectory: "working-directory" /* WorkingDirectory */
199
149
  };
200
- UNREADABLE_SUBJECTS = Object.fromEntries(
201
- Object.values(Unreadable).map((code) => [code, APP_MESSAGES[code]()])
202
- );
203
150
  }
204
151
  });
205
152
 
@@ -269,7 +216,7 @@ function settleExitCode(proc) {
269
216
  endRunOn(UNEXPECTED_ERROR, proc);
270
217
  }
271
218
  function unexpectedErrorLine(err, afterVerdict) {
272
- const message2 = afterVerdict ? 95 /* UnexpectedErrorAfterVerdict */ : 94 /* UnexpectedError */;
219
+ const message2 = afterVerdict ? "unexpected-error-after-verdict" /* UnexpectedErrorAfterVerdict */ : "unexpected-error" /* UnexpectedError */;
273
220
  return APP_MESSAGES[message2](nameOf(err), firstLineOf(err));
274
221
  }
275
222
  function nameOf(err) {
@@ -350,66 +297,6 @@ var init_inputReading = __esm({
350
297
  }
351
298
  });
352
299
 
353
- // src/ingest/ingestScenarios.ts
354
- import { readFileSync as readFileSync2, readdirSync as readdirSync2 } from "node:fs";
355
- import { join as join2 } from "node:path";
356
- function entriesOf(dir) {
357
- return readdirSync2(dir, { withFileTypes: true });
358
- }
359
- function corpusEntries(dir) {
360
- try {
361
- return entriesOf(dir);
362
- } catch (err) {
363
- if (err.code === "ENOENT") throw new MissingFeatureCorpusError(dir);
364
- throw err;
365
- }
366
- }
367
- function featureFilesUnder(dir, prefix, entries) {
368
- return entries.flatMap((entry) => {
369
- const relativePath = `${prefix}${entry.name}`;
370
- if (entry.name.endsWith(".feature")) return [relativePath];
371
- if (!entry.isDirectory()) return [];
372
- const subdirectory = join2(dir, entry.name);
373
- return featureFilesUnder(subdirectory, `${relativePath}/`, entriesOf(subdirectory));
374
- });
375
- }
376
- function corpusPathOf(dir, relativePath) {
377
- return join2(dir, relativePath);
378
- }
379
- function slugOf(relativePath) {
380
- return relativePath.slice(0, -".feature".length);
381
- }
382
- function corpusFeatureFiles(dir) {
383
- return featureFilesUnder(dir, "", corpusEntries(dir)).sort().map((relativePath) => ({ path: corpusPathOf(dir, relativePath), relativePath }));
384
- }
385
- function readFeatureSource(path) {
386
- try {
387
- return readFileSync2(path, "utf8");
388
- } catch (err) {
389
- const errno = err;
390
- errno.path ??= path;
391
- throw err;
392
- }
393
- }
394
- function readFeatureSources(dir) {
395
- return corpusFeatureFiles(dir).map(({ path, relativePath }) => ({ path, relativePath, source: readFeatureSource(path) }));
396
- }
397
- var MissingFeatureCorpusError;
398
- var init_ingestScenarios = __esm({
399
- "src/ingest/ingestScenarios.ts"() {
400
- "use strict";
401
- init_messages();
402
- MissingFeatureCorpusError = class extends Error {
403
- directory;
404
- constructor(directory) {
405
- super(APP_MESSAGES[11 /* FeatureCorpusDirectoryMissing */](directory));
406
- this.name = "MissingFeatureCorpusError";
407
- this.directory = directory;
408
- }
409
- };
410
- }
411
- });
412
-
413
300
  // ../../node_modules/.pnpm/@cucumber+gherkin@41.0.0/node_modules/@cucumber/gherkin/dist/AstNode.js
414
301
  var AstNode;
415
302
  var init_AstNode = __esm({
@@ -19887,7 +19774,7 @@ function childrenOf(node) {
19887
19774
  }
19888
19775
  function pipeline(node, outputs) {
19889
19776
  const last = node.commands.length - 1;
19890
- return node.commands.flatMap((stage, at) => walk(stage, at < last ? pointing(outputs, 1, true) : outputs));
19777
+ return node.commands.flatMap((stage, at2) => walk(stage, at2 < last ? pointing(outputs, 1, true) : outputs));
19891
19778
  }
19892
19779
  function walk(node, outputs) {
19893
19780
  if (node.type === "Command")
@@ -19916,12 +19803,12 @@ function launched(words2) {
19916
19803
  const next = handedOn(words2);
19917
19804
  return next === void 0 ? words2 : launched(next);
19918
19805
  }
19919
- function afterSelections(head, at, invocations) {
19920
- const option = head[at]?.replace(/=.*/, "");
19806
+ function afterSelections(head, at2, invocations) {
19807
+ const option = head[at2]?.replace(/=.*/, "");
19921
19808
  const valueWords = invocations.selections?.get(option);
19922
19809
  if (valueWords === void 0)
19923
- return at;
19924
- return afterSelections(head, at + (option === head[at] ? 1 + valueWords : 1), invocations);
19810
+ return at2;
19811
+ return afterSelections(head, at2 + (option === head[at2] ? 1 + valueWords : 1), invocations);
19925
19812
  }
19926
19813
  function scriptsNamedBy(head) {
19927
19814
  const invocations = SCRIPT_INVOCATIONS.get(head[0]);
@@ -19936,11 +19823,11 @@ function scriptsNamedBy(head) {
19936
19823
  return [next];
19937
19824
  return [isOneOf(invocations.testShortcuts, word) ? "test" : void 0, invocations.runsBareName ? word : void 0];
19938
19825
  }
19939
- function pastOptions(words2, at, prefix) {
19940
- const word = words2[at];
19826
+ function pastOptions(words2, at2, prefix) {
19827
+ const word = words2[at2];
19941
19828
  if (word === void 0 || !(word.startsWith("-") || ASSIGNMENT.test(word)))
19942
- return at;
19943
- return pastOptions(words2, at + (prefix.valued.includes(word) ? 2 : 1), prefix);
19829
+ return at2;
19830
+ return pastOptions(words2, at2 + (prefix.valued.includes(word) ? 2 : 1), prefix);
19944
19831
  }
19945
19832
  function passedOn(words2) {
19946
19833
  const prefix = COMMAND_PREFIXES.find((row) => opensWith(words2, row.words));
@@ -20056,11 +19943,11 @@ var init_commandRuns = __esm({
20056
19943
  }
20057
19944
  ]
20058
19945
  ]);
20059
- opensAt = (words2, prefix, from) => prefix.every((word, at) => words2[from + at] === word);
19946
+ opensAt = (words2, prefix, from) => prefix.every((word, at2) => words2[from + at2] === word);
20060
19947
  opensWith = (words2, prefix) => opensAt(words2, prefix, 0);
20061
19948
  namedOnLine = (line, invocation) => {
20062
19949
  const words2 = wordsOf(line);
20063
- return words2.some((_, at) => opensAt(words2, invocation, at));
19950
+ return words2.some((_, at2) => opensAt(words2, invocation, at2));
20064
19951
  };
20065
19952
  NOTHING = [];
20066
19953
  SHELLS = /* @__PURE__ */ new Set(["bash", "sh"]);
@@ -27597,24 +27484,24 @@ function reconcilerRoleOf(step, runsTheReconciler) {
27597
27484
  return "reconciles";
27598
27485
  return step.writesStepRecord ? "records" : void 0;
27599
27486
  }
27600
- function reconcilerSteps(steps, nameOf2, runsTheReconciler) {
27487
+ function reconcilerSteps(steps, nameOf3, runsTheReconciler) {
27601
27488
  return {
27602
27489
  steps: steps.flatMap((step) => {
27603
27490
  const role = reconcilerRoleOf(step, runsTheReconciler);
27604
- return role === void 0 ? [] : [{ step: nameOf2(step), role }];
27491
+ return role === void 0 ? [] : [{ step: nameOf3(step), role }];
27605
27492
  }),
27606
27493
  isReconciler: (step) => reconcilerRoleOf(step, runsTheReconciler) !== void 0,
27607
27494
  roleOf: (step) => reconcilerRoleOf(step, runsTheReconciler)
27608
27495
  };
27609
27496
  }
27610
- function nonChecksApplied(steps, nameOf2, nonChecks) {
27611
- const named = new Set(steps.map(nameOf2));
27497
+ function nonChecksApplied(steps, nameOf3, nonChecks) {
27498
+ const named = new Set(steps.map(nameOf3));
27612
27499
  const excluded = nonChecks.filter((entry) => named.has(entry));
27613
27500
  return {
27614
27501
  excluded,
27615
27502
  unmatchedEntries: nonChecks.filter((entry) => !named.has(entry)),
27616
27503
  isExcluded: (step) => {
27617
- const name = nameOf2(step);
27504
+ const name = nameOf3(step);
27618
27505
  return excluded.some((entry) => entry === name);
27619
27506
  }
27620
27507
  };
@@ -27672,12 +27559,12 @@ function totalOf(rows) {
27672
27559
  plumbing: summed("plumbing")
27673
27560
  };
27674
27561
  }
27675
- function stepsBehindCounts(steps, dispositionOf, nameOf2, roleOf) {
27562
+ function stepsBehindCounts(steps, dispositionOf, nameOf3, roleOf) {
27676
27563
  const reconciler = steps.filter((step) => dispositionOf(step) === "reconciler").flatMap((step) => {
27677
27564
  const role = roleOf(step);
27678
- return role === void 0 ? [] : [{ step: nameOf2(step), role }];
27565
+ return role === void 0 ? [] : [{ step: nameOf3(step), role }];
27679
27566
  });
27680
- const namesOf = (disposition) => steps.filter((step) => dispositionOf(step) === disposition).map(nameOf2);
27567
+ const namesOf = (disposition) => steps.filter((step) => dispositionOf(step) === disposition).map(nameOf3);
27681
27568
  const runners = namesOf("runner");
27682
27569
  const nonChecks = namesOf("nonCheck");
27683
27570
  const plumbing = namesOf("plumbing");
@@ -27688,7 +27575,7 @@ function stepsBehindCounts(steps, dispositionOf, nameOf2, roleOf) {
27688
27575
  ...plumbing.length > 0 ? { plumbing } : {}
27689
27576
  };
27690
27577
  }
27691
- function stepAccountOf(steps, dispositionOf, nameOf2, roleOf) {
27578
+ function stepAccountOf(steps, dispositionOf, nameOf3, roleOf) {
27692
27579
  const rows = /* @__PURE__ */ new Map();
27693
27580
  for (const step of steps) {
27694
27581
  const row = rows.get(jobKeyOf(step)) ?? noStepsOf(step);
@@ -27699,7 +27586,7 @@ function stepAccountOf(steps, dispositionOf, nameOf2, roleOf) {
27699
27586
  return {
27700
27587
  byJob,
27701
27588
  total: totalOf(byJob),
27702
- steps: stepsBehindCounts(stepsInAccountingOrder(steps), dispositionOf, nameOf2, roleOf)
27589
+ steps: stepsBehindCounts(stepsInAccountingOrder(steps), dispositionOf, nameOf3, roleOf)
27703
27590
  };
27704
27591
  }
27705
27592
  function declaredRunnersRunBy(scripts, runners, shell) {
@@ -27713,17 +27600,17 @@ function declaredRunnerTest(scripts, runners, shell) {
27713
27600
  const runnersRunBy = declaredRunnersRunBy(scripts, runners, shell);
27714
27601
  return (step) => runnersRunBy(step).length > 0;
27715
27602
  }
27716
- function recognisedRunners(steps, nameOf2, scripts, runners, shell) {
27603
+ function recognisedRunners(steps, nameOf3, scripts, runners, shell) {
27717
27604
  const runnersRunBy = declaredRunnersRunBy(scripts, runners, shell);
27718
27605
  return steps.flatMap((step) => runnersRunBy(step).map(([layer, runner]) => ({
27719
27606
  layer,
27720
27607
  runner,
27721
- step: nameOf2(step)
27608
+ step: nameOf3(step)
27722
27609
  })));
27723
27610
  }
27724
- function countedRunners(steps, dispositionOf, nameOf2, scripts, runners, shell) {
27611
+ function countedRunners(steps, dispositionOf, nameOf3, scripts, runners, shell) {
27725
27612
  const counted2 = stepsInAccountingOrder(steps).filter((step) => dispositionOf(step) === "runner");
27726
- return recognisedRunners(counted2, nameOf2, scripts, runners, shell);
27613
+ return recognisedRunners(counted2, nameOf3, scripts, runners, shell);
27727
27614
  }
27728
27615
  var WORKFLOW_FILE_THEN_COLON, jobKeyOf, byCodeUnit, byWorkflowThenJob, stepsInAccountingOrder, workflowsReadInOrder, COUNTED_AS, noStepsOf;
27729
27616
  var init_uncitedFitnessFunctions = __esm({
@@ -28096,15 +27983,15 @@ function kindOf(value) {
28096
27983
  return "list";
28097
27984
  return typeof value;
28098
27985
  }
28099
- function wrongKindsInList(value, at) {
27986
+ function wrongKindsInList(value, at2) {
28100
27987
  if (!Array.isArray(value))
28101
- return [wrongKind(at, value, "list")];
28102
- return value.flatMap((entry, i) => isListEntry(entry) ? [] : [wrongKind(`${at}[${i}]`, entry, "string")]);
27988
+ return [wrongKind(at2, value, "list")];
27989
+ return value.flatMap((entry, i) => isListEntry(entry) ? [] : [wrongKind(`${at2}[${i}]`, entry, "string")]);
28103
27990
  }
28104
- function wrongKindsInRunners(value, at) {
27991
+ function wrongKindsInRunners(value, at2) {
28105
27992
  if (!isBlock(value))
28106
- return [wrongKind(at, value, "object")];
28107
- return Object.entries(value).filter(([key, runner]) => isLayer(key) && !isRunner(runner)).map(([key, runner]) => wrongKind(`${at}.${key}`, runner, "string-or-null"));
27993
+ return [wrongKind(at2, value, "object")];
27994
+ return Object.entries(value).filter(([key, runner]) => isLayer(key) && !isRunner(runner)).map(([key, runner]) => wrongKind(`${at2}.${key}`, runner, "string-or-null"));
28108
27995
  }
28109
27996
  function configurationRead(values, wrongKinds, unknownKeys) {
28110
27997
  return {
@@ -32484,6 +32371,187 @@ var init_dist3 = __esm({
32484
32371
  }
32485
32372
  });
32486
32373
 
32374
+ // src/messages.en.json
32375
+ var messages_en_default;
32376
+ var init_messages_en = __esm({
32377
+ "src/messages.en.json"() {
32378
+ messages_en_default = {
32379
+ "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}.",
32380
+ "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.",
32381
+ "see-commands-and-modifiers": "Run 'spec-controller --help' to see the commands and host modifiers this version accepts.",
32382
+ "see-modifiers": "Run 'spec-controller --help' to see the host modifiers this version accepts.",
32383
+ "see-flags": "Run ''{scope} --help' to see the flags this version accepts.",
32384
+ "see-flags-and-values": "Run ''{scope} --help' to see the flags this version accepts and the values they take.",
32385
+ "see-arguments": "Run ''{scope} --help' to see what this version accepts.",
32386
+ "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.",
32387
+ "modifier-took-command": "The {modifier} host modifier took ''{command}'', a command, as its value, and left no command to run.",
32388
+ "give-modifier-its-own-value": "Give {modifier} its own value, as in 'spec-controller {modifier} {arg} {command} \u2026'.",
32389
+ "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}''.",
32390
+ "unknown-command": 'unknown command "{command}".',
32391
+ "modifiers-not-taken": "''{command}'' takes no host modifier, and was given {modifiers}: it answers a query and keeps no run.",
32392
+ "run-without-modifiers": "Run 'spec-controller {command} \u2026' without them.",
32393
+ "missing-value": "The {flag} flag of ''{scope}'' needs a value \u2014 {flag} {arg} \u2014 and was given none.",
32394
+ "given-twice": "The {flag} flag of ''{scope}'' was given more than once, and is read once: give it once.",
32395
+ "equals-form": "The {token} form is not read by ''{scope}'': a flag and its value are two arguments, as in ''{spelling}''.",
32396
+ "takes-no-value": "The {flag} flag of ''{scope}'' takes no value, and was given one: ''{value}''.",
32397
+ "extra-argument": "The argument ''{token}'' is more than ''{scope}'' takes: it takes {takes} once, and its flags.",
32398
+ "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.",
32399
+ "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.",
32400
+ "unknown-flag": "Unknown flag {flag} for ''{scope}'' \u2014 this is spec-controller {toolVersion}, and that flag is not in its {command} scope.",
32401
+ "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}.",
32402
+ "otherwise-see-flags": "Otherwise run ''{scope} --help' to see the flags this version accepts.",
32403
+ "retired-flag": "Retired flag {flag} for ''{scope}'' \u2014 retired in spec-controller {retiredIn}, and no later version accepts it (this is spec-controller {toolVersion}).",
32404
+ "do-not-pin-retired": "Do not pin an earlier version to get it back: that restores the route it was retired with.",
32405
+ "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.",
32406
+ "re-render-without-it": "Run 'spec-controller balance --render-from-json <path>' without it.",
32407
+ "re-render-without-them": "Run 'spec-controller balance --render-from-json <path>' without them.",
32408
+ "run-id-without-store": "--run-id names a stored run, and was given ''{runId}'' with no --store, so no run is kept under it.",
32409
+ "keep-run-under-name": "To keep the run under that name, give --store <root> as well; otherwise run ''{command}'' without --run-id.",
32410
+ "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).",
32411
+ "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.",
32412
+ "unknown-format": "Unknown --format {formats}. Supported formats are {supported} (e.g. --format md, --format json:report.json).",
32413
+ "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).",
32414
+ "outputs-share-file": "Two outputs name the same file: {first} and {second}. Give each output a file of its own.",
32415
+ "output-overwrites-input": "An output would overwrite a file this run reads: {output} is {subject}, {path}. Give the report a file of its own.",
32416
+ "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.",
32417
+ "unknown-part-refused": "unknown part \u2014 no feature file's header carries {part}.\nThe parts this corpus's feature files carry: {parts}.",
32418
+ "no-parts-carried": "none",
32419
+ "no-feature-part-given": "no feature part was given: 'spec-controller allocate <FFF>' takes one, a feature file's header code.",
32420
+ "not-a-feature-part": "''{part}'' is not a feature part: two to five characters, each A-Z or 0-9.",
32421
+ "default-corpus-feature-file": "a feature file of the corpus read by default",
32422
+ "flagged-corpus-feature-file": "a feature file of the --features corpus",
32423
+ "default-ci-workflow": "a CI workflow read by default",
32424
+ "flagged-ci-workflow": "the --ci workflow",
32425
+ "flagged-ci-folder-workflow": "a workflow of the --ci folder",
32426
+ "format-on-standard-output": "{fmt} on standard output",
32427
+ "coded-usage-error": "spec-controller {command}: usage error [{code}] \u2014 {message}",
32428
+ "coded-host-usage-error": "spec-controller: usage error [{code}] \u2014 {message}",
32429
+ history: "the repository's history",
32430
+ repository: "the repository",
32431
+ tree: "the tree",
32432
+ "tree-directory": "a directory in the tree",
32433
+ "tree-file": "a file in the tree",
32434
+ "feature-file": "a feature file",
32435
+ "feature-corpus": "the feature corpus",
32436
+ "working-directory": "the working directory",
32437
+ "working-directory-unreadable": "{subject} could not be read ({reason})",
32438
+ "could-not-be-read": "{subject} could not be read: {path} ({reason})",
32439
+ "git-exited": "git {command} exited {status}: {said}",
32440
+ "feature-corpus-directory-missing": "The feature corpus directory does not exist: {directory}",
32441
+ "stored-run-directory-not-created": "The stored run's directory could not be created: {path} ({reason})",
32442
+ "input-path-missing": "The {flag} path does not exist: {path}",
32443
+ "flagged-file": "The {flag} file",
32444
+ "flagged-report": "The {flag} report",
32445
+ "flagged-record": "The {flag} record",
32446
+ "flagged-manifest": "The {flag} manifest",
32447
+ "flagged-saved-report": "The {flag} saved report",
32448
+ "flagged-corpus": "The {flag} corpus",
32449
+ "flagged-workflows": "The {flag} workflows",
32450
+ "default-package-json": "The package.json read by default",
32451
+ "default-feature-corpus": "The feature corpus read by default",
32452
+ "default-ci-workflows": "The CI workflows read by default",
32453
+ "vitest-report-shape": "the Vitest JSON reporter writes",
32454
+ "junit-report-shape": "of the JUnit XML report pytest --junitxml writes",
32455
+ "jest-report-shape": "of the JSON report jest --json writes",
32456
+ "junit-xml-report-shape": "of a JUnit XML report",
32457
+ "rspec-report-shape": "of the JSON report rspec --format json writes",
32458
+ "cucumber-report-shape": "the Cucumber JSON formatter writes",
32459
+ "ci-step-record-shape": "of a CI run's record of its steps",
32460
+ "package-manifest-shape": "of a package.json manifest",
32461
+ "not-valid-json": "{subject} is not valid JSON: {path} ({reason})",
32462
+ "not-valid-json-in-shape": "{subject} is not valid JSON, so not in the shape {shape}: {path} ({reason})",
32463
+ "not-valid-xml": "{subject} is not valid XML, so not in the shape {shape}: {path} ({reason})",
32464
+ "xml-fault-at-line": "{fault} at line {line}",
32465
+ "not-in-shape": "{subject} is not in the shape {shape}: {path} ({fault})",
32466
+ "not-a-saved-reconciliation": "{subject} is not a saved reconciliation: {path} ({fault}). Run balance again to save one.",
32467
+ "not-renderable-as-saved": "{subject} could not be rendered as a saved reconciliation: {path} ({reason})",
32468
+ "corpus-file-unparseable": "{corpus} contains a feature file that could not be parsed: {file}\n{message}",
32469
+ "workflow-not-yaml": "{workflows} contain a workflow that is not valid YAML: {file}\n{message}",
32470
+ "report-not-written": "The {format} report could not be written: {path} ({reason})",
32471
+ "shape-kind-list": "a list",
32472
+ "shape-kind-object": "an object",
32473
+ "shape-kind-of-type": "a {type}",
32474
+ "shape-top-level": "the top level",
32475
+ "shape-wrong-kind": "{where} is {found}, not {expected}",
32476
+ "shape-field-missing": "{path} is missing"
32477
+ };
32478
+ }
32479
+ });
32480
+
32481
+ // src/appText.ts
32482
+ var message;
32483
+ var init_appText = __esm({
32484
+ "src/appText.ts"() {
32485
+ "use strict";
32486
+ init_dist3();
32487
+ init_messages_en();
32488
+ message = messagesFrom(
32489
+ messages_en_default
32490
+ );
32491
+ }
32492
+ });
32493
+
32494
+ // src/ingest/ingestScenarios.ts
32495
+ import { readFileSync as readFileSync2, readdirSync as readdirSync2 } from "node:fs";
32496
+ import { join as join2 } from "node:path";
32497
+ function entriesOf(dir) {
32498
+ return readdirSync2(dir, { withFileTypes: true });
32499
+ }
32500
+ function corpusEntries(dir) {
32501
+ try {
32502
+ return entriesOf(dir);
32503
+ } catch (err) {
32504
+ if (err.code === "ENOENT") throw new MissingFeatureCorpusError(dir);
32505
+ throw err;
32506
+ }
32507
+ }
32508
+ function featureFilesUnder(dir, prefix, entries) {
32509
+ return entries.flatMap((entry) => {
32510
+ const relativePath = `${prefix}${entry.name}`;
32511
+ if (entry.name.endsWith(".feature")) return [relativePath];
32512
+ if (!entry.isDirectory()) return [];
32513
+ const subdirectory = join2(dir, entry.name);
32514
+ return featureFilesUnder(subdirectory, `${relativePath}/`, entriesOf(subdirectory));
32515
+ });
32516
+ }
32517
+ function corpusPathOf(dir, relativePath) {
32518
+ return join2(dir, relativePath);
32519
+ }
32520
+ function slugOf(relativePath) {
32521
+ return relativePath.slice(0, -".feature".length);
32522
+ }
32523
+ function corpusFeatureFiles(dir) {
32524
+ return featureFilesUnder(dir, "", corpusEntries(dir)).sort().map((relativePath) => ({ path: corpusPathOf(dir, relativePath), relativePath }));
32525
+ }
32526
+ function readFeatureSource(path) {
32527
+ try {
32528
+ return readFileSync2(path, "utf8");
32529
+ } catch (err) {
32530
+ const errno = err;
32531
+ errno.path ??= path;
32532
+ throw err;
32533
+ }
32534
+ }
32535
+ function readFeatureSources(dir) {
32536
+ return corpusFeatureFiles(dir).map(({ path, relativePath }) => ({ path, relativePath, source: readFeatureSource(path) }));
32537
+ }
32538
+ var MissingFeatureCorpusError;
32539
+ var init_ingestScenarios = __esm({
32540
+ "src/ingest/ingestScenarios.ts"() {
32541
+ "use strict";
32542
+ init_messages();
32543
+ init_appText();
32544
+ MissingFeatureCorpusError = class extends Error {
32545
+ directory;
32546
+ constructor(directory) {
32547
+ super(message("feature-corpus-directory-missing" /* FeatureCorpusDirectoryMissing */, { directory }));
32548
+ this.name = "MissingFeatureCorpusError";
32549
+ this.directory = directory;
32550
+ }
32551
+ };
32552
+ }
32553
+ });
32554
+
32487
32555
  // src/ingest/ingestQualityChecks.ts
32488
32556
  import { basename } from "node:path";
32489
32557
  function sourcesOf(featuresDir) {
@@ -32521,8 +32589,8 @@ function workflowSourcesOf(path, read) {
32521
32589
  function parsedWorkflowsOf({ paths, sources }) {
32522
32590
  const parse5 = parseWorkflows(sources);
32523
32591
  if (parse5.kind === "parsed") return { kind: "read", workflows: parse5.parsed };
32524
- const pathOf4 = new Map(paths.map((read) => [basename(read), read]));
32525
- return { kind: "unparseable", faults: parse5.faults.map(({ file, message: message2 }) => ({ file: pathOf4.get(file) ?? file, message: message2 })) };
32592
+ const pathOf3 = new Map(paths.map((read) => [basename(read), read]));
32593
+ return { kind: "unparseable", faults: parse5.faults.map(({ file, message: message2 }) => ({ file: pathOf3.get(file) ?? file, message: message2 })) };
32526
32594
  }
32527
32595
  function readWorkflows(ciPath, read = readUtf8) {
32528
32596
  const path = ciPath ?? DEFAULT_CI_PATH;
@@ -32587,23 +32655,40 @@ var init_ingestQualityChecks = __esm({
32587
32655
  // src/ingest/inputShapes.ts
32588
32656
  function kindOf2(value) {
32589
32657
  if (value === null) return "null";
32590
- if (Array.isArray(value)) return APP_MESSAGES[87 /* ShapeKindList */]();
32591
- if (typeof value === "object") return APP_MESSAGES[88 /* ShapeKindObject */]();
32592
- return APP_MESSAGES[89 /* ShapeKindOfType */](typeof value);
32658
+ if (Array.isArray(value)) return "list";
32659
+ return typeof value;
32593
32660
  }
32594
32661
  function expectedKindOf(shape) {
32595
- if (typeof shape === "string") return APP_MESSAGES[89 /* ShapeKindOfType */](shape);
32596
- return "list" in shape ? APP_MESSAGES[87 /* ShapeKindList */]() : APP_MESSAGES[88 /* ShapeKindObject */]();
32662
+ if (typeof shape === "string") return shape;
32663
+ return "list" in shape ? "list" : "object";
32664
+ }
32665
+ function wordedKind(kind) {
32666
+ if (kind === "null") return kind;
32667
+ if (kind === "list") return message("shape-kind-list" /* ShapeKindList */);
32668
+ if (kind === "object") return message("shape-kind-object" /* ShapeKindObject */);
32669
+ return message("shape-kind-of-type" /* ShapeKindOfType */, { type: kind });
32670
+ }
32671
+ function at(path) {
32672
+ return { kind: "at", path };
32673
+ }
32674
+ function nameOf2(position) {
32675
+ return position.kind === "top" ? message("shape-top-level" /* ShapeTopLevel */) : position.path;
32676
+ }
32677
+ function fieldOf(position, key) {
32678
+ return at(position.kind === "top" ? key : `${position.path}.${key}`);
32597
32679
  }
32598
- function pathOf(where, key) {
32599
- return where === "" ? key : `${where}.${key}`;
32680
+ function itemOf(position, index) {
32681
+ return at(`${position.kind === "top" ? "" : position.path}[${index}]`);
32600
32682
  }
32601
- function shapeFaultIn(value, shape, where = "") {
32683
+ function shapeFaultIn(value, shape) {
32684
+ return faultAt(value, shape, TOP);
32685
+ }
32686
+ function faultAt(value, shape, where) {
32602
32687
  if (shape === "anything") return null;
32603
32688
  const found = kindOf2(value);
32604
32689
  const expected = expectedKindOf(shape);
32605
32690
  if (found !== expected)
32606
- return APP_MESSAGES[91 /* ShapeWrongKind */](where === "" ? APP_MESSAGES[90 /* ShapeTopLevel */]() : where, found, expected);
32691
+ return message("shape-wrong-kind" /* ShapeWrongKind */, { where: nameOf2(where), found: wordedKind(found), expected: wordedKind(expected) });
32607
32692
  if (typeof shape === "string") return null;
32608
32693
  if ("list" in shape) return listFault(value, shape.list, where);
32609
32694
  if ("entries" in shape) return entriesFault(value, shape, where);
@@ -32611,19 +32696,19 @@ function shapeFaultIn(value, shape, where = "") {
32611
32696
  }
32612
32697
  function listFault(items, item, where) {
32613
32698
  for (const [index, value] of items.entries()) {
32614
- const fault = shapeFaultIn(value, item, `${where}[${index}]`);
32699
+ const fault = faultAt(value, item, itemOf(where, index));
32615
32700
  if (fault !== null) return fault;
32616
32701
  }
32617
32702
  return null;
32618
32703
  }
32619
32704
  function fieldsFault(record, shape, where) {
32620
32705
  for (const [key, field] of Object.entries(shape.fields)) {
32621
- const path = pathOf(where, key);
32706
+ const position = fieldOf(where, key);
32622
32707
  if (record[key] === void 0) {
32623
- if (shape.required?.includes(key) === true) return APP_MESSAGES[92 /* ShapeFieldMissing */](path);
32708
+ if (shape.required?.includes(key) === true) return message("shape-field-missing" /* ShapeFieldMissing */, { path: position.path });
32624
32709
  continue;
32625
32710
  }
32626
- const fault = shapeFaultIn(record[key], field, path);
32711
+ const fault = faultAt(record[key], field, position);
32627
32712
  if (fault !== null) return fault;
32628
32713
  }
32629
32714
  return null;
@@ -32631,17 +32716,18 @@ function fieldsFault(record, shape, where) {
32631
32716
  function entriesFault(record, shape, where) {
32632
32717
  for (const [key, value] of Object.entries(record)) {
32633
32718
  if (shape.keys !== void 0 && !shape.keys(key)) continue;
32634
- const fault = shapeFaultIn(value, shape.entries, pathOf(where, key));
32719
+ const fault = faultAt(value, shape.entries, fieldOf(where, key));
32635
32720
  if (fault !== null) return fault;
32636
32721
  }
32637
32722
  return null;
32638
32723
  }
32639
- var VITEST_REPORT, JUNIT_REPORT, RSPEC_REPORT, CUCUMBER_REPORT, CI_STEP_RECORD, PACKAGE_MANIFEST, SAVED_RECONCILIATION;
32724
+ var VITEST_REPORT, JUNIT_REPORT, RSPEC_REPORT, CUCUMBER_REPORT, CI_STEP_RECORD, PACKAGE_MANIFEST, SAVED_RECONCILIATION, TOP;
32640
32725
  var init_inputShapes = __esm({
32641
32726
  "src/ingest/inputShapes.ts"() {
32642
32727
  "use strict";
32643
32728
  init_dist3();
32644
32729
  init_messages();
32730
+ init_appText();
32645
32731
  VITEST_REPORT = {
32646
32732
  fields: {
32647
32733
  testResults: {
@@ -32724,6 +32810,7 @@ var init_inputShapes = __esm({
32724
32810
  },
32725
32811
  required: ["runProvenance", "summary", "ledger"]
32726
32812
  };
32813
+ TOP = { kind: "top" };
32727
32814
  }
32728
32815
  });
32729
32816
 
@@ -32744,57 +32831,57 @@ var init_evidenceInputs = __esm({
32744
32831
  init_messages();
32745
32832
  init_inputShapes();
32746
32833
  DECLARED = [
32747
- { flag: "features", key: "features", arg: "<dir>", description: 24 /* FeaturesFlag */ },
32834
+ { flag: "features", key: "features", arg: "<dir>", description: 11 /* FeaturesFlag */ },
32748
32835
  {
32749
32836
  flag: "vitest",
32750
32837
  key: "vitest",
32751
32838
  arg: "<report.json>",
32752
- description: 25 /* VitestFlag */,
32839
+ description: 12 /* VitestFlag */,
32753
32840
  report: {
32754
32841
  reader: "vitest",
32755
32842
  format: "json",
32756
32843
  shape: VITEST_REPORT,
32757
- subject: 51 /* FlaggedReport */,
32758
- writer: 60 /* VitestReportShape */
32844
+ subject: "flagged-report" /* FlaggedReport */,
32845
+ writer: "vitest-report-shape" /* VitestReportShape */
32759
32846
  }
32760
32847
  },
32761
32848
  {
32762
32849
  flag: "pytest",
32763
32850
  key: "pytest",
32764
32851
  arg: "<report.xml>",
32765
- description: 26 /* PytestFlag */,
32852
+ description: 13 /* PytestFlag */,
32766
32853
  report: {
32767
32854
  reader: "pytest",
32768
32855
  format: "junit-xml",
32769
32856
  shape: JUNIT_REPORT,
32770
- subject: 51 /* FlaggedReport */,
32771
- writer: 61 /* JunitReportShape */
32857
+ subject: "flagged-report" /* FlaggedReport */,
32858
+ writer: "junit-report-shape" /* JunitReportShape */
32772
32859
  }
32773
32860
  },
32774
32861
  {
32775
32862
  flag: "jest",
32776
32863
  key: "jest",
32777
32864
  arg: "<report.json>",
32778
- description: 27 /* JestFlag */,
32865
+ description: 14 /* JestFlag */,
32779
32866
  report: {
32780
32867
  reader: "jest",
32781
32868
  format: "json-naming-its-shape",
32782
32869
  shape: VITEST_REPORT,
32783
- subject: 51 /* FlaggedReport */,
32784
- writer: 62 /* JestReportShape */
32870
+ subject: "flagged-report" /* FlaggedReport */,
32871
+ writer: "jest-report-shape" /* JestReportShape */
32785
32872
  }
32786
32873
  },
32787
32874
  {
32788
32875
  flag: "junit",
32789
32876
  key: "junit",
32790
32877
  arg: "<report.xml>",
32791
- description: 28 /* JunitFlag */,
32878
+ description: 15 /* JunitFlag */,
32792
32879
  report: {
32793
32880
  reader: "junit",
32794
32881
  format: "junit-xml-or-one-suite",
32795
32882
  shape: JUNIT_REPORT,
32796
- subject: 51 /* FlaggedReport */,
32797
- writer: 63 /* JunitXmlReportShape */,
32883
+ subject: "flagged-report" /* FlaggedReport */,
32884
+ writer: "junit-xml-report-shape" /* JunitXmlReportShape */,
32798
32885
  takesADirectory: true
32799
32886
  }
32800
32887
  },
@@ -32802,53 +32889,53 @@ var init_evidenceInputs = __esm({
32802
32889
  flag: "rspec",
32803
32890
  key: "rspec",
32804
32891
  arg: "<report.json>",
32805
- description: 29 /* RspecFlag */,
32892
+ description: 16 /* RspecFlag */,
32806
32893
  report: {
32807
32894
  reader: "rspec",
32808
32895
  format: "json-naming-its-shape",
32809
32896
  shape: RSPEC_REPORT,
32810
- subject: 51 /* FlaggedReport */,
32811
- writer: 64 /* RspecReportShape */
32897
+ subject: "flagged-report" /* FlaggedReport */,
32898
+ writer: "rspec-report-shape" /* RspecReportShape */
32812
32899
  }
32813
32900
  },
32814
32901
  {
32815
32902
  flag: "cucumber",
32816
32903
  key: "cucumber",
32817
32904
  arg: "<report.json>",
32818
- description: 30 /* CucumberFlag */,
32905
+ description: 17 /* CucumberFlag */,
32819
32906
  report: {
32820
32907
  reader: "cucumber",
32821
32908
  format: "json",
32822
32909
  shape: CUCUMBER_REPORT,
32823
- subject: 51 /* FlaggedReport */,
32824
- writer: 65 /* CucumberReportShape */
32910
+ subject: "flagged-report" /* FlaggedReport */,
32911
+ writer: "cucumber-report-shape" /* CucumberReportShape */
32825
32912
  }
32826
32913
  },
32827
- { flag: "ci", key: "ci", arg: "<ci.yml>", description: 31 /* CiFlag */ },
32914
+ { flag: "ci", key: "ci", arg: "<ci.yml>", description: 18 /* CiFlag */ },
32828
32915
  {
32829
32916
  flag: "package-json",
32830
32917
  key: "packageJson",
32831
32918
  arg: "<path>",
32832
- description: 32 /* PackageJsonFlag */,
32919
+ description: 19 /* PackageJsonFlag */,
32833
32920
  report: {
32834
32921
  reader: "package-manifest",
32835
32922
  format: "json",
32836
32923
  shape: PACKAGE_MANIFEST,
32837
- subject: 53 /* FlaggedManifest */,
32838
- writer: 67 /* PackageManifestShape */
32924
+ subject: "flagged-manifest" /* FlaggedManifest */,
32925
+ writer: "package-manifest-shape" /* PackageManifestShape */
32839
32926
  }
32840
32927
  },
32841
32928
  {
32842
32929
  flag: "ci-steps",
32843
32930
  key: "ciSteps",
32844
32931
  arg: "<record.json>",
32845
- description: 33 /* CiStepsFlag */,
32932
+ description: 20 /* CiStepsFlag */,
32846
32933
  report: {
32847
32934
  reader: "ci-step-record",
32848
32935
  format: "json",
32849
32936
  shape: CI_STEP_RECORD,
32850
- subject: 52 /* FlaggedRecord */,
32851
- writer: 66 /* CiStepRecordShape */
32937
+ subject: "flagged-record" /* FlaggedRecord */,
32938
+ writer: "ci-step-record-shape" /* CiStepRecordShape */
32852
32939
  }
32853
32940
  }
32854
32941
  ];
@@ -32857,83 +32944,13 @@ var init_evidenceInputs = __esm({
32857
32944
  }
32858
32945
  });
32859
32946
 
32860
- // src/messages.en.json
32861
- var messages_en_default;
32862
- var init_messages_en = __esm({
32863
- "src/messages.en.json"() {
32864
- messages_en_default = {
32865
- "usage-error": "spec-controller {command}: usage error \u2014 {message}",
32866
- "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}.",
32867
- "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.",
32868
- "see-commands-and-modifiers": "Run 'spec-controller --help' to see the commands and host modifiers this version accepts.",
32869
- "see-modifiers": "Run 'spec-controller --help' to see the host modifiers this version accepts.",
32870
- "see-flags": "Run ''{scope} --help' to see the flags this version accepts.",
32871
- "see-flags-and-values": "Run ''{scope} --help' to see the flags this version accepts and the values they take.",
32872
- "see-arguments": "Run ''{scope} --help' to see what this version accepts.",
32873
- "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.",
32874
- "modifier-took-command": "The {modifier} host modifier took ''{command}'', a command, as its value, and left no command to run.",
32875
- "give-modifier-its-own-value": "Give {modifier} its own value, as in 'spec-controller {modifier} {arg} {command} \u2026'.",
32876
- "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}''.",
32877
- "unknown-command": 'unknown command "{command}".',
32878
- "modifiers-not-taken": "''{command}'' takes no host modifier, and was given {modifiers}: it answers a query and keeps no run.",
32879
- "run-without-modifiers": "Run 'spec-controller {command} \u2026' without them.",
32880
- "missing-value": "The {flag} flag of ''{scope}'' needs a value \u2014 {flag} {arg} \u2014 and was given none.",
32881
- "given-twice": "The {flag} flag of ''{scope}'' was given more than once, and is read once: give it once.",
32882
- "equals-form": "The {token} form is not read by ''{scope}'': a flag and its value are two arguments, as in ''{spelling}''.",
32883
- "takes-no-value": "The {flag} flag of ''{scope}'' takes no value, and was given one: ''{value}''.",
32884
- "extra-argument": "The argument ''{token}'' is more than ''{scope}'' takes: it takes {takes} once, and its flags.",
32885
- "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.",
32886
- "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.",
32887
- "unknown-flag": "Unknown flag {flag} for ''{scope}'' \u2014 this is spec-controller {toolVersion}, and that flag is not in its {command} scope.",
32888
- "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}.",
32889
- "otherwise-see-flags": "Otherwise run ''{scope} --help' to see the flags this version accepts.",
32890
- "retired-flag": "Retired flag {flag} for ''{scope}'' \u2014 retired in spec-controller {retiredIn}, and no later version accepts it (this is spec-controller {toolVersion}).",
32891
- "do-not-pin-retired": "Do not pin an earlier version to get it back: that restores the route it was retired with.",
32892
- "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.",
32893
- "re-render-without-it": "Run 'spec-controller balance --render-from-json <path>' without it.",
32894
- "re-render-without-them": "Run 'spec-controller balance --render-from-json <path>' without them.",
32895
- "run-id-without-store": "--run-id names a stored run, and was given ''{runId}'' with no --store, so no run is kept under it.",
32896
- "keep-run-under-name": "To keep the run under that name, give --store <root> as well; otherwise run ''{command}'' without --run-id.",
32897
- "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).",
32898
- "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.",
32899
- "unknown-format": "Unknown --format {formats}. Supported formats are {supported} (e.g. --format md, --format json:report.json).",
32900
- "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).",
32901
- "outputs-share-file": "Two outputs name the same file: {first} and {second}. Give each output a file of its own.",
32902
- "output-overwrites-input": "An output would overwrite a file this run reads: {output} is {subject}, {path}. Give the report a file of its own.",
32903
- "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.",
32904
- "unknown-part-refused": "unknown part \u2014 no feature file's header carries {part}.\nThe parts this corpus's feature files carry: {parts}.",
32905
- "no-parts-carried": "none",
32906
- "no-feature-part-given": "no feature part was given: 'spec-controller allocate <FFF>' takes one, a feature file's header code.",
32907
- "not-a-feature-part": "''{part}'' is not a feature part: two to five characters, each A-Z or 0-9.",
32908
- "default-corpus-feature-file": "a feature file of the corpus read by default",
32909
- "flagged-corpus-feature-file": "a feature file of the --features corpus",
32910
- "default-ci-workflow": "a CI workflow read by default",
32911
- "flagged-ci-workflow": "the --ci workflow",
32912
- "flagged-ci-folder-workflow": "a workflow of the --ci folder",
32913
- "format-on-standard-output": "{fmt} on standard output",
32914
- "coded-usage-error": "spec-controller {command}: usage error [{code}] \u2014 {message}",
32915
- "coded-host-usage-error": "spec-controller: usage error [{code}] \u2014 {message}"
32916
- };
32917
- }
32918
- });
32919
-
32920
- // src/appText.ts
32921
- var message;
32922
- var init_appText = __esm({
32923
- "src/appText.ts"() {
32924
- "use strict";
32925
- init_dist3();
32926
- init_messages_en();
32927
- message = messagesFrom(
32928
- messages_en_default
32929
- );
32930
- }
32931
- });
32932
-
32933
32947
  // src/refusal.ts
32934
32948
  function refusal(code, values, pointers = []) {
32935
32949
  return Object.assign(Object.create(PRINTED_REFUSAL), { code, values, pointers });
32936
32950
  }
32951
+ function refusals(each) {
32952
+ return { lines: (command) => each.map((one) => one.lines(command)).join("\n") };
32953
+ }
32937
32954
  function openingLine(code, text, command) {
32938
32955
  return command === void 0 ? message("coded-host-usage-error" /* CodedHostUsageError */, { code, message: text }) : message("coded-usage-error" /* CodedUsageError */, { command, code, message: text });
32939
32956
  }
@@ -33023,15 +33040,15 @@ var init_format = __esm({
33023
33040
  // src/outputLocation.ts
33024
33041
  import { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync, realpathSync, statSync as statSync2, unlinkSync } from "node:fs";
33025
33042
  import { dirname, resolve, sep } from "node:path";
33026
- function unwritableRefusal(subject, path, err) {
33043
+ function unwritableRefusal(what, path, err) {
33027
33044
  const reason = err instanceof Error ? err.message : String(err);
33028
- return `${subject}: ${path} (${reason})`;
33045
+ return what.kind === "report" ? refusal("report-not-written" /* ReportNotWritten */, { format: what.format, path, reason }) : refusal("stored-run-directory-not-created" /* StoredRunDirectoryNotCreated */, { path, reason });
33029
33046
  }
33030
- function writeOrRefuse(subject, path, write) {
33047
+ function writeOrRefuse(what, path, write) {
33031
33048
  try {
33032
33049
  write();
33033
33050
  } catch (err) {
33034
- refuse(unwritableRefusal(subject, path, err));
33051
+ refuse(unwritableRefusal(what, path, err));
33035
33052
  }
33036
33053
  }
33037
33054
  function refuse(error) {
@@ -33137,6 +33154,8 @@ var init_outputLocation = __esm({
33137
33154
  "use strict";
33138
33155
  init_exitCode();
33139
33156
  init_standardError();
33157
+ init_refusal();
33158
+ init_messages();
33140
33159
  UsageRefusal = class extends Error {
33141
33160
  name = "UsageRefusal";
33142
33161
  exitCode = USAGE_EXIT_CODE;
@@ -33189,8 +33208,8 @@ function vetDestinations(outputs, stdoutFile, inputs) {
33189
33208
  const identified = [];
33190
33209
  for (const output of outputs) {
33191
33210
  const probe = identify(output, stdoutFile, created);
33192
- if (typeof probe === "string") return probe;
33193
- identified.push({ output, identity: probe });
33211
+ if (probe.kind === "refused") return probe.refusal;
33212
+ identified.push({ output, identity: probe.identity });
33194
33213
  }
33195
33214
  return sharedFileRefusal(identified) ?? inputOverwriteRefusal(identified, inputs);
33196
33215
  } finally {
@@ -33207,17 +33226,17 @@ function earlierStoredRunRefusal(outputs, earlierStoredRunDirOf2) {
33207
33226
  }
33208
33227
  function identify(output, stdoutFile, created) {
33209
33228
  const dest = output.dest;
33210
- if (dest.kind === "stdout") return stdoutFile();
33229
+ if (dest.kind === "stdout") return { kind: "identified", identity: stdoutFile() };
33211
33230
  try {
33212
33231
  const probed = probeDestination(dest.path);
33213
33232
  if (probed.created !== void 0) created.push(probed.created);
33214
- return probed.identity;
33233
+ return { kind: "identified", identity: probed.identity };
33215
33234
  } catch (err) {
33216
- return unwritableRefusal(refusalSubject(output), dest.path, err);
33235
+ return { kind: "refused", refusal: unwritableRefusal(reportOf2(output), dest.path, err) };
33217
33236
  }
33218
33237
  }
33219
- function refusalSubject(output) {
33220
- return APP_MESSAGES[77 /* ReportNotWritten */](output.fmt);
33238
+ function reportOf2(output) {
33239
+ return { kind: "report", format: output.fmt };
33221
33240
  }
33222
33241
  function emit(output, text) {
33223
33242
  const dest = output.dest;
@@ -33225,7 +33244,7 @@ function emit(output, text) {
33225
33244
  process.stdout.write(text);
33226
33245
  return;
33227
33246
  }
33228
- writeOrRefuse(refusalSubject(output), dest.path, () => writeFileSync(dest.path, text));
33247
+ writeOrRefuse(reportOf2(output), dest.path, () => writeFileSync(dest.path, text));
33229
33248
  }
33230
33249
  var init_writer = __esm({
33231
33250
  "src/cli-balance/emit/writer.ts"() {
@@ -37594,7 +37613,7 @@ var init_fxp = __esm({
37594
37613
  // src/ingest/junitXml.ts
37595
37614
  function parseJunitXml(text) {
37596
37615
  const valid = XMLValidator.validate(text);
37597
- if (valid !== true) throw new Error(APP_MESSAGES[71 /* XmlFaultAtLine */](valid.err.msg.replace(/\.$/, ""), valid.err.line));
37616
+ if (valid !== true) throw new Error(message("xml-fault-at-line" /* XmlFaultAtLine */, { fault: valid.err.msg.replace(/\.$/, ""), line: valid.err.line }));
37598
37617
  return JUNIT_XML.parse(text);
37599
37618
  }
37600
37619
  function parseJunitXmlLiftingBareSuite(text) {
@@ -37608,6 +37627,7 @@ var init_junitXml = __esm({
37608
37627
  "use strict";
37609
37628
  init_fxp();
37610
37629
  init_messages();
37630
+ init_appText();
37611
37631
  JUNIT_REPEATED_ELEMENTS = /* @__PURE__ */ new Set(["testsuite", "testcase", "property"]);
37612
37632
  JUNIT_XML = new XMLParser({
37613
37633
  ignoreAttributes: false,
@@ -37684,14 +37704,14 @@ function jsonInputsOf(args, exists) {
37684
37704
  const path = args[flag];
37685
37705
  if (report === void 0 || path === void 0) return [];
37686
37706
  const paths = report.takesADirectory === true && isDirectory(path) ? reportFilesIn(path) : [path];
37687
- const subject = APP_MESSAGES[report.subject](`--${flag}`);
37707
+ const subject = message(report.subject, { flag: `--${flag}` });
37688
37708
  return paths.map((file) => ({ subject, path: file, report, flagged: true }));
37689
37709
  });
37690
37710
  return [...given, ...manifestReadByDefault(args, exists)];
37691
37711
  }
37692
37712
  function manifestReadByDefault(args, exists) {
37693
37713
  return EVIDENCE_INPUTS.flatMap(
37694
- ({ flag, report }) => report?.reader === "package-manifest" && args[flag] === void 0 && exists(DEFAULT_PACKAGE_JSON) ? [{ subject: APP_MESSAGES[57 /* DefaultPackageJson */](), path: DEFAULT_PACKAGE_JSON, report, flagged: false }] : []
37714
+ ({ flag, report }) => report?.reader === "package-manifest" && args[flag] === void 0 && exists(DEFAULT_PACKAGE_JSON) ? [{ subject: message("default-package-json" /* DefaultPackageJson */), path: DEFAULT_PACKAGE_JSON, report, flagged: false }] : []
37695
37715
  );
37696
37716
  }
37697
37717
  function isDirectory(path) {
@@ -37719,29 +37739,29 @@ function readReports(inputs, read = readUtf8) {
37719
37739
  return { kind: "read", files, reports };
37720
37740
  }
37721
37741
  function reportRefusal({ subject, path, report, reading }) {
37722
- const writer = APP_MESSAGES[report.writer]();
37742
+ const shape = message(report.writer);
37723
37743
  switch (reading.kind) {
37724
37744
  case "read-fault":
37725
- return APP_MESSAGES[9 /* CouldNotBeReadAt */](subject, path, reading.fault.reason);
37745
+ return refusal("could-not-be-read" /* CouldNotBeRead */, { subject, path, reason: reading.fault.reason });
37726
37746
  case "unparseable":
37727
- return NOT_VALID_IN[report.format](subject, writer, path, reading.reason);
37747
+ return NOT_VALID_IN[report.format](subject, shape, path, reading.reason);
37728
37748
  case "misshapen":
37729
- return APP_MESSAGES[72 /* NotInShape */](subject, writer, path, reading.fault);
37749
+ return refusal("not-in-shape" /* NotInShape */, { subject, shape, path, fault: reading.fault });
37730
37750
  }
37731
37751
  }
37732
37752
  function checkInputShapes(reports) {
37733
37753
  return reports.kind === "faulty" ? reportRefusal(reports.first) : null;
37734
37754
  }
37735
37755
  function pathRefusal(subject, fault) {
37736
- return APP_MESSAGES[9 /* CouldNotBeReadAt */](subject, fault.path, fault.reason);
37756
+ return refusal("could-not-be-read" /* CouldNotBeRead */, { subject, path: fault.path, reason: fault.reason });
37737
37757
  }
37738
37758
  function corpusDirRefusal(fault) {
37739
- return pathRefusal(APP_MESSAGES[58 /* DefaultFeatureCorpus */](), fault);
37759
+ return pathRefusal(message("default-feature-corpus" /* DefaultFeatureCorpus */), fault);
37740
37760
  }
37741
37761
  function checkInputPaths(args, corpusReading, workflowReading) {
37742
37762
  if (corpusReading.kind === "read-fault") {
37743
37763
  return pathRefusal(
37744
- args["features"] === void 0 ? APP_MESSAGES[58 /* DefaultFeatureCorpus */]() : APP_MESSAGES[55 /* FlaggedCorpus */]("--features"),
37764
+ args["features"] === void 0 ? message("default-feature-corpus" /* DefaultFeatureCorpus */) : message("flagged-corpus" /* FlaggedCorpus */, { flag: "--features" }),
37745
37765
  corpusReading.fault
37746
37766
  );
37747
37767
  }
@@ -37751,35 +37771,43 @@ function checkInputPaths(args, corpusReading, workflowReading) {
37751
37771
  return null;
37752
37772
  }
37753
37773
  function savedReportRefusal(path, reading) {
37754
- return APP_MESSAGES[9 /* CouldNotBeReadAt */](
37755
- APP_MESSAGES[54 /* FlaggedSavedReport */]("--render-from-json"),
37774
+ return refusal("could-not-be-read" /* CouldNotBeRead */, {
37775
+ subject: message("flagged-saved-report" /* FlaggedSavedReport */, { flag: "--render-from-json" }),
37756
37776
  path,
37757
- reading.kind === "read-fault" ? reading.fault.reason : reading.reason
37758
- );
37777
+ reason: reading.kind === "read-fault" ? reading.fault.reason : reading.reason
37778
+ });
37759
37779
  }
37760
37780
  function checkSavedReconciliation(path, saved) {
37761
37781
  const fault = shapeFaultIn(saved, SAVED_RECONCILIATION);
37762
37782
  if (fault === null) return null;
37763
- return APP_MESSAGES[73 /* NotASavedReconciliation */](APP_MESSAGES[50 /* FlaggedFile */]("--render-from-json"), path, fault);
37783
+ return refusal("not-a-saved-reconciliation" /* NotASavedReconciliation */, {
37784
+ subject: message("flagged-file" /* FlaggedFile */, { flag: "--render-from-json" }),
37785
+ path,
37786
+ fault
37787
+ });
37764
37788
  }
37765
37789
  function reRenderOrRefusal(path, saved, strict) {
37766
37790
  try {
37767
37791
  return reRender(saved, strict);
37768
37792
  } catch (err) {
37769
- return APP_MESSAGES[74 /* NotRenderableAsSaved */](
37770
- APP_MESSAGES[50 /* FlaggedFile */]("--render-from-json"),
37793
+ return refusal("not-renderable-as-saved" /* NotRenderableAsSaved */, {
37794
+ subject: message("flagged-file" /* FlaggedFile */, { flag: "--render-from-json" }),
37771
37795
  path,
37772
- reasonOf(err)
37773
- );
37796
+ reason: reasonOf(err)
37797
+ });
37774
37798
  }
37775
37799
  }
37776
37800
  function workflowsSubjectOf(args) {
37777
- return args["ci"] === void 0 ? APP_MESSAGES[59 /* DefaultCiWorkflows */]() : APP_MESSAGES[56 /* FlaggedWorkflows */]("--ci");
37801
+ return args["ci"] === void 0 ? message("default-ci-workflows" /* DefaultCiWorkflows */) : message("flagged-workflows" /* FlaggedWorkflows */, { flag: "--ci" });
37778
37802
  }
37779
37803
  function checkWorkflowsParse(args, workflowReading) {
37780
37804
  if (workflowReading.kind !== "unparseable") return null;
37781
- const { file, message: message2 } = workflowReading.faults[0];
37782
- return APP_MESSAGES[76 /* WorkflowNotYaml */](workflowsSubjectOf(args), file, message2);
37805
+ const { file, message: text } = workflowReading.faults[0];
37806
+ return refusal("workflow-not-yaml" /* WorkflowNotYaml */, { workflows: workflowsSubjectOf(args), file, message: text });
37807
+ }
37808
+ function corpusUnparseableRefusal(faults) {
37809
+ const corpus = message("flagged-corpus" /* FlaggedCorpus */, { flag: "--features" });
37810
+ return refusals(faults.map(({ file, message: text }) => refusal("corpus-file-unparseable" /* CorpusFileUnparseable */, { corpus, file, message: text })));
37783
37811
  }
37784
37812
  var NOT_VALID_IN;
37785
37813
  var init_unreadableInputs = __esm({
@@ -37792,12 +37820,14 @@ var init_unreadableInputs = __esm({
37792
37820
  init_reportReading();
37793
37821
  init_reRender();
37794
37822
  init_messages();
37823
+ init_appText();
37824
+ init_refusal();
37795
37825
  init_evidenceInputs();
37796
37826
  NOT_VALID_IN = {
37797
- json: (subject, _writer, path, reason) => APP_MESSAGES[68 /* NotValidJson */](subject, path, reason),
37798
- "json-naming-its-shape": APP_MESSAGES[69 /* NotValidJsonInShape */],
37799
- "junit-xml": APP_MESSAGES[70 /* NotValidXml */],
37800
- "junit-xml-or-one-suite": APP_MESSAGES[70 /* NotValidXml */]
37827
+ json: (subject, _shape, path, reason) => refusal("not-valid-json" /* NotValidJson */, { subject, path, reason }),
37828
+ "json-naming-its-shape": (subject, shape, path, reason) => refusal("not-valid-json-in-shape" /* NotValidJsonInShape */, { subject, shape, path, reason }),
37829
+ "junit-xml": (subject, shape, path, reason) => refusal("not-valid-xml" /* NotValidXml */, { subject, shape, path, reason }),
37830
+ "junit-xml-or-one-suite": (subject, shape, path, reason) => refusal("not-valid-xml" /* NotValidXml */, { subject, shape, path, reason })
37801
37831
  };
37802
37832
  }
37803
37833
  });
@@ -37910,19 +37940,19 @@ function urlOriginName(transport, scheme, rest) {
37910
37940
  const afterAuthority = rest.slice(authority.length);
37911
37941
  const host = authority.slice(authority.lastIndexOf("@") + 1);
37912
37942
  if (afterAuthority.includes("@") || host === "") return null;
37913
- const path = pathOf2(afterAuthority);
37943
+ const path = pathOf(afterAuthority);
37914
37944
  const ownerRepo = transport === "" && OWNER_REPO_SCHEMES.has(scheme) ? ownerRepoOf(path) : null;
37915
37945
  return ownerRepo ?? `${transport}${scheme}://${host}${path}`;
37916
37946
  }
37917
37947
  function scpOriginName(address) {
37918
- const at = address.lastIndexOf("@");
37919
- const hostPath = address.slice(at + 1);
37948
+ const at2 = address.lastIndexOf("@");
37949
+ const hostPath = address.slice(at2 + 1);
37920
37950
  const colon = hostPath.indexOf(":");
37921
37951
  if (colon <= 0) return null;
37922
- const path = pathOf2(hostPath.slice(colon + 1));
37923
- return (at !== -1 ? ownerRepoOf(path) : null) ?? `${hostPath.slice(0, colon)}:${path}`;
37952
+ const path = pathOf(hostPath.slice(colon + 1));
37953
+ return (at2 !== -1 ? ownerRepoOf(path) : null) ?? `${hostPath.slice(0, colon)}:${path}`;
37924
37954
  }
37925
- function pathOf2(rest) {
37955
+ function pathOf(rest) {
37926
37956
  return rest.split(/[?#]/, 1)[0];
37927
37957
  }
37928
37958
  function ownerRepoOf(path) {
@@ -38059,7 +38089,7 @@ function serialiseRunManifest(manifest) {
38059
38089
  function executeKeptRun(spec, meta, route) {
38060
38090
  const plan = planKeptRun(spec);
38061
38091
  writeOrRefuse(
38062
- APP_MESSAGES[12 /* StoredRunDirectoryNotCreated */](),
38092
+ { kind: "stored-run-directory" },
38063
38093
  plan.runDir,
38064
38094
  () => mkdirSync(plan.runDir, { recursive: true })
38065
38095
  );
@@ -38109,7 +38139,7 @@ function renderCommandHelp(command) {
38109
38139
  `spec-controller ${command.name} \u2014 ${command.summary}`,
38110
38140
  ...positionalHelp(command.name, command.positionals ?? []),
38111
38141
  "",
38112
- APP_MESSAGES[17 /* HelpOptions */](),
38142
+ APP_MESSAGES[4 /* HelpOptions */](),
38113
38143
  ...lines,
38114
38144
  ...configHelp.length > 0 ? ["", ...configHelp] : []
38115
38145
  ].join("\n");
@@ -38119,9 +38149,9 @@ function positionalHelp(command, positionals) {
38119
38149
  const width = Math.max(...positionals.map((positional) => positional.name.length));
38120
38150
  return [
38121
38151
  "",
38122
- `${APP_MESSAGES[14 /* HelpUsage */]()} spec-controller ${command} ${positionals.map((positional) => positional.name).join(" ")} [options]`,
38152
+ `${APP_MESSAGES[1 /* HelpUsage */]()} spec-controller ${command} ${positionals.map((positional) => positional.name).join(" ")} [options]`,
38123
38153
  "",
38124
- APP_MESSAGES[18 /* HelpArguments */](),
38154
+ APP_MESSAGES[5 /* HelpArguments */](),
38125
38155
  ...positionals.map((positional) => ` ${positional.name.padEnd(width + 2)}${positional.description}`)
38126
38156
  ];
38127
38157
  }
@@ -38138,18 +38168,18 @@ function renderTopLevelHelp(registry) {
38138
38168
  );
38139
38169
  const modifierUsage = registry.global.map((flag) => `[${flagLabel(flag)}]`).join(" ");
38140
38170
  return [
38141
- APP_MESSAGES[13 /* HelpTitle */](),
38171
+ APP_MESSAGES[0 /* HelpTitle */](),
38142
38172
  "",
38143
- APP_MESSAGES[14 /* HelpUsage */](),
38144
- ` ${APP_MESSAGES[93 /* HelpUsageLine */](modifierUsage)}`,
38173
+ APP_MESSAGES[1 /* HelpUsage */](),
38174
+ ` ${APP_MESSAGES[45 /* HelpUsageLine */](modifierUsage)}`,
38145
38175
  "",
38146
- APP_MESSAGES[15 /* HelpCommands */](),
38176
+ APP_MESSAGES[2 /* HelpCommands */](),
38147
38177
  ...commandLines,
38148
38178
  "",
38149
- APP_MESSAGES[16 /* HelpHostModifiers */](),
38179
+ APP_MESSAGES[3 /* HelpHostModifiers */](),
38150
38180
  ...modifierLines,
38151
38181
  "",
38152
- APP_MESSAGES[19 /* HelpPointer */]()
38182
+ APP_MESSAGES[6 /* HelpPointer */]()
38153
38183
  ].join("\n");
38154
38184
  }
38155
38185
  var balanceFlags, balanceConfigHelp, balanceRetiredFlags, globalFlags, balanceCommand, allocateCommand, cliRegistry;
@@ -38164,84 +38194,84 @@ var init_cliRegistry = __esm({
38164
38194
  {
38165
38195
  name: "--target",
38166
38196
  arg: "<name>",
38167
- description: APP_MESSAGES[34 /* TargetFlag */]()
38197
+ description: APP_MESSAGES[21 /* TargetFlag */]()
38168
38198
  },
38169
38199
  {
38170
38200
  name: "--source-sha",
38171
38201
  arg: "<sha>",
38172
- description: APP_MESSAGES[35 /* SourceShaFlag */]()
38202
+ description: APP_MESSAGES[22 /* SourceShaFlag */]()
38173
38203
  },
38174
38204
  {
38175
38205
  name: "--format",
38176
38206
  arg: "<fmt>[:<path>]",
38177
38207
  repeatable: true,
38178
- description: APP_MESSAGES[36 /* FormatFlag */]()
38208
+ description: APP_MESSAGES[23 /* FormatFlag */]()
38179
38209
  },
38180
38210
  {
38181
38211
  name: "--render-from-json",
38182
38212
  arg: "<path>",
38183
- description: APP_MESSAGES[37 /* RenderFromJsonFlag */]()
38213
+ description: APP_MESSAGES[24 /* RenderFromJsonFlag */]()
38184
38214
  },
38185
38215
  {
38186
38216
  name: "--strict",
38187
- description: APP_MESSAGES[38 /* StrictFlag */]()
38217
+ description: APP_MESSAGES[25 /* StrictFlag */]()
38188
38218
  },
38189
38219
  {
38190
38220
  name: "--exit-zero",
38191
- description: APP_MESSAGES[39 /* ExitZeroFlag */]()
38221
+ description: APP_MESSAGES[26 /* ExitZeroFlag */]()
38192
38222
  },
38193
38223
  {
38194
38224
  name: "--help",
38195
38225
  aliases: ["-h"],
38196
- description: APP_MESSAGES[20 /* HelpFlag */]()
38226
+ description: APP_MESSAGES[7 /* HelpFlag */]()
38197
38227
  }
38198
38228
  ];
38199
38229
  balanceConfigHelp = [
38200
- APP_MESSAGES[40 /* ConfigurationHeading */](),
38201
- ` ${APP_MESSAGES[41 /* DeferralTagsKey */]()}`,
38202
- ` ${APP_MESSAGES[42 /* DeferralTagsExtend */]()}`,
38203
- ` ${APP_MESSAGES[43 /* DeferralTagsNeverReplace */]()}`,
38204
- ` ${APP_MESSAGES[44 /* BuiltInDeferralTags */](BUILT_IN_DEFERRAL_TAGS.map((tag) => `@${tag}`).join(", "))}`
38230
+ APP_MESSAGES[27 /* ConfigurationHeading */](),
38231
+ ` ${APP_MESSAGES[28 /* DeferralTagsKey */]()}`,
38232
+ ` ${APP_MESSAGES[29 /* DeferralTagsExtend */]()}`,
38233
+ ` ${APP_MESSAGES[30 /* DeferralTagsNeverReplace */]()}`,
38234
+ ` ${APP_MESSAGES[31 /* BuiltInDeferralTags */](BUILT_IN_DEFERRAL_TAGS.map((tag) => `@${tag}`).join(", "))}`
38205
38235
  ];
38206
38236
  balanceRetiredFlags = [
38207
38237
  {
38208
38238
  name: "--measurements",
38209
38239
  retiredIn: "0.1.0-alpha.5",
38210
- replacement: APP_MESSAGES[45 /* MeasurementsReplacement */]()
38240
+ replacement: APP_MESSAGES[32 /* MeasurementsReplacement */]()
38211
38241
  }
38212
38242
  ];
38213
38243
  globalFlags = [
38214
38244
  {
38215
38245
  name: "--store",
38216
38246
  arg: "<root>",
38217
- description: APP_MESSAGES[21 /* StoreModifier */]()
38247
+ description: APP_MESSAGES[8 /* StoreModifier */]()
38218
38248
  },
38219
38249
  {
38220
38250
  name: "--run-id",
38221
38251
  arg: "<id>",
38222
- description: APP_MESSAGES[22 /* RunIdModifier */]()
38252
+ description: APP_MESSAGES[9 /* RunIdModifier */]()
38223
38253
  }
38224
38254
  ];
38225
38255
  balanceCommand = {
38226
38256
  name: "balance",
38227
- summary: APP_MESSAGES[23 /* BalanceSummary */](),
38257
+ summary: APP_MESSAGES[10 /* BalanceSummary */](),
38228
38258
  flags: balanceFlags,
38229
38259
  configHelp: balanceConfigHelp,
38230
38260
  retiredFlags: balanceRetiredFlags
38231
38261
  };
38232
38262
  allocateCommand = {
38233
38263
  name: "allocate",
38234
- summary: APP_MESSAGES[46 /* AllocateSummary */](),
38264
+ summary: APP_MESSAGES[33 /* AllocateSummary */](),
38235
38265
  acceptsHostModifiers: false,
38236
38266
  positionals: [
38237
- { name: "<FFF>", description: APP_MESSAGES[47 /* FeaturePartArgument */]() }
38267
+ { name: "<FFF>", description: APP_MESSAGES[34 /* FeaturePartArgument */]() }
38238
38268
  ],
38239
38269
  flags: [
38240
38270
  {
38241
38271
  name: "--new",
38242
- description: APP_MESSAGES[48 /* NewFlag */]()
38272
+ description: APP_MESSAGES[35 /* NewFlag */]()
38243
38273
  },
38244
- { name: "--help", aliases: ["-h"], description: APP_MESSAGES[20 /* HelpFlag */]() }
38274
+ { name: "--help", aliases: ["-h"], description: APP_MESSAGES[7 /* HelpFlag */]() }
38245
38275
  ]
38246
38276
  };
38247
38277
  cliRegistry = {
@@ -38364,9 +38394,9 @@ function isEqualsForm(token) {
38364
38394
  return isFlagShaped(token) && token.includes("=");
38365
38395
  }
38366
38396
  function equalsFormRefusal(token, flags, scope) {
38367
- const at = token.indexOf("=");
38368
- const name = token.slice(0, at);
38369
- const value = token.slice(at + 1);
38397
+ const at2 = token.indexOf("=");
38398
+ const name = token.slice(0, at2);
38399
+ const value = token.slice(at2 + 1);
38370
38400
  const flag = flags.get(name);
38371
38401
  const spelling = flag !== void 0 && flag.arg === void 0 ? name : `${name} ${value === "" ? flag?.arg ?? "<value>" : value}`;
38372
38402
  return refusal("equals-form" /* EqualsForm */, { token, scope, spelling }, [message("see-flags" /* SeeFlags */, { scope })]);
@@ -38459,7 +38489,7 @@ function checkInputsExist(args, exists) {
38459
38489
  for (const { flag } of EVIDENCE_INPUTS) {
38460
38490
  const path = args[flag];
38461
38491
  if (path !== void 0 && !exists(path)) {
38462
- return APP_MESSAGES[49 /* InputPathMissing */](`--${flag}`, path);
38492
+ return refusal("input-path-missing" /* InputPathMissing */, { flag: `--${flag}`, path });
38463
38493
  }
38464
38494
  }
38465
38495
  return null;
@@ -38523,7 +38553,7 @@ function renderSavedReport(args) {
38523
38553
  const notSavedError = checkSavedReconciliation(rehydratePath, savedReading.document);
38524
38554
  if (notSavedError) refuse(notSavedError);
38525
38555
  const saved = reRenderOrRefusal(rehydratePath, savedReading.document, args["strict"] !== void 0);
38526
- if (typeof saved === "string") refuse(saved);
38556
+ if ("code" in saved) refuse(saved);
38527
38557
  process.stdout.write(saved.markdown + "\n");
38528
38558
  endRunOn({ kind: "verdict", code: exitCodeOf(saved.verdict, args["exit-zero"] !== void 0) });
38529
38559
  return true;
@@ -38542,13 +38572,7 @@ function refuseUnreadableInputs(args) {
38542
38572
  if (workflowReading.kind === "read-fault") refuse(checkInputPaths(args, corpusReading, workflowReading));
38543
38573
  if (workflowReading.kind === "unparseable") refuse(checkWorkflowsParse(args, workflowReading));
38544
38574
  if (reportsReading.kind === "faulty") refuse(checkInputShapes(reportsReading));
38545
- if (corpusReading.kind === "unparseable") {
38546
- refuse(
38547
- corpusReading.faults.map(
38548
- ({ file, message: message2 }) => APP_MESSAGES[75 /* CorpusFileUnparseable */](APP_MESSAGES[55 /* FlaggedCorpus */]("--features"), file, message2)
38549
- ).join("\n")
38550
- );
38551
- }
38575
+ if (corpusReading.kind === "unparseable") refuse(corpusUnparseableRefusal(corpusReading.faults));
38552
38576
  return { corpus: corpusReading.corpus, workflows: workflowReading.workflows, reports: reportsReading.reports };
38553
38577
  }
38554
38578
  function runContextOf(args, inputs, runStart, root) {
@@ -38605,44 +38629,55 @@ function refuse2(what, path, err) {
38605
38629
  if (!(err instanceof Error) || typeof errno.code !== "string") throw err;
38606
38630
  throw new UnreadableInput(what, errno.path ?? path, err.message);
38607
38631
  }
38608
- function refusalLine(refusal2) {
38609
- return message("usage-error" /* UsageError */, { command: "allocate", message: refusal2.message });
38632
+ function refusalLine(refused) {
38633
+ return refused.refusal;
38634
+ }
38635
+ function gitExited(args, status, stderr) {
38636
+ return message("git-exited" /* GitExited */, { command: String(args[0]), status: String(status), said: firstLine(stderr) });
38610
38637
  }
38611
38638
  function firstLine(text) {
38612
38639
  return text.split("\n")[0] ?? "";
38613
38640
  }
38614
- var UnreadableInput, UnparseableFeatureFiles;
38641
+ var UNREADABLE_SUBJECTS, UnreadableInput, UnparseableFeatureFiles;
38615
38642
  var init_unreadable = __esm({
38616
38643
  "src/cli-allocate/unreadable.ts"() {
38617
38644
  "use strict";
38618
38645
  init_messages();
38619
38646
  init_appText();
38647
+ init_refusal();
38648
+ UNREADABLE_SUBJECTS = Object.fromEntries(
38649
+ Object.values(Unreadable).map((code) => [code, message(code)])
38650
+ );
38620
38651
  UnreadableInput = class extends Error {
38621
38652
  constructor(what, path, reason) {
38622
38653
  const subject = UNREADABLE_SUBJECTS[what];
38623
- super(
38624
- path === "" ? APP_MESSAGES[8 /* CouldNotBeRead */](subject, reason) : APP_MESSAGES[9 /* CouldNotBeReadAt */](subject, path, reason)
38625
- );
38654
+ const refused = what === Unreadable.WorkingDirectory ? refusal("working-directory-unreadable" /* WorkingDirectoryUnreadable */, { subject, reason }) : refusal("could-not-be-read" /* CouldNotBeRead */, { subject, path, reason });
38655
+ super(refused.lines("allocate"));
38626
38656
  this.path = path;
38627
38657
  this.reason = reason;
38628
38658
  this.subject = subject;
38659
+ this.refusal = refused;
38629
38660
  }
38630
38661
  path;
38631
38662
  reason;
38632
38663
  name = "UnreadableInput";
38633
38664
  subject;
38665
+ refusal;
38634
38666
  };
38635
38667
  UnparseableFeatureFiles = class extends Error {
38636
38668
  constructor(faults) {
38637
- super(
38669
+ const refused = refusals(
38638
38670
  faults.map(
38639
- ({ file, message: message2 }) => APP_MESSAGES[75 /* CorpusFileUnparseable */](UNREADABLE_SUBJECTS[6 /* FeatureCorpus */], file, message2)
38640
- ).join("\n")
38671
+ ({ file, message: text }) => refusal("corpus-file-unparseable" /* CorpusFileUnparseable */, { corpus: UNREADABLE_SUBJECTS[Unreadable.FeatureCorpus], file, message: text })
38672
+ )
38641
38673
  );
38674
+ super(refused.lines("allocate"));
38642
38675
  this.faults = faults;
38676
+ this.refusal = refused;
38643
38677
  }
38644
38678
  faults;
38645
38679
  name = "UnparseableFeatureFiles";
38680
+ refusal;
38646
38681
  };
38647
38682
  }
38648
38683
  });
@@ -38652,7 +38687,7 @@ import { readFileSync as readFileSync5 } from "node:fs";
38652
38687
  function readHeaderCodes(featuresDir) {
38653
38688
  const sources = featureFilesIn(featuresDir).map(({ path }) => ({
38654
38689
  file: path,
38655
- source: readOrRefuse(5 /* FeatureFile */, path, () => readFileSync5(path, "utf8"))
38690
+ source: readOrRefuse("feature-file" /* FeatureFile */, path, () => readFileSync5(path, "utf8"))
38656
38691
  }));
38657
38692
  const parse5 = parseFeatureCorpus(sources);
38658
38693
  if (parse5.kind === "unparseable") throw new UnparseableFeatureFiles(parse5.faults);
@@ -38663,7 +38698,7 @@ function featureFilesIn(dir) {
38663
38698
  return corpusFeatureFiles(dir);
38664
38699
  } catch (err) {
38665
38700
  if (err instanceof MissingFeatureCorpusError) return [];
38666
- return refuse2(6 /* FeatureCorpus */, dir, err);
38701
+ return refuse2("feature-corpus" /* FeatureCorpus */, dir, err);
38667
38702
  }
38668
38703
  }
38669
38704
  var init_readParts = __esm({
@@ -38719,13 +38754,13 @@ function gitDirsOf(cwd) {
38719
38754
  return [...new Set(result.stdout.split("\n").filter((line) => line !== ""))];
38720
38755
  }
38721
38756
  function readEveryEntry(path) {
38722
- const kind = readOrRefuse(0 /* History */, path, () => lstatSync2(path, { throwIfNoEntry: false }));
38757
+ const kind = readOrRefuse("history" /* History */, path, () => lstatSync2(path, { throwIfNoEntry: false }));
38723
38758
  if (kind === void 0) return;
38724
38759
  if (kind.isDirectory()) {
38725
- const names = readOrRefuse(0 /* History */, path, () => readdirSync3(path));
38760
+ const names = readOrRefuse("history" /* History */, path, () => readdirSync3(path));
38726
38761
  for (const name of names) readEveryEntry(join7(path, name));
38727
38762
  } else if (kind.isFile()) {
38728
- readOrRefuse(0 /* History */, path, () => readFileSync6(path));
38763
+ readOrRefuse("history" /* History */, path, () => readFileSync6(path));
38729
38764
  }
38730
38765
  }
38731
38766
  var REF_STORES;
@@ -38746,9 +38781,9 @@ function readHistory(cwd, part) {
38746
38781
  proveRefsReadable(cwd);
38747
38782
  const args = ["log", "--all", "-p", "-U0", "--no-color", "--no-ext-diff", "--format=%x01%h", "-G", `SCN-${part}-`];
38748
38783
  const result = spawnSync2("git", args, { cwd, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES });
38749
- if (result.error !== void 0) refuse2(0 /* History */, cwd, result.error);
38784
+ if (result.error !== void 0) refuse2("history" /* History */, cwd, result.error);
38750
38785
  if (result.status !== 0) {
38751
- throw new UnreadableInput(0 /* History */, cwd, APP_MESSAGES[10 /* GitExited */](args, result.status, firstLine(result.stderr)));
38786
+ throw new UnreadableInput("history" /* History */, cwd, gitExited(args, result.status, result.stderr));
38752
38787
  }
38753
38788
  return diffLineOccurrences(result.stdout);
38754
38789
  }
@@ -38762,13 +38797,13 @@ function repositoryTop(cwd) {
38762
38797
  if (result.status === 0) return result.stdout.trim();
38763
38798
  const gitEntry = result.error === void 0 ? gitEntryAtOrAbove(cwd) : null;
38764
38799
  if (gitEntry === null) return null;
38765
- throw new UnreadableInput(1 /* Repository */, gitEntry, APP_MESSAGES[10 /* GitExited */](args, result.status, firstLine(result.stderr)));
38800
+ throw new UnreadableInput("repository" /* Repository */, gitEntry, gitExited(args, result.status, result.stderr));
38766
38801
  }
38767
38802
  function gitEntryAtOrAbove(dir) {
38768
- for (let at = dir; ; at = dirname5(at)) {
38769
- const entry = join8(at, ".git");
38803
+ for (let at2 = dir; ; at2 = dirname5(at2)) {
38804
+ const entry = join8(at2, ".git");
38770
38805
  if (lstatSync3(entry, { throwIfNoEntry: false }) !== void 0) return entry;
38771
- if (dirname5(at) === at) return null;
38806
+ if (dirname5(at2) === at2) return null;
38772
38807
  }
38773
38808
  }
38774
38809
  function isGitRepository(cwd) {
@@ -38781,7 +38816,7 @@ function historyBoundaryOf(cwd) {
38781
38816
  }
38782
38817
  function shallowBoundaryOf(cwd) {
38783
38818
  const shallowPath = shallowRecordPath(cwd);
38784
- const record = readOrRefuse(0 /* History */, shallowPath, () => readFileSync7(shallowPath, "utf8"));
38819
+ const record = readOrRefuse("history" /* History */, shallowPath, () => readFileSync7(shallowPath, "utf8"));
38785
38820
  const edge = record.split("\n")[0] ?? "";
38786
38821
  return { kind: "shallow", before: gitAnswer(cwd, ["rev-parse", "--short", edge]) ?? edge };
38787
38822
  }
@@ -38790,38 +38825,38 @@ function shallowRecordPath(cwd) {
38790
38825
  return shallowFile.startsWith("/") ? shallowFile : `${cwd}/${shallowFile}`;
38791
38826
  }
38792
38827
  function diffLineOccurrences(logOutput) {
38793
- const at = { inFileHeader: false, oldPath: "", newPath: "", oldLine: 0, newLine: 0 };
38828
+ const at2 = { inFileHeader: false, oldPath: "", newPath: "", oldLine: 0, newLine: 0 };
38794
38829
  const occurrences = [];
38795
38830
  for (const line of logOutput.split("\n")) {
38796
- const occurrence = readLine(line, at);
38831
+ const occurrence = readLine(line, at2);
38797
38832
  if (occurrence !== void 0) occurrences.push(occurrence);
38798
38833
  }
38799
38834
  return occurrences;
38800
38835
  }
38801
- function readLine(line, at) {
38802
- if (line.startsWith(COMMIT_MARKER)) at.commit = line.slice(COMMIT_MARKER.length);
38803
- else if (line.startsWith("diff --git ")) at.inFileHeader = true;
38804
- else if (at.inFileHeader) readFileHeader(line, at);
38805
- else if (line.startsWith("-")) return occurrenceAt(line, at.oldPath, at.oldLine++, at.commit);
38806
- else if (line.startsWith("+")) return occurrenceAt(line, at.newPath, at.newLine++, at.commit);
38807
- else if (line.startsWith("@@ ")) readHunkHeader(line, at);
38836
+ function readLine(line, at2) {
38837
+ if (line.startsWith(COMMIT_MARKER)) at2.commit = line.slice(COMMIT_MARKER.length);
38838
+ else if (line.startsWith("diff --git ")) at2.inFileHeader = true;
38839
+ else if (at2.inFileHeader) readFileHeader(line, at2);
38840
+ else if (line.startsWith("-")) return occurrenceAt(line, at2.oldPath, at2.oldLine++, at2.commit);
38841
+ else if (line.startsWith("+")) return occurrenceAt(line, at2.newPath, at2.newLine++, at2.commit);
38842
+ else if (line.startsWith("@@ ")) readHunkHeader(line, at2);
38808
38843
  return void 0;
38809
38844
  }
38810
- function readFileHeader(line, at) {
38811
- if (line.startsWith("--- ")) at.oldPath = pathOf3(line);
38812
- else if (line.startsWith("+++ ")) at.newPath = pathOf3(line);
38845
+ function readFileHeader(line, at2) {
38846
+ if (line.startsWith("--- ")) at2.oldPath = pathOf2(line);
38847
+ else if (line.startsWith("+++ ")) at2.newPath = pathOf2(line);
38813
38848
  else if (line.startsWith("@@ ")) {
38814
- at.inFileHeader = false;
38815
- readHunkHeader(line, at);
38849
+ at2.inFileHeader = false;
38850
+ readHunkHeader(line, at2);
38816
38851
  }
38817
38852
  }
38818
- function pathOf3(header) {
38853
+ function pathOf2(header) {
38819
38854
  return header.slice(4).replace(/^[ab]\//, "");
38820
38855
  }
38821
- function readHunkHeader(line, at) {
38856
+ function readHunkHeader(line, at2) {
38822
38857
  const match = /@@ -(\d+)(?:,\d+)? \+(\d+)/.exec(line);
38823
- at.oldLine = Number(match?.[1] ?? 0);
38824
- at.newLine = Number(match?.[2] ?? 0);
38858
+ at2.oldLine = Number(match?.[1] ?? 0);
38859
+ at2.newLine = Number(match?.[2] ?? 0);
38825
38860
  }
38826
38861
  function occurrenceAt(text, path, line, commit) {
38827
38862
  return { text, path, line, commit };
@@ -38850,9 +38885,9 @@ function readTree(top, part) {
38850
38885
  }
38851
38886
  function gitListing(top, args) {
38852
38887
  const result = spawnSync3("git", args, { cwd: top, encoding: "utf8", maxBuffer: MAX_OUTPUT_BYTES2 });
38853
- if (result.error !== void 0) refuse2(2 /* Tree */, top, result.error);
38888
+ if (result.error !== void 0) refuse2("tree" /* Tree */, top, result.error);
38854
38889
  if (result.status !== 0) {
38855
- throw new UnreadableInput(2 /* Tree */, top, APP_MESSAGES[10 /* GitExited */](args, result.status, firstLine(result.stderr)));
38890
+ throw new UnreadableInput("tree" /* Tree */, top, gitExited(args, result.status, result.stderr));
38856
38891
  }
38857
38892
  return result.stdout.split("\0");
38858
38893
  }
@@ -38861,7 +38896,7 @@ function isDirectoryEntry(entry) {
38861
38896
  }
38862
38897
  function proveListable(top, dir, ignored) {
38863
38898
  const path = join9(top, dir);
38864
- const entries = readOrRefuse(3 /* TreeDirectory */, path, () => listedAndEntered(path));
38899
+ const entries = readOrRefuse("tree-directory" /* TreeDirectory */, path, () => listedAndEntered(path));
38865
38900
  if (dir !== "" && entries.some((entry) => entry.name === ".git")) return;
38866
38901
  for (const entry of entries) {
38867
38902
  const child = dir === "" ? entry.name : `${dir}/${entry.name}`;
@@ -38874,9 +38909,9 @@ function listedAndEntered(path) {
38874
38909
  }
38875
38910
  function occurrencesInListed(top, path, needle) {
38876
38911
  const file = join9(top, path);
38877
- const kind = readOrRefuse(4 /* TreeFile */, file, () => lstatSync4(file, { throwIfNoEntry: false }));
38912
+ const kind = readOrRefuse("tree-file" /* TreeFile */, file, () => lstatSync4(file, { throwIfNoEntry: false }));
38878
38913
  if (kind === void 0 || !kind.isFile()) return [];
38879
- return linesCarrying(path, readOrRefuse(4 /* TreeFile */, file, () => readFileSync8(file)), needle);
38914
+ return linesCarrying(path, readOrRefuse("tree-file" /* TreeFile */, file, () => readFileSync8(file)), needle);
38880
38915
  }
38881
38916
  function linesCarrying(path, content, needle) {
38882
38917
  if (content.subarray(0, BINARY_PROBE_BYTES).includes(0)) return [];
@@ -38887,12 +38922,12 @@ function isWalkedDirectory(name) {
38887
38922
  }
38888
38923
  function walkTree(root, part) {
38889
38924
  return filesUnder(root).flatMap((file) => {
38890
- const content = readOrRefuse(4 /* TreeFile */, file, () => readFileSync8(file));
38925
+ const content = readOrRefuse("tree-file" /* TreeFile */, file, () => readFileSync8(file));
38891
38926
  return linesCarrying(relative2(root, file).split(sep4).join("/"), content, `SCN-${part}-`);
38892
38927
  });
38893
38928
  }
38894
38929
  function filesUnder(dir) {
38895
- const entries = readOrRefuse(3 /* TreeDirectory */, dir, () => readdirSync4(dir, { withFileTypes: true }));
38930
+ const entries = readOrRefuse("tree-directory" /* TreeDirectory */, dir, () => readdirSync4(dir, { withFileTypes: true }));
38896
38931
  return entries.flatMap((entry) => {
38897
38932
  const path = join9(dir, entry.name);
38898
38933
  if (entry.isDirectory()) return isWalkedDirectory(entry.name) ? filesUnder(path) : [];
@@ -38913,15 +38948,15 @@ var init_readTree = __esm({
38913
38948
  // src/cli-allocate/stderr.ts
38914
38949
  function historyBoundaryLine(boundary, allocation) {
38915
38950
  if (boundary.kind === "complete") return null;
38916
- const unread = boundary.kind === "shallow" ? APP_MESSAGES[79 /* ShallowHistoryUnread */](boundary.before) : APP_MESSAGES[80 /* NoRepositoryHistoryRead */]();
38917
- const risk = allocation.highest === null ? APP_MESSAGES[81 /* RiskOfPartCode */](featureCodeOf(allocation.code) ?? "") : APP_MESSAGES[82 /* RiskAboveCode */](allocation.highest.code);
38918
- return APP_MESSAGES[78 /* HistoryBoundary */](unread, risk);
38951
+ const unread = boundary.kind === "shallow" ? APP_MESSAGES[37 /* ShallowHistoryUnread */](boundary.before) : APP_MESSAGES[38 /* NoRepositoryHistoryRead */]();
38952
+ const risk = allocation.highest === null ? APP_MESSAGES[39 /* RiskOfPartCode */](featureCodeOf(allocation.code) ?? "") : APP_MESSAGES[40 /* RiskAboveCode */](allocation.highest.code);
38953
+ return APP_MESSAGES[36 /* HistoryBoundary */](unread, risk);
38919
38954
  }
38920
38955
  function highestSeenLine(allocation) {
38921
38956
  const highest = allocation.highest;
38922
- if (highest === null) return APP_MESSAGES[83 /* HighestSeenNone */]();
38957
+ if (highest === null) return APP_MESSAGES[41 /* HighestSeenNone */]();
38923
38958
  const { path, line, commit } = highest.occurrence;
38924
- return commit === void 0 ? APP_MESSAGES[84 /* HighestSeenInTree */](highest.code, path, line) : APP_MESSAGES[85 /* HighestSeenInCommit */](highest.code, path, line, commit);
38959
+ return commit === void 0 ? APP_MESSAGES[42 /* HighestSeenInTree */](highest.code, path, line) : APP_MESSAGES[43 /* HighestSeenInCommit */](highest.code, path, line, commit);
38925
38960
  }
38926
38961
  function carriedParts(carried) {
38927
38962
  return CARRIED_PARTS[carried.kind](carried);
@@ -38931,7 +38966,7 @@ function unknownPartRefusal(unknown) {
38931
38966
  }
38932
38967
  function alreadyHeadedNote(allocation) {
38933
38968
  if (allocation.alreadyHeaded !== true) return null;
38934
- return APP_MESSAGES[86 /* PartAlreadyHeaded */](featureCodeOf(allocation.code) ?? "");
38969
+ return APP_MESSAGES[44 /* PartAlreadyHeaded */](featureCodeOf(allocation.code) ?? "");
38935
38970
  }
38936
38971
  var CARRIED_PARTS;
38937
38972
  var init_stderr = __esm({
@@ -38980,7 +39015,7 @@ function refuseUsage(error) {
38980
39015
  endRunOn(USAGE_REFUSAL);
38981
39016
  }
38982
39017
  function answerRequest({ part, isNew }) {
38983
- const cwd = readOrRefuse(7 /* WorkingDirectory */, "", () => process.cwd());
39018
+ const cwd = readOrRefuse("working-directory" /* WorkingDirectory */, "", () => process.cwd());
38984
39019
  const top = repositoryTop(cwd);
38985
39020
  const headerCodes = readHeaderCodes(join10(top ?? cwd, DEFAULT_FEATURES_DIR));
38986
39021
  const answer = nextScnCode({ part, headerCodes, isNew }, occurrencesFrom(cwd, part, top));