@md-code/follow-architecture 0.3.0 → 0.3.2

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 (387) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1310 -472
  3. package/dist/args.d.ts +4 -0
  4. package/dist/args.js +18 -1
  5. package/dist/bin/follow-architecture.js +3 -3
  6. package/dist/closure-project.d.ts +4 -0
  7. package/dist/closure-project.js +132 -0
  8. package/dist/code-entities/classify.d.ts +11 -0
  9. package/dist/code-entities/classify.js +45 -0
  10. package/dist/code-entities/connector.d.ts +8 -0
  11. package/dist/code-entities/connector.js +119 -0
  12. package/dist/code-entities/entities.d.ts +9 -0
  13. package/dist/{code-roles/roles.js → code-entities/entities.js} +98 -61
  14. package/dist/code-entities/project.d.ts +21 -0
  15. package/dist/code-entities/project.js +259 -0
  16. package/dist/code-entities/walk.d.ts +31 -0
  17. package/dist/code-entities/walk.js +105 -0
  18. package/dist/config-options.d.ts +23 -0
  19. package/dist/config-options.js +18 -1
  20. package/dist/config-project.js +27 -9
  21. package/dist/config-report.d.ts +1 -1
  22. package/dist/config-report.js +37 -10
  23. package/dist/config-rule.d.ts +25 -0
  24. package/dist/config-rule.js +106 -13
  25. package/dist/config-state.d.ts +14 -3
  26. package/dist/config-state.js +197 -24
  27. package/dist/config.d.ts +25 -0
  28. package/dist/css/index.d.ts +11 -7
  29. package/dist/css/index.js +141 -30
  30. package/dist/css/syntax/css/gate.js +5 -5
  31. package/dist/css/syntax/css/index.d.ts +1 -1
  32. package/dist/css/syntax/css/index.js +18 -8
  33. package/dist/css/syntax/css/reference.d.ts +1 -1
  34. package/dist/css/syntax/css/reference.js +15 -3
  35. package/dist/css/syntax/language.d.ts +1 -1
  36. package/dist/css/syntax/language.js +21 -9
  37. package/dist/css/syntax/scss/index.d.ts +2 -2
  38. package/dist/css/syntax/scss/index.js +18 -8
  39. package/dist/css/syntax/scss/reference.d.ts +1 -1
  40. package/dist/css/syntax/scss/reference.js +7 -1
  41. package/dist/css/syntax/styled/document.d.ts +3 -3
  42. package/dist/css/syntax/styled/document.js +34 -14
  43. package/dist/css/syntax/styled/markup.d.ts +1 -1
  44. package/dist/css/syntax/styled/markup.js +22 -14
  45. package/dist/css/syntax/styled/tags.d.ts +2 -0
  46. package/dist/css/syntax/styled/tags.js +22 -0
  47. package/dist/css/syntax/styled/template.js +10 -4
  48. package/dist/css/syntax/tailwind/tailwind.js +4 -4
  49. package/dist/css/value/check.d.ts +1 -1
  50. package/dist/css/value/check.js +1 -1
  51. package/dist/css/value/expression/arithmetic.d.ts +2 -2
  52. package/dist/css/value/expression/arithmetic.js +7 -3
  53. package/dist/css/value/expression/block.d.ts +2 -2
  54. package/dist/css/value/expression/block.js +4 -3
  55. package/dist/css/value/expression/conditional.d.ts +2 -2
  56. package/dist/css/value/expression/conditional.js +1 -1
  57. package/dist/css/value/expression/index.d.ts +2 -2
  58. package/dist/css/value/expression/index.js +10 -6
  59. package/dist/css/value/expression/map.d.ts +2 -2
  60. package/dist/css/value/expression/map.js +2 -2
  61. package/dist/css/value/object/index.d.ts +2 -2
  62. package/dist/css/value/object/index.js +14 -4
  63. package/dist/css/value/object/members.d.ts +2 -2
  64. package/dist/css/value/object/node.js +9 -4
  65. package/dist/css/value/object/path.d.ts +3 -3
  66. package/dist/css/value/object/path.js +10 -4
  67. package/dist/css/value/pieces.d.ts +3 -3
  68. package/dist/css/value/pieces.js +14 -4
  69. package/dist/css/value/resolve.js +15 -5
  70. package/dist/css/value/scope.d.ts +3 -2
  71. package/dist/css/value/scope.js +25 -7
  72. package/dist/css/value/substitute.js +43 -11
  73. package/dist/entities/architecture.d.ts +28 -25
  74. package/dist/entities/ast/assignments-raw.d.ts +1 -1
  75. package/dist/entities/ast/assignments-raw.js +61 -8
  76. package/dist/entities/ast/assignments-tagged.d.ts +1 -1
  77. package/dist/entities/ast/assignments-tagged.js +22 -7
  78. package/dist/entities/ast/assignments.d.ts +1 -1
  79. package/dist/entities/ast/assignments.js +6 -4
  80. package/dist/entities/ast/branches.d.ts +1 -1
  81. package/dist/entities/ast/calls.d.ts +1 -1
  82. package/dist/entities/ast/calls.js +19 -3
  83. package/dist/entities/ast/classes.d.ts +1 -1
  84. package/dist/entities/ast/classes.js +5 -1
  85. package/dist/entities/ast/comments.d.ts +3 -2
  86. package/dist/entities/ast/comments.js +47 -17
  87. package/dist/entities/ast/declaration.d.ts +1 -1
  88. package/dist/entities/ast/depth.d.ts +2 -2
  89. package/dist/entities/ast/depth.js +32 -15
  90. package/dist/entities/ast/enums.d.ts +1 -1
  91. package/dist/entities/ast/export-chain.d.ts +15 -0
  92. package/dist/entities/ast/export-chain.js +171 -0
  93. package/dist/entities/ast/file-exports.d.ts +1 -1
  94. package/dist/entities/ast/file-exports.js +26 -3
  95. package/dist/entities/ast/file-facts.d.ts +6 -3
  96. package/dist/entities/ast/file-facts.js +33 -4
  97. package/dist/entities/ast/file-imports.d.ts +1 -1
  98. package/dist/entities/ast/file-imports.js +26 -3
  99. package/dist/entities/ast/file.d.ts +2 -2
  100. package/dist/entities/ast/file.js +2 -1
  101. package/dist/entities/ast/functions.d.ts +1 -1
  102. package/dist/entities/ast/functions.js +13 -4
  103. package/dist/entities/ast/heritage.d.ts +1 -1
  104. package/dist/entities/ast/heritage.js +9 -1
  105. package/dist/entities/ast/index.d.ts +6 -3
  106. package/dist/entities/ast/index.js +82 -26
  107. package/dist/entities/ast/kind.d.ts +1 -1
  108. package/dist/entities/ast/kind.js +7 -1
  109. package/dist/entities/ast/modifiers.d.ts +1 -1
  110. package/dist/entities/ast/modifiers.js +4 -4
  111. package/dist/entities/ast/project.js +33 -2
  112. package/dist/entities/ast/properties.d.ts +1 -1
  113. package/dist/entities/ast/properties.js +10 -5
  114. package/dist/entities/ast/resolve.d.ts +1 -1
  115. package/dist/entities/ast/resolve.js +21 -11
  116. package/dist/entities/ast/tree.d.ts +4 -2
  117. package/dist/entities/ast/tree.js +184 -17
  118. package/dist/entities/ast/types.d.ts +1 -1
  119. package/dist/entities/ast/types.js +2 -1
  120. package/dist/entities/ast/usage.d.ts +1 -1
  121. package/dist/entities/ast/usage.js +1 -1
  122. package/dist/entities/ast/variables.d.ts +1 -1
  123. package/dist/entities/context.d.ts +4 -4
  124. package/dist/entities/facts.d.ts +36 -13
  125. package/dist/entities/findings.d.ts +3 -3
  126. package/dist/entities/kinds.d.ts +1 -1
  127. package/dist/entities/kinds.js +148 -37
  128. package/dist/entities/location/homes.d.ts +10 -10
  129. package/dist/entities/location/homes.js +74 -48
  130. package/dist/entities/location/place.d.ts +1 -1
  131. package/dist/entities/location/place.js +10 -3
  132. package/dist/entities/location/where.d.ts +10 -8
  133. package/dist/entities/location/where.js +89 -30
  134. package/dist/entities/location.d.ts +3 -3
  135. package/dist/entities/location.js +17 -17
  136. package/dist/entities/operators.js +1 -1
  137. package/dist/entities/overview/data.d.ts +6 -6
  138. package/dist/entities/overview/decision.d.ts +11 -11
  139. package/dist/entities/overview/finding.d.ts +10 -10
  140. package/dist/entities/overview/graph.d.ts +28 -11
  141. package/dist/entities/overview/input.d.ts +2 -2
  142. package/dist/entities/overview/summaries.d.ts +17 -15
  143. package/dist/entities/queries.d.ts +1 -1
  144. package/dist/entities/queries.js +89 -19
  145. package/dist/entities/repair.d.ts +1 -1
  146. package/dist/entities/repair.js +8 -2
  147. package/dist/entities/schema.d.ts +17 -3
  148. package/dist/entities/schema.js +74 -16
  149. package/dist/entities/story.d.ts +5 -5
  150. package/dist/entities/structure-facts.d.ts +1 -1
  151. package/dist/entities/token.d.ts +4 -4
  152. package/dist/entities/tree/build.d.ts +4 -3
  153. package/dist/entities/tree/build.js +112 -51
  154. package/dist/entities/tree/entries.d.ts +4 -4
  155. package/dist/entities/tree/entries.js +41 -16
  156. package/dist/entities/tree/index.d.ts +2 -2
  157. package/dist/entities/tree/index.js +1 -1
  158. package/dist/entities/tree/match.d.ts +2 -2
  159. package/dist/entities/tree/match.js +26 -12
  160. package/dist/fa-index.d.ts +16 -0
  161. package/dist/fa-index.js +165 -0
  162. package/dist/fa-open.d.ts +51 -0
  163. package/dist/fa-open.js +242 -0
  164. package/dist/fa-store.d.ts +22 -0
  165. package/dist/fa-store.js +232 -0
  166. package/dist/fa-values.d.ts +37 -0
  167. package/dist/fa-values.js +104 -0
  168. package/dist/facts-record.d.ts +45 -0
  169. package/dist/facts-record.js +297 -0
  170. package/dist/frameworks/angular/index.d.ts +2 -2
  171. package/dist/frameworks/angular/index.js +2 -1
  172. package/dist/frameworks/facet.d.ts +3 -1
  173. package/dist/frameworks/facet.js +13 -0
  174. package/dist/frameworks/index.d.ts +1 -1
  175. package/dist/frameworks/index.js +25 -11
  176. package/dist/frameworks/react/index.d.ts +2 -2
  177. package/dist/frameworks/react/index.js +33 -10
  178. package/dist/frameworks/test/index.d.ts +6 -0
  179. package/dist/frameworks/test/index.js +157 -0
  180. package/dist/frameworks/vue/index.d.ts +2 -2
  181. package/dist/frameworks/vue/index.js +2 -1
  182. package/dist/ignore.d.ts +3 -0
  183. package/dist/ignore.js +62 -0
  184. package/dist/index-file.d.ts +43 -0
  185. package/dist/index-file.js +218 -0
  186. package/dist/index-run.d.ts +39 -0
  187. package/dist/index-run.js +217 -0
  188. package/dist/index-zone.d.ts +25 -0
  189. package/dist/index-zone.js +219 -0
  190. package/dist/main.d.ts +5 -2
  191. package/dist/main.js +223 -41
  192. package/dist/nodes/child-entities.d.ts +3 -0
  193. package/dist/nodes/child-entities.js +12 -0
  194. package/dist/nodes/children.d.ts +4 -4
  195. package/dist/nodes/children.js +64 -11
  196. package/dist/nodes/finally/emit.d.ts +4 -4
  197. package/dist/nodes/finally/emit.js +26 -10
  198. package/dist/nodes/finally/entities.d.ts +13 -0
  199. package/dist/nodes/finally/entities.js +42 -0
  200. package/dist/nodes/finally/index.d.ts +6 -6
  201. package/dist/nodes/finally/index.js +8 -8
  202. package/dist/nodes/finally/queries.d.ts +2 -2
  203. package/dist/nodes/finally/queries.js +7 -4
  204. package/dist/nodes/finally/relations-access.d.ts +2 -2
  205. package/dist/nodes/finally/relations-access.js +22 -18
  206. package/dist/nodes/finally/relations-edge.d.ts +5 -5
  207. package/dist/nodes/finally/relations-edge.js +67 -44
  208. package/dist/nodes/finally/relations-group.d.ts +7 -7
  209. package/dist/nodes/finally/relations-group.js +28 -25
  210. package/dist/nodes/finally/relations.d.ts +2 -2
  211. package/dist/nodes/finally/relations.js +16 -12
  212. package/dist/nodes/finally/required.d.ts +3 -3
  213. package/dist/nodes/finally/required.js +9 -7
  214. package/dist/nodes/finally/violation.d.ts +2 -2
  215. package/dist/nodes/similar.d.ts +3 -3
  216. package/dist/nodes/similar.js +78 -56
  217. package/dist/piece-forms.d.ts +9 -0
  218. package/dist/piece-forms.js +68 -0
  219. package/dist/{pipeline-roles.d.ts → pipeline-entities.d.ts} +2 -2
  220. package/dist/{pipeline-roles.js → pipeline-entities.js} +32 -28
  221. package/dist/pipeline-facts.d.ts +4 -3
  222. package/dist/pipeline-facts.js +64 -62
  223. package/dist/{pipeline-unroled.d.ts → pipeline-unclassified.d.ts} +2 -2
  224. package/dist/{pipeline-unroled.js → pipeline-unclassified.js} +58 -63
  225. package/dist/pipeline.d.ts +1 -1
  226. package/dist/pipeline.js +19 -64
  227. package/dist/release-file.d.ts +3 -0
  228. package/dist/release-file.js +13 -0
  229. package/dist/report/asks.d.ts +3 -3
  230. package/dist/report/asks.js +16 -6
  231. package/dist/report/configErrors.d.ts +55 -27
  232. package/dist/report/configErrors.js +81 -35
  233. package/dist/report/errorTypes/codes/structure.d.ts +1 -1
  234. package/dist/report/errorTypes/codes/structure.js +9 -9
  235. package/dist/report/errorTypes/decision-maker.d.ts +5 -5
  236. package/dist/report/errorTypes/decision-maker.js +21 -11
  237. package/dist/report/errorTypes/destinations.d.ts +5 -5
  238. package/dist/report/errorTypes/destinations.js +52 -34
  239. package/dist/report/errorTypes/finding-type.d.ts +3 -3
  240. package/dist/report/errorTypes/index.d.ts +1 -1
  241. package/dist/report/errorTypes/index.js +17 -7
  242. package/dist/report/errorTypes/types/fileContents.d.ts +4 -4
  243. package/dist/report/errorTypes/types/fileContents.js +11 -5
  244. package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
  245. package/dist/report/errorTypes/types/{unknownRole.js → unknownEntity.js} +12 -7
  246. package/dist/report/errorTypes/types/wrongAction.d.ts +5 -5
  247. package/dist/report/errorTypes/types/wrongAction.js +18 -13
  248. package/dist/report/errorTypes/types/wrongPlacement.d.ts +4 -4
  249. package/dist/report/errorTypes/types/wrongPlacement.js +19 -9
  250. package/dist/report/errorTypes/vocabulary/ids.d.ts +2 -2
  251. package/dist/report/errorTypes/vocabulary/ids.js +3 -3
  252. package/dist/report/errorTypes/vocabulary/phrases.d.ts +2 -2
  253. package/dist/report/errorTypes/vocabulary/phrases.js +39 -26
  254. package/dist/report/errorTypes/vocabulary/places.d.ts +3 -3
  255. package/dist/report/errorTypes/vocabulary/places.js +13 -13
  256. package/dist/report/finding-from.d.ts +3 -3
  257. package/dist/report/finding-from.js +14 -9
  258. package/dist/report/notices.d.ts +6 -1
  259. package/dist/report/notices.js +46 -20
  260. package/dist/report/observed.d.ts +19 -0
  261. package/dist/report/observed.js +87 -0
  262. package/dist/report/render-report.d.ts +1 -1
  263. package/dist/report/render-report.js +33 -30
  264. package/dist/report/user-report/build/bundle.js +26 -7
  265. package/dist/report/user-report/build/bundle.prebuilt.js +799 -297
  266. package/dist/report/user-report/data/collect.d.ts +2 -2
  267. package/dist/report/user-report/data/collect.js +32 -19
  268. package/dist/report/user-report/data/entities.d.ts +7 -0
  269. package/dist/report/user-report/data/{roles.js → entities.js} +27 -22
  270. package/dist/report/user-report/data/{role-examples.d.ts → entity-examples.d.ts} +3 -3
  271. package/dist/report/user-report/data/entity-examples.js +136 -0
  272. package/dist/report/user-report/data/{role-filters.d.ts → entity-filters.d.ts} +2 -2
  273. package/dist/report/user-report/data/{role-filters.js → entity-filters.js} +7 -7
  274. package/dist/report/user-report/data/entity-marks.d.ts +5 -0
  275. package/dist/report/user-report/data/{role-marks.js → entity-marks.js} +11 -11
  276. package/dist/report/user-report/data/file-tree.d.ts +3 -3
  277. package/dist/report/user-report/data/file-tree.js +13 -5
  278. package/dist/report/user-report/data/finding-boundary.d.ts +4 -4
  279. package/dist/report/user-report/data/finding-boundary.js +2 -2
  280. package/dist/report/user-report/data/finding-plan.d.ts +5 -5
  281. package/dist/report/user-report/data/finding-plan.js +10 -10
  282. package/dist/report/user-report/data/finding-title.d.ts +2 -2
  283. package/dist/report/user-report/data/finding-title.js +8 -8
  284. package/dist/report/user-report/data/findings.d.ts +4 -4
  285. package/dist/report/user-report/data/findings.js +30 -20
  286. package/dist/report/user-report/data/graph-edges.d.ts +4 -4
  287. package/dist/report/user-report/data/graph-edges.js +19 -19
  288. package/dist/report/user-report/data/graph-entities.d.ts +6 -0
  289. package/dist/report/user-report/data/graph-entities.js +158 -0
  290. package/dist/report/user-report/data/graph-helpers.d.ts +5 -5
  291. package/dist/report/user-report/data/graph-helpers.js +15 -15
  292. package/dist/report/user-report/data/graph.d.ts +5 -4
  293. package/dist/report/user-report/data/graph.js +28 -21
  294. package/dist/report/user-report/data/nodes.d.ts +2 -2
  295. package/dist/report/user-report/data/nodes.js +33 -23
  296. package/dist/report/user-report/data/rules.d.ts +7 -0
  297. package/dist/report/user-report/data/{invariants.js → rules.js} +13 -13
  298. package/dist/report/user-report/data/scan.d.ts +1 -1
  299. package/dist/report/user-report/data/scan.js +19 -9
  300. package/dist/report/user-report/html/shell.d.ts +1 -1
  301. package/dist/report/user-report/html/shell.js +1 -1
  302. package/dist/report/user-report/index.d.ts +1 -1
  303. package/dist/report/user-report/index.js +17 -7
  304. package/dist/report/user-report/shared/describe.d.ts +1 -1
  305. package/dist/report/user-report/shared/describe.js +6 -6
  306. package/dist/rules/index.d.ts +7 -0
  307. package/dist/{invariants → rules}/index.js +85 -57
  308. package/dist/{invariants → rules}/list-vars.d.ts +2 -2
  309. package/dist/{invariants → rules}/list-vars.js +9 -3
  310. package/dist/{invariants → rules}/name.js +2 -2
  311. package/dist/rules/normalize.d.ts +5 -0
  312. package/dist/rules/normalize.js +108 -0
  313. package/dist/{invariants → rules}/vars.d.ts +9 -7
  314. package/dist/{invariants → rules}/vars.js +5 -5
  315. package/dist/scan-run.d.ts +20 -0
  316. package/dist/scan-run.js +130 -0
  317. package/dist/scripts/audit-report.js +19 -9
  318. package/dist/usage-index.d.ts +4 -0
  319. package/dist/usage-index.js +282 -0
  320. package/dist/usage-mode.d.ts +7 -0
  321. package/dist/usage-mode.js +16 -0
  322. package/dist/usage-pass.d.ts +19 -0
  323. package/dist/usage-pass.js +136 -0
  324. package/dist/usage-prepare.d.ts +2 -0
  325. package/dist/usage-prepare.js +22 -0
  326. package/dist/usage-sweep.d.ts +10 -0
  327. package/dist/usage-sweep.js +264 -0
  328. package/dist/utils/aliases.d.ts +22 -0
  329. package/dist/utils/aliases.js +173 -0
  330. package/dist/utils/classify.d.ts +2 -2
  331. package/dist/utils/classify.js +4 -4
  332. package/dist/utils/configs.js +17 -7
  333. package/dist/utils/distinct.js +4 -2
  334. package/dist/utils/files.js +41 -37
  335. package/dist/utils/fixpoint.js +2 -2
  336. package/dist/utils/host.d.ts +1 -1
  337. package/dist/utils/host.js +4 -1
  338. package/dist/utils/imports.js +83 -19
  339. package/dist/utils/keyed.js +2 -2
  340. package/dist/utils/map-record.js +2 -2
  341. package/dist/utils/packages.d.ts +15 -0
  342. package/dist/utils/packages.js +207 -0
  343. package/dist/utils/path-label.js +3 -1
  344. package/dist/utils/pattern.d.ts +5 -4
  345. package/dist/utils/pattern.js +55 -15
  346. package/dist/utils/permission.d.ts +3 -3
  347. package/dist/utils/permission.js +4 -2
  348. package/dist/utils/plural.js +2 -2
  349. package/dist/utils/qualified.js +4 -4
  350. package/dist/utils/rank.js +2 -2
  351. package/dist/utils/record.js +1 -1
  352. package/dist/utils/search.js +7 -2
  353. package/dist/utils/speak.js +1 -1
  354. package/dist/utils/split.js +14 -1
  355. package/dist/utils/template.d.ts +1 -1
  356. package/dist/utils/template.js +1 -1
  357. package/dist/utils/tokenize.js +6 -1
  358. package/dist/utils/typed-field.js +2 -2
  359. package/dist/utils/verdicts.js +1 -1
  360. package/entities/operators.ts +1 -1
  361. package/package.json +101 -90
  362. package/report/errorTypes/vocabulary/ids.ts +7 -2
  363. package/report/errorTypes/vocabulary/phrases.ts +47 -27
  364. package/report/errorTypes/vocabulary/places.ts +21 -16
  365. package/report/user-report/shared/describe.ts +7 -7
  366. package/dist/code-roles/classify.d.ts +0 -11
  367. package/dist/code-roles/classify.js +0 -43
  368. package/dist/code-roles/connector.d.ts +0 -5
  369. package/dist/code-roles/connector.js +0 -114
  370. package/dist/code-roles/project.d.ts +0 -12
  371. package/dist/code-roles/project.js +0 -122
  372. package/dist/code-roles/roles.d.ts +0 -8
  373. package/dist/invariants/index.d.ts +0 -6
  374. package/dist/invariants/normalize.d.ts +0 -4
  375. package/dist/invariants/normalize.js +0 -95
  376. package/dist/nodes/child-roles.d.ts +0 -3
  377. package/dist/nodes/child-roles.js +0 -12
  378. package/dist/nodes/finally/roles.d.ts +0 -13
  379. package/dist/nodes/finally/roles.js +0 -41
  380. package/dist/report/errorTypes/types/unknownRole.d.ts +0 -9
  381. package/dist/report/user-report/data/graph-roles.d.ts +0 -5
  382. package/dist/report/user-report/data/graph-roles.js +0 -71
  383. package/dist/report/user-report/data/invariants.d.ts +0 -7
  384. package/dist/report/user-report/data/role-examples.js +0 -94
  385. package/dist/report/user-report/data/role-marks.d.ts +0 -5
  386. package/dist/report/user-report/data/roles.d.ts +0 -7
  387. /package/dist/{invariants → rules}/name.d.ts +0 -0
