@hailstails/hone 2.0.0-pre.3 → 2.0.0-pre.4

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 (201) hide show
  1. package/ADOPTING.md +7 -7
  2. package/CHANGELOG.md +70 -0
  3. package/MIGRATING.md +15 -6
  4. package/README.md +12 -13
  5. package/chunks/chunk-3CWFUD5B.js +38 -0
  6. package/chunks/chunk-5AKHEW6V.js +15 -0
  7. package/chunks/chunk-75XWZYNN.js +64 -0
  8. package/chunks/chunk-7FVSZ2VL.js +1304 -0
  9. package/chunks/chunk-A3RL4O5V.js +146 -0
  10. package/chunks/chunk-BIDD2YWP.js +398 -0
  11. package/chunks/{chunk-GNOMK7CR.js → chunk-BKQ3K766.js} +489 -52
  12. package/chunks/{chunk-NRIQD3PI.js → chunk-BRANVR7K.js} +3 -5
  13. package/chunks/chunk-COQMPHWZ.js +37 -0
  14. package/chunks/{chunk-L7BGRC6D.js → chunk-CXM5KBZX.js} +1 -1
  15. package/chunks/chunk-D6645WPB.js +6 -0
  16. package/chunks/chunk-DJMF6JIM.js +42 -0
  17. package/chunks/{chunk-OKLYWD2Z.js → chunk-E4D5WDRX.js} +27 -20
  18. package/chunks/chunk-EBX57Z3V.js +8 -0
  19. package/chunks/chunk-FHVNKG5Q.js +19 -0
  20. package/chunks/chunk-FPIP7JEC.js +191 -0
  21. package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
  22. package/chunks/chunk-LD766VWU.js +57 -0
  23. package/chunks/chunk-LEFM7OPS.js +41 -0
  24. package/chunks/chunk-LNMDMRGQ.js +51 -0
  25. package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
  26. package/chunks/chunk-OO5KV7KN.js +17 -0
  27. package/chunks/{chunk-ASUN4AVC.js → chunk-PVSC4SE3.js} +71 -5
  28. package/chunks/chunk-SKDQ3QJD.js +75 -0
  29. package/chunks/chunk-W5OIAUDW.js +18 -0
  30. package/chunks/chunk-X73RZUPO.js +63 -0
  31. package/chunks/chunk-XE2KKWYH.js +45 -0
  32. package/chunks/chunk-YGMO5Z6U.js +432 -0
  33. package/chunks/chunk-YONPKP3C.js +15 -0
  34. package/docs/adding-a-discipline-or-mechanism.md +1 -1
  35. package/docs/extending.md +7 -388
  36. package/package.json +7 -6
  37. package/rules/README.md +2 -2
  38. package/rules/typescript/checks.md +236 -18
  39. package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
  40. package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
  41. package/rules/typescript/symptoms/assertion-outside-a-test/assertion-site.md +10 -0
  42. package/rules/typescript/symptoms/assertion-outside-a-test.md +25 -0
  43. package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
  44. package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
  45. package/rules/typescript/symptoms/code-or-prose-read-as-text/raw-read.md +10 -0
  46. package/rules/typescript/symptoms/code-or-prose-read-as-text.md +31 -0
  47. package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +1 -1
  48. package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -1
  49. package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
  50. package/rules/typescript/symptoms/export-from-a-test-file/test-file-export.md +10 -0
  51. package/rules/typescript/symptoms/export-from-a-test-file.md +33 -0
  52. package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
  53. package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
  54. package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
  55. package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
  56. package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
  57. package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
  58. package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
  59. package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
  60. package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
  61. package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
  62. package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
  63. package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
  64. package/rules/typescript/symptoms/test-switched-off.md +1 -1
  65. package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
  66. package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
  67. package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
  68. package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
  69. package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
  70. package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
  71. package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
  72. package/rules/typescript/symptoms/wide-input.md +3 -2
  73. package/rules/typescript/symptoms.md +183 -121
  74. package/src/application/conformance/conformance-testing-types.d.ts +13 -16
  75. package/src/domain/language-layer/authored-item-types.d.ts +50 -0
  76. package/src/domain/language-layer/catalogue-name.d.ts +5 -0
  77. package/src/domain/language-layer/check-address-text.d.ts +12 -0
  78. package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
  79. package/src/domain/rule-set/clause-address-types.d.ts +4 -3
  80. package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
  81. package/src/domain/runner/check-binding.d.ts +18 -0
  82. package/src/domain/runner/check-observations.d.ts +39 -0
  83. package/src/domain/runner/conformance-types.d.ts +8 -2
  84. package/src/domain/settings/test-files.d.ts +7 -0
  85. package/src/eslint-plugin.js +16 -12
  86. package/src/hone.js +10677 -10754
  87. package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
  88. package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
  89. package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
  90. package/src/infrastructure/engines/eslint/runner/runner.js +945 -1188
  91. package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
  92. package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
  93. package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
  94. package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
  95. package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
  96. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
  97. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
  98. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
  99. package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
  100. package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
  101. package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
  102. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
  103. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
  104. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
  105. package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.examples.json +30 -0
  106. package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.js +123 -0
  107. package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/piece.json +9 -0
  108. package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
  109. package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
  110. package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +169 -98
  111. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
  112. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
  113. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
  114. package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
  115. package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
  116. package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/piece.json +9 -0
  117. package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.examples.json +30 -0
  118. package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.js +166 -0
  119. package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
  120. package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
  121. package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
  122. package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
  123. package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
  124. package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
  125. package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/piece.json +9 -0
  126. package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.examples.json +30 -0
  127. package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.js +31 -0
  128. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
  129. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
  130. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
  131. package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
  132. package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
  133. package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
  134. package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
  135. package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
  136. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
  137. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
  138. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
  139. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
  140. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
  141. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
  142. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
  143. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
  144. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
  145. package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
  146. package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
  147. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
  148. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
  149. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
  150. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
  151. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
  152. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
  153. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
  154. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
  155. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
  156. package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
  157. package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
  158. package/src/infrastructure/engines/walker/runner/runner.js +266 -77
  159. package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
  160. package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
  161. package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
  162. package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
  163. package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
  164. package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
  165. package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
  166. package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
  167. package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
  168. package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
  169. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
  170. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
  171. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
  172. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
  173. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
  174. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
  175. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
  176. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
  177. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
  178. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
  179. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +24 -0
  180. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +27 -0
  181. package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
  182. package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
  183. package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
  184. package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
  185. package/src/rule-set.d.ts +2 -1
  186. package/src/testing.d.ts +2 -4
  187. package/src/testing.js +104 -317
  188. package/src/{audit.d.ts → walker.d.ts} +13 -8
  189. package/src/walker.js +28 -0
  190. package/chunks/chunk-5HRMJ4O2.js +0 -608
  191. package/chunks/chunk-IX2VZTBO.js +0 -887
  192. package/chunks/chunk-K2W3D3NB.js +0 -17
  193. package/chunks/chunk-M6SOGWT7.js +0 -82
  194. package/chunks/chunk-Q62Y25WS.js +0 -843
  195. package/chunks/chunk-R75QELTA.js +0 -481
  196. package/chunks/chunk-RANAKCTW.js +0 -31
  197. package/chunks/chunk-TNY2PASL.js +0 -38
  198. package/chunks/chunk-UJONWHA4.js +0 -22
  199. package/docs/output-contract.md +0 -1155
  200. package/src/audit.js +0 -18
  201. package/src/domain/runner/runner-module-types.d.ts +0 -15
