@hailstails/hone 2.0.0-pre.2 → 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 +76 -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 +10493 -10410
  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 +953 -1189
  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 +213 -126
  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-MWLBA4B3.js +0 -849
  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
@@ -0,0 +1,146 @@
1
+ import {
2
+ NOT_INSTALLED,
3
+ TOOL_IDENTITY,
4
+ installRootAboveEntry,
5
+ versionOneEngineNameOf
6
+ } from "./chunk-BKQ3K766.js";
7
+
8
+ // src/infrastructure/command-line/installation/install-root.ts
9
+ var DIRECTORIES_ABOVE_ENTRY = {
10
+ api: "two directories",
11
+ command: "two directories"
12
+ };
13
+ var installRootUnresolvable = (request) => ({
14
+ outcome: "failed",
15
+ error: { kind: "install-root-unresolvable", url: request.url, detail: request.detail }
16
+ });
17
+ var installRootAbove = (request) => {
18
+ const entry = request.path.fromFileUrl({ url: request.moduleUrl });
19
+ if (entry.outcome === "failed") {
20
+ return installRootUnresolvable({ url: entry.error.url, detail: entry.error.detail });
21
+ }
22
+ const resolved = request.path.resolve({
23
+ path: installRootAboveEntry({
24
+ entryFile: entry.value,
25
+ entry: request.entry,
26
+ directoryOf: (path) => request.path.directoryOf({ path })
27
+ })
28
+ });
29
+ if (resolved.outcome === "failed") {
30
+ return installRootUnresolvable({
31
+ url: request.moduleUrl,
32
+ detail: `the install root ${DIRECTORIES_ABOVE_ENTRY[request.entry]} above the entry file is not an absolute path`
33
+ });
34
+ }
35
+ return resolved;
36
+ };
37
+ var installRootOf = (request) => installRootAbove({ ...request, entry: "command" });
38
+ var installRootOfApiEntry = (request) => installRootAbove({ ...request, entry: "api" });
39
+
40
+ // src/infrastructure/printed-report/load-failures/load-failure-text.ts
41
+ var escapedLineBreaks = (request) => request.text.replaceAll("\n", "\\n").replaceAll("\r", "\\r");
42
+ var JUDGEMENT_CLAUSE_LISTED_REPAIR = "a judgement clause is enforced by review and is left out of clauses, adopted or not; remove it";
43
+ var CONFIG_ROOT_REPAIR = "an eslintConfigRoots entry is a folder git tracks files under outside every excluded path, spelled exactly as git spells it; fix or remove it in disciplines.json";
44
+ var SELECTION_ABSENT_REPAIR = "holds no disciplines.json; give the folder that holds it, usually the repository root";
45
+ var WHY_CHAINS_REQUIRED_REPAIR = `${TOOL_IDENTITY.command} record-debt writes records that give only a reason, and this file requires a whyChain on every record; set "fileExceptionWhyChains": "optional" in it to accept them`;
46
+ var BOTH_LAYOUTS_REPAIR = `${TOOL_IDENTITY.name} reads exception records from one layout; keep each record in one of them and remove the other`;
47
+ var SUPPORTED_VERSION_REPAIR = "add a supported version to the devDependencies of the repository root";
48
+ var EACH_SUPPORTED_VERSION_REPAIR = "add a supported version of each to the devDependencies of the repository root";
49
+ var unavailablePeerRepair = (request) => request.peer.peer === "required" && request.peer.found === NOT_INSTALLED ? `${request.peer.packageName} is a required peer of ${TOOL_IDENTITY.packageName}, so this install is incomplete; ${SUPPORTED_VERSION_REPAIR} and reinstall` : SUPPORTED_VERSION_REPAIR;
50
+ var unavailablePeersRepair = (request) => {
51
+ const [first, ...rest] = request.peers;
52
+ return rest.length === 0 ? unavailablePeerRepair({ peer: first }) : EACH_SUPPORTED_VERSION_REPAIR;
53
+ };
54
+ var unavailablePeerText = (request) => `${request.peer.packageName} found ${request.peer.found}, supported ${request.peer.supported}`;
55
+ var runnerFailureFields = (request) => {
56
+ switch (request.failure.kind) {
57
+ case "piece-invalid":
58
+ return [request.failure.kind, request.failure.pieceRoot, request.failure.detail];
59
+ case "file-unreadable":
60
+ case "file-unparseable":
61
+ return [request.failure.kind, request.failure.file, request.failure.detail];
62
+ case "toolchain-unavailable":
63
+ return [
64
+ request.failure.kind,
65
+ `${request.failure.peers.map((peer) => unavailablePeerText({ peer })).join("; ")}: ${unavailablePeersRepair({ peers: request.failure.peers })}`
66
+ ];
67
+ case "toolchain-shadowed":
68
+ return [
69
+ request.failure.kind,
70
+ request.failure.packageName,
71
+ `resolved from ${request.failure.location} inside the core install ${request.failure.installRoot}: delete ${request.failure.installRoot}/node_modules, then reinstall the package with the repository's package manager, so the repository's own copy is used`
72
+ ];
73
+ case "tool-failed":
74
+ case "plugin-conflict":
75
+ case "team-config-unloadable":
76
+ case "runner-invalid-output":
77
+ return [request.failure.kind, request.failure.detail];
78
+ }
79
+ };
80
+ var loadFailureFields = (request) => {
81
+ switch (request.failure.kind) {
82
+ case "arguments-invalid":
83
+ case "git-failed":
84
+ case "unexpected-error":
85
+ return [request.failure.detail];
86
+ case "selection-absent":
87
+ return [request.failure.repo, SELECTION_ABSENT_REPAIR];
88
+ case "install-root-unresolvable":
89
+ return [request.failure.url, request.failure.detail];
90
+ case "file-unreadable":
91
+ case "file-malformed":
92
+ case "file-unwritable":
93
+ case "records-unsplittable":
94
+ case "rule-set-invalid":
95
+ return [request.failure.path, request.failure.detail];
96
+ case "rule-set-not-upgraded":
97
+ return [request.failure.path];
98
+ case "rule-set-half-upgraded":
99
+ return [request.failure.path, ...request.failure.files];
100
+ case "records-in-both-layouts":
101
+ return [request.failure.path, `${request.failure.folder}:`, BOTH_LAYOUTS_REPAIR];
102
+ case "why-chains-required":
103
+ return [`${request.failure.path}:`, WHY_CHAINS_REQUIRED_REPAIR];
104
+ case "unsupported-version":
105
+ return [request.failure.path, String(JSON.stringify(request.failure.found))];
106
+ case "reserved-rule-set-name":
107
+ case "unknown-rule-set":
108
+ return [request.failure.name];
109
+ case "duplicate-clause":
110
+ return [request.failure.address, request.failure.prefixedAddress];
111
+ case "rule-set-name-collision":
112
+ return [request.failure.name, request.failure.other];
113
+ case "rule-sets-share-a-check":
114
+ return [request.failure.check, ...request.failure.ruleSets];
115
+ case "unknown-discipline":
116
+ case "unknown-clause":
117
+ case "judgement-clause-selected":
118
+ return [request.failure.address];
119
+ case "judgement-clause-listed":
120
+ return [`${request.failure.address}:`, JUDGEMENT_CLAUSE_LISTED_REPAIR];
121
+ case "mechanism-not-allowed":
122
+ case "piece-missing":
123
+ return [request.failure.address, versionOneEngineNameOf(request.failure.mechanism)];
124
+ case "config-root-untracked":
125
+ return [`${request.failure.root}:`, CONFIG_ROOT_REPAIR];
126
+ case "runner-missing":
127
+ return [versionOneEngineNameOf(request.failure.mechanism)];
128
+ case "runner-invalid":
129
+ return [versionOneEngineNameOf(request.failure.mechanism), request.failure.detail];
130
+ case "runner-failed":
131
+ return [
132
+ versionOneEngineNameOf(request.failure.mechanism),
133
+ ...runnerFailureFields({ failure: request.failure.failure })
134
+ ];
135
+ }
136
+ };
137
+ var loadFailureDetail = (request) => [request.failure.kind, ...loadFailureFields(request)].map((text) => escapedLineBreaks({ text })).join(" ");
138
+ var loadFailureText = (request) => `load failure: ${loadFailureDetail(request)}
139
+ `;
140
+
141
+ export {
142
+ installRootOf,
143
+ installRootOfApiEntry,
144
+ loadFailureDetail,
145
+ loadFailureText
146
+ };
@@ -0,0 +1,398 @@
1
+ import {
2
+ ownedNameText,
3
+ sameOwnedName
4
+ } from "./chunk-FPIP7JEC.js";
5
+ import {
6
+ TOOL_RULE_SET,
7
+ checkAddressTextOf
8
+ } from "./chunk-BKQ3K766.js";
9
+
10
+ // src/domain/settings/settings-file.ts
11
+ var SETTINGS_FILE_NAME = "hone.config.json";
12
+ var VERSION_ONE_SETTINGS_FILE_NAME = "disciplines.json";
13
+ var RENAMED_SETTINGS = [
14
+ { name: "confinedOutsideDependencies", pieceName: "confinedPackages" }
15
+ ];
16
+ var eslintConfigLookupOf = (request) => request.declared === void 0 ? { lookup: "detected" } : { lookup: "declared", value: request.declared };
17
+
18
+ // src/domain/repository/exclusion.ts
19
+ var exclusionOf = (request) => request.excluded.some(
20
+ (excludedPath) => request.path === excludedPath || request.path.startsWith(`${excludedPath}/`)
21
+ ) ? "excluded" : "checked";
22
+
23
+ // src/domain/records/answering/outside-dependency.ts
24
+ var NPM_PREFIX = "npm:";
25
+ var SCOPE_MARK = "@";
26
+ var VERSION_MARK = "@";
27
+ var SCOPED_NAME_SEGMENTS = 2;
28
+ var UNSCOPED_NAME_SEGMENTS = 1;
29
+ var withoutNpmPrefix = (request) => request.specifier.startsWith(NPM_PREFIX) ? request.specifier.slice(NPM_PREFIX.length) : request.specifier;
30
+ var withoutVersion = (request) => {
31
+ const versionAt = request.segment.indexOf(VERSION_MARK);
32
+ return versionAt === -1 ? request.segment : request.segment.slice(0, versionAt);
33
+ };
34
+ var dependencyOf = (request) => {
35
+ const bare = withoutNpmPrefix(request);
36
+ const nameSegments = bare.startsWith(SCOPE_MARK) ? SCOPED_NAME_SEGMENTS : UNSCOPED_NAME_SEGMENTS;
37
+ const segments = bare.split("/");
38
+ const scope = segments.slice(0, nameSegments - 1);
39
+ const name = segments.slice(nameSegments - 1, nameSegments).map((segment) => withoutVersion({ segment }));
40
+ return [...scope, ...name].join("/");
41
+ };
42
+ var banStandingOf = (request) => request.namedBans.some(
43
+ (ban) => ban.outsideDependency.toLowerCase() === request.dependency.toLowerCase()
44
+ ) ? "banned" : "not-banned";
45
+
46
+ // src/domain/records/answering/record-reach.ts
47
+ var FOLDER_SEPARATOR = "/";
48
+ var IMPORTED_PARTY_SYMPTOMS = [
49
+ "outside-import-past-a-boundary",
50
+ "library-class-built-in-place",
51
+ "outside-type-in-a-signature"
52
+ ];
53
+ var RUNTIME_REACH = {
54
+ clock: ["date-used-directly"],
55
+ random: ["ambient-randomness"],
56
+ process: ["process-global-used-in-place"],
57
+ json: ["text-past-its-reader"]
58
+ };
59
+ var everyHolds = (request) => request.holdings.every((holding) => holding === "holds") ? "holds" : "does-not-hold";
60
+ var sameName = (request) => request.left === request.right ? "holds" : "does-not-hold";
61
+ var namedIn = (request) => request.names.includes(request.name) ? "holds" : "does-not-hold";
62
+ var toolSymptomNamedIn = (request) => request.symptom.ruleSet === TOOL_RULE_SET ? namedIn({ name: request.symptom.name, names: request.names }) : "does-not-hold";
63
+ var sameSymptom = (request) => sameOwnedName(request) === "same" ? "holds" : "does-not-hold";
64
+ var reachesCheck = (request) => {
65
+ const { reach, check } = request;
66
+ switch (reach.reaches) {
67
+ case "whole-symptom":
68
+ return "holds";
69
+ case "one-check":
70
+ return check.found === "check" ? sameName({ left: check.check.name, right: reach.check.name }) : "does-not-hold";
71
+ case "unknown-check":
72
+ return "does-not-hold";
73
+ }
74
+ };
75
+ var reachesSymptom = (request) => everyHolds({
76
+ holdings: [
77
+ sameSymptom({ left: request.symptom, right: request.site.symptom }),
78
+ reachesCheck({ reach: request.reach, check: request.site.check })
79
+ ]
80
+ });
81
+ var clearOfOutsideParties = (request) => toolSymptomNamedIn({ symptom: request.symptom, names: IMPORTED_PARTY_SYMPTOMS }) === "holds" ? "does-not-hold" : "holds";
82
+ var reachOf = (request) => {
83
+ switch (request.party.kind) {
84
+ case "package":
85
+ case "scheme-module":
86
+ return IMPORTED_PARTY_SYMPTOMS;
87
+ case "runtime":
88
+ return RUNTIME_REACH[request.party.facility];
89
+ }
90
+ };
91
+ var moduleCovers = (request) => request.file === request.module || request.file.startsWith(`${request.module}${FOLDER_SEPARATOR}`) ? "holds" : "does-not-hold";
92
+ var recipeOfSymptom = (request) => request.symptom.recipes.some(
93
+ (recipe) => sameOwnedName({ left: recipe, right: request.record.recipe }) === "same"
94
+ ) ? "holds" : "does-not-hold";
95
+ var importedPartyClearOfBans = (request) => {
96
+ switch (request.party.reported) {
97
+ case "not-reported":
98
+ return "does-not-hold";
99
+ case "specifier":
100
+ return banStandingOf({
101
+ namedBans: request.catalogue.namedBans,
102
+ dependency: dependencyOf({ specifier: request.party.specifier })
103
+ }) === "banned" ? "does-not-hold" : "holds";
104
+ }
105
+ };
106
+ var deviationClearOfBans = (request) => clearOfOutsideParties({ symptom: request.site.symptom }) === "holds" ? "holds" : importedPartyClearOfBans({ party: request.site.party, catalogue: request.catalogue });
107
+ var reportedPartyIs = (request) => {
108
+ switch (request.party.kind) {
109
+ case "package":
110
+ return sameName({
111
+ left: dependencyOf({ specifier: request.specifier }),
112
+ right: request.party.dependency
113
+ });
114
+ case "scheme-module":
115
+ return sameName({ left: request.specifier, right: request.party.specifier });
116
+ case "runtime":
117
+ return "does-not-hold";
118
+ }
119
+ };
120
+ var boundaryPartyNamed = (request) => {
121
+ if (request.record.outsideParty.kind === "runtime") {
122
+ return "holds";
123
+ }
124
+ switch (request.site.party.reported) {
125
+ case "not-reported":
126
+ return "does-not-hold";
127
+ case "specifier":
128
+ return reportedPartyIs({
129
+ party: request.record.outsideParty,
130
+ specifier: request.site.party.specifier
131
+ });
132
+ }
133
+ };
134
+ var checksReachedBy = (request) => {
135
+ const { record, catalogue } = request;
136
+ switch (record.kind) {
137
+ case "debt":
138
+ case "authorised-location":
139
+ return catalogue.checks.filter(
140
+ (check) => reachesSymptom({
141
+ symptom: record.symptom,
142
+ reach: record.reach,
143
+ site: { symptom: check.symptom, check: { found: "check", check } }
144
+ }) === "holds"
145
+ );
146
+ case "deviation":
147
+ return catalogue.checks.filter(
148
+ (check) => recipeOfSymptom({ record, symptom: check.symptom }) === "holds"
149
+ );
150
+ case "boundary-record":
151
+ return catalogue.checks.filter(
152
+ (check) => toolSymptomNamedIn({
153
+ symptom: check.symptom,
154
+ names: reachOf({ party: record.outsideParty })
155
+ }) === "holds"
156
+ );
157
+ case "dependency-record":
158
+ return [];
159
+ }
160
+ };
161
+ var placeOf = (request) => {
162
+ const { record } = request;
163
+ switch (record.kind) {
164
+ case "debt":
165
+ case "authorised-location":
166
+ case "deviation":
167
+ return { at: "file", file: record.file };
168
+ case "boundary-record":
169
+ return { at: "module", module: record.module };
170
+ case "dependency-record":
171
+ return void 0;
172
+ }
173
+ };
174
+ var placesReachedBy = (request) => {
175
+ const place = placeOf(request);
176
+ return place === void 0 ? [] : checksReachedBy(request).map((check) => ({ check, place }));
177
+ };
178
+ var sitedAt = (request) => {
179
+ const { record, site } = request;
180
+ switch (record.kind) {
181
+ case "debt":
182
+ case "authorised-location":
183
+ return everyHolds({
184
+ holdings: [
185
+ reachesSymptom({ symptom: record.symptom, reach: record.reach, site }),
186
+ sameName({ left: record.file, right: site.file })
187
+ ]
188
+ });
189
+ case "deviation":
190
+ return everyHolds({
191
+ holdings: [
192
+ sameName({ left: record.file, right: site.file }),
193
+ recipeOfSymptom({ record, symptom: site.symptom })
194
+ ]
195
+ });
196
+ case "boundary-record":
197
+ return everyHolds({
198
+ holdings: [
199
+ moduleCovers({ module: record.module, file: site.file }),
200
+ toolSymptomNamedIn({
201
+ symptom: site.symptom,
202
+ names: reachOf({ party: record.outsideParty })
203
+ })
204
+ ]
205
+ });
206
+ case "dependency-record":
207
+ return "does-not-hold";
208
+ }
209
+ };
210
+ var partyHolds = (request) => {
211
+ const { record } = request;
212
+ switch (record.kind) {
213
+ case "debt":
214
+ case "authorised-location":
215
+ case "dependency-record":
216
+ return "holds";
217
+ case "deviation":
218
+ return deviationClearOfBans(request);
219
+ case "boundary-record":
220
+ return boundaryPartyNamed({ record, site: request.site });
221
+ }
222
+ };
223
+ var holdsAt = (request) => everyHolds({
224
+ holdings: [sitedAt({ record: request.record, site: request.site }), partyHolds(request)]
225
+ });
226
+
227
+ // src/domain/records/answering/records-by-place.ts
228
+ var FOLDER_SEPARATOR2 = "/";
229
+ var symptomKey = (request) => `symptom:${ownedNameText(request.symptom)}`;
230
+ var addressKey = (request) => `check:${ownedNameText(request.address)}`;
231
+ var checkKey = (request) => addressKey({
232
+ address: {
233
+ ruleSet: request.symptom.ruleSet,
234
+ name: checkAddressTextOf({ check: { name: request.check, symptom: request.symptom } })
235
+ }
236
+ });
237
+ var answeredByPlaceOf = (request) => new Map(
238
+ [...Map.groupBy(request.answered, ({ file }) => file)].map(([file, answers]) => [
239
+ file,
240
+ new Set(
241
+ answers.map(
242
+ ({ ruleSet, symptom, check }) => check === void 0 ? symptomKey({ symptom: { ruleSet, name: symptom } }) : checkKey({ symptom: { ruleSet, name: symptom }, check })
243
+ )
244
+ )
245
+ ])
246
+ );
247
+ var answeredAt = (request) => {
248
+ const answers = request.byPlace.get(request.file);
249
+ const { ruleSet } = request;
250
+ return answers !== void 0 && (answers.has(symptomKey({ symptom: { ruleSet, name: request.symptom } })) || answers.has(addressKey({ address: { ruleSet, name: request.address } })));
251
+ };
252
+ var recipeKey = (request) => `recipe:${ownedNameText(request.recipe)}`;
253
+ var symptomReachKeysOf = (request) => {
254
+ const { symptom, reach } = request;
255
+ switch (reach.reaches) {
256
+ case "whole-symptom":
257
+ return [symptomKey({ symptom })];
258
+ case "one-check":
259
+ return [checkKey({ symptom, check: reach.check.name })];
260
+ case "unknown-check":
261
+ return [];
262
+ }
263
+ };
264
+ var reachKeysOf = (request) => {
265
+ const { record } = request;
266
+ switch (record.kind) {
267
+ case "debt":
268
+ case "authorised-location":
269
+ return symptomReachKeysOf({ symptom: record.symptom, reach: record.reach });
270
+ case "deviation":
271
+ return [recipeKey({ recipe: record.recipe })];
272
+ case "boundary-record":
273
+ return reachOf({ party: record.outsideParty }).map(
274
+ (name) => symptomKey({ symptom: { ruleSet: TOOL_RULE_SET, name } })
275
+ );
276
+ case "dependency-record":
277
+ return [];
278
+ }
279
+ };
280
+ var keyedOf = (request) => reachKeysOf({ record: request.placed.record }).map((key) => ({
281
+ placed: request.placed,
282
+ rank: request.rank,
283
+ path: request.path,
284
+ key
285
+ }));
286
+ var byPathAndKey = (request) => new Map(
287
+ [...Map.groupBy(request.keyed, ({ path }) => path)].map(([path, entries]) => [
288
+ path,
289
+ Map.groupBy(entries, ({ key }) => key)
290
+ ])
291
+ );
292
+ var recordsByPlaceOf = (request) => {
293
+ const inFile = request.records.flatMap((placed, rank) => {
294
+ const { record } = placed;
295
+ return record.kind === "debt" || record.kind === "authorised-location" || record.kind === "deviation" ? keyedOf({ placed, rank, path: record.file }) : [];
296
+ });
297
+ const inModule = request.records.flatMap(
298
+ (placed, rank) => placed.record.kind === "boundary-record" ? keyedOf({ placed, rank, path: placed.record.module }) : []
299
+ );
300
+ return {
301
+ ranks: new Map(request.records.map((placed, rank) => [placed, rank])),
302
+ inFile: byPathAndKey({ keyed: inFile }),
303
+ inModule: byPathAndKey({ keyed: inModule })
304
+ };
305
+ };
306
+ var rankEntry = (request) => [
307
+ request.placed,
308
+ request.rank
309
+ ];
310
+ var inRankOrder = (request) => [...request.ranked].toSorted(([, left], [, right]) => left - right).map(([placed]) => placed);
311
+ var placedInRecordOrder = (request) => inRankOrder({
312
+ ranked: new Map(
313
+ [...request.records].flatMap((placed) => {
314
+ const rank = request.byPlace.ranks.get(placed);
315
+ return rank === void 0 ? [] : [rankEntry({ placed, rank })];
316
+ })
317
+ )
318
+ });
319
+ var siteKeysOf = (request) => {
320
+ const { symptom, check } = request.site;
321
+ return [
322
+ symptomKey({ symptom }),
323
+ ...check.found === "check" ? [checkKey({ symptom, check: check.check.name })] : [],
324
+ ...symptom.recipes.map((recipe) => recipeKey({ recipe }))
325
+ ];
326
+ };
327
+ var modulesCovering = (request) => {
328
+ const parts = request.file.split(FOLDER_SEPARATOR2);
329
+ return [...parts.keys()].map((end) => parts.slice(0, end + 1).join(FOLDER_SEPARATOR2));
330
+ };
331
+ var rankedAt = (request) => request.paths.flatMap((path) => {
332
+ const byKey = request.byPath.get(path);
333
+ return byKey === void 0 ? [] : request.keys.flatMap((key) => byKey.get(key) ?? []);
334
+ });
335
+ var recordsReachingSites = (request) => inRankOrder({
336
+ ranked: new Map(
337
+ request.sites.flatMap((site) => {
338
+ const keys = siteKeysOf({ site });
339
+ return [
340
+ ...rankedAt({ byPath: request.byPlace.inFile, paths: [site.file], keys }),
341
+ ...rankedAt({
342
+ byPath: request.byPlace.inModule,
343
+ paths: modulesCovering({ file: site.file }),
344
+ keys
345
+ })
346
+ ].map(rankEntry);
347
+ })
348
+ )
349
+ });
350
+
351
+ // src/domain/repository/repo-path-of.ts
352
+ var brandedAsRepoPath = (text) => text;
353
+ var repoPathOf = (text) => {
354
+ const plain = text;
355
+ return brandedAsRepoPath(plain);
356
+ };
357
+ var repoPathBeneath = (request) => brandedAsRepoPath(`${request.parent}/${request.segment}`);
358
+
359
+ // src/domain/repository/projection-outputs.ts
360
+ var projectionOutputsOf = (request) => ({
361
+ configuration: `hone.${request.engineName}.mjs`,
362
+ declaration: `hone.${request.engineName}.d.mts`
363
+ });
364
+
365
+ // src/domain/repository/absolute-within.ts
366
+ var BACKSLASH = "\\";
367
+ var BACKSLASH_FORM = /^(?:[A-Za-z]:\\|\\\\)/;
368
+ var absoluteWithin = (request) => {
369
+ const separator = BACKSLASH_FORM.test(request.root) ? BACKSLASH : "/";
370
+ const root = request.root.endsWith(separator) ? request.root.slice(0, -1) : request.root;
371
+ return `${root}${separator}${request.file.replaceAll("/", separator)}`;
372
+ };
373
+
374
+ // src/infrastructure/engines/eslint/eslint-config-lookup.ts
375
+ import { z } from "zod";
376
+ var eslintConfigLookupSchema = z.enum(["nearest-to-file", "repository-root"]);
377
+
378
+ export {
379
+ repoPathOf,
380
+ repoPathBeneath,
381
+ projectionOutputsOf,
382
+ SETTINGS_FILE_NAME,
383
+ VERSION_ONE_SETTINGS_FILE_NAME,
384
+ RENAMED_SETTINGS,
385
+ eslintConfigLookupOf,
386
+ exclusionOf,
387
+ dependencyOf,
388
+ banStandingOf,
389
+ placesReachedBy,
390
+ holdsAt,
391
+ answeredByPlaceOf,
392
+ answeredAt,
393
+ recordsByPlaceOf,
394
+ placedInRecordOrder,
395
+ recordsReachingSites,
396
+ eslintConfigLookupSchema,
397
+ absoluteWithin
398
+ };