@@ -1,8 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.partsOf = void 0;
4
+ // The same handful of paths is cut over and over — every finding names a file,
5
+ // every rule names a folder — so the split is memoised per separator. The parts
6
+ // are read-only: a reader that needs a derived array (filtered segments) makes
7
+ // one, and nothing here is ever mutated.
8
+ // Module-wide, keyed by separator + text: it grows to the paths split in one run
9
+ // (bounded by the working tree — a CLI run dies with it).
10
+ const memo = new Map();
4
11
  const partsOf = (text, separator) => {
12
+ const key = `${separator}\u0000${text ?? ""}`;
13
+ const cached = memo.get(key);
14
+ if (cached)
15
+ return cached;
5
16
  const all = String(text ?? "").split(separator);
6
- return { all, head: all.slice(0, -1), last: all[all.length - 1] ?? "" };
17
+ const parts = { all, head: all.slice(0, -1), last: all[all.length - 1] ?? "" };
18
+ memo.set(key, parts);
19
+ return parts;
7
20
  };
8
21
  exports.partsOf = partsOf;
@@ -1,4 +1,4 @@
1
- import type { FieldValue } from "../utils/field";
1
+ import type { FieldValue } from "@md-code/follow-architecture/utils/field";
2
2
  type TemplateVars = Record<string, FieldValue>;
