@nielspeter/eess-ts 0.2.1 → 0.5.0

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 (467) hide show
  1. package/README.md +61 -35
  2. package/dist/builders/call-rule-builder.d.ts +66 -26
  3. package/dist/builders/call-rule-builder.d.ts.map +1 -1
  4. package/dist/builders/call-rule-builder.js +75 -32
  5. package/dist/builders/call-rule-builder.js.map +1 -1
  6. package/dist/builders/class-rule-builder.d.ts +125 -26
  7. package/dist/builders/class-rule-builder.d.ts.map +1 -1
  8. package/dist/builders/class-rule-builder.js +141 -55
  9. package/dist/builders/class-rule-builder.js.map +1 -1
  10. package/dist/builders/correspondence-builder.d.ts +287 -0
  11. package/dist/builders/correspondence-builder.d.ts.map +1 -0
  12. package/dist/builders/correspondence-builder.js +385 -0
  13. package/dist/builders/correspondence-builder.js.map +1 -0
  14. package/dist/builders/correspondence-findings.d.ts +104 -0
  15. package/dist/builders/correspondence-findings.d.ts.map +1 -0
  16. package/dist/builders/correspondence-findings.js +301 -0
  17. package/dist/builders/correspondence-findings.js.map +1 -0
  18. package/dist/builders/cross-layer-builder.d.ts +99 -16
  19. package/dist/builders/cross-layer-builder.d.ts.map +1 -1
  20. package/dist/builders/cross-layer-builder.js +182 -35
  21. package/dist/builders/cross-layer-builder.js.map +1 -1
  22. package/dist/builders/function-rule-builder.d.ts +144 -25
  23. package/dist/builders/function-rule-builder.d.ts.map +1 -1
  24. package/dist/builders/function-rule-builder.js +177 -39
  25. package/dist/builders/function-rule-builder.js.map +1 -1
  26. package/dist/builders/jsx-rule-builder.d.ts +70 -14
  27. package/dist/builders/jsx-rule-builder.d.ts.map +1 -1
  28. package/dist/builders/jsx-rule-builder.js +73 -14
  29. package/dist/builders/jsx-rule-builder.js.map +1 -1
  30. package/dist/builders/module-rule-builder.d.ts +2 -2
  31. package/dist/builders/module-rule-builder.d.ts.map +1 -1
  32. package/dist/builders/module-rule-builder.js +16 -19
  33. package/dist/builders/module-rule-builder.js.map +1 -1
  34. package/dist/builders/scoped-function-rule-builder.d.ts +11 -0
  35. package/dist/builders/scoped-function-rule-builder.d.ts.map +1 -1
  36. package/dist/builders/scoped-function-rule-builder.js +12 -0
  37. package/dist/builders/scoped-function-rule-builder.js.map +1 -1
  38. package/dist/builders/slice-discovery-message.d.ts +36 -0
  39. package/dist/builders/slice-discovery-message.d.ts.map +1 -0
  40. package/dist/builders/slice-discovery-message.js +181 -0
  41. package/dist/builders/slice-discovery-message.js.map +1 -0
  42. package/dist/builders/slice-rule-builder.d.ts +151 -12
  43. package/dist/builders/slice-rule-builder.d.ts.map +1 -1
  44. package/dist/builders/slice-rule-builder.js +243 -35
  45. package/dist/builders/slice-rule-builder.js.map +1 -1
  46. package/dist/builders/type-rule-builder.d.ts +95 -24
  47. package/dist/builders/type-rule-builder.d.ts.map +1 -1
  48. package/dist/builders/type-rule-builder.js +109 -42
  49. package/dist/builders/type-rule-builder.js.map +1 -1
  50. package/dist/{helpers → builders}/within.d.ts +2 -2
  51. package/dist/builders/within.d.ts.map +1 -0
  52. package/dist/{helpers → builders}/within.js +1 -1
  53. package/dist/builders/within.js.map +1 -0
  54. package/dist/cli/commands/baseline.d.ts +8 -3
  55. package/dist/cli/commands/baseline.d.ts.map +1 -1
  56. package/dist/cli/commands/baseline.js +111 -7
  57. package/dist/cli/commands/baseline.js.map +1 -1
  58. package/dist/cli/commands/check.d.ts +7 -2
  59. package/dist/cli/commands/check.d.ts.map +1 -1
  60. package/dist/cli/commands/check.js +385 -47
  61. package/dist/cli/commands/check.js.map +1 -1
  62. package/dist/cli/commands/doctor.d.ts +29 -0
  63. package/dist/cli/commands/doctor.d.ts.map +1 -0
  64. package/dist/cli/commands/doctor.js +224 -0
  65. package/dist/cli/commands/doctor.js.map +1 -0
  66. package/dist/cli/commands/explain.d.ts +2 -1
  67. package/dist/cli/commands/explain.d.ts.map +1 -1
  68. package/dist/cli/commands/explain.js +19 -10
  69. package/dist/cli/commands/explain.js.map +1 -1
  70. package/dist/cli/commands/init.d.ts +9 -3
  71. package/dist/cli/commands/init.d.ts.map +1 -1
  72. package/dist/cli/commands/init.js +162 -137
  73. package/dist/cli/commands/init.js.map +1 -1
  74. package/dist/cli/import-rule-module.d.ts +29 -0
  75. package/dist/cli/import-rule-module.d.ts.map +1 -0
  76. package/dist/cli/import-rule-module.js +47 -0
  77. package/dist/cli/import-rule-module.js.map +1 -0
  78. package/dist/cli/index.d.ts +2 -2
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +101 -43
  81. package/dist/cli/index.js.map +1 -1
  82. package/dist/cli/load-rules.d.ts +6 -11
  83. package/dist/cli/load-rules.d.ts.map +1 -1
  84. package/dist/cli/load-rules.js +25 -32
  85. package/dist/cli/load-rules.js.map +1 -1
  86. package/dist/cli/resolve-config.d.ts +0 -8
  87. package/dist/cli/resolve-config.d.ts.map +1 -1
  88. package/dist/cli/resolve-config.js +25 -55
  89. package/dist/cli/resolve-config.js.map +1 -1
  90. package/dist/cli/rule-file-findings.d.ts +178 -0
  91. package/dist/cli/rule-file-findings.d.ts.map +1 -0
  92. package/dist/cli/rule-file-findings.js +351 -0
  93. package/dist/cli/rule-file-findings.js.map +1 -0
  94. package/dist/cli/watch.d.ts +17 -34
  95. package/dist/cli/watch.d.ts.map +1 -1
  96. package/dist/cli/watch.js +14 -129
  97. package/dist/cli/watch.js.map +1 -1
  98. package/dist/conditions/body-analysis-function.d.ts.map +1 -1
  99. package/dist/conditions/body-analysis-function.js +16 -7
  100. package/dist/conditions/body-analysis-function.js.map +1 -1
  101. package/dist/conditions/body-analysis-module.d.ts.map +1 -1
  102. package/dist/conditions/body-analysis-module.js +14 -9
  103. package/dist/conditions/body-analysis-module.js.map +1 -1
  104. package/dist/conditions/body-analysis.d.ts.map +1 -1
  105. package/dist/conditions/body-analysis.js +16 -7
  106. package/dist/conditions/body-analysis.js.map +1 -1
  107. package/dist/conditions/call.d.ts.map +1 -1
  108. package/dist/conditions/call.js +41 -19
  109. package/dist/conditions/call.js.map +1 -1
  110. package/dist/conditions/catch-analysis.d.ts +2 -1
  111. package/dist/conditions/catch-analysis.d.ts.map +1 -1
  112. package/dist/conditions/catch-analysis.js.map +1 -1
  113. package/dist/conditions/cross-layer.d.ts +2 -10
  114. package/dist/conditions/cross-layer.d.ts.map +1 -1
  115. package/dist/conditions/cross-layer.js +227 -23
  116. package/dist/conditions/cross-layer.js.map +1 -1
  117. package/dist/conditions/dependency.d.ts +35 -6
  118. package/dist/conditions/dependency.d.ts.map +1 -1
  119. package/dist/conditions/dependency.js +299 -45
  120. package/dist/conditions/dependency.js.map +1 -1
  121. package/dist/conditions/exports.d.ts.map +1 -1
  122. package/dist/conditions/exports.js +41 -37
  123. package/dist/conditions/exports.js.map +1 -1
  124. package/dist/conditions/function.d.ts.map +1 -1
  125. package/dist/conditions/function.js +19 -5
  126. package/dist/conditions/function.js.map +1 -1
  127. package/dist/conditions/helpers.d.ts +2 -1
  128. package/dist/conditions/helpers.d.ts.map +1 -1
  129. package/dist/conditions/helpers.js +4 -1
  130. package/dist/conditions/helpers.js.map +1 -1
  131. package/dist/conditions/jsx.d.ts.map +1 -1
  132. package/dist/conditions/jsx.js +7 -2
  133. package/dist/conditions/jsx.js.map +1 -1
  134. package/dist/conditions/match-identity.d.ts +43 -0
  135. package/dist/conditions/match-identity.d.ts.map +1 -0
  136. package/dist/conditions/match-identity.js +43 -0
  137. package/dist/conditions/match-identity.js.map +1 -0
  138. package/dist/conditions/members.d.ts.map +1 -1
  139. package/dist/conditions/members.js +20 -6
  140. package/dist/conditions/members.js.map +1 -1
  141. package/dist/conditions/reverse-dependency.d.ts +18 -5
  142. package/dist/conditions/reverse-dependency.d.ts.map +1 -1
  143. package/dist/conditions/reverse-dependency.js +155 -93
  144. package/dist/conditions/reverse-dependency.js.map +1 -1
  145. package/dist/conditions/slice.d.ts +86 -2
  146. package/dist/conditions/slice.d.ts.map +1 -1
  147. package/dist/conditions/slice.js +234 -53
  148. package/dist/conditions/slice.js.map +1 -1
  149. package/dist/conditions/structural.d.ts.map +1 -1
  150. package/dist/conditions/structural.js +16 -4
  151. package/dist/conditions/structural.js.map +1 -1
  152. package/dist/core/check-all.d.ts +19 -0
  153. package/dist/core/check-all.d.ts.map +1 -0
  154. package/dist/core/check-all.js +150 -0
  155. package/dist/core/check-all.js.map +1 -0
  156. package/dist/core/combinators.d.ts +48 -0
  157. package/dist/core/combinators.d.ts.map +1 -0
  158. package/dist/core/combinators.js +49 -0
  159. package/dist/core/combinators.js.map +1 -0
  160. package/dist/core/descendant-cache.d.ts +36 -0
  161. package/dist/core/descendant-cache.d.ts.map +1 -0
  162. package/dist/core/descendant-cache.js +117 -0
  163. package/dist/core/descendant-cache.js.map +1 -0
  164. package/dist/core/diagnose.d.ts +234 -0
  165. package/dist/core/diagnose.d.ts.map +1 -0
  166. package/dist/core/diagnose.js +390 -0
  167. package/dist/core/diagnose.js.map +1 -0
  168. package/dist/core/disk-set.d.ts +48 -0
  169. package/dist/core/disk-set.d.ts.map +1 -0
  170. package/dist/core/disk-set.js +218 -0
  171. package/dist/core/disk-set.js.map +1 -0
  172. package/dist/core/element-cache.d.ts +75 -0
  173. package/dist/core/element-cache.d.ts.map +1 -0
  174. package/dist/core/element-cache.js +32 -0
  175. package/dist/core/element-cache.js.map +1 -0
  176. package/dist/core/empty-project-advice.d.ts +75 -0
  177. package/dist/core/empty-project-advice.d.ts.map +1 -0
  178. package/dist/core/empty-project-advice.js +61 -0
  179. package/dist/core/empty-project-advice.js.map +1 -0
  180. package/dist/core/exclusion-comments.d.ts +19 -0
  181. package/dist/core/exclusion-comments.d.ts.map +1 -0
  182. package/dist/core/exclusion-comments.js +7 -0
  183. package/dist/core/exclusion-comments.js.map +1 -0
  184. package/dist/core/execute-rule.d.ts +158 -0
  185. package/dist/core/execute-rule.d.ts.map +1 -0
  186. package/dist/core/execute-rule.js +666 -0
  187. package/dist/core/execute-rule.js.map +1 -0
  188. package/dist/core/glob-diagnosis.d.ts +78 -0
  189. package/dist/core/glob-diagnosis.d.ts.map +1 -0
  190. package/dist/core/glob-diagnosis.js +134 -0
  191. package/dist/core/glob-diagnosis.js.map +1 -0
  192. package/dist/core/glob-evaluator.d.ts +48 -0
  193. package/dist/core/glob-evaluator.d.ts.map +1 -0
  194. package/dist/core/glob-evaluator.js +89 -0
  195. package/dist/core/glob-evaluator.js.map +1 -0
  196. package/dist/core/import-candidates.d.ts +60 -0
  197. package/dist/core/import-candidates.d.ts.map +1 -0
  198. package/dist/core/import-candidates.js +93 -0
  199. package/dist/core/import-candidates.js.map +1 -0
  200. package/dist/core/import-options.d.ts +55 -2
  201. package/dist/core/import-options.d.ts.map +1 -1
  202. package/dist/core/import-options.js +64 -0
  203. package/dist/core/import-options.js.map +1 -1
  204. package/dist/core/invalidate-on-modify.d.ts +20 -0
  205. package/dist/core/invalidate-on-modify.d.ts.map +1 -0
  206. package/dist/core/invalidate-on-modify.js +26 -0
  207. package/dist/core/invalidate-on-modify.js.map +1 -0
  208. package/dist/core/line-index.d.ts +3 -0
  209. package/dist/core/line-index.d.ts.map +1 -0
  210. package/dist/core/line-index.js +227 -0
  211. package/dist/core/line-index.js.map +1 -0
  212. package/dist/core/metric-violation.d.ts +86 -0
  213. package/dist/core/metric-violation.d.ts.map +1 -0
  214. package/dist/core/metric-violation.js +132 -0
  215. package/dist/core/metric-violation.js.map +1 -0
  216. package/dist/core/module-edges.d.ts +361 -0
  217. package/dist/core/module-edges.d.ts.map +1 -0
  218. package/dist/core/module-edges.js +593 -0
  219. package/dist/core/module-edges.js.map +1 -0
  220. package/dist/core/object-literal-functions.d.ts +42 -0
  221. package/dist/core/object-literal-functions.d.ts.map +1 -0
  222. package/dist/core/object-literal-functions.js +75 -0
  223. package/dist/core/object-literal-functions.js.map +1 -0
  224. package/dist/core/orphan-exclusions.d.ts +44 -0
  225. package/dist/core/orphan-exclusions.d.ts.map +1 -0
  226. package/dist/core/orphan-exclusions.js +224 -0
  227. package/dist/core/orphan-exclusions.js.map +1 -0
  228. package/dist/core/pair-condition.d.ts +32 -3
  229. package/dist/core/pair-condition.d.ts.map +1 -1
  230. package/dist/core/path-universe.d.ts +22 -0
  231. package/dist/core/path-universe.d.ts.map +1 -0
  232. package/dist/core/path-universe.js +45 -0
  233. package/dist/core/path-universe.js.map +1 -0
  234. package/dist/core/per-root-compiler-options.d.ts +20 -0
  235. package/dist/core/per-root-compiler-options.d.ts.map +1 -0
  236. package/dist/core/per-root-compiler-options.js +57 -0
  237. package/dist/core/per-root-compiler-options.js.map +1 -0
  238. package/dist/core/project-relative.d.ts +98 -0
  239. package/dist/core/project-relative.d.ts.map +1 -0
  240. package/dist/core/project-relative.js +185 -0
  241. package/dist/core/project-relative.js.map +1 -0
  242. package/dist/core/project.d.ts +7 -1
  243. package/dist/core/project.d.ts.map +1 -1
  244. package/dist/core/project.js +29 -4
  245. package/dist/core/project.js.map +1 -1
  246. package/dist/core/rule-builder.d.ts +303 -0
  247. package/dist/core/rule-builder.d.ts.map +1 -0
  248. package/dist/core/rule-builder.js +463 -0
  249. package/dist/core/rule-builder.js.map +1 -0
  250. package/dist/core/rule-declaration.d.ts +32 -0
  251. package/dist/core/rule-declaration.d.ts.map +1 -0
  252. package/dist/core/rule-declaration.js +88 -0
  253. package/dist/core/rule-declaration.js.map +1 -0
  254. package/dist/core/terminal-builder.d.ts +629 -0
  255. package/dist/core/terminal-builder.d.ts.map +1 -0
  256. package/dist/core/terminal-builder.js +807 -0
  257. package/dist/core/terminal-builder.js.map +1 -0
  258. package/dist/core/terminal-execution.d.ts +39 -0
  259. package/dist/core/terminal-execution.d.ts.map +1 -0
  260. package/dist/core/terminal-execution.js +103 -0
  261. package/dist/core/terminal-execution.js.map +1 -0
  262. package/dist/core/ts-comment-mask.d.ts +2 -0
  263. package/dist/core/ts-comment-mask.d.ts.map +1 -0
  264. package/dist/core/ts-comment-mask.js +102 -0
  265. package/dist/core/ts-comment-mask.js.map +1 -0
  266. package/dist/core/vacuity-diagnosis.d.ts +103 -0
  267. package/dist/core/vacuity-diagnosis.d.ts.map +1 -0
  268. package/dist/core/vacuity-diagnosis.js +415 -0
  269. package/dist/core/vacuity-diagnosis.js.map +1 -0
  270. package/dist/core/violation.d.ts +16 -11
  271. package/dist/core/violation.d.ts.map +1 -1
  272. package/dist/core/violation.js +33 -13
  273. package/dist/core/violation.js.map +1 -1
  274. package/dist/graphql/graphql-rule-builder.d.ts +95 -0
  275. package/dist/graphql/graphql-rule-builder.d.ts.map +1 -0
  276. package/dist/graphql/graphql-rule-builder.js +127 -0
  277. package/dist/graphql/graphql-rule-builder.js.map +1 -0
  278. package/dist/graphql/index.d.ts +1 -0
  279. package/dist/graphql/index.d.ts.map +1 -1
  280. package/dist/graphql/index.js +2 -1
  281. package/dist/graphql/index.js.map +1 -1
  282. package/dist/graphql/resolver-rule-builder.d.ts +44 -23
  283. package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
  284. package/dist/graphql/resolver-rule-builder.js +80 -72
  285. package/dist/graphql/resolver-rule-builder.js.map +1 -1
  286. package/dist/graphql/schema-loader.d.ts +21 -0
  287. package/dist/graphql/schema-loader.d.ts.map +1 -1
  288. package/dist/graphql/schema-loader.js +82 -12
  289. package/dist/graphql/schema-loader.js.map +1 -1
  290. package/dist/graphql/schema-predicates.d.ts.map +1 -1
  291. package/dist/graphql/schema-predicates.js +17 -12
  292. package/dist/graphql/schema-predicates.js.map +1 -1
  293. package/dist/graphql/schema-rule-builder.d.ts +15 -24
  294. package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
  295. package/dist/graphql/schema-rule-builder.js +39 -77
  296. package/dist/graphql/schema-rule-builder.js.map +1 -1
  297. package/dist/helpers/baseline-diagnostics.d.ts +45 -0
  298. package/dist/helpers/baseline-diagnostics.d.ts.map +1 -0
  299. package/dist/helpers/baseline-diagnostics.js +168 -0
  300. package/dist/helpers/baseline-diagnostics.js.map +1 -0
  301. package/dist/helpers/baseline-generator.d.ts +28 -0
  302. package/dist/helpers/baseline-generator.d.ts.map +1 -0
  303. package/dist/helpers/baseline-generator.js +27 -0
  304. package/dist/helpers/baseline-generator.js.map +1 -0
  305. package/dist/helpers/baseline.d.ts +336 -0
  306. package/dist/helpers/baseline.d.ts.map +1 -0
  307. package/dist/helpers/baseline.js +664 -0
  308. package/dist/helpers/baseline.js.map +1 -0
  309. package/dist/helpers/body-traversal.d.ts +27 -2
  310. package/dist/helpers/body-traversal.d.ts.map +1 -1
  311. package/dist/helpers/body-traversal.js +135 -16
  312. package/dist/helpers/body-traversal.js.map +1 -1
  313. package/dist/helpers/callback-extractor.d.ts.map +1 -1
  314. package/dist/helpers/callback-extractor.js +53 -84
  315. package/dist/helpers/callback-extractor.js.map +1 -1
  316. package/dist/helpers/complexity.d.ts +13 -5
  317. package/dist/helpers/complexity.d.ts.map +1 -1
  318. package/dist/helpers/complexity.js +15 -6
  319. package/dist/helpers/complexity.js.map +1 -1
  320. package/dist/helpers/diff-aware.d.ts +16 -0
  321. package/dist/helpers/diff-aware.d.ts.map +1 -0
  322. package/dist/helpers/diff-aware.js +16 -0
  323. package/dist/helpers/diff-aware.js.map +1 -0
  324. package/dist/helpers/matchers.d.ts +68 -7
  325. package/dist/helpers/matchers.d.ts.map +1 -1
  326. package/dist/helpers/matchers.js +164 -86
  327. package/dist/helpers/matchers.js.map +1 -1
  328. package/dist/helpers/slice-graph.d.ts +100 -8
  329. package/dist/helpers/slice-graph.d.ts.map +1 -1
  330. package/dist/helpers/slice-graph.js +126 -34
  331. package/dist/helpers/slice-graph.js.map +1 -1
  332. package/dist/helpers/tarjan.d.ts +0 -14
  333. package/dist/helpers/tarjan.d.ts.map +1 -1
  334. package/dist/helpers/tarjan.js +29 -16
  335. package/dist/helpers/tarjan.js.map +1 -1
  336. package/dist/index.d.ts +55 -19
  337. package/dist/index.d.ts.map +1 -1
  338. package/dist/index.js +67 -15
  339. package/dist/index.js.map +1 -1
  340. package/dist/models/arch-call.d.ts +3 -2
  341. package/dist/models/arch-call.d.ts.map +1 -1
  342. package/dist/models/arch-call.js.map +1 -1
  343. package/dist/models/arch-function.d.ts +54 -8
  344. package/dist/models/arch-function.d.ts.map +1 -1
  345. package/dist/models/arch-function.js +145 -8
  346. package/dist/models/arch-function.js.map +1 -1
  347. package/dist/models/arch-jsx-element.d.ts.map +1 -1
  348. package/dist/models/arch-jsx-element.js +18 -19
  349. package/dist/models/arch-jsx-element.js.map +1 -1
  350. package/dist/models/slice.d.ts +33 -9
  351. package/dist/models/slice.d.ts.map +1 -1
  352. package/dist/models/slice.js +129 -19
  353. package/dist/models/slice.js.map +1 -1
  354. package/dist/predicates/call.d.ts.map +1 -1
  355. package/dist/predicates/call.js +5 -0
  356. package/dist/predicates/call.js.map +1 -1
  357. package/dist/predicates/identity.d.ts +21 -0
  358. package/dist/predicates/identity.d.ts.map +1 -1
  359. package/dist/predicates/identity.js +75 -3
  360. package/dist/predicates/identity.js.map +1 -1
  361. package/dist/predicates/index.d.ts +1 -1
  362. package/dist/predicates/index.d.ts.map +1 -1
  363. package/dist/predicates/index.js +1 -1
  364. package/dist/predicates/index.js.map +1 -1
  365. package/dist/predicates/jsx.d.ts.map +1 -1
  366. package/dist/predicates/jsx.js +2 -1
  367. package/dist/predicates/jsx.js.map +1 -1
  368. package/dist/predicates/metrics.d.ts +4 -2
  369. package/dist/predicates/metrics.d.ts.map +1 -1
  370. package/dist/predicates/metrics.js +4 -2
  371. package/dist/predicates/metrics.js.map +1 -1
  372. package/dist/predicates/module.d.ts +4 -12
  373. package/dist/predicates/module.d.ts.map +1 -1
  374. package/dist/predicates/module.js +57 -37
  375. package/dist/predicates/module.js.map +1 -1
  376. package/dist/presets/agent-guardrails.d.ts +49 -16
  377. package/dist/presets/agent-guardrails.d.ts.map +1 -1
  378. package/dist/presets/agent-guardrails.js +308 -19
  379. package/dist/presets/agent-guardrails.js.map +1 -1
  380. package/dist/presets/boundaries.d.ts +46 -3
  381. package/dist/presets/boundaries.d.ts.map +1 -1
  382. package/dist/presets/boundaries.js +132 -23
  383. package/dist/presets/boundaries.js.map +1 -1
  384. package/dist/presets/data-layer.d.ts +23 -3
  385. package/dist/presets/data-layer.d.ts.map +1 -1
  386. package/dist/presets/data-layer.js +58 -16
  387. package/dist/presets/data-layer.js.map +1 -1
  388. package/dist/presets/index.d.ts +10 -5
  389. package/dist/presets/index.d.ts.map +1 -1
  390. package/dist/presets/index.js +19 -3
  391. package/dist/presets/index.js.map +1 -1
  392. package/dist/presets/layered.d.ts +47 -3
  393. package/dist/presets/layered.d.ts.map +1 -1
  394. package/dist/presets/layered.js +66 -29
  395. package/dist/presets/layered.js.map +1 -1
  396. package/dist/presets/recommended.d.ts +81 -10
  397. package/dist/presets/recommended.d.ts.map +1 -1
  398. package/dist/presets/recommended.js +25 -23
  399. package/dist/presets/recommended.js.map +1 -1
  400. package/dist/presets/shared.d.ts +267 -2
  401. package/dist/presets/shared.d.ts.map +1 -1
  402. package/dist/presets/shared.js +367 -4
  403. package/dist/presets/shared.js.map +1 -1
  404. package/dist/rules/code-quality.d.ts.map +1 -1
  405. package/dist/rules/code-quality.js +15 -6
  406. package/dist/rules/code-quality.js.map +1 -1
  407. package/dist/rules/hygiene.d.ts +1 -1
  408. package/dist/rules/hygiene.js +1 -1
  409. package/dist/rules/metrics-function.d.ts +2 -1
  410. package/dist/rules/metrics-function.d.ts.map +1 -1
  411. package/dist/rules/metrics-function.js +63 -39
  412. package/dist/rules/metrics-function.js.map +1 -1
  413. package/dist/rules/metrics.d.ts +2 -1
  414. package/dist/rules/metrics.d.ts.map +1 -1
  415. package/dist/rules/metrics.js +80 -47
  416. package/dist/rules/metrics.js.map +1 -1
  417. package/dist/smells/clusters.d.ts +78 -0
  418. package/dist/smells/clusters.d.ts.map +1 -0
  419. package/dist/smells/clusters.js +124 -0
  420. package/dist/smells/clusters.js.map +1 -0
  421. package/dist/smells/duplicate-bodies.d.ts +92 -5
  422. package/dist/smells/duplicate-bodies.d.ts.map +1 -1
  423. package/dist/smells/duplicate-bodies.js +203 -73
  424. package/dist/smells/duplicate-bodies.js.map +1 -1
  425. package/dist/smells/duplicate-report.d.ts +90 -0
  426. package/dist/smells/duplicate-report.d.ts.map +1 -0
  427. package/dist/smells/duplicate-report.js +344 -0
  428. package/dist/smells/duplicate-report.js.map +1 -0
  429. package/dist/smells/fingerprint.d.ts +20 -1
  430. package/dist/smells/fingerprint.d.ts.map +1 -1
  431. package/dist/smells/fingerprint.js +27 -3
  432. package/dist/smells/fingerprint.js.map +1 -1
  433. package/dist/smells/inconsistent-siblings.d.ts +128 -7
  434. package/dist/smells/inconsistent-siblings.d.ts.map +1 -1
  435. package/dist/smells/inconsistent-siblings.js +288 -86
  436. package/dist/smells/inconsistent-siblings.js.map +1 -1
  437. package/dist/smells/sibling-files.d.ts +47 -0
  438. package/dist/smells/sibling-files.d.ts.map +1 -0
  439. package/dist/smells/sibling-files.js +104 -0
  440. package/dist/smells/sibling-files.js.map +1 -0
  441. package/dist/smells/similar-pairs.d.ts +28 -0
  442. package/dist/smells/similar-pairs.d.ts.map +1 -0
  443. package/dist/smells/similar-pairs.js +134 -0
  444. package/dist/smells/similar-pairs.js.map +1 -0
  445. package/dist/smells/smell-builder.d.ts +57 -12
  446. package/dist/smells/smell-builder.d.ts.map +1 -1
  447. package/dist/smells/smell-builder.js +112 -14
  448. package/dist/smells/smell-builder.js.map +1 -1
  449. package/dist/smells/variation.d.ts +47 -0
  450. package/dist/smells/variation.d.ts.map +1 -0
  451. package/dist/smells/variation.js +90 -0
  452. package/dist/smells/variation.js.map +1 -0
  453. package/dist/tsconfig/index.d.ts +19 -0
  454. package/dist/tsconfig/index.d.ts.map +1 -0
  455. package/dist/tsconfig/index.js +20 -0
  456. package/dist/tsconfig/index.js.map +1 -0
  457. package/dist/tsconfig/tsconfig-builder.d.ts +42 -9
  458. package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
  459. package/dist/tsconfig/tsconfig-builder.js +65 -16
  460. package/dist/tsconfig/tsconfig-builder.js.map +1 -1
  461. package/package.json +4 -2
  462. package/dist/core/module-dependencies.d.ts +0 -28
  463. package/dist/core/module-dependencies.d.ts.map +0 -1
  464. package/dist/core/module-dependencies.js +0 -35
  465. package/dist/core/module-dependencies.js.map +0 -1
  466. package/dist/helpers/within.d.ts.map +0 -1
  467. package/dist/helpers/within.js.map +0 -1
