@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
@@ -1,12 +1,17 @@
1
1
  import {
2
2
  clauseAddressObjectSchema
3
- } from "./chunk-NRIQD3PI.js";
3
+ } from "./chunk-BRANVR7K.js";
4
4
  import {
5
5
  snippetSchema
6
6
  } from "./chunk-Z6JHBNDS.js";
7
7
  import {
8
- repoPathSchema
9
- } from "./chunk-GNOMK7CR.js";
8
+ anchorKindSchema,
9
+ editionSchema,
10
+ engineIdSchema,
11
+ isCheckAddressText,
12
+ repoPathSchema,
13
+ ruleSetIdentitySchema
14
+ } from "./chunk-BKQ3K766.js";
10
15
 
11
16
  // src/infrastructure/engines/protocol/runner-module/runner-result-schema.ts
12
17
  import { z as z3 } from "zod";
@@ -91,14 +96,75 @@ var runnerResultSchema = (request) => z3.union([
91
96
  z3.object({ outcome: z3.literal("failed"), error: runnerFailureSchema }).readonly()
92
97
  ]);
93
98
 
99
+ // src/infrastructure/engines/protocol/checks/check-wire.ts
100
+ import { z as z4 } from "zod";
101
+ var checkAddressSchema = z4.string().refine(isCheckAddressText, { error: "expected a symptom and check address" });
102
+ var checkBindingSchema = z4.strictObject({
103
+ address: checkAddressSchema,
104
+ ruleSet: ruleSetIdentitySchema,
105
+ engine: engineIdSchema,
106
+ anchor: anchorKindSchema,
107
+ pieceRoot: z4.string().min(1),
108
+ settings: z4.json(),
109
+ forms: z4.record(z4.string(), checkAddressSchema).optional(),
110
+ checkSettings: z4.record(z4.string(), z4.json()),
111
+ edition: editionSchema
112
+ }).readonly();
113
+ var measurement = { check: checkAddressSchema, file: repoPathSchema };
114
+ var checkMeasurementSchema = z4.strictObject(measurement).readonly();
115
+ var checkHitSchema = z4.strictObject({
116
+ ...measurement,
117
+ anchor: anchorSchema,
118
+ snippet: snippetSchema,
119
+ remedy: remedySchema.optional(),
120
+ importSpecifier: z4.string().min(1).optional()
121
+ }).readonly();
122
+ var scriptOptionCauseSchema = z4.discriminatedUnion("kind", [
123
+ z4.strictObject({ kind: z4.literal("weakens-run") }),
124
+ z4.strictObject({
125
+ kind: z4.literal("after-another-command"),
126
+ command: z4.string(),
127
+ invocation: z4.string()
128
+ }),
129
+ z4.strictObject({ kind: z4.literal("wrapped"), command: z4.string(), wrapper: z4.string() }),
130
+ z4.strictObject({ kind: z4.literal("unreadable"), command: z4.string() })
131
+ ]);
132
+ var inline = { line: z4.number().int().min(1), text: z4.string() };
133
+ var checkNativeExceptionSchema = z4.discriminatedUnion("kind", [
134
+ z4.strictObject({ kind: z4.literal("ignore"), ...measurement }),
135
+ z4.strictObject({ kind: z4.literal("config-override"), ...measurement }),
136
+ z4.strictObject({
137
+ kind: z4.literal("suppression-entry"),
138
+ ...measurement,
139
+ location: repoPathSchema
140
+ }),
141
+ z4.strictObject({
142
+ kind: z4.literal("inline-disable"),
143
+ ...measurement,
144
+ ...inline,
145
+ reach: z4.enum(["one-check", "every-selected-check"])
146
+ }),
147
+ z4.strictObject({ kind: z4.literal("inline-rule-config"), ...measurement, ...inline }),
148
+ z4.strictObject({
149
+ kind: z4.literal("command-line-option"),
150
+ check: checkAddressSchema,
151
+ location: repoPathSchema,
152
+ script: z4.string(),
153
+ option: z4.string(),
154
+ cause: scriptOptionCauseSchema
155
+ })
156
+ ]).readonly();
157
+
94
158
  export {
95
159
  runnerFailureSchema,
96
160
  reportedCheckSchema,
97
161
  nativeExceptionKindSchema,
98
162
  hitSchema,
99
- measuredPairSchema,
100
163
  measuredSchema,
101
164
  caseVerdictSchema,
102
165
  projectionWriteSchema,
103
- runnerResultSchema
166
+ runnerResultSchema,
167
+ checkMeasurementSchema,
168
+ checkHitSchema,
169
+ checkNativeExceptionSchema
104
170
  };
