@nielspeter/eess-ts 0.2.1 → 0.4.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 (433) 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 +73 -31
  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 +134 -30
  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 +393 -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 +181 -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 +173 -26
  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 +12 -3
  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 +242 -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 +105 -29
  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 +3 -2
  55. package/dist/cli/commands/baseline.d.ts.map +1 -1
  56. package/dist/cli/commands/baseline.js +68 -6
  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 +241 -45
  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 +60 -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 +98 -33
  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 +21 -29
  85. package/dist/cli/load-rules.js.map +1 -1
  86. package/dist/cli/resolve-config.d.ts.map +1 -1
  87. package/dist/cli/resolve-config.js +24 -24
  88. package/dist/cli/resolve-config.js.map +1 -1
  89. package/dist/cli/rule-file-findings.d.ts +178 -0
  90. package/dist/cli/rule-file-findings.d.ts.map +1 -0
  91. package/dist/cli/rule-file-findings.js +293 -0
  92. package/dist/cli/rule-file-findings.js.map +1 -0
  93. package/dist/cli/watch.d.ts +20 -7
  94. package/dist/cli/watch.d.ts.map +1 -1
  95. package/dist/cli/watch.js +39 -14
  96. package/dist/cli/watch.js.map +1 -1
  97. package/dist/conditions/body-analysis-function.d.ts.map +1 -1
  98. package/dist/conditions/body-analysis-function.js +16 -7
  99. package/dist/conditions/body-analysis-function.js.map +1 -1
  100. package/dist/conditions/body-analysis-module.d.ts.map +1 -1
  101. package/dist/conditions/body-analysis-module.js +14 -9
  102. package/dist/conditions/body-analysis-module.js.map +1 -1
  103. package/dist/conditions/body-analysis.d.ts.map +1 -1
  104. package/dist/conditions/body-analysis.js +16 -7
  105. package/dist/conditions/body-analysis.js.map +1 -1
  106. package/dist/conditions/call.d.ts.map +1 -1
  107. package/dist/conditions/call.js +38 -17
  108. package/dist/conditions/call.js.map +1 -1
  109. package/dist/conditions/catch-analysis.d.ts +2 -1
  110. package/dist/conditions/catch-analysis.d.ts.map +1 -1
  111. package/dist/conditions/catch-analysis.js.map +1 -1
  112. package/dist/conditions/cross-layer.d.ts +2 -10
  113. package/dist/conditions/cross-layer.d.ts.map +1 -1
  114. package/dist/conditions/cross-layer.js +227 -23
  115. package/dist/conditions/cross-layer.js.map +1 -1
  116. package/dist/conditions/dependency.d.ts +35 -6
  117. package/dist/conditions/dependency.d.ts.map +1 -1
  118. package/dist/conditions/dependency.js +299 -45
  119. package/dist/conditions/dependency.js.map +1 -1
  120. package/dist/conditions/exports.d.ts.map +1 -1
  121. package/dist/conditions/exports.js +10 -0
  122. package/dist/conditions/exports.js.map +1 -1
  123. package/dist/conditions/function.d.ts.map +1 -1
  124. package/dist/conditions/function.js +19 -5
  125. package/dist/conditions/function.js.map +1 -1
  126. package/dist/conditions/helpers.d.ts +2 -1
  127. package/dist/conditions/helpers.d.ts.map +1 -1
  128. package/dist/conditions/helpers.js +4 -1
  129. package/dist/conditions/helpers.js.map +1 -1
  130. package/dist/conditions/jsx.d.ts.map +1 -1
  131. package/dist/conditions/jsx.js +7 -2
  132. package/dist/conditions/jsx.js.map +1 -1
  133. package/dist/conditions/match-identity.d.ts +43 -0
  134. package/dist/conditions/match-identity.d.ts.map +1 -0
  135. package/dist/conditions/match-identity.js +43 -0
  136. package/dist/conditions/match-identity.js.map +1 -0
  137. package/dist/conditions/members.d.ts.map +1 -1
  138. package/dist/conditions/members.js +17 -4
  139. package/dist/conditions/members.js.map +1 -1
  140. package/dist/conditions/reverse-dependency.d.ts +18 -5
  141. package/dist/conditions/reverse-dependency.d.ts.map +1 -1
  142. package/dist/conditions/reverse-dependency.js +109 -92
  143. package/dist/conditions/reverse-dependency.js.map +1 -1
  144. package/dist/conditions/slice.d.ts +86 -2
  145. package/dist/conditions/slice.d.ts.map +1 -1
  146. package/dist/conditions/slice.js +234 -53
  147. package/dist/conditions/slice.js.map +1 -1
  148. package/dist/conditions/structural.d.ts.map +1 -1
  149. package/dist/conditions/structural.js +16 -4
  150. package/dist/conditions/structural.js.map +1 -1
  151. package/dist/core/check-all.d.ts +19 -0
  152. package/dist/core/check-all.d.ts.map +1 -0
  153. package/dist/core/check-all.js +96 -0
  154. package/dist/core/check-all.js.map +1 -0
  155. package/dist/core/combinators.d.ts +48 -0
  156. package/dist/core/combinators.d.ts.map +1 -0
  157. package/dist/core/combinators.js +56 -0
  158. package/dist/core/combinators.js.map +1 -0
  159. package/dist/core/descendant-cache.d.ts +36 -0
  160. package/dist/core/descendant-cache.d.ts.map +1 -0
  161. package/dist/core/descendant-cache.js +119 -0
  162. package/dist/core/descendant-cache.js.map +1 -0
  163. package/dist/core/diagnose.d.ts +234 -0
  164. package/dist/core/diagnose.d.ts.map +1 -0
  165. package/dist/core/diagnose.js +382 -0
  166. package/dist/core/diagnose.js.map +1 -0
  167. package/dist/core/disk-set.d.ts +48 -0
  168. package/dist/core/disk-set.d.ts.map +1 -0
  169. package/dist/core/disk-set.js +218 -0
  170. package/dist/core/disk-set.js.map +1 -0
  171. package/dist/core/element-cache.d.ts +75 -0
  172. package/dist/core/element-cache.d.ts.map +1 -0
  173. package/dist/core/element-cache.js +32 -0
  174. package/dist/core/element-cache.js.map +1 -0
  175. package/dist/core/empty-project-advice.d.ts +75 -0
  176. package/dist/core/empty-project-advice.d.ts.map +1 -0
  177. package/dist/core/empty-project-advice.js +61 -0
  178. package/dist/core/empty-project-advice.js.map +1 -0
  179. package/dist/core/exclusion-comments.d.ts +54 -0
  180. package/dist/core/exclusion-comments.d.ts.map +1 -0
  181. package/dist/core/exclusion-comments.js +310 -0
  182. package/dist/core/exclusion-comments.js.map +1 -0
  183. package/dist/core/execute-rule.d.ts +150 -0
  184. package/dist/core/execute-rule.d.ts.map +1 -0
  185. package/dist/core/execute-rule.js +580 -0
  186. package/dist/core/execute-rule.js.map +1 -0
  187. package/dist/core/glob-diagnosis.d.ts +78 -0
  188. package/dist/core/glob-diagnosis.d.ts.map +1 -0
  189. package/dist/core/glob-diagnosis.js +134 -0
  190. package/dist/core/glob-diagnosis.js.map +1 -0
  191. package/dist/core/glob-evaluator.d.ts +48 -0
  192. package/dist/core/glob-evaluator.d.ts.map +1 -0
  193. package/dist/core/glob-evaluator.js +89 -0
  194. package/dist/core/glob-evaluator.js.map +1 -0
  195. package/dist/core/import-candidates.d.ts +60 -0
  196. package/dist/core/import-candidates.d.ts.map +1 -0
  197. package/dist/core/import-candidates.js +93 -0
  198. package/dist/core/import-candidates.js.map +1 -0
  199. package/dist/core/import-options.d.ts +55 -2
  200. package/dist/core/import-options.d.ts.map +1 -1
  201. package/dist/core/import-options.js +64 -0
  202. package/dist/core/import-options.js.map +1 -1
  203. package/dist/core/line-index.d.ts +3 -0
  204. package/dist/core/line-index.d.ts.map +1 -0
  205. package/dist/core/line-index.js +229 -0
  206. package/dist/core/line-index.js.map +1 -0
  207. package/dist/core/metric-violation.d.ts +86 -0
  208. package/dist/core/metric-violation.d.ts.map +1 -0
  209. package/dist/core/metric-violation.js +132 -0
  210. package/dist/core/metric-violation.js.map +1 -0
  211. package/dist/core/module-edges.d.ts +361 -0
  212. package/dist/core/module-edges.d.ts.map +1 -0
  213. package/dist/core/module-edges.js +592 -0
  214. package/dist/core/module-edges.js.map +1 -0
  215. package/dist/core/object-literal-functions.d.ts +42 -0
  216. package/dist/core/object-literal-functions.d.ts.map +1 -0
  217. package/dist/core/object-literal-functions.js +75 -0
  218. package/dist/core/object-literal-functions.js.map +1 -0
  219. package/dist/core/orphan-exclusions.d.ts +44 -0
  220. package/dist/core/orphan-exclusions.d.ts.map +1 -0
  221. package/dist/core/orphan-exclusions.js +214 -0
  222. package/dist/core/orphan-exclusions.js.map +1 -0
  223. package/dist/core/pair-condition.d.ts +32 -3
  224. package/dist/core/pair-condition.d.ts.map +1 -1
  225. package/dist/core/path-universe.d.ts +54 -0
  226. package/dist/core/path-universe.d.ts.map +1 -0
  227. package/dist/core/path-universe.js +65 -0
  228. package/dist/core/path-universe.js.map +1 -0
  229. package/dist/core/per-root-compiler-options.d.ts +20 -0
  230. package/dist/core/per-root-compiler-options.d.ts.map +1 -0
  231. package/dist/core/per-root-compiler-options.js +57 -0
  232. package/dist/core/per-root-compiler-options.js.map +1 -0
  233. package/dist/core/project-relative.d.ts +98 -0
  234. package/dist/core/project-relative.d.ts.map +1 -0
  235. package/dist/core/project-relative.js +185 -0
  236. package/dist/core/project-relative.js.map +1 -0
  237. package/dist/core/project.d.ts +7 -1
  238. package/dist/core/project.d.ts.map +1 -1
  239. package/dist/core/project.js +24 -0
  240. package/dist/core/project.js.map +1 -1
  241. package/dist/core/rule-builder.d.ts +282 -0
  242. package/dist/core/rule-builder.d.ts.map +1 -0
  243. package/dist/core/rule-builder.js +445 -0
  244. package/dist/core/rule-builder.js.map +1 -0
  245. package/dist/core/rule-declaration.d.ts +32 -0
  246. package/dist/core/rule-declaration.d.ts.map +1 -0
  247. package/dist/core/rule-declaration.js +126 -0
  248. package/dist/core/rule-declaration.js.map +1 -0
  249. package/dist/core/terminal-builder.d.ts +625 -0
  250. package/dist/core/terminal-builder.d.ts.map +1 -0
  251. package/dist/core/terminal-builder.js +787 -0
  252. package/dist/core/terminal-builder.js.map +1 -0
  253. package/dist/core/terminal-execution.d.ts +23 -0
  254. package/dist/core/terminal-execution.d.ts.map +1 -0
  255. package/dist/core/terminal-execution.js +71 -0
  256. package/dist/core/terminal-execution.js.map +1 -0
  257. package/dist/core/vacuity-diagnosis.d.ts +103 -0
  258. package/dist/core/vacuity-diagnosis.d.ts.map +1 -0
  259. package/dist/core/vacuity-diagnosis.js +415 -0
  260. package/dist/core/vacuity-diagnosis.js.map +1 -0
  261. package/dist/core/violation.d.ts +16 -11
  262. package/dist/core/violation.d.ts.map +1 -1
  263. package/dist/core/violation.js +33 -13
  264. package/dist/core/violation.js.map +1 -1
  265. package/dist/graphql/index.js +1 -1
  266. package/dist/graphql/index.js.map +1 -1
  267. package/dist/graphql/resolver-rule-builder.d.ts +98 -23
  268. package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
  269. package/dist/graphql/resolver-rule-builder.js +151 -21
  270. package/dist/graphql/resolver-rule-builder.js.map +1 -1
  271. package/dist/graphql/schema-loader.d.ts +21 -0
  272. package/dist/graphql/schema-loader.d.ts.map +1 -1
  273. package/dist/graphql/schema-loader.js +81 -12
  274. package/dist/graphql/schema-loader.js.map +1 -1
  275. package/dist/graphql/schema-rule-builder.d.ts +57 -20
  276. package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
  277. package/dist/graphql/schema-rule-builder.js +101 -25
  278. package/dist/graphql/schema-rule-builder.js.map +1 -1
  279. package/dist/helpers/baseline-diagnostics.d.ts +45 -0
  280. package/dist/helpers/baseline-diagnostics.d.ts.map +1 -0
  281. package/dist/helpers/baseline-diagnostics.js +168 -0
  282. package/dist/helpers/baseline-diagnostics.js.map +1 -0
  283. package/dist/helpers/baseline-generator.d.ts +19 -0
  284. package/dist/helpers/baseline-generator.d.ts.map +1 -0
  285. package/dist/helpers/baseline-generator.js +18 -0
  286. package/dist/helpers/baseline-generator.js.map +1 -0
  287. package/dist/helpers/baseline.d.ts +336 -0
  288. package/dist/helpers/baseline.d.ts.map +1 -0
  289. package/dist/helpers/baseline.js +664 -0
  290. package/dist/helpers/baseline.js.map +1 -0
  291. package/dist/helpers/body-traversal.d.ts +27 -2
  292. package/dist/helpers/body-traversal.d.ts.map +1 -1
  293. package/dist/helpers/body-traversal.js +122 -16
  294. package/dist/helpers/body-traversal.js.map +1 -1
  295. package/dist/helpers/callback-extractor.d.ts.map +1 -1
  296. package/dist/helpers/callback-extractor.js +48 -47
  297. package/dist/helpers/callback-extractor.js.map +1 -1
  298. package/dist/helpers/complexity.d.ts +13 -5
  299. package/dist/helpers/complexity.d.ts.map +1 -1
  300. package/dist/helpers/complexity.js +15 -6
  301. package/dist/helpers/complexity.js.map +1 -1
  302. package/dist/helpers/diff-aware.d.ts +44 -0
  303. package/dist/helpers/diff-aware.d.ts.map +1 -0
  304. package/dist/helpers/diff-aware.js +84 -0
  305. package/dist/helpers/diff-aware.js.map +1 -0
  306. package/dist/helpers/matchers.d.ts +68 -7
  307. package/dist/helpers/matchers.d.ts.map +1 -1
  308. package/dist/helpers/matchers.js +114 -20
  309. package/dist/helpers/matchers.js.map +1 -1
  310. package/dist/helpers/slice-graph.d.ts +100 -8
  311. package/dist/helpers/slice-graph.d.ts.map +1 -1
  312. package/dist/helpers/slice-graph.js +126 -34
  313. package/dist/helpers/slice-graph.js.map +1 -1
  314. package/dist/helpers/tarjan.d.ts +0 -14
  315. package/dist/helpers/tarjan.d.ts.map +1 -1
  316. package/dist/helpers/tarjan.js +29 -16
  317. package/dist/helpers/tarjan.js.map +1 -1
  318. package/dist/index.d.ts +56 -17
  319. package/dist/index.d.ts.map +1 -1
  320. package/dist/index.js +57 -13
  321. package/dist/index.js.map +1 -1
  322. package/dist/models/arch-call.d.ts +3 -2
  323. package/dist/models/arch-call.d.ts.map +1 -1
  324. package/dist/models/arch-call.js.map +1 -1
  325. package/dist/models/arch-function.d.ts +28 -6
  326. package/dist/models/arch-function.d.ts.map +1 -1
  327. package/dist/models/arch-function.js +106 -3
  328. package/dist/models/arch-function.js.map +1 -1
  329. package/dist/models/arch-jsx-element.js +2 -2
  330. package/dist/models/arch-jsx-element.js.map +1 -1
  331. package/dist/models/slice.d.ts +33 -9
  332. package/dist/models/slice.d.ts.map +1 -1
  333. package/dist/models/slice.js +129 -19
  334. package/dist/models/slice.js.map +1 -1
  335. package/dist/predicates/call.d.ts.map +1 -1
  336. package/dist/predicates/call.js +5 -0
  337. package/dist/predicates/call.js.map +1 -1
  338. package/dist/predicates/identity.d.ts +21 -0
  339. package/dist/predicates/identity.d.ts.map +1 -1
  340. package/dist/predicates/identity.js +75 -3
  341. package/dist/predicates/identity.js.map +1 -1
  342. package/dist/predicates/index.d.ts +1 -1
  343. package/dist/predicates/index.d.ts.map +1 -1
  344. package/dist/predicates/index.js +1 -1
  345. package/dist/predicates/index.js.map +1 -1
  346. package/dist/predicates/metrics.d.ts +4 -2
  347. package/dist/predicates/metrics.d.ts.map +1 -1
  348. package/dist/predicates/metrics.js +4 -2
  349. package/dist/predicates/metrics.js.map +1 -1
  350. package/dist/predicates/module.d.ts +4 -12
  351. package/dist/predicates/module.d.ts.map +1 -1
  352. package/dist/predicates/module.js +57 -37
  353. package/dist/predicates/module.js.map +1 -1
  354. package/dist/presets/agent-guardrails.d.ts +22 -15
  355. package/dist/presets/agent-guardrails.d.ts.map +1 -1
  356. package/dist/presets/agent-guardrails.js +124 -19
  357. package/dist/presets/agent-guardrails.js.map +1 -1
  358. package/dist/presets/boundaries.d.ts +45 -2
  359. package/dist/presets/boundaries.d.ts.map +1 -1
  360. package/dist/presets/boundaries.js +132 -23
  361. package/dist/presets/boundaries.js.map +1 -1
  362. package/dist/presets/data-layer.d.ts +22 -2
  363. package/dist/presets/data-layer.d.ts.map +1 -1
  364. package/dist/presets/data-layer.js +58 -16
  365. package/dist/presets/data-layer.js.map +1 -1
  366. package/dist/presets/index.d.ts +7 -5
  367. package/dist/presets/index.d.ts.map +1 -1
  368. package/dist/presets/index.js +9 -3
  369. package/dist/presets/index.js.map +1 -1
  370. package/dist/presets/layered.d.ts +46 -2
  371. package/dist/presets/layered.d.ts.map +1 -1
  372. package/dist/presets/layered.js +66 -29
  373. package/dist/presets/layered.js.map +1 -1
  374. package/dist/presets/recommended.d.ts +80 -9
  375. package/dist/presets/recommended.d.ts.map +1 -1
  376. package/dist/presets/recommended.js +25 -23
  377. package/dist/presets/recommended.js.map +1 -1
  378. package/dist/presets/shared.d.ts +270 -2
  379. package/dist/presets/shared.d.ts.map +1 -1
  380. package/dist/presets/shared.js +338 -4
  381. package/dist/presets/shared.js.map +1 -1
  382. package/dist/rules/code-quality.d.ts.map +1 -1
  383. package/dist/rules/code-quality.js +15 -6
  384. package/dist/rules/code-quality.js.map +1 -1
  385. package/dist/rules/hygiene.d.ts +1 -1
  386. package/dist/rules/hygiene.js +1 -1
  387. package/dist/rules/metrics-function.d.ts +2 -1
  388. package/dist/rules/metrics-function.d.ts.map +1 -1
  389. package/dist/rules/metrics-function.js +33 -6
  390. package/dist/rules/metrics-function.js.map +1 -1
  391. package/dist/rules/metrics.d.ts +2 -1
  392. package/dist/rules/metrics.d.ts.map +1 -1
  393. package/dist/rules/metrics.js +39 -9
  394. package/dist/rules/metrics.js.map +1 -1
  395. package/dist/smells/duplicate-bodies.d.ts +58 -5
  396. package/dist/smells/duplicate-bodies.d.ts.map +1 -1
  397. package/dist/smells/duplicate-bodies.js +137 -56
  398. package/dist/smells/duplicate-bodies.js.map +1 -1
  399. package/dist/smells/fingerprint.d.ts +8 -1
  400. package/dist/smells/fingerprint.d.ts.map +1 -1
  401. package/dist/smells/fingerprint.js +21 -3
  402. package/dist/smells/fingerprint.js.map +1 -1
  403. package/dist/smells/inconsistent-siblings.d.ts +128 -7
  404. package/dist/smells/inconsistent-siblings.d.ts.map +1 -1
  405. package/dist/smells/inconsistent-siblings.js +288 -86
  406. package/dist/smells/inconsistent-siblings.js.map +1 -1
  407. package/dist/smells/sibling-files.d.ts +47 -0
  408. package/dist/smells/sibling-files.d.ts.map +1 -0
  409. package/dist/smells/sibling-files.js +104 -0
  410. package/dist/smells/sibling-files.js.map +1 -0
  411. package/dist/smells/similar-pairs.d.ts +27 -0
  412. package/dist/smells/similar-pairs.d.ts.map +1 -0
  413. package/dist/smells/similar-pairs.js +52 -0
  414. package/dist/smells/similar-pairs.js.map +1 -0
  415. package/dist/smells/smell-builder.d.ts +57 -12
  416. package/dist/smells/smell-builder.d.ts.map +1 -1
  417. package/dist/smells/smell-builder.js +111 -14
  418. package/dist/smells/smell-builder.js.map +1 -1
  419. package/dist/tsconfig/index.d.ts +19 -0
  420. package/dist/tsconfig/index.d.ts.map +1 -0
  421. package/dist/tsconfig/index.js +20 -0
  422. package/dist/tsconfig/index.js.map +1 -0
  423. package/dist/tsconfig/tsconfig-builder.d.ts +42 -9
  424. package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
  425. package/dist/tsconfig/tsconfig-builder.js +64 -16
  426. package/dist/tsconfig/tsconfig-builder.js.map +1 -1
  427. package/package.json +3 -2
  428. package/dist/core/module-dependencies.d.ts +0 -28
  429. package/dist/core/module-dependencies.d.ts.map +0 -1
  430. package/dist/core/module-dependencies.js +0 -35
  431. package/dist/core/module-dependencies.js.map +0 -1
  432. package/dist/helpers/within.d.ts.map +0 -1
  433. package/dist/helpers/within.js.map +0 -1