package/src/testing.js CHANGED
@@ -1,246 +1,107 @@
1
1
  import {
2
- createDefaultEnginePort,
3
- defaultClauseSettings,
4
- readHeldDiscipline,
5
- readLocatedPieceFile
6
- } from "../chunks/chunk-Q62Y25WS.js";
2
+ createNamedConformancePort,
3
+ defaultClauseSettings
4
+ } from "../chunks/chunk-YGMO5Z6U.js";
7
5
  import {
8
6
  installRootOfApiEntry,
9
- loadFailureDetail,
10
- readInstalledNames
11
- } from "../chunks/chunk-IX2VZTBO.js";
7
+ loadFailureDetail
8
+ } from "../chunks/chunk-A3RL4O5V.js";
12
9
  import {
13
- checkAddressOfNames,
14
- checkNamesOf,
15
- clauseCasesSchema,
16
- parsedJson,
10
+ checkPieceOf,
17
11
  readNamedPiece,
18
- sourceCaseSchema
19
- } from "../chunks/chunk-R75QELTA.js";
20
- import "../chunks/chunk-RANIXNWY.js";
21
- import "../chunks/chunk-ASUN4AVC.js";
22
- import "../chunks/chunk-NRIQD3PI.js";
12
+ teamRuleSetOf
13
+ } from "../chunks/chunk-FPIP7JEC.js";
14
+ import "../chunks/chunk-PVSC4SE3.js";
15
+ import "../chunks/chunk-BRANVR7K.js";
23
16
  import "../chunks/chunk-Z6JHBNDS.js";
