@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,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EDGE_FACTS = exports.missingRequiredChild = exports.fitsRole = exports.checkFinally = void 0;
3
+ exports.EDGE_FACTS = exports.missingRequiredChild = exports.fitsEntity = exports.checkFinally = void 0;
4
4
  // finally-follow-architecture: the built-in structure rule. Four questions,
5
5
  // one module each, no wording (that lives in report/errorTypes).
6
- const location_1 = require("../../entities/location");
7
- const tree_1 = require("../../entities/tree");
8
- const children_1 = require("../children");
9
- const kinds_1 = require("../../entities/kinds");
6
+ const location_1 = require("@md-code/follow-architecture/entities/location");
7
+ const index_1 = require("@md-code/follow-architecture/entities/tree/index");
8
+ const children_1 = require("@md-code/follow-architecture/nodes/children");
9
+ const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
10
10
  Object.defineProperty(exports, "EDGE_FACTS", { enumerable: true, get: function () { return kinds_1.EDGE_FACTS; } });
11
- const roles_1 = require("./roles");
12
- Object.defineProperty(exports, "fitsRole", { enumerable: true, get: function () { return roles_1.fitsRole; } });
11
+ const entities_1 = require("./entities");
12
+ Object.defineProperty(exports, "fitsEntity", { enumerable: true, get: function () { return entities_1.fitsEntity; } });
13
13
  const required_1 = require("./required");
14
14
  const queries_1 = require("./queries");
15
15
  const relations_1 = require("./relations");
@@ -25,7 +25,7 @@ const checkNode = (ctx, node, out, findingFrom) => {
25
25
  (0, emit_1.emitFindings)(violations, ctx, node, out, findingFrom);
26
26
  };