@@ -0,0 +1,580 @@
1
+ import fs from 'node:fs';
2
+ import { severityFor, disambiguateIdentities, byCodepoint, violationsEmittedCount, } from '@nielspeter/eess';
3
+ import { ArchRuleError } from '@nielspeter/eess';
4
+ import { formatViolations } from '@nielspeter/eess';
5
+ import { formatViolationsJson } from '@nielspeter/eess';
6
+ import { activeNotice } from '@nielspeter/eess';
7
+ import { formatViolationsGitHub } from '@nielspeter/eess';
8
+ import { parseExclusionComments, isExcludedByComment } from './exclusion-comments.js';
9
+ import { UNSUPPRESSABLE } from '@nielspeter/eess';
10
+ import { recordCommentSuppression } from '@nielspeter/eess';
11
+ import { writeStderr } from '@nielspeter/eess';
12
+ /**
13
+ * Complete each violation's identity, then apply `.excluding()` patterns and
14
+ * inline exclusion comments.
15
+ *
16
+ * Extracted to eliminate terminal-method duplication across builders.
17
+ *
18
+ * **Not** baseline or diff filtering, despite what this said for several
19
+ * releases — those run in `executeCheck` / `executeWarn`, after this returns.
20
+ *
21
+ * ## The invariant, for whoever adds the next filter
22
+ *
23
+ * **Enrichment runs first, so every filter sees a complete violation.** That is
24
+ * the whole reason for the ordering, and it is easy to undo by accident because
25
+ * enrichment looks like output formatting rather than identity. It is not: the
26
+ * comment filter matches on `ruleId`, and when enrichment ran last that filter
27
+ * saw `undefined` for every condition that did not stamp the field itself
28
+ * (bug 0041) — a documented feature that silently did nothing.
29
+ *
30
+ * Enrichment is pure, idempotent, and writes a **disjoint field set** from
31
+ * everything the filters read: it touches `ruleId`, `because`, `suggestion` and
32
+ * `docs`; `.excluding()` matches on `element`/`file`/`message`, and the
33
+ * `bypassFilters` refusal path reads a flag enrichment never writes. So
34
+ * "identity is complete before anything reads it" is a simpler invariant to hold
35
+ * than "each filter must know which fields exist yet". Add a filter that reads
36
+ * one of those four fields and it will work; add a mutation of them below a
37
+ * filter and you have reintroduced 0041.
38
+ */
39
+ export function applyFilters(violations, ctx) {
40
+ // Identity uniqueness, BEFORE the enrichment below and before every filter — see
41
+ // `disambiguateIdentities`. Two reasons for this position specifically:
42
+ //
43
+ // 1. This function's own contract is that identity is complete before anything reads it,
44
+ // and the baseline reads it after. A producer that emits two findings with one identity
45
+ // hands the baseline one entry for two findings, and accepting either accepts both —
46
+ // which is bugs 0028, 0063, 0064 and 0065, one per family that got reviewed.
47
+ // 2. Ahead of the filters rather than after them, so a finding's identity is a property of
48
+ // what the RULE found, not of what a `--changed` or `.excluding()` run happened to keep.
49
+ // Suffixing after filtering would give the same finding different identities in CI and
50
+ // on a laptop, which is the defect `identity` exists to prevent.
51
+ //
52
+ // Enrichment does not touch `element`, `message` or `identity`, so the order between this
53
+ // and the block below is free; it runs first to keep "identity is settled" the outermost
54
+ // statement about this function.
55
+ let result = disambiguateIdentities(violations);
56
+ // Enrich FIRST, because a filter cannot match on a field that is not set yet.
57
+ //
58
+ // [ts-archunit Bug 0041](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0041-an-exclusion-comment-is-a-no-op-for-most-conditions.md):
59
+ // this block used to run LAST, after the inline-comment filter below. That
60
+ // filter's first statement is `if (!violation.ruleId) return false`
61
+ // (`exclusion-comments.ts:262`), so an exclusion comment matched only
62
+ // violations whose *producing condition* stamped `ruleId` itself. For every
63
+ // condition that left it to this enrichment — the dependency, exports, slice,
64
+ // reverse-dependency and module-body families, which is most of them — the
65
+ // comment was inert: no suppression, no error, no warning. Measured, with a
66
+ // documented comment and a rule carrying an id, `modules().notImportFrom()`
67
+ // returned the violation unsuppressed, and it carried the matching `ruleId`,
68
+ // stamped here a few lines too late.
69
+ //
70
+ // Ordering, not lookup, is the fix: giving `isExcludedByComment` a second
71
+ // source for the id would leave two places that decide what a rule is called.
72
+ //
73
+ // Safe ahead of `.excluding()` as well, which matches on `element`/`file`/
74
+ // `message` — none of which this touches. It costs a map over violations that
75
+ // may later be filtered out; correctness beats that.
76
+ const meta = ctx.metadata;
77
+ if (ctx.reason || meta?.id || meta?.because || meta?.suggestion || meta?.docs) {
78
+ result = result.map((v) => ({
79
+ ...v,
80
+ ruleId: v.ruleId ?? meta?.id,
81
+ because: v.because ?? ctx.reason ?? meta?.because,
82
+ // A `bypassFilters` finding reports that the rule enforces NOTHING, so the
83
+ // author's `suggestion` cannot be its remedy: that text describes how to fix
84
+ // a real violation of the rule, and the formatter renders `suggestion` under
85
+ // `Fix:` — the field an agent obeys. Pairing a configuration message with an
86
+ // unrelated `Fix:` is a false remedy by juxtaposition (bug 0021), and it is
87
+ // ADR-009 rule 2: a failure may not assert a cause it cannot verify.
88
+ //
89
+ // `SliceRuleBuilder.metaViolation` argued exactly this in a comment and
90
+ // omitted both fields — and was overridden here, one layer up, so the
91
+ // omission had no effect in any shipped version. Measured: a finding reading
92
+ // "resolved no slices" printed "Split the cycle by extracting a shared
93
+ // module." as its Fix:.
94
+ //
95
+ // This guard reaches only producers that LEAVE the fields unset. A producer
96
+ // that assigns `context.suggestion` itself defeats it — bug 0042, where
97
+ // `cross-layer.ts` did exactly that and shipped the author's remedy on an
98
+ // empty-layer finding. Such a producer owns the discipline itself.
99
+ //
100
+ // `ruleId` and `because` stay. Neither asserts a remedy: the id says WHICH
101
+ // rule enforces nothing, which is the first thing the reader needs, and
102
+ // `because` states why the rule exists, which is context rather than a
103
+ // claim about this finding's cause. A producer that wants a remedy sets its
104
+ // own — `metaViolation` sets `docs: GLOB_DOCS`, which is about the fault.
105
+ suggestion: v.bypassFilters ? v.suggestion : (v.suggestion ?? meta?.suggestion),
106
+ docs: v.bypassFilters ? v.docs : (v.docs ?? meta?.docs),
107
+ }));
108
+ }
109
+ // Apply .excluding() chain exclusions
110
+ const exclusions = ctx.exclusions ?? [];
111
+ if (exclusions.length > 0) {
112
+ const matchedPatterns = new Set();
113
+ /** Patterns that matched a meta-finding, which cannot be excluded. */
114
+ const refusedPatterns = new Set();
115
+ // Per exclusion-pattern index, the DISTINCT `element` values it matched among
116
+ // violations whose `identity` starts with `cycle-edge::` (plan 0104). A plain
117
+ // string-prefix read of a field every violation already carries — no cycle-specific
118
+ // import here, so this stays family-agnostic in spirit even though today only one
119
+ // family sets that prefix. One pattern matching more than one distinct cycle edge is
120
+ // the exact loophole a whole-component `.excluding()` waiver reopens: it silently
121
+ // absorbs any FUTURE edge the pattern also happens to match, which is the same
122
+ // fail-open shape plan 0104's `element`-per-edge change exists to close.
123
+ const matchedCycleEdges = new Map();
124
+ result = result.filter((v) => {
125
+ // Config-level meta-findings (empty selector / empty discovery) are never
126
+ // excludable: they report that the rule checks NOTHING, so silencing one
127
+ // silences the guard itself. Baseline and diff-aware already honor this
128
+ // flag; `.excluding()` must too, or a rule that enforces nothing can be
129
+ // made green — the exact false-green ADR-008 exists to prevent. This
130
+ // matters more now that meta-messages quote the user's own globs/paths,
131
+ // which an unrelated path exclusion can incidentally match.
132
+ if (v.bypassFilters) {
133
+ // Record a pattern that WOULD have matched, so the "unused exclusion" warning
134
+ // below doesn't tell the caller their exclusion is stale after a rename. It
135
+ // isn't stale — it is refused, which is a different instruction.
136
+ const wouldMatch = exclusions.findIndex((pattern) => typeof pattern === 'string'
137
+ ? [v.element, v.file, v.message].includes(pattern)
138
+ : [v.element, v.file, v.message].some((target) => pattern.test(target)));
139
+ if (wouldMatch >= 0)
140
+ refusedPatterns.add(wouldMatch);
141
+ return true;
142
+ }
143
+ // Match against element, file, or message — so that custom conditions
144
+ // using createViolation() can be excluded by file path or message content,
145
+ // not just by element name (which may be a generic AST node kind).
146
+ const targets = [v.element, v.file, v.message];
147
+ const matchIndex = exclusions.findIndex((pattern) => typeof pattern === 'string'
148
+ ? targets.some((t) => t === pattern)
149
+ : targets.some((t) => pattern.test(t)));
150
+ if (matchIndex >= 0) {
151
+ matchedPatterns.add(matchIndex);
152
+ if (v.identity?.startsWith('cycle-edge::') === true) {
153
+ const set = matchedCycleEdges.get(matchIndex) ?? new Set();
154
+ set.add(v.element);
155
+ matchedCycleEdges.set(matchIndex, set);
156
+ }
157
+ return false;
158
+ }
159
+ return true;
160
+ });
161
+ const ruleId = ctx.metadata?.id ?? 'unnamed';
162
+ const silentIndices = ctx.silentIndices ?? new Set();
163
+ exclusions.forEach((pattern, index) => {
164
+ if (refusedPatterns.has(index)) {
165
+ writeStderr(`[eess] Exclusion '${String(pattern)}' in rule '${ruleId}' matched a ` +
166
+ `configuration finding, which cannot be excluded — that finding reports the ` +
167
+ `rule enforces nothing. Fix the fault it names instead.`);
168
+ }
169
+ else if (!matchedPatterns.has(index) && !silentIndices.has(index)) {
170
+ writeStderr(`[eess] Unused exclusion '${String(pattern)}' in rule '${ruleId}'. ` +
171
+ `It matched zero violations — it may be stale after a rename.`);
172
+ }
173
+ else {
174
+ // A pattern matching more than one distinct cycle edge silently absorbs any
175
+ // future edge it also happens to match — the loose-regex loophole plan 0104's
176
+ // per-edge `element` reopens for anyone matching on `file`/`message` instead of an
177
+ // exact `element` string (an exact string can only equal one edge, by
178
+ // construction). Advisory (`writeStderr`), not a `DiagnosticFinding` or a
179
+ // second unsuppressable gate. Review flagged the asymmetry directly rather
180
+ // than let it pass as settled: "Unused exclusion" above it warns about a
181
+ // pattern that silences NOTHING (fail-closed — the finding still fires, CI is
182
+ // still red), while this warns about a pattern that silences MULTIPLE real
183
+ // findings and every future one on the same edges (fail-open — a green
184
+ // `check()`, one stderr line). ADR-008 states the primary consumer does not
185
+ // read warnings. Kept advisory here, matching plan 0104's own review
186
+ // resolution — but the asymmetry is real and worth re-litigating if this
187
+ // loophole is measured firing in practice, not settled by the precedent
188
+ // alone.
189
+ const edges = matchedCycleEdges.get(index);
190
+ if (edges !== undefined && edges.size > 1) {
191
+ // byCodepoint, not the default comparator — this is user-facing (the
192
+ // suggested `.excluding(...)` line) and the same determinism class
193
+ // bug 0010 named for every other sorted, filesystem-adjacent output
194
+ // in this family (review: architect).
195
+ const sorted = [...edges].sort(byCodepoint);
196
+ writeStderr(`[eess] Exclusion '${String(pattern)}' in rule '${ruleId}' matched ${String(sorted.length)} ` +
197
+ `distinct cycle edges (${sorted.join(', ')}). A pattern matching more than one edge silently ` +
198
+ `absorbs any future cycle among the edges it matches — name each edge separately: ` +
199
+ `.excluding(${sorted.map((e) => `'${e}'`).join(', ')}).`);
200
+ }
201
+ }
202
+ });
203
+ }
204
+ // Scan source files for inline exclusion comments (when rule has an ID)
205
+ if (ctx.metadata?.id && result.length > 0) {
206
+ const undocumented = [];
207
+ const filePaths = new Set(result.map((v) => v.file));
208
+ const allComments = [...filePaths].flatMap((filePath) => {
209
+ // Two EXPECTED shapes never reach the read, so that the catch below is
210
+ // left holding only the surprising one.
211
+ //
212
+ // `file: ''` is a configuration finding — there is no source and no
213
+ // comment to find. This used to be expressed by letting `readFileSync('')`
214
+ // throw into the catch: control flow by exception, on a NORMAL path.
215
+ //
216
+ // A path not on disk is an in-memory ts-morph project or a test fixture's
217
+ // synthetic file. Same story — no file, so no exclusion comments. Measured:
218
+ // without this clause a warning fires once per file for every in-memory
219
+ // project (it broke two cases in `excluding-matching.test.ts`).
220
+ //
221
+ // Together these are what made the catch unreportable — it could not tell
222
+ // either expected case from a file we genuinely failed to read, so it had
223
+ // to stay silent about all three.
224
+ if (filePath === '' || !fs.existsSync(filePath))
225
+ return [];
226
+ try {
227
+ const sourceText = fs.readFileSync(filePath, 'utf-8');
228
+ const parseResult = parseExclusionComments(sourceText, filePath);
229
+ for (const warning of parseResult.warnings) {
230
+ // An undocumented exclusion is well-formed and APPLIES, so a stderr
231
+ // line is the wrong weight: it silences a real finding and the build
232
+ // goes green (bug 0039). It becomes a configuration finding below.
233
+ // The malformed shapes are different — two of the three decline to
234
+ // create the exclusion at all, so the original violation still fires
235
+ // and the build is already red. A line on stderr is right for those.
236
+ if (warning.kind === 'undocumented') {
237
+ undocumented.push(warning);
238
+ continue;
239
+ }
240
+ writeStderr(`[eess] ${warning.message}`);
241
+ }
242
+ return parseResult.exclusions;
243
+ }
244
+ catch (err) {
245
+ // On disk, and still unreadable — a permission or I/O failure, not a
246
+ // shape eess expects. That is NOT silent: every `// eess-exclude` in
247
+ // this file stops applying, so a violation the author believes is
248
+ // waived fires again with no stated cause. Naming the file and the
249
+ // reason is the difference between "your waiver broke" and "eess
250
+ // started reporting something new" (ADR-009 rule 2).
251
+ writeStderr(`[eess] could not read ${filePath} to apply its exclusion comments ` +
252
+ `(${err instanceof Error ? err.message : String(err)}) — any ` +
253
+ `\`// eess-exclude\` directives in it were NOT applied.\n`);
254
+ return [];
255
+ }
256
+ });
257
+ if (allComments.length > 0) {
258
+ // `v.bypassFilters` explicitly, not by accident. These findings are
259
+ // immune today only because they carry `file: ''`, which the guard above
260
+ // returns no exclusions for, so `comment.file === ''` can never hold.
261
+ // The moment one carries a real path this clause becomes the only
262
+ // protection — and bug 0026 is that moment: configuration findings now
263
+ // carry the rule file they came from, so this file IS read and its
264
+ // `// eess-exclude` comments ARE parsed. Without the first clause
265
+ // a comment in a rule file would silence the finding that says the rule
266
+ // enforces nothing. Pinned by tests/helpers/exclusion-comments.ts.
267
+ result = result.filter((v) => {
268
+ if (v.bypassFilters === true)
269
+ return true;
270
+ if (!isExcludedByComment(v, allComments))
271
+ return true;
272
+ // Disclose it. Silently dropping is what made this the only filter in
273
+ // the pipeline a reader could not see — see `comment-suppression.ts`.
274
+ recordCommentSuppression(v.ruleId ?? ctx.metadata?.id ?? '(unnamed rule)', v.file);
275
+ return false;
276
+ });
277
+ }
278
+ // The exemption stands; what fails is the missing justification. That is
279
+ // deliberate and it is what makes the remedy remediable: add a reason and
280
+ // this finding clears while the exclusion keeps working. Refusing to apply
281
+ // the exclusion instead would make the remedy "add a reason" produce a
282
+ // DIFFERENT failure — the violation itself — which is a remedy that does
283
+ // not remediate (ADR-009 rule 2).
284
+ //
285
+ // Unsuppressable, because a suppression mechanism that can suppress the
286
+ // complaint about itself is not a mechanism.
287
+ for (const warning of undocumented) {
288
+ result.push({
289
+ rule: ctx.metadata.id,
290
+ ruleId: ctx.metadata.id,
291
+ element: `${ctx.metadata.id}@${warning.file}:${String(warning.line)}`,
292
+ file: warning.file,
293
+ line: warning.line,
294
+ message: `This exclusion states no reason, so nothing records why the rule is ` +
295
+ `waived here — and it is silently suppressing a real finding.`,
296
+ suggestion: `Add a reason: // eess-exclude ${ctx.metadata.id}: <why>. ` +
297
+ `A reason is prose and nothing verifies it, so this raises the cost of a ` +
298
+ `suppression rather than preventing one — the audience is the reviewer ` +
299
+ `reading the diff. If the exemption is not justifiable, delete it and fix ` +
300
+ `the finding instead. ${UNSUPPRESSABLE}`,
301
+ // No explicit `severity`. `bypassFilters` already forces `error` through
302
+ // `severityFor`, which every consumer path runs — `violations()`
303
+ // (`terminal-builder.ts:229`), `executeCheck` and `executeWarn`. Setting
304
+ // it here was dead: a sabotage row that flipped it to `warn` left the
305
+ // suite green, because the flag overrode it downstream. A line that
306
+ // reads load-bearing and is not is worse than no line.
307
+ bypassFilters: true,
308
+ });
309
+ }
310
+ }
311
+ return result;
312
+ }
313
+ /**
314
+ * Stamp any un-stamped violation with a default severity (per-violation wins),
315
+ * except a configuration meta-finding, which is always `error`.
316
+ *
317
+ * This is the site that mattered most and read as the safest: `?? severity`
318
+ * looks conservative, but five of the six `bypassFilters` producers set no
319
+ * severity at all, so on the `executeWarn` path every one of them resolved to
320
+ * `warn` — a finding saying "this rule enforces nothing", reported as advice.
321
+ */
322
+ function stampSeverity(violations, severity) {
323
+ return violations.map((v) => ({ ...v, severity: severityFor(v, v.severity ?? severity) }));
324
+ }
325
+ /**
326
+ * Write a severity-aware, single-document report for the given format.
327
+ *
328
+ * Shared by the CLI runner and the throwing `check` terminal so the three
329
+ * format branches live in one place:
330
+ * - `json` ALWAYS emits one valid document (even with zero violations) so
331
+ * consumers/agents can parse a clean run.
332
+ * - `github` partitions by severity so warnings render as `::warning`, not
333
+ * `::error`.
334
+ * - terminal (default) writes the rich format to stderr.
335
+ *
336
+ * Terminal/github emit nothing when there are no violations.
337
+ */
338
+ export function writeReport(violations, format, reason,
339
+ /** Allowlist rules that tested no edges, for the JSON document (bug 0015). */
340
+ untested = []) {
341
+ // Counted at the top, before the json early-return, so every path that writes
342
+ // is counted once. See `violationsWritten()` for why this is an emission count
343
+ // and not a suppression count.
344
+ violationsWrittenHere += violations.length;
345
+ if (format === 'json') {
346
+ process.stdout.write(formatViolationsJson(violations, reason, untested) + '\n');
347
+ return;
348
+ }
349
+ if (violations.length === 0)
350
+ return;
351
+ if (format === 'github') {
352
+ const errors = violations.filter((v) => (v.severity ?? 'error') === 'error');
353
+ const warnings = violations.filter((v) => v.severity === 'warn');
354
+ const parts = [];
355
+ if (errors.length > 0)
356
+ parts.push(formatViolationsGitHub(errors, 'error'));
357
+ if (warnings.length > 0)
358
+ parts.push(formatViolationsGitHub(warnings, 'warning'));
359
+ process.stdout.write(parts.join('\n') + '\n');
360
+ }
361
+ else {
362
+ writeStderr(formatViolations(violations, reason));
363
+ }
364
+ }
365
+ /**
366
+ * Whether a caller aggregates and reports every finding itself.
367
+ *
368
+ * The CLI does: it collects across all rule files and calls `writeReport` once, so a
369
+ * per-rule terminal that also writes produces the finding twice — measured on the real
370
+ * CLI as two `Architecture Violation [1 of 1]` blocks with identical content while
371
+ * `--format json` said 1 (bug 0029).
372
+ *
373
+ * **Only the findings the aggregator can actually recover may be suppressed**, which
374
+ * means only the ones that travel on the thrown `ArchRuleError`. A `.warn()` whose
375
+ * violations are ordinary does not throw, and the CLI never calls `.violations()` on a
376
+ * self-executing rule file — so those exist nowhere else and must always be written or
377
+ * they are lost outright.
378
+ *
379
+ * Default false, because the in-test path has no aggregator: nothing catches the error
380
+ * and re-renders it, so `ArchRuleError.message` — a one-line summary by design — would
381
+ * be all a reader gets, losing the finding's message, its remedy and the sentence
382
+ * saying it cannot be suppressed.
383
+ */
384
+ let callerAggregatesReports = false;
385
+ let violationsWrittenHere = 0;
386
+ /**
387
+ * Run `fn` with report aggregation on, restoring the previous value afterwards.
388
+ *
389
+ * **A dynamic extent, not a latch.** This replaced an exported
390
+ * `setCallerAggregatesReports(on)` that the CLI called once and nothing ever set
391
+ * back. Aggregation is a property of a RUN, and while `executeCheck` was the only
392
+ * reader the difference was invisible — the CLI wanted suppression for its whole
393
+ * life. It stopped being invisible the moment `deliver()` and `checkAll()` read it
394
+ * too (bug 0203): measured, a preset called directly in a process that had already
395
+ * run `runCheck` once emitted **6 violation blocks before and 0 after**. It still
396
+ * threw, so nothing went falsely green — but the report, the `Why:` and the `Fix:`
397
+ * were gone, with no signal that anything had been swallowed.
398
+ *
399
+ * Not an option on `CheckOptions`: a self-executing rule file writes `.check()`
400
+ * with no arguments and a preset is called by the RULE FILE, not by the CLI, so
401
+ * there is no per-call site the CLI could set. This is a property of who is
402
+ * driving the run.
403
+ *
404
+ * Restores rather than clears, so nesting cannot switch a still-running outer
405
+ * aggregation off.
406
+ */
407
+ export async function withCallerAggregating(fn) {
408
+ const previous = callerAggregatesReports;
409
+ callerAggregatesReports = true;
410
+ try {
411
+ return await fn();
412
+ }
413
+ finally {
414
+ callerAggregatesReports = previous;
415
+ }
416
+ }
417
+ /**
418
+ * How many violations have actually been WRITTEN by either emitter, ever.
419
+ *
420
+ * Read as a delta across one rule file's evaluation, this answers the only
421
+ * question the CLI's "your output was not filtered" notice may assert: *did
422
+ * anything emit while that module was loading?*
423
+ *
424
+ * **This replaced an inverted signal, and the inversion was a measured defect.**
425
+ * The first version counted the writes `executeCheck` SUPPRESSED and concluded
426
+ * "then nothing leaked" from the absence of a suppression. That is a double
427
+ * negative, and a rule file that suppresses one terminal while leaking through
428
+ * another satisfies it while leaking — measured: a `report: 'warn'` preset plus a
429
+ * silenced `.check()` in one file leaked 7 violation blocks and the notice stayed
430
+ * silent. A silence built from a stale signal is worse than the false claim it was
431
+ * introduced to fix, because the run says nothing at all.
432
+ *
433
+ * **Three emitters are counted, not two, and an earlier version of this docblock
434
+ * got the list wrong.** It said `writeReport` was "used by `executeCheck`,
435
+ * `executeWarn` and `check-all.ts`" — `executeWarn` does not call it. It writes
436
+ * through `writeStderr` / `process.stdout.write` directly, with its own
437
+ * json/github/terminal branching, so it moved neither counter and the leak
438
+ * detector could not see it. Measured: a live `.warn()` beside a throwing
439
+ * `.check()` under `--baseline` leaked its advisory findings in silence.
440
+ *
441
+ * The three: this module's `writeReport` (`executeCheck`, `check-all.ts`), this
442
+ * module's `executeWarn` advisory write, and the kernel's `reportViolations`
443
+ * (`finishPreset`). Missing any one reproduces the blind spot on that path — which
444
+ * is exactly what happened, twice.
445
+ *
446
+ * That every emitter must be counted, and that nothing enforces it, is
447
+ * [bug 0205](../../../../work/bugs/0205-four-emitters-restate-the-suppression-rule-and-disagree.md).
448
+ */
449
+ /**
450
+ * Is a caller aggregating reports for this run?
451
+ *
452
+ * Exposed so the two OTHER ts-side emitters can honour the same contract
453
+ * `executeCheck` does: `presets/shared.ts`'s `deliver()` and `core/check-all.ts`.
454
+ * Both used to emit unconditionally, so a preset or a `checkAll()` at module scope
455
+ * printed its findings before the aggregating caller saw them — and the caller then
456
+ * reported the same violations again off the throw. Bug 0203.
457
+ */
458
+ export function callerAggregates() {
459
+ return callerAggregatesReports;
460
+ }
461
+ export function violationsWritten() {
462
+ return violationsWrittenHere + violationsEmittedCount();
463
+ }
464
+ /**
465
+ * Execute the terminal "check" action: apply options, format, throw on violations.
466
+ */
467
+ export function executeCheck(violations, ctx, options) {
468
+ let filtered = applyFilters(violations, ctx);
469
+ if (options?.baseline) {
470
+ filtered = options.baseline.filterNew(filtered);
471
+ }
472
+ if (options?.diff) {
473
+ // Per rule, so no run total exists here — state the configuration once per
474
+ // process instead of printing one line per rule (plan 0071,
475
+ // `core/diff-disclosure.ts`).
476
+ const before = filtered.length;
477
+ filtered = options.diff.filterToChanged(filtered);
478
+ const notice = activeNotice(before - filtered.length, options.diff.size, options.diff.baseBranch);
479
+ if (notice !== undefined)
480
+ writeStderr(notice);
481
+ }
482
+ if (filtered.length > 0) {
483
+ const stamped = stampSeverity(filtered, 'error');
484
+ // Bug 0201. `executeWarn` below has honoured this flag since it shipped;
485
+ // `executeCheck` never did, so a `.check()` at module scope printed its
486
+ // findings before the aggregating caller could filter them — which is the
487
+ // whole of bug 0199 on this path. Measured: the leak goes 4 violations → 0.
488
+ //
489
+ // Safe for every other caller because the flag defaults to `false` and only
490
+ // the CLI sets it: a `.check()` in a test file, where there is no aggregator,
491
+ // still prints exactly as before.
492
+ //
493
+ // The violations are NOT lost when we stay quiet — they ride the throw, which
494
+ // is the same reason `executeWarn` may suppress only its `bypassFilters`
495
+ // entries and must still write the rest.
496
+ if (!callerAggregatesReports)
497
+ writeReport(stamped, options?.format, ctx.reason);
498
+ throw new ArchRuleError(stamped, ctx.reason);
499
+ }
500
+ }
501
+ /**
502
+ * Execute the terminal "warn" action: apply options, format, log to stderr.
503
+ *
504
+ * Advisory for ordinary violations, which are logged exactly as before and
505
+ * never throw. **A `bypassFilters` configuration finding throws**, carrying
506
+ * only those findings.
507
+ *
508
+ * `.warn()` says "this rule's violations are advisory". A finding that the
509
+ * rule enforces nothing is not a violation of the rule — it reports that the
510
+ * rule cannot fire — and there is nothing advisory about that. Leaving the
511
+ * hole open would make `.warn()` the documented escape hatch for exactly the
512
+ * class of finding this release exists to surface, on exactly the
513
+ * gradual-adoption audience the docs point at it.
514
+ *
515
+ * The payload matters as much as the throw: an error carrying 200 warn-level
516
+ * violations plus one meta-finding would make "these findings are true" false
517
+ * for 200 of 201 entries. `.violations()` remains the non-throwing
518
+ * programmatic surface.
519
+ */
520
+ export function executeWarn(violations, ctx, options) {
521
+ let filtered = applyFilters(violations, ctx);
522
+ if (options?.baseline) {
523
+ filtered = options.baseline.filterNew(filtered);
524
+ }
525
+ if (options?.diff) {
526
+ // Per rule, so no run total exists here — state the configuration once per
527
+ // process instead of printing one line per rule (plan 0071,
528
+ // `core/diff-disclosure.ts`).
529
+ const before = filtered.length;
530
+ filtered = options.diff.filterToChanged(filtered);
531
+ const notice = activeNotice(before - filtered.length, options.diff.size, options.diff.baseBranch);
532
+ if (notice !== undefined)
533
+ writeStderr(notice);
534
+ }
535
+ if (filtered.length > 0) {
536
+ const stamped = stampSeverity(filtered, 'warn');
537
+ const configFindings = stamped.filter((v) => v.bypassFilters === true);
538
+ // Write only what the throw will NOT carry.
539
+ //
540
+ // This used to write `stamped` in full and then throw the configuration
541
+ // findings, so those were reported twice: once here and once by whoever
542
+ // caught the error and reported `error.violations`. Measured on the CLI —
543
+ // two `Architecture Violation [1 of 1]` blocks with identical content, while
544
+ // `--format json` said 1 (bug 0029).
545
+ //
546
+ // Splitting rather than skipping the write entirely, because the ordinary
547
+ // warn-level violations are NOT on the error — it deliberately carries only
548
+ // the configuration findings, so that "these findings are true" stays true
549
+ // for every entry. Dropping the write would lose them.
550
+ // The configuration findings ride on the throw, so an aggregator re-reports them
551
+ // and writing here would duplicate. Everything else exists only here.
552
+ const advisory = callerAggregatesReports
553
+ ? stamped.filter((v) => v.bypassFilters !== true)
554
+ : stamped;
555
+ if (advisory.length > 0) {
556
+ // Counted, because this is an EMISSION and an aggregating caller's leak
557
+ // detector reads emissions. This function does not go through `writeReport`
558
+ // — it has its own json/github/terminal branching, deliberately, so that a
559
+ // json run's stdout document stays the caller's alone — and that made it
560
+ // invisible: measured, a live `.warn()` beside a throwing `.check()` under
561
+ // `--baseline` printed its advisory findings unfiltered while
562
+ // `violationsWritten()` reported nothing written, so the "your filters did
563
+ // not reach this" notice stayed silent. Bug 0199's false negative, reopened
564
+ // through the one emitter this module's own docblock claimed was covered.
565
+ violationsWrittenHere += advisory.length;
566
+ if (options?.format === 'json') {
567
+ writeStderr(formatViolationsJson(advisory, ctx.reason));
568
+ }
569
+ else if (options?.format === 'github') {
570
+ process.stdout.write(formatViolationsGitHub(advisory, 'warning') + '\n');
571
+ }
572
+ else {
573
+ writeStderr(formatViolations(advisory, ctx.reason));
574
+ }
575
+ }
576
+ if (configFindings.length > 0)
577
+ throw new ArchRuleError(configFindings, ctx.reason);
578
+ }
579
+ }
580
+ //# sourceMappingURL=execute-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-rule.js","sourceRoot":"","sources":["../../src/core/execute-rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AAExB,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,WAAW,EACX,sBAAsB,GACvB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAErF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAe9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAC1B,UAA2B,EAC3B,GAAuB;IAEvB,iFAAiF;IACjF,wEAAwE;IACxE,EAAE;IACF,yFAAyF;IACzF,2FAA2F;IAC3F,wFAAwF;IACxF,gFAAgF;IAChF,2FAA2F;IAC3F,4FAA4F;IAC5F,0FAA0F;IAC1F,oEAAoE;IACpE,EAAE;IACF,0FAA0F;IAC1F,yFAAyF;IACzF,iCAAiC;IACjC,IAAI,MAAM,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAA;IAE/C,8EA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