3
3
  declare const substitute: (text: string, vars: TemplateVars) => string;
4
4
  export { substitute };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.substitute = void 0;
4
- const substitute = (text, vars) => String(text).replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g, (whole, k) => (vars[k] != null ? String(vars[k]) : whole));
4
+ const substitute = (text, vars) => String(text).replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g, (whole, k) => vars[k] != null ? String(vars[k]) : whole);
5
5
  exports.substitute = substitute;
@@ -9,5 +9,10 @@ exports.tokenize = void 0;
9
9
  //
10
10
  // A GLOBAL utility: tailwind, a class attribute, any facet reads a token list
11
11
  // the same way.
12
- const tokenize = (text) => [...new Set(String(text ?? "").trim().split(/\s+/).filter(Boolean))];
12
+ const tokenize = (text) => [
13
+ ...new Set(String(text ?? "")
14
+ .trim()
15
+ .split(/\s+/)
16
+ .filter(Boolean)),
17
+ ];
13
18
  exports.tokenize = tokenize;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.typedField = void 0;
4
4
  // A TYPED FIELD is one mechanism: a record's field is read as plain data, and
5
5
  // only the value of the expected shape is kept — anything else is nothing. A
6
- // report template's string fields are read this way (`invariants/index`); a
7
- // scope accessor's `scope` is read this way (`code-roles/roles`). The walk is
6
+ // report template's string fields are read this way (`rules/index`); a
7
+ // scope accessor's `scope` is read this way (`code-entities/entities`). The walk is
8
8
  // the same — read, qualify, keep or drop — so it lives here once. What the
