spec-controller 0.1.273 → 0.1.275

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 +68 -80
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -401,7 +401,7 @@ function claimRowsOf({ examples }) {
401
401
  return void 0;
402
402
  return examples.flatMap((block) => {
403
403
  const column = clmColumnOf(block);
404
- return block.rows.map(({ line, cells }) => ({ line, cell: cells[column] }));
404
+ return block.rows.map(({ cells }) => ({ cell: cells[column] }));
405
405
  });
406
406
  }
407
407
  function scenarioReadOf(scenario) {
@@ -425,13 +425,10 @@ function obligationsRaisedBy(tags, strict) {
425
425
  function claimOf(file, scenario, strict, claimCode) {
426
426
  return { file, title: scenario.title, obligations: obligationsRaisedBy(scenario.tags, strict), ...claimCode && { claimCode } };
427
427
  }
428
- function claimCodesIn2(tags) {
429
- return tags.flatMap((tag) => claimCodeFrom(tag) ?? []);
430
- }
431
428
  function claimsOf(file, scenario, settings) {
432
429
  if (isDeferred(scenario.tags, settings))
433
430
  return [];
434
- const codes = claimCodesIn2(scenario.tags);
431
+ const codes = claimCodesIn(scenario.tags);
435
432
  const claim = (claimCode) => claimOf(file, scenario, settings.strict, claimCode);
436
433
  if (scenario.rows)
437
434
  return codes.length > 0 ? [] : scenario.rows.map((row2) => claim(claimCodeFrom(row2.cell)));
@@ -447,7 +444,7 @@ var init_postEvidenceObligation = __esm({
447
444
  init_claimCodes();
448
445
  CLM_COLUMN = "clm";
449
446
  clmColumnOf = (block) => block.columns.indexOf(CLM_COLUMN);
450
- codesIn = (words2) => words2.filter((word) => claimCodeFrom(word) !== void 0);
447
+ codesIn = (words2) => claimCodesIn(words2).map(written);
451
448
  BUILT_IN_DEFERRAL_TAGS = ["wip", "ignore", "skip", "todo", "pending"];
452
449
  QUALITY_CHECK_KINDS = ["fitness", "unit", "integration", "e2e", "performance"];
453
450
  }
@@ -684,7 +681,7 @@ function scenarioRunObservationOf(run3, root, claimCodesAt) {
684
681
  return [];
685
682
  const place = relativizeToRoot(String(run3.featurePath ?? run3.featureName), root);
686
683
  const rowCodes = run3.line === void 0 ? [] : claimCodesAt(place, run3.line);
687
- const cites = nearestCitation([codesIn2([...run3.tags, ...rowCodes])]);
684
+ const cites = nearestCitation([claimCodesIn([...run3.tags, ...rowCodes])]);
688
685
  const neverRan = result === "never-ran";
689
686
  const notes = neverRan ? run3.steps.filter((step) => endingOf(step) === "could-not-run").map(stepText) : [];
690
687
  return kindsTheTagsName(run3.tags).map((kind) => ({ cites, result, kind, place, notes, ...neverRan ? {} : { name: run3.name } }));
@@ -714,7 +711,7 @@ function filedUnder(claim, phantoms, unnamed) {
714
711
  phantoms.push(phantom);
715
712
  return phantom;
716
713
  }
717
- var abortsJob, RECONCILER_INVOCATION, RESULT_OF_OUTCOME, isKeyedByAClaimCode, TEST_REPORT_KIND, RESULT_OF_TEST_STATUS, resultOfTestStatus, FAILED_FILE, CLAIM_CODE_PROPERTY, isCollectionFailure, isClassSetupFailure, isSetupError, isPackageFailure, errorTextOf, LOADED_FILE, KINDS_A_SCENARIO_TAG_NAMES, ENDING_OF_STEP_STATUS, endingOf, stepText, codesIn2, isExecutable, isUnnamedClaim;
714
+ var abortsJob, RECONCILER_INVOCATION, RESULT_OF_OUTCOME, isKeyedByAClaimCode, TEST_REPORT_KIND, RESULT_OF_TEST_STATUS, resultOfTestStatus, FAILED_FILE, CLAIM_CODE_PROPERTY, isCollectionFailure, isClassSetupFailure, isSetupError, isPackageFailure, errorTextOf, LOADED_FILE, KINDS_A_SCENARIO_TAG_NAMES, ENDING_OF_STEP_STATUS, endingOf, stepText, isExecutable, isUnnamedClaim;
718
715
  var init_postEvidenceObservation = __esm({
719
716
  "../core/dist/domain/postEvidenceObservation.js"() {
720
717
  "use strict";
@@ -751,7 +748,6 @@ var init_postEvidenceObservation = __esm({
751
748
  ]);
752
749
  endingOf = (step) => ENDING_OF_STEP_STATUS.get(step.status);
753
750
  stepText = (step) => `${String(step.keyword).trim()} ${step.text}`;
754
- codesIn2 = (texts) => texts.flatMap((text) => claimCodeFrom(text) ?? []);
755
751
  isExecutable = (claim) => "title" in claim;
756
752
  isUnnamedClaim = (claim) => !isExecutable(claim) && claim.claimCode === void 0;
757
753
  }
@@ -903,8 +899,7 @@ function outOfBalanceByFeatureOf(claimReconciliations) {
903
899
  return files.length === 0 ? void 0 : countsBy(files, (file) => file).map(({ key, count }) => ({ file: key, count }));
904
900
  }
905
901
  function excludedClaimCodeOccurrencesOf(features) {
906
- const codesIn3 = (words2) => words2.filter((word) => claimCodeFrom(word) !== void 0).length;
907
- return features.reduce((sum, { tagFormWords, scenarios }) => sum + codesIn3(tagFormWords) - codesIn3(scenarios.flatMap(({ tags }) => tags)), 0);
902
+ return features.reduce((sum, { tagFormWords, scenarios }) => sum + claimCodesIn(tagFormWords).length - claimCodesIn(scenarios.flatMap(({ tags }) => tags)).length, 0);
908
903
  }
909
904
  function totalsOf(claimReconciliations, excludedClaimCodeOccurrences) {
910
905
  const qualityChecks = qualityCheckReconciliationsOf(claimReconciliations);
@@ -30381,7 +30376,7 @@ function workflowSourcesOf(path, read) {
30381
30376
  }
30382
30377
  function parsedWorkflowsOf({ paths, sources }) {
30383
30378
  const parse4 = parseWorkflows(sources);
30384
- if (parse4.kind === "parsed") return { kind: "read", workflows: parse4.parsed };
30379
+ if (parse4.kind === "parsed") return { kind: "read", workflows: parse4.parsed, paths };
30385
30380
  const pathOf3 = new Map(paths.map((read) => [basename(read), read]));
30386
30381
  return { kind: "unparseable", faults: parse4.faults.map(({ file, message: message2 }) => ({ file: pathOf3.get(file), message: message2 })) };
30387
30382
  }
@@ -30592,7 +30587,7 @@ function linkTarget(path) {
30592
30587
  return void 0;
30593
30588
  }
30594
30589
  function identifiedInputs(inputs) {
30595
- return inputs.map((input) => ({ ...input, identity: regularFileIdentity(input.path) }));
30590
+ return inputs.map(({ subject, path, readAt }) => ({ subject, path, identity: regularFileIdentity(readAt) }));
30596
30591
  }
30597
30592
  var MAX_LINKS_FOLLOWED, STANDARD_OUTPUT_SPELLINGS;
30598
30593
  var init_outputLocation = __esm({
@@ -30720,6 +30715,45 @@ var init_usageRefusal = __esm({
30720
30715
  }
30721
30716
  });
30722
30717
 
30718
+ // src/inputs/inputsRead.ts
30719
+ function inputsReadOf(args, read, defaultCorpus) {
30720
+ const corpus = args["features"] ?? defaultCorpus;
30721
+ return [
30722
+ ...read.reports.map((path) => ({ subject: message("read-report" /* ReadReport */), path, readAt: path })),
30723
+ ...read.featureFiles.map((file) => ({
30724
+ subject: message("feature-file" /* FeatureFile */),
30725
+ path: corpusPathOf(corpus, file),
30726
+ readAt: corpusPathOf(read.corpus, file)
30727
+ })),
30728
+ ...read.workflows.map((path) => ({ subject: message("ci-workflow" /* CiWorkflow */), path, readAt: path }))
30729
+ ];
30730
+ }
30731
+ var init_inputsRead = __esm({
30732
+ "src/inputs/inputsRead.ts"() {
30733
+ "use strict";
30734
+ init_messages();
30735
+ init_appText();
30736
+ init_ingestScenarios();
30737
+ }
30738
+ });
30739
+
30740
+ // src/inputs/corpusDir.ts
30741
+ import { join as join3 } from "node:path";
30742
+ function corpusDirOf(args, defaultCorpus) {
30743
+ const given = args["features"];
30744
+ if (given !== void 0) return given;
30745
+ try {
30746
+ return join3(process.cwd(), defaultCorpus);
30747
+ } catch (err) {
30748
+ return { path: defaultCorpus, reason: err.message };
30749
+ }
30750
+ }
30751
+ var init_corpusDir = __esm({
30752
+ "src/inputs/corpusDir.ts"() {
30753
+ "use strict";
30754
+ }
30755
+ });
30756
+
30723
30757
  // src/inputs/inputShapes.ts
30724
30758
  function kindOf(value) {
30725
30759
  if (value === null) return "null";
@@ -30919,9 +30953,9 @@ var init_inputKinds = __esm({
30919
30953
  });
30920
30954
 
30921
30955
  // src/inputs/junitReportPaths.ts
30922
- import { join as join3 } from "node:path";
30956
+ import { join as join4 } from "node:path";
30923
30957
  function junitReportPathsOf(path, reader = NODE_CI_PATH_READER) {
30924
- return reader.readDir(path).filter((name) => SUREFIRE_REPORT_FILE.test(name)).sort().map((name) => join3(path, name));
30958
+ return reader.readDir(path).filter((name) => SUREFIRE_REPORT_FILE.test(name)).sort().map((name) => join4(path, name));
30925
30959
  }
30926
30960
  var SUREFIRE_REPORT_FILE;
30927
30961
  var init_junitReportPaths = __esm({
@@ -35411,60 +35445,6 @@ var init_unreadableInputs = __esm({
35411
35445
  }
35412
35446
  });
35413
35447
 
35414
- // src/inputs/inputsRead.ts
35415
- import { existsSync as existsSync3 } from "node:fs";
35416
- function featureFilesIn(dir) {
35417
- try {
35418
- return corpusFeatureFiles(dir).map(({ path }) => path);
35419
- } catch (err) {
35420
- if (err instanceof MissingFeatureCorpusError) return [];
35421
- throw err;
35422
- }
35423
- }
35424
- function inputsReadFrom(args, given, reader, defaults) {
35425
- const reports = jsonInputsOf(given, reader.exists, defaults.packageJson).map(({ path }) => ({ subject: message("read-report" /* ReadReport */), path }));
35426
- return [...reports, ...featureInputs(args["features"], reader, defaults.features), ...workflowInputs(args["ci"], reader, defaults.ci)];
35427
- }
35428
- function featureInputs(dir, reader, defaultCorpus) {
35429
- return reader.featureFiles(dir ?? defaultCorpus).map((path) => ({ subject: message("feature-file" /* FeatureFile */), path }));
35430
- }
35431
- function workflowInputs(ci, reader, defaultWorkflows) {
35432
- return reader.workflowFiles(ci ?? defaultWorkflows).map((path) => ({ subject: message("ci-workflow" /* CiWorkflow */), path }));
35433
- }
35434
- var NODE_INPUT_READER;
35435
- var init_inputsRead = __esm({
35436
- "src/inputs/inputsRead.ts"() {
35437
- "use strict";
35438
- init_ciSourcePaths();
35439
- init_ingestScenarios();
35440
- init_messages();
35441
- init_appText();
35442
- init_unreadableInputs();
35443
- NODE_INPUT_READER = {
35444
- exists: existsSync3,
35445
- featureFiles: featureFilesIn,
35446
- workflowFiles: (path) => ciSourcePathsOf(path)
35447
- };
35448
- }
35449
- });
35450
-
35451
- // src/inputs/corpusDir.ts
35452
- import { join as join4 } from "node:path";
35453
- function corpusDirOf(args, defaultCorpus) {
35454
- const given = args["features"];
35455
- if (given !== void 0) return given;
35456
- try {
35457
- return join4(process.cwd(), defaultCorpus);
35458
- } catch (err) {
35459
- return { path: defaultCorpus, reason: err.message };
35460
- }
35461
- }
35462
- var init_corpusDir = __esm({
35463
- "src/inputs/corpusDir.ts"() {
35464
- "use strict";
35465
- }
35466
- });
35467
-
35468
35448
  // src/runEnding/exitStatus.ts
35469
35449
  function exitCodeOf({ verdict }, exitZero) {
35470
35450
  return exitZero && verdict === "out-of-balance" ? 0 : VERDICT_EXIT_CODE[verdict];
@@ -35800,7 +35780,7 @@ var init_cliArgs = __esm({
35800
35780
  });
35801
35781
 
35802
35782
  // src/commands/balance.ts
35803
- import { existsSync as existsSync4 } from "node:fs";
35783
+ import { existsSync as existsSync3 } from "node:fs";
35804
35784
  import { dirname as dirname3 } from "node:path";
35805
35785
  function runBalance(argv) {
35806
35786
  return settlingRefusal(() => balance(argv), false);
@@ -35818,20 +35798,17 @@ function reconcile(argv) {
35818
35798
  if (unknownFlagError) refuse(unknownFlagError);
35819
35799
  const missingValueError = checkMissingValues(argv, cliRegistry, "balance");
35820
35800
  if (missingValueError) refuse(missingValueError);
35821
- const { corpus, workflows, reports } = refuseUnreadableInputs(args);
35801
+ const { corpus, workflows, reports, read } = refuseUnreadableInputs(args);
35822
35802
  const inputs = inputPathsOf(args);
35823
35803
  const root = targetRootOf(inputs.features);
35824
35804
  const evidenceReconciliation = runReconcile(reports, root, corpus, workflows, {
35825
35805
  strict: args["strict"] !== void 0,
35826
35806
  provenance: provenanceOf2(args, inputs, root)
35827
35807
  });
35828
- writeReports(collectFormatSpecs(argv), evidenceReconciliation, identifiedInputs(inputsReadBy(args, NODE_INPUT_READER)));
35808
+ writeReports(collectFormatSpecs(argv), evidenceReconciliation, identifiedInputs(inputsReadOf(args, read, INPUT_DEFAULTS.features)));
35829
35809
  endRunOn({ kind: "verdict", code: exitCodeOf(evidenceReconciliation.runVerdict, args["exit-zero"] !== void 0) });
35830
35810
  return true;
35831
35811
  }
35832
- function inputsReadBy(args, reader) {
35833
- return inputsReadFrom(args, requestedInputsOf(args), reader, INPUT_DEFAULTS);
35834
- }
35835
35812
  function writeReports(formatSpecs, evidenceReconciliation, inputs) {
35836
35813
  const plan = outputPlanOf(locatedOutputs(requestedOutputsOf(formatSpecs)), WRITTEN_FORMATS);
35837
35814
  if (!plan.ok) refuse(outputRefusal(plan.refusal));
@@ -35844,9 +35821,10 @@ function writeReports(formatSpecs, evidenceReconciliation, inputs) {
35844
35821
  }
35845
35822
  function refuseUnreadableInputs(args) {
35846
35823
  const given = requestedInputsOf(args);
35847
- const missingInputError = checkInputsExist(given, existsSync4);
35824
+ const missingInputError = checkInputsExist(given, existsSync3);
35848
35825
  if (missingInputError) refuse(missingInputError);
35849
- const reportsReading = readReports(jsonInputsOf(given, existsSync4, INPUT_DEFAULTS.packageJson));
35826
+ const reportInputs = jsonInputsOf(given, existsSync3, INPUT_DEFAULTS.packageJson);
35827
+ const reportsReading = readReports(reportInputs);
35850
35828
  const corpusDir = corpusDirOf(args, INPUT_DEFAULTS.features);
35851
35829
  if (typeof corpusDir !== "string") refuse(corpusDirRefusal(corpusDir));
35852
35830
  const corpusReading = readCorpus(corpusDir);
@@ -35856,7 +35834,17 @@ function refuseUnreadableInputs(args) {
35856
35834
  if (workflowReading.kind === "unparseable") refuse(workflowsUnparseableRefusal(args, workflowReading.faults));
35857
35835
  if (reportsReading.faulty !== void 0) refuse(reportRefusal(reportsReading.faulty));
35858
35836
  if (corpusReading.kind === "unparseable") refuse(corpusUnparseableRefusal(corpusReading.faults));
35859
- return { corpus: corpusReading.corpus, workflows: workflowReading.workflows, reports: reportsReading.reports };
35837
+ return {
35838
+ corpus: corpusReading.corpus,
35839
+ workflows: workflowReading.workflows,
35840
+ reports: reportsReading.reports,
35841
+ read: {
35842
+ reports: reportInputs.map(({ path }) => path),
35843
+ corpus: corpusDir,
35844
+ featureFiles: corpusReading.corpus.map(({ file }) => file),
35845
+ workflows: workflowReading.paths
35846
+ }
35847
+ };
35860
35848
  }
35861
35849
  function targetRootOf(features) {
35862
35850
  const corpusFolder = features === void 0 ? void 0 : dirname3(features);
@@ -36232,11 +36220,11 @@ function refuseUsage(error) {
36232
36220
  function answerRequest({ featureCode, isNew }) {
36233
36221
  const cwd = process.cwd();
36234
36222
  const top = repositoryTop(cwd);
36235
- const featureCodes = readFeatureCodes(featureFilesIn2(join8(top ?? cwd, DEFAULT_FEATURES_DIR)));
36223
+ const featureCodes = readFeatureCodes(featureFilesIn(join8(top ?? cwd, DEFAULT_FEATURES_DIR)));
36236
36224
  const answer = nextClaimCode({ featureCode, featureCodes, isNew }, occurrencesFrom(cwd, featureCode, top));
36237
36225
  ANSWERED[answer.kind](answer, cwd);
36238
36226
  }
36239
- function featureFilesIn2(dir) {
36227
+ function featureFilesIn(dir) {
36240
36228
  try {
36241
36229
  return corpusFeatureFiles(dir);
36242
36230
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-controller",
3
- "version": "0.1.273",
3
+ "version": "0.1.275",
4
4
  "description": "Reconcile the behaviour your scenarios name against the evidence that actually ran — the deterministic `balance` CLI.",
5
5
  "keywords": [
6
6
  "reconciliation",
@@ -26,7 +26,7 @@
26
26
  "fast-xml-parser": "^5.11.2",
27
27
  "ts-json-schema-generator": "^2.9.0",
28
28
  "yaml": "^2.9.0",
29
- "@3f-consulting/spec-controller-core": "0.1.273"
29
+ "@3f-consulting/spec-controller-core": "0.1.275"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"