@nielspeter/eess-ts 0.2.0 → 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 +87 -34
  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 -14
  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,168 @@
1
+ import { hashSubject, HASH_VERSION } from './baseline.js';
2
+ /**
3
+ * A meta-finding for baseline entries that stopped matching because the
4
+ * **rule's description changed**, not because the violation was fixed.
5
+ *
6
+ * The distinction is the whole difficulty (bug 0027). An entry that stops
7
+ * matching is normally success — that is what a ratchet is for — so "some
8
+ * entries did not match" is not evidence of anything, which is why
9
+ * \{@link unmatchedBaselineFinding\} is gated on `matched === 0` and stays
10
+ * silent here. But that leaves the common case unexplained: an accepted
11
+ * violation reported as new, reading like fresh rot in application code.
12
+ *
13
+ * `hashSubject` is the differently-derived value that separates them. A
14
+ * violation in this run whose subject matches a baseline entry, under a
15
+ * different full hash, is the same finding about the same code under a rule
16
+ * whose description moved. A subject present in the baseline and absent from
17
+ * the run was fixed, and says nothing.
18
+ *
19
+ * Silent for a baseline written before 0.24.0: those entries have no subject,
20
+ * so the question cannot be asked and no cause is guessed.
21
+ */
22
+ /**
23
+ * The rule description the baseline recorded for this violation's subject, when
24
+ * the violation looks like the SAME finding under a renamed rule.
25
+ *
26
+ * Extracted from `descriptionChangeFinding` so the four disqualifying cases
27
+ * read as one question with one answer instead of four `continue`s inside the
28
+ * accumulating loop (they were most of that method's branching).
29
+ */
30
+ function renamedRuleFor(ctx, violation) {
31
+ if (violation.bypassFilters === true)
32
+ return undefined;
33
+ if (ctx.isKnown(violation))
34
+ return undefined;
35
+ // A regressed metric is not a renamed rule (bug 0012). Its hash is in the
36
+ // baseline — the description is demonstrably unchanged — and only the
37
+ // measurement moved, so `isKnown` is false while `hasEntry` is true. Without
38
+ // this the ratchet's own working case reported "1 rule whose description
39
+ // changed", which is a false cause under ADR-009 rule 2.
40
+ if (ctx.hasEntry(violation))
41
+ return undefined;
42
+ return ctx.knownSubjects.get(hashSubject(violation, ctx.root));
43
+ }
44
+ export function descriptionChangeFinding(ctx, violations) {
45
+ if (ctx.knownSubjects.size === 0)
46
+ return undefined;
47
+ // Rule descriptions the baseline recorded for subjects this run re-reported
48
+ // under a different identity. A Map keyed by the OLD description, so the
49
+ // same edited rule is named once however many violations it has.
50
+ const changed = new Map();
51
+ for (const violation of violations) {
52
+ const recordedRule = renamedRuleFor(ctx, violation);
53
+ if (recordedRule !== undefined)
54
+ changed.set(recordedRule, violation.rule);
55
+ }
56
+ if (changed.size === 0)
57
+ return undefined;
58
+ const where = ctx.sourcePath ?? 'the baseline file';
59
+ // Identities, never a total (ADR-009 rule 4): name the rules, both spellings,
60
+ // so the reader can see WHAT changed rather than being told how many did.
61
+ const pairs = [...changed.entries()]
62
+ .map(([was, now]) => `\n was: ${was}\n now: ${now}`)
63
+ .join('');
64
+ const plural = changed.size === 1 ? 'rule' : 'rules';
65
+ return {
66
+ rule: 'eess-ts: baseline',
67
+ element: 'baseline',
68
+ file: '',
69
+ line: 0,
70
+ message: `Baseline at ${where} no longer matches ${String(changed.size)} ${plural} whose ` +
71
+ `description changed, so already-accepted violations of ${changed.size === 1 ? 'it' : 'them'} ` +
72
+ `are being reported as new. This is not new rot in your code — the rule was edited, ` +
73
+ `or its conditions accumulated (v0.23.0):${pairs}`,
74
+ because: "A violation's identity includes the rule description, so editing a rule re-reports every violation it had already accepted — indistinguishable from a regression unless it is named.",
75
+ suggestion: `Regenerate the baseline: \`npx eess-ts baseline <your-rule-files> --output ${where}\`. Review the diff: the entries that vanish are the ones listed above, and their replacements should be the same violations under the new description.`,
76
+ bypassFilters: true,
77
+ };
78
+ }
79
+ /**
80
+ * A meta-finding for a baseline that is present, non-empty, and matched
81
+ * **nothing** in a run that produced findings it could have matched.
82
+ *
83
+ * Gated on the measurement, not on the version field. An earlier cut fired
84
+ * whenever `hashVersion` was older, which was wrong for most users: v2
85
+ * hashing is byte-identical to v1 for any violation whose fields contain no
86
+ * path, so the majority of existing baselines still match perfectly. Failing
87
+ * those with "its entries match nothing" was both a false red and a false
88
+ * statement — a derived value reported as a fact with nothing disagreeing
89
+ * with it, which is the ADR-009 rule 5 mistake this bug was about.
90
+ *
91
+ * `matched === 0` is the independently-derived signal, and it covers every
92
+ * cause at once: a v1 file, a root that resolved differently here than where
93
+ * the file was written, or a baseline for a different project entirely.
94
+ *
95
+ * Silent when the run produced nothing to match (`matchable === 0`) — an
96
+ * empty run is not evidence about the baseline. Carries `bypassFilters`
97
+ * because the filters are what it is reporting on (ADR-008; plan 0067).
98
+ */
99
+ export function unmatchedBaselineFinding(ctx, matched, matchable) {
100
+ if (ctx.knownHashes.size === 0 || matchable === 0 || matched > 0)
101
+ return undefined;
102
+ const where = ctx.sourcePath ?? 'the baseline file';
103
+ const entries = ctx.knownHashes.size;
104
+ const plural = entries === 1 ? 'entry' : 'entries';
105
+ const cause = unmatchedCause(ctx);
106
+ return {
107
+ rule: 'eess-ts: baseline',
108
+ element: 'baseline',
109
+ file: '',
110
+ line: 0,
111
+ message: `Baseline at ${where} matched 0 of its ${String(entries)} ${plural} against ` +
112
+ `${String(matchable)} finding(s) in this run, so every one of them is being reported as new. ${cause}`,
113
+ because: 'A baseline that matches nothing is indistinguishable from a mass regression, and silently reporting the whole set as new hides which of the two happened (bug 0010).',
114
+ suggestion: ctx.hashVersion > HASH_VERSION
115
+ ? 'Upgrade eess-ts to a version that reads this format.'
116
+ : // `<your-rule-files>` stands in for the caller's own paths on
117
+ // purpose: the command needs rule files unless a config supplies
118
+ // them, and printed without them it fails with "No rule files
119
+ // specified" — a remedy that
120
+ // cannot remediate (ADR-009 rule 2). Measured. The path is left as
121
+ // recorded rather than absolutized, so the line is copyable on a
122
+ // machine other than the one that wrote the baseline.
123
+ `Regenerate it: \`npx eess-ts baseline <your-rule-files> --output ${where}\` (rule files are implied if an eess-ts config lists them). Review the diff first — entries that vanish were never matching here.`,
124
+ bypassFilters: true,
125
+ };
126
+ }
127
+ /**
128
+ * Why a baseline matched nothing — or, where nothing can be told apart, the
129
+ * candidates in order.
130
+ *
131
+ * Extracted from {@link unmatchedBaselineFinding} so that method stays inside
132
+ * `eess/max-method-lines`, which bug 0170 re-derived from span lines to code
133
+ * lines. Most of what was there was this decision.
134
+ */
135
+ function unmatchedCause(ctx) {
136
+ if (ctx.hashVersion < HASH_VERSION) {
137
+ return `It was written in identity format v${String(ctx.hashVersion)} and this version reads v${String(HASH_VERSION)}, which is the likely cause.`;
138
+ }
139
+ if (ctx.hashVersion > HASH_VERSION) {
140
+ return `It was written in identity format v${String(ctx.hashVersion)}, which is newer than this version reads (v${String(HASH_VERSION)}) — upgrade eess-ts rather than regenerating.`;
141
+ }
142
+ // **Do not assert a cause that has not been distinguished from its alternatives.**
143
+ //
144
+ // This branch used to say "Same identity format, so the likely cause is that it
145
+ // was generated against a different repository root". That is one cause among
146
+ // several and the code has checked none of them —
147
+ // [ts-archunit bug 0060](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0060-a-pattern-change-silently-invalidates-every-baselined-finding.md),
148
+ // where a shipped default pattern changed and a reader spent an hour on `root`
149
+ // before regenerating, which is the outcome ts-archunit's `docs/upgrading.md` exists to prevent.
150
+ //
151
+ // The rename detector above cannot cover it either: when a pattern changes, the
152
+ // rule description AND the subject move together, so `hashSubject` misses and
153
+ // that diagnostic stays silent. Nothing here can tell these apart, so the honest
154
+ // output is the candidate list, ordered, with the version-specific one first
155
+ // because upgrading is when this happens.
156
+ return ('The identity format is unchanged, so one of its INPUTS moved.\n' +
157
+ ' This code cannot tell which. In order of likelihood:\n' +
158
+ ' 1. you upgraded, and a shipped rule description or default pattern changed —\n' +
159
+ ' check the CHANGELOG entry for the version you moved to, which says so when\n' +
160
+ ' it happens. If this is it, regenerating is correct and expected.\n' +
161
+ ' 2. you upgraded, and a metric changed WHAT IT COUNTS (bug 0171). Those entries\n' +
162
+ ' normally still match and report themselves — but a rule edited in the same\n' +
163
+ ' release moves the identity too, and then they land here instead.\n' +
164
+ ' 3. the baseline was generated against a different repository root — see the\n' +
165
+ ' `root` option on withBaseline()/generateBaseline().\n' +
166
+ ' 4. the rules themselves were edited.');
167
+ }
168
+ //# sourceMappingURL=baseline-diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-diagnostics.js","sourceRoot":"","sources":["../../src/helpers/baseline-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAwBzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,GAAkB,EAAE,SAAwB;IAClE,IAAI,SAAS,CAAC,aAAa,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IACtD,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IAC5C,0EAA0E;IAC1E,sEAAsE;IACtE,6EAA6E;IAC7E,yEAAyE;IACzE,yDAAyD;IACzD,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IAC7C,OAAO,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,GAAkB,EAClB,UAA2B;IAE3B,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAClD,4EAA4E;IAC5E,yEAAyE;IACzE,iEAAiE;IACjE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAA;IACzC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,YA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AC,8CAA8C,MAAM,CAAC,YAAY,CAAC,+CAA+C,CAAA;IACvL,CAAC;IACD,mFAAmF;IACnF,EAAE;IACF,gFAAgF;IAChF,8EAA8E;IAC9E,kDAAkD;IAClD,gKAAgK;IAChK,+EAA+E;IAC/E,iGAAiG;IACjG,EAAE;IACF,gFAAgF;IAChF,8EAA8E;IAC9E,iFAAiF;IACjF,6EAA6E;IAC7E,0CAA0C;IAC1C,OAAO,CACL,iEAAiE;QACjE,0DAA0D;QAC1D,oFAAoF;QACpF,qFAAqF;QACrF,2EAA2E;QAC3E,sFAAsF;QACtF,qFAAqF;QACrF,2EAA2E;QAC3E,mFAAmF;QACnF,8DAA8D;QAC9D,0CAA0C,CAC3C,CAAA;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { ArchViolation } from '@nielspeter/eess';
2
+ /**
3
+ * Collect violations from rules WITHOUT throwing.
4
+ *
5
+ * Used to generate a baseline: run all rules via their non-throwing
6
+ * `.violations()` terminal (severity-stamped), and write them to a baseline
7
+ * file.
8
+ *
9
+ * @example
10
+ * const violations = collectViolations(
11
+ * classes(p).that().extend('Base').should().notContain(call('parseInt')),
12
+ * classes(p).that().extend('Base').should().notContain(newExpr('Error')),
13
+ * )
14
+ * generateBaseline(violations, 'arch-baseline.json')
15
+ */
16
+ export declare function collectViolations(...builders: Array<{
17
+ violations: () => ArchViolation[];
18
+ }>): ArchViolation[];
19
+ //# sourceMappingURL=baseline-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-generator.d.ts","sourceRoot":"","sources":["../../src/helpers/baseline-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,QAAQ,EAAE,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,aAAa,EAAE,CAAA;CAAE,CAAC,GACxD,aAAa,EAAE,CAEjB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Collect violations from rules WITHOUT throwing.
3
+ *
4
+ * Used to generate a baseline: run all rules via their non-throwing
5
+ * `.violations()` terminal (severity-stamped), and write them to a baseline
6
+ * file.
7
+ *
8
+ * @example
9
+ * const violations = collectViolations(
10
+ * classes(p).that().extend('Base').should().notContain(call('parseInt')),
11
+ * classes(p).that().extend('Base').should().notContain(newExpr('Error')),
12
+ * )
13
+ * generateBaseline(violations, 'arch-baseline.json')
14
+ */
15
+ export function collectViolations(...builders) {
16
+ return builders.flatMap((builder) => builder.violations());
17
+ }
18
+ //# sourceMappingURL=baseline-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-generator.js","sourceRoot":"","sources":["../../src/helpers/baseline-generator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAG,QAAsD;IAEzD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;AAC5D,CAAC"}
@@ -0,0 +1,336 @@
1
+ import type { ArchViolation } from '@nielspeter/eess';
2
+ /**
3
+ * Identity-hash format version.
4
+ *
5
+ * 1 — sha256(rule::element::message) verbatim; absolute paths leak in.
6
+ * 2 — the repository root is replaced with a token first, so identity is
7
+ * portable across checkouts (bug 0010).
8
+ *
9
+ * Note that v2 is byte-identical to v1 for any violation whose fields contain
10
+ * no path, so most v1 baselines keep matching. The version alone is therefore
11
+ * NOT grounds to fail — see `unmatchedBaselineFinding`, which fires on the
12
+ * measurement instead.
13
+ * 4 — bug 0012. Metric findings gained a producer-set `identity`
14
+ * (`file::element::metric`) and an accepted `measured` value, so every entry
15
+ * for the ten size and complexity conditions hashes differently. The v3
16
+ * precedent applies exactly: `hashViolation`'s FORMULA is untouched and one
17
+ * of its inputs moved, which is the case the 0.23.0 withdrawal established
18
+ * is worth a bump only when the identity of existing entries actually
19
+ * changes. It does here, for that family and no other — a baseline with no
20
+ * metric entries is byte-identical and keeps matching.
21
+ *
22
+ */
23
+ export declare const HASH_VERSION = 5;
24
+ /**
25
+ * A single entry in the baseline file.
26
+ *
27
+ * Violations are identified by rule + file + content hash.
28
+ * Line numbers are stored for human readability but NOT used for matching —
29
+ * they drift as code moves. The content hash (of the violation message +
30
+ * element name) provides stable identity.
31
+ */
32
+ export interface BaselineEntry {
33
+ /** Rule description (from the fluent chain) */
34
+ rule: string;
35
+ /** File path relative to the identity root (see `root` below), forward-slashed */
36
+ file: string;
37
+ /** Line number at time of baseline (informational, not used for matching) */
38
+ line: number;
39
+ /** Stable identity hash: sha256(rule + element + message) */
40
+ hash: string;
41
+ /**
42
+ * The measurement this entry accepted, for a metric finding (bug 0012).
43
+ *
44
+ * Present only on metric findings. `filterNew` suppresses such a finding
45
+ * while the current measurement is **no greater** than this, so improving a
46
+ * metric stays green and regressing past the accepted value fails. Without
47
+ * it the message's embedded count made every change — in either direction —
48
+ * a new finding, and paying down debt turned the build red.
49
+ */
50
+ measured?: number;
51
+ /**
52
+ * What {@link measured} counts — `code-lines`, `methods`, `complexity`.
53
+ *
54
+ * Written since bug 0171 and optional. Absent means the entry predates unit
55
+ * stamping, which {@link Baseline.isKnown} treats as "unknown unit": still
56
+ * comparable for the metrics whose meaning has never changed, and NOT
57
+ * comparable for `code-lines`, because such an entry necessarily recorded a
58
+ * span. That distinction is the whole point — see {@link MEANING_NEVER_CHANGED}.
59
+ */
60
+ measuredUnit?: string;
61
+ /**
62
+ * Subject hash: sha256(element + message), i.e. identity WITHOUT the rule
63
+ * description. Written since 0.24.0 and optional, so a baseline from an
64
+ * earlier version still loads — it simply cannot be diagnosed when an entry
65
+ * stops matching, which is honest degradation rather than a guessed cause.
66
+ * See \{@link hashSubject\} for what it is for.
67
+ */
68
+ subject?: string;
69
+ }
70
+ /** A measurement an entry accepted, and what that number counts (bugs 0012, 0171). */
71
+ interface AcceptedMeasurement {
72
+ value: number;
73
+ /** `undefined` on any entry written before unit stamping — see {@link measurementComparable}. */
74
+ unit?: string;
75
+ }
76
+ /**
77
+ * The baseline file structure.
78
+ */
79
+ export interface BaselineFile {
80
+ /** ISO timestamp when the baseline was generated */
81
+ generatedAt: string;
82
+ /**
83
+ * Identity-hash format version. Absent means 1 — a baseline written before
84
+ * paths were stripped from identity, whose hashes cannot be matched.
85
+ */
86
+ hashVersion?: number;
87
+ /**
88
+ * Where the identity root sits **relative to this file**, e.g. `'../..'`.
89
+ *
90
+ * Recorded rather than re-derived because generation and loading otherwise
91
+ * discover the root independently, and a disagreement between them is
92
+ * silent: every hash differs, the baseline matches nothing, and the format
93
+ * version is identical on both sides so nothing notices. A relative position
94
+ * is a property of the repository layout, so it is the same on every machine
95
+ * — which is exactly what the absolute root is not.
96
+ */
97
+ root?: string;
98
+ /** Number of violations recorded */
99
+ count: number;
100
+ /** The violations */
101
+ violations: BaselineEntry[];
102
+ }
103
+ /**
104
+ * Compute a stable hash for a violation.
105
+ *
106
+ * Uses rule + element + message as identity. This survives:
107
+ * - Line number changes (code moved)
108
+ * - Unrelated code changes in the same file
109
+ * - **The checkout's absolute location** — see `root` below
110
+ *
111
+ * Does NOT survive:
112
+ * - Rule DESCRIPTION changes — the assembled `that … should …` text, i.e. editing
113
+ * the rule's predicates or conditions. **Not** `.because()`: that sets
114
+ * `because`, which is not hashed. The old wording said "(rewording
115
+ * .because())" and it was false — measured, two violations differing only in
116
+ * `because` hash identically, and so do two differing only in `suggestion`.
117
+ * The distinction is load-bearing: it is what makes correcting a preset's
118
+ * remedy text a patch rather than a change that invalidates every consumer's
119
+ * baseline (bug 0017, whose own defect was a remedy claiming something it
120
+ * could not do — sitting in the docstring a compat auditor would check).
121
+ * - Element renames (class renamed)
122
+ * - Message text changes (condition wording updated)
123
+ *
124
+ * This is intentional — if the rule or element changes,
125
+ * the violation should be re-evaluated.
126
+ *
127
+ * @param root - Repository/workspace root. Every occurrence of it inside the
128
+ * rule, element and message is replaced with a stable token before hashing.
129
+ * Producers interpolate absolute paths into those fields, so without a root
130
+ * the identity encodes the checkout directory and a baseline written on one
131
+ * machine matches nothing on another (bug 0010). Omitting it preserves the
132
+ * pre-0.19 hash and is only correct when no field contains a path.
133
+ */
134
+ export declare function hashViolation(violation: ArchViolation, root?: string): string;
135
+ /**
136
+ * The violation's **subject**: what was found, independent of which rule found it.
137
+ *
138
+ * `hashViolation` above is `rule::element::message`, so editing a rule's
139
+ * predicates or conditions — or accumulating them, which v0.23.0 made happen for
140
+ * a rule derived off a held rule — changes the identity of violations that did
141
+ * not change at all. Those entries stop matching and their already-accepted
142
+ * violations report as **new**, with nothing saying why (bug 0027).
143
+ *
144
+ * This is the differently-derived value that tells the two cases apart:
145
+ *
146
+ * | baseline entry did not match because… | subject present in the run? |
147
+ * | ------------------------------------- | --------------------------- |
148
+ * | the violation was fixed | no — stay silent, this is success |
149
+ * | the rule's description changed | yes — say so, and regenerate |
150
+ *
151
+ * Bug 0027's own suggested signal was "an entry whose `rule` string appears under
152
+ * a different hash", and it cannot work: the rule string is precisely what
153
+ * changed. Measured before this was built.
154
+ */
155
+ export declare function hashSubject(violation: ArchViolation, root?: string): string;
156
+ /**
157
+ * Options shared by baseline loading and generation.
158
+ */
159
+ export interface BaselineOptions {
160
+ /**
161
+ * Repository/workspace root used to make violation identity portable.
162
+ *
163
+ * Defaults to the **nearest** enclosing repository or workspace root above
164
+ * the baseline file — `.git`, then a monorepo marker (`pnpm-workspace.yaml`,
165
+ * `nx.json`, …) or a `package.json` declaring `workspaces`, then the nearest
166
+ * `package.json`. Nearest, not outermost: an ancestor that is also a repo (a
167
+ * home directory under dotfiles version control) would otherwise anchor above
168
+ * the checkout and leave machine-specific segments in the "relative" path.
169
+ *
170
+ * You should rarely need this. `generateBaseline` records where the root sat
171
+ * relative to the file, and `withBaseline` reuses that, so the two ends
172
+ * cannot silently disagree. Pass it only to override both — and then the
173
+ * value must be the same on every machine, so derive it from the repository
174
+ * layout, never from `process.cwd()`.
175
+ */
176
+ readonly root?: string;
177
+ }
178
+ /**
179
+ * Load a baseline from a JSON file.
180
+ *
181
+ * @param baselinePath - Path to the baseline JSON file
182
+ * @param options - See \{@link BaselineOptions\}
183
+ * @returns A Baseline object for use with check(\{ baseline \})
184
+ */
185
+ export declare function withBaseline(baselinePath: string, options?: BaselineOptions): Baseline;
186
+ /**
187
+ * Generate a baseline file from a list of violations.
188
+ *
189
+ * Call this to create/update the baseline:
190
+ * ```typescript
191
+ * const violations = collectAllViolations(rules)
192
+ * generateBaseline(violations, 'arch-baseline.json')
193
+ * ```
194
+ */
195
+ export declare function generateBaseline(violations: ArchViolation[], outputPath: string, options?: BaselineOptions): BaselineDelta;
196
+ /**
197
+ * The delta a `generateBaseline` call applied, for the caller to report.
198
+ *
199
+ * Plan 0071's second instrument. The 0.28.0 upgrade recipe is "refresh the
200
+ * baseline, commit, then upgrade", and its whole safety rests on the adopter
201
+ * seeing what that refresh accepted. Before this, `baseline` printed only the
202
+ * new total — so a refresh that accepted 37 findings and one that accepted none
203
+ * printed the same shape of line, and the number that mattered was the one
204
+ * nobody could see.
205
+ */
206
+ export interface BaselineDelta {
207
+ /** Entries in the file that was overwritten; `undefined` if there was none. */
208
+ readonly before: number | undefined;
209
+ /** Entries written now. */
210
+ readonly after: number;
211
+ /** Entries written now whose identity was not in the prior file. */
212
+ readonly added: number;
213
+ /** Prior entries whose identity is not in what was just written. */
214
+ readonly removed: number;
215
+ /** The prior file's hash version, when it had a readable one. */
216
+ readonly priorHashVersion?: number;
217
+ /** A prior file existed but could not be read as a baseline. */
218
+ readonly priorUnreadable: boolean;
219
+ }
220
+ /**
221
+ * The one-line delta, e.g. `41 → 78 entries (+37, −0)`.
222
+ *
223
+ * Kept beside {@link BaselineDelta} rather than in the CLI so the `baseline`
224
+ * command and any programmatic caller print the same sentence.
225
+ */
226
+ export declare function formatBaselineDelta(delta: BaselineDelta): string;
227
+ /**
228
+ * A loaded baseline. Passed to check(\{ baseline \}) to filter known violations.
229
+ */
230
+ export declare class Baseline {
231
+ private readonly knownHashes;
232
+ private readonly root;
233
+ private readonly hashVersion;
234
+ private readonly sourcePath?;
235
+ /**
236
+ * Subject hash -> the rule description recorded against it. Empty for a
237
+ * baseline written before 0.24.0, which disables the description-change
238
+ * diagnosis rather than guessing at it (bug 0027).
239
+ */
240
+ private readonly knownSubjects;
241
+ /**
242
+ * Hash -> the measurement accepted for it, for metric findings (bug 0012).
243
+ * Absent for every non-metric entry and for baselines written before this
244
+ * shipped, where equality of identity remains the right test.
245
+ */
246
+ private readonly acceptedMeasurements;
247
+ constructor(knownHashes: Set<string>, root: string, hashVersion?: number, sourcePath?: string | undefined,
248
+ /**
249
+ * Subject hash -> the rule description recorded against it. Empty for a
250
+ * baseline written before 0.24.0, which disables the description-change
251
+ * diagnosis rather than guessing at it (bug 0027).
252
+ */
253
+ knownSubjects?: ReadonlyMap<string, string>,
254
+ /**
255
+ * Hash -> the measurement accepted for it, for metric findings (bug 0012).
256
+ * Absent for every non-metric entry and for baselines written before this
257
+ * shipped, where equality of identity remains the right test.
258
+ */
259
+ acceptedMeasurements?: ReadonlyMap<string, AcceptedMeasurement>);
260
+ /**
261
+ * Check if a violation is known (exists in the baseline).
262
+ * Known violations are filtered out — they don't cause failures.
263
+ */
264
+ /**
265
+ * Whether the baseline holds an entry with this violation's identity.
266
+ *
267
+ * Distinct from {@link isKnown}, which also asks whether a metric finding is
268
+ * still within the measurement that entry accepted. A regressed metric has an
269
+ * entry and is not known.
270
+ */
271
+ hasEntry(violation: ArchViolation): boolean;
272
+ /**
273
+ * Whether this violation is already accepted by the baseline.
274
+ *
275
+ * Identity answers "is this the same finding?"; for a metric finding that is
276
+ * not enough, so a known hash is additionally required to be **no worse** than
277
+ * the accepted measurement — improving a metric stays green, regressing past
278
+ * the accepted value fails (bug 0012).
279
+ */
280
+ isKnown(violation: ArchViolation): boolean;
281
+ /**
282
+ * What the diagnoses in `baseline-diagnostics.ts` need, stated explicitly.
283
+ *
284
+ * An object rather than `this`, because the fields are `private readonly` and
285
+ * a diagnosis should depend on the facts it reads, not on the class that
286
+ * happens to hold them.
287
+ */
288
+ private facts;
289
+ /**
290
+ * Filter out known violations, returning only new ones.
291
+ *
292
+ * Config-level meta-findings (empty selector/discovery) are never baselined
293
+ * away — a regenerated baseline must not silence them (ADR-008; plan 0067).
294
+ *
295
+ * A baseline that matches **nothing** looks identical to "every accepted
296
+ * violation regressed at once", so that case is reported as what it is —
297
+ * see \{@link unmatchedBaselineFinding\}.
298
+ */
299
+ filterNew(violations: ArchViolation[]): ArchViolation[];
300
+ /**
301
+ * The stale-unit measurements in this run, grouped by the unit pair that
302
+ * changed — so one upgrade is described once however many elements it
303
+ * touched, with the identities carried inside.
304
+ *
305
+ * Extracted from {@link staleMeasurementFinding} because the four
306
+ * disqualifying cases are most of that method's branching, the same reason
307
+ * {@link renamedRuleFor} sits beside {@link descriptionChangeFinding}.
308
+ */
309
+ private staleMeasurementsByUnit;
310
+ /**
311
+ * The accepted measurement this violation matches but CANNOT be compared
312
+ * against, or `undefined` when there is no such conflict — which covers the
313
+ * ordinary cases too: not a metric finding, no matching entry, or a unit that
314
+ * still means what it meant.
315
+ */
316
+ private incomparableAcceptedFor;
317
+ /**
318
+ * A meta-finding for baselined metric entries whose accepted measurement is
319
+ * denominated in a unit this version no longer produces — bug 0171.
320
+ *
321
+ * Without it, the upgrade that changed a metric reports the affected classes
322
+ * as ordinary new violations. The author sees findings against code they did
323
+ * not touch, on a rule they had already baselined, with nothing connecting
324
+ * that to the release note — the "eess started reporting something new"
325
+ * failure ADR-009 rule 2 exists to prevent.
326
+ *
327
+ * This fires where `unmatchedBaselineFinding` structurally cannot: those
328
+ * entries MATCH. Identity is intact and only the unit moved, so `matched` is
329
+ * non-zero and that check stays silent by design.
330
+ */
331
+ private staleMeasurementFinding;
332
+ /** Number of known violations in the baseline */
333
+ get size(): number;
334
+ }
335
+ export {};
336
+ //# sourceMappingURL=baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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