@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
package/ADOPTING.md CHANGED
@@ -146,7 +146,7 @@ export default [
146
146
 
147
147
  To confirm it, run the repository's own `eslint` on one TypeScript file with a type annotation, for example `node_modules/.bin/eslint src/index.ts` with a file of your own; it must report findings or nothing, never `Parsing error`.
148
148
 
149
- In a monorepo where ESLint resolves each file from its nearest config, `hone:project` also writes a `hone.eslint.mjs` slice, with its `hone.eslint.d.mts` declaration of the type, beside each package's tracked `eslint.config.*`, holding only that package's records with paths relative to the package. Where one ESLint 9 run applies the root config to every file, package configs are never loaded and get no slice. A package config keeps its slice even in a folder the root config ignores, since a lint run from that package loads its own config without the root's ignores. A folder holding its own `hone.config.json` is a nested Hone configuration, which is not supported yet ([#72](https://github.com/HailsTails/hone/issues/72)): when the ESLint engine would check a file under it, `check` and `project` stop before anything is checked or written, and say to move the folder out and run it on its own with `--repo`. A run that lists only walker checks does not stop, and a folder with no such file gets no slice. The root config spreads the root projection last, and each package config spreads its own slice last, never the root one:
149
+ In a monorepo where ESLint resolves each file from its nearest config, `hone:project` also writes a `hone.eslint.mjs` slice, with its `hone.eslint.d.mts` declaration of the type, beside each package's tracked `eslint.config.*`, holding only that package's records with paths relative to the package. Where one ESLint 9 run applies the root config to every file, package configs are never loaded and get no slice. A package config keeps its slice even in a folder the root config ignores, since a lint run from that package loads its own config without the root's ignores. When a folder holds its own `hone.config.json`, `check` and `project` continue. Hone skips projection slices there and names the folder when it keeps the parent projection out of effect. The root config spreads the root projection last, and each package config spreads its own slice last, never the root one:
150
150
 
151
151
  ```js
152
152
  import projection from "./hone.eslint.mjs";
@@ -187,7 +187,7 @@ Commit the projection, every slice and the configs. Hone's check reads this conf
187
187
  npm run --silent hone:check
188
188
  ```
189
189
 
190
- It exits `0` on `verdict: pass`, `1` on `verdict: fail` and `2` when an input cannot be loaded; [docs/output-contract.md](docs/output-contract.md) has every exit code and line. `npm run` passes the exit code through. `sh: hone: not found` or `'hone' is not recognized` means step 2's install is missing. A load failure that names a toolchain package says what to install or delete.
190
+ It exits `0` on `verdict: pass`, `1` on `verdict: fail` and `2` when an input cannot be loaded. `npm run` passes the exit code through. `sh: hone: not found` or `'hone' is not recognized` means step 2's install is missing. A load failure that names a toolchain package says what to install or delete.
191
191
 
192
192
  Add the check to the repository's existing validation script, and run that script in CI and in any pre-push hook the repository already has, so the check runs wherever the other checks run.
193
193
 
@@ -205,7 +205,7 @@ With pnpm:
205
205
  pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main
206
206
  ```
207
207
 
208
- A run that leaves forfeiture to another run marks its verdict line as a partial assessment. Act on the exit code, or match every verdict line [docs/output-contract.md](docs/output-contract.md#the-version-2-report) lists.
208
+ A run that leaves forfeiture to another run marks its verdict line as a partial assessment. Act on the exit code.
209
209
 
210
210
  CI leaves forfeiture to the hook, and with `elsewhere` in effect it can run the check with no base revision:
211
211
 
@@ -280,7 +280,7 @@ A finished section reads like this, for the check `claimed-type#unlisted-cast-si
280
280
 
281
281
  ## 6. Read the report
282
282
 
283
- The report prints only the sections that have entries, each with its count, then the verdict. A finding names the check, the engine, the place and the snippet, what the check may indicate and, where it has one, the fix. Each other line says what to do about it. [docs/output-contract.md](docs/output-contract.md#the-version-2-report) lists every section in the order it prints, which sections fail the run, and every line. The `symptoms` section, printed last, explains each symptom the findings name.
283
+ The report prints only the sections that have entries, each with its count, then the verdict. A finding names the check, the engine, the place and the snippet, what the check may indicate and, where it has one, the fix. Each other line says what to do about it. The `symptoms` section, printed last, explains each symptom the findings name.
284
284
 
285
285
  To print less, set `"reportOutput"` in `hone.config.json`, or pass `--report-output` for one run. The verdict and exit code are the same whichever output you choose.
286
286
 
@@ -288,7 +288,7 @@ To print less, set `"reportOutput"` in `hone.config.json`, or pass `--report-out
288
288
 
289
289
  Before recording anything, take the chain in [the spirit of the rules](rules/SPIRIT.md#when-the-check-is-red): measure the sites for each failing check, ask what each group points at using the `symptoms` section of the report, the "May indicate" and "Breach usually sits" lines of each symptom on [the symptoms page](rules/typescript/symptoms.md) and the check's section in `disciplines.assessment.md` (step 5a), then decide. Fix the cause where you can; a record is not the first move. Where a finding is correct in a place, or owed and cannot be fixed yet, answer it with a record in `<repo>/hone-records`, one file for each kind and symptom or recipe:
290
290
 
291
- - **Debt** is known debt in one file: `hone-records/debt/<symptom>.json` with the symptom's name as `answers`, or `<symptom>#<check>` to reach one check of it, and the `file`. It is forfeited, and fails the run, as soon as that file changes since `--base-revision`. An `eslint-disable` comment or a `@ts-expect-error`, `@ts-ignore` or `@ts-nocheck` directive in a file is held only by a record on its check and file: until one holds it, such a comment is `unrecorded` and fails the run. Step 7a writes that debt for the findings and for such comments.
291
+ - **Debt** is known debt in one file: `hone-records/debt/<symptom>.json` with the symptom's name as `answers`, or `<symptom>#<check>` to reach one check of it, and the `file`. It is forfeited, and fails the run, as soon as that file changes since `--base-revision`. An `eslint-disable` comment or a `@ts-expect-error`, `@ts-ignore` or `@ts-nocheck` directive in a file is held only by a record on its check and file: until one holds it, such a comment is `unrecorded` and fails the run; once held, it is listed under `held` with the record that holds it. Step 7a writes that debt for the findings and for such comments.
292
292
  - **An authorised location** says the symptom is correct in that file, for example the single adapter that reads the real clock when the catalogue lists that case: `hone-records/authorised-locations/<symptom>.json`. `hone authorise` writes one from the arguments it is given, with the why-chain the person supplies.
293
293
  - **A boundary record** says a module is where an outside party is met, such as the clock adapter, in `hone-records/boundary-records.json`:
294
294
 
@@ -333,7 +333,7 @@ Existing debt needs no chain and no case: a debt record names only its symptom a
333
333
 
334
334
  A repository with existing code usually has more findings than the change that adopts Hone can fix. `hone record-debt` writes a debt record for each symptom, check and file the check finds broken, and for each inline disable or TypeScript directive that hides one, so the first passing run does not wait on hundreds of records written by hand. Do this after the assessment (step 5a), and after fixing what you are going to fix in this change.
335
335
 
336
- 1. **Decide the permanent exceptions first.** List each file or folder that breaks a check on purpose and always will, such as the one adapter that reads the real clock. Those are not debt. They get an authorised location or a boundary record with their own reason, written by a person, so keep them out of the generated records with `--leave`.
336
+ 1. **Decide the permanent exceptions first.** List each file or folder that breaks a check on purpose and always will, such as the one adapter that reads the real clock. Those are not debt. They get an authorised location with its `whyChain`, or a boundary record, written by a person, so keep them out of the generated records with `--leave`.
337
337
  2. **Leave `hone.config.json` as it is.** Debt needs no why-chain and no case, so the command needs no setting and never sets one. The same command records debt a later change uncovers, such as a newly listed check or a newer edition: run it again against the branch's base.
338
338
  3. **Finish every source file this change edits.** Forfeiture is assessed against the branch's base, the revision your pre-push hook and CI pass to the check (step 5), such as `origin/main`, not against the commit you run from. A file the adopting change edits has changed since that base, so a record for it is forfeited there, even after you commit the edit; the command writes none for such a file and says so. In each file this change edits, fix every finding of each check, or take the edit out of this change and make it later in a change that fixes the file. A file this change adds has no record to lose: point 4 reports it `touched`.
339
339
  4. **Run it once, with the branch's base as `--base-revision`**, one `--leave` for each path from point 1. Fetch the base first, so the revision is current:
@@ -343,7 +343,7 @@ A repository with existing code usually has more findings than the change that a
343
343
  node_modules/.bin/hone record-debt --repo . --base-revision origin/main --leave src/clock.ts --leave src/adapters
344
344
  ```
345
345
 
346
- It prints one line per finding and per native exception, saying what it recorded and, for each it did not, why and what to do instead. Files under a `--leave` path need their records written now, each with its own reason. Files this change created or changed need fixing, or a record with a reason of your own.
346
+ It prints one line per finding and per native exception, saying what it recorded and, for each it did not, why and what to do instead. Files under a `--leave` path need their authorised locations or boundary records from point 1 written now. Files this change created or changed need fixing.
347
347
  5. **Re-project and check against the same base.** With any `eslint` check, run `npm run --silent hone:project`. Then run `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main` (with pnpm, `pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main`). `--forfeiture this-run` makes this run assess forfeiture whatever `forfeiture` says, as the run that assesses it for your repository does: the pre-push hook with `"forfeiture": "elsewhere"` (step 5), or CI without it. A `forfeited` line names a file this change edits: go back to point 3 for it. A check against `HEAD` hides those lines, because nothing has changed since `HEAD`, and the hook or CI then fails where this run passed. What stays under `unrecorded` is what no record can hold; point 4's line for each says what to do.
348
348
  6. **Review the diff.** Nothing takes effect until you commit it. Each generated record is debt holding only its symptom, check and file: inherited debt that nobody has reviewed, and the reviewer of the adopting change reads it as that. Note them in each check's Debt line in `disciplines.assessment.md`.
349
349
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,82 @@
2
2
 
3
3
  Every release of Hone, newest first. `pnpm run release-pull-request` writes each new section from the commits merged to `main` since the previous release tag, whose subjects are the squash-merged pull request titles; README.md's Compatibility section says what each kind of release may change. The sections below were written by hand from the merged pull requests when the changelog started.
4
4
 
5
+ ## 2.0.0-pre.4
6
+
7
+ ### Breaking changes
8
+
9
+ - speak the named model in the walker, rule-set and testing entries (#415)
10
+
11
+ ### Features
12
+
13
+ - detect process global access (#359)
14
+ - detect ambient random calls (#360)
15
+ - detect throws in production units (#361)
16
+ - detect prose in TypeScript comments (#362)
17
+ - detect global patches and stub answers in hooks (#363)
18
+ - detect floating versions and fetched tools (#364)
19
+ - ci: stable managed agents build, triage and review, invoked from issues and pull requests (#409)
20
+ - ci: review draft pull requests and hand review findings back to the builder (#428)
21
+ - ci: reviews run from main and post as rin-reviewer (#430)
22
+ - agents: triager weighs issues against ordinary use (#431)
23
+ - keep team records in their rule set's records folder (#390)
24
+ - record, prune and authorise on team rule set addresses (#408)
25
+ - hone upgrade converts a team rule set from its version 1 layout (#424)
26
+ - agent-detached label stops agent reviews and hand-backs on a pull request (#437)
27
+ - release: fold a stable release's pre-release changelog sections into one (#351) (#405)
28
+ - detect Vitest test call aliases (#385)
29
+ - detect debugger statements (#386)
30
+ - detect ambient browser dialogs in edition two (#388)
31
+ - detect conditional and todo tests in edition two (#389)
32
+ - detect exports from test files (#392)
33
+ - detect type declarations in test files (#393)
34
+ - detect empty error handlers (#394)
35
+ - detect built units called in place (#395)
36
+ - detect assertions outside test cases (#396)
37
+ - detect tests reading code or prose as text (#397)
38
+ - detect unread function parameters (#398)
39
+ - declare which files are tests with testFiles in hone.config.json (#434)
40
+ - the generated checks page shows each check's engines (#407)
41
+
42
+ ### Fixes
43
+
44
+ - record-debt refuses and names project when the projection is stale (#371)
45
+ - --repo refusal and help name hone.config.json, not disciplines.json (#370)
46
+ - upgrade proof counts the files it writes, mentions every version 1 file, and says what it compared (#373)
47
+ - ci: the agent job reads the session's list cost amount (#406)
48
+ - cap hook answer snippets at eighty characters (#401)
49
+ - detect Vitest environment stubs in edition two (#402)
50
+ - ci: the agent job streams session events through a file (#425)
51
+ - lead findings with their symptom and source (#378)
52
+ - explain the problem in walker test-body remedies (#381)
53
+ - report floating versions at their manifest declarations (#411)
54
+ - detect pnpx in workflow commands (#404)
55
+ - self-check: print the gate line as the run's only verdict (#419)
56
+ - treat workspace packages and subpath imports as own API in test-body logic (#427)
57
+ - share tracker reference parsing (#414)
58
+ - an answered finding line names the fix its finding line names (#426)
59
+ - records: record-debt new-file and left lines no longer ask for a reason of its own (#418)
60
+ - continue checks around nested Hone configurations (#384)
61
+
62
+ ### Other changes
63
+
64
+ - retire the output contract doc and the test that pins it to the code (#376)
65
+ - run and report version 2 checks by name (#358)
66
+ - Claude works an issue labelled claude or a comment mentioning @claude (#380)
67
+ - a Claude Managed Agent works an issue labelled claude (#400)
68
+ - record the applied agent definitions (#410)
69
+ - share TypeScript throw detection (#399)
70
+ - read team rule sets from the version 2 layout and refuse the version 1 layout by name (#383)
71
+ - share anchored walker snippets (#429)
72
+ - record the applied agent definitions (#432)
73
+ - assess debt forfeiture in Hone's own runs again (#438)
74
+
75
+ ## 2.0.0-pre.3
76
+
77
+ ### Fixes
78
+
79
+ - index records, measurements and declarations once instead of rescanning per hit (#365)
80
+
5
81
  ## 2.0.0-pre.2
6
82
 
7
83
  ### Fixes
package/MIGRATING.md CHANGED
@@ -228,10 +228,10 @@ To move:
228
228
  2. **Install the package** as [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) step 2 says, including the two `hone:` scripts.
229
229
  3. **Repoint every command.** In scripts, CI and the pre-push hook, replace `node tools/discipline-core/core/check/check-command.ts --repo .` with `npm run --silent hone:check`, and `project-command.ts` with `npm run --silent hone:project`. Pass options after `--` with npm, as in `npm run --silent hone:check -- --base-revision origin/main`, and straight after the script name with pnpm, as in `pnpm run --silent hone:check --base-revision origin/main`. A hook or gate that reads the verdict line needs the warning in [ADOPTING.md](ADOPTING.md#5-run-the-check) step 5. Point agent instructions at `node_modules/@hailstails/hone/rules/`.
230
230
  4. **Repoint your own pieces and tests.** Nothing outside the package's public entries can be imported now:
231
- - A piece that imported types or `folderScope` from the copy, such as from `walker-piece.ts` or `source-scope.ts`, imports them from `@hailstails/hone/audit`.
232
- - A piece that read JSON with comments through the copy's `jsonc-parse.ts` calls TypeScript's own parser on the syntax API that `prepare` hands it: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config`, and sets `error` when it cannot parse the text. Do not import `jsonc-parser`: it is Hone's own dependency, not one the repository declares, so a strict package manager such as pnpm does not resolve it from a piece, and a piece imports only what [docs/extending.md](docs/extending.md#what-is-stable) lists.
231
+ - A piece that imported types or `folderScope` from the copy, such as from `walker-piece.ts` or `source-scope.ts`, imports them from `@hailstails/hone/walker`.
232
+ - A piece that read JSON with comments through the copy's `jsonc-parse.ts` calls TypeScript's own parser on the syntax API that `prepare` hands it: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config`, and sets `error` when it cannot parse the text. Do not import `jsonc-parser`: it is Hone's own dependency, not one the repository declares, so a strict package manager such as pnpm does not resolve it from a piece, and a piece imports only what [docs/extending.md](docs/extending.md) lists.
233
233
  - For a file it cannot parse, a piece returns `{ outcome: "failed", error: { kind: "file-unparseable", file, detail } }`. The check then stops with `load failure: runner-failed audit file-unparseable <file> <detail>` and exit `2`.
234
- - Case tests use `clauseConformanceOf` from `@hailstails/hone/testing`, as [docs/extending.md](docs/extending.md#test-a-piece) shows.
234
+ - Case tests use `checkConformanceOf` from `@hailstails/hone/testing`, naming the `ruleSet`, as [docs/extending.md](docs/extending.md) shows.
235
235
  - A test that called the copy's check or governance functions directly, such as `runCheck` or `applyGovernance`, has no entry to call: run the `hone check` command against a repository the test sets up, and assert on its report and exit code.
236
236
  5. **Remove the copy.** Delete `tools/discipline-core/`, its line in `.gitignore`, and its entry in `disciplines.json`'s `exclude`.
237
237
  6. **Re-project** if any clause is `eslint`: run `npm run --silent hone:project`. The projection now imports each piece by package name instead of by a path into `tools/discipline-core/`, so it changes once; commit it.
@@ -390,7 +390,7 @@ Nothing must be migrated. Selections, exception records and findings still use t
390
390
  1. **Refresh Hone** as [ADOPTING.md](ADOPTING.md#10-update-and-remove) section 10 says, and run the check. A record whose debt is paid on a file that still exists now brings the `prune-debt` line to the end of `readFirst`.
391
391
  2. **Run the command it names,** then `npm run --silent hone:project` when any clause is `eslint`, and commit what they change.
392
392
  3. **Runners written outside Hone** may return `measured`, a list of `{ clause, file }` pairs, beside what they return now; [the mechanism guide](docs/adding-a-discipline-or-mechanism.md) says what a pair means. A runner that returns none has measured nothing, and its records on files that still exist stay for a person, as before.
393
- 4. **Audit pieces written outside Hone** must answer `skipped` from `prepareFile` for a file they do not judge. Any other answer now says the piece's clauses were measured on that file, so `prune-debt` may remove a record on it; [the audit piece guide](docs/extending.md#an-audit-piece) says so.
393
+ 4. **Audit pieces written outside Hone** must answer `skipped` from `prepareFile` for a file they do not judge. Any other answer now says the piece's clauses were measured on that file, so `prune-debt` may remove a record on it; [the audit piece guide](docs/extending.md) says so.
394
394
 
395
395
  ## 20. Moving from version 1 to version 2
396
396
 
@@ -403,7 +403,7 @@ Version 2 keeps its settings in `hone.config.json`, its records in the `hone-rec
403
403
  node_modules/.bin/hone upgrade --repo .
404
404
  ```
405
405
 
406
- It runs version 1 over your repository, plans the version 2 files, writes them, runs version 2 and compares the two runs. A version 1 `reportOutput` of `failures-only` is written as `actionable`, its version 2 name, and `--report-output failures-only` is refused on a version 2 repository. Only when they agree does it remove the version 1 files. If they do not, it changes nothing. Each refusal states whether anything was changed, and lists any file it could not put back; [the output contract](docs/output-contract.md#hone-upgrade) lists every refusal.
406
+ It runs version 1 over your repository, plans the version 2 files, writes them, runs version 2 and compares the two runs. A version 1 `reportOutput` of `failures-only` is written as `actionable`, its version 2 name, and `--report-output failures-only` is refused on a version 2 repository. Only when they agree does it remove the version 1 files. If they do not, it changes nothing. Each refusal states whether anything was changed, and lists any file it could not put back.
407
407
  3. **Commit** what the upgrade wrote and removed, as its own commit after the install: the version 2 files together with the removal of the version 1 files, `git add .`, then your commit. That includes each `hone.eslint.d.mts`, which the check compares with what `hone project` writes and reports under `projection-problems` when it is missing or out of date.
408
408
 
409
409
  After the upgrade, `hone split-records` does not run on version 2 files, and the records stay in `hone-records`. Before it, version 1's `hone authorise` stops and sends you here.
@@ -411,7 +411,7 @@ Version 2 keeps its settings in `hone.config.json`, its records in the `hone-rec
411
411
 
412
412
  ### What the upgrade prints
413
413
 
414
- It exits `0` on success, listing each file it wrote, rewrote or removed: commit them all. It exits `1` on a refusal, and each refusal line says what to do: do it, then run the upgrade again. A refusal says whether anything was changed, and lists any file it could not put back. A line that asks you to report a fault at the issues page is the tool's fault, not your repository's: send the output. It exits `3` when version 2 is in place but some version 1 files could not be removed: delete the files it lists by hand, then commit. [docs/output-contract.md](docs/output-contract.md) lists every line.
414
+ It exits `0` on success, listing each file it wrote, rewrote or removed: commit them all. It exits `1` on a refusal, and each refusal line says what to do: do it, then run the upgrade again. A refusal says whether anything was changed, and lists any file it could not put back. A line that asks you to report a fault at the issues page is the tool's fault, not your repository's: send the output. It exits `3` when version 2 is in place but some version 1 files could not be removed: delete the files it lists by hand, then commit.
415
415
 
416
416
  ### Your records, and what the check judges
417
417
 
@@ -436,3 +436,12 @@ A repository with package slices, one `disciplines.eslint.mjs` in each package f
436
436
  After version 1's run, the upgrade runs version 1's own `project` once, to learn which slices exist. A slice that no config root owns any more is removed by it. A refusal after that lists it under `version 1's own project removed these files, and the upgrade does not put them back; restore them from version control:`, since the upgrade did not write it.
437
437
 
438
438
  Each refusal an ESLint repository meets names the config or projection and what to do, as every other refusal does.
439
+
440
+ ### A team rule set
441
+
442
+ A team rule set still in version 1's layout, `rules/<ID>/discipline.json` beside `mechanisms/`, is converted by the same run. Before it, do these by hand, in a commit of their own:
443
+
444
+ 1. **Name and define what version 2 needs.** Names and definitions are your team's judgement, so the upgrade asks for them rather than writing its own: write `version-two-names.json` at the rule set's root. `clauses` gives each mechanical clause a check of its own, not one of Hone's, and a title, such as `"ACME-1#console-calls": { "check": "direct-console#console-calls", "title": "Console calls" }`. `symptoms`, `cases`, `principles` and `rules` define each symptom those checks see, and what each symptom points at, with the same facts as their items in [docs/extending.md](docs/extending.md); a symptom's `seen` is taken from its clauses' summaries. Anything missing refuses the upgrade, and the refusal lists every entry to add.
445
+ 2. **Update the pieces to version 2's piece API,** which [docs/extending.md](docs/extending.md) describes: a walker piece reads `bindings` and reports at `binding.address` where it read clauses, it imports from `@hailstails/hone/walker`, and its tests use `@hailstails/hone/testing`. The upgrade runs the pieces to prove the two runs agree, so they must run under version 2 first.
446
+
447
+ The upgrade writes the definitions, symptoms and checks under the rule set's `rules/` folder and each clause's cases as its check's examples, moves each piece's folder to `engines/<engine>/<symptom>/<check>/`, and removes the version 1 files and the names file. A folder that several clauses share is split: each clause's module and its test go to that clause's check, and the other files go once to the check of the clause first by name. Each moved file's relative imports, `require` calls and test-double module paths are rewritten for where it now sits. The upgrade refuses a folder whose one module serves several clauses, and an import or module path written as an expression rather than a string; give each clause a module of its own, or write the path as a string, first. The rule set takes Hone's record kinds, and its records land under `hone-records/<rule set>/`. An upgrade that stopped part way leaves version 1 discipline files beside version 2 items, and a second `hone upgrade` refuses that rule set until they are removed or it is restored.
package/README.md CHANGED
@@ -21,14 +21,12 @@ Two engines ship: `walker`, a standalone TypeScript syntax walker, and `eslint`,
21
21
 
22
22
  To adopt Hone in another repository, follow [ADOPTING.md](ADOPTING.md) step by step. A repository already using the older standalone route, or a copy of Hone's source, follows [MIGRATING.md](MIGRATING.md) instead.
23
23
 
24
- A team adds its own disciplines as a rule set in its own repository, with ESLint and audit pieces, following [docs/extending.md](docs/extending.md). Adding a discipline or a mechanism to Hone itself, and the full list of ESLint native channels, are covered in [docs/adding-a-discipline-or-mechanism.md](docs/adding-a-discipline-or-mechanism.md).
24
+ A team adds its own symptoms and checks as a rule set in its own repository, with ESLint and walker pieces, following [docs/extending.md](docs/extending.md). Adding a symptom, check or engine to Hone itself, and the full list of ESLint native channels, are covered in [docs/adding-a-discipline-or-mechanism.md](docs/adding-a-discipline-or-mechanism.md).
25
25
 
26
26
  ## Commands
27
27
 
28
28
  The package ships one command, `hone`. `check` and `project` run through a `package.json` script as [ADOPTING.md](ADOPTING.md#2-install-the-hone-package) shows; `record-debt` runs once, when a repository adopts Hone; `prune-debt` runs when the check names it, to remove the records of debt that is paid; `authorise` writes one authorised location; `upgrade` runs once, to move a version 1 repository to version 2, as [MIGRATING.md](MIGRATING.md#20-moving-from-version-1-to-version-2) section 20 shows. `hone --help` lists the commands, and `hone <command> --help` gives each one's options and exit codes.
29
29
 
30
- [docs/output-contract.md](docs/output-contract.md) lists every line `hone` prints, the exit codes, the report's sections and which parts are stable for hooks, CI and agents to rely on.
31
-
32
30
  `hone check` loads the repository's `hone.config.json`, the symptom catalogue and the records in `hone-records`; works out which files changed since `--base-revision`; runs each engine its listed checks name once over the repository's tracked files; answers each finding by the records; and prints one report ending in its verdict. The verdict and exit code always come from the whole report, whatever `--report-output` or `reportOutput` print.
33
31
 
34
32
  Without `--base-revision`, Hone cannot tell which files were touched, so debt cannot be forfeited and records carried from version 1 cannot be compared with the base; the report says so and the run fails. `--forfeiture elsewhere`, or `"forfeiture": "elsewhere"` in `hone.config.json`, leaves debt forfeiture to another run, such as a pre-push hook given a base revision; that run's report says what it left, and its verdict is a partial assessment.
@@ -44,7 +42,7 @@ Give it the base that the run assessing forfeiture is given, such as `origin/mai
44
42
  It never writes anything that needs an owner's reason: no authorised location, no boundary record, no deviation, no dependency record and no setting. It prints one line per finding and per native exception under `unrecorded`, and writes nothing for:
45
43
 
46
44
  - a symptom and file that already hold debt;
47
- - a file under a `--leave` path. `--leave` takes an exact file or folder, as `exclude` does, and may be given once for each path. It names the deliberate, permanent exceptions, which a person records as an authorised location with its own reason;
45
+ - a file under a `--leave` path. `--leave` takes an exact file or folder, as `exclude` does, and may be given once for each path. It names the deliberate, permanent exceptions, which a person records as an authorised location with a why chain;
48
46
  - a file this change created or changed, when the run assesses forfeiture, since a finding there is the change's own breach: fix it there. With `forfeiture` set to `elsewhere` the check forfeits nothing, so the command writes debt on such a file like any other;
49
47
  - a finding the catalogue gives no symptom or check to record against, such as one of a team rule set's clauses;
50
48
  - a native exception no debt record can hold. A `config-override` is never recorded, since debt holds what is owed and an override on a clean file owes nothing: a file under it that breaks the check gets its debt from the finding, because Hone's own run does not read the override, so remove the override or narrow it. An `ignore` and a `suppression-entry` hide nothing from Hone's run, which has already recorded what it finds in the file, so remove them; a generated or vendored file under an `ignore` can instead be listed in `exclude`, which Hone's run then honours too, so no `ignore` line is printed for it. An inline rule configuration changes what the rule checks: remove the comment. A lint-script option gets the advice for why Hone could not judge it, the same as its `unrecorded` line.
@@ -90,7 +88,7 @@ import hone from "./hone.eslint.mjs";
90
88
  export default [{ files: ["**/*.{ts,tsx,mts,cts}"] }, ...hone];
91
89
  ```
92
90
 
93
- A package with no `eslint.config.*` of its own is linted by the nearest config above it, so its records stay in that config's slice. A file is governed by the deepest config root that contains it. A folder holding its own `hone.config.json` is a nested Hone configuration, which is not supported yet ([#72](https://github.com/HailsTails/hone/issues/72)): when the ESLint engine would check a file under it, `check` and `project` stop before anything is checked or written, while a run that lists only walker checks does not stop. A folder holding one and no file the run would check gets no slice, and nor does anything under it. Either fix works today: run the folder on its own with `--repo`, as the line says, or govern it from this repository by removing its `hone.config.json` and keeping its records here, after which `hone project` writes its slice.
91
+ A package with no `eslint.config.*` of its own is linted by the nearest config above it, so its records stay in that config's slice. A file is governed by the deepest config root that contains it. When a folder holds its own `hone.config.json`, `check` and `project` continue. Hone skips projection slices in that folder and names it when it keeps the parent projection out of effect.
94
92
 
95
93
  A config root keeps its slice even where a config above it ignores its folder: a lint run from that folder loads its own config and never reads the ignores above it, so `hone project` writes the same slices from the same inputs every time. A repository with only a root config gets exactly the projection it had before.
96
94
 
@@ -127,6 +125,7 @@ At the repository root. It lists the checks the repository runs and the engine t
127
125
  - `checkEditions`, optional, is `"pinned"` (the default) or `"latest"`. A check that has been tightened has more than one edition, listed on its check page. `"pinned"` runs each check's default edition, which changes only in a major release; `"latest"` runs the newest edition the installed Hone has for every listed check, so a minor release can add findings. `"edition"` in a check's `checkSettings` holds that one check to the edition it names over either. The report lists the edition each such check ran under `editions`.
128
126
  - `checkSettings`, optional, maps a listed check address to an object of that check's settings, for a check whose page lists settings. Each key must be one the check's piece declares, and its value must be the same JSON kind as the declared default and, where the piece lists choices, one of them; the value replaces the default. Anything else makes `hone.config.json` malformed, naming the check, the key and what is accepted.
129
127
  - `exclude`, optional, lists repository folders or exact files that no engine checks. A folder entry covers everything under it. Globs are refused: an entry containing `*` makes `hone.config.json` malformed. The report lists the active entries under `excluded`. Exclude Hone's own install when it is vendored inside the repository.
128
+ - `testFiles`, optional, says which files are tests: `{ "suffixes": ["test", "spec"], "folders": [] }` by default. A file is a test when the name part before its extension is one of `suffixes`, such as `order.spec.ts`, or when it sits under a folder named in `folders`, such as `__tests__`.
130
129
  - `generated` and `layers`, optional, are declared for checks that will read them; no check reads either yet, and the report says so under `settings-notes`.
131
130
 
132
131
  The keys version 1's `disciplines.json` used under other names are refused, each naming what replaces it: `clauses` is `checks`, `clauseSettings` is `checkSettings`, `assessment` is `forfeiture`, and `fileExceptionWhyChains` is gone, since every record shows its why-chain. [MIGRATING.md](MIGRATING.md#20-moving-from-version-1-to-version-2) section 20 lists what moved.
@@ -157,15 +156,15 @@ With the ESLint mechanism selected, a packaged install's projection imports one
157
156
 
158
157
  ## Public type entries
159
158
 
160
- The package has three public entries for TypeScript. `@hailstails/hone/rule-set` holds types only, so importing it adds no code to a build; import it with `import type`. `@hailstails/hone/audit` adds three values to its types, and `@hailstails/hone/testing` is for a team's own tests.
159
+ The package has three public entries for TypeScript. No other path in the package is a public TypeScript entry.
161
160
 
162
161
  | Entry | Status | What it is for |
163
162
  | --- | --- | --- |
164
- | `@hailstails/hone/rule-set` | Stable | The shapes of `discipline.json`, `piece.json` and an ESLint piece's `settings`, for a team writing its own rule set. Identifiers and paths are plain strings: Hone checks them when it reads the files. |
165
- | `@hailstails/hone/audit` | Experimental | The types for writing an audit walker piece, `WalkerPiece` and what it needs, including `PieceFailure`, the failures a piece may return. Clause addresses and file paths reach a piece from Hone, already checked, and a piece passes them back unchanged. Its three values are `folderScope`, which tells a piece whether a file sits in a generated folder; `isEdition`, which narrows a text such as `"2"` to an `Edition`; and `editionReaches`, which tells a piece whether the edition that runs covers something introduced in a given edition. It may change in a minor release. |
166
- | `@hailstails/hone/testing` | Experimental | Runs a team audit clause's `cases` through its piece with the installed audit runner (`clauseConformanceOf`), and hands a test the clause bound as `hone check` binds it (`clauseUnderTestOf`) and a checked file path (`repoPathOf`). Hone does not run these tests itself. It may change in a minor release. |
163
+ | `@hailstails/hone/rule-set` | Stable | Types only, for the files a team writes in its own rule set. |
164
+ | `@hailstails/hone/walker` | Experimental, may change in a minor release | Writing a walker piece. It names TypeScript's syntax types, so it needs the repository's `typescript` peer. |
165
+ | `@hailstails/hone/testing` | Experimental, may change in a minor release | Running a team's checks against their own examples in the team's tests. |
167
166
 
168
- Each resolves with `moduleResolution` `"nodenext"` or `"bundler"`. `install-proof` type-checks a team piece and rule set against them, and checks that a wrongly typed field fails: on TypeScript 4.8.4 from an ES module with `"nodenext"` (4.8 has no `"bundler"`), and on 6.0.3 from an ES module with both and from a CommonJS file. A CommonJS file (`.cts`, or `.ts` in a package that is not `"type": "module"`) can import these types on TypeScript 5.8 or later with `module` `"nodenext"`. With `module` `"node16"`, and on TypeScript 5.3 to 5.7, the import needs `with { "resolution-mode": "import" }`, and older versions reject it. These CommonJS figures were checked once by hand, on 5.8.2, 5.3.3 and 6.0.3 with `"node16"`; `install-proof` checks only the 6.0.3 CommonJS case with `"nodenext"`. `@hailstails/hone/audit` names TypeScript's own syntax types, so it needs the `typescript` the repository already installs as a peer. No other path in the package is a public TypeScript entry.
167
+ `install-proof` type-checks the `acme` team rule set against these entries, and checks that a wrongly typed field fails, on TypeScript 4.8.4 from an ES module with `moduleResolution` `"nodenext"`, and on 6.0.3 from an ES module with `"nodenext"` and `"bundler"` and from a CommonJS file with `"nodenext"`. It also runs acme's examples through `@hailstails/hone/testing`.
169
168
 
170
169
  ## Runtime
171
170
 
@@ -188,8 +187,8 @@ Hone's version numbers follow semantic versioning under these rules:
188
187
  - A new or tightened check ships off by default in a minor release and becomes a default only in a major release. A new check arrives as a new check of a symptom, which a repository adopts by listing it. A tightened check arrives as a new edition of the check, which runs only for a repository that sets `checkEditions` to `"latest"` or names the edition in the check's `checkSettings`; a major release makes it the default edition and may retire older ones.
189
188
  - A change to the ESLint config that `hone project` generates, which an adopter must regenerate, is a minor release, with a clear message telling the adopter to regenerate: its changelog entry says to run `hone project` and commit the result, and until then the check reports the projection `out-of-date`.
190
189
  - Renaming or removing a check address, a config key in `hone.config.json`, a records file or a key of a record, or a CLI flag, or changing what one means, is a major release. Adding one with a safe default is not.
191
- - A change to what [the output contract](docs/output-contract.md) says a tool can parse is a major release: the command and option names, the exit codes and streams, the report's sections, outputs and verdict lines, the load failure kinds, and each line's leading fields up to its first value that may hold a space. What it marks not stable, such as the help text, the wording of `arguments-invalid` and `readFirst` lines and the repair text after a load failure's values, may change in a minor release, and a minor release may add a section, a kind of line or an option.
192
- - A breaking change to a type in `@hailstails/hone/rule-set` is a major release. `@hailstails/hone/audit` is experimental: its types may change in a minor release until it is marked stable.
190
+ - A change that breaks a tool parsing hone's output is a major release: the command and option names, the exit codes, the report's section names and its verdict lines. A change to the help text or to the wording of a message is a minor release.
191
+ - A breaking change to a type in `@hailstails/hone/rule-set` is a major release. `@hailstails/hone/walker` and `@hailstails/hone/testing` are experimental: they may change in a minor release until they are marked stable.
193
192
  - A pre-release previews the release it is numbered towards and is published under the `next` dist-tag. A change no larger than the one a pre-release is numbered towards lands in that release's next pre-release; a larger one starts the line of the larger version it calls for. The changelog lists each change either way.
194
193
 
195
194
  `hone.config.json` and the records in `hone-records` follow the same rules. A new key with a safe default, where nothing changes for an adopter who does not set it, is not breaking and can arrive in a minor release. A new required key with no safe default is breaking, and so is a change that makes a file that loads today stop loading or mean something else; both wait for a major release.
@@ -259,7 +258,7 @@ To prepare a release, create a new branch at the tip of `main` and run `pnpm run
259
258
 
260
259
  The first stable release is made the same way. The `0.1.0` pre-release line holds breaking changes, so on the branch for that release `pnpm run release-pull-request stable` finishes the line with major version 1, minor and patch 0, and every release after it follows the rules above.
261
260
 
262
- It then writes a section for that version at the top of `CHANGELOG.md`, grouping the subjects under Breaking changes, Features, Fixes and Other changes, and sets `version` in `package.json`. It refuses, changing nothing, when no subject follows the latest tag, when a merge commit follows the latest tag or the tag it sizes from, when `package.json` is not at the tag's version, or when the changelog already has the new version. A subject that is not a Conventional Commits subject is named on standard error and counted as a patch under Other changes, or as a major under Breaking changes when its message has a breaking footer, so check its place before opening the pull request. If writing the second file fails, it restores the first. The script only edits those two files: it never commits, tags, pushes or publishes. Open the release pull request with the title `chore(release): <version>`. Merging it is the release: no tag is pushed by hand and nothing is run after the merge. `.github/CODEOWNERS` makes the owner, `@HailsTails`, the code owner of `package.json`, `CHANGELOG.md`, `.github/workflows/`, `.github/CODEOWNERS` itself, the `scripts/release-*` scripts, `scripts/published-manifest.ts`, which writes the published `package.json`, `core/values/tool-identity.ts`, which names the package and its repository, and `pnpm-workspace.yaml`, which holds the `minimumReleaseAge` the release job installs under, so a release pull request, or any change to how a release is made, needs her code-owner approval before it can merge. That also covers every change to `package.json`, dependency updates included, since the version a release is triggered by lives there.
261
+ It then writes a section for that version at the top of `CHANGELOG.md`, grouping the subjects under Breaking changes, Features, Fixes and Other changes, and sets `version` in `package.json`. A stable release folds every pre-release section above the newest stable section into its one section, keeping each entry's group, and leaves no pre-release heading. A folded entry is dropped when a later entry names the same pull request, `(#N)`; the new subjects are all kept. It refuses, changing nothing, when no subject follows the latest tag, when a merge commit follows the latest tag or the tag it sizes from, when `package.json` is not at the tag's version, when the changelog already has the new version, or when a section to fold has a group other than those four or a line that is neither a group heading nor an entry. A subject that is not a Conventional Commits subject is named on standard error and counted as a patch under Other changes, or as a major under Breaking changes when its message has a breaking footer, so check its place before opening the pull request. If writing the second file fails, it restores the first. The script only edits those two files: it never commits, tags, pushes or publishes. Open the release pull request with the title `chore(release): <version>`. Merging it is the release: no tag is pushed by hand and nothing is run after the merge. `.github/CODEOWNERS` makes the owner, `@HailsTails`, the code owner of `package.json`, `CHANGELOG.md`, `.github/workflows/`, `.github/CODEOWNERS` itself, the `scripts/release-*` scripts, `scripts/published-manifest.ts`, which writes the published `package.json`, `core/values/tool-identity.ts`, which names the package and its repository, and `pnpm-workspace.yaml`, which holds the `minimumReleaseAge` the release job installs under, so a release pull request, or any change to how a release is made, needs her code-owner approval before it can merge. That also covers every change to `package.json`, dependency updates included, since the version a release is triggered by lives there.
263
262
 
264
263
  `CHANGELOG.md` names versions, so it stays in the repository and out of the package; the shipped pages link to it on GitHub.
265
264
 
@@ -0,0 +1,38 @@
1
+ import {
2
+ withoutParentheses
3
+ } from "./chunk-EBX57Z3V.js";
4
+
5
+ // src/infrastructure/engines/walker/runner/pieces/syntax-callee-root.ts
6
+ var calleeRootOf = (request) => {
7
+ const { syntaxApi } = request;
8
+ const node = withoutParentheses(request);
9
+ if (syntaxApi.isIdentifier(node)) return node;
10
+ if (syntaxApi.isTaggedTemplateExpression(node))
11
+ return calleeRootOf({ syntaxApi, node: node.tag });
12
+ if (syntaxApi.isPropertyAccessExpression(node) || syntaxApi.isElementAccessExpression(node) || syntaxApi.isCallExpression(node) || syntaxApi.isNonNullExpression(node))
13
+ return calleeRootOf({ syntaxApi, node: node.expression });
14
+ return void 0;
15
+ };
16
+
17
+ // src/infrastructure/engines/walker/runner/pieces/vitest-import.ts
18
+ var valueImportFromVitest = ({ syntaxApi, node }) => {
19
+ if (syntaxApi.isImportDeclaration(node)) {
20
+ return syntaxApi.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === "vitest" && node.importClause?.isTypeOnly !== true;
21
+ }
22
+ if (node.parent === void 0 || syntaxApi.isSourceFile(node)) return false;
23
+ return valueImportFromVitest({ syntaxApi, node: node.parent });
24
+ };
25
+ var vitestImportedNameOf = (request) => {
26
+ const { syntaxApi, node } = request;
27
+ if (syntaxApi.isImportSpecifier(node))
28
+ return !node.isTypeOnly && valueImportFromVitest(request) ? (node.propertyName ?? node.name).text : void 0;
29
+ if (syntaxApi.isNamespaceImport(node)) return valueImportFromVitest(request) ? "*" : void 0;
30
+ if (syntaxApi.isImportClause(node))
31
+ return node.name !== void 0 && valueImportFromVitest(request) ? "default" : void 0;
32
+ return void 0;
33
+ };
34
+
35
+ export {
36
+ calleeRootOf,
37
+ vitestImportedNameOf
38
+ };
@@ -0,0 +1,15 @@
1
+ // src/infrastructure/engines/walker/runner/pieces/source-snippet.ts
2
+ var MAX_LENGTH = 80;
3
+ var trimSnippet = (text) => text.length > MAX_LENGTH ? `${text.slice(0, MAX_LENGTH)}\u2026` : text;
4
+ var sourceSnippetOf = (text) => trimSnippet(text.replace(/\r?\n[ \t]*/g, " "));
5
+ var compactSourceSnippetOf = (text) => trimSnippet(text.replace(/\s+/g, " "));
6
+ var sourceSnippetAt = ({
7
+ source,
8
+ position
9
+ }) => trimSnippet(source.slice(position, position + MAX_LENGTH + 1).replace(/\n/g, " "));
10
+
11
+ export {
12
+ sourceSnippetOf,
13
+ compactSourceSnippetOf,
14
+ sourceSnippetAt
15
+ };
@@ -0,0 +1,64 @@
1
+ // src/infrastructure/engines/walker/runner/pieces/source-bindings.ts
2
+ var sourceBindingsOf = ({
3
+ syntaxApi,
4
+ sourceFile
5
+ }) => syntaxApi.createProgram(
6
+ [sourceFile.fileName],
7
+ { noLib: true, noResolve: true },
8
+ {
9
+ getSourceFile: (file) => file === sourceFile.fileName ? sourceFile : void 0,
10
+ readFile: (file) => file === sourceFile.fileName ? sourceFile.text : void 0,
11
+ fileExists: (file) => file === sourceFile.fileName,
12
+ getCanonicalFileName: (file) => file,
13
+ getCurrentDirectory: () => "/",
14
+ getDefaultLibFileName: () => "lib.d.ts",
15
+ getNewLine: () => "\n",
16
+ useCaseSensitiveFileNames: () => true,
17
+ writeFile: () => void 0
18
+ }
19
+ ).getTypeChecker();
20
+ var sourceBindingsPerFile = () => {
21
+ const bound = /* @__PURE__ */ new WeakMap();
22
+ return (request) => {
23
+ const previous = bound.get(request.sourceFile);
24
+ if (previous !== void 0) return previous;
25
+ const bindings = sourceBindingsOf(request);
26
+ bound.set(request.sourceFile, bindings);
27
+ return bindings;
28
+ };
29
+ };
30
+ var declarationKindOf = ({
31
+ syntaxApi,
32
+ node
33
+ }) => {
34
+ if (syntaxApi.isSourceFile(node)) return node.isDeclarationFile ? "ambient" : "runtime";
35
+ if (syntaxApi.isInterfaceDeclaration(node) || syntaxApi.isTypeAliasDeclaration(node))
36
+ return "ambient";
37
+ if ((syntaxApi.isImportSpecifier(node) || syntaxApi.isImportClause(node) || syntaxApi.isImportEqualsDeclaration(node)) && node.isTypeOnly)
38
+ return "ambient";
39
+ if (syntaxApi.canHaveModifiers(node) && syntaxApi.getModifiers(node)?.some((modifier) => modifier.kind === syntaxApi.SyntaxKind.DeclareKeyword))
40
+ return "ambient";
41
+ return node.parent === void 0 ? "runtime" : declarationKindOf({ syntaxApi, node: node.parent });
42
+ };
43
+ var runtimeDeclarationsOf = (request) => request.declarations.filter(
44
+ (node) => declarationKindOf({ syntaxApi: request.syntaxApi, node }) === "runtime"
45
+ );
46
+ var sourceValueDeclarationsOf = (request) => {
47
+ const { syntaxApi, bindings, node } = request;
48
+ const parent = node.parent;
49
+ const symbol = parent !== void 0 && syntaxApi.isShorthandPropertyAssignment(parent) && parent.name === node ? bindings.getShorthandAssignmentValueSymbol(parent) : bindings.getSymbolAtLocation(node);
50
+ return runtimeDeclarationsOf({ syntaxApi, declarations: symbol?.declarations ?? [] });
51
+ };
52
+ var sourceValueLookupOf = (request) => {
53
+ let bindings;
54
+ return (node) => {
55
+ bindings ??= sourceBindingsOf(request);
56
+ return sourceValueDeclarationsOf({ syntaxApi: request.syntaxApi, bindings, node });
57
+ };
58
+ };
59
+
60
+ export {
61
+ sourceBindingsOf,
62
+ sourceBindingsPerFile,
63
+ sourceValueLookupOf
64
+ };