9
9
  // field IS and which shape qualifies is the caller's own.
10
10
  const field_1 = require("./field");
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.worstWhenAllRefuse = void 0;
4
4
  // A VERDICT LIST is one mechanism: entries are judged, the refusals are ranked
5
5
  // by how well they EXPLAIN the rule, and the best explanation is the one the
6
- // reader gets. The relation check ranks the target roles an edge could be
6
+ // reader gets. The relation check ranks the target entities an edge could be
7
7
  // judged by (`nodes/finally/relations`); any consumer that must pick the most
8
8
  // informative refusal asks the same question. The ranking is the caller's own
9
9
  // policy; the walk — rank, then take the head only when EVERY entry refuses —
@@ -2,7 +2,7 @@
2
2
 
3
3
  // The operator vocabulary AS THE REPORT READS IT: which keys stand for a list,
4
4
  // which of them say "one of them", and how a scalar operator is spelled for a
5
- // human. Two readers share it — the Node-side summarizer (`data/invariants.js`)
5
+ // human. Two readers share it — the Node-side summarizer (`data/rules.js`)
6
6
  // and the browser describer (`src/utils/describe.js`) — because they used to
7
7
  // carry the same three tables twice and printed two different truths.
8
8
  //
package/package.json CHANGED
@@ -1,92 +1,103 @@
1
1
  {
2
- "name": "@md-code/follow-architecture",
3
- "version": "0.3.0",
4
- "private": false,
5
- "description": "ESLint rule + CLI that enforces a declarative architecture: where files may live, what they may be named, and what they may contain.",
6
- "license": "Apache-2.0",
7
- "author": "DrBoria <dr.boria@gmail.com>",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/DrBoria/follow-architecture.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/DrBoria/follow-architecture/issues"
14
- },
15
- "homepage": "https://github.com/DrBoria/follow-architecture#readme",
16
- "main": "dist/plugin.js",
17
- "types": "dist/plugin.d.ts",
18
- "engines": {
19
- "node": ">=18"
20
- },
21
- "bin": {
22
- "follow-architecture": "dist/bin/follow-architecture.js"
23
- },
24
- "files": [
25
- "dist/",
26
- "report/user-report/shared/",
27
- "report/errorTypes/vocabulary/",
28
- "entities/operators.ts",
29
- "README.md",
30
- "CHANGELOG.md"
31
- ],
32
- "exports": {
33
- ".": "./dist/plugin.js",
34
- "./plugin": "./dist/plugin.js",
35
- "./config": "./dist/config.js",
36
- "./main": "./dist/main.js",
37
- "./package.json": "./package.json"
38
- },
39
- "dependencies": {
40
- "@typescript-eslint/parser": "^8.71.0",
41
- "css-tree": "^3.2.1",
42
- "highlight.js": "^11.12.0",
43
- "js-yaml": "^5.4.2",
44
- "minimatch": "^9.0.4",
45
- "postcss": "^8.5.32",
46
- "postcss-scss": "^4.0.9",
47
- "postcss-selector-parser": "^7.1.7",
48
- "postcss-value-parser": "^4.2.0",
49
- "remeda": "^2.50.0",
50
- "stylis": "^4.4.0",
51
- "tailwindcss": "^3.4.0",
52
- "ts-morph": "^24.0.0"
53
- },
54
- "peerDependencies": {
55
- "eslint": ">=8.40.0"
56
- },
57
- "scripts": {
58
- "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
59
- "build": "npm run clean && tsc -p tsconfig.json && npm run prebuild:report",
60
- "prebuild:report": "node scripts/build-report-bundle.mjs",
61
- "typecheck": "tsc -p tsconfig.json --noEmit",
62
- "test": "vitest run",
63
- "overview": "node dist/bin/follow-architecture.js --overview architecture-overview.html",
64
- "prepublishOnly": "npm run build && vitest run --no-file-parallelism",
65
- "lint": "eslint ."
66
- },
67
- "devDependencies": {
68
- "@md-code/component-uniqueness": "workspace:*",
69
- "@md-code/entities-uniqueness": "workspace:*",
70
- "@md-code/utils-uniqueness": "workspace:*",
71
- "@types/node": "^26.6.6",
72
- "@types/react": "^18",
73
- "@types/react-dom": "^18",
74
- "esbuild": "^0.25.12",
75
- "react": "^18.3.1",
76
- "react-dom": "^18.3.1",
77
- "styled-components": "^6.6.0",
78
- "typescript": "^5.5",
79
- "typescript-eslint": "^8.73.0",
80
- "vite": "^6.4.5",
81
- "vitest": "^5.0.3"
82
- },
83
- "publishConfig": {
84
- "access": "public"
85
- },
86
- "keywords": [
87
- "eslint",
88
- "eslint-rule",
89
- "architecture",
90
- "typescript"
91
- ]
2
+ "name": "@md-code/follow-architecture",
3
+ "version": "0.3.2",
4
+ "private": false,
5
+ "description": "ESLint rule + CLI that enforces a declarative architecture: where files may live, what they may be named, and what they may contain.",
6
+ "license": "Apache-2.0",
7
+ "author": "DrBoria <dr.boria@gmail.com>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/DrBoria/follow-architecture.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/DrBoria/follow-architecture/issues"
14
+ },
15
+ "homepage": "https://github.com/DrBoria/follow-architecture#readme",
16
+ "main": "dist/plugin.js",
17
+ "types": "dist/plugin.d.ts",
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "bin": {
22
+ "follow-architecture": "dist/bin/follow-architecture.js"
23
+ },
24
+ "files": [
25
+ "dist/",
26
+ "report/user-report/shared/",
27
+ "report/errorTypes/vocabulary/",
28
+ "entities/operators.ts",
29
+ "README.md",
30
+ "CHANGELOG.md"
31
+ ],
32
+ "exports": {
33
+ ".": "./dist/plugin.js",
34
+ "./plugin": "./dist/plugin.js",
35
+ "./config": "./dist/config.js",
36
+ "./main": "./dist/main.js",
37
+ "./package.json": "./package.json",
38
+ "./*": "./dist/*.js",
39
+ "./*.js": "./dist/*.js"
40
+ },
41
+ "dependencies": {
42
+ "@md-code/utils": "^0.0.2",
43
+ "@typescript-eslint/parser": "^8.71.0",
44
+ "css-tree": "^3.2.1",
45
+ "highlight.js": "^11.12.0",
46
+ "js-yaml": "^5.4.2",
47
+ "minimatch": "^9.0.4",
48
+ "postcss": "^8.5.32",
49
+ "postcss-scss": "^4.0.9",
50
+ "postcss-selector-parser": "^7.1.7",
51
+ "postcss-value-parser": "^4.2.0",
52
+ "remeda": "^2.50.0",
53
+ "stylis": "^4.4.0",
54
+ "tailwindcss": "^3.4.0",
55
+ "ts-morph": "^24.0.0"
56
+ },
57
+ "peerDependencies": {
58
+ "eslint": ">=8.40.0"
59
+ },
60
+ "scripts": {
61
+ "format": "prettier --write \"**/*.{ts,tsx,js,jsx,css,json}\" --ignore-path ../../.prettierignore",
62
+ "format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,css,json}\" --ignore-path ../../.prettierignore",
63
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
64
+ "build": "npm run clean && tsc -p tsconfig.json && npm run prebuild:report",
65
+ "prebuild:report": "node scripts/build-report-bundle.mjs",
66
+ "typecheck": "tsc -p tsconfig.json --noEmit",
67
+ "lint:products": "ESLINT_BIN=\"$PWD/node_modules/.bin/eslint\"; cd ../.. && NODE_OPTIONS=--max-old-space-size=13312 LINT_OVERVIEW=0 \"$ESLINT_BIN\" --config packages/follow-architecture/eslint.products.config.mjs packages",
68
+ "lint:products:overview": "ESLINT_BIN=\"$PWD/node_modules/.bin/eslint\"; cd ../.. && NODE_OPTIONS=--max-old-space-size=13312 LINT_OVERVIEW=1 \"$ESLINT_BIN\" --config packages/follow-architecture/eslint.products.config.mjs packages",
69
+ "test": "vitest run",
70
+ "overview": "node dist/bin/follow-architecture.js --overview architecture-overview.html",
71
+ "prepublishOnly": "npm run build && vitest run --no-file-parallelism",
72
+ "lint": "eslint ."
73
+ },
74
+ "devDependencies": {
75
+ "@md-code/component-uniqueness": "^0.3.0",
76
+ "@md-code/components": "^0.0.2",
77
+ "@md-code/entities-uniqueness": "^0.3.0",
78
+ "@md-code/sections": "^0.0.2",
79
+ "@md-code/utils-uniqueness": "^0.3.0",
80
+ "@types/node": "^26.6.6",
81
+ "@types/react": "^18",
82
+ "@types/react-dom": "^18",
83
+ "esbuild": "^0.25.12",
84
+ "react": "^18.3.1",
85
+ "react-dom": "^18.3.1",
86
+ "styled-components": "^6.6.0",
87
+ "typescript": "^5.5",
88
+ "typescript-eslint": "^8.73.0",
89
+ "vite": "^6.4.5",
90
+ "vitest": "^5.0.3",
91
+ "@md-code/styles": "^0.0.1",
92
+ "@md-code/config": "^0.0.1"
93
+ },
94
+ "publishConfig": {
95
+ "access": "public"
96
+ },
97
+ "keywords": [
98
+ "eslint",
99
+ "eslint-rule",
100
+ "architecture",
101
+ "typescript"
102
+ ]
92
103
  }
