@md-code/follow-architecture 0.1.1 → 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 (487) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +202 -0
  3. package/README.md +1420 -139
  4. package/dist/aliases.d.ts +3 -0
  5. package/dist/aliases.js +12 -0
  6. package/dist/args.d.ts +18 -0
  7. package/dist/args.js +94 -0
  8. package/dist/bin/follow-architecture.d.ts +2 -0
  9. package/dist/bin/follow-architecture.js +23 -0
  10. package/dist/closure-project.d.ts +4 -0
  11. package/dist/closure-project.js +132 -0
  12. package/dist/code-entities/classify.d.ts +11 -0
  13. package/dist/code-entities/classify.js +45 -0
  14. package/dist/code-entities/connector.d.ts +8 -0
  15. package/dist/code-entities/connector.js +119 -0
  16. package/dist/code-entities/entities.d.ts +9 -0
  17. package/dist/code-entities/entities.js +227 -0
  18. package/dist/code-entities/project.d.ts +21 -0
  19. package/dist/code-entities/project.js +259 -0
  20. package/dist/code-entities/walk.d.ts +31 -0
  21. package/dist/code-entities/walk.js +105 -0
  22. package/dist/config-options.d.ts +76 -0
  23. package/dist/config-options.js +52 -0
  24. package/dist/config-project.d.ts +4 -0
  25. package/dist/config-project.js +92 -0
  26. package/dist/config-report.d.ts +19 -0
  27. package/dist/config-report.js +161 -0
  28. package/dist/config-rule.d.ts +95 -0
  29. package/dist/config-rule.js +211 -0
  30. package/dist/config-state.d.ts +25 -0
  31. package/dist/config-state.js +269 -0
  32. package/dist/config.d.ts +107 -0
  33. package/dist/config.js +38 -0
  34. package/dist/css/index.d.ts +31 -0
  35. package/dist/css/index.js +251 -0
  36. package/dist/css/syntax/css/gate.d.ts +2 -0
  37. package/dist/css/syntax/css/gate.js +69 -0
  38. package/dist/css/syntax/css/index.d.ts +7 -0
  39. package/dist/css/syntax/css/index.js +51 -0
  40. package/dist/css/syntax/css/reference.d.ts +3 -0
  41. package/dist/css/syntax/css/reference.js +36 -0
  42. package/dist/css/syntax/language.d.ts +25 -0
  43. package/dist/css/syntax/language.js +81 -0
  44. package/dist/css/syntax/scss/index.d.ts +25 -0
  45. package/dist/css/syntax/scss/index.js +95 -0
  46. package/dist/css/syntax/scss/reference.d.ts +3 -0
  47. package/dist/css/syntax/scss/reference.js +17 -0
  48. package/dist/css/syntax/styled/document.d.ts +68 -0
  49. package/dist/css/syntax/styled/document.js +261 -0
  50. package/dist/css/syntax/styled/markup.d.ts +6 -0
  51. package/dist/css/syntax/styled/markup.js +84 -0
  52. package/dist/css/syntax/styled/tags.d.ts +2 -0
  53. package/dist/css/syntax/styled/tags.js +22 -0
  54. package/dist/css/syntax/styled/template.d.ts +23 -0
  55. package/dist/css/syntax/styled/template.js +67 -0
  56. package/dist/css/syntax/tailwind/tailwind-engine.d.ts +23 -0
  57. package/dist/css/syntax/tailwind/tailwind-engine.js +37 -0
  58. package/dist/css/syntax/tailwind/tailwind.d.ts +26 -0
  59. package/dist/css/syntax/tailwind/tailwind.js +118 -0
  60. package/dist/css/value/check.d.ts +86 -0
  61. package/dist/css/value/check.js +122 -0
  62. package/dist/css/value/expression/arithmetic.d.ts +7 -0
  63. package/dist/css/value/expression/arithmetic.js +73 -0
  64. package/dist/css/value/expression/block.d.ts +9 -0
  65. package/dist/css/value/expression/block.js +92 -0
  66. package/dist/css/value/expression/conditional.d.ts +8 -0
  67. package/dist/css/value/expression/conditional.js +53 -0
  68. package/dist/css/value/expression/index.d.ts +5 -0
  69. package/dist/css/value/expression/index.js +73 -0
  70. package/dist/css/value/expression/map.d.ts +7 -0
  71. package/dist/css/value/expression/map.js +113 -0
  72. package/dist/css/value/object/index.d.ts +5 -0
  73. package/dist/css/value/object/index.js +113 -0
  74. package/dist/css/value/object/members.d.ts +7 -0
  75. package/dist/css/value/object/members.js +103 -0
  76. package/dist/css/value/object/node.d.ts +8 -0
  77. package/dist/css/value/object/node.js +134 -0
  78. package/dist/css/value/object/path.d.ts +10 -0
  79. package/dist/css/value/object/path.js +152 -0
  80. package/dist/css/value/pieces.d.ts +61 -0
  81. package/dist/css/value/pieces.js +65 -0
  82. package/dist/css/value/resolve.d.ts +33 -0
  83. package/dist/css/value/resolve.js +104 -0
  84. package/dist/css/value/scope.d.ts +28 -0
  85. package/dist/css/value/scope.js +205 -0
  86. package/dist/css/value/substitute.d.ts +10 -0
  87. package/dist/css/value/substitute.js +145 -0
  88. package/dist/css/value/values.d.ts +23 -0
  89. package/dist/css/value/values.js +131 -0
  90. package/dist/entities/architecture.d.ts +165 -0
  91. package/dist/entities/architecture.js +2 -0
  92. package/dist/entities/ast/assignments-nodes.d.ts +10 -0
  93. package/dist/entities/ast/assignments-nodes.js +64 -0
  94. package/dist/entities/ast/assignments-raw.d.ts +6 -0
  95. package/dist/entities/ast/assignments-raw.js +139 -0
  96. package/dist/entities/ast/assignments-tagged.d.ts +5 -0
  97. package/dist/entities/ast/assignments-tagged.js +195 -0
  98. package/dist/entities/ast/assignments.d.ts +9 -0
  99. package/dist/entities/ast/assignments.js +80 -0
  100. package/dist/entities/ast/branches.d.ts +4 -0
  101. package/dist/entities/ast/branches.js +32 -0
  102. package/dist/entities/ast/calls.d.ts +6 -0
  103. package/dist/entities/ast/calls.js +150 -0
  104. package/dist/entities/ast/classes.d.ts +5 -0
  105. package/dist/entities/ast/classes.js +61 -0
  106. package/dist/entities/ast/climb.d.ts +12 -0
  107. package/dist/entities/ast/climb.js +17 -0
  108. package/dist/entities/ast/comments.d.ts +5 -0
  109. package/dist/entities/ast/comments.js +130 -0
  110. package/dist/entities/ast/declaration.d.ts +4 -0
  111. package/dist/entities/ast/declaration.js +26 -0
  112. package/dist/entities/ast/depth.d.ts +17 -0
  113. package/dist/entities/ast/depth.js +166 -0
  114. package/dist/entities/ast/enums.d.ts +6 -0
  115. package/dist/entities/ast/enums.js +17 -0
  116. package/dist/entities/ast/export-chain.d.ts +15 -0
  117. package/dist/entities/ast/export-chain.js +171 -0
  118. package/dist/entities/ast/file-exports.d.ts +7 -0
  119. package/dist/entities/ast/file-exports.js +101 -0
  120. package/dist/entities/ast/file-facts.d.ts +16 -0
  121. package/dist/entities/ast/file-facts.js +64 -0
  122. package/dist/entities/ast/file-imports.d.ts +5 -0
  123. package/dist/entities/ast/file-imports.js +100 -0
  124. package/dist/entities/ast/file.d.ts +5 -0
  125. package/dist/entities/ast/file.js +23 -0
  126. package/dist/entities/ast/functions.d.ts +8 -0
  127. package/dist/entities/ast/functions.js +111 -0
  128. package/dist/entities/ast/heritage.d.ts +4 -0
  129. package/dist/entities/ast/heritage.js +44 -0
  130. package/dist/entities/ast/index.d.ts +9 -0
  131. package/dist/entities/ast/index.js +181 -0
  132. package/dist/entities/ast/kind.d.ts +5 -0
  133. package/dist/entities/ast/kind.js +34 -0
  134. package/dist/entities/ast/loose.d.ts +37 -0
  135. package/dist/entities/ast/loose.js +2 -0
  136. package/dist/entities/ast/modifiers.d.ts +5 -0
  137. package/dist/entities/ast/modifiers.js +32 -0
  138. package/dist/entities/ast/project.d.ts +9 -0
  139. package/dist/entities/ast/project.js +106 -0
  140. package/dist/entities/ast/properties.d.ts +11 -0
  141. package/dist/entities/ast/properties.js +176 -0
  142. package/dist/entities/ast/resolve.d.ts +16 -0
  143. package/dist/entities/ast/resolve.js +317 -0
  144. package/dist/entities/ast/tree.d.ts +31 -0
  145. package/dist/entities/ast/tree.js +518 -0
  146. package/dist/entities/ast/types.d.ts +6 -0
  147. package/dist/entities/ast/types.js +46 -0
  148. package/dist/entities/ast/usage.d.ts +11 -0
  149. package/dist/entities/ast/usage.js +81 -0
  150. package/dist/entities/ast/variables.d.ts +8 -0
  151. package/dist/entities/ast/variables.js +91 -0
  152. package/dist/entities/context.d.ts +29 -0
  153. package/dist/entities/context.js +2 -0
  154. package/dist/entities/facts.d.ts +284 -0
  155. package/dist/entities/facts.js +2 -0
  156. package/dist/entities/findings.d.ts +19 -0
  157. package/dist/entities/findings.js +2 -0
  158. package/dist/entities/kinds.d.ts +40 -0
  159. package/dist/entities/kinds.js +332 -0
  160. package/dist/entities/location/homes.d.ts +28 -0
  161. package/dist/entities/location/homes.js +195 -0
  162. package/dist/entities/location/place.d.ts +10 -0
  163. package/dist/entities/location/place.js +63 -0
  164. package/dist/entities/location/where.d.ts +19 -0
  165. package/dist/entities/location/where.js +277 -0
  166. package/dist/entities/location.d.ts +16 -0
  167. package/dist/entities/location.js +140 -0
  168. package/dist/entities/operators.d.ts +14 -0
  169. package/dist/entities/operators.js +30 -0
  170. package/dist/entities/overview/data.d.ts +43 -0
  171. package/dist/entities/overview/data.js +2 -0
  172. package/dist/entities/overview/decision.d.ts +60 -0
  173. package/dist/entities/overview/decision.js +2 -0
  174. package/dist/entities/overview/file-tree.d.ts +10 -0
  175. package/dist/entities/overview/file-tree.js +2 -0
  176. package/dist/entities/overview/finding.d.ts +58 -0
  177. package/dist/entities/overview/finding.js +2 -0
  178. package/dist/entities/overview/graph.d.ts +82 -0
  179. package/dist/entities/overview/graph.js +2 -0
  180. package/dist/entities/overview/input.d.ts +15 -0
  181. package/dist/entities/overview/input.js +2 -0
  182. package/dist/entities/overview/summaries.d.ts +81 -0
  183. package/dist/entities/overview/summaries.js +2 -0
  184. package/dist/entities/place.d.ts +5 -0
  185. package/dist/entities/place.js +2 -0
  186. package/dist/entities/queries.d.ts +9 -0
  187. package/dist/entities/queries.js +375 -0
  188. package/dist/entities/repair.d.ts +16 -0
  189. package/dist/entities/repair.js +29 -0
  190. package/dist/entities/schema.d.ts +22 -0
  191. package/dist/entities/schema.js +81 -0
  192. package/dist/entities/story.d.ts +47 -0
  193. package/dist/entities/story.js +2 -0
  194. package/dist/entities/structure-facts.d.ts +11 -0
  195. package/dist/entities/structure-facts.js +2 -0
  196. package/dist/entities/token.d.ts +23 -0
  197. package/dist/entities/token.js +2 -0
  198. package/dist/entities/tree/build.d.ts +6 -0
  199. package/dist/entities/tree/build.js +313 -0
  200. package/dist/entities/tree/entries.d.ts +7 -0
  201. package/dist/entities/tree/entries.js +145 -0
  202. package/dist/entities/tree/index.d.ts +6 -0
  203. package/dist/entities/tree/index.js +21 -0
  204. package/dist/entities/tree/match.d.ts +17 -0
  205. package/dist/entities/tree/match.js +190 -0
  206. package/dist/fa-index.d.ts +16 -0
  207. package/dist/fa-index.js +165 -0
  208. package/dist/fa-open.d.ts +51 -0
  209. package/dist/fa-open.js +242 -0
  210. package/dist/fa-store.d.ts +22 -0
  211. package/dist/fa-store.js +232 -0
  212. package/dist/fa-values.d.ts +37 -0
  213. package/dist/fa-values.js +104 -0
  214. package/dist/facts-record.d.ts +45 -0
  215. package/dist/facts-record.js +297 -0
  216. package/dist/frameworks/angular/index.d.ts +7 -0
  217. package/dist/frameworks/angular/index.js +18 -0
  218. package/dist/frameworks/facet.d.ts +18 -0
  219. package/dist/frameworks/facet.js +15 -0
  220. package/dist/frameworks/index.d.ts +9 -0
  221. package/dist/frameworks/index.js +134 -0
  222. package/dist/frameworks/react/index.d.ts +7 -0
  223. package/dist/frameworks/react/index.js +237 -0
  224. package/dist/frameworks/test/index.d.ts +6 -0
  225. package/dist/frameworks/test/index.js +157 -0
  226. package/dist/frameworks/vue/index.d.ts +7 -0
  227. package/dist/frameworks/vue/index.js +18 -0
  228. package/dist/ignore.d.ts +3 -0
  229. package/dist/ignore.js +62 -0
  230. package/dist/index-file.d.ts +43 -0
  231. package/dist/index-file.js +218 -0
  232. package/dist/index-run.d.ts +39 -0
  233. package/dist/index-run.js +217 -0
  234. package/dist/index-zone.d.ts +25 -0
  235. package/dist/index-zone.js +219 -0
  236. package/dist/main.d.ts +10 -0
  237. package/dist/main.js +411 -0
  238. package/dist/nodes/child-entities.d.ts +3 -0
  239. package/dist/nodes/child-entities.js +12 -0
  240. package/dist/nodes/children.d.ts +25 -0
  241. package/dist/nodes/children.js +165 -0
  242. package/dist/nodes/finally/emit.d.ts +6 -0
  243. package/dist/nodes/finally/emit.js +71 -0
  244. package/dist/nodes/finally/entities.d.ts +13 -0
  245. package/dist/nodes/finally/entities.js +42 -0
  246. package/dist/nodes/finally/index.d.ts +8 -0
  247. package/dist/nodes/finally/index.js +35 -0
  248. package/dist/nodes/finally/queries.d.ts +5 -0
  249. package/dist/nodes/finally/queries.js +25 -0
  250. package/dist/nodes/finally/relations-access.d.ts +5 -0
  251. package/dist/nodes/finally/relations-access.js +50 -0
  252. package/dist/nodes/finally/relations-edge.d.ts +29 -0
  253. package/dist/nodes/finally/relations-edge.js +148 -0
  254. package/dist/nodes/finally/relations-group.d.ts +31 -0
  255. package/dist/nodes/finally/relations-group.js +106 -0
  256. package/dist/nodes/finally/relations.d.ts +5 -0
  257. package/dist/nodes/finally/relations.js +85 -0
  258. package/dist/nodes/finally/required.d.ts +5 -0
  259. package/dist/nodes/finally/required.js +92 -0
  260. package/dist/nodes/finally/violation.d.ts +17 -0
  261. package/dist/nodes/finally/violation.js +2 -0
  262. package/dist/nodes/similar.d.ts +21 -0
  263. package/dist/nodes/similar.js +178 -0
  264. package/dist/piece-forms.d.ts +9 -0
  265. package/dist/piece-forms.js +68 -0
  266. package/dist/pipeline-entities.d.ts +6 -0
  267. package/dist/pipeline-entities.js +79 -0
  268. package/dist/pipeline-facts.d.ts +12 -0
  269. package/dist/pipeline-facts.js +114 -0
  270. package/dist/pipeline-unclassified.d.ts +14 -0
  271. package/dist/pipeline-unclassified.js +188 -0
  272. package/dist/pipeline.d.ts +7 -0
  273. package/dist/pipeline.js +28 -0
  274. package/dist/plugin.d.ts +2 -0
  275. package/dist/plugin.js +3 -0
  276. package/dist/release-file.d.ts +3 -0
  277. package/dist/release-file.js +13 -0
  278. package/dist/report/asks.d.ts +55 -0
  279. package/dist/report/asks.js +60 -0
  280. package/dist/report/cli-report.d.ts +2 -0
  281. package/dist/report/cli-report.js +13 -0
  282. package/dist/report/config-error-guard.d.ts +8 -0
  283. package/dist/report/config-error-guard.js +5 -0
  284. package/dist/report/configErrors.d.ts +126 -0
  285. package/dist/report/configErrors.js +121 -0
  286. package/dist/report/errorTypes/codes/structure.d.ts +15 -0
  287. package/dist/report/errorTypes/codes/structure.js +76 -0
  288. package/dist/report/errorTypes/decision-maker.d.ts +23 -0
  289. package/dist/report/errorTypes/decision-maker.js +109 -0
  290. package/dist/report/errorTypes/destinations.d.ts +38 -0
  291. package/dist/report/errorTypes/destinations.js +165 -0
  292. package/dist/report/errorTypes/finding-type.d.ts +11 -0
  293. package/dist/report/errorTypes/finding-type.js +2 -0
  294. package/dist/report/errorTypes/index.d.ts +15 -0
  295. package/dist/report/errorTypes/index.js +55 -0
  296. package/dist/report/errorTypes/types/fileContents.d.ts +9 -0
  297. package/dist/report/errorTypes/types/fileContents.js +40 -0
  298. package/dist/report/errorTypes/types/unknownEntity.d.ts +9 -0
  299. package/dist/report/errorTypes/types/unknownEntity.js +27 -0
  300. package/dist/report/errorTypes/types/wrongAction.d.ts +22 -0
  301. package/dist/report/errorTypes/types/wrongAction.js +140 -0
  302. package/dist/report/errorTypes/types/wrongPlacement.d.ts +9 -0
  303. package/dist/report/errorTypes/types/wrongPlacement.js +67 -0
  304. package/dist/report/errorTypes/vocabulary/ids.d.ts +5 -0
  305. package/dist/report/errorTypes/vocabulary/ids.js +16 -0
  306. package/dist/report/errorTypes/vocabulary/phrases.d.ts +10 -0
  307. package/dist/report/errorTypes/vocabulary/phrases.js +187 -0
  308. package/dist/report/errorTypes/vocabulary/places.d.ts +8 -0
  309. package/dist/report/errorTypes/vocabulary/places.js +36 -0
  310. package/dist/report/errorTypes/vocabulary/verbs.d.ts +7 -0
  311. package/dist/report/errorTypes/vocabulary/verbs.js +30 -0
  312. package/dist/report/finding-from.d.ts +9 -0
  313. package/dist/report/finding-from.js +108 -0
  314. package/dist/report/notices.d.ts +9 -0
  315. package/dist/report/notices.js +57 -0
  316. package/dist/report/observed.d.ts +19 -0
  317. package/dist/report/observed.js +87 -0
  318. package/dist/report/render-report.d.ts +12 -0
  319. package/dist/report/render-report.js +145 -0
  320. package/dist/report/user-report/build/bundle.d.ts +3 -0
  321. package/dist/report/user-report/build/bundle.js +188 -0
  322. package/dist/report/user-report/build/bundle.prebuilt.js +1262 -0
  323. package/dist/report/user-report/data/collect.d.ts +4 -0
  324. package/dist/report/user-report/data/collect.js +93 -0
  325. package/dist/report/user-report/data/entities.d.ts +7 -0
  326. package/dist/report/user-report/data/entities.js +88 -0
  327. package/dist/report/user-report/data/entity-examples.d.ts +16 -0
  328. package/dist/report/user-report/data/entity-examples.js +136 -0
  329. package/dist/report/user-report/data/entity-filters.d.ts +15 -0
  330. package/dist/report/user-report/data/entity-filters.js +79 -0
  331. package/dist/report/user-report/data/entity-marks.d.ts +5 -0
  332. package/dist/report/user-report/data/entity-marks.js +79 -0
  333. package/dist/report/user-report/data/file-tree.d.ts +9 -0
  334. package/dist/report/user-report/data/file-tree.js +80 -0
  335. package/dist/report/user-report/data/finding-boundary.d.ts +9 -0
  336. package/dist/report/user-report/data/finding-boundary.js +21 -0
  337. package/dist/report/user-report/data/finding-plan.d.ts +16 -0
  338. package/dist/report/user-report/data/finding-plan.js +45 -0
  339. package/dist/report/user-report/data/finding-title.d.ts +12 -0
  340. package/dist/report/user-report/data/finding-title.js +36 -0
  341. package/dist/report/user-report/data/findings.d.ts +10 -0
  342. package/dist/report/user-report/data/findings.js +181 -0
  343. package/dist/report/user-report/data/graph-edges.d.ts +19 -0
  344. package/dist/report/user-report/data/graph-edges.js +109 -0
  345. package/dist/report/user-report/data/graph-entities.d.ts +6 -0
  346. package/dist/report/user-report/data/graph-entities.js +158 -0
  347. package/dist/report/user-report/data/graph-helpers.d.ts +7 -0
  348. package/dist/report/user-report/data/graph-helpers.js +67 -0
  349. package/dist/report/user-report/data/graph.d.ts +12 -0
  350. package/dist/report/user-report/data/graph.js +97 -0
  351. package/dist/report/user-report/data/nodes.d.ts +11 -0
  352. package/dist/report/user-report/data/nodes.js +116 -0
  353. package/dist/report/user-report/data/rules.d.ts +7 -0
  354. package/dist/report/user-report/data/rules.js +62 -0
  355. package/dist/report/user-report/data/scan.d.ts +8 -0
  356. package/dist/report/user-report/data/scan.js +69 -0
  357. package/dist/report/user-report/html/shell.d.ts +3 -0
  358. package/dist/report/user-report/html/shell.js +27 -0
  359. package/dist/report/user-report/index.d.ts +8 -0
  360. package/dist/report/user-report/index.js +58 -0
  361. package/dist/report/user-report/shared/describe.d.ts +7 -0
  362. package/dist/report/user-report/shared/describe.js +86 -0
  363. package/dist/rules/index.d.ts +7 -0
  364. package/dist/rules/index.js +327 -0
  365. package/dist/rules/list-vars.d.ts +5 -0
  366. package/dist/rules/list-vars.js +149 -0
  367. package/dist/rules/name.d.ts +16 -0
  368. package/dist/rules/name.js +18 -0
  369. package/dist/rules/normalize.d.ts +5 -0
  370. package/dist/rules/normalize.js +108 -0
  371. package/dist/rules/vars.d.ts +22 -0
  372. package/dist/rules/vars.js +117 -0
  373. package/dist/scan-run.d.ts +20 -0
  374. package/dist/scan-run.js +130 -0
  375. package/dist/scripts/audit-report.d.ts +2 -0
  376. package/dist/scripts/audit-report.js +157 -0
  377. package/dist/usage-index.d.ts +4 -0
  378. package/dist/usage-index.js +282 -0
  379. package/dist/usage-mode.d.ts +7 -0
  380. package/dist/usage-mode.js +16 -0
  381. package/dist/usage-pass.d.ts +19 -0
  382. package/dist/usage-pass.js +136 -0
  383. package/dist/usage-prepare.d.ts +2 -0
  384. package/dist/usage-prepare.js +22 -0
  385. package/dist/usage-sweep.d.ts +10 -0
  386. package/dist/usage-sweep.js +264 -0
  387. package/dist/utils/accumulate.d.ts +6 -0
  388. package/dist/utils/accumulate.js +18 -0
  389. package/dist/utils/aliases.d.ts +22 -0
  390. package/dist/utils/aliases.js +173 -0
  391. package/dist/utils/article.d.ts +2 -0
  392. package/dist/utils/article.js +12 -0
  393. package/dist/utils/classify.d.ts +12 -0
  394. package/dist/utils/classify.js +25 -0
  395. package/dist/utils/configs.d.ts +25 -0
  396. package/dist/utils/configs.js +97 -0
  397. package/dist/utils/count.d.ts +7 -0
  398. package/dist/utils/count.js +13 -0
  399. package/dist/utils/dispatch.d.ts +2 -0
  400. package/dist/utils/dispatch.js +27 -0
  401. package/dist/utils/distinct.d.ts +2 -0
  402. package/dist/utils/distinct.js +14 -0
  403. package/dist/utils/field.d.ts +14 -0
  404. package/dist/utils/field.js +60 -0
  405. package/dist/utils/file-name.d.ts +2 -0
  406. package/dist/utils/file-name.js +11 -0
  407. package/dist/utils/files.d.ts +7 -0
  408. package/dist/utils/files.js +77 -0
  409. package/dist/utils/fixpoint.d.ts +2 -0
  410. package/dist/utils/fixpoint.js +19 -0
  411. package/dist/utils/gate.d.ts +2 -0
  412. package/dist/utils/gate.js +12 -0
  413. package/dist/utils/group.d.ts +3 -0
  414. package/dist/utils/group.js +33 -0
  415. package/dist/utils/host.d.ts +3 -0
  416. package/dist/utils/host.js +16 -0
  417. package/dist/utils/imports.d.ts +12 -0
  418. package/dist/utils/imports.js +185 -0
  419. package/dist/utils/judged.d.ts +5 -0
  420. package/dist/utils/judged.js +19 -0
  421. package/dist/utils/keyed.d.ts +2 -0
  422. package/dist/utils/keyed.js +23 -0
  423. package/dist/utils/map-record.d.ts +2 -0
  424. package/dist/utils/map-record.js +11 -0
  425. package/dist/utils/packages.d.ts +15 -0
  426. package/dist/utils/packages.js +207 -0
  427. package/dist/utils/path-label.d.ts +6 -0
  428. package/dist/utils/path-label.js +37 -0
  429. package/dist/utils/pattern.d.ts +19 -0
  430. package/dist/utils/pattern.js +231 -0
  431. package/dist/utils/permission.d.ts +16 -0
  432. package/dist/utils/permission.js +18 -0
  433. package/dist/utils/plural.d.ts +2 -0
  434. package/dist/utils/plural.js +9 -0
  435. package/dist/utils/qualified.d.ts +2 -0
  436. package/dist/utils/qualified.js +21 -0
  437. package/dist/utils/rank.d.ts +2 -0
  438. package/dist/utils/rank.js +24 -0
  439. package/dist/utils/read-field.d.ts +12 -0
  440. package/dist/utils/read-field.js +50 -0
  441. package/dist/utils/read-when.d.ts +2 -0
  442. package/dist/utils/read-when.js +17 -0
  443. package/dist/utils/reason.d.ts +4 -0
  444. package/dist/utils/reason.js +9 -0
  445. package/dist/utils/record.d.ts +3 -0
  446. package/dist/utils/record.js +21 -0
  447. package/dist/utils/resolve.d.ts +2 -0
  448. package/dist/utils/resolve.js +24 -0
  449. package/dist/utils/search.d.ts +2 -0
  450. package/dist/utils/search.js +21 -0
  451. package/dist/utils/seen.d.ts +6 -0
  452. package/dist/utils/seen.js +27 -0
  453. package/dist/utils/span.d.ts +5 -0
  454. package/dist/utils/span.js +2 -0
  455. package/dist/utils/speak.d.ts +2 -0
  456. package/dist/utils/speak.js +18 -0
  457. package/dist/utils/split.d.ts +8 -0
  458. package/dist/utils/split.js +21 -0
  459. package/dist/utils/template.d.ts +5 -0
  460. package/dist/utils/template.js +5 -0
  461. package/dist/utils/text.d.ts +4 -0
  462. package/dist/utils/text.js +42 -0
  463. package/dist/utils/tokenize.d.ts +2 -0
  464. package/dist/utils/tokenize.js +18 -0
  465. package/dist/utils/try-read.d.ts +4 -0
  466. package/dist/utils/try-read.js +24 -0
  467. package/dist/utils/typed-field.d.ts +3 -0
  468. package/dist/utils/typed-field.js +16 -0
  469. package/dist/utils/verdicts.d.ts +4 -0
  470. package/dist/utils/verdicts.js +20 -0
  471. package/entities/operators.ts +31 -0
  472. package/package.json +101 -47
  473. package/report/errorTypes/vocabulary/ids.ts +17 -0
  474. package/report/errorTypes/vocabulary/phrases.ts +181 -0
  475. package/report/errorTypes/vocabulary/places.ts +51 -0
  476. package/report/errorTypes/vocabulary/verbs.ts +31 -0
  477. package/report/user-report/shared/describe.ts +107 -0
  478. package/ast.js +0 -107
  479. package/bin/follow-architecture.js +0 -6
  480. package/config.js +0 -101
  481. package/entities/aliases.js +0 -10
  482. package/entities/invariants.js +0 -134
  483. package/entities/nodes.js +0 -112
  484. package/main.js +0 -96
  485. package/plugin.js +0 -5
  486. package/report.js +0 -73
  487. package/utils.js +0 -104
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registryFromIndex = exports.checkIndexed = exports.checkOne = exports.recordFor = exports.readOne = exports.addPieces = exports.addSummary = exports.emptyRegistry = void 0;
4
+ // ONE FILE, AS THE INDEXED RUN NEEDS IT: the project-wide index a summary feeds,
5
+ // the record of a file this run has to read again, and the check that turns that
6
+ // record into the verdicts stored in the light section. Nothing here opens or
7
+ // drives the index — `index-run.ts` decides what is read and in which order.
8
+ const facts_record_1 = require("./facts-record");
9
+ const classify_1 = require("./code-entities/classify");
10
+ const project_1 = require("./code-entities/project");
11
+ const fa_index_1 = require("./fa-index");
12
+ const rules_1 = require("./rules");
13
+ const notices_1 = require("./report/notices");
14
+ const release_file_1 = require("./release-file");
15
+ const scan_run_1 = require("./scan-run");
16
+ const closure_project_1 = require("./closure-project");
17
+ const ast_1 = require("./entities/ast");
18
+ const group_1 = require("./utils/group");
19
+ const fa_values_1 = require("./fa-values");
20
+ // The project-wide index, rebuilt from summaries. Every piece here was produced by
21
+ // the same per-file classification the AST pass runs, so the answers are the ones
22
+ // that pass would give — without reading a single record.
23
+ const emptyRegistry = () => ({
24
+ bySlug: new Map(),
25
+ objectsBySlug: new Map(),
26
+ entitiesByFile: new Map(),
27
+ });
28
+ exports.emptyRegistry = emptyRegistry;
29
+ // One file's summary, handed to the registry: no parse, only grouping. The pieces
30
+ // are not in a summary (they are the bulk of the index), so `bySlug` stays empty
31
+ // until `addPieces` is called — which a run does only when a rule names a code
32
+ // entity, the same condition that makes the checks ask for `entityScope`.
33
+ const addSummary = (index, abs, rel, summary) => {
34
+ for (const object of summary.objects)
35
+ (0, group_1.pushGroup)(index.objectsBySlug, object.entity, { ...object, path: abs });
36
+ index.entitiesByFile.set(rel, new Set(summary.entities));
37
+ };
38
+ exports.addSummary = addSummary;
39
+ // One file's classified pieces, for the `entity` scope: the owners of names, keyed
40
+ // by entity, exactly the grouping the unfiled pass builds from the same list.
41
+ const addPieces = (index, candidates) => {
42
+ for (const candidate of candidates) {
43
+ if (candidate.entity)
44
+ (0, group_1.pushGroup)(index.bySlug, candidate.entity, candidate);
45
+ }
46
+ };
47
+ exports.addPieces = addPieces;
48
+ // The project-wide index as the INDEX holds it: every file's summary, plus the
49
+ // pieces when a rule names a code entity — the same two sections a scan reads
50
+ // before its checks. The rule path asks about one file at a time and never walks
51
+ // the tree, so this is where its `entity` scope and its objects come from; the run
52
+ // caches the answer by its file list, so a lint session reads these sections once.
53
+ const registryFromIndex = (index, arch, absFiles, repoFiles) => {
54
+ const light = (0, fa_index_1.readLight)(index, absFiles);
55
+ const registry = emptyRegistry();
56
+ for (let at = 0; at < absFiles.length; at += 1) {
57
+ const entry = light.get(absFiles[at]);
58
+ if (entry !== undefined)
59
+ addSummary(registry, absFiles[at], repoFiles[at], entry.summary);
60
+ }
61
+ if ((0, facts_record_1.namesCodeEntity)(arch.rules)) {
62
+ for (const list of (0, fa_index_1.readPeers)(index, (0, fa_index_1.pieceFiles)(light, (0, rules_1.namedEntitySlugs)(arch.rules))).values())
63
+ addPieces(registry, list);
64
+ }
65
+ return registry;
66
+ };
67
+ exports.registryFromIndex = registryFromIndex;
68
+ // One file's record as a run needs it before checking: facts, classified pieces,
69
+ // the literals' places. The syntax is released on the way out — facts, objects and
70
+ // the templates' positions are what a check needs, never the tree.
71
+ const readOne = (abs, run, project) => {
72
+ const record = (0, facts_record_1.extractFileFacts)(abs, { arch: run.arch, project, repoFiles: run.repoFiles });
73
+ // Classify NOW, not in the scan pass: the project-wide index is rebuilt from
74
+ // these values before any file is checked, and it is the entity of a piece that
75
+ // decides which entity owns which object literal.
76
+ const classified = (0, classify_1.classifyEntities)(record.candidates, run.arch.entities, run.arch, record.facts);
77
+ record.candidates = classified.candidates;
78
+ record.facts.entities = [...new Set(classified.present)];
79
+ const sf = project.getSourceFile(abs) ?? null;
80
+ record.objects = (0, project_1.fileObjects)(sf, classified.candidates);
81
+ if (sf !== null)
82
+ (0, release_file_1.releaseFile)(sf);
83
+ return record;
84
+ };
85
+ exports.readOne = readOne;
86
+ // The record this check reads: read again by this run, stored by an earlier one, or
87
+ // — when the index may not be written — still held by the extraction. A record that
88
+ // cannot be read back at all is read again here rather than losing the answer.
89
+ const recordFor = (args, abs) => args.kept.get(abs) ?? (0, fa_index_1.recordAt)(args.index, abs) ?? readOne(abs, args.run, (0, scan_run_1.wholeRepoProject)());
90
+ exports.recordFor = recordFor;
91
+ // The live project answers the lookalike layer, and only about a file this run
92
+ // read again: a stored record was checked against the syntax of its own run.
93
+ // The lookalike nodes are the one answer this run may not be able to ask for:
94
+ // without a project they come from the verdicts stored with the record.
95
+ const nodesOf = (project, parts, stored) => project === null ? stored : parts.nodes;
96
+ // The verdicts, stored where the next run reads them: the light section.
97
+ const storeVerdict = (args, file, record, parts) => {
98
+ const summary = file.entry?.summary ?? (0, fa_values_1.summaryOf)(record);
99
+ const verdict = { findings: parts, notices: [...record.notices], summary };
100
+ args.light.set(file.abs, verdict);
101
+ return (0, fa_index_1.keepVerdict)(args.index, file.abs, verdict);
102
+ };
103
+ // Check one file against the state of this run. The record is dropped with the
104
+ // chunk it was read in: a check reads its OWN record and the registry (`bySlug`,
105
+ // objects, entities per file), never another file's facts.
106
+ const checkOne = (args, file, findings) => {
107
+ const { run, projectOpen, index } = args;
108
+ const record = recordFor(args, file.abs);
109
+ const project = projectOpen ? (0, scan_run_1.wholeRepoProject)() : null;
110
+ // The file's record already carries its literals' places, and its checker
111
+ // answers come from the run's usage pass: nothing here needs this file's syntax.
112
+ const usage = index === null ? null : (0, fa_index_1.usageAt)(index, file.abs);
113
+ const stored = file.entry?.findings?.nodes ?? [];
114
+ const parts = (0, facts_record_1.checkRecord)(record, {
115
+ arch: run.arch,
116
+ project,
117
+ repoFiles: run.repoFiles,
118
+ dedupe: run.dedupe,
119
+ sf: null,
120
+ usage,
121
+ });
122
+ findings.push(...parts.before, ...nodesOf(project, parts, stored), ...parts.after);
123
+ return storeVerdict(args, file, record, parts);
124
+ };
125
+ exports.checkOne = checkOne;
126
+ // The buffer's own syntax, in a project of its own: the run's project holds the
127
+ // files as they are on disk, and rewriting one of them would answer for the others
128
+ // with text nobody saved.
129
+ const bufferProject = (abs, text, arch) => {
130
+ const project = (0, ast_1.createTsProject)({ repoRoot: arch.repoRoot ?? ".", aliases: arch.aliases });
131
+ (0, ast_1.loadSourceFile)(project, abs, text);
132
+ return project;
133
+ };
134
+ // The file's own syntax, in a project of its own: `buffer` is text the index has
135
+ // never seen, and rewriting the run's project would answer for the others with it.
136
+ const fromBuffer = (abs, text, run) => {
137
+ const project = bufferProject(abs, text, run.arch);
138
+ return {
139
+ record: (0, facts_record_1.extractFileFacts)(abs, { arch: run.arch, project, repoFiles: run.repoFiles, text }),
140
+ project,
141
+ source: project.getSourceFile(abs) ?? null,
142
+ fromDisk: false,
143
+ };
144
+ };
145
+ // The project a file without a record is read in. A run that already opened the
146
+ // whole repo (the scan, or the lookalike question) reuses it — the CLI pays
147
+ // nothing new. A rule on one file builds that file's own closure instead: the
148
+ // files its syntax reaches, which is what its css values and its parameter types
149
+ // are answered from, without the repo-wide parse that made the first check after
150
+ // an edit take seconds. With no index at all the checker's own answers (who calls
151
+ // a name) have to come from a project holding the repo — a closure would answer
152
+ // "nobody" for a helper the rest of the repo calls — so the whole one opens, as
153
+ // it always did.
154
+ const projectFor = (abs, run) => {
155
+ const open = (0, scan_run_1.openWholeRepoProject)();
156
+ if (open !== null)
157
+ return open;
158
+ if (run.index === null)
159
+ return (0, scan_run_1.wholeRepoProject)();
160
+ return (0, closure_project_1.openClosure)(abs, run.arch, run.repoFiles);
161
+ };
162
+ const loadOne = (abs, run, buffer) => {
163
+ if (buffer !== undefined && buffer !== null)
164
+ return fromBuffer(abs, buffer, run);
165
+ const fromIndex = run.index === null ? null : (0, fa_index_1.recordAt)(run.index, abs);
166
+ // The record answers on its own; only a file this index cannot answer for is
167
+ // read, and in a project of its own closure.
168
+ if (fromIndex !== null)
169
+ return { record: fromIndex, project: null, source: null, fromDisk: true };
170
+ const project = projectFor(abs, run);
171
+ return {
172
+ record: (0, facts_record_1.extractFileFacts)(abs, { arch: run.arch, project, repoFiles: run.repoFiles }),
173
+ project,
174
+ source: project.getSourceFile(abs) ?? null,
175
+ fromDisk: true,
176
+ };
177
+ };
178
+ // THE ONE-FILE PATH (the ESLint rule): the answer for THIS file, from a record when
179
+ // the index has a fresh one and from its syntax when it does not. `sf` is that
180
+ // syntax, handed in by the caller because the rule may hold the editor's buffer
181
+ // instead of the file on disk; the checker's answers are asked here, on it, when
182
+ // the index has none stored.
183
+ // THE RULE ONLY READS. A record derived here answers for the project it was derived
184
+ // in — a file's closure, or the editor's buffer — and the CLI's warm run must never
185
+ // replay such an answer as if the whole repo had given it: `off` would stop matching
186
+ // `warm` depending on what was edited in which order. Writing the index stays the
187
+ // CLI's alone, so the file the CLI wrote is the file every reader meets.
188
+ // The scan already answered this file, and the index still holds that answer:
189
+ // the verdict IS the answer. Re-deriving it here would ask the questions that
190
+ // needed the project (the lookalike folder, an object literal's resolution)
191
+ // again — without one, the answer would quietly be a different one.
192
+ const replayed = (abs, run, buffer) => {
193
+ if (buffer !== undefined && buffer !== null)
194
+ return null;
195
+ const stored = run.index === null ? null : (0, fa_index_1.lightAt)(run.index, abs);
196
+ if (stored === null || stored.findings === null)
197
+ return null;
198
+ (0, notices_1.replayNotices)(stored.notices);
199
+ return [...stored.findings.before, ...stored.findings.nodes, ...stored.findings.after];
200
+ };
201
+ const checkIndexed = (abs, run, buffer) => {
202
+ const answer = replayed(abs, run, buffer);
203
+ if (answer !== null)
204
+ return answer;
205
+ const loaded = loadOne(abs, run, buffer);
206
+ const parts = (0, facts_record_1.checkRecord)(loaded.record, {
207
+ arch: run.arch,
208
+ project: loaded.project,
209
+ repoFiles: run.repoFiles,
210
+ dedupe: run.dedupe,
211
+ sf: loaded.source,
212
+ usage: run.index === null ? null : (0, fa_index_1.usageAt)(run.index, abs),
213
+ });
214
+ if (!loaded.fromDisk && loaded.source !== null)
215
+ (0, release_file_1.releaseFile)(loaded.source);
216
+ return [...parts.before, ...parts.nodes, ...parts.after];
217
+ };
218
+ exports.checkIndexed = checkIndexed;
@@ -0,0 +1,39 @@
1
+ import { type ScanScope } from "./fa-index";
2
+ import type { Arch } from "./entities/architecture";
3
+ import type { Finding } from "./entities/findings";
4
+ import type { SeenStore } from "./utils/seen";
5
+ type RunArgs = {
6
+ arch: Arch;
7
+ repoFiles: string[];
8
+ absFiles: readonly string[];
9
+ scope: ScanScope;
10
+ option: string | boolean | null | undefined;
11
+ dedupe: SeenStore;
12
+ shouldCheck?: ((abs: string) => boolean) | null;
13
+ usage?: string;
14
+ };
15
+ type RunStats = {
16
+ mode: "warm" | "hybrid" | "cold";
17
+ stale: number;
18
+ zone: number;
19
+ extracted: number;
20
+ written: number;
21
+ bytes: number;
22
+ chunks: number;
23
+ compactions: number;
24
+ pruned: number;
25
+ warning: string | null;
26
+ compactionWarning: string | null;
27
+ usageFiles: number;
28
+ usageNames: number;
29
+ projectsOpened: number;
30
+ checksProjects: number;
31
+ };
32
+ type RunOut = {
33
+ findings: Finding[];
34
+ stats: RunStats;
35
+ };
36
+ declare const runIndexed: (run: RunArgs) => RunOut | null;
37
+ export { runIndexed };
38
+ export { checkIndexed, registryFromIndex } from "./index-file";
39
+ export type { RunArgs, RunOut, RunStats };
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registryFromIndex = exports.checkIndexed = exports.runIndexed = void 0;
4
+ // A SCAN THAT READS ITS OWN PAST: what a run can answer from the file index, what
5
+ // it has to ask the syntax again, and how the two are stitched back into one
6
+ // answer.
7
+ //
8
+ // THE ORDER OF A RUN (any mode):
9
+ // 1. read the LIGHT section (`fa-out`) of every scanned file: the summary — the
10
+ // classified pieces, the literals' places, the entities, the deps — and the
11
+ // verdicts an earlier run derived. Small (a few MB over a whole repo) and
12
+ // the only thing a warm run reads;
13
+ // 2. the zone is what must be read again — see `index-zone.ts` for what makes a
14
+ // summary stale and how far a change reaches;
15
+ // 3. the project-wide entity index is rebuilt from the SUMMARIES: every summary
16
+ // carries the classified pieces and the object-literal places of its file, so
17
+ // the pass over every file's syntax does not happen at all;
18
+ // 4. the zone is read again and written back in chunks: its record goes to `fa`,
19
+ // its summary to `fa-out`, and the objects are dropped as each chunk lands —
20
+ // a cold run never holds the records of the files it has already read;
21
+ // 5. one pass in scan order answers every file: a file whose verdicts are stored
22
+ // and whose facts did not change is REPLAYED from `fa-out` (nothing is read
23
+ // twice), a file in the zone is read back from `fa`, checked, and its verdicts
24
+ // written into `fa-out` alone — the record it was checked from is dropped as
25
+ // its chunk goes by.
26
+ //
27
+ // WHY THE VERDICTS ARE STORED: everything except the lookalike question is a pure
28
+ // function of one record plus the run's shared state, so replaying it from the
29
+ // index would replay findings that were deduped per PLACE (`dedupeBy`) against a
30
+ // population that no longer exists — the first file of a place wins, and editing a
31
+ // file can change the winner. That is why a file whose facts changed is checked
32
+ // together with everything the change can reach (the zone): a stored verdict is
33
+ // the answer its own facts gave, and the zone is the boundary of what a change
34
+ // invalidates.
35
+ const fa_index_1 = require("./fa-index");
36
+ const rules_1 = require("./rules");
37
+ const facts_record_1 = require("./facts-record");
38
+ const scan_run_1 = require("./scan-run");
39
+ const notices_1 = require("./report/notices");
40
+ const index_zone_1 = require("./index-zone");
41
+ const usage_pass_1 = require("./usage-pass");
42
+ const usage_prepare_1 = require("./usage-prepare");
43
+ const index_file_1 = require("./index-file");
44
+ const fa_values_1 = require("./fa-values");
45
+ // A record is read on the SAME project the checks use — the whole repo. Every
46
+ // fact that depends on type resolution (`parameters[].type`, an assignment's
47
+ // presence, a call's resolved module) has one answer per program, and a project
48
+ // holding only part of the repo gives a different one: `--index off` would then
49
+ // report findings the index cannot reproduce. The chunked project this run used
50
+ // before is gone for that reason.
51
+ const extractZone = (args, zone) => {
52
+ const { run, index, light, kept, registry, pieces } = args;
53
+ let extracted = 0;
54
+ for (const rel of zone) {
55
+ const abs = args.absOf.get(rel);
56
+ if (abs === undefined)
57
+ continue;
58
+ const record = (0, facts_record_1.slimmable)((0, index_file_1.readOne)(abs, run, (0, scan_run_1.wholeRepoProject)()));
59
+ extracted += 1;
60
+ const summary = (0, fa_values_1.summaryOf)(record);
61
+ (0, index_file_1.addSummary)(registry, abs, record.rel, summary);
62
+ if (pieces)
63
+ (0, index_file_1.addPieces)(registry, record.candidates);
64
+ const fresh = { findings: null, notices: [...record.notices], summary };
65
+ // The lookalike answer of a fresh file is asked live in the scan pass; the
66
+ // verdicts are written there, once they exist.
67
+ if (!(0, fa_index_1.keepFacts)(index, abs, record, fresh))
68
+ kept.set(abs, record);
69
+ light.set(abs, fresh);
70
+ }
71
+ return extracted;
72
+ };
73
+ // Nothing to recompute: the verdicts of this file were derived from these very
74
+ // facts in an earlier run, and the zone says no change reached it.
75
+ const replayStored = (entry, findings) => {
76
+ if (entry === undefined || entry.findings === null)
77
+ return false;
78
+ (0, notices_1.replayNotices)(entry.notices);
79
+ findings.push(...entry.findings.before, ...entry.findings.nodes, ...entry.findings.after);
80
+ return true;
81
+ };
82
+ // One file, checked and — when this run read it again or its verdicts are missing
83
+ // — written back at once.
84
+ const scanOne = (args, at, findings) => {
85
+ const { run, light, absFiles, live } = args;
86
+ const abs = absFiles[at];
87
+ const entry = light.get(abs);
88
+ // A file outside `--files` is not checked, but what its READING could not read
89
+ // is still part of the report — the light value carries those lines.
90
+ if (run.shouldCheck && !run.shouldCheck(abs)) {
91
+ (0, notices_1.replayNotices)(entry?.notices ?? []);
92
+ return false;
93
+ }
94
+ const fresh = live.has(run.repoFiles[at]);
95
+ if (!fresh && replayStored(entry, findings))
96
+ return false;
97
+ return (0, index_file_1.checkOne)(args, { abs, entry, fresh }, findings);
98
+ };
99
+ // The scan itself: one pass in scan order, so the dedupe store, the folder
100
+ // counters and the entity scope see every file in the order a cold run saw them —
101
+ // and the index is opened once per chunk of files, not once per file.
102
+ const scanAll = (args) => {
103
+ const findings = [];
104
+ let written = 0;
105
+ (0, fa_index_1.scanChunks)(args.index, args.absFiles, (from, to) => {
106
+ for (let at = from; at < to; at += 1)
107
+ if (scanOne(args, at, findings))
108
+ written += 1;
109
+ });
110
+ return { findings, written };
111
+ };
112
+ const modeOf = (stale, zone, total) => {
113
+ if (stale === 0)
114
+ return "warm";
115
+ return zone >= total ? "cold" : "hybrid";
116
+ };
117
+ // The project-wide index, from the summaries: the answers a check gives about
118
+ // OTHER files. The `entity` scope is the one question about other files' PIECES:
119
+ // asked for by the same predicate that makes the checks read them, so a config
120
+ // that never names a code entity never decodes a file it does not check — and a
121
+ // config that names one decodes only the files that have it.
122
+ const lightIndex = (args) => {
123
+ const { index, light, absFiles, repoFiles, arch } = args;
124
+ const registry = (0, index_file_1.emptyRegistry)();
125
+ for (let at = 0; at < absFiles.length; at += 1) {
126
+ const entry = light.get(absFiles[at]);
127
+ if (entry !== undefined)
128
+ (0, index_file_1.addSummary)(registry, absFiles[at], repoFiles[at], entry.summary);
129
+ }
130
+ const pieces = (0, facts_record_1.namesCodeEntity)(arch.rules);
131
+ if (pieces) {
132
+ for (const list of (0, fa_index_1.readPeers)(index, (0, fa_index_1.pieceFiles)(light, (0, rules_1.namedEntitySlugs)(arch.rules))).values())
133
+ (0, index_file_1.addPieces)(registry, list);
134
+ }
135
+ return { registry, pieces, kept: new Map(), known: new Set(light.keys()), depsOf: (abs) => light.get(abs)?.summary.deps ?? [] };
136
+ };
137
+ // null means "this run may not use an index" — the caller then takes the plain
138
+ // path, which remembers nothing and reads every file.
139
+ const runIndexed = (run) => {
140
+ const root = run.arch.repoRoot ?? ".";
141
+ (0, usage_prepare_1.prepareUsage)(run.usage, root, run.repoFiles);
142
+ const index = (0, fa_index_1.openFactsIndex)({ root, option: run.option, arch: run.arch, scope: run.scope });
143
+ if (index === null)
144
+ return null;
145
+ // THE LIGHT PASS: every file's summary and stored verdicts, one decode each. No
146
+ // record is touched, so what a run holds from here on is a few MB, not the repo.
147
+ const light = (0, fa_index_1.readLight)(index, run.absFiles);
148
+ const absOf = new Map(run.repoFiles.map((rel, at) => [rel, run.absFiles[at]]));
149
+ const { zone, stale } = (0, index_zone_1.zoneOf)({ index, light, absFiles: run.absFiles, repoFiles: run.repoFiles, root });
150
+ const { registry, pieces, kept, known, depsOf } = lightIndex({ index, light, absFiles: run.absFiles, repoFiles: run.repoFiles, arch: run.arch });
151
+ const zoneArgs = { run, index, light, pieces, kept, registry, absOf };
152
+ let extracted = extractZone(zoneArgs, zone);
153
+ extracted += (0, index_zone_1.extendZone)({ zone, known, depsOf, absOf, repoFiles: run.repoFiles }, (paths) => extractZone(zoneArgs, paths));
154
+ // The depth cache answers a question about a file's TEXT, and every answer is
155
+ // already in a record: dropped here, so the scan pass does not keep the
156
+ // candidates of every file the extraction happened to look at.
157
+ delete run.arch.depthCache;
158
+ // Everything extracted is on disk before the checks read it back.
159
+ (0, fa_index_1.settle)(index);
160
+ // THE CHECKER'S ANSWERS, asked once: one project over the whole repo, the zone's
161
+ // published names only. The records in the zone carry no answer yet; every later
162
+ // check of them reads one from the index instead of opening a project.
163
+ const usage = (0, usage_pass_1.runUsagePass)({ run, index, zone, absOf });
164
+ // The answers are on disk before the first check reads one: a chunk that reads
165
+ // the section would otherwise see a value still queued in this process.
166
+ (0, fa_index_1.settle)(index);
167
+ // A file whose facts are stored but whose verdicts never landed (a run that
168
+ // stopped between the two) is checked without being read again.
169
+ const partial = [...light.values()].some((entry) => entry.findings === null);
170
+ (0, scan_run_1.adoptEntityIndex)(registry);
171
+ // Counted from here: a project built AFTER this point would be a second parse of
172
+ // the repo for a question the pass has already answered.
173
+ const beforeChecks = (0, scan_run_1.projectsOpened)();
174
+ const scanned = scanAll({
175
+ run,
176
+ index,
177
+ light,
178
+ kept,
179
+ absFiles: run.absFiles,
180
+ live: zone,
181
+ // The lookalike question and the css templates a re-read file carries are the
182
+ // two things that still need syntax in the checks; the checker's answers are
183
+ // already stored and read as data.
184
+ projectOpen: zone.size > 0 || partial,
185
+ });
186
+ const done = (0, fa_index_1.finish)(index);
187
+ // A run that has the whole file list is the one that can tombstone the rest.
188
+ const pruned = (0, fa_index_1.prune)(index, run.absFiles);
189
+ (0, scan_run_1.adoptEntityIndex)(null);
190
+ return {
191
+ findings: scanned.findings,
192
+ stats: {
193
+ mode: modeOf(stale, zone.size, run.repoFiles.length),
194
+ stale,
195
+ zone: zone.size,
196
+ extracted,
197
+ written: scanned.written,
198
+ bytes: done.bytes,
199
+ chunks: done.chunks,
200
+ compactions: done.compactions,
201
+ pruned: pruned.dropped,
202
+ warning: done.warning,
203
+ // The names the usage pass stored an answer for, and those that are not null.
204
+ usageFiles: usage.files,
205
+ usageNames: usage.answered,
206
+ // Whole-repo projects this run built, and how many of them the checks built.
207
+ projectsOpened: (0, scan_run_1.projectsOpened)(),
208
+ checksProjects: (0, scan_run_1.projectsOpened)() - beforeChecks,
209
+ // Read after the prune: a flush there can be the one that deferred.
210
+ compactionWarning: index.compactionWarning,
211
+ },
212
+ };
213
+ };
214
+ exports.runIndexed = runIndexed;
215
+ var index_file_2 = require("./index-file");
216
+ Object.defineProperty(exports, "checkIndexed", { enumerable: true, get: function () { return index_file_2.checkIndexed; } });
217
+ Object.defineProperty(exports, "registryFromIndex", { enumerable: true, get: function () { return index_file_2.registryFromIndex; } });
@@ -0,0 +1,25 @@
1
+ import { type Index, type Light } from "./fa-index";
2
+ declare const MAX_ZONE = 200;
3
+ declare const MAX_FOLDER = 400;
4
+ declare const importersOf: (light: Map<string, Light>, relOf: ReadonlyMap<string, string>) => Map<string, string[]>;
5
+ declare const closureOf: (seeds: readonly string[], edges: readonly ((rel: string) => readonly string[])[], limit: number) => Set<string>;
6
+ declare const extendZone: (args: {
7
+ zone: Set<string>;
8
+ known: ReadonlySet<string>;
9
+ depsOf: (abs: string) => readonly string[];
10
+ absOf: ReadonlyMap<string, string>;
11
+ repoFiles: readonly string[];
12
+ }, extract: (paths: ReadonlySet<string>) => number) => number;
13
+ type ZoneArgs = {
14
+ index: Index;
15
+ light: Map<string, Light>;
16
+ absFiles: readonly string[];
17
+ repoFiles: readonly string[];
18
+ root: string;
19
+ };
20
+ declare const zoneOf: (args: ZoneArgs) => {
21
+ zone: Set<string>;
22
+ stale: number;
23
+ };
24
+ export { zoneOf, importersOf, closureOf, extendZone, MAX_ZONE, MAX_FOLDER };
25
+ export type { ZoneArgs };