@nielspeter/eess-ts 0.2.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (467) hide show
  1. package/README.md +61 -35
  2. package/dist/builders/call-rule-builder.d.ts +66 -26
  3. package/dist/builders/call-rule-builder.d.ts.map +1 -1
  4. package/dist/builders/call-rule-builder.js +75 -32
  5. package/dist/builders/call-rule-builder.js.map +1 -1
  6. package/dist/builders/class-rule-builder.d.ts +125 -26
  7. package/dist/builders/class-rule-builder.d.ts.map +1 -1
  8. package/dist/builders/class-rule-builder.js +141 -55
  9. package/dist/builders/class-rule-builder.js.map +1 -1
  10. package/dist/builders/correspondence-builder.d.ts +287 -0
  11. package/dist/builders/correspondence-builder.d.ts.map +1 -0
  12. package/dist/builders/correspondence-builder.js +385 -0
  13. package/dist/builders/correspondence-builder.js.map +1 -0
  14. package/dist/builders/correspondence-findings.d.ts +104 -0
  15. package/dist/builders/correspondence-findings.d.ts.map +1 -0
  16. package/dist/builders/correspondence-findings.js +301 -0
  17. package/dist/builders/correspondence-findings.js.map +1 -0
  18. package/dist/builders/cross-layer-builder.d.ts +99 -16
  19. package/dist/builders/cross-layer-builder.d.ts.map +1 -1
  20. package/dist/builders/cross-layer-builder.js +182 -35
  21. package/dist/builders/cross-layer-builder.js.map +1 -1
  22. package/dist/builders/function-rule-builder.d.ts +144 -25
  23. package/dist/builders/function-rule-builder.d.ts.map +1 -1
  24. package/dist/builders/function-rule-builder.js +177 -39
  25. package/dist/builders/function-rule-builder.js.map +1 -1
  26. package/dist/builders/jsx-rule-builder.d.ts +70 -14
  27. package/dist/builders/jsx-rule-builder.d.ts.map +1 -1
  28. package/dist/builders/jsx-rule-builder.js +73 -14
  29. package/dist/builders/jsx-rule-builder.js.map +1 -1
  30. package/dist/builders/module-rule-builder.d.ts +2 -2
  31. package/dist/builders/module-rule-builder.d.ts.map +1 -1
  32. package/dist/builders/module-rule-builder.js +16 -19
  33. package/dist/builders/module-rule-builder.js.map +1 -1
  34. package/dist/builders/scoped-function-rule-builder.d.ts +11 -0
  35. package/dist/builders/scoped-function-rule-builder.d.ts.map +1 -1
  36. package/dist/builders/scoped-function-rule-builder.js +12 -0
  37. package/dist/builders/scoped-function-rule-builder.js.map +1 -1
  38. package/dist/builders/slice-discovery-message.d.ts +36 -0
  39. package/dist/builders/slice-discovery-message.d.ts.map +1 -0
  40. package/dist/builders/slice-discovery-message.js +181 -0
  41. package/dist/builders/slice-discovery-message.js.map +1 -0
  42. package/dist/builders/slice-rule-builder.d.ts +151 -12
  43. package/dist/builders/slice-rule-builder.d.ts.map +1 -1
  44. package/dist/builders/slice-rule-builder.js +243 -35
  45. package/dist/builders/slice-rule-builder.js.map +1 -1
  46. package/dist/builders/type-rule-builder.d.ts +95 -24
  47. package/dist/builders/type-rule-builder.d.ts.map +1 -1
  48. package/dist/builders/type-rule-builder.js +109 -42
  49. package/dist/builders/type-rule-builder.js.map +1 -1
  50. package/dist/{helpers → builders}/within.d.ts +2 -2
  51. package/dist/builders/within.d.ts.map +1 -0
  52. package/dist/{helpers → builders}/within.js +1 -1
  53. package/dist/builders/within.js.map +1 -0
  54. package/dist/cli/commands/baseline.d.ts +8 -3
  55. package/dist/cli/commands/baseline.d.ts.map +1 -1
  56. package/dist/cli/commands/baseline.js +111 -7
  57. package/dist/cli/commands/baseline.js.map +1 -1
  58. package/dist/cli/commands/check.d.ts +7 -2
  59. package/dist/cli/commands/check.d.ts.map +1 -1
  60. package/dist/cli/commands/check.js +385 -47
  61. package/dist/cli/commands/check.js.map +1 -1
  62. package/dist/cli/commands/doctor.d.ts +29 -0
  63. package/dist/cli/commands/doctor.d.ts.map +1 -0
  64. package/dist/cli/commands/doctor.js +224 -0
  65. package/dist/cli/commands/doctor.js.map +1 -0
  66. package/dist/cli/commands/explain.d.ts +2 -1
  67. package/dist/cli/commands/explain.d.ts.map +1 -1
  68. package/dist/cli/commands/explain.js +19 -10
  69. package/dist/cli/commands/explain.js.map +1 -1
  70. package/dist/cli/commands/init.d.ts +9 -3
  71. package/dist/cli/commands/init.d.ts.map +1 -1
  72. package/dist/cli/commands/init.js +162 -137
  73. package/dist/cli/commands/init.js.map +1 -1
  74. package/dist/cli/import-rule-module.d.ts +29 -0
  75. package/dist/cli/import-rule-module.d.ts.map +1 -0
  76. package/dist/cli/import-rule-module.js +47 -0
  77. package/dist/cli/import-rule-module.js.map +1 -0
  78. package/dist/cli/index.d.ts +2 -2
  79. package/dist/cli/index.d.ts.map +1 -1
  80. package/dist/cli/index.js +101 -43
  81. package/dist/cli/index.js.map +1 -1
  82. package/dist/cli/load-rules.d.ts +6 -11
  83. package/dist/cli/load-rules.d.ts.map +1 -1
  84. package/dist/cli/load-rules.js +25 -32
  85. package/dist/cli/load-rules.js.map +1 -1
  86. package/dist/cli/resolve-config.d.ts +0 -8
  87. package/dist/cli/resolve-config.d.ts.map +1 -1
  88. package/dist/cli/resolve-config.js +25 -55
  89. package/dist/cli/resolve-config.js.map +1 -1
  90. package/dist/cli/rule-file-findings.d.ts +178 -0
  91. package/dist/cli/rule-file-findings.d.ts.map +1 -0
  92. package/dist/cli/rule-file-findings.js +351 -0
  93. package/dist/cli/rule-file-findings.js.map +1 -0
  94. package/dist/cli/watch.d.ts +17 -34
  95. package/dist/cli/watch.d.ts.map +1 -1
  96. package/dist/cli/watch.js +14 -129
  97. package/dist/cli/watch.js.map +1 -1
  98. package/dist/conditions/body-analysis-function.d.ts.map +1 -1
  99. package/dist/conditions/body-analysis-function.js +16 -7
  100. package/dist/conditions/body-analysis-function.js.map +1 -1
  101. package/dist/conditions/body-analysis-module.d.ts.map +1 -1
  102. package/dist/conditions/body-analysis-module.js +14 -9
  103. package/dist/conditions/body-analysis-module.js.map +1 -1
  104. package/dist/conditions/body-analysis.d.ts.map +1 -1
  105. package/dist/conditions/body-analysis.js +16 -7
  106. package/dist/conditions/body-analysis.js.map +1 -1
  107. package/dist/conditions/call.d.ts.map +1 -1
  108. package/dist/conditions/call.js +41 -19
  109. package/dist/conditions/call.js.map +1 -1
  110. package/dist/conditions/catch-analysis.d.ts +2 -1
  111. package/dist/conditions/catch-analysis.d.ts.map +1 -1
  112. package/dist/conditions/catch-analysis.js.map +1 -1
  113. package/dist/conditions/cross-layer.d.ts +2 -10
  114. package/dist/conditions/cross-layer.d.ts.map +1 -1
  115. package/dist/conditions/cross-layer.js +227 -23
  116. package/dist/conditions/cross-layer.js.map +1 -1
  117. package/dist/conditions/dependency.d.ts +35 -6
  118. package/dist/conditions/dependency.d.ts.map +1 -1
  119. package/dist/conditions/dependency.js +299 -45
  120. package/dist/conditions/dependency.js.map +1 -1
  121. package/dist/conditions/exports.d.ts.map +1 -1
  122. package/dist/conditions/exports.js +41 -37
  123. package/dist/conditions/exports.js.map +1 -1
  124. package/dist/conditions/function.d.ts.map +1 -1
  125. package/dist/conditions/function.js +19 -5
  126. package/dist/conditions/function.js.map +1 -1
  127. package/dist/conditions/helpers.d.ts +2 -1
  128. package/dist/conditions/helpers.d.ts.map +1 -1
  129. package/dist/conditions/helpers.js +4 -1
  130. package/dist/conditions/helpers.js.map +1 -1
  131. package/dist/conditions/jsx.d.ts.map +1 -1
  132. package/dist/conditions/jsx.js +7 -2
  133. package/dist/conditions/jsx.js.map +1 -1
  134. package/dist/conditions/match-identity.d.ts +43 -0
  135. package/dist/conditions/match-identity.d.ts.map +1 -0
  136. package/dist/conditions/match-identity.js +43 -0
  137. package/dist/conditions/match-identity.js.map +1 -0
  138. package/dist/conditions/members.d.ts.map +1 -1
  139. package/dist/conditions/members.js +20 -6
  140. package/dist/conditions/members.js.map +1 -1
  141. package/dist/conditions/reverse-dependency.d.ts +18 -5
  142. package/dist/conditions/reverse-dependency.d.ts.map +1 -1
  143. package/dist/conditions/reverse-dependency.js +155 -93
  144. package/dist/conditions/reverse-dependency.js.map +1 -1
  145. package/dist/conditions/slice.d.ts +86 -2
  146. package/dist/conditions/slice.d.ts.map +1 -1
  147. package/dist/conditions/slice.js +234 -53
  148. package/dist/conditions/slice.js.map +1 -1
  149. package/dist/conditions/structural.d.ts.map +1 -1
  150. package/dist/conditions/structural.js +16 -4
  151. package/dist/conditions/structural.js.map +1 -1
  152. package/dist/core/check-all.d.ts +19 -0
  153. package/dist/core/check-all.d.ts.map +1 -0
  154. package/dist/core/check-all.js +150 -0
  155. package/dist/core/check-all.js.map +1 -0
  156. package/dist/core/combinators.d.ts +48 -0
  157. package/dist/core/combinators.d.ts.map +1 -0
  158. package/dist/core/combinators.js +49 -0
  159. package/dist/core/combinators.js.map +1 -0
  160. package/dist/core/descendant-cache.d.ts +36 -0
  161. package/dist/core/descendant-cache.d.ts.map +1 -0
  162. package/dist/core/descendant-cache.js +117 -0
  163. package/dist/core/descendant-cache.js.map +1 -0
  164. package/dist/core/diagnose.d.ts +234 -0
  165. package/dist/core/diagnose.d.ts.map +1 -0
  166. package/dist/core/diagnose.js +390 -0
  167. package/dist/core/diagnose.js.map +1 -0
  168. package/dist/core/disk-set.d.ts +48 -0
  169. package/dist/core/disk-set.d.ts.map +1 -0
  170. package/dist/core/disk-set.js +218 -0
  171. package/dist/core/disk-set.js.map +1 -0
  172. package/dist/core/element-cache.d.ts +75 -0
  173. package/dist/core/element-cache.d.ts.map +1 -0
  174. package/dist/core/element-cache.js +32 -0
  175. package/dist/core/element-cache.js.map +1 -0
  176. package/dist/core/empty-project-advice.d.ts +75 -0
  177. package/dist/core/empty-project-advice.d.ts.map +1 -0
  178. package/dist/core/empty-project-advice.js +61 -0
  179. package/dist/core/empty-project-advice.js.map +1 -0
  180. package/dist/core/exclusion-comments.d.ts +19 -0
  181. package/dist/core/exclusion-comments.d.ts.map +1 -0
  182. package/dist/core/exclusion-comments.js +7 -0
  183. package/dist/core/exclusion-comments.js.map +1 -0
  184. package/dist/core/execute-rule.d.ts +158 -0
  185. package/dist/core/execute-rule.d.ts.map +1 -0
  186. package/dist/core/execute-rule.js +666 -0
  187. package/dist/core/execute-rule.js.map +1 -0
  188. package/dist/core/glob-diagnosis.d.ts +78 -0
  189. package/dist/core/glob-diagnosis.d.ts.map +1 -0
  190. package/dist/core/glob-diagnosis.js +134 -0
  191. package/dist/core/glob-diagnosis.js.map +1 -0
  192. package/dist/core/glob-evaluator.d.ts +48 -0
  193. package/dist/core/glob-evaluator.d.ts.map +1 -0
  194. package/dist/core/glob-evaluator.js +89 -0
  195. package/dist/core/glob-evaluator.js.map +1 -0
  196. package/dist/core/import-candidates.d.ts +60 -0
  197. package/dist/core/import-candidates.d.ts.map +1 -0
  198. package/dist/core/import-candidates.js +93 -0
  199. package/dist/core/import-candidates.js.map +1 -0
  200. package/dist/core/import-options.d.ts +55 -2
  201. package/dist/core/import-options.d.ts.map +1 -1
  202. package/dist/core/import-options.js +64 -0
  203. package/dist/core/import-options.js.map +1 -1
  204. package/dist/core/invalidate-on-modify.d.ts +20 -0
  205. package/dist/core/invalidate-on-modify.d.ts.map +1 -0
  206. package/dist/core/invalidate-on-modify.js +26 -0
  207. package/dist/core/invalidate-on-modify.js.map +1 -0
  208. package/dist/core/line-index.d.ts +3 -0
  209. package/dist/core/line-index.d.ts.map +1 -0
  210. package/dist/core/line-index.js +227 -0
  211. package/dist/core/line-index.js.map +1 -0
  212. package/dist/core/metric-violation.d.ts +86 -0
  213. package/dist/core/metric-violation.d.ts.map +1 -0
  214. package/dist/core/metric-violation.js +132 -0
  215. package/dist/core/metric-violation.js.map +1 -0
  216. package/dist/core/module-edges.d.ts +361 -0
  217. package/dist/core/module-edges.d.ts.map +1 -0
  218. package/dist/core/module-edges.js +593 -0
  219. package/dist/core/module-edges.js.map +1 -0
  220. package/dist/core/object-literal-functions.d.ts +42 -0
  221. package/dist/core/object-literal-functions.d.ts.map +1 -0
  222. package/dist/core/object-literal-functions.js +75 -0
  223. package/dist/core/object-literal-functions.js.map +1 -0
  224. package/dist/core/orphan-exclusions.d.ts +44 -0
  225. package/dist/core/orphan-exclusions.d.ts.map +1 -0
  226. package/dist/core/orphan-exclusions.js +224 -0
  227. package/dist/core/orphan-exclusions.js.map +1 -0
  228. package/dist/core/pair-condition.d.ts +32 -3
  229. package/dist/core/pair-condition.d.ts.map +1 -1
  230. package/dist/core/path-universe.d.ts +22 -0
  231. package/dist/core/path-universe.d.ts.map +1 -0
  232. package/dist/core/path-universe.js +45 -0
  233. package/dist/core/path-universe.js.map +1 -0
  234. package/dist/core/per-root-compiler-options.d.ts +20 -0
  235. package/dist/core/per-root-compiler-options.d.ts.map +1 -0
  236. package/dist/core/per-root-compiler-options.js +57 -0
  237. package/dist/core/per-root-compiler-options.js.map +1 -0
  238. package/dist/core/project-relative.d.ts +98 -0
  239. package/dist/core/project-relative.d.ts.map +1 -0
  240. package/dist/core/project-relative.js +185 -0
  241. package/dist/core/project-relative.js.map +1 -0
  242. package/dist/core/project.d.ts +7 -1
  243. package/dist/core/project.d.ts.map +1 -1
  244. package/dist/core/project.js +29 -4
  245. package/dist/core/project.js.map +1 -1
  246. package/dist/core/rule-builder.d.ts +303 -0
  247. package/dist/core/rule-builder.d.ts.map +1 -0
  248. package/dist/core/rule-builder.js +463 -0
  249. package/dist/core/rule-builder.js.map +1 -0
  250. package/dist/core/rule-declaration.d.ts +32 -0
  251. package/dist/core/rule-declaration.d.ts.map +1 -0
  252. package/dist/core/rule-declaration.js +88 -0
  253. package/dist/core/rule-declaration.js.map +1 -0
  254. package/dist/core/terminal-builder.d.ts +629 -0
  255. package/dist/core/terminal-builder.d.ts.map +1 -0
  256. package/dist/core/terminal-builder.js +807 -0
  257. package/dist/core/terminal-builder.js.map +1 -0
  258. package/dist/core/terminal-execution.d.ts +39 -0
  259. package/dist/core/terminal-execution.d.ts.map +1 -0
  260. package/dist/core/terminal-execution.js +103 -0
  261. package/dist/core/terminal-execution.js.map +1 -0
  262. package/dist/core/ts-comment-mask.d.ts +2 -0
  263. package/dist/core/ts-comment-mask.d.ts.map +1 -0
  264. package/dist/core/ts-comment-mask.js +102 -0
  265. package/dist/core/ts-comment-mask.js.map +1 -0
  266. package/dist/core/vacuity-diagnosis.d.ts +103 -0
  267. package/dist/core/vacuity-diagnosis.d.ts.map +1 -0
  268. package/dist/core/vacuity-diagnosis.js +415 -0
  269. package/dist/core/vacuity-diagnosis.js.map +1 -0
  270. package/dist/core/violation.d.ts +16 -11
  271. package/dist/core/violation.d.ts.map +1 -1
  272. package/dist/core/violation.js +33 -13
  273. package/dist/core/violation.js.map +1 -1
  274. package/dist/graphql/graphql-rule-builder.d.ts +95 -0
  275. package/dist/graphql/graphql-rule-builder.d.ts.map +1 -0
  276. package/dist/graphql/graphql-rule-builder.js +127 -0
  277. package/dist/graphql/graphql-rule-builder.js.map +1 -0
  278. package/dist/graphql/index.d.ts +1 -0
  279. package/dist/graphql/index.d.ts.map +1 -1
  280. package/dist/graphql/index.js +2 -1
  281. package/dist/graphql/index.js.map +1 -1
  282. package/dist/graphql/resolver-rule-builder.d.ts +44 -23
  283. package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
  284. package/dist/graphql/resolver-rule-builder.js +80 -72
  285. package/dist/graphql/resolver-rule-builder.js.map +1 -1
  286. package/dist/graphql/schema-loader.d.ts +21 -0
  287. package/dist/graphql/schema-loader.d.ts.map +1 -1
  288. package/dist/graphql/schema-loader.js +82 -12
  289. package/dist/graphql/schema-loader.js.map +1 -1
  290. package/dist/graphql/schema-predicates.d.ts.map +1 -1
  291. package/dist/graphql/schema-predicates.js +17 -12
  292. package/dist/graphql/schema-predicates.js.map +1 -1
  293. package/dist/graphql/schema-rule-builder.d.ts +15 -24
  294. package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
  295. package/dist/graphql/schema-rule-builder.js +39 -77
  296. package/dist/graphql/schema-rule-builder.js.map +1 -1
  297. package/dist/helpers/baseline-diagnostics.d.ts +45 -0
  298. package/dist/helpers/baseline-diagnostics.d.ts.map +1 -0
  299. package/dist/helpers/baseline-diagnostics.js +168 -0
  300. package/dist/helpers/baseline-diagnostics.js.map +1 -0
  301. package/dist/helpers/baseline-generator.d.ts +28 -0
  302. package/dist/helpers/baseline-generator.d.ts.map +1 -0
  303. package/dist/helpers/baseline-generator.js +27 -0
  304. package/dist/helpers/baseline-generator.js.map +1 -0
  305. package/dist/helpers/baseline.d.ts +336 -0
  306. package/dist/helpers/baseline.d.ts.map +1 -0
  307. package/dist/helpers/baseline.js +664 -0
  308. package/dist/helpers/baseline.js.map +1 -0
  309. package/dist/helpers/body-traversal.d.ts +27 -2
  310. package/dist/helpers/body-traversal.d.ts.map +1 -1
  311. package/dist/helpers/body-traversal.js +135 -16
  312. package/dist/helpers/body-traversal.js.map +1 -1
  313. package/dist/helpers/callback-extractor.d.ts.map +1 -1
  314. package/dist/helpers/callback-extractor.js +53 -84
  315. package/dist/helpers/callback-extractor.js.map +1 -1
  316. package/dist/helpers/complexity.d.ts +13 -5
  317. package/dist/helpers/complexity.d.ts.map +1 -1
  318. package/dist/helpers/complexity.js +15 -6
  319. package/dist/helpers/complexity.js.map +1 -1
  320. package/dist/helpers/diff-aware.d.ts +16 -0
  321. package/dist/helpers/diff-aware.d.ts.map +1 -0
  322. package/dist/helpers/diff-aware.js +16 -0
  323. package/dist/helpers/diff-aware.js.map +1 -0
  324. package/dist/helpers/matchers.d.ts +68 -7
  325. package/dist/helpers/matchers.d.ts.map +1 -1
  326. package/dist/helpers/matchers.js +164 -86
  327. package/dist/helpers/matchers.js.map +1 -1
  328. package/dist/helpers/slice-graph.d.ts +100 -8
  329. package/dist/helpers/slice-graph.d.ts.map +1 -1
  330. package/dist/helpers/slice-graph.js +126 -34
  331. package/dist/helpers/slice-graph.js.map +1 -1
  332. package/dist/helpers/tarjan.d.ts +0 -14
  333. package/dist/helpers/tarjan.d.ts.map +1 -1
  334. package/dist/helpers/tarjan.js +29 -16
  335. package/dist/helpers/tarjan.js.map +1 -1
  336. package/dist/index.d.ts +55 -19
  337. package/dist/index.d.ts.map +1 -1
  338. package/dist/index.js +67 -15
  339. package/dist/index.js.map +1 -1
  340. package/dist/models/arch-call.d.ts +3 -2
  341. package/dist/models/arch-call.d.ts.map +1 -1
  342. package/dist/models/arch-call.js.map +1 -1
  343. package/dist/models/arch-function.d.ts +54 -8
  344. package/dist/models/arch-function.d.ts.map +1 -1
  345. package/dist/models/arch-function.js +145 -8
  346. package/dist/models/arch-function.js.map +1 -1
  347. package/dist/models/arch-jsx-element.d.ts.map +1 -1
  348. package/dist/models/arch-jsx-element.js +18 -19
  349. package/dist/models/arch-jsx-element.js.map +1 -1
  350. package/dist/models/slice.d.ts +33 -9
  351. package/dist/models/slice.d.ts.map +1 -1
  352. package/dist/models/slice.js +129 -19
  353. package/dist/models/slice.js.map +1 -1
  354. package/dist/predicates/call.d.ts.map +1 -1
  355. package/dist/predicates/call.js +5 -0
  356. package/dist/predicates/call.js.map +1 -1
  357. package/dist/predicates/identity.d.ts +21 -0
  358. package/dist/predicates/identity.d.ts.map +1 -1
  359. package/dist/predicates/identity.js +75 -3
  360. package/dist/predicates/identity.js.map +1 -1
  361. package/dist/predicates/index.d.ts +1 -1
  362. package/dist/predicates/index.d.ts.map +1 -1
  363. package/dist/predicates/index.js +1 -1
  364. package/dist/predicates/index.js.map +1 -1
  365. package/dist/predicates/jsx.d.ts.map +1 -1
  366. package/dist/predicates/jsx.js +2 -1
  367. package/dist/predicates/jsx.js.map +1 -1
  368. package/dist/predicates/metrics.d.ts +4 -2
  369. package/dist/predicates/metrics.d.ts.map +1 -1
  370. package/dist/predicates/metrics.js +4 -2
  371. package/dist/predicates/metrics.js.map +1 -1
  372. package/dist/predicates/module.d.ts +4 -12
  373. package/dist/predicates/module.d.ts.map +1 -1
  374. package/dist/predicates/module.js +57 -37
  375. package/dist/predicates/module.js.map +1 -1
  376. package/dist/presets/agent-guardrails.d.ts +49 -16
  377. package/dist/presets/agent-guardrails.d.ts.map +1 -1
  378. package/dist/presets/agent-guardrails.js +308 -19
  379. package/dist/presets/agent-guardrails.js.map +1 -1
  380. package/dist/presets/boundaries.d.ts +46 -3
  381. package/dist/presets/boundaries.d.ts.map +1 -1
  382. package/dist/presets/boundaries.js +132 -23
  383. package/dist/presets/boundaries.js.map +1 -1
  384. package/dist/presets/data-layer.d.ts +23 -3
  385. package/dist/presets/data-layer.d.ts.map +1 -1
  386. package/dist/presets/data-layer.js +58 -16
  387. package/dist/presets/data-layer.js.map +1 -1
  388. package/dist/presets/index.d.ts +10 -5
  389. package/dist/presets/index.d.ts.map +1 -1
  390. package/dist/presets/index.js +19 -3
  391. package/dist/presets/index.js.map +1 -1
  392. package/dist/presets/layered.d.ts +47 -3
  393. package/dist/presets/layered.d.ts.map +1 -1
  394. package/dist/presets/layered.js +66 -29
  395. package/dist/presets/layered.js.map +1 -1
  396. package/dist/presets/recommended.d.ts +81 -10
  397. package/dist/presets/recommended.d.ts.map +1 -1
  398. package/dist/presets/recommended.js +25 -23
  399. package/dist/presets/recommended.js.map +1 -1
  400. package/dist/presets/shared.d.ts +267 -2
  401. package/dist/presets/shared.d.ts.map +1 -1
  402. package/dist/presets/shared.js +367 -4
  403. package/dist/presets/shared.js.map +1 -1
  404. package/dist/rules/code-quality.d.ts.map +1 -1
  405. package/dist/rules/code-quality.js +15 -6
  406. package/dist/rules/code-quality.js.map +1 -1
  407. package/dist/rules/hygiene.d.ts +1 -1
  408. package/dist/rules/hygiene.js +1 -1
  409. package/dist/rules/metrics-function.d.ts +2 -1
  410. package/dist/rules/metrics-function.d.ts.map +1 -1
  411. package/dist/rules/metrics-function.js +63 -39
  412. package/dist/rules/metrics-function.js.map +1 -1
  413. package/dist/rules/metrics.d.ts +2 -1
  414. package/dist/rules/metrics.d.ts.map +1 -1
  415. package/dist/rules/metrics.js +80 -47
  416. package/dist/rules/metrics.js.map +1 -1
  417. package/dist/smells/clusters.d.ts +78 -0
  418. package/dist/smells/clusters.d.ts.map +1 -0
  419. package/dist/smells/clusters.js +124 -0
  420. package/dist/smells/clusters.js.map +1 -0
  421. package/dist/smells/duplicate-bodies.d.ts +92 -5
  422. package/dist/smells/duplicate-bodies.d.ts.map +1 -1
  423. package/dist/smells/duplicate-bodies.js +203 -73
  424. package/dist/smells/duplicate-bodies.js.map +1 -1
  425. package/dist/smells/duplicate-report.d.ts +90 -0
  426. package/dist/smells/duplicate-report.d.ts.map +1 -0
  427. package/dist/smells/duplicate-report.js +344 -0
  428. package/dist/smells/duplicate-report.js.map +1 -0
  429. package/dist/smells/fingerprint.d.ts +20 -1
  430. package/dist/smells/fingerprint.d.ts.map +1 -1
  431. package/dist/smells/fingerprint.js +27 -3
  432. package/dist/smells/fingerprint.js.map +1 -1
  433. package/dist/smells/inconsistent-siblings.d.ts +128 -7
  434. package/dist/smells/inconsistent-siblings.d.ts.map +1 -1
  435. package/dist/smells/inconsistent-siblings.js +288 -86
  436. package/dist/smells/inconsistent-siblings.js.map +1 -1
  437. package/dist/smells/sibling-files.d.ts +47 -0
  438. package/dist/smells/sibling-files.d.ts.map +1 -0
  439. package/dist/smells/sibling-files.js +104 -0
  440. package/dist/smells/sibling-files.js.map +1 -0
  441. package/dist/smells/similar-pairs.d.ts +28 -0
  442. package/dist/smells/similar-pairs.d.ts.map +1 -0
  443. package/dist/smells/similar-pairs.js +134 -0
  444. package/dist/smells/similar-pairs.js.map +1 -0
  445. package/dist/smells/smell-builder.d.ts +57 -12
  446. package/dist/smells/smell-builder.d.ts.map +1 -1
  447. package/dist/smells/smell-builder.js +112 -14
  448. package/dist/smells/smell-builder.js.map +1 -1
  449. package/dist/smells/variation.d.ts +47 -0
  450. package/dist/smells/variation.d.ts.map +1 -0
  451. package/dist/smells/variation.js +90 -0
  452. package/dist/smells/variation.js.map +1 -0
  453. package/dist/tsconfig/index.d.ts +19 -0
  454. package/dist/tsconfig/index.d.ts.map +1 -0
  455. package/dist/tsconfig/index.js +20 -0
  456. package/dist/tsconfig/index.js.map +1 -0
  457. package/dist/tsconfig/tsconfig-builder.d.ts +42 -9
  458. package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
  459. package/dist/tsconfig/tsconfig-builder.js +65 -16
  460. package/dist/tsconfig/tsconfig-builder.js.map +1 -1
  461. package/package.json +4 -2
  462. package/dist/core/module-dependencies.d.ts +0 -28
  463. package/dist/core/module-dependencies.d.ts.map +0 -1
  464. package/dist/core/module-dependencies.js +0 -35
  465. package/dist/core/module-dependencies.js.map +0 -1
  466. package/dist/helpers/within.d.ts.map +0 -1
  467. package/dist/helpers/within.js.map +0 -1