@@ -7,6 +7,11 @@
7
7
  // the finding judges the file's own contents
8
8
  const __exported_WRONG_ACTION = "wrongAction";
9
9
  const __exported_WRONG_PLACEMENT = "wrongPlacement";
10
- const __exported_UNKNOWN_ROLE = "unknownRole";
10
+ const __exported_UNKNOWN_ENTITY = "unknownEntity";
11
11
  const __exported_FILE_CONTENTS = "fileContents";
12
- export { __exported_WRONG_ACTION as WRONG_ACTION, __exported_WRONG_PLACEMENT as WRONG_PLACEMENT, __exported_UNKNOWN_ROLE as UNKNOWN_ROLE, __exported_FILE_CONTENTS as FILE_CONTENTS };
12
+ export {
13
+ __exported_WRONG_ACTION as WRONG_ACTION,
14
+ __exported_WRONG_PLACEMENT as WRONG_PLACEMENT,
15
+ __exported_UNKNOWN_ENTITY as UNKNOWN_ENTITY,
16
+ __exported_FILE_CONTENTS as FILE_CONTENTS,
17
+ };
@@ -5,10 +5,16 @@
5
5
  // the ONE spelling the text and the picture read. Every field is read through
6
6
  // the shared field readers — a fact is plain data, never an `any`.