@@ -0,0 +1,178 @@
1
+ import type { ArchViolation } from '@nielspeter/eess';
2
+ /**
3
+ * Attribute findings that have no source location of their own to the rule file
4
+ * they came from.
5
+ *
6
+ * [ts-archunit Bug 0026](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0026-a-location-less-finding-does-not-say-which-rule-file-it-came-from.md):
7
+ * a configuration finding carries `file: ''` because it reports a fault in the
8
+ * rule rather than in the code, so two identical vacuous rules in two rule files
9
+ * rendered as two identical paragraphs with nothing saying which to open. In a
10
+ * test the frame comes free from vitest; in the CLI — the golden-path default —
11
+ * nothing supplied it, even though this loop knows the file and was discarding it.
12
+ *
13
+ * `line: 1`, following `tsconfig()`'s precedent for a fault that belongs to a
14
+ * file rather than to a position in it (`docs/config-rules.md` documents that
15
+ * choice). The builders cannot know the line: a rule with no glob has no
16
+ * position anywhere, and the assertion-gate findings are exactly the rules that
17
+ * may have none. Not `line: 0` — `::error file=x,line=0` is not a valid GitHub
18
+ * annotation and gets dropped or misplaced.
19
+ *
20
+ * **Safe against a `eess-exclude` comment only because these findings carry
21
+ * `bypassFilters`.** `execute-rule.ts` filters comment exclusions with
22
+ * `v.bypassFilters === true || !isExcludedByComment(...)`, and that first clause
23
+ * is what stops a real path here from making the finding suppressible by a
24
+ * comment in the rule file. It was written for this exact temptation, and until
25
+ * this change nothing tested it, because no such finding had a readable path.
26
+ * `tests/helpers/exclusion-comments.test.ts` now pins it.
27
+ */
28
+ export declare function attributeToRuleFile(violations: readonly ArchViolation[], file: string): ArchViolation[];
29
+ /**
30
+ * A rule file, or one rule in it, that could not be evaluated at all.
31
+ *
32
+ * [ts-archunit Bug 0025](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0025-a-non-archruleerror-from-one-rule-file-drops-every-other-finding.md):
33
+ * `runCheck` and `runBaseline` caught `ArchRuleError` and rethrew everything
34
+ * else, so any other error escaped the per-file loop and terminated the process
35
+ * — no report written, no exit code returned, and every finding already
36
+ * collected discarded. Measured: one malformed `crossProject()` in one file
37
+ * silenced a second file's four real violations, and printed a raw Node stack
38
+ * trace with `node_modules` paths in their place.
39
+ *
40
+ * Reported as a **configuration finding** (`bypassFilters`): a rule that could
41
+ * not run enforced nothing, which is not a violation of the rule and is not
42
+ * something to accept into a baseline. Same reasoning as the assertion gate,
43
+ * and it inherits the same treatment — `error` severity whatever the rule
44
+ * asked for, refused by `.excluding()`, skipped by diff and baseline.
45
+ *
46
+ * `line: 1` with the rule file as `file`, following `tsconfig()`'s precedent for
47
+ * a fault that belongs to a file rather than to a position in it. Not `line: 0`:
48
+ * `::error file=x,line=0` is not a valid GitHub annotation and gets dropped or
49
+ * misplaced (the v0.22.0 defect), and only a `file` of `''` takes the run-level
50
+ * branch that avoids it.
51
+ */
52
+ export declare function ruleFileFailure(file: string, error: unknown, ruleFiles: number): ArchViolation;
53
+ /**
54
+ * What to collect when evaluating a rule file, or one rule in it, threw.
55
+ *
56
+ * An `ArchRuleError` already carries findings — those ARE the report, and this
57
+ * is the pre-existing path for a rule file that self-executes a failing
58
+ * `.check()` at import. Anything else becomes one configuration finding naming
59
+ * the file. Never a rethrow: that discarded every finding already collected in
60
+ * the run, including other files' (bug 0025).
61
+ *
62
+ * One definition, imported by both `runCheck` and `runBaseline`. They had a copy
63
+ * each for the ArchRuleError half and the two had already diverged in what they
64
+ * did with everything else.
65
+ */
66
+ export declare function failureOrViolations(file: string, error: unknown, ruleFiles: number): ArchViolation[];
67
+ /**
68
+ * A rule file stopped evaluating partway, so the rules after that point never ran.
69
+ *
70
+ * [ts-archunit Bug 0029](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0029-a-throwing-warn-truncates-the-rest-of-the-rule-file.md),
71
+ * and the half [ts-archunit plan 0069](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0069-no-rule-may-certify-nothing.md)'s R3a
72
+ * specified and did not build: *"R3a states the semantics, and the CLI **reports the
73
+ * truncation rather than absorbing it**."* The semantics shipped in v0.23.0; this is
74
+ * the reporting.
75
+ *
76
+ * In a **self-executing** rule file — the shape `init` scaffolds and `docs/cli.md`
77
+ * documents — every rule calls its own terminal at module scope. A throw there aborts
78
+ * the module, so every rule declared after it is never evaluated. The CLI then folds
79
+ * the thrown finding into the run and the output looks entirely ordinary. Measured on
80
+ * v0.28.0, the same two rules in each style:
81
+ *
82
+ * | rule file shape | findings reported |
83
+ * | -------------------------------- | ----------------- |
84
+ * | `export default [rule1, rule2]` | **5** — the configuration finding and all four violations |
85
+ * | self-executing | **1** — the four violations silently absent |
86
+ *
87
+ * Worse than a crash, because the run is **red for the other finding**: someone fixes
88
+ * that, moves on, and never learns the rest of the file was skipped — or takes the
89
+ * sanctioned remedy for a dead glob, which is to delete the rule, and still never
90
+ * learns it.
91
+ *
92
+ * **What this can and cannot say.** The module never finished, so the CLI cannot know
93
+ * *what* was lost — only that anything after the throw did not run. Naming a count or
94
+ * a rule would be invention. It says the file stopped and what to do, which is all it
95
+ * has.
96
+ *
97
+ * `bypassFilters` because it reports missing coverage: nothing to grade, exclude or
98
+ * accept into a baseline.
99
+ */
100
+ export declare function ruleFileTruncated(file: string, ruleFiles: number): ArchViolation;
101
+ /**
102
+ * `--baseline` was passed, but the rule file printed findings the baseline never
103
+ * filtered. Bug 0199.
104
+ *
105
+ * **The mechanism, corrected TWICE. This is the third version and the measured one.**
106
+ *
107
+ * 1. *"The preset throws before baseline filtering runs."* False. `runCheck` collects
108
+ * a thrown terminal's violations off the error (`failureOrViolations`) and filters
109
+ * them; measured, its collection came back empty against a matching baseline.
110
+ * 2. *"`setCallerAggregatesReports` is module state that does not cross jiti's
111
+ * registry."* Also false, and it was the premise of a whole record. The flag is
112
+ * read at exactly ONE site — `core/execute-rule.ts`, inside `executeWarn`.
113
+ * And jiti is not even the default loader: `cli/import-rule-module.ts` imports
114
+ * natively first and reaches jiti only on a module-format refusal.
115
+ * (Line numbers deliberately omitted: the fix for (3) moved every one of them,
116
+ * and the first version of this docblock cited three that had already drifted.)
117
+ *
118
+ * 3. **What is actually true:** `executeCheck` calls `writeReport(...)`
119
+ * **unconditionally** at `core/execute-rule.ts`, one line before it throws.
120
+ * A `.check()` at module scope therefore prints its findings always — same
121
+ * registry, no jiti, no flag involved. The CLI cannot un-print them.
122
+ *
123
+ * The disproof of (2) is one line: a fixture importing the same module graph as the
124
+ * test's `runCheck`, so the flag was fully visible, printed all four violations
125
+ * anyway.
126
+ *
127
+ * **Why a notice and not the repair.** Making `executeCheck` honour the flag is a
128
+ * change to when a terminal emits — ADR-008 territory, and it would alter behaviour
129
+ * for every caller that relies on `.check()` printing, including test files. That is
130
+ * bug 0201. Until it is decided the run must not be silent about output it could not
131
+ * filter.
132
+ *
133
+ * **Fires only when something was actually printed.** `executeWarn` throws the same
134
+ * error type, and when the CLI aggregates it writes only non-`bypassFilters` entries
135
+ * — for a configuration finding, nothing at all. The first version fired on the bare
136
+ * `isArchRuleError` condition and so claimed a leak that never happened, pointing at
137
+ * a finding whose own text says a baseline can never suppress it. Asserting a cause
138
+ * the run cannot verify is the ADR-009 rule 2 defect `ruleFileFailure` names above.
139
+ *
140
+ * **What this can and cannot say.** The leaked lines were written before the CLI saw
141
+ * them, so it cannot know how many there were. Naming a count would be invention.
142
+ *
143
+ * `bypassFilters` because it reports a gap in filtering — accepting it into a
144
+ * baseline would suppress the notice that the baseline is not being applied.
145
+ */
146
+ export declare function baselineNotApplied(file: string, filters: {
147
+ baseline?: string;
148
+ changed: boolean;
149
+ }): ArchViolation;
150
+ /**
151
+ * A rule file loaded cleanly and contributed **zero** rules.
152
+ *
153
+ * `check` used to print `✓ eess-ts — 0 rules across 1 file · 0 failing` and exit 0
154
+ * over exactly this, while `doctor` on the same file already refused it with "no
155
+ * rules found in the given files". Two commands in one CLI disagreeing about
156
+ * whether "no rules" is an error, and the one wired into CI was the one blessing
157
+ * it.
158
+ *
159
+ * **The shape that makes it urgent** is a migration from `@nielspeter/ts-archunit`,
160
+ * whose `recommended()` returned builders unconditionally and had no `report`
161
+ * option. eess-ts's runs and throws by default, so the line ts-archunit's own
162
+ * `init` scaffolded — `export default [...recommended(p)]` — spreads a *violations*
163
+ * array. On a codebase with findings that fails loudly (the loader rejects a
164
+ * non-builder entry). **On a clean codebase the array is empty**, so the file
165
+ * exports `[]`, the CLI loads nothing, and the run is green with every rule gone.
166
+ * `tsc --noEmit` passes; nothing reaches stderr.
167
+ *
168
+ * The adopter this hits is the one who did the baseline work and cleaned up.
169
+ *
170
+ * `CLAUDE.md` already tells agents that a zero denominator "means the gate matched
171
+ * little or nothing — treat that as a red flag". This makes the CLI agree with its
172
+ * own instruction instead of printing `✓` over its alarm value.
173
+ *
174
+ * `bypassFilters` because it reports absent coverage: there is nothing to grade,
175
+ * exclude, or accept into a baseline.
176
+ */
177
+ export declare function ruleFileContributedNoRules(file: string): ArchViolation;
178
+ //# sourceMappingURL=rule-file-findings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-file-findings.d.ts","sourceRoot":"","sources":["../../src/cli/rule-file-findings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,IAAI,EAAE,MAAM,GACX,aAAa,EAAE,CAEjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CA0B9F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,aAAa,EAAE,CASjB;AA2DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAqBhF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC/C,aAAa,CAkDf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAsBtE"}
@@ -0,0 +1,351 @@
1
+ import { isArchRuleError, isArchConfigError } from '@nielspeter/eess';
2
+ import { basename } from 'node:path';
3
+ /**
4
+ * Attribute findings that have no source location of their own to the rule file
5
+ * they came from.
6
+ *
7
+ * [ts-archunit Bug 0026](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0026-a-location-less-finding-does-not-say-which-rule-file-it-came-from.md):
8
+ * a configuration finding carries `file: ''` because it reports a fault in the
9
+ * rule rather than in the code, so two identical vacuous rules in two rule files
10
+ * rendered as two identical paragraphs with nothing saying which to open. In a
11
+ * test the frame comes free from vitest; in the CLI — the golden-path default —
12
+ * nothing supplied it, even though this loop knows the file and was discarding it.
13
+ *
14
+ * `line: 1`, following `tsconfig()`'s precedent for a fault that belongs to a
15
+ * file rather than to a position in it (`docs/config-rules.md` documents that
16
+ * choice). The builders cannot know the line: a rule with no glob has no
17
+ * position anywhere, and the assertion-gate findings are exactly the rules that
18
+ * may have none. Not `line: 0` — `::error file=x,line=0` is not a valid GitHub
19
+ * annotation and gets dropped or misplaced.
20
+ *
21
+ * **Safe against a `eess-exclude` comment only because these findings carry
22
+ * `bypassFilters`.** `execute-rule.ts` filters comment exclusions with
23
+ * `v.bypassFilters === true || !isExcludedByComment(...)`, and that first clause
24
+ * is what stops a real path here from making the finding suppressible by a
25
+ * comment in the rule file. It was written for this exact temptation, and until
26
+ * this change nothing tested it, because no such finding had a readable path.
27
+ * `tests/helpers/exclusion-comments.test.ts` now pins it.
28
+ */
29
+ export function attributeToRuleFile(violations, file) {
30
+ return violations.map((v) => (v.file === '' ? { ...v, file, line: 1 } : v));
31
+ }
32
+ /**
33
+ * A rule file, or one rule in it, that could not be evaluated at all.
34
+ *
35
+ * [ts-archunit Bug 0025](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0025-a-non-archruleerror-from-one-rule-file-drops-every-other-finding.md):
36
+ * `runCheck` and `runBaseline` caught `ArchRuleError` and rethrew everything
37
+ * else, so any other error escaped the per-file loop and terminated the process
38
+ * — no report written, no exit code returned, and every finding already
39
+ * collected discarded. Measured: one malformed `crossProject()` in one file
40
+ * silenced a second file's four real violations, and printed a raw Node stack
41
+ * trace with `node_modules` paths in their place.
42
+ *
43
+ * Reported as a **configuration finding** (`bypassFilters`): a rule that could
44
+ * not run enforced nothing, which is not a violation of the rule and is not
45
+ * something to accept into a baseline. Same reasoning as the assertion gate,
46
+ * and it inherits the same treatment — `error` severity whatever the rule
47
+ * asked for, refused by `.excluding()`, skipped by diff and baseline.
48
+ *
49
+ * `line: 1` with the rule file as `file`, following `tsconfig()`'s precedent for
50
+ * a fault that belongs to a file rather than to a position in it. Not `line: 0`:
51
+ * `::error file=x,line=0` is not a valid GitHub annotation and gets dropped or
52
+ * misplaced (the v0.22.0 defect), and only a `file` of `''` takes the run-level
53
+ * branch that avoids it.
54
+ */
55
+ // eess-exclude eess/no-unused-exports: consumed by the test suite; the build tsconfig this gate reads excludes tests, so `src` is the only usage it can see
56
+ export function ruleFileFailure(file, error, ruleFiles) {
57
+ const raw = error instanceof Error ? error.message : String(error);
58
+ // An error message may or may not end in punctuation, and the sentence after
59
+ // it ran straight on: "…(reading 'config') The other rule files…". Measured on
60
+ // the real CLI, which is the only place the two strings meet.
61
+ const detail = /[.!?]$/.test(raw.trimEnd()) ? raw.trimEnd() : `${raw.trimEnd()}.`;
62
+ const others = ruleFiles > 1 ? ' The other rule files in this run were still checked.' : '';
63
+ return {
64
+ // The path goes in `file` and nowhere else it would be re-rendered. It used
65
+ // to appear four times in one finding — in `rule`, in `element`, in the
66
+ // location line, and in the remedy — and the location line renders it
67
+ // through `path.relative(cwd, …)`, so a rule file outside the cwd printed as
68
+ // `../../../../../../private/tmp/…`. Measured on the real CLI.
69
+ rule: 'eess-ts: rule file',
70
+ element: basename(file),
71
+ file,
72
+ line: 1,
73
+ message: `This rule file could not be evaluated, so its rules enforced nothing in this run: ${detail}${others}`,
74
+ // Conditional, never asserted — this fires for any error a rule file or a
75
+ // builder can raise (a syntax error, a missing dependency, a misconfigured
76
+ // builder), and naming one cause for all of them is the ADR-009 rule 2
77
+ // defect. The error message above is the evidence; the builder sentence is
78
+ // offered as the common case that is fixable without touching source code.
79
+ suggestion: `Fix the error named above in this rule file. If it names a builder method — for example a crossProject() with the wrong number of .side(...) calls — the rule is misconfigured rather than violated, so the fix is in the rule file and not in the code it checks.`,
80
+ bypassFilters: true,
81
+ };
82
+ }
83
+ /**
84
+ * What to collect when evaluating a rule file, or one rule in it, threw.
85
+ *
86
+ * An `ArchRuleError` already carries findings — those ARE the report, and this
87
+ * is the pre-existing path for a rule file that self-executes a failing
88
+ * `.check()` at import. Anything else becomes one configuration finding naming
89
+ * the file. Never a rethrow: that discarded every finding already collected in
90
+ * the run, including other files' (bug 0025).
91
+ *
92
+ * One definition, imported by both `runCheck` and `runBaseline`. They had a copy
93
+ * each for the ArchRuleError half and the two had already diverged in what they
94
+ * did with everything else.
95
+ */
96
+ export function failureOrViolations(file, error, ruleFiles) {
97
+ if (isArchRuleError(error))
98
+ return error.violations;
99
+ // Bug 0241. `ArchConfigError` knows WHAT was misconfigured, so it is the one
100
+ // error here that can carry a specific remedy without guessing — which is the
101
+ // whole reason the type exists, and it shipped with 17 throw sites and nothing
102
+ // reading it. Ordered after the rule-error branch, never before: a rule file
103
+ // that self-executes a failing check reports its own findings.
104
+ if (isArchConfigError(error))
105
+ return [ruleFileMisconfigured(file, error, ruleFiles)];
106
+ return [ruleFileFailure(file, error, ruleFiles)];
107
+ }
108
+ /**
109
+ * A rule file misconfigured something eess offers, and eess knows which thing.
110
+ *
111
+ * The sibling `ruleFileFailure` is deliberately vague because it answers for any
112
+ * error a rule file can raise, and naming one cause for all of them is ADR-009
113
+ * rule 2's defect. This one is the opposite case and gets the opposite
114
+ * treatment: the thrower named its subject — `havePropertyNamed`,
115
+ * `requireGraphQL`, `workspace` — so the remedy can point at the call instead of
116
+ * hedging about what the message might mean.
117
+ *
118
+ * The distinction is for the reader this project actually ships to. "Your rule
119
+ * file is wrong, fix the argument" and "eess crashed" ask an agent for opposite
120
+ * next actions, and before this they rendered identically.
121
+ *
122
+ * NOT exported, unlike its sibling `ruleFileFailure`. Nothing outside this
123
+ * module calls it — `failureOrViolations` is the seam, and the tests drive it
124
+ * through that. Exporting it anyway would have added a fourth instance of the
125
+ * exact shape bug 0241 is about, in the fix for bug 0241; `check:arch`'s
126
+ * no-unused-exports rule said so before this comment existed.
127
+ */
128
+ function ruleFileMisconfigured(file, error, ruleFiles) {
129
+ const others = ruleFiles > 1 ? ' The other rule files in this run were still checked.' : '';
130
+ // The cause, when it adds something. `schema-loader.ts` throws the same
131
+ // subject for "the graphql package is not installed" and "it is installed but
132
+ // failed to load", and only the cause separates them — its own fix records
133
+ // that discarding it "used to be reported as 'not installed' too, discarding
134
+ // the one line that would have told the reader what actually happened".
135
+ // Nothing rendered `cause` before this, so that line was reaching nobody.
136
+ const cause = error.cause instanceof Error ? error.cause.message : undefined;
137
+ const detail = cause !== undefined && !error.message.includes(cause)
138
+ ? `${error.message} (${cause})`
139
+ : error.message;
140
+ return {
141
+ // The subject, not the file's basename: the thing to open is the CALL. The
142
+ // file is already in `file`, and the generic path uses the basename there.
143
+ rule: 'eess-ts: rule file',
144
+ element: error.subject,
145
+ file,
146
+ line: 1,
147
+ message: `${error.subject} is misconfigured in this rule file, so its rules enforced nothing in ` +
148
+ `this run: ${detail}${others}`,
149
+ // Specific, because this error earned it. `ruleFileFailure`'s remedy has to
150
+ // hedge ("if it names a builder method…"); this one does not, and asserting
151
+ // that it does not is how the two stay distinguishable.
152
+ suggestion: `Fix the call to ${error.subject} in this rule file. This is a fault in how the rule was ` +
153
+ `configured, not a finding about the code under test — editing the code cannot clear it.`,
154
+ bypassFilters: true,
155
+ };
156
+ }
157
+ /**
158
+ * A rule file stopped evaluating partway, so the rules after that point never ran.
159
+ *
160
+ * [ts-archunit Bug 0029](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0029-a-throwing-warn-truncates-the-rest-of-the-rule-file.md),
161
+ * and the half [ts-archunit plan 0069](https://github.com/nielspeter/ts-archunit/blob/main/plans/completed/0069-no-rule-may-certify-nothing.md)'s R3a
162
+ * specified and did not build: *"R3a states the semantics, and the CLI **reports the
163
+ * truncation rather than absorbing it**."* The semantics shipped in v0.23.0; this is
164
+ * the reporting.
165
+ *
166
+ * In a **self-executing** rule file — the shape `init` scaffolds and `docs/cli.md`
167
+ * documents — every rule calls its own terminal at module scope. A throw there aborts
168
+ * the module, so every rule declared after it is never evaluated. The CLI then folds
169
+ * the thrown finding into the run and the output looks entirely ordinary. Measured on
170
+ * v0.28.0, the same two rules in each style:
171
+ *
172
+ * | rule file shape | findings reported |
173
+ * | -------------------------------- | ----------------- |
174
+ * | `export default [rule1, rule2]` | **5** — the configuration finding and all four violations |
175
+ * | self-executing | **1** — the four violations silently absent |
176
+ *
177
+ * Worse than a crash, because the run is **red for the other finding**: someone fixes
178
+ * that, moves on, and never learns the rest of the file was skipped — or takes the
179
+ * sanctioned remedy for a dead glob, which is to delete the rule, and still never
180
+ * learns it.
181
+ *
182
+ * **What this can and cannot say.** The module never finished, so the CLI cannot know
183
+ * *what* was lost — only that anything after the throw did not run. Naming a count or
184
+ * a rule would be invention. It says the file stopped and what to do, which is all it
185
+ * has.
186
+ *
187
+ * `bypassFilters` because it reports missing coverage: nothing to grade, exclude or
188
+ * accept into a baseline.
189
+ */
190
+ export function ruleFileTruncated(file, ruleFiles) {
191
+ const others = ruleFiles > 1 ? ' The other rule files in this run were still checked.' : '';
192
+ return {
193
+ rule: 'eess-ts: rule file',
194
+ element: basename(file),
195
+ file,
196
+ line: 1,
197
+ message: `This rule file stopped evaluating at the finding above, so any rule declared after ` +
198
+ `that point never ran and its violations are not in this report. Rules that had already ` +
199
+ `run are reported normally.${others}`,
200
+ suggestion: `Fix the finding above, then re-run to see the rest of this file. To make the file ` +
201
+ `always evaluate in full: if its rules come from a preset, pass \`report: 'builders'\` — ` +
202
+ `e.g. \`recommended(p, { report: 'builders' })\` — which returns the builders instead of ` +
203
+ `running them at module scope. A spread like \`export default [...recommended(p)]\` does ` +
204
+ `NOT avoid this on its own, because the spread evaluates before the array exists. ` +
205
+ `Otherwise move the rules into \`export default [rule1, rule2]\` and drop the terminal ` +
206
+ `calls, so every rule is built before any of them runs.`,
207
+ bypassFilters: true,
208
+ };
209
+ }
210
+ /**
211
+ * `--baseline` was passed, but the rule file printed findings the baseline never
212
+ * filtered. Bug 0199.
213
+ *
214
+ * **The mechanism, corrected TWICE. This is the third version and the measured one.**
215
+ *
216
+ * 1. *"The preset throws before baseline filtering runs."* False. `runCheck` collects
217
+ * a thrown terminal's violations off the error (`failureOrViolations`) and filters
218
+ * them; measured, its collection came back empty against a matching baseline.
219
+ * 2. *"`setCallerAggregatesReports` is module state that does not cross jiti's
220
+ * registry."* Also false, and it was the premise of a whole record. The flag is
221
+ * read at exactly ONE site — `core/execute-rule.ts`, inside `executeWarn`.
222
+ * And jiti is not even the default loader: `cli/import-rule-module.ts` imports
223
+ * natively first and reaches jiti only on a module-format refusal.
224
+ * (Line numbers deliberately omitted: the fix for (3) moved every one of them,
225
+ * and the first version of this docblock cited three that had already drifted.)
226
+ *
227
+ * 3. **What is actually true:** `executeCheck` calls `writeReport(...)`
228
+ * **unconditionally** at `core/execute-rule.ts`, one line before it throws.
229
+ * A `.check()` at module scope therefore prints its findings always — same
230
+ * registry, no jiti, no flag involved. The CLI cannot un-print them.
231
+ *
232
+ * The disproof of (2) is one line: a fixture importing the same module graph as the
233
+ * test's `runCheck`, so the flag was fully visible, printed all four violations
234
+ * anyway.
235
+ *
236
+ * **Why a notice and not the repair.** Making `executeCheck` honour the flag is a
237
+ * change to when a terminal emits — ADR-008 territory, and it would alter behaviour
238
+ * for every caller that relies on `.check()` printing, including test files. That is
239
+ * bug 0201. Until it is decided the run must not be silent about output it could not
240
+ * filter.
241
+ *
242
+ * **Fires only when something was actually printed.** `executeWarn` throws the same
243
+ * error type, and when the CLI aggregates it writes only non-`bypassFilters` entries
244
+ * — for a configuration finding, nothing at all. The first version fired on the bare
245
+ * `isArchRuleError` condition and so claimed a leak that never happened, pointing at
246
+ * a finding whose own text says a baseline can never suppress it. Asserting a cause
247
+ * the run cannot verify is the ADR-009 rule 2 defect `ruleFileFailure` names above.
248
+ *
249
+ * **What this can and cannot say.** The leaked lines were written before the CLI saw
250
+ * them, so it cannot know how many there were. Naming a count would be invention.
251
+ *
252
+ * `bypassFilters` because it reports a gap in filtering — accepting it into a
253
+ * baseline would suppress the notice that the baseline is not being applied.
254
+ */
255
+ export function baselineNotApplied(file, filters) {
256
+ // Name the filters that were actually in play. `--baseline` is not the only one,
257
+ // and it is not always a FLAG — a config file can set it, and telling someone
258
+ // "`--baseline` was not applied" when they never typed it sends them looking for
259
+ // an argument they did not pass (adopter review of PR #74).
260
+ const names = [];
261
+ if (filters.baseline !== undefined)
262
+ names.push(`the baseline \`${basename(filters.baseline)}\``);
263
+ if (filters.changed)
264
+ names.push('`--changed` (diff-aware mode)');
265
+ const list = names.join(' and ');
266
+ return {
267
+ // NOT `eess-ts: rule file` — `dedupeConfigFindings` keys on
268
+ // `file + rule + element`, so sharing that label merges this into
269
+ // `ruleFileTruncated()` and the notice disappears. Measured: it did.
270
+ //
271
+ // NOT `eess-ts: baseline` either: it fires for `--changed` too, and three
272
+ // existing findings already use that label for baseline diagnostics.
273
+ //
274
+ // And NOT `eess-ts: filtering`, which it briefly was — across `docs/`
275
+ // "filtering" is the `.that()` predicate phase (`docs/core-concepts.md:91`,
276
+ // repeated on every dialect page), so a reader seeing it on a red build would
277
+ // most reasonably conclude their predicate was wrong. `reporting` is ADR-008's
278
+ // own noun for what this finding is actually about: who emitted, and when.
279
+ rule: 'eess-ts: reporting',
280
+ element: basename(file),
281
+ file,
282
+ line: 1,
283
+ message: `This rule file reported findings itself, so ${list} ` +
284
+ `${names.length > 1 ? 'were' : 'was'} NOT applied to them — anything it printed ` +
285
+ `reached you unfiltered, and findings you have already accepted or excluded can ` +
286
+ `appear as failures. The findings the CLI collected were filtered normally, which ` +
287
+ `is why the counts in this run disagree.`,
288
+ because: `A CLI-side filter can only act on findings the CLI collects. A rule file that ` +
289
+ `calls its own terminal at module scope prints them first, so the run you are ` +
290
+ `reading is not the run the filter describes.`,
291
+ // The remedy is ordered generic-first ON PURPOSE. This finding fires for ANY
292
+ // terminal throwing at module scope — a hand-written `.check()` with no preset
293
+ // in sight reaches it too — so naming the preset fix alone would be the ADR-009
294
+ // rule 2 defect its neighbour `ruleFileFailure` calls out by name.
295
+ suggestion: `Move this file's rules into \`export default [rule1, rule2]\` and drop the ` +
296
+ `terminal calls — an array export hands every rule to the CLI, which then owns ` +
297
+ `reporting and applies every filter to all of it. If the rules come from a ` +
298
+ `preset, pass \`report: 'builders'\` instead — e.g. ` +
299
+ `\`recommended(p, { report: 'builders' })\` — which returns the builders rather ` +
300
+ `than running them. \`eess-ts init\` scaffolds both forms correctly.`,
301
+ bypassFilters: true,
302
+ };
303
+ }
304
+ /**
305
+ * A rule file loaded cleanly and contributed **zero** rules.
306
+ *
307
+ * `check` used to print `✓ eess-ts — 0 rules across 1 file · 0 failing` and exit 0
308
+ * over exactly this, while `doctor` on the same file already refused it with "no
309
+ * rules found in the given files". Two commands in one CLI disagreeing about
310
+ * whether "no rules" is an error, and the one wired into CI was the one blessing
311
+ * it.
312
+ *
313
+ * **The shape that makes it urgent** is a migration from `@nielspeter/ts-archunit`,
314
+ * whose `recommended()` returned builders unconditionally and had no `report`
315
+ * option. eess-ts's runs and throws by default, so the line ts-archunit's own
316
+ * `init` scaffolded — `export default [...recommended(p)]` — spreads a *violations*
317
+ * array. On a codebase with findings that fails loudly (the loader rejects a
318
+ * non-builder entry). **On a clean codebase the array is empty**, so the file
319
+ * exports `[]`, the CLI loads nothing, and the run is green with every rule gone.
320
+ * `tsc --noEmit` passes; nothing reaches stderr.
321
+ *
322
+ * The adopter this hits is the one who did the baseline work and cleaned up.
323
+ *
324
+ * `CLAUDE.md` already tells agents that a zero denominator "means the gate matched
325
+ * little or nothing — treat that as a red flag". This makes the CLI agree with its
326
+ * own instruction instead of printing `✓` over its alarm value.
327
+ *
328
+ * `bypassFilters` because it reports absent coverage: there is nothing to grade,
329
+ * exclude, or accept into a baseline.
330
+ */
331
+ export function ruleFileContributedNoRules(file) {
332
+ return {
333
+ rule: 'eess-ts: rule file',
334
+ element: basename(file),
335
+ file,
336
+ line: 1,
337
+ message: `This rule file loaded without error but contributed no rules, so it enforced ` +
338
+ `nothing in this run. A green result here would mean "every rule passed" when ` +
339
+ `what happened is "there were no rules".`,
340
+ because: `A gate that checks nothing cannot fail, and a passing build is only evidence ` +
341
+ `if something was actually examined.`,
342
+ suggestion: `Check what this file's default export actually contains. The usual cause is a ` +
343
+ `preset spread without \`report: 'builders'\` — \`export default ` +
344
+ `[...recommended(p)]\` spreads the preset's RESULT, which on a codebase with no ` +
345
+ `violations is an empty array. Use \`recommended(p, { report: 'builders' })\`. ` +
346
+ `If the file is deliberately empty, delete it rather than leaving a rule file ` +
347
+ `that enforces nothing.`,
348
+ bypassFilters: true,
349
+ };
350
+ }
351
+ //# sourceMappingURL=rule-file-findings.js.map
@@ -0,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CAAC;QACP,OAAO,EACL,+EAA+E;YAC/E,+EAA+E;YAC/E,yCAAyC;QAC3C,OAAO,EACL,+EAA+E;YAC/E,qCAAqC;QACvC,UAAU,EACR,gFAAgF;YAChF,kEAAkE;YAClE,iFAAiF;YACjF,gFAAgF;YAChF,+EAA+E;YAC/E,wBAAwB;QAC1B,aAAa,EAAE,IAAI;KACpB,CAAA;AACH,CAAC"}
@@ -1,4 +1,11 @@
1
- export interface WatchOptions {
1
+ /**
2
+ * Watch mode for `eess-ts`.
3
+ *
4
+ * The scheduling and the watch loop live in the kernel — they were duplicated
5
+ * with `eess-mermaid` and the copies drifted (see `@nielspeter/eess`'s
6
+ * `watch.ts`). What is dialect-specific is only which filenames count.
7
+ */
8
+ interface WatchOptions {
2
9
  /** Directories to watch for changes */
3
10
  watchDirs: string[];
4
11
  /** Additional files to watch (e.g., rule files) */
@@ -9,41 +16,17 @@ export interface WatchOptions {
9
16
  debounceMs?: number;
10
17
  }
11
18
  export declare const TS_FILE_RE: RegExp;
19
+ export declare function watchAndRerun(options: WatchOptions): void;
12
20
  /**
13
- * Scheduling logic for watch mode — extracted for testability.
14
- *
15
- * Debounces rapid triggers. If a trigger arrives while the callback
16
- * is running, it queues a re-run after the current run completes.
17
- */
18
- export declare class RunScheduler {
19
- #private;
20
- private debounceTimer;
21
- private running;
22
- private _pendingRerun;
23
- private readonly debounceMs;
24
- private readonly onRun;
25
- constructor(onRun: (trigger: string) => Promise<void>, debounceMs?: number);
26
- get runCount(): number;
27
- get pendingRerun(): boolean;
28
- get isRunning(): boolean;
29
- /**
30
- * Queue a run for the given trigger, resetting the debounce window.
31
- * If a run is already in progress, marks a pending re-run instead.
32
- */
33
- schedule(trigger: string): void;
34
- private executeRun;
35
- }
36
- /**
37
- * Watch for file changes and re-run the callback.
21
+ * Import a module with cache-busting for watch mode.
38
22
  *
39
- * Uses Node.js `fs.watch` with `recursive: true` (Node 24+).
40
- * Debounces rapid filesystem events. If a change arrives while
41
- * a run is in progress, it is queued and executed after the
42
- * current run completes.
23
+ * Node ESM has no cache eviction API. Each call creates a new module entry via a
24
+ * unique query string. Over long sessions this leaks memory.
43
25
  *
44
- * Known limitation: each re-run loads rule files with a fresh (cache-busting)
45
- * jiti instance. Over long sessions, memory grows — restart the watcher
46
- * periodically for long sessions.
26
+ * Stays in this package rather than moving to the kernel with the watch loop:
27
+ * `eess-mermaid` has no equivalent, so it is not duplicated and unifying it
28
+ * would be inventing shared surface rather than removing copied surface.
47
29
  */
48
- export declare function watchAndRerun(options: WatchOptions): void;
30
+ export declare function importFresh(filePath: string): Promise<unknown>;
31
+ export {};
49
32
  //# sourceMappingURL=watch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/cli/watch.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAGD,eAAO,MAAM,UAAU,QAAiB,CAAA;AAExC;;;;;GAKG;AAEH,qBAAa,YAAY;;IACvB,OAAO,CAAC,aAAa,CAA2C;IAChE,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;gBAG9C,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,UAAU,SAAM;IAKvE,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;OAGG;IACH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