@@ -1,3 +1,268 @@
1
- export { dispatchRule, validateOverrides, throwIfViolations, finishPreset } from '@nielspeter/eess';
2
- export type { RuleSeverity, PresetBaseOptions } from '@nielspeter/eess';
1
+ import type { ReportMode, OutputFormat } from '@nielspeter/eess';
2
+ import type { CollectResult } from '@nielspeter/eess';
3
+ /**
4
+ * What a preset can be asked to do with its rules.
5
+ *
6
+ * Deliberately a DIALECT type rather than a widening of the kernel's
7
+ * `ReportMode`: `'builders'` is not a reporting mode at all — it suppresses the
8
+ * run — and the kernel's `finishPreset` must never receive it. Keeping it here
9
+ * means the kernel's three emission modes stay exactly three.
10
+ */
11
+ export type PresetDelivery = ReportMode | 'builders';
12
+ import { validateOverrides } from '@nielspeter/eess';
13
+ import type { Predicate } from '@nielspeter/eess';
14
+ import type { Located } from '../predicates/identity.js';
15
+ import type { RuleMetadata } from '@nielspeter/eess';
16
+ import type { RuleBuilderLike } from '@nielspeter/eess';
17
+ export type RuleSeverity = 'error' | 'warn' | 'off';
18
+ /**
19
+ * A builder a preset can configure and hand back: `.rule()` / `.asSeverity()`
20
+ * chain (return `this`), `.violations()` runs it. Satisfied by both the
21
+ * `RuleBuilder` and `TerminalBuilder` hierarchies.
22
+ */
23
+ interface PresetRule {
24
+ rule(m: RuleMetadata): this;
25
+ asSeverity(level: 'error' | 'warn'): this;
26
+ /** Plan 0089's carrier — hoisted to `TerminalBuilder` by plan 0097, so every preset rule has it. */
27
+ expectEmpty(): this;
28
+ violations(): CollectResult;
29
+ }
30
+ /**
31
+ * Resolve a preset rule's effective severity and return it as a configured,
32
+ * UN-executed builder for the caller to spread into a rule array. `'off'` →
33
+ * empty array (spread-friendly). The returning-form replacement for the old
34
+ * self-executing `dispatchRule`.
35
+ *
36
+ * Takes the rule's full metadata, not just its id. It used to take an id and
37
+ * attach `{ id }` alone, which meant every rule in `strictBoundaries`,
38
+ * `layeredArchitecture` and `dataLayerIsolation` — 37 of them in
39
+ * `strictBoundaries` alone — failed with no `because` and no `suggestion`.
40
+ * ADR-009 rule 2 requires every failure to carry its sanctioned fix, and a
41
+ * preset is the one place a user cannot supply it themselves: they did not
42
+ * write the rule.
43
+ */
44
+ export declare function collectRule(builder: PresetRule, meta: RuleMetadata & {
45
+ id: string;
46
+ }, defaultSeverity: RuleSeverity, config: PresetBaseOptions | undefined, constructed?: string[]): RuleBuilderLike[];
47
+ /**
48
+ * Apply plan 0089's declaration carrier to one constructed rule.
49
+ *
50
+ * Exported because the presets build rules three different ways — through
51
+ * `collectRule`, through a local `push` helper, and through an inline loop — and
52
+ * a carrier that reached only one of them would be the shape ADR-009's Context
53
+ * table is about: a mechanism that covers the families someone remembered.
54
+ */
55
+ export declare function declareEmptyIfListed<T extends PresetRule>(builder: T, id: string, config: PresetBaseOptions | undefined): T;
56
+ /**
57
+ * The spelling a PRESET user must type to declare this rule empty — plan 0099.
58
+ *
59
+ * This is the single site that knows both facts the remedy needs: the rule's id,
60
+ * and that the caller is a preset which accepts `expectEmpty`. Core knows only
61
+ * the id, and used to guess from its `preset/` prefix — a naming convention, not
62
+ * a capability, and false for a hand-written rule or a third-party preset that
63
+ * never accepted the option.
64
+ *
65
+ * Applied to every preset rule, not only declared ones: the advice is printed on
66
+ * a rule that examined nothing, which is exactly the rule that has NOT been
67
+ * declared yet.
68
+ */
69
+ export declare function presetDeclarationSpelling(id: string): string;
70
+ /**
71
+ * Guard a preset's *discovery* step (ADR-008 / plan 0067): if a glob discovered
72
+ * no subjects, return a failing rule carrying a config-level meta-finding rather
73
+ * than silently generating no rules — the false green a boundaries/layers preset
74
+ * must never produce. The finding bypasses diff/baseline so it survives the
75
+ * standard CI mode.
76
+ */
77
+ export declare function assertDiscovered(discovered: readonly unknown[], finding: {
78
+ id: string;
79
+ glob: string;
80
+ remedy: string;
81
+ }): RuleBuilderLike[];
82
+ /**
83
+ * Options every preset accepts.
84
+ *
85
+ * `TRuleId` is that preset's own rule ids as a literal union, so a misspelled
86
+ * override key is a **compile error** rather than a silent no-op
87
+ * ([bug 0157](../../../../work/bugs/fixed/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md)).
88
+ * Measured before this: `'…/no-silent-cach': 'error'` left the rule at `warn`
89
+ * and the build green — the escalation the author asked for simply did not
90
+ * happen, and the only trace was a line on stderr.
91
+ *
92
+ * Catching it in the editor is strictly better than catching it at run time:
93
+ * zero CI cycles, and it fires while the author is still looking at the key.
94
+ * The runtime finding exists as well, for the paths a type cannot reach — a
95
+ * JavaScript consumer, a dynamically-built overrides object, a config read from
96
+ * disk.
97
+ *
98
+ * Defaults to `string`, so anything outside this package that extends
99
+ * `PresetBaseOptions` keeps compiling.
100
+ */
101
+ /**
102
+ * An unknown override key, as a failing configuration finding —
103
+ * [bug 0157](../../../../work/bugs/fixed/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md).
104
+ *
105
+ * `validateOverrides` writes a line to stderr and returns `void`. That is not a
106
+ * signal: measured, `'…/no-silent-cach': 'error'` left the rule at `warn`, the
107
+ * build passed, and the printed warning never reached the exit code. A rule the
108
+ * author asked to escalate silently did not.
109
+ *
110
+ * ## Why a sibling rather than changing `validateOverrides`
111
+ *
112
+ * That function is re-exported from `src/presets/index.ts` and documented with a
113
+ * `void` signature. Changing it to return rules is a **published API break** for
114
+ * a fault this bug concedes is low-frequency, and the user-visible outcome is
115
+ * identical either way — so it stays as it is and this sits beside it. ADR-008
116
+ * rule 6 says guard the guard, not break the API.
117
+ *
118
+ * `PresetBaseOptions` now types the key as a literal union, so most typos never
119
+ * reach here at all. This covers what a type cannot: JavaScript consumers, a
120
+ * dynamically-built overrides object, and `agent-guardrails`' template-literal
121
+ * ids, where the API segment is open by construction.
122
+ */
123
+ export declare function overrideFindings(overrides: Partial<Record<string, RuleSeverity>> | undefined, knownIds: readonly string[]): RuleBuilderLike[];
124
+ /**
125
+ * Findings for `expectEmpty` ids that bind to no constructed rule — plan 0089.
126
+ *
127
+ * The sibling of {@link overrideFindings}, and it fails for a sharper reason.
128
+ * An unknown override key leaves a rule at its default: an escalation that did
129
+ * not happen. An unknown `expectEmpty` id turns an **expiring assertion into
130
+ * nothing** — the author declared a state, the declaration bound to no rule, and
131
+ * once plan 0099's floor lands they are told to declare what they already
132
+ * declared, misspelled. That is bug 0017's shape, and ADR-009 rule 1 forbids
133
+ * answering it with a warning nobody reads.
134
+ *
135
+ * The unbound id is reported against the **constructed** set, not the declared
136
+ * one, so a rule switched `'off'` and still named here reports too — which is
137
+ * correct: `'off'` deleted the rule, so the declaration about it is dead.
138
+ */
139
+ export declare function declaredEmptyFindings(expectEmpty: readonly string[] | undefined, constructedIds: readonly string[]): RuleBuilderLike[];
140
+ /**
141
+ * Guard a preset's *construction* step (plan 0100): every rule this preset can
142
+ * build sits behind its own optional flag, and the required field is only the
143
+ * selector — so satisfying the type completely can still enable nothing.
144
+ * Measured: `agentGuardrails({ src })` and `dataLayerIsolation({ repositories })`
145
+ * both construct zero rules, on every corpus, and report nothing — the loop a
146
+ * user holds runs zero times and every gate is green.
147
+ *
148
+ * `attempted` is the id list the caller's OPTIONS asked for, computed BEFORE
149
+ * `overrides` is consulted — the same distinction plan 0099's floor draws
150
+ * between zero-subjects and declared-empty:
151
+ *
152
+ * - `attempted.length === 0` — no rule was ever enabled. A mistake: fire.
153
+ * - `attempted.length > 0` and nothing was constructed — every enabled rule
154
+ * was explicitly turned off (`overrides: { id: 'off' }`), which
155
+ * {@link UNSUPPRESSABLE}'s own text already treats as a permanent, legitimate
156
+ * decision, not a suppression. Silent.
157
+ *
158
+ * Fires only when `otherFindings` — every other config-finding builder this
159
+ * preset already produced (unknown override keys, unbound `expectEmpty`, a
160
+ * discovery guard) — is also empty, so a preset with a more specific cause
161
+ * reports that cause once, not this one stacked on top of it. Same ordering
162
+ * the zero-examined producer already states: report last, and only when
163
+ * nothing else already explained the emptiness.
164
+ *
165
+ * Returns the same `{ violations }`-only shape as {@link assertDiscovered} and
166
+ * {@link overrideFindings} — sufficient for both real consumers of a preset's
167
+ * `RuleBuilderLike[]` (`checkAll()`, `src/cli/load-rules.ts`), which call only
168
+ * `.violations()` on every array element, never `.check()`/`.warn()` on one
169
+ * item in isolation.
170
+ */
171
+ export declare function assertEnabled(attempted: readonly string[], otherFindings: readonly RuleBuilderLike[], finding: {
172
+ id: string;
173
+ presetName: string;
174
+ optionsHint: string;
175
+ }): RuleBuilderLike[];
176
+ export interface PresetBaseOptions<TRuleId extends string = string> {
177
+ overrides?: Partial<Record<TRuleId, RuleSeverity>>;
178
+ /**
179
+ * Delivery mode — [ADR-008](../../../../adr/008-caller-owns-reporting.md).
180
+ *
181
+ * How the preset delivers its result. **Omitting it runs the rules and
182
+ * throws** — ADR-008's documented default, and what published `eess-ts` has
183
+ * always done:
184
+ *
185
+ * - omitted / `'throw'` → run, emit once, then throw if anything failed;
186
+ * - `'return'` → run every rule and return the violations, emitting nothing;
187
+ * - `'warn'` → run and emit, without throwing;
188
+ * - `'builders'` → build the rules and run **nothing**, returning them for the
189
+ * caller to run (pair with `checkAll()`).
190
+ *
191
+ * `'builders'` is spelled out on purpose. Plan 0165 Phase 3 restored `report`
192
+ * "additive, by overload" and, as a side effect of the overload order, made
193
+ * the builder form what you got by saying *nothing* — so the documented
194
+ * onboarding path (a bare `layeredArchitecture(p, {…})` inside an `it()`)
195
+ * became a test that passed unconditionally on any codebase. Every other mode
196
+ * had a name; only this one was reachable by omission. Naming it restores the
197
+ * default the ADR states and keeps the capability (PR #72 review).
198
+ */
199
+ report?: PresetDelivery;
200
+ /** Output format for the emitting modes. Ignored when `report` is omitted. */
201
+ format?: OutputFormat;
202
+ /** Rationale threaded into emitted output. Ignored when `report` is omitted. */
203
+ reason?: string;
204
+ /**
205
+ * Rules of this preset whose empty state is **declared** — plan 0089.
206
+ *
207
+ * A preset user holds no builder, so they cannot reach `.expectEmpty()`. Once
208
+ * plan 0099's floor fails a check that examined nothing, their only other
209
+ * remedy is `overrides: { id: 'off' }` — which is permanent, never expires,
210
+ * and deletes the rule rather than declaring a fact about it. That is
211
+ * [ADR-009](../../../../adr/009-agent-first-failure-surfaces.md) rule 1's
212
+ * trained-suppression dynamic, produced by our own gate; ADR-010 part 3 makes
213
+ * a carrier binding for exactly this reason.
214
+ *
215
+ * Typed on the preset's own id union, like `overrides`, so a rename is a
216
+ * compile error rather than a silent no-op. **An id here that binds to no
217
+ * constructed rule is a failing configuration finding**, never a warning — see
218
+ * {@link declaredEmptyFindings}.
219
+ *
220
+ * ## One id can name several constructed rules
221
+ *
222
+ * `boundaries` and `layered` construct some ids many times — `no-cross-boundary`
223
+ * once per boundary, `restricted-packages` once per package, `test-isolation`
224
+ * once per boundary pair. Declaring such an id applies the assertion to **every**
225
+ * instance, so it holds only while all of them examine nothing, and the day one
226
+ * fills you get a false-declaration finding for that instance. The rule's real
227
+ * violations are still reported alongside it — `RuleBuilder.evaluate` used to
228
+ * discard them, which is how a genuine `imports "lodash"` finding went missing
229
+ * behind a declaration.
230
+ *
231
+ * `readonly` so a caller's `as const` list is accepted.
232
+ */
233
+ expectEmpty?: readonly TRuleId[];
234
+ }
235
+ /**
236
+ * Match a user-supplied glob against the file path **or** its parent directory.
237
+ *
238
+ * Preset options name a location — `repositories`, `shared`, a layer glob — and
239
+ * both spellings are natural: `'**\/repositories/**'` and
240
+ * `'**\/repositories/repo.ts'`. `resideInFolder` reads only the parent
241
+ * directory, so a preset that used it directly silently enforced **nothing**
242
+ * for a file glob: measured, `dataLayerIsolation({ repositories:
243
+ * '**\/repositories/bad-repo.ts' })` generated its two rules and reported 0
244
+ * violations on a fixture named `bad-repo` (bug 0018).
245
+ *
246
+ * The fix is to make the natural spelling work rather than to fail on it — the
247
+ * principle bug 0014 settled on, and 0067-C reached independently. `or()` is
248
+ * the right combinator for the glob model too: the declaration is dead only
249
+ * when **both** readings are, which is what `doctor` will report on it.
250
+ *
251
+ * Internal to presets on purpose. A user writing their own rule chooses
252
+ * `resideInFile` or `resideInFolder` knowing which they mean; a preset option
253
+ * has to accept whichever its caller wrote.
254
+ */
255
+ export declare function atPath<T extends Located>(glob: string, option?: string): Predicate<T>;
256
+ /**
257
+ * A preset's return value, honouring `report` when the caller named one.
258
+ *
259
+ * One definition, called by all five presets — the pre-copy code had this logic
260
+ * inline in each and they had already drifted over what `'print'` did.
261
+ */
262
+ export declare function deliver(builders: RuleBuilderLike[], options: {
263
+ report?: PresetDelivery;
264
+ format?: OutputFormat;
265
+ reason?: string;
266
+ } | undefined): RuleBuilderLike[] | CollectResult;
267
+ export { validateOverrides };
3
268
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/presets/shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACnG,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/presets/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,CAAA;AACpD,OAAO,EAGL,iBAAiB,EAGlB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAEnD;;;;GAIG;AACH,UAAU,UAAU;IAClB,IAAI,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAA;IACzC,oGAAoG;IACpG,WAAW,IAAI,IAAI,CAAA;IACnB,UAAU,IAAI,aAAa,CAAA;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACnC,eAAe,EAAE,YAAY,EAC7B,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,eAAe,EAAE,CAUnB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,EACvD,OAAO,EAAE,CAAC,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,iBAAiB,GAAG,SAAS,GACpC,CAAC,CAEH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,SAAS,OAAO,EAAE,EAC9B,OAAO,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpD,eAAe,EAAE,CAoBnB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GAAG,SAAS,EAC5D,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,eAAe,EAAE,CA8BnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC1C,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,eAAe,EAAE,CAkDnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,aAAa,EAAE,SAAS,eAAe,EAAE,EACzC,OAAO,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC/D,eAAe,EAAE,CAuBnB;AAED,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAChE,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;IAElD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;CACjC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAKrF;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,QAAQ,EAAE,eAAe,EAAE,EAC3B,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,cAAc,CAAC;IAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GACvF,eAAe,EAAE,GAAG,aAAa,CAyDnC;AAMD,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,5 +1,368 @@
1
- // The preset-dispatch infrastructure is dialect-independent and now lives in the
2
- // kernel (@nielspeter/eess). Re-exported here so existing preset imports
3
- // (`./shared.js`) keep working unchanged.
4
- export { dispatchRule, validateOverrides, throwIfViolations, finishPreset } from '@nielspeter/eess';
1
+ import { finishPreset, ArchRuleError, validateOverrides, mergeCollectResults, collectResult, } from '@nielspeter/eess';
2
+ import { callerAggregates } from '../core/execute-rule.js';
3
+ import { UNSUPPRESSABLE } from '@nielspeter/eess/internal';
4
+ import { resideInFile, resideInFolder } from '../predicates/identity.js';
5
+ import { or } from '../core/combinators.js';
6
+ /**
7
+ * Resolve a preset rule's effective severity and return it as a configured,
8
+ * UN-executed builder for the caller to spread into a rule array. `'off'` →
9
+ * empty array (spread-friendly). The returning-form replacement for the old
10
+ * self-executing `dispatchRule`.
11
+ *
12
+ * Takes the rule's full metadata, not just its id. It used to take an id and
13
+ * attach `{ id }` alone, which meant every rule in `strictBoundaries`,
14
+ * `layeredArchitecture` and `dataLayerIsolation` — 37 of them in
15
+ * `strictBoundaries` alone — failed with no `because` and no `suggestion`.
16
+ * ADR-009 rule 2 requires every failure to carry its sanctioned fix, and a
17
+ * preset is the one place a user cannot supply it themselves: they did not
18
+ * write the rule.
19
+ */
20
+ export function collectRule(builder, meta, defaultSeverity, config, constructed) {
21
+ const effective = config?.overrides?.[meta.id] ?? defaultSeverity;
22
+ if (effective === 'off')
23
+ return [];
24
+ // Record what was actually BUILT. `RuleBuilderLike` exposes no metadata, and
25
+ // the known-id list cannot answer this: these presets construct rules
26
+ // conditionally, so "known" and "constructed" differ by exactly the ids a
27
+ // declaration must not silently bind to.
28
+ constructed?.push(meta.id);
29
+ const stamped = { ...meta, declarationSpelling: presetDeclarationSpelling(meta.id) };
30
+ return [declareEmptyIfListed(builder.rule(stamped).asSeverity(effective), meta.id, config)];
31
+ }
32
+ /**
33
+ * Apply plan 0089's declaration carrier to one constructed rule.
34
+ *
35
+ * Exported because the presets build rules three different ways — through
36
+ * `collectRule`, through a local `push` helper, and through an inline loop — and
37
+ * a carrier that reached only one of them would be the shape ADR-009's Context
38
+ * table is about: a mechanism that covers the families someone remembered.
39
+ */
40
+ export function declareEmptyIfListed(builder, id, config) {
41
+ return config?.expectEmpty?.includes(id) === true ? builder.expectEmpty() : builder;
42
+ }
43
+ /**
44
+ * The spelling a PRESET user must type to declare this rule empty — plan 0099.
45
+ *
46
+ * This is the single site that knows both facts the remedy needs: the rule's id,
47
+ * and that the caller is a preset which accepts `expectEmpty`. Core knows only
48
+ * the id, and used to guess from its `preset/` prefix — a naming convention, not
49
+ * a capability, and false for a hand-written rule or a third-party preset that
50
+ * never accepted the option.
51
+ *
52
+ * Applied to every preset rule, not only declared ones: the advice is printed on
53
+ * a rule that examined nothing, which is exactly the rule that has NOT been
54
+ * declared yet.
55
+ */
56
+ export function presetDeclarationSpelling(id) {
57
+ return `expectEmpty: ['${id}'] in this preset's options`;
58
+ }
59
+ /**
60
+ * Guard a preset's *discovery* step (ADR-008 / plan 0067): if a glob discovered
61
+ * no subjects, return a failing rule carrying a config-level meta-finding rather
62
+ * than silently generating no rules — the false green a boundaries/layers preset
63
+ * must never produce. The finding bypasses diff/baseline so it survives the
64
+ * standard CI mode.
65
+ */
66
+ export function assertDiscovered(discovered, finding) {
67
+ if (discovered.length > 0)
68
+ return [];
69
+ const violation = {
70
+ rule: finding.id,
71
+ ruleId: finding.id,
72
+ element: finding.id,
73
+ file: '',
74
+ line: 0,
75
+ message: `Discovery matched 0 subjects for glob '${finding.glob}'. ${finding.remedy}`,
76
+ because: 'a preset that discovers nothing generates no rules, so the whole preset silently certifies nothing',
77
+ suggestion: finding.remedy,
78
+ severity: 'error',
79
+ bypassFilters: true,
80
+ };
81
+ // `examined: 0` and honest: these are CONFIGURATION findings, not rules that
82
+ // examined units. The receipt carries a violation, so the emitter's evidence
83
+ // gate passes it through untouched (ADR-014 §4 — a value already carrying a
84
+ // finding is red, and the emitter adds nothing to it).
85
+ return [{ violations: () => collectResult([violation], { examined: 0 }) }];
86
+ }
87
+ /**
88
+ * Options every preset accepts.
89
+ *
90
+ * `TRuleId` is that preset's own rule ids as a literal union, so a misspelled
91
+ * override key is a **compile error** rather than a silent no-op
92
+ * ([bug 0157](../../../../work/bugs/fixed/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md)).
93
+ * Measured before this: `'…/no-silent-cach': 'error'` left the rule at `warn`
94
+ * and the build green — the escalation the author asked for simply did not
95
+ * happen, and the only trace was a line on stderr.
96
+ *
97
+ * Catching it in the editor is strictly better than catching it at run time:
98
+ * zero CI cycles, and it fires while the author is still looking at the key.
99
+ * The runtime finding exists as well, for the paths a type cannot reach — a
100
+ * JavaScript consumer, a dynamically-built overrides object, a config read from
101
+ * disk.
102
+ *
103
+ * Defaults to `string`, so anything outside this package that extends
104
+ * `PresetBaseOptions` keeps compiling.
105
+ */
106
+ /**
107
+ * An unknown override key, as a failing configuration finding —
108
+ * [bug 0157](../../../../work/bugs/fixed/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md).
109
+ *
110
+ * `validateOverrides` writes a line to stderr and returns `void`. That is not a
111
+ * signal: measured, `'…/no-silent-cach': 'error'` left the rule at `warn`, the
112
+ * build passed, and the printed warning never reached the exit code. A rule the
113
+ * author asked to escalate silently did not.
114
+ *
115
+ * ## Why a sibling rather than changing `validateOverrides`
116
+ *
117
+ * That function is re-exported from `src/presets/index.ts` and documented with a
118
+ * `void` signature. Changing it to return rules is a **published API break** for
119
+ * a fault this bug concedes is low-frequency, and the user-visible outcome is
120
+ * identical either way — so it stays as it is and this sits beside it. ADR-008
121
+ * rule 6 says guard the guard, not break the API.
122
+ *
123
+ * `PresetBaseOptions` now types the key as a literal union, so most typos never
124
+ * reach here at all. This covers what a type cannot: JavaScript consumers, a
125
+ * dynamically-built overrides object, and `agent-guardrails`' template-literal
126
+ * ids, where the API segment is open by construction.
127
+ */
128
+ export function overrideFindings(overrides, knownIds) {
129
+ if (!overrides)
130
+ return [];
131
+ const known = new Set(knownIds);
132
+ const unknown = Object.keys(overrides).filter((key) => !known.has(key));
133
+ if (unknown.length === 0)
134
+ return [];
135
+ const violations = unknown.map((key) => ({
136
+ rule: `preset override '${key}'`,
137
+ ruleId: `preset/override/${key}`,
138
+ element: key,
139
+ file: '',
140
+ line: 0,
141
+ message: `Override key '${key}' matches no rule in this preset, so it does nothing — ` +
142
+ `the severity you set was never applied.`,
143
+ because: 'an override that names no rule silently leaves that rule at its default, ' +
144
+ 'which is a configured escalation that did not happen',
145
+ // Its own remedy, never the author's, and it names the alternatives because
146
+ // the commonest cause is a near-miss the reader cannot spot by staring.
147
+ suggestion: `Correct the key, or remove it. This preset's rules are: ${knownIds.join(', ')}. ` +
148
+ UNSUPPRESSABLE,
149
+ bypassFilters: true,
150
+ }));
151
+ // `examined: 0` and honest: these are CONFIGURATION findings, not rules that
152
+ // examined units. The receipt carries a violation, so the emitter's evidence
153
+ // gate passes it through untouched (ADR-014 §4 — a value already carrying a
154
+ // finding is red, and the emitter adds nothing to it).
155
+ return [{ violations: () => collectResult(violations, { examined: 0 }) }];
156
+ }
157
+ /**
158
+ * Findings for `expectEmpty` ids that bind to no constructed rule — plan 0089.
159
+ *
160
+ * The sibling of {@link overrideFindings}, and it fails for a sharper reason.
161
+ * An unknown override key leaves a rule at its default: an escalation that did
162
+ * not happen. An unknown `expectEmpty` id turns an **expiring assertion into
163
+ * nothing** — the author declared a state, the declaration bound to no rule, and
164
+ * once plan 0099's floor lands they are told to declare what they already
165
+ * declared, misspelled. That is bug 0017's shape, and ADR-009 rule 1 forbids
166
+ * answering it with a warning nobody reads.
167
+ *
168
+ * The unbound id is reported against the **constructed** set, not the declared
169
+ * one, so a rule switched `'off'` and still named here reports too — which is
170
+ * correct: `'off'` deleted the rule, so the declaration about it is dead.
171
+ */
172
+ export function declaredEmptyFindings(expectEmpty, constructedIds) {
173
+ if (!expectEmpty || expectEmpty.length === 0)
174
+ return [];
175
+ const built = new Set(constructedIds);
176
+ const unbound = [...new Set(expectEmpty)].filter((id) => !built.has(id));
177
+ if (unbound.length === 0)
178
+ return [];
179
+ // De-duplicated, because `boundaries` and `layered` push the same id once per
180
+ // boundary / layer / pair. Un-deduplicated this degenerates exactly where the
181
+ // reader needs it most: measured at 5 boundaries + 1 shared glob +
182
+ // `isolateTests`, the list ran to 31 entries naming 4 unique ids, with
183
+ // `test-isolation` repeated 20 consecutive times and the answer buried inside
184
+ // it. `overrideFindings` never had this problem only because it is handed
185
+ // `RULE_IDS`, which is unique by construction.
186
+ const uniqueConstructed = [...new Set(constructedIds)];
187
+ // When the preset built NOTHING, "correct the id" is a false remedy — the id
188
+ // is usually right and the cause is upstream (a discovery glob that matched
189
+ // no folders, or every rule overridden `off`). An agent that obeys it deletes
190
+ // a correct declaration, and plan 0099's floor then demands the declaration
191
+ // back: bug 0017's loop, which ADR-009 rule 2 forbids us to reintroduce.
192
+ const suggestion = uniqueConstructed.length === 0
193
+ ? `This preset constructed NO rules, so the cause is upstream of this id — check the ` +
194
+ `discovery glob that finds this preset's subjects, and whether every rule was set to 'off'. ` +
195
+ `Fix that first: the declaration is probably correct and will bind once rules exist. ` +
196
+ UNSUPPRESSABLE
197
+ : `Correct the id, or remove it. This preset constructed: ${uniqueConstructed.join(', ')}. ` +
198
+ `Note that a rule set to 'off' is not constructed, so a declaration naming it is dead. ` +
199
+ UNSUPPRESSABLE;
200
+ const violations = unbound.map((id) => ({
201
+ rule: `preset expectEmpty '${id}'`,
202
+ ruleId: `preset/expect-empty/${id}`,
203
+ element: id,
204
+ file: '',
205
+ line: 0,
206
+ message: `expectEmpty names '${id}', which this preset did not construct, so the ` +
207
+ `declaration applies to nothing.`,
208
+ because: 'a declaration that binds to no rule is not a weaker assertion, it is no assertion — ' +
209
+ 'and it reads in the config as though the empty state has been accounted for',
210
+ suggestion,
211
+ bypassFilters: true,
212
+ }));
213
+ // `examined: 0` and honest: these are CONFIGURATION findings, not rules that
214
+ // examined units. The receipt carries a violation, so the emitter's evidence
215
+ // gate passes it through untouched (ADR-014 §4 — a value already carrying a
216
+ // finding is red, and the emitter adds nothing to it).
217
+ return [{ violations: () => collectResult(violations, { examined: 0 }) }];
218
+ }
219
+ /**
220
+ * Guard a preset's *construction* step (plan 0100): every rule this preset can
221
+ * build sits behind its own optional flag, and the required field is only the
222
+ * selector — so satisfying the type completely can still enable nothing.
223
+ * Measured: `agentGuardrails({ src })` and `dataLayerIsolation({ repositories })`
224
+ * both construct zero rules, on every corpus, and report nothing — the loop a
225
+ * user holds runs zero times and every gate is green.
226
+ *
227
+ * `attempted` is the id list the caller's OPTIONS asked for, computed BEFORE
228
+ * `overrides` is consulted — the same distinction plan 0099's floor draws
229
+ * between zero-subjects and declared-empty:
230
+ *
231
+ * - `attempted.length === 0` — no rule was ever enabled. A mistake: fire.
232
+ * - `attempted.length > 0` and nothing was constructed — every enabled rule
233
+ * was explicitly turned off (`overrides: { id: 'off' }`), which
234
+ * {@link UNSUPPRESSABLE}'s own text already treats as a permanent, legitimate
235
+ * decision, not a suppression. Silent.
236
+ *
237
+ * Fires only when `otherFindings` — every other config-finding builder this
238
+ * preset already produced (unknown override keys, unbound `expectEmpty`, a
239
+ * discovery guard) — is also empty, so a preset with a more specific cause
240
+ * reports that cause once, not this one stacked on top of it. Same ordering
241
+ * the zero-examined producer already states: report last, and only when
242
+ * nothing else already explained the emptiness.
243
+ *
244
+ * Returns the same `{ violations }`-only shape as {@link assertDiscovered} and
245
+ * {@link overrideFindings} — sufficient for both real consumers of a preset's
246
+ * `RuleBuilderLike[]` (`checkAll()`, `src/cli/load-rules.ts`), which call only
247
+ * `.violations()` on every array element, never `.check()`/`.warn()` on one
248
+ * item in isolation.
249
+ */
250
+ export function assertEnabled(attempted, otherFindings, finding) {
251
+ if (attempted.length > 0 || otherFindings.length > 0)
252
+ return [];
253
+ const violation = {
254
+ rule: finding.id,
255
+ ruleId: finding.id,
256
+ element: finding.id,
257
+ file: '',
258
+ line: 0,
259
+ message: `${finding.presetName}(...) satisfied every required option and constructed 0 rules — every ` +
260
+ `rule it can build sits behind an optional flag, and none was set, so this call enforces ` +
261
+ `nothing while every gate reports it as healthy.`,
262
+ because: 'a preset that constructs no rules has nothing for the fail-closed floor to reach — a ' +
263
+ 'function returning [] never calls collectViolations(), so no per-rule guard sees it',
264
+ suggestion: `Set at least one of: ${finding.optionsHint}. ` + UNSUPPRESSABLE,
265
+ bypassFilters: true,
266
+ };
267
+ // `examined: 0` and honest: these are CONFIGURATION findings, not rules that
268
+ // examined units. The receipt carries a violation, so the emitter's evidence
269
+ // gate passes it through untouched (ADR-014 §4 — a value already carrying a
270
+ // finding is red, and the emitter adds nothing to it).
271
+ return [{ violations: () => collectResult([violation], { examined: 0 }) }];
272
+ }
273
+ /**
274
+ * Match a user-supplied glob against the file path **or** its parent directory.
275
+ *
276
+ * Preset options name a location — `repositories`, `shared`, a layer glob — and
277
+ * both spellings are natural: `'**\/repositories/**'` and
278
+ * `'**\/repositories/repo.ts'`. `resideInFolder` reads only the parent
279
+ * directory, so a preset that used it directly silently enforced **nothing**
280
+ * for a file glob: measured, `dataLayerIsolation({ repositories:
281
+ * '**\/repositories/bad-repo.ts' })` generated its two rules and reported 0
282
+ * violations on a fixture named `bad-repo` (bug 0018).
283
+ *
284
+ * The fix is to make the natural spelling work rather than to fail on it — the
285
+ * principle bug 0014 settled on, and 0067-C reached independently. `or()` is
286
+ * the right combinator for the glob model too: the declaration is dead only
287
+ * when **both** readings are, which is what `doctor` will report on it.
288
+ *
289
+ * Internal to presets on purpose. A user writing their own rule chooses
290
+ * `resideInFile` or `resideInFolder` knowing which they mean; a preset option
291
+ * has to accept whichever its caller wrote.
292
+ */
293
+ export function atPath(glob, option) {
294
+ const combined = or(resideInFile(glob), resideInFolder(glob));
295
+ // The option name, when the caller knows it, so a configuration finding names
296
+ // `shared: "…"` rather than the two calls `or()` expanded into (plan 0074).
297
+ return option === undefined ? combined : { ...combined, originLabel: `${option}: "${glob}"` };
298
+ }
299
+ /**
300
+ * A preset's return value, honouring `report` when the caller named one.
301
+ *
302
+ * One definition, called by all five presets — the pre-copy code had this logic
303
+ * inline in each and they had already drifted over what `'print'` did.
304
+ */
305
+ export function deliver(builders, options) {
306
+ // Only an EXPLICIT 'builders' returns without running. Omission falls through
307
+ // to `finishPreset`, whose own default is 'throw' — so a preset called with no
308
+ // options enforces, which is what ADR-008 states and what the docs teach.
309
+ if (options?.report === 'builders')
310
+ return builders;
311
+ // `flatMap` would drop every receipt's evidence on the floor — the exact site
312
+ // plan 0235's Phase 3 names. The kernel merge is fail-closed and is the only
313
+ // place the `examined` sum and the sourceEmpty/declaredEmpty precedence are
314
+ // stated once (bug 0205's class is four emitters restating that rule and
315
+ // disagreeing).
316
+ //
317
+ // A preset that constructed NO builders merges zero members: `examined: 0`,
318
+ // no declaration, no violations — and the emitter's gate then produces
319
+ // `emitter/pass-without-evidence`. That is the all-off case (bug 0261)
320
+ // falling out of the contract rather than needing a guard of its own, which
321
+ // is what ADR-014 §3's 2026-09-05 amendment settled: a declaration is one a
322
+ // caller made, never one eess infers from a config.
323
+ const violations = mergeCollectResults(builders.map((b) => b.violations()));
324
+ const mode = options?.report ?? 'throw';
325
+ // **Bug 0203 — enforce, but let an aggregating caller do the reporting.**
326
+ //
327
+ // `finishPreset` emits and then throws. Under `eess-ts check` that printed the
328
+ // findings before the CLI saw them, and the CLI then reported the same
329
+ // violations again off the throw: one violation, two blocks, two contradicting
330
+ // counters, with no flags involved. Measured on a rule file carried over from
331
+ // `@nielspeter/ts-archunit` — 13 blocks, 6 exact duplicates.
332
+ //
333
+ // The throw is kept, so behaviour is unchanged for everyone: the caller still
334
+ // learns the run failed, and the violations ride the error exactly as
335
+ // `executeCheck`'s do. Only the emission moves.
336
+ //
337
+ // ONLY for the default 'throw' mode. `'warn'` and `'return'` are explicit
338
+ // choices about emission that a caller made on purpose, and `'warn'`'s
339
+ // violations do NOT ride a throw — suppressing them here would lose them.
340
+ if (mode === 'throw' && callerAggregates()) {
341
+ // **The gate runs here too — bug 0206.** This branch used to return before
342
+ // `finishPreset` was ever called, so everything the finisher adds was
343
+ // invisible to an aggregating caller: an all-off preset threw nothing and
344
+ // reported nothing under `eess-ts check`, while the same preset on the
345
+ // default path reported correctly. Two doors, two verdicts, and only one of
346
+ // them tested — which is exactly what 0206 is about.
347
+ //
348
+ // `report: 'return'` because the aggregating caller owns emission (bug
349
+ // 0203); only the EMISSION moves, never the verdict. The receipt then rides
350
+ // the throw with the finding already in it, which is 0206's picked
351
+ // direction.
352
+ const gated = finishPreset(violations, { report: 'return' });
353
+ if (gated.length > 0)
354
+ throw new ArchRuleError(gated, options?.reason);
355
+ return gated;
356
+ }
357
+ return finishPreset(violations, {
358
+ report: mode,
359
+ format: options?.format,
360
+ reason: options?.reason,
361
+ });
362
+ }
363
+ // The kernel's — this package carried a byte-identical copy differing only in
364
+ // two signature widths, which the kernel adopted. Re-exported (from the ROOT,
365
+ // not `/internal`, so ADR-011 clause 2 is satisfied) because `recommended` and
366
+ // `agent-guardrails` import it from here.
367
+ export { validateOverrides };
5
368
  //# sourceMappingURL=shared.js.map