7
7
 
8
- import { RELATION } from "../../../entities/kinds";
9
- import { fieldOf, isObj, type FieldValue } from "../../../utils/field";
10
- import { stringField, stringListField, recordField, recordListField, booleanField } from "../../../utils/read-field";
11
- import { article } from "../../../utils/article";
8
+ import { RELATION } from "@md-code/follow-architecture/entities/kinds";
9
+ import { fieldOf, isObj, type FieldValue } from "@md-code/follow-architecture/utils/field";
10
+ import {
11
+ stringField,
12
+ stringListField,
13
+ recordField,
14
+ recordListField,
15
+ booleanField,
16
+ } from "@md-code/follow-architecture/utils/read-field";
17
+ import { article } from "@md-code/follow-architecture/utils/article";
12
18
 
13
19
  const q = (s: FieldValue): string => (s == null ? "—" : `\`${s}\``);
14
20
  const list = (xs: readonly FieldValue[]): string => xs.map(q).join(", ");
@@ -38,7 +44,8 @@ const pluralize = (text: string): string => {
38
44
  // The export forms that read as a re-export of a whole module / a default.
39
45
  const exportFormText = (fact: FieldValue): string | null => {
40
46
  const form = stringField(fact, "form");
41
- if (form === "namespace") return `re-exports ${q(fieldOf(fact, "source"))} as ${q(stringListField(fact, "names")[0] ?? fieldOf(fact, "name"))}`;
47
+ if (form === "namespace")
48
+ return `re-exports ${q(fieldOf(fact, "source"))} as ${q(stringListField(fact, "names")[0] ?? fieldOf(fact, "name"))}`;
42
49
  if (form === "star") return `re-exports ${q(fieldOf(fact, "source"))}`;
43
50
  if (form === "default") return "is exported as its default";
44
51
  if (form === "equals") return "is exported with `export =`";
@@ -78,8 +85,9 @@ const callText = (fact: FieldValue): string =>
78
85
 
79
86
  const mutateText = (fact: FieldValue): string => {
80
87
  if (booleanField(fact, "onThis")) return `changes ${q(fieldOf(fact, "target"))} of its own file`;
81
- const ownerRole = fieldOf(fact, "ownerRole");
82
- if (ownerRole) return `changes ${q(fieldOf(fact, "target"))} of the ${q(ownerRole)} (${q(fieldOf(fact, "module"))})`;
88
+ const ownerEntity = fieldOf(fact, "ownerEntity");
89
+ if (ownerEntity)
90
+ return `changes ${q(fieldOf(fact, "target"))} of the ${q(ownerEntity)} (${q(fieldOf(fact, "module"))})`;
83
91
  return `changes ${q(fieldOf(fact, "target"))} of ${q(fieldOf(fact, "module"))}`;
84
92
  };
85
93
 
@@ -89,8 +97,18 @@ const declareText = (fact: FieldValue): string => {
89
97
  return "is declared here";
90
98
  };
91
99
 
92
- const importText = (fact: FieldValue): string =>
93
- stringField(fact, "form") === "statement" ? `imports ${q(fieldOf(fact, "resolved"))}` : `requires ${q(fieldOf(fact, "source"))}`;
100
+ // A named import names the SYMBOLS it takes (and the file that declares them):
101
+ // `imports `codeEditor` of `packages/styles/themes/editor.ts``. A module-level
102
+ // import keeps its one-word form.
103
+ const importText = (fact: FieldValue): string => {
104
+ if (stringField(fact, "form") !== "statement") return `requires ${q(fieldOf(fact, "source"))}`;
105
+ const names = fieldOf(fact, "names");
106
+ const symbols = Array.isArray(names) ? names.filter((name) => typeof name === "string") : [];
107
+
108
+ return symbols.length
109
+ ? `imports ${list(symbols)} of ${q(fieldOf(fact, "resolved"))}`
110
+ : `imports ${q(fieldOf(fact, "resolved"))}`;
111
+ };
94
112
 
95
113
  const assignText = (fact: FieldValue): string => {
96
114
  const method = fieldOf(fact, "method");
@@ -116,38 +134,40 @@ const factText = (fact: FieldValue): string => {
116
134
  return `does a \`${kind}\` the architecture does not describe`;
117
135
  };
118
136
 
119
- const rolesSuffix = (roles: string[]): string => {
120
- if (!roles.length) return "";
121
- return roles.length === 1 ? ` (${roles[0]})` : ` (${roles.join(" / ")})`;
137
+ const entitiesSuffix = (entities: string[]): string => {
138
+ if (!entities.length) return "";
139
+ return entities.length === 1 ? ` (${entities[0]})` : ` (${entities.join(" / ")})`;
122
140
  };
123
141
 
124
142
  const subjectText = (subject: FieldValue, file: string): string => {
125
- const roleNames = stringListField(subject, "roles").filter(Boolean);
126
- const roles = roleNames.map(q);
127
- const rolesPart = rolesSuffix(roles);
143
+ const entityNames = stringListField(subject, "entities").filter(Boolean);
144
+ const entities = entityNames.map(q);
145
+ const entitiesPart = entitiesSuffix(entities);
128
146
  if (!isObj(subject) || booleanField(subject, "scope")) {
129
- return `the module scope of ${q(file)}${rolesPart}`;
147
+ return `the module scope of ${q(file)}${entitiesPart}`;
130
148
  }
131
149
  const pieces = stringListField(subject, "pieces").filter(Boolean).map(q);
132
- if (!pieces.length) return `the module scope of ${q(file)}${rolesPart}`;
133
- const who = roleNames.length === 1 ? ` (${article(roleNames[0])} ${q(roleNames[0])})` : rolesPart;
134
- return `${pieces.join(", ")}${who || " (which no role describes)"}`;
150
+ if (!pieces.length) return `the module scope of ${q(file)}${entitiesPart}`;
151
+ const who = entityNames.length === 1 ? ` (${article(entityNames[0])} ${q(entityNames[0])})` : entitiesPart;
152
+ return `${pieces.join(", ")}${who || " (which no entity describes)"}`;
135
153
  };
136
154
 
137
155
  // WHY it is refused — a code from the engine, not a sentence.
138
156
  const whyText = (why: FieldValue): string => {
139
157
  if (!isObj(why)) return "it is not allowed";
140
158
  if (stringField(why, "code") === "silent") return "nothing in the architecture allows it";
141
- const same = new Set(stringListField(why, "sameRoles"));
142
- // A role the rule limits to the SAME feature instance says so: without the
143
- // limit the sentence reads as "this role may not do it at all", which is the
159
+ const same = new Set(stringListField(why, "sameEntities"));
160
+ // An entity the rule limits to the SAME feature instance says so: without the
161
+ // limit the sentence reads as "this entity may not do it at all", which is the
144
162
  // opposite of what the architecture declares.
145
- const roles = stringListField(why, "roles").filter(Boolean).map((r) => (same.has(r) ? `${q(r)} in the same feature` : q(r)));
146
- // The role DOES allow the call — what it refuses is the value handed over.
163
+ const entities = stringListField(why, "entities")
164
+ .filter(Boolean)
165
+ .map((r) => (same.has(r) ? `${q(r)} in the same feature` : q(r)));
166
+ // The entity DOES allow the call — what it refuses is the value handed over.
147
167
  if (booleanField(why, "outward")) return "that value may not be handed to it";
148
- if (!roles.length) return stringField(why, "code") === "nobody" ? "no code may do it" : "it is not allowed";
149
- if (booleanField(why, "self")) return `only ${roles.join(", ")} may do it`;
150
- return `only ${roles.join(", ")} may do it with ${q(fieldOf(why, "targetNode"))} code`;
168
+ if (!entities.length) return stringField(why, "code") === "nobody" ? "no code may do it" : "it is not allowed";
169
+ if (booleanField(why, "self")) return `only ${entities.join(", ")} may do it`;
170
+ return `only ${entities.join(", ")} may do it with ${q(fieldOf(why, "targetNode"))} code`;
151
171
  };
152
172
 
153
173
  // The one sentence a refused relation gets.
@@ -1,15 +1,20 @@
1
1
  "use strict";
2
2
 
3
- // Engine names → report names: role → box, place → node.
3
+ // Engine names → report names: entity → box, place → node.
4
4
 
5
5
  // ONE source for every place question. `homeFor`, `nodeAtPath`, `homeTemplates`
6
6
  // and `pathOf` used to be spelled again here, in a second wording, next to the
7
7
  // real ones in `entities/location.js` — the report and the engine then disagreed
8
- // about where a role lives. This file only NAMES things now.
9
- import { homesOf, rolesAtPath as rolesDeclaredAt, homeForRole, boxOfPlace } from "../../../entities/location";
10
- import type { Arch } from "../../../entities/architecture";
11
- import type { NodeSummary } from "../../../entities/overview/summaries";
12
- import type { Places } from "../../../entities/overview/decision";
8
+ // about where an entity lives. This file only NAMES things now.
9
+ import {
10
+ homesOf,
11
+ entitiesAtPath as entitiesDeclaredAt,
12
+ homeForEntity,
13
+ boxOfPlace,
14
+ } from "@md-code/follow-architecture/entities/location";
15
+ import type { Arch } from "@md-code/follow-architecture/entities/architecture";
16
+ import type { NodeSummary } from "@md-code/follow-architecture/entities/overview/summaries";
17
+ import type { Places } from "@md-code/follow-architecture/entities/overview/decision";
13
18
 
14
19
  const make = ({ nodes, arch }: { nodes: NodeSummary[]; arch: Arch }): Places => {
15
20
  const folderOf = (slug: string | null | undefined): string | null => {
@@ -21,26 +26,26 @@ const make = ({ nodes, arch }: { nodes: NodeSummary[]; arch: Arch }): Places =>
21
26
  // A node slug as the path a human recognises.
22
27
  const pathOf = (slug: string): string => nodes.find((n) => n.slug === slug)?.paths?.[0] ?? slug;
23
28
 
24
- // EVERY role that declares a place — the candidate set a destination decision
25
- // may choose from ("какие есть").
26
- const roles = (): string[] => Object.keys(arch.nodes.roleHomes);
29
+ // EVERY entity that declares a place — the set a destination decision chooses
30
+ // from: everything the tree says could be here.
31
+ const entities = (): string[] => Object.keys(arch.nodes.entityHomes);
27
32
 
28
- // Roles whose declared home covers this path, most specific first: what this
33
+ // Entities whose declared home covers this path, most specific first: what this
29
34
  // file already IS, according to the tree.
30
- const rolesAtPath = (rel: string): string[] => rolesDeclaredAt(arch, rel);
35
+ const entitiesAtPath = (rel: string): string[] => entitiesDeclaredAt(arch, rel);
31
36
 
32
- // The path templates a role declares (`…/constants.ts`, `…/actions/**`).
33
- const homeTemplates = (role: string): string[] => homesOf(arch, role).map((h) => h.template);
37
+ // The path templates an entity declares (`…/constants.ts`, `…/actions/**`).
38
+ const homeTemplates = (entity: string): string[] => homesOf(arch, entity).map((h) => h.template);
34
39
 
35
- // Where this role's code belongs FOR THIS FILE, and the box that hosts it —
40
+ // Where this entity's code belongs FOR THIS FILE, and the box that hosts it —
36
41
  // the engine's own answer, never a folder invented here.
37
- const homeFor = (role: string, rel: string) => homeForRole(arch, role, rel);
42
+ const homeFor = (entity: string, rel: string) => homeForEntity(arch, entity, rel);
38
43
 
39
44
  // The box that HOLDS a path — `apps/backend/document/store.ts` → the node that
40
45
  // owns `apps/backend/document`.
41
46
  const nodeAtPath = (path: string | null | undefined): string | null => boxOfPlace(arch, path);
42
47
 
43
- return { folderOf, pathOf, roles, rolesAtPath, homeTemplates, homeFor, nodeAtPath };
48
+ return { folderOf, pathOf, entities, entitiesAtPath, homeTemplates, homeFor, nodeAtPath };
44
49
  };
45
50
 
46
51
  export { make };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- // Turn a nested architecture query (`infer` blocks, invariant conditions, `when`
3
+ // Turn a nested architecture query (`infer` blocks, rule conditions, `when`
4
4
  // blocks) into short, readable lines: `subscriptions.length > 0`,
5
5
  // `descendants[*].kind = ClassDeclaration`. ONE walk, shared by the Node-side
6
- // summarizer (`data/invariants`) and the browser describer
6
+ // summarizer (`data/rules`) and the browser describer
7
7
  // (`src/utils/describe`), which used to carry the same algorithm twice and
8
8
  // could drift.
9
9
  //
@@ -13,14 +13,15 @@
13
13
  // setValue the text an `is set` operator prints; `undefined` keeps the value
14
14
  // the query carries (the browser reader), `""` blanks it (Node side)
15
15
 
16
- import { CONTAINERS, QUANTIFIERS, SCALAR_OPS } from "../../../entities/operators";
17
- import { isObj, isList, type FieldValue } from "../../../utils/field";
18
- import { dispatchOn } from "../../../utils/dispatch";
16
+ import { CONTAINERS, QUANTIFIERS, SCALAR_OPS } from "@md-code/follow-architecture/entities/operators";
17
+ import { isObj, isList, type FieldValue } from "@md-code/follow-architecture/utils/field";
18
+ import { dispatchOn } from "@md-code/follow-architecture/utils/dispatch";
19
19
 
20
20
  // One condition line: a path, an operator, and the value it demands.
21
21
  type Condition = { path: string; op: string; value: string };
22
22
 
23
- const fmt = (v: FieldValue): string => (typeof v === "string" || typeof v === "number" || typeof v === "boolean" ? String(v) : JSON.stringify(v));
23
+ const fmt = (v: FieldValue): string =>
24
+ typeof v === "string" || typeof v === "number" || typeof v === "boolean" ? String(v) : JSON.stringify(v);
24
25
 
25
26
  // The presentation options: which keys are prose, and what `is set` prints.
26
27
  type DescribeOptions = { ignore?: readonly string[]; setValue?: string };
@@ -47,7 +48,6 @@ const walkAt = (child: FieldValue, trail: string[], state: Walk): void => {
47
48
  // The scalar operator a key names, if it is one (the table is the engine's own).
48
49
  const scalarOpOf = (key: string): string | undefined => Object.entries(SCALAR_OPS).find(([k]) => k === key)?.[1];
49
50
 
50
-
51
51
  const walkEntry = (key: string, child: FieldValue, state: Walk): void => {
52
52
  if (state.ignore.has(key)) return;
53
53
  if (key === "at") {
@@ -1,11 +0,0 @@
1
- import type { Arch, CodeRoles } from "../entities/architecture";
2
- import type { Candidate, FileFacts } from "../entities/facts";
3
- declare const classifyRoles: (candidates: Candidate[] | null | undefined, codeRoles: CodeRoles | null | undefined, arch?: Arch | null, fileFacts?: FileFacts | null) => {
4
- present: string[];
5
- candidates: Candidate[];
6
- roleCtx: {
7
- present: string[];
8
- candidates: Candidate[];
9
- };
10
- };
11
- export { classifyRoles };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.classifyRoles = void 0;
4
- // Classify the file's candidates against the codeRoles.
5
- //
6
- // `classifyRoles(candidates, codeRoles)` returns:
7
- // • `present` — the flat list of role names present in the file
8
- // • `roleCtx` — `{ present, candidates }` where `candidates` are the
9
- // enriched facts (each carrying `role`, `parentRole`, and
10
- // `calls[].targetRole`).
11
- //
12
- // The input candidates array is NOT mutated in place — a shallow copy
13
- // (plus a copy of `calls`) is enriched, so the original facts the
14
- // pipeline built stay untouched.
15
- //
16
- // File-level `when` filters consume `ctx.facts` (which already includes
17
- // `roles` and `candidates`), so no separate predicate language is needed.
18
- const connector_1 = require("./connector");
19
- const classify_1 = require("../utils/classify");
20
- const read_when_1 = require("../utils/read-when");
21
- // A file with NO code candidates (a barrel of re-exports, a file of imports)
22
- // still has a nature a role may describe: the file's own facts are asked
23
- // against the same `infer` filters. The first role whose infer matches the
24
- // FILE facts describes the module scope — the same first-match-wins order the
25
- // pieces use (the shared `utils/classify` walk). A role inferred from a piece's
26
- // shape (`kind.own`) simply does not match the file, so nothing changes for
27
- // files that hold code. The qualified read is the shared `readWhen`: only a
28
- // file that is there is asked.
29
- const fileRoleOf = (fileFacts, codeRoles, arch) => (0, read_when_1.readWhen)(fileFacts, (f) => f != null, (f) => (0, classify_1.firstMatch)(f, (0, classify_1.definitionsOf)(codeRoles), { ...f, arch }), null);
30
- const classifyRoles = (candidates, codeRoles, arch, fileFacts = null) => {
31
- const copy = (candidates ?? []).map((c) => ({ ...c, calls: (c.calls ?? []).map((x) => ({ ...x })) }));
32
- (0, connector_1.enrichWithRoles)(copy, codeRoles, arch);
33
- const present = copy.map((c) => c.role).filter((r) => Boolean(r));
34
- // The module scope answers for statements no piece owns (`export * from`).
35
- // When no piece got a role, the file itself may still be describable.
36
- if (!present.length) {
37
- const fileRole = fileRoleOf(fileFacts, codeRoles, arch);
38
- if (fileRole)
39
- present.push(fileRole);
40
- }
41
- return { present, candidates: copy, roleCtx: { present, candidates: copy } };
42
- };
43
- exports.classifyRoles = classifyRoles;
@@ -1,5 +0,0 @@
1
- import type { Arch, CodeRoles } from "../entities/architecture";
2
- import type { Candidate, CallFact } from "../entities/facts";
3
- declare const roleOfTarget: (call: Partial<CallFact> | null | undefined, nameToRole: ReadonlyMap<string, Candidate>, arch?: Arch | null) => string | null;
4
- declare const enrichWithRoles: (candidates: Candidate[], codeRoles: CodeRoles | null | undefined, arch?: Arch | null) => Candidate[];
5
- export { enrichWithRoles, roleOfTarget };