24
17
  import {
18
+ TOOL_RULE_SET,
19
+ checkAddressOfNames,
20
+ checkNamesOf,
21
+ clauseCasesSchema,
25
22
  createDefaultFileTextPort,
26
23
  createDefaultModuleLoaderPort,
27
24
  createDefaultPathPort,
28
25
  isRepoPath,
29
- moduleExtensionOf
30
- } from "../chunks/chunk-GNOMK7CR.js";
26
+ moduleExtensionOf,
27
+ parsedJson,
28
+ sourceCaseSchema
29
+ } from "../chunks/chunk-BKQ3K766.js";
31
30
  import {
32
- clauseAddressOf,
33
31
  gatheredOutcomes
34
- } from "../chunks/chunk-M6SOGWT7.js";
32
+ } from "../chunks/chunk-YONPKP3C.js";
33
+ import "../chunks/chunk-OO5KV7KN.js";
34
+ import "../chunks/chunk-RANIXNWY.js";
35
35
  import "../chunks/chunk-DGOLOS5A.js";
36
36
 
37
37
  // src/domain/runner/edition-runs.ts
38
- var caseEditionOf = (request) => request.sourceCase.edition ?? request.clause.edition;
39
- var editionRunsOf = (request) => {
40
- const editions = [
41
- .../* @__PURE__ */ new Set([
42
- request.clause.edition,
43
- ...request.cases.map((sourceCase) => caseEditionOf({ sourceCase, clause: request.clause }))
44
- ])
45
- ];
46
- return editions.map((edition) => ({
47
- clause: { ...request.clause, edition },
48
- cases: request.cases.filter(
49
- (sourceCase) => caseEditionOf({ sourceCase, clause: request.clause }) === edition
50
- )
51
- })).filter((run) => run.cases.length > 0);
38
+ var casesByEdition = (request) => {
39
+ const caseEditionOf = (sourceCase) => sourceCase.edition ?? request.defaultEdition;
40
+ const editions = /* @__PURE__ */ new Set([request.defaultEdition, ...request.cases.map(caseEditionOf)]);
41
+ return [...editions].flatMap((edition) => {
42
+ const cases = request.cases.filter((sourceCase) => caseEditionOf(sourceCase) === edition);
43
+ return cases.length === 0 ? [] : [{ edition, cases }];
44
+ });
52
45
  };
53
46
 
54
- // src/application/conformance/clause-under-test.ts
55
- var setupFailed = (error) => ({
47
+ // src/application/conformance/check-conformance.ts
48
+ var ruleSetInvalid = (request) => ({
56
49
  outcome: "failed",
57
- error
50
+ error: { kind: "rule-set-invalid", detail: request.detail }
58
51
  });
59
- var unloadable = (request) => setupFailed({
60
- kind: "rule-set-unloadable",
61
- detail: request.loadFailureDetail({ failure: request.failure })
62
- });
63
- var boundClauseOf = (request) => {
64
- const { loadFailureDetail: loadFailureDetail2 } = request;
65
- const address = clauseAddressOf({ text: request.clause });
66
- if (address === "not-a-clause-address") {
67
- return setupFailed({ kind: "address-invalid", detail: request.clause });
68
- }
69
- const ruleSetRoot = request.path.resolve({ path: request.ruleSetRoot });
70
- if (ruleSetRoot.outcome === "failed") {
71
- return setupFailed({
72
- kind: "rule-set-unloadable",
73
- detail: `${request.ruleSetRoot} does not resolve: ${ruleSetRoot.error.kind}`
52
+ var placedTeamRuleSet = (request) => {
53
+ const { name, root } = request.ruleSet;
54
+ const identity = teamRuleSetOf({ name });
55
+ if (identity === void 0) {
56
+ return ruleSetInvalid({
57
+ detail: `${name} is not a team rule set name: use lower-case letters, digits and hyphens, and not ${TOOL_RULE_SET}`
74
58
  });
75
59
  }
76
- const held = request.ruleSetFiles.disciplineFile({
77
- ruleSetRoot: ruleSetRoot.value,
78
- installRoot: request.installRoot,
79
- discipline: address.discipline
80
- });
81
- if (held.outcome === "failed") {
82
- return unloadable({ failure: held.error, loadFailureDetail: loadFailureDetail2 });
83
- }
84
- if (held.value.held === "absent") {
85
- return unloadable({
86
- failure: { kind: "unknown-discipline", address: request.clause },
87
- loadFailureDetail: loadFailureDetail2
60
+ if (!isRepoPath(root)) {
61
+ return ruleSetInvalid({
62
+ detail: `the root ${root} of rule set ${name} is not a path inside the repository`
88
63
  });
89
64
  }
90
- const discipline = held.value.file;
91
- const definition = discipline.clauses.find(
92
- (clause) => clause.id === address.clause && clause.kind === "mechanical"
93
- );
94
- if (definition === void 0) {
95
- return setupFailed({ kind: "clause-not-mechanical", detail: request.clause });
96
- }
97
- if (!definition.mechanisms.includes(request.mechanism)) {
98
- return unloadable({
99
- failure: {
100
- kind: "mechanism-not-allowed",
101
- address: request.clause,
102
- mechanism: request.mechanism
103
- },
104
- loadFailureDetail: loadFailureDetail2
105
- });
65
+ const resolved = request.path.resolve({ path: root });
66
+ return resolved.outcome === "failed" ? ruleSetInvalid({
67
+ detail: `the root ${root} of rule set ${name} does not resolve, because the working directory cannot be used`
68
+ }) : { outcome: "ok", value: { identity, root: resolved.value } };
69
+ };
70
+ var placedRuleSet = (request) => request.ruleSet === TOOL_RULE_SET ? { outcome: "ok", value: { identity: TOOL_RULE_SET, root: request.installRoot } } : placedTeamRuleSet({ ruleSet: request.ruleSet, path: request.path });
71
+ var examplesOf = (request) => {
72
+ if (checkNamesOf({ text: request.check }) === void 0) {
73
+ return { outcome: "failed", error: { kind: "address-invalid", detail: request.check } };
106
74
  }
107
- const piece = request.ruleSetFiles.pieceFile({
108
- ruleSetRoot: ruleSetRoot.value,
75
+ const placed = placedRuleSet(request);
76
+ if (placed.outcome === "failed") return placed;
77
+ const read = request.examples.read({
109
78
  installRoot: request.installRoot,
110
- mechanism: request.mechanism,
111
- discipline
79
+ ruleSetRoot: placed.value.root,
80
+ check: request.check,
81
+ engine: request.engine
112
82
  });
113
- if (piece.outcome === "failed") {
114
- return unloadable({ failure: piece.error, loadFailureDetail: loadFailureDetail2 });
115
- }
116
- const entry = piece.value.clauses.find((candidate) => candidate.clause === address.clause);
117
- if (entry === void 0) {
118
- return unloadable({
119
- failure: { kind: "piece-missing", address: request.clause, mechanism: request.mechanism },
120
- loadFailureDetail: loadFailureDetail2
121
- });
122
- }
123
- return {
124
- outcome: "ok",
125
- value: {
126
- clause: {
127
- address,
128
- anchor: definition.anchor,
129
- pieceRoot: entry.pieceRoot,
130
- settings: entry.settings,
131
- clauseSettings: defaultClauseSettings({ declarations: entry.clauseSettings }),
132
- edition: entry.editions.default
133
- },
134
- cases: [...definition.cases.flag, ...definition.cases.allow]
135
- }
136
- };
137
- };
138
- var clauseUnderTestOf = (request) => {
139
- const bound = boundClauseOf(request);
140
- if (bound.outcome === "failed") {
141
- return bound;
83
+ if (read.outcome === "ok") {
84
+ return { outcome: "ok", value: { ...read.value, ruleSet: placed.value.identity } };
142
85
  }
143
86
  return {
144
- outcome: "ok",
145
- value: {
146
- clause: bound.value.clause,
147
- cases: bound.value.cases.map((sourceCase) => ({
148
- name: sourceCase.name,
149
- file: sourceCase.fileName,
150
- source: sourceCase.source,
151
- edition: sourceCase.edition ?? bound.value.clause.edition
152
- }))
153
- }
154
- };
155
- };
156
- var repoPathOf = (request) => {
157
- return isRepoPath(request.file) ? { outcome: "ok", value: request.file } : setupFailed({ kind: "file-invalid", detail: request.file });
158
- };
159
-
160
- // src/application/conformance/conforming-runner.ts
161
- var NO_CHECKS_RUNNER_FOR_CONFORMANCE_DETAIL = "the runner module exports no checksRunner, which version 2 conformance needs of an engine that runs through a native tool";
162
- var conformingRunnerOf = (request) => {
163
- const { runner, checksRunner } = request.engine;
164
- if (runner.exceptionPath === "standalone") {
165
- return { outcome: "ok", value: runner };
166
- }
167
- return checksRunner === void 0 ? {
168
- outcome: "failed",
169
- error: { kind: "runner-unloadable", detail: NO_CHECKS_RUNNER_FOR_CONFORMANCE_DETAIL }
170
- } : { outcome: "ok", value: checksRunner };
171
- };
172
-
173
- // src/application/conformance/clause-conformance.ts
174
- var clauseConformanceOf = async (request) => {
175
- const bound = boundClauseOf(request);
176
- if (bound.outcome === "failed") {
177
- return bound;
178
- }
179
- return conformBoundClause({
180
- location: request,
181
- engine: request.engine,
182
- loadFailureDetail: request.loadFailureDetail,
183
- bound: bound.value
184
- });
185
- };
186
- var conformBoundClause = async (request) => {
187
- const engine = await request.engine.load(request.location);
188
- if (engine.outcome === "failed") {
189
- return {
190
- outcome: "failed",
191
- error: {
192
- kind: "runner-unloadable",
193
- detail: request.loadFailureDetail({ failure: engine.error })
194
- }
195
- };
196
- }
197
- const runner = conformingRunnerOf({ engine: engine.value });
198
- if (runner.outcome === "failed") {
199
- return runner;
200
- }
201
- const conformance = gatheredOutcomes({
202
- outcomes: await Promise.all(
203
- editionRunsOf(request.bound).map(
204
- (run) => request.engine.conform({ clause: run.clause, cases: run.cases, runner: runner.value })
205
- )
206
- )
207
- });
208
- return conformance.outcome === "failed" ? {
209
- outcome: "failed",
210
- error: {
211
- kind: "runner-refused",
212
- detail: request.loadFailureDetail({
213
- failure: {
214
- kind: "runner-failed",
215
- mechanism: request.location.mechanism,
216
- failure: conformance.error
217
- }
218
- })
219
- }
220
- } : conformance;
221
- };
222
-
223
- // src/application/conformance/check-conformance.ts
224
- var examplesOf = (request) => {
225
- const read = request.examples.read(request);
226
- return read.outcome === "failed" ? {
227
87
  outcome: "failed",
228
88
  error: {
229
- kind: "rule-set-unloadable",
89
+ kind: read.error.kind === "piece-missing" ? "check-missing" : "rule-set-unloadable",
230
90
  detail: request.loadFailureDetail({ failure: read.error })
231
91
  }
232
- } : read;
92
+ };
233
93
  };
234
94
  var checkUnderTestOf = (request) => {
235
95
  const read = examplesOf(request);
236
96
  if (read.outcome === "failed") {
237
97
  return read;
238
98
  }
239
- const { check, engine } = request;
99
+ const { ruleSet, check, engine } = request;
240
100
  const { piece, examples: examples2 } = read.value;
241
101
  return {
242
102
  outcome: "ok",
243
103
  value: {
104
+ ruleSet,
244
105
  check,
245
106
  engine,
246
107
  examples: examples2.map((example) => ({
@@ -252,86 +113,54 @@ var checkUnderTestOf = (request) => {
252
113
  }
253
114
  };
254
115
  };
255
- var checkConformanceOf = (request) => {
116
+ var checkConformanceOf = async (request) => {
256
117
  const read = examplesOf(request);
257
- if (read.outcome === "failed") {
258
- return Promise.resolve(read);
259
- }
260
- const translated = request.examples.runnerAddress(request);
261
- if (translated.outcome === "failed") {
262
- return Promise.resolve({
118
+ if (read.outcome === "failed") return read;
119
+ const mechanism = request.engine;
120
+ const runner = await request.enginePort.load({ ...request, mechanism });
121
+ if (runner.outcome === "failed") {
122
+ return {
263
123
  outcome: "failed",
264
124
  error: {
265
- kind: "address-invalid",
266
- detail: request.loadFailureDetail({ failure: translated.error })
125
+ kind: "runner-unloadable",
126
+ detail: request.loadFailureDetail({ failure: runner.error })
267
127
  }
268
- });
128
+ };
269
129
  }
270
- const { piece, examples: examples2 } = read.value;
271
- const clause = {
272
- address: translated.value,
130
+ const { piece, examples: examples2, ruleSet } = read.value;
131
+ const binding = {
132
+ address: request.check,
133
+ ruleSet,
134
+ engine: mechanism,
273
135
  anchor: piece.anchor,
274
136
  pieceRoot: piece.pieceRoot,
275
137
  settings: piece.settings,
276
- clauseSettings: defaultClauseSettings({ declarations: piece.declarations }),
138
+ forms: piece.forms,
139
+ checkSettings: defaultClauseSettings({ declarations: piece.declarations }),
277
140
  edition: piece.editions.default
278
141
  };
279
- const { installRoot: installRoot2, moduleExtension, modules: modules2, path: path2, engine, enginePort: enginePort2, loadFailureDetail: loadFailureDetail2 } = request;
280
- return conformBoundClause({
281
- location: { installRoot: installRoot2, moduleExtension, modules: modules2, path: path2, mechanism: engine },
282
- engine: enginePort2,
283
- loadFailureDetail: loadFailureDetail2,
284
- bound: { clause, cases: examples2 }
142
+ const conformed = gatheredOutcomes({
143
+ outcomes: await Promise.all(
144
+ casesByEdition({ cases: examples2, defaultEdition: binding.edition }).map(
145
+ ({ edition, cases }) => request.enginePort.conform({
146
+ binding: { ...binding, edition },
147
+ cases,
148
+ runner: runner.value
149
+ })
150
+ )
151
+ )
285
152
  });
286
- };
287
-
288
- // src/application/conformance/conformance-testing.ts
289
- var createConformanceTesting = (ports) => ({
290
- clauseConformanceOf: (request) => {
291
- if (ports.installRoot.outcome === "failed") {
292
- return Promise.resolve({
293
- outcome: "failed",
294
- error: {
295
- kind: "runner-unloadable",
296
- detail: ports.loadFailureDetail({ failure: ports.installRoot.error })
297
- }
298
- });
299
- }
300
- return clauseConformanceOf({
301
- ruleSetRoot: request.ruleSetRoot,
302
- clause: request.clause,
303
- mechanism: ports.mechanism,
304
- ruleSetFiles: ports.ruleSetFiles,
305
- loadFailureDetail: ports.loadFailureDetail,
306
- path: ports.path,
307
- modules: ports.modules,
308
- engine: ports.engine,
309
- installRoot: ports.installRoot.value,
310
- moduleExtension: moduleExtensionOf({ moduleUrl: ports.moduleUrl })
311
- });
312
- },
313
- clauseUnderTestOf: (request) => {
314
- if (ports.installRoot.outcome === "failed") {
315
- return {
316
- outcome: "failed",
317
- error: {
318
- kind: "rule-set-unloadable",
319
- detail: ports.loadFailureDetail({ failure: ports.installRoot.error })
320
- }
321
- };
153
+ return conformed.outcome === "ok" ? conformed : {
154
+ outcome: "failed",
155
+ error: {
156
+ kind: "runner-refused",
157
+ detail: request.loadFailureDetail({
158
+ failure: { kind: "runner-failed", mechanism, failure: conformed.error }
159
+ })
322
160
  }
323
- return clauseUnderTestOf({
324
- ruleSetRoot: request.ruleSetRoot,
325
- clause: request.clause,
326
- mechanism: ports.mechanism,
327
- ruleSetFiles: ports.ruleSetFiles,
328
- loadFailureDetail: ports.loadFailureDetail,
329
- path: ports.path,
330
- installRoot: ports.installRoot.value
331
- });
332
- },
333
- repoPathOf
334
- });
161
+ };
162
+ };
163
+ var repoPathOf = ({ file }) => isRepoPath(file) ? { outcome: "ok", value: file } : { outcome: "failed", error: { kind: "file-invalid", detail: file } };
335
164
 
336
165
  // src/infrastructure/content-files/rule-sets/named-check-examples.ts
337
166
  import { z } from "zod";
@@ -365,18 +194,9 @@ var readExamplesDocument = (request) => {
365
194
  var exampleChecksOf = (request) => {
366
195
  const owner = request.piece.exampleOwner;
367
196
  const ownerAddress = checkAddressOfNames(owner);
368
- const declaredOwner = ownerAddress === request.check ? { outcome: "ok", value: request.piece } : readNamedPiece({
369
- ...request,
370
- ...owner,
371
- ruleSetRoot: request.installRoot,
372
- mechanism: request.engine
373
- });
374
- if (declaredOwner.outcome === "failed") {
375
- return declaredOwner;
376
- }
377
197
  const addresses = /* @__PURE__ */ new Set([
378
198
  ownerAddress,
379
- ...Object.values(declaredOwner.value.forms).map(checkAddressOfNames)
199
+ ...Object.values(request.piece.forms).map(checkAddressOfNames)
380
200
  ]);
381
201
  if (!addresses.has(request.check)) {
382
202
  return malformed({
@@ -414,7 +234,7 @@ var examplesForCheck = (request) => {
414
234
  const unsupported = selected.find(
415
235
  ({ edition }) => edition !== void 0 && !declared.includes(edition)
416
236
  );
417
- return unsupported === void 0 ? { outcome: "ok", value: { piece: request.piece, examples: selected } } : malformed({
237
+ return unsupported === void 0 ? { outcome: "ok", value: { piece: checkPieceOf(request.piece), examples: selected } } : malformed({
418
238
  path: path2,
419
239
  detail: `example ${unsupported.name} selects edition ${unsupported.edition} outside the declaration`
420
240
  });
@@ -424,12 +244,7 @@ var readExamples = (request) => {
424
244
  if (names === void 0) {
425
245
  return { outcome: "failed", error: { kind: "unknown-clause", address: request.check } };
426
246
  }
427
- const piece = readNamedPiece({
428
- ...request,
429
- ...names,
430
- ruleSetRoot: request.installRoot,
431
- mechanism: request.engine
432
- });
247
+ const piece = readNamedPiece({ ...request, ...names, mechanism: request.engine });
433
248
  if (piece.outcome === "failed") {
434
249
  return piece;
435
250
  }
@@ -449,21 +264,7 @@ var readExamples = (request) => {
449
264
  });
450
265
  };
451
266
  var createNamedCheckExamplesRepository = (ports) => ({
452
- read: (request) => readExamples({ ...ports, ...request }),
453
- runnerAddress: ({ installRoot: installRoot2, check }) => {
454
- const legacy = readInstalledNames({ ...ports, installRoot: installRoot2 });
455
- if (legacy.outcome === "failed") {
456
- return legacy;
457
- }
458
- const address = legacy.value.clauseOfCheck.get(check);
459
- return address === void 0 ? { outcome: "failed", error: { kind: "unknown-clause", address: check } } : { outcome: "ok", value: address };
460
- }
461
- });
462
-
463
- // src/infrastructure/content-files/rule-sets/rule-set-file-reader.ts
464
- var createRuleSetFileReader = (options) => ({
465
- disciplineFile: (request) => readHeldDiscipline({ ...options, ...request }),
466
- pieceFile: (request) => readLocatedPieceFile({ ...options, ...request })
267
+ read: (request) => readExamples({ ...ports, ...request })
467
268
  });
468
269
 
469
270
  // src/testing.ts
@@ -472,21 +273,8 @@ var moduleUrl = import.meta.url;
472
273
  var installRoot = installRootOfApiEntry({ path, moduleUrl });
473
274
  var fileText = createDefaultFileTextPort({});
474
275
  var modules = createDefaultModuleLoaderPort({});
475
- var enginePort = createDefaultEnginePort({});
476
276
  var examples = createNamedCheckExamplesRepository({ fileText, path });
477
- var testing = createConformanceTesting({
478
- mechanism: "walker",
479
- moduleUrl,
480
- installRoot,
481
- ruleSetFiles: createRuleSetFileReader({ fileText, path }),
482
- loadFailureDetail,
483
- path,
484
- modules,
485
- engine: enginePort
486
- });
487
- var clauseConformanceOf2 = testing.clauseConformanceOf;
488
- var clauseUnderTestOf2 = testing.clauseUnderTestOf;
489
- var repoPathOf2 = testing.repoPathOf;
277
+ var repoPathOf2 = repoPathOf;
490
278
  var checkUnderTestOf2 = (request) => installRoot.outcome === "failed" ? {
491
279
  outcome: "failed",
492
280
  error: {
@@ -496,6 +284,7 @@ var checkUnderTestOf2 = (request) => installRoot.outcome === "failed" ? {
496
284
  } : checkUnderTestOf({
497
285
  ...request,
498
286
  installRoot: installRoot.value,
287
+ path,
499
288
  examples,
500
289
  loadFailureDetail
501
290
  });
@@ -512,13 +301,11 @@ var checkConformanceOf2 = (request) => installRoot.outcome === "failed" ? Promis
512
301
  loadFailureDetail,
513
302
  path,
514
303
  modules,
515
- enginePort,
304
+ enginePort: createNamedConformancePort({}),
516
305
  moduleExtension: moduleExtensionOf({ moduleUrl })
517
306
  });
518
307
  export {
519
308
  checkConformanceOf2 as checkConformanceOf,
520
309
  checkUnderTestOf2 as checkUnderTestOf,
521
- clauseConformanceOf2 as clauseConformanceOf,
522
- clauseUnderTestOf2 as clauseUnderTestOf,
523
310
  repoPathOf2 as repoPathOf
524
311
  };
@@ -1,12 +1,15 @@
1
+ import type { TestFiles } from "./domain/settings/test-files.js";
2
+ export type { CheckBinding, CheckSettingValues } from "./domain/runner/check-binding.js";
3
+ export type { CheckAddressText } from "./domain/language-layer/check-address-text.js";
1
4
  export type { PieceFailure } from "./domain/runner/piece-failure-types.js";
2
- export type { ClauseSettingValues, RunnerClause } from "./domain/runner/runner-module-types.js";
3
5
  export type { ReadonlyJsonValue } from "./domain/settings/json-values/json-value.js";
4
6
  export type { Edition, EditionReach } from "./domain/rule-set/edition-types.js";
5
- export type { Hit, Remedy } from "./domain/runner/runner-result-types.js";
7
+ export type { Remedy } from "./domain/runner/runner-result-types.js";
6
8
  export type { Anchor, AnchorKind } from "./domain/finding/anchor.js";
7
- export type { ClauseAddress, ToolRuleSet } from "./domain/rule-set/clause-address-types.js";
8
- export type { ClauseId, DisciplineId, RuleSetName } from "./domain/rule-set/identifier-types.js";
9
+ export type { RuleSetIdentity } from "./domain/rule-set/clause-address-types.js";
10
+ export type { RuleSetName } from "./domain/rule-set/identifier-types.js";
9
11
  export type { RepoPath } from "./domain/repository/repo-path-types.js";
12
+ export type { TestFiles } from "./domain/settings/test-files.js";
10
13
  export type { Result } from "./domain/result.js";
11
14
  export type { CommentRange, SyntaxApi, SyntaxNode, SyntaxTree, } from "./infrastructure/engines/walker/runner/toolchain/typescript-parse.js";
12
15
  export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerDisk, WalkerFile, WalkerPiece, WalkerRepository, } from "./infrastructure/engines/walker/runner/pieces/walker-piece.js";
@@ -14,7 +17,9 @@ export declare const folderScope: (request: {
14
17
  readonly file: string;
15
18
  }) => "generated" | "authored";
16
19
  export declare const editionReaches: (request: {
17
- readonly edition: import("./audit.js").Edition;
18
- readonly introducedIn: import("./audit.js").Edition;
19
- }) => import("./audit.js").EditionReach;
20
- export declare const isEdition: (text: string) => text is import("./audit.js").Edition;
20
+ readonly edition: import("./walker.js").Edition;
21
+ readonly introducedIn: import("./walker.js").Edition;
22
+ }) => import("./walker.js").EditionReach;
23
+ export declare const isEdition: (text: string) => text is import("./walker.js").Edition;
24
+ export declare const isRuleSetName: (text: string) => text is import("./walker.js").RuleSetName;
25
+ export declare const DEFAULT_TEST_FILES: TestFiles;
package/src/walker.js ADDED
@@ -0,0 +1,28 @@
1
+ import {
2
+ folderScope
3
+ } from "../chunks/chunk-COQMPHWZ.js";
4
+ import {
5
+ DEFAULT_TEST_FILES
6
+ } from "../chunks/chunk-D6645WPB.js";
7
+ import {
8
+ isRuleSetName
9
+ } from "../chunks/chunk-OO5KV7KN.js";
10
+ import {
11
+ editionReaches,
12
+ isEdition
13
+ } from "../chunks/chunk-RANIXNWY.js";
14
+ import "../chunks/chunk-DGOLOS5A.js";
15
+
16
+ // src/walker.ts
17
+ var folderScope2 = folderScope;
18
+ var editionReaches2 = editionReaches;
19
+ var isEdition2 = isEdition;
20
+ var isRuleSetName2 = isRuleSetName;
21
+ var DEFAULT_TEST_FILES2 = DEFAULT_TEST_FILES;
22
+ export {
23
+ DEFAULT_TEST_FILES2 as DEFAULT_TEST_FILES,
24
+ editionReaches2 as editionReaches,
25
+ folderScope2 as folderScope,
26
+ isEdition2 as isEdition,
27
+ isRuleSetName2 as isRuleSetName
28
+ };