spec-controller 0.1.0-alpha.5 → 0.1.0-alpha.50

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 (122) hide show
  1. package/README.md +34 -6
  2. package/dist/cli-allocate/cli.d.ts +2 -0
  3. package/dist/cli-allocate/cli.d.ts.map +1 -0
  4. package/dist/cli-allocate/cli.js +60 -0
  5. package/dist/cli-allocate/cli.js.map +1 -0
  6. package/dist/cli-allocate/readHistory.d.ts +15 -0
  7. package/dist/cli-allocate/readHistory.d.ts.map +1 -0
  8. package/dist/cli-allocate/readHistory.js +108 -0
  9. package/dist/cli-allocate/readHistory.js.map +1 -0
  10. package/dist/cli-allocate/readParts.d.ts +2 -0
  11. package/dist/cli-allocate/readParts.d.ts.map +1 -0
  12. package/dist/cli-allocate/readParts.js +22 -0
  13. package/dist/cli-allocate/readParts.js.map +1 -0
  14. package/dist/cli-allocate/readTree.d.ts +5 -0
  15. package/dist/cli-allocate/readTree.d.ts.map +1 -0
  16. package/dist/cli-allocate/readTree.js +74 -0
  17. package/dist/cli-allocate/readTree.js.map +1 -0
  18. package/dist/cli-allocate/refStore.d.ts +2 -0
  19. package/dist/cli-allocate/refStore.d.ts.map +1 -0
  20. package/dist/cli-allocate/refStore.js +34 -0
  21. package/dist/cli-allocate/refStore.js.map +1 -0
  22. package/dist/cli-allocate/request.d.ts +9 -0
  23. package/dist/cli-allocate/request.d.ts.map +1 -0
  24. package/dist/cli-allocate/request.js +22 -0
  25. package/dist/cli-allocate/request.js.map +1 -0
  26. package/dist/cli-allocate/stderr.d.ts +7 -0
  27. package/dist/cli-allocate/stderr.d.ts.map +1 -0
  28. package/dist/cli-allocate/stderr.js +26 -0
  29. package/dist/cli-allocate/stderr.js.map +1 -0
  30. package/dist/cli-allocate/unreadable.d.ts +11 -0
  31. package/dist/cli-allocate/unreadable.d.ts.map +1 -0
  32. package/dist/cli-allocate/unreadable.js +30 -0
  33. package/dist/cli-allocate/unreadable.js.map +1 -0
  34. package/dist/cli-args.d.ts +12 -70
  35. package/dist/cli-args.d.ts.map +1 -1
  36. package/dist/cli-args.js +158 -81
  37. package/dist/cli-args.js.map +1 -1
  38. package/dist/cli-balance/cli.d.ts +1 -81
  39. package/dist/cli-balance/cli.d.ts.map +1 -1
  40. package/dist/cli-balance/cli.js +71 -357
  41. package/dist/cli-balance/cli.js.map +1 -1
  42. package/dist/cli-balance/emit/format.d.ts +16 -38
  43. package/dist/cli-balance/emit/format.d.ts.map +1 -1
  44. package/dist/cli-balance/emit/format.js +31 -58
  45. package/dist/cli-balance/emit/format.js.map +1 -1
  46. package/dist/cli-balance/emit/writer.d.ts +2 -32
  47. package/dist/cli-balance/emit/writer.d.ts.map +1 -1
  48. package/dist/cli-balance/emit/writer.js +50 -37
  49. package/dist/cli-balance/emit/writer.js.map +1 -1
  50. package/dist/cli-balance/exitStatus.d.ts +2 -0
  51. package/dist/cli-balance/exitStatus.d.ts.map +1 -0
  52. package/dist/cli-balance/exitStatus.js +5 -0
  53. package/dist/cli-balance/exitStatus.js.map +1 -0
  54. package/dist/cli-balance/inputsRead.d.ts +11 -0
  55. package/dist/cli-balance/inputsRead.d.ts.map +1 -0
  56. package/dist/cli-balance/inputsRead.js +53 -0
  57. package/dist/cli-balance/inputsRead.js.map +1 -0
  58. package/dist/cli-balance/reRender.d.ts +8 -0
  59. package/dist/cli-balance/reRender.d.ts.map +1 -0
  60. package/dist/cli-balance/reRender.js +21 -0
  61. package/dist/cli-balance/reRender.js.map +1 -0
  62. package/dist/cli-balance/unreadableInputs.d.ts +14 -0
  63. package/dist/cli-balance/unreadableInputs.d.ts.map +1 -0
  64. package/dist/cli-balance/unreadableInputs.js +80 -0
  65. package/dist/cli-balance/unreadableInputs.js.map +1 -0
  66. package/dist/cli-registry.d.ts +12 -70
  67. package/dist/cli-registry.d.ts.map +1 -1
  68. package/dist/cli-registry.js +37 -97
  69. package/dist/cli-registry.js.map +1 -1
  70. package/dist/cli.d.ts +0 -21
  71. package/dist/cli.d.ts.map +1 -1
  72. package/dist/cli.js +62 -55
  73. package/dist/cli.js.map +1 -1
  74. package/dist/deferralTags.d.ts +0 -14
  75. package/dist/deferralTags.d.ts.map +1 -1
  76. package/dist/deferralTags.js +0 -14
  77. package/dist/deferralTags.js.map +1 -1
  78. package/dist/host.d.ts +10 -41
  79. package/dist/host.d.ts.map +1 -1
  80. package/dist/host.js +103 -50
  81. package/dist/host.js.map +1 -1
  82. package/dist/ingest/ciSourcePaths.d.ts +0 -38
  83. package/dist/ingest/ciSourcePaths.d.ts.map +1 -1
  84. package/dist/ingest/ciSourcePaths.js +0 -38
  85. package/dist/ingest/ciSourcePaths.js.map +1 -1
  86. package/dist/ingest/gherkinValidation.d.ts +0 -80
  87. package/dist/ingest/gherkinValidation.d.ts.map +1 -1
  88. package/dist/ingest/gherkinValidation.js +0 -80
  89. package/dist/ingest/gherkinValidation.js.map +1 -1
  90. package/dist/ingest/ingestQualityChecks.d.ts +8 -93
  91. package/dist/ingest/ingestQualityChecks.d.ts.map +1 -1
  92. package/dist/ingest/ingestQualityChecks.js +57 -214
  93. package/dist/ingest/ingestQualityChecks.js.map +1 -1
  94. package/dist/ingest/ingestScenarios.d.ts +0 -45
  95. package/dist/ingest/ingestScenarios.d.ts.map +1 -1
  96. package/dist/ingest/ingestScenarios.js +28 -108
  97. package/dist/ingest/ingestScenarios.js.map +1 -1
  98. package/dist/ingest/inputShapes.d.ts +16 -0
  99. package/dist/ingest/inputShapes.d.ts.map +1 -0
  100. package/dist/ingest/inputShapes.js +113 -0
  101. package/dist/ingest/inputShapes.js.map +1 -0
  102. package/dist/outputLocation.d.ts +27 -0
  103. package/dist/outputLocation.d.ts.map +1 -0
  104. package/dist/outputLocation.js +135 -0
  105. package/dist/outputLocation.js.map +1 -0
  106. package/dist/run-management/keptRun.d.ts +5 -105
  107. package/dist/run-management/keptRun.d.ts.map +1 -1
  108. package/dist/run-management/keptRun.js +16 -82
  109. package/dist/run-management/keptRun.js.map +1 -1
  110. package/dist/run-management/resolveRunInputs.d.ts +0 -67
  111. package/dist/run-management/resolveRunInputs.d.ts.map +1 -1
  112. package/dist/run-management/resolveRunInputs.js +0 -88
  113. package/dist/run-management/resolveRunInputs.js.map +1 -1
  114. package/dist/storedRun.d.ts +6 -0
  115. package/dist/storedRun.d.ts.map +1 -0
  116. package/dist/storedRun.js +28 -0
  117. package/dist/storedRun.js.map +1 -0
  118. package/package.json +2 -2
  119. package/dist/corpus/cli.d.ts +0 -34
  120. package/dist/corpus/cli.d.ts.map +0 -1
  121. package/dist/corpus/cli.js +0 -125
  122. package/dist/corpus/cli.js.map +0 -1