@@ -0,0 +1,75 @@
1
+ import {
2
+ createDefaultJsoncTreePort
3
+ } from "./chunk-DJMF6JIM.js";
4
+ import {
5
+ folderScope
6
+ } from "./chunk-COQMPHWZ.js";
7
+
8
+ // src/infrastructure/engines/walker/runner/pieces/dependency-files.ts
9
+ var PACKAGE_MANIFEST = /(?:^|\/)package\.json$/;
10
+ var WORKFLOW = /^(?:\.github\/workflows\/.*\.ya?ml|(?<gitlab>\.gitlab-ci\.ya?ml)|azure-pipelines\.ya?ml)$/;
11
+ var dependencySourceOf = (request) => request.accepts.test(request.file) && folderScope({ file: request.file }) !== "generated" ? request.readText() : { outcome: "ok", value: void 0 };
12
+ var jsoncTree = createDefaultJsoncTreePort({ trailingCommas: "refused" });
13
+ var unparseableManifest = (file, detail) => ({
14
+ outcome: "failed",
15
+ error: { kind: "file-unparseable", file: file.file, detail }
16
+ });
17
+ var lineIndexOf = (request) => {
18
+ const { offset, starts, first, last } = request;
19
+ if (first === last) return first;
20
+ const middle = Math.ceil((first + last) / 2);
21
+ return (starts[middle] ?? 0) <= offset ? lineIndexOf({ ...request, first: middle }) : lineIndexOf({ ...request, last: middle - 1 });
22
+ };
23
+ var propertyAnchor = (offset, locations) => {
24
+ const { starts } = locations;
25
+ const line = lineIndexOf({ starts, offset, first: 0, last: starts.length - 1 });
26
+ return { line: line + 1, column: offset - (starts[line] ?? 0) };
27
+ };
28
+ var sourceToken = (source, token) => source.slice(token.offset, token.offset + token.length);
29
+ var locatedFieldsOf = (request) => {
30
+ const { node, locations } = request;
31
+ if (node?.type !== "object") return /* @__PURE__ */ new Map();
32
+ const { source } = locations;
33
+ return new Map(
34
+ node.children?.flatMap((property) => {
35
+ const [key, propertyValue] = property.children ?? [];
36
+ if (key === void 0 || typeof key.value !== "string" || propertyValue === void 0)
37
+ return [];
38
+ const keyToken = sourceToken(source, key);
39
+ return [
40
+ [
41
+ key.value,
42
+ {
43
+ value: propertyValue.value,
44
+ anchor: propertyAnchor(key.offset, locations),
45
+ snippet: propertyValue.type === "string" ? `${keyToken}: ${sourceToken(source, propertyValue)}` : keyToken,
46
+ fields: locatedFieldsOf({ node: propertyValue, locations })
47
+ }
48
+ ]
49
+ ];
50
+ })
51
+ );
52
+ };
53
+ var locatedPackageManifestOf = (file) => {
54
+ const text = dependencySourceOf({ ...file, accepts: PACKAGE_MANIFEST });
55
+ if (text.outcome === "failed") return text;
56
+ if (text.value === void 0) return { outcome: "ok", value: void 0 };
57
+ const source = text.value;
58
+ const parsed = jsoncTree.parse({ source });
59
+ if (parsed.outcome === "failed") return unparseableManifest(file, parsed.error.detail);
60
+ const starts = [
61
+ 0,
62
+ ...Array.from(source.matchAll(/\r\n|\r|\n/g), ({ index, 0: ending }) => index + ending.length)
63
+ ];
64
+ return {
65
+ outcome: "ok",
66
+ value: locatedFieldsOf({ node: parsed.value, locations: { source, starts } })
67
+ };
68
+ };
69
+
70
+ export {
71
+ PACKAGE_MANIFEST,
72
+ WORKFLOW,
73
+ dependencySourceOf,
74
+ locatedPackageManifestOf
75
+ };
@@ -0,0 +1,18 @@
1
+ // src/infrastructure/engines/walker/runner/pieces/piece-check-settings.ts
2
+ import { z } from "zod";
3
+ var stringListCheckSettings = (request) => {
4
+ const parsed = z.record(z.enum(request.keys), z.array(z.string().min(1)).readonly()).safeParse(request.binding.checkSettings);
5
+ if (parsed.success) return { outcome: "ok", value: parsed.data };
6
+ return {
7
+ outcome: "failed",
8
+ error: {
9
+ kind: "piece-invalid",
10
+ pieceRoot: request.binding.pieceRoot,
11
+ detail: `the checkSettings of ${request.binding.address} are malformed: ${z.prettifyError(parsed.error)}`
12
+ }
13
+ };
14
+ };
15
+
16
+ export {
17
+ stringListCheckSettings
18
+ };
@@ -0,0 +1,63 @@
1
+ import {
2
+ stringListCheckSettings
3
+ } from "./chunk-W5OIAUDW.js";
4
+ import {
5
+ gatheredOutcomes
6
+ } from "./chunk-YONPKP3C.js";
7
+
8
+ // src/infrastructure/engines/walker/runner/pieces/tracker-patterns.ts
9
+ var NUMBERED_REFERENCE = /\([^()\s]*\d[^()\s]*\)/;
10
+ var TRACKED_REFERENCE_PATTERN = new RegExp(NUMBERED_REFERENCE.source, "g");
11
+ var LEADING_TRACKED_REFERENCE_PATTERN = new RegExp(`^\\s*(${NUMBERED_REFERENCE.source})`);
12
+ var WHOLE_NUMBERED_REFERENCE_PATTERN = new RegExp(`^${NUMBERED_REFERENCE.source}$`);
13
+ var numberedReferenceKind = (text) => WHOLE_NUMBERED_REFERENCE_PATTERN.test(text) ? "numbered" : "other";
14
+ var compiledTracker = (request) => {
15
+ try {
16
+ return { outcome: "ok", value: [new RegExp(request.source)] };
17
+ } catch (thrown) {
18
+ return {
19
+ outcome: "failed",
20
+ error: {
21
+ kind: "piece-invalid",
22
+ pieceRoot: request.binding.pieceRoot,
23
+ detail: `the checkSettings of ${request.binding.address} are malformed: trackerPatterns entry ${JSON.stringify(request.source)} is not a regular expression: ${thrown instanceof Error ? thrown.message : String(thrown)}`
24
+ }
25
+ };
26
+ }
27
+ };
28
+ var trackedCheckOf = (request) => {
29
+ const settings = stringListCheckSettings({
30
+ binding: request.binding,
31
+ keys: ["trackerPatterns"]
32
+ });
33
+ if (settings.outcome === "failed") return settings;
34
+ const trackers = gatheredOutcomes({
35
+ outcomes: settings.value.trackerPatterns.map(
36
+ (source) => compiledTracker({ binding: request.binding, source })
37
+ )
38
+ });
39
+ if (trackers.outcome === "failed") return trackers;
40
+ return {
41
+ outcome: "ok",
42
+ value: [{ binding: request.binding, trackers: trackers.value }]
43
+ };
44
+ };
45
+ var trackedChecksOf = (request) => gatheredOutcomes({
46
+ outcomes: request.bindings.map((binding) => trackedCheckOf({ binding }))
47
+ });
48
+ var trackingReference = (request) => request.tracked.trackers.some((tracker) => tracker.test(request.reference)) ? "tracked" : "untracked";
49
+ var trackingAnywhere = (request) => Array.from(request.text.matchAll(TRACKED_REFERENCE_PATTERN), (match) => match[0]).some(
50
+ (reference) => trackingReference({ ...request, reference }) === "tracked"
51
+ ) ? "tracked" : "untracked";
52
+ var trackingAtStart = (request) => {
53
+ const reference = LEADING_TRACKED_REFERENCE_PATTERN.exec(request.text)?.[1];
54
+ return reference === void 0 ? "untracked" : trackingReference({ ...request, reference });
55
+ };
56
+
57
+ export {
58
+ numberedReferenceKind,
59
+ trackedChecksOf,
60
+ trackingReference,
61
+ trackingAnywhere,
62
+ trackingAtStart
63
+ };
@@ -0,0 +1,45 @@
1
+ import {
2
+ sourceSnippetOf
3
+ } from "./chunk-5AKHEW6V.js";
4
+ import {
5
+ typeScriptSourceKindOf
6
+ } from "./chunk-COQMPHWZ.js";
7
+
8
+ // src/infrastructure/engines/walker/runner/pieces/throw-statement-check.ts
9
+ var throwStatementCheck = (scope) => ({
10
+ prepare: ({ bindings, repository, syntaxApi }) => ({
11
+ outcome: "ok",
12
+ value: {
13
+ prepareFile: ({ file }) => {
14
+ if (typeScriptSourceKindOf({ file, testFiles: repository.testFiles }) !== scope) {
15
+ return { outcome: "ok", value: { kind: "skipped" } };
16
+ }
17
+ return {
18
+ outcome: "ok",
19
+ value: {
20
+ kind: "syntax",
21
+ begin: ({ sourceFile, anchorAt }) => {
22
+ const hits = [];
23
+ return {
24
+ enter: ({ node }) => {
25
+ if (!syntaxApi.isThrowStatement(node)) return;
26
+ const anchor = anchorAt({ position: node.getStart(sourceFile) });
27
+ const snippet = sourceSnippetOf(node.getText(sourceFile));
28
+ hits.push(
29
+ ...bindings.map(({ address }) => ({ check: address, anchor, snippet }))
30
+ );
31
+ },
32
+ finish: () => hits
33
+ };
34
+ }
35
+ }
36
+ };
37
+ },
38
+ finish: () => ({ outcome: "ok", value: [] })
39
+ }
40
+ })
41
+ });
42
+
43
+ export {
44
+ throwStatementCheck
45
+ };