27
27
  const checkFinally = (ctx, arch, out, findingFrom) => {
28
- const match = (0, tree_1.deepestMatch)(ctx.rel, arch);
28
+ const match = (0, index_1.deepestMatch)(ctx.rel, arch);
29
29
  if (!match)
30
30
  return;
31
31
  checkNode(ctx, match.node, out, findingFrom);
@@ -1,5 +1,5 @@
1
- import type { ArchNode } from "../../entities/architecture";
2
- import type { FileContext } from "../../entities/context";
1
+ import type { ArchNode } from "@md-code/follow-architecture/entities/architecture";
2
+ import type { FileContext } from "@md-code/follow-architecture/entities/context";
3
3
  import type { Violation } from "./violation";
4
4
  declare const checkChildQueries: (ctx: FileContext, node: ArchNode, violations: Violation[]) => void;
5
5
  export { checkChildQueries };
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkChildQueries = void 0;
4
4
  // A file that matches a declared child's query but sits outside it.
5
- const queries_1 = require("../../entities/queries");
6
- const children_1 = require("../children");
7
- const location_1 = require("../../entities/location");
5
+ const queries_1 = require("@md-code/follow-architecture/entities/queries");
6
+ const children_1 = require("@md-code/follow-architecture/nodes/children");
7
+ const location_1 = require("@md-code/follow-architecture/entities/location");
8
8
  const checkChildQueries = (ctx, node, violations) => {
9
9
  for (const child of node.children) {
10
10
  if (!child.query)
@@ -16,7 +16,10 @@ const checkChildQueries = (ctx, node, violations) => {
16
16
  if (re.test(ctx.rel))
17
17
  continue; // already in the right place
18
18
  const where = (0, location_1.fillTemplate)(childPath, ctx.rel);
19
- violations.push({ line: 1, text: `this file matches the query of node \`${child.slug ?? child.name}\` and belong in \`${where}\`` });
19
+ violations.push({
20
+ line: 1,
21
+ text: `this file matches the query of node \`${child.slug ?? child.name}\` and belong in \`${where}\``,
22
+ });
20
23
  }
21
24
  };
22
25
  exports.checkChildQueries = checkChildQueries;
@@ -1,5 +1,5 @@
1
- import type { Arch, ActionDef } from "../../entities/architecture";
2
- import type { FileContext } from "../../entities/context";
1
+ import type { Arch, ActionDef } from "@md-code/follow-architecture/entities/architecture";
2
+ import type { FileContext } from "@md-code/follow-architecture/entities/context";
3
3
  import type { Violation } from "./violation";
4
4
  declare const checkAccessorImports: (ctx: FileContext, arch: Arch, declared: Map<string, Map<string, ActionDef>>, violations: Violation[]) => void;
5
5
  export { checkAccessorImports };
@@ -1,27 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkAccessorImports = void 0;
4
- // The accessor-import check: a role handed out ONLY through declared accessors
4
+ // The accessor-import check: an entity handed out ONLY through declared accessors
5
5
  // (`scopeAccess`) may not be imported by name. The rule is the architecture's
6
- // own — the engine only reads which accessors a role declares and which names
6
+ // own — the engine only reads which accessors an entity declares and which names
7
7
  // an import takes out.
8
- const queries_1 = require("../../entities/queries");
9
- const location_1 = require("../../entities/location");
10
- const kinds_1 = require("../../entities/kinds");
11
- const roles_1 = require("../../code-roles/roles");
12
- // The function-scope accessors a role declares — the only names it is handed
8
+ const queries_1 = require("@md-code/follow-architecture/entities/queries");
9
+ const location_1 = require("@md-code/follow-architecture/entities/location");
10
+ const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
11
+ const entities_1 = require("@md-code/follow-architecture/code-entities/entities");
12
+ // The function-scope accessors an entity declares — the only names it is handed
13
13
  // out as.
14
- const accessorsOf = (action) => (action?.scopeAccess ?? []).filter((x) => x.scope === roles_1.SCOPE.FUNCTION).map((x) => x.segments[0]);
15
- // The role's own concrete homes (no placeholders): where an import of it may
14
+ const accessorsOf = (action) => (action?.scopeAccess ?? []).filter((x) => x.scope === entities_1.SCOPE.FUNCTION).map((x) => x.segments[0]);
15
+ // The entity's own concrete homes (no placeholders): where an import of it may
16
16
  // resolve to.
17
- const ownFilesOf = (arch, roleSlug) => (0, location_1.homesOf)(arch, roleSlug)
17
+ const ownFilesOf = (arch, entitySlug) => (0, location_1.homesOf)(arch, entitySlug)
18
18
  .map((h) => h.template)
19
19
  .filter((t) => !/[*{]/.test(t));
20
- // One role's accessor rule, asked of the file's imports.
21
- const checkRoleAccess = (ctx, roleSlug, accessors, violations) => {
20
+ // One entity's accessor rule, asked of the file's imports.
21
+ const checkEntityAccess = (ctx, entitySlug, accessors, violations) => {
22
22
  const arch = ctx.arch;
23
- const ownFile = ownFilesOf(arch, roleSlug);
24
- const importFilter = { resolved: { in: ownFile }, typeOnly: { equals: false }, named: { any: { not: { in: accessors } } } };
23
+ const ownFile = ownFilesOf(arch, entitySlug);
24
+ const importFilter = {
25
+ resolved: { in: ownFile },
26
+ typeOnly: { equals: false },
27
+ named: { any: { not: { in: accessors } } },
28
+ };
25
29
  const repoImports = ctx.facts?.imports ?? [];
26
30
  const scope = { arch, fileRel: ctx.rel };
27
31
  for (const imp of (0, queries_1.hitOf)(repoImports, { any: importFilter }, scope)) {
@@ -30,17 +34,17 @@ const checkRoleAccess = (ctx, roleSlug, accessors, violations) => {
30
34
  continue;
31
35
  violations.push({
32
36
  line: imp.line ?? 1,
33
- text: `\`${bad.join("`, `")}\` is taken out of \`${imp.resolved}\`, but \`${roleSlug}\` is handed out only as ${accessors.map((a) => `\`${a}(…)\``).join(", ")}`,
37
+ text: `\`${bad.join("`, `")}\` is taken out of \`${imp.resolved}\`, but \`${entitySlug}\` is handed out only as ${accessors.map((a) => `\`${a}(…)\``).join(", ")}`,
34
38
  fix: `Import one of the declared accessors (${accessors.join(", ")}) instead of \`${bad[0]}\`.`,
35
39
  });
36
40
  }
37
41
  };
38
42
  const checkAccessorImports = (ctx, arch, declared, violations) => {
39
- for (const roleSlug of Object.keys(arch.codeRoles ?? {})) {
40
- const accessors = accessorsOf(declared.get(kinds_1.RELATION.CALL)?.get(roleSlug));
43
+ for (const entitySlug of Object.keys(arch.entities ?? {})) {
44
+ const accessors = accessorsOf(declared.get(kinds_1.RELATION.CALL)?.get(entitySlug));
41
45
  if (!accessors.length)
42
46
  continue;
43
- checkRoleAccess(ctx, roleSlug, accessors, violations);
47
+ checkEntityAccess(ctx, entitySlug, accessors, violations);
44
48
  }
45
49
  };
46
50
  exports.checkAccessorImports = checkAccessorImports;
@@ -1,7 +1,7 @@
1
- import { type Edge } from "../../entities/kinds";
2
- import type { Arch, ActionDef } from "../../entities/architecture";
3
- import type { FileContext } from "../../entities/context";
4
- import type { Caps } from "../../entities/location/where";
1
+ import { type Edge } from "@md-code/follow-architecture/entities/kinds";
2
+ import type { Arch, ActionDef } from "@md-code/follow-architecture/entities/architecture";
3
+ import type { FileContext } from "@md-code/follow-architecture/entities/context";
4
+ import type { Caps } from "@md-code/follow-architecture/entities/location/where";
5
5
  import type { RelationGroup } from "./relations-group";
6
6
  type Pair = {
7
7
  targetSlug: string;
@@ -21,7 +21,7 @@ type JudgeCtx = {
21
21
  arch: Arch;
22
22
  kind: string;
23
23
  actionDecls: Map<string, ActionDef>;
24
- fileRoles: string[];
24
+ fileEntities: string[];
25
25
  };
26
26
  declare const judgeEdge: (edge: Edge, jctx: JudgeCtx) => EdgeJudgment | null;
27
27
  declare const joinGroup: (group: RelationGroup, edge: Edge) => void;
@@ -1,53 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.joinGroup = exports.judgeEdge = void 0;
4
- // ONE edge, judged by the role that owns its target: which target roles could
4
+ // ONE edge, judged by the entity that owns its target: which target entities could
5
5
  // allow it, what each declares, and whether every one of them refuses. The
6
6
  // ranking picks the refusal that explains the rule best; only when EVERY
7
7
  // target refuses is there a finding to group.
8
- const location_1 = require("../../entities/location");
9
- const tree_1 = require("../../entities/tree");
10
- const kinds_1 = require("../../entities/kinds");
11
- const verdicts_1 = require("../../utils/verdicts");
12
- const permission_1 = require("../../utils/permission");
13
- const roles_1 = require("./roles");
14
- // The roles the edge's SOURCE speaks with: the piece's own role when it has
15
- // one; a file-level statement speaks with the file's roles; an unroled piece
8
+ const location_1 = require("@md-code/follow-architecture/entities/location");
9
+ const index_1 = require("@md-code/follow-architecture/entities/tree/index");
10
+ const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
11
+ const verdicts_1 = require("@md-code/follow-architecture/utils/verdicts");
12
+ const permission_1 = require("@md-code/follow-architecture/utils/permission");
13
+ const entities_1 = require("./entities");
14
+ const observed_1 = require("@md-code/follow-architecture/report/observed");
15
+ // The entities the edge's SOURCE speaks with: the piece's own entity when it has
16
+ // one; a file-level statement speaks with the file's entities; an unclassified piece
16
17
  // speaks with none.
17
- const sourceRolesOf = (edge, fileRoles) => {
18
- const own = edge.role ? [edge.role] : [...fileRoles];
19
- return edge.piece && !edge.role ? [] : own;
18
+ const sourceEntitiesOf = (edge, fileEntities) => {
19
+ const own = edge.entity ? [edge.entity] : [...fileEntities];
20
+ return edge.piece && !edge.entity ? [] : own;
20
21
  };
21
- // The roles the TARGET may be judged by: a self-statement keeps the source's
22
- // own roles; anything else asks the tree what is declared at the target path.
23
- const targetRolesOf = (edge, jctx, selfStatement) => {
22
+ // The entities the TARGET may be judged by: a self-statement keeps the source's
23
+ // own entities; anything else asks the tree what is declared at the target path.
24
+ const targetEntitiesOf = (edge, jctx, selfStatement) => {
24
25
  if (!selfStatement)
25
- return (0, location_1.rolesAtPath)(jctx.arch, edge.path);
26
- if (edge.role)
27
- return [edge.role];
28
- return jctx.fileRoles.length ? jctx.fileRoles : (0, location_1.rolesAtPath)(jctx.arch, edge.path);
26
+ return (0, location_1.entitiesAtPath)(jctx.arch, edge.path);
27
+ if (edge.entity)
28
+ return [edge.entity];
29
+ return jctx.fileEntities.length ? jctx.fileEntities : (0, location_1.entitiesAtPath)(jctx.arch, edge.path);
29
30
  };
30
- // The scope one action is judged in: the file's facts, the source's roles,
31
+ // The scope one action is judged in: the file's facts, the source's entities,
31
32
  // and the edge itself (the call may need WHAT was passed).
32
- const scopeOf = (ctx, sourceRoles, edge) => {
33
+ const scopeOf = (ctx, sourceEntities, edge) => {
33
34
  const facts = ctx.facts;
34
- const base = facts ?? { lines: [], imports: [], exports: [], location: { path: ctx.rel, segments: [], exts: [], fileName: "", words: [], files: [], siblings: [] }, reads: [], kind: { own: { is: "SourceFile" }, descendants: [] }, candidates: [], roles: [] };
35
- return { ...base, roles: sourceRoles, edge: edge.fact ?? null };
35
+ const base = facts ?? {
36
+ lines: [],
37
+ imports: [],
38
+ exports: [],
39
+ location: { path: ctx.rel, segments: [], exts: [], fileName: "", words: [], files: [], siblings: [] },
40
+ reads: [],
41
+ kind: { own: { is: "SourceFile" }, descendants: [] },
42
+ candidates: [],
43
+ entities: [],
44
+ };
45
+ return { ...base, entities: sourceEntities, edge: edge.fact ?? null };
36
46
  };
37
- // One target role's verdict: the action it declares for this fact kind (or a
47
+ // One target entity's verdict: the action it declares for this fact kind (or a
38
48
  // missing one), and whether the source may do it. The allow/except walk is the
39
- // shared `permissionOf` core; a source with no roles is granted nothing.
40
- const pairOf = (targetSlug, edge, sourceRoles, jctx) => {
49
+ // shared `permissionOf` core; a source with no entities is granted nothing.
50
+ const pairOf = (targetSlug, edge, sourceEntities, jctx) => {
41
51
  const { ctx, arch } = jctx;
42
- const caps = (0, tree_1.targetCapsFor)(edge.path ?? "", arch);
52
+ const caps = (0, index_1.targetCapsFor)(edge.path ?? "", arch);
43
53
  const action = jctx.actionDecls.get(targetSlug);
44
54
  if (!action)
45
55
  return { targetSlug, action: { where: [], missing: true }, caps, violation: true };
46
- const { allowed, denied } = (0, permission_1.permissionOf)(action, { rel: ctx.rel, arch, scope: scopeOf(ctx, sourceRoles, edge), caps });
47
- const violation = sourceRoles.length ? !allowed || denied : true;
56
+ const { allowed, denied } = (0, permission_1.permissionOf)(action, {
57
+ rel: ctx.rel,
58
+ arch,
59
+ scope: scopeOf(ctx, sourceEntities, edge),
60
+ caps,
61
+ });
62
+ const violation = sourceEntities.length ? !allowed || denied : true;
48
63
  return { targetSlug, action, caps, violation, outward: denied };
49
64
  };
50
- // A role that NAMES who may do it explains the rule best; a declared action
65
+ // An entity that NAMES who may do it explains the rule best; a declared action
51
66
  // beats a missing one; fewer conditions beat more.
52
67
  const rankPairs = (a, b) => Number(Boolean(b.action.where?.length)) - Number(Boolean(a.action.where?.length)) ||
53
68
  Number(!b.action.missing) - Number(!a.action.missing) ||
@@ -61,30 +76,35 @@ const routeOf = (targetSlug, jctx, caps) => {
61
76
  const route = callOk ? ((callDecl?.scopeAccess ?? [])[0] ?? null) : null;
62
77
  return route ? (0, location_1.accessorLabel)(route) : null;
63
78
  };
64
- const declaredCall = (jctx, targetSlug) => jctx.ctx.arch.codeRoles[targetSlug]?.actions[kinds_1.RELATION.CALL] ?? null;
79
+ const declaredCall = (jctx, targetSlug) => jctx.ctx.arch.entities[targetSlug]?.actions[kinds_1.RELATION.CALL] ?? null;
65
80
  // The concrete destinations the refusal can offer: the allowed places that
66
81
  // are not the target itself, not this file, not this folder.
67
82
  const destOf = (places, targetSlug, rel) => {
68
- const others = places.filter((p) => p.role !== targetSlug);
83
+ const others = places.filter((p) => p.entity !== targetSlug);
69
84
  const spots = (others.length ? others : places)
70
85
  .filter((pl) => !pl.filter)
71
- .flatMap((pl) => pl.paths.map((path) => ({ role: pl.role, path })))
72
- .filter((sp) => sp.path !== rel && sp.path !== (0, location_1.dirOf)(rel) && sp.role !== targetSlug);
86
+ .flatMap((pl) => pl.paths.map((path) => ({ entity: pl.entity, path })))
87
+ .filter((sp) => sp.path !== rel && sp.path !== (0, location_1.dirOf)(rel) && sp.entity !== targetSlug);
73
88
  return spots[0]?.path ?? null;
74
89
  };
75
- // The group one refused edge starts or joins. The allowed roles are the
90
+ // The group one refused edge starts or joins. The allowed entities are the
76
91
  // places WITHOUT the target itself (the target cannot allow its own refusal);
77
92
  // only when no other place exists does the target's own list stand.
78
93
  const groupOf = (edge, pair, jctx, all) => {
79
94
  const { ctx, kind } = jctx;
80
95
  const route = routeOf(pair.targetSlug, jctx, pair.caps);
81
- const others = all.filter((p) => p.role !== pair.targetSlug);
96
+ const others = all.filter((p) => p.entity !== pair.targetSlug);
82
97
  const places = others.length ? others : all;
83
98
  return {
84
99
  kind,
85
100
  targetNode: pair.targetSlug,
86
- allowedRoles: [...new Set(places.map((pl) => pl.role).filter((r) => Boolean(r)))],
87
- sameRoles: [...new Set(places.filter((pl) => pl.same).map((pl) => pl.role).filter((r) => Boolean(r)))],
101
+ allowedEntities: [...new Set(places.map((pl) => pl.entity).filter((r) => Boolean(r)))],
102
+ sameEntities: [
103
+ ...new Set(places
104
+ .filter((pl) => pl.same)
105
+ .map((pl) => pl.entity)
106
+ .filter((r) => Boolean(r))),
107
+ ],
88
108
  via: (pair.action.scopeAccess ?? []).map(location_1.accessorLabel),
89
109
  route,
90
110
  dest: destOf(all, pair.targetSlug, ctx.rel),
@@ -93,23 +113,26 @@ const groupOf = (edge, pair, jctx, all) => {
93
113
  path: edge.path,
94
114
  pieces: new Map(),
95
115
  piece: edge.piece ?? null,
96
- pieceRole: edge.role ?? null,
116
+ pieceEntity: edge.entity ?? null,
97
117
  silent: Boolean(pair.action.missing) || !(pair.action.where ?? []).length,
98
118
  filtered: Boolean(pair.outward),
99
119
  self: edge.path === ctx.rel,
100
120
  fact: edge.fact ?? null,
101
121
  };
102
122
  };
103
- // Judge one edge: every target role's verdict, ranked; when ALL refuse, the
123
+ // What the scan SAW is recorded before the judgment drops the allowed edges below:
124
+ // the graph draws them, and this is the only place both halves are still together.
125
+ // Judge one edge: every target entity's verdict, ranked; when ALL refuse, the
104
126
  // best-explaining one names the group.
105
127
  const judgeEdge = (edge, jctx) => {
106
- const sourceRoles = sourceRolesOf(edge, jctx.fileRoles);
128
+ const sourceEntities = sourceEntitiesOf(edge, jctx.fileEntities);
107
129
  const selfStatement = edge.path === jctx.ctx.rel;
108
- const pairs = targetRolesOf(edge, jctx, selfStatement).map((slug) => pairOf(slug, edge, sourceRoles, jctx));
130
+ const pairs = targetEntitiesOf(edge, jctx, selfStatement).map((slug) => pairOf(slug, edge, sourceEntities, jctx));
131
+ (0, observed_1.recordJudged)({ kind: jctx.kind, file: jctx.ctx.rel, line: edge.line ?? 1, sentence: edge.what }, sourceEntities, pairs);
109
132
  const worst = (0, verdicts_1.worstWhenAllRefuse)(pairs, rankPairs);
110
133
  if (!worst)
111
134
  return null;
112
- const places = (0, roles_1.allowedPlaces)(worst.action.where, jctx.arch, worst.caps);
135
+ const places = (0, entities_1.allowedPlaces)(worst.action.where, jctx.arch, worst.caps);
113
136
  const group = groupOf(edge, worst, jctx, places);
114
137
  const key = `${jctx.kind}|${worst.targetSlug}|${edge.what}`;
115
138
  return { key, group };
@@ -120,6 +143,6 @@ const joinGroup = (group, edge) => {
120
143
  group.lines.push(edge.line ?? 1);
121
144
  group.what.add(edge.what);
122
145
  if (edge.piece)
123
- group.pieces.set(edge.piece, edge.role ?? null);
146
+ group.pieces.set(edge.piece, edge.entity ?? null);
124
147
  };
125
148
  exports.joinGroup = joinGroup;
@@ -1,12 +1,12 @@
1
- import type { Arch, QueryFilter } from "../../entities/architecture";
2
- import type { FileContext } from "../../entities/context";
1
+ import type { Arch, QueryFilter } from "@md-code/follow-architecture/entities/architecture";
2
+ import type { FileContext } from "@md-code/follow-architecture/entities/context";
3
3
  import type { Violation } from "./violation";
4
- import type { RelationToken as SharedToken } from "../../entities/token";
4
+ import type { RelationToken as SharedToken } from "@md-code/follow-architecture/entities/token";
5
5
  type RelationGroup = {
6
6
  kind: string;
7
7
  targetNode: string;
8
- allowedRoles: string[];
9
- sameRoles: string[];
8
+ allowedEntities: string[];
9
+ sameEntities: string[];
10
10
  via: string[];
11
11
  route: string | null;
12
12
  dest: string | null;
@@ -15,7 +15,7 @@ type RelationGroup = {
15
15
  path: string | null;
16
16
  pieces: Map<string, string | null>;
17
17
  piece: string | null;
18
- pieceRole: string | null;
18
+ pieceEntity: string | null;
19
19
  silent: boolean;
20
20
  filtered: boolean;
21
21
  self: boolean;
@@ -23,7 +23,7 @@ type RelationGroup = {
23
23
  };
24
24
  type RelationToken = Required<Pick<SharedToken, "code" | "via">> & {
25
25
  fact: QueryFilter | null;
26
- subject: Pick<Required<NonNullable<SharedToken["subject"]>>, "pieces" | "roles" | "plural">;
26
+ subject: Pick<Required<NonNullable<SharedToken["subject"]>>, "pieces" | "entities" | "plural">;
27
27
  why: Required<NonNullable<SharedToken["why"]>>;
28
28
  };
29
29
  declare const describeGroups: (groups: ReadonlyMap<string, RelationGroup>, ctx: FileContext, arch: Arch, violations: Violation[]) => void;
@@ -4,44 +4,44 @@ exports.describeGroups = void 0;
4
4
  // One verdict per group of refused relations, built from facts and nothing
5
5
  // else: the sentence (`relationMessage`), the repair, and one violation per
6
6
  // line the group covers.
7
- const tree_1 = require("../../entities/tree");
8
- const kinds_1 = require("../../entities/kinds");
9
- const phrases_1 = require("../../report/errorTypes/vocabulary/phrases");
10
- // The owner role of a state-changing relation's target — the report names it.
11
- const ownerRoleOf = (g, arch) => {
7
+ const index_1 = require("@md-code/follow-architecture/entities/tree/index");
8
+ const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
9
+ const phrases_1 = require("@md-code/follow-architecture/report/errorTypes/vocabulary/phrases");
10
+ // The owner entity of a state-changing relation's target — the report names it.
11
+ const ownerEntityOf = (g, arch) => {
12
12
  if (!(0, kinds_1.changesState)(g.kind))
13
13
  return null;
14
- const owner = (0, tree_1.deepestMatch)(String(g.path ?? ""), arch)?.node ?? null;
15
- return (owner?.roles ?? []).filter(Boolean)[0] ?? null;
14
+ const owner = (0, index_1.deepestMatch)(String(g.path ?? ""), arch)?.node ?? null;
15
+ return (owner?.entities ?? []).filter(Boolean)[0] ?? null;
16
16
  };
17
- // The fact with the owner role attached — the report names it. A fact that is
17
+ // The fact with the owner entity attached — the report names it. A fact that is
18
18
  // not a record carries nothing to attach to.
19
- const factWithOwner = (g, ownerRole) => {
19
+ const factWithOwner = (g, ownerEntity) => {
20
20
  if (!g.fact || typeof g.fact !== "object" || Array.isArray(g.fact))
21
21
  return null;
22
- return { ...g.fact, ownerRole };
22
+ return { ...g.fact, ownerEntity };
23
23
  };
24
- // Why the relation is refused: nothing allows it, some roles do, or nobody may.
24
+ // Why the relation is refused: nothing allows it, some entities do, or nobody may.
25
25
  const whyCodeOf = (g) => {
26
26
  if (g.silent)
27
27
  return "silent";
28
- return g.allowedRoles.length ? "allowed" : "nobody";
28
+ return g.allowedEntities.length ? "allowed" : "nobody";
29
29
  };
30
- const tokenOf = (g, arch, fileRoles) => {
30
+ const tokenOf = (g, arch, fileEntities) => {
31
31
  const names = [...g.pieces.keys()];
32
- const roles = [...new Set([...g.pieces.values()].filter((r) => Boolean(r)))];
33
- const ownerRole = ownerRoleOf(g, arch);
32
+ const entities = [...new Set([...g.pieces.values()].filter((r) => Boolean(r)))];
33
+ const ownerEntity = ownerEntityOf(g, arch);
34
34
  return {
35
35
  code: "relation.forbidden",
36
- fact: factWithOwner(g, ownerRole),
37
- subject: { pieces: names, roles: names.length ? roles : [...fileRoles], plural: names.length > 1 },
36
+ fact: factWithOwner(g, ownerEntity),
37
+ subject: { pieces: names, entities: names.length ? entities : [...fileEntities], plural: names.length > 1 },
38
38
  // The route the architecture DOES allow to the same code, if it names one.
39
39
  via: g.via?.[0] ?? g.route ?? null,
40
40
  why: {
41
41
  code: whyCodeOf(g),
42
- roles: g.allowedRoles,
42
+ entities: g.allowedEntities,
43
43
  // The ones the rule limits to the SAME feature instance.
44
- sameRoles: g.sameRoles,
44
+ sameEntities: g.sameEntities,
45
45
  self: Boolean(g.self),
46
46
  outward: Boolean(g.filtered),
47
47
  targetNode: g.targetNode ?? null,
@@ -55,12 +55,15 @@ const tokenOf = (g, arch, fileRoles) => {
55
55
  const relationFix = (g, token) => {
56
56
  const target = `\`${g.path ?? g.targetNode}\``;
57
57
  const kind = g.kind;
58
- const roles = token.why.roles;
58
+ const entities = token.why.entities;
59
59
  // The call itself is fine; the VALUE it was given is what the `except` refused.
60
60
  if (token.why.outward) {
61
- return { code: "rewrite", fix: `Keep this \`${kind}\` of ${target} and change what it is given: the rule's \`except\` refuses that value.` };
61
+ return {
62
+ code: "rewrite",
63
+ fix: `Keep this \`${kind}\` of ${target} and change what it is given: the rule's \`except\` refuses that value.`,
64
+ };
62
65
  }
63
- if (!roles.length) {
66
+ if (!entities.length) {
64
67
  // Nothing declares who may do it — or nobody may: either way the line is the
65
68
  // thing that goes, and saying so is the whole advice.
66
69
  return {
@@ -68,15 +71,15 @@ const relationFix = (g, token) => {
68
71
  fix: `Delete this \`${kind}\` of ${target}: no code in this architecture is allowed to reach \`${g.targetNode}\` that way, so the line cannot be made legal where it stands.`,
69
72
  };
70
73
  }
71
- const who = roles.map((r) => `\`${r}\``).join(", ");
74
+ const who = entities.map((r) => `\`${r}\``).join(", ");
72
75
  return {
73
76
  code: "remove",
74
- fix: `Delete this \`${kind}\` of ${target}, or do it from ${who} — that is the only code that may ${kind} it${token.why.sameRoles.length ? ", and only in the same feature instance" : ""}.`,
77
+ fix: `Delete this \`${kind}\` of ${target}, or do it from ${who} — that is the only code that may ${kind} it${token.why.sameEntities.length ? ", and only in the same feature instance" : ""}.`,
75
78
  };
76
79
  };
77
80
  // One group → one verdict, carried on every line it covers.
78
81
  const describeGroup = (g, ctx, arch, violations) => {
79
- const token = tokenOf(g, arch, ctx.facts?.roles ?? []);
82
+ const token = tokenOf(g, arch, ctx.facts?.entities ?? []);
80
83
  const text = (0, phrases_1.relationMessage)(token, { file: ctx.rel });
81
84
  const lines = [...new Set(g.lines)].sort((a, b) => a - b);
82
85
  // ONE repair per group, carried on every line it covers: a finding without
@@ -1,5 +1,5 @@
1
- import type { Arch } from "../../entities/architecture";
2
- import type { FileContext } from "../../entities/context";
1
+ import type { Arch } from "@md-code/follow-architecture/entities/architecture";
2
+ import type { FileContext } from "@md-code/follow-architecture/entities/context";
3
3
  import type { Violation } from "./violation";
4
4
  declare const checkRelations: (ctx: FileContext, arch: Arch, violations: Violation[]) => void;
5
5
  export { checkRelations };
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkRelations = void 0;
4
- // Relations: every file→file edge, judged by the role that owns the target.
4
+ // Relations: every file→file edge, judged by the entity that owns the target.
5
5
  // Collect (group the refusals), then describe (one token per group). The
6
6
  // judgment of ONE edge lives in `relations-edge`; the accessor-import check
7
7
  // in `relations-access`; the group's sentence in `relations-group`.
8
- const kinds_1 = require("../../entities/kinds");
9
- const gate_1 = require("../../utils/gate");
10
- const judged_1 = require("../../utils/judged");
11
- const accumulate_1 = require("../../utils/accumulate");
8
+ const kinds_1 = require("@md-code/follow-architecture/entities/kinds");
9
+ const gate_1 = require("@md-code/follow-architecture/utils/gate");
10
+ const judged_1 = require("@md-code/follow-architecture/utils/judged");
11
+ const accumulate_1 = require("@md-code/follow-architecture/utils/accumulate");
12
12
  const relations_edge_1 = require("./relations-edge");
13
13
  const relations_access_1 = require("./relations-access");
14
14
  const relations_group_1 = require("./relations-group");
@@ -26,31 +26,35 @@ const uniqueEdges = (kind, edges) => {
26
26
  return out;
27
27
  };
28
28
  // Is this edge the closed-world rule's business? A LIBRARY is not a place the
29
- // tree declares: `react`, `@apollo/client`, `fs` have no node and no role home,
29
+ // tree declares: `react`, `@apollo/client`, `fs` have no node and no entity home,
30
30
  // so there is no folder-level rule to judge them by. What a piece may do with a
31
31
  // library is the CANDIDATE's own business — `infer` reads `calls.module` /
32
32
  // `imports.source` directly. Skipping here keeps the closed-world rule about
33
33
  // REPO code; a library edge judged against an empty home list would report
34
34
  // every `styled.div` and every `useState` as a forbidden relation. The verdicts
35
35
  // are the shared gate: an edge is judged when none of the skips fires.
36
- const judgedEdge = (edge, fileRoles) => (0, gate_1.admitsWhenNoneReject)(edge, [(e) => e.external, (e) => Boolean(e.piece) && !e.role, (e) => !e.piece && !fileRoles.length]);
36
+ const judgedEdge = (edge, fileEntities) => (0, gate_1.admitsWhenNoneReject)(edge, [
37
+ (e) => e.external,
38
+ (e) => Boolean(e.piece) && !e.entity,
39
+ (e) => !e.piece && !fileEntities.length,
40
+ ]);
37
41
  // The edges of one fact kind that the closed-world rule owns (not a library's,
38
- // not an unroled piece's, not a roleless file's) — the ones it judges.
42
+ // not an unclassified piece's, not a entityless file's) — the ones it judges.
39
43
  const ownedEdges = (kind, ctx) => {
40
44
  const facts = ctx.facts;
41
45
  if (!facts)
42
46
  return [];
43
- const fileRoles = facts.roles ?? [];
44
- return uniqueEdges(kind, kinds_1.EDGE_FACTS[kind](facts)).filter((e) => judgedEdge(e, fileRoles));
47
+ const fileEntities = facts.entities ?? [];
48
+ return uniqueEdges(kind, kinds_1.EDGE_FACTS[kind](facts)).filter((e) => judgedEdge(e, fileEntities));
45
49
  };
46
50
  // One kind's refusals → groups. The judge-and-keep walk is the shared
47
51
  // `judgedItems` core; the keyed merge is the shared `accumulateByKey` core.
48
52
  // Returns whether any edge of this kind was owned (passed the skips).
49
53
  const collectKind = (kind, actionDecls, jctx) => {
50
54
  const { ctx, arch, groups } = jctx;
51
- const fileRoles = ctx.facts?.roles ?? [];
55
+ const fileEntities = ctx.facts?.entities ?? [];
52
56
  const edges = ownedEdges(kind, ctx);
53
- const judgments = (0, judged_1.judgedItems)(edges, (e) => (0, relations_edge_1.judgeEdge)(e, { ctx, arch, kind, actionDecls, fileRoles }));
57
+ const judgments = (0, judged_1.judgedItems)(edges, (e) => (0, relations_edge_1.judgeEdge)(e, { ctx, arch, kind, actionDecls, fileEntities }));
54
58
  (0, accumulate_1.accumulateByKey)(judgments.map(({ item, verdict }) => ({ key: verdict.key, item, bucket: verdict.group })), groups, relations_edge_1.joinGroup);
55
59
  return edges.length > 0;
56
60
  };
@@ -1,5 +1,5 @@
1
- import type { ArchNode } from "../../entities/architecture";
2
- import type { FileContext } from "../../entities/context";
3
- import type { Finding, FindingFrom } from "../../entities/findings";
1
+ import type { ArchNode } from "@md-code/follow-architecture/entities/architecture";
2
+ import type { FileContext } from "@md-code/follow-architecture/entities/context";
3
+ import type { Finding, FindingFrom } from "@md-code/follow-architecture/entities/findings";
4
4
  declare const checkRequiredChildren: (ctx: FileContext, node: ArchNode, out: Finding[], findingFrom: FindingFrom) => void;
5
5
  export { checkRequiredChildren };
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkRequiredChildren = void 0;
4
4
  // Required children: is this folder an instance of its node, and is anything
5
5
  // the node requires missing.
6
- const location_1 = require("../../entities/location");
7
- const children_1 = require("../children");
6
+ const location_1 = require("@md-code/follow-architecture/entities/location");
7
+ const children_1 = require("@md-code/follow-architecture/nodes/children");
8
8
  // Where the run remembers which folders it has already spoken for.
9
9
  const foldersOf = (ctx) => ctx.dedupe?.get("required") ?? new Set();
10
10
  const remember = (ctx, folders, key) => {
@@ -14,16 +14,16 @@ const remember = (ctx, folders, key) => {
14
14
  // A home outside the folder: a place the code could move to. A home inside
15
15
  // (or the folder itself) is not an offer.
16
16
  const outsideHome = (path, folder) => Boolean(path) && path !== folder && !path.startsWith(`${folder}/`);
17
- // The homes the file's own roles would put its code in, outside this folder —
17
+ // The homes the file's own entities would put its code in, outside this folder —
18
18
  // the destinations a "this folder is not described" finding can offer.
19
19
  const homesOutside = (ctx, arch, folder) => {
20
20
  const byPath = new Map();
21
21
  for (const c of ctx.facts?.candidates ?? []) {
22
- if (!c.role)
22
+ if (!c.entity)
23
23
  continue;
24
- const path = (0, location_1.placeFor)(arch, c.role, ctx.rel)?.path ?? null;
24
+ const path = (0, location_1.placeFor)(arch, c.entity, ctx.rel)?.path ?? null;
25
25
  if (outsideHome(path, folder) && !byPath.has(path))
26
- byPath.set(path, c.role);
26
+ byPath.set(path, c.entity);
27
27
  }
28
28
  return byPath;
29
29
  };
@@ -38,7 +38,9 @@ const foreignFolder = (...args) => {
38
38
  return;
39
39
  remember(ctx, folders, key);
40
40
  const byPath = homesOutside(ctx, arch, folder);
41
- const where = byPath.size ? [...byPath.entries()].map(([path, role]) => `\`${path}\` (${role})`).join(" and ") : null;
41
+ const where = byPath.size
42
+ ? [...byPath.entries()].map(([path, entity]) => `\`${path}\` (${entity})`).join(" and ")
43
+ : null;
42
44
  out.push(findingFrom({
43
45
  key,
44
46
  report: {