@@ -1,34 +0,0 @@
1
- /**
2
- * The `tags` command — `spec-controller tags`, the `@SCN` scheme policing itself over a
3
- * target's Gherkin corpus.
4
- *
5
- * THIS EDGE OWNS ONLY THE READS. The rule is `corpusFaults`, in core, reached through the ROOT
6
- * barrel and nothing else: `./internal` is dropped by `publishConfig.exports` at pack time, and
7
- * this module travels in the tarball. That is not a style preference — an installed
8
- * `balance --help` once threw ERR_PACKAGE_PATH_NOT_EXPORTED behind thirteen green gates because a
9
- * published module reached that subpath (3F-3086). So what happens here is: discover the corpus,
10
- * read the manifest, build the mutation-record reader, hand over the bytes.
11
- *
12
- * ITS OWN COMMAND RATHER THAN A `balance` FLAG. `balance`'s exit code IS its verdict — 0
13
- * balanced, 1 out of balance, 3 pending-under-strict, 4 unsound, 5 nothing to reconcile — and a
14
- * corpus FAULT is not a reconciliation verdict. A flag would either overload one of those codes or
15
- * add a further meaning to a status a consumer's CI branches on. A second command costs one registry entry and gives
16
- * the fault its own ladder:
17
- *
18
- * 0 — the corpus obeys the scheme.
19
- * 1 — findings; the corpus was read and it breaks a rule.
20
- * 2 — the corpus (or the manifest) could not be READ at all. Not a verdict, because nothing was
21
- * concluded. Sibling to @SCN-CLI-014/015/016 on `balance`, and the same argument: an input
22
- * the tool cannot read is a usage error, never a verdict.
23
- *
24
- * Usage:
25
- * spec-controller tags [--features <dir>] [--package-json <path>]
26
- */
27
- /**
28
- * Police a target's corpus against the `@SCN` scheme's own rules.
29
- *
30
- * `process.exitCode` RATHER THAN `process.exit`, so whatever has been written is flushed intact
31
- * rather than truncated mid-write — the convention `balance`'s own gate settled on.
32
- */
33
- export declare function runTags(argv: string[]): void;
34
- //# sourceMappingURL=cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/corpus/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA8DH;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAiD5C"}
@@ -1,125 +0,0 @@
1
- /**
2
- * The `tags` command — `spec-controller tags`, the `@SCN` scheme policing itself over a
3
- * target's Gherkin corpus.
4
- *
5
- * THIS EDGE OWNS ONLY THE READS. The rule is `corpusFaults`, in core, reached through the ROOT
6
- * barrel and nothing else: `./internal` is dropped by `publishConfig.exports` at pack time, and
7
- * this module travels in the tarball. That is not a style preference — an installed
8
- * `balance --help` once threw ERR_PACKAGE_PATH_NOT_EXPORTED behind thirteen green gates because a
9
- * published module reached that subpath (3F-3086). So what happens here is: discover the corpus,
10
- * read the manifest, build the mutation-record reader, hand over the bytes.
11
- *
12
- * ITS OWN COMMAND RATHER THAN A `balance` FLAG. `balance`'s exit code IS its verdict — 0
13
- * balanced, 1 out of balance, 3 pending-under-strict, 4 unsound, 5 nothing to reconcile — and a
14
- * corpus FAULT is not a reconciliation verdict. A flag would either overload one of those codes or
15
- * add a further meaning to a status a consumer's CI branches on. A second command costs one registry entry and gives
16
- * the fault its own ladder:
17
- *
18
- * 0 — the corpus obeys the scheme.
19
- * 1 — findings; the corpus was read and it breaks a rule.
20
- * 2 — the corpus (or the manifest) could not be READ at all. Not a verdict, because nothing was
21
- * concluded. Sibling to @SCN-CLI-014/015/016 on `balance`, and the same argument: an input
22
- * the tool cannot read is a usage error, never a verdict.
23
- *
24
- * Usage:
25
- * spec-controller tags [--features <dir>] [--package-json <path>]
26
- */
27
- import { existsSync, readFileSync } from "node:fs";
28
- import { corpusFaults } from "@3f-consulting/spec-controller-core";
29
- import { cliRegistry, renderCommandHelp } from "../cli-registry.js";
30
- import { checkUnknownFlags, parseArgs } from "../cli-args.js";
31
- import { DEFAULT_DEFERRAL_TAGS } from "../deferralTags.js";
32
- import { UnreadableFeatureCorpusError } from "../ingest/gherkinValidation.js";
33
- import { discoverFeatures } from "../ingest/ingestScenarios.js";
34
- import { resolveToolIdentity } from "../run-management/resolveRunInputs.js";
35
- /**
36
- * Read everything the rule takes, or say why it could not be read.
37
- *
38
- * ONE PLACE, ONE STATUS, because it is one Rule. A corpus the Gherkin parser rejects, a features
39
- * directory that is not there, and a manifest that is not JSON are three spellings of "the tool
40
- * could not read its input" — and every one of them, left to escape, lands on Node's default exit
41
- * 1, which is this command's code for FINDINGS. A crashed invocation would then be
42
- * indistinguishable by status from a corpus that genuinely breaks a rule, which is exactly the
43
- * collision 3F-1742 closed on `balance`.
44
- *
45
- * THE PARSE REFUSAL IS INHERITED, NOT RESTATED (@SCN-GPG-001). `discoverFeatures` refuses a corpus
46
- * cucumber could not run rather than returning one, so this command gets that refusal by going
47
- * through the shared discovery — the same way `balance` does — and what is left here is turning
48
- * it into this command's status. Its message carries the parser's own words verbatim.
49
- *
50
- * THE SOURCES ARE READ HERE because the rule is pure and takes bytes. `DiscoveredFeature` carries
51
- * the header code and the scenario ids but not the file's text, and the grammar rules that follow
52
- * this one need the text to walk the tags.
53
- */
54
- function readCorpusInputs(featuresDir, manifestPath) {
55
- try {
56
- const discovered = featuresDir === undefined ? discoverFeatures() : discoverFeatures(featuresDir);
57
- return {
58
- ok: true,
59
- features: discovered.map((f) => ({
60
- slug: f.slug,
61
- featureCode: f.featureCode,
62
- source: readFileSync(f.path, "utf8"),
63
- })),
64
- packageJson: existsSync(manifestPath)
65
- ? JSON.parse(readFileSync(manifestPath, "utf8"))
66
- : {},
67
- };
68
- }
69
- catch (err) {
70
- if (err instanceof UnreadableFeatureCorpusError)
71
- return { ok: false, error: err.message };
72
- const failure = err instanceof Error ? err.message : String(err);
73
- return { ok: false, error: `The corpus could not be read: ${failure}` };
74
- }
75
- }
76
- /**
77
- * Police a target's corpus against the `@SCN` scheme's own rules.
78
- *
79
- * `process.exitCode` RATHER THAN `process.exit`, so whatever has been written is flushed intact
80
- * rather than truncated mid-write — the convention `balance`'s own gate settled on.
81
- */
82
- export function runTags(argv) {
83
- // Answer `--help`/`-h` from the registry BEFORE any parse, so it never falls through as a stray
84
- // flag while the command runs anyway. The registry is the single source, so a flag that exists
85
- // is a flag that appears in help — there is no hand-kept list here to drift.
86
- if (argv.includes("--help") || argv.includes("-h")) {
87
- process.stdout.write(renderCommandHelp(cliRegistry, "tags") + "\n");
88
- return;
89
- }
90
- const args = parseArgs(argv);
91
- // Registry-bounded parse (@SCN-CLI-009's rule, applied to this command's own scope): `tags`
92
- // accepts ONLY the flags its registry entry lists. By construction, not by assertion — the
93
- // helper is the one `balance` uses, given this command's name.
94
- const unknownFlagError = checkUnknownFlags(args, cliRegistry, "tags", resolveToolIdentity().toolVersion);
95
- if (unknownFlagError) {
96
- process.stderr.write(unknownFlagError + "\n");
97
- process.exitCode = 2;
98
- return;
99
- }
100
- // `--package-json` defaults to the manifest at the cwd, matching `balance`'s default: the
101
- // target is the tree you are standing in unless you say otherwise.
102
- const inputs = readCorpusInputs(args["features"], args["package-json"] ?? "package.json");
103
- if (!inputs.ok) {
104
- process.stderr.write(inputs.error + "\n");
105
- process.exitCode = 2;
106
- return;
107
- }
108
- const faults = corpusFaults({
109
- features: inputs.features,
110
- packageJson: inputs.packageJson,
111
- // The STARTER deferral set — the application layer's own policy, which a target's config may
112
- // only extend. Single-sourced here for the reason the reconcile composition takes it as a
113
- // parameter: which words the community recognises is the product's answer, not the engine's.
114
- deferralTags: DEFAULT_DEFERRAL_TAGS,
115
- });
116
- if (faults.length === 0) {
117
- process.stdout.write("tags: OK — every feature code names one feature file, and every tag on the corpus obeys the @SCN scheme's own rules.\n");
118
- return;
119
- }
120
- process.stderr.write(`tags: FAILED — ${faults.length} finding(s):\n`);
121
- for (const fault of faults)
122
- process.stderr.write(` ${fault.message}\n`);
123
- process.exitCode = 1;
124
- }
125
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/corpus/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAW5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,gBAAgB,CAAC,WAA+B,EAAE,YAAoB;IAC7E,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAClG,OAAO;YACL,EAAE,EAAE,IAAI;YACR,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC/B,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,MAAM,EAAE,YAAY,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