@aiready/context-analyzer 0.22.9 → 0.22.12

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 (302) hide show
  1. package/.turbo/turbo-build.log +33 -32
  2. package/.turbo/turbo-format-check.log +1 -1
  3. package/.turbo/turbo-lint.log +8 -0
  4. package/dist/chunk-HD4Y3GYL.mjs +124 -0
  5. package/dist/{chunk-M2EGQ36M.mjs → chunk-ISWPFG2C.mjs} +43 -98
  6. package/dist/{chunk-BQCISA2F.mjs → chunk-QW6ULRML.mjs} +32 -6
  7. package/dist/{chunk-WHB7QI7N.mjs → chunk-T733LS62.mjs} +23 -4
  8. package/dist/{cli-action-CXIHOVAC.mjs → cli-action-FV4G4OB6.mjs} +3 -3
  9. package/dist/{cli-action-3CWN7PBE.mjs → cli-action-HYSWE7F4.mjs} +3 -3
  10. package/dist/{cli-action-MLFCIW2O.mjs → cli-action-VIQZSWSP.mjs} +3 -3
  11. package/dist/{cli-action-E7UGP4KE.mjs → cli-action-W7TESWAV.mjs} +6 -8
  12. package/dist/cli.js +236 -191
  13. package/dist/cli.mjs +1 -1
  14. package/dist/console-report-AP4JYNQY.mjs +74 -0
  15. package/dist/html-report-ULELSIYG.mjs +73 -0
  16. package/dist/index.d.mts +69 -337
  17. package/dist/index.d.ts +69 -337
  18. package/dist/index.js +90 -452
  19. package/dist/index.mjs +9 -157
  20. package/dist/interactive-setup-JGFBFI3M.mjs +75 -0
  21. package/dist/{orchestrator-3ERQS3NW.mjs → orchestrator-QNE2E4TE.mjs} +2 -2
  22. package/dist/summary-GQRWW3A2.mjs +7 -0
  23. package/dist/summary-JTBS7CPM.mjs +7 -0
  24. package/dist/summary-TZFB6ZFM.mjs +7 -0
  25. package/package.json +2 -2
  26. package/src/__tests__/file-classification.fixtures.ts +57 -0
  27. package/src/__tests__/file-classification.test.ts +24 -929
  28. package/src/__tests__/provider.test.ts +6 -72
  29. package/src/classifier.ts +42 -42
  30. package/src/cli-action.ts +11 -6
  31. package/src/index.ts +30 -27
  32. package/src/provider.ts +1 -1
  33. package/src/summary.ts +65 -10
  34. package/dist/__tests__/analyzer.test.d.ts +0 -2
  35. package/dist/__tests__/analyzer.test.d.ts.map +0 -1
  36. package/dist/__tests__/analyzer.test.js +0 -198
  37. package/dist/__tests__/analyzer.test.js.map +0 -1
  38. package/dist/__tests__/auto-detection.test.d.ts +0 -2
  39. package/dist/__tests__/auto-detection.test.d.ts.map +0 -1
  40. package/dist/__tests__/auto-detection.test.js +0 -132
  41. package/dist/__tests__/auto-detection.test.js.map +0 -1
  42. package/dist/__tests__/cluster-detector.test.d.ts +0 -2
  43. package/dist/__tests__/cluster-detector.test.d.ts.map +0 -1
  44. package/dist/__tests__/cluster-detector.test.js +0 -121
  45. package/dist/__tests__/cluster-detector.test.js.map +0 -1
  46. package/dist/__tests__/contract.test.d.ts +0 -2
  47. package/dist/__tests__/contract.test.d.ts.map +0 -1
  48. package/dist/__tests__/contract.test.js +0 -59
  49. package/dist/__tests__/contract.test.js.map +0 -1
  50. package/dist/__tests__/enhanced-cohesion.test.d.ts +0 -2
  51. package/dist/__tests__/enhanced-cohesion.test.d.ts.map +0 -1
  52. package/dist/__tests__/enhanced-cohesion.test.js +0 -119
  53. package/dist/__tests__/enhanced-cohesion.test.js.map +0 -1
  54. package/dist/__tests__/file-classification.test.d.ts +0 -2
  55. package/dist/__tests__/file-classification.test.d.ts.map +0 -1
  56. package/dist/__tests__/file-classification.test.js +0 -749
  57. package/dist/__tests__/file-classification.test.js.map +0 -1
  58. package/dist/__tests__/fragmentation-advanced.test.d.ts +0 -2
  59. package/dist/__tests__/fragmentation-advanced.test.d.ts.map +0 -1
  60. package/dist/__tests__/fragmentation-advanced.test.js +0 -44
  61. package/dist/__tests__/fragmentation-advanced.test.js.map +0 -1
  62. package/dist/__tests__/fragmentation-coupling.test.d.ts +0 -2
  63. package/dist/__tests__/fragmentation-coupling.test.d.ts.map +0 -1
  64. package/dist/__tests__/fragmentation-coupling.test.js +0 -52
  65. package/dist/__tests__/fragmentation-coupling.test.js.map +0 -1
  66. package/dist/__tests__/fragmentation-log.test.d.ts +0 -2
  67. package/dist/__tests__/fragmentation-log.test.d.ts.map +0 -1
  68. package/dist/__tests__/fragmentation-log.test.js +0 -29
  69. package/dist/__tests__/fragmentation-log.test.js.map +0 -1
  70. package/dist/__tests__/provider.test.d.ts +0 -2
  71. package/dist/__tests__/provider.test.d.ts.map +0 -1
  72. package/dist/__tests__/provider.test.js +0 -72
  73. package/dist/__tests__/provider.test.js.map +0 -1
  74. package/dist/__tests__/remediation.test.d.ts +0 -2
  75. package/dist/__tests__/remediation.test.d.ts.map +0 -1
  76. package/dist/__tests__/remediation.test.js +0 -61
  77. package/dist/__tests__/remediation.test.js.map +0 -1
  78. package/dist/__tests__/scoring.test.d.ts +0 -2
  79. package/dist/__tests__/scoring.test.d.ts.map +0 -1
  80. package/dist/__tests__/scoring.test.js +0 -298
  81. package/dist/__tests__/scoring.test.js.map +0 -1
  82. package/dist/__tests__/structural-cohesion.test.d.ts +0 -2
  83. package/dist/__tests__/structural-cohesion.test.d.ts.map +0 -1
  84. package/dist/__tests__/structural-cohesion.test.js +0 -35
  85. package/dist/__tests__/structural-cohesion.test.js.map +0 -1
  86. package/dist/analyzer.d.ts +0 -37
  87. package/dist/analyzer.d.ts.map +0 -1
  88. package/dist/analyzer.js +0 -283
  89. package/dist/analyzer.js.map +0 -1
  90. package/dist/analyzers/python-context.d.ts +0 -38
  91. package/dist/analyzers/python-context.d.ts.map +0 -1
  92. package/dist/analyzers/python-context.js +0 -234
  93. package/dist/analyzers/python-context.js.map +0 -1
  94. package/dist/ast-utils.d.ts +0 -16
  95. package/dist/ast-utils.d.ts.map +0 -1
  96. package/dist/ast-utils.js +0 -81
  97. package/dist/ast-utils.js.map +0 -1
  98. package/dist/chunk-22ZO4EKZ.mjs +0 -1297
  99. package/dist/chunk-2HE27YEV.mjs +0 -1739
  100. package/dist/chunk-45P4RDYP.mjs +0 -607
  101. package/dist/chunk-474DEGWW.mjs +0 -1792
  102. package/dist/chunk-4SYIJ7CU.mjs +0 -1538
  103. package/dist/chunk-4U4LDWGF.mjs +0 -360
  104. package/dist/chunk-4XQVYYPC.mjs +0 -1470
  105. package/dist/chunk-5CLU3HYU.mjs +0 -1475
  106. package/dist/chunk-5K73Q3OQ.mjs +0 -1520
  107. package/dist/chunk-5N5DCJOV.mjs +0 -583
  108. package/dist/chunk-6AVS4KTM.mjs +0 -1536
  109. package/dist/chunk-6FQYIG6I.mjs +0 -1298
  110. package/dist/chunk-6I4552YB.mjs +0 -1467
  111. package/dist/chunk-6LPITDKG.mjs +0 -1539
  112. package/dist/chunk-72QC5QUS.mjs +0 -549
  113. package/dist/chunk-736QSHJP.mjs +0 -1807
  114. package/dist/chunk-7LUSCLGR.mjs +0 -2058
  115. package/dist/chunk-7VK3XTSH.mjs +0 -1756
  116. package/dist/chunk-7ZEJGWLN.mjs +0 -1363
  117. package/dist/chunk-AECWO7NQ.mjs +0 -1539
  118. package/dist/chunk-AEK3MZC5.mjs +0 -709
  119. package/dist/chunk-AJC3FR6G.mjs +0 -1509
  120. package/dist/chunk-AMPK6SWS.mjs +0 -1754
  121. package/dist/chunk-BA7QGUHN.mjs +0 -1722
  122. package/dist/chunk-BCEZGRXI.mjs +0 -1297
  123. package/dist/chunk-BD4NWUVG.mjs +0 -1242
  124. package/dist/chunk-BEZPBI5C.mjs +0 -1829
  125. package/dist/chunk-BHCRDEE4.mjs +0 -1745
  126. package/dist/chunk-BW463GQB.mjs +0 -1767
  127. package/dist/chunk-CAX2MOUZ.mjs +0 -1801
  128. package/dist/chunk-CBWM3EK5.mjs +0 -1854
  129. package/dist/chunk-CCBNKQYB.mjs +0 -1812
  130. package/dist/chunk-CDIVYADN.mjs +0 -2110
  131. package/dist/chunk-CVGIDSMN.mjs +0 -1522
  132. package/dist/chunk-D25B5LZR.mjs +0 -1739
  133. package/dist/chunk-D3SIHB2V.mjs +0 -2118
  134. package/dist/chunk-DD7UVNE3.mjs +0 -678
  135. package/dist/chunk-DMRZMS2U.mjs +0 -964
  136. package/dist/chunk-DXG5NIYL.mjs +0 -1527
  137. package/dist/chunk-EBXG2Q5Y.mjs +0 -2059
  138. package/dist/chunk-EH3PMNZQ.mjs +0 -569
  139. package/dist/chunk-EMYD7NS6.mjs +0 -137
  140. package/dist/chunk-EVX2W2BK.mjs +0 -1896
  141. package/dist/chunk-EWFR366Y.mjs +0 -1740
  142. package/dist/chunk-EX7HCWAO.mjs +0 -625
  143. package/dist/chunk-FNPSK3CG.mjs +0 -1760
  144. package/dist/chunk-FO6YT6RG.mjs +0 -1751
  145. package/dist/chunk-FYI56A5M.mjs +0 -1892
  146. package/dist/chunk-G3CCJCBI.mjs +0 -1521
  147. package/dist/chunk-G7PO3DNK.mjs +0 -1072
  148. package/dist/chunk-GFADGYXZ.mjs +0 -1752
  149. package/dist/chunk-GTRIBVS6.mjs +0 -1467
  150. package/dist/chunk-GXTGOLZT.mjs +0 -92
  151. package/dist/chunk-H4HWBQU6.mjs +0 -1530
  152. package/dist/chunk-HDFXSEFW.mjs +0 -605
  153. package/dist/chunk-HOUDVRG2.mjs +0 -1422
  154. package/dist/chunk-HQNHM2X7.mjs +0 -997
  155. package/dist/chunk-I54HL4FZ.mjs +0 -781
  156. package/dist/chunk-I77HFFZU.mjs +0 -1876
  157. package/dist/chunk-IKRP7ECY.mjs +0 -1754
  158. package/dist/chunk-ILMLGJGI.mjs +0 -1295
  159. package/dist/chunk-IPIE5TXJ.mjs +0 -1741
  160. package/dist/chunk-IRWCPDWD.mjs +0 -779
  161. package/dist/chunk-J3MUOWHC.mjs +0 -1747
  162. package/dist/chunk-J5TA3AZU.mjs +0 -1795
  163. package/dist/chunk-JH535NPP.mjs +0 -1619
  164. package/dist/chunk-JUHHOSHG.mjs +0 -1808
  165. package/dist/chunk-JZ2SE4DB.mjs +0 -1116
  166. package/dist/chunk-K2WFOBAZ.mjs +0 -1821
  167. package/dist/chunk-K6U64EL3.mjs +0 -517
  168. package/dist/chunk-KDUUZQBK.mjs +0 -1692
  169. package/dist/chunk-KGFWKSGJ.mjs +0 -1442
  170. package/dist/chunk-KGVMS4R5.mjs +0 -1750
  171. package/dist/chunk-KWIS5FQP.mjs +0 -1739
  172. package/dist/chunk-KYSZF5N6.mjs +0 -1876
  173. package/dist/chunk-LERPI33Y.mjs +0 -2060
  174. package/dist/chunk-M64RHH4D.mjs +0 -1896
  175. package/dist/chunk-MBE4AQP5.mjs +0 -1362
  176. package/dist/chunk-MR7WXHIE.mjs +0 -1833
  177. package/dist/chunk-MZP3G7TF.mjs +0 -2118
  178. package/dist/chunk-N2GQWNFG.mjs +0 -1527
  179. package/dist/chunk-N6XBOOVA.mjs +0 -564
  180. package/dist/chunk-NJUW6VED.mjs +0 -610
  181. package/dist/chunk-NOHK5DLU.mjs +0 -2173
  182. package/dist/chunk-NQA3F2HJ.mjs +0 -1532
  183. package/dist/chunk-NXXQ2U73.mjs +0 -1467
  184. package/dist/chunk-OP4G6GLN.mjs +0 -1876
  185. package/dist/chunk-ORLC5Y4J.mjs +0 -1787
  186. package/dist/chunk-OTCQL7DY.mjs +0 -2045
  187. package/dist/chunk-OUYSZZ7X.mjs +0 -1846
  188. package/dist/chunk-OZE3FVZT.mjs +0 -1089
  189. package/dist/chunk-P3T3H27S.mjs +0 -1895
  190. package/dist/chunk-P5YV5WIX.mjs +0 -1803
  191. package/dist/chunk-P74BO725.mjs +0 -1296
  192. package/dist/chunk-PDN74MG3.mjs +0 -1834
  193. package/dist/chunk-PJD4VCIH.mjs +0 -1722
  194. package/dist/chunk-PVVCCE6W.mjs +0 -755
  195. package/dist/chunk-PVVMK56C.mjs +0 -1793
  196. package/dist/chunk-Q2GDZ2FZ.mjs +0 -1794
  197. package/dist/chunk-QDGPR3L6.mjs +0 -1518
  198. package/dist/chunk-RQCIJO5Z.mjs +0 -1116
  199. package/dist/chunk-RRB2C34Q.mjs +0 -1738
  200. package/dist/chunk-RYIB5CWD.mjs +0 -781
  201. package/dist/chunk-S6OPP4L5.mjs +0 -1791
  202. package/dist/chunk-SAVOSPM3.mjs +0 -1522
  203. package/dist/chunk-SFK6XTJE.mjs +0 -2110
  204. package/dist/chunk-SIX4KMF2.mjs +0 -1468
  205. package/dist/chunk-SPAM2YJE.mjs +0 -1537
  206. package/dist/chunk-T6ZCOPPI.mjs +0 -538
  207. package/dist/chunk-TPF75CNP.mjs +0 -581
  208. package/dist/chunk-TWWPY7FD.mjs +0 -1754
  209. package/dist/chunk-U5R2FTCR.mjs +0 -1803
  210. package/dist/chunk-UG7OPVHB.mjs +0 -1521
  211. package/dist/chunk-UMZTAWDA.mjs +0 -1812
  212. package/dist/chunk-UU4HZ7ZT.mjs +0 -1849
  213. package/dist/chunk-UXC6QUZ7.mjs +0 -1801
  214. package/dist/chunk-VBWXHKGD.mjs +0 -1895
  215. package/dist/chunk-VIJTZPBI.mjs +0 -1470
  216. package/dist/chunk-VLV6MXPL.mjs +0 -1750
  217. package/dist/chunk-VTALAPQZ.mjs +0 -1241
  218. package/dist/chunk-W2KNBN6W.mjs +0 -1849
  219. package/dist/chunk-W37E7MW5.mjs +0 -1403
  220. package/dist/chunk-W76FEISE.mjs +0 -1538
  221. package/dist/chunk-WCFQYXQA.mjs +0 -1532
  222. package/dist/chunk-WKOZOHOU.mjs +0 -2060
  223. package/dist/chunk-WTQJNY4U.mjs +0 -1785
  224. package/dist/chunk-XBFM2Z4O.mjs +0 -1792
  225. package/dist/chunk-XIXAWCMS.mjs +0 -1760
  226. package/dist/chunk-XTAXUNQN.mjs +0 -1742
  227. package/dist/chunk-XY77XABG.mjs +0 -1545
  228. package/dist/chunk-XZ645X5U.mjs +0 -1425
  229. package/dist/chunk-Y6FXYEAI.mjs +0 -10
  230. package/dist/chunk-YCGDIGOG.mjs +0 -1467
  231. package/dist/chunk-YYB6NZE3.mjs +0 -1869
  232. package/dist/chunk-Z5WY6A4P.mjs +0 -1754
  233. package/dist/chunk-ZAMFWKIB.mjs +0 -1842
  234. package/dist/classifier.d.ts +0 -114
  235. package/dist/classifier.d.ts.map +0 -1
  236. package/dist/classifier.js +0 -439
  237. package/dist/classifier.js.map +0 -1
  238. package/dist/cli-action-SA7SCYNV.mjs +0 -95
  239. package/dist/cli-action-VCXBZGZP.mjs +0 -95
  240. package/dist/cli-action-YAJOJCXJ.mjs +0 -95
  241. package/dist/cli.d.ts.map +0 -1
  242. package/dist/cli.js.map +0 -1
  243. package/dist/cluster-detector.d.ts +0 -8
  244. package/dist/cluster-detector.d.ts.map +0 -1
  245. package/dist/cluster-detector.js +0 -70
  246. package/dist/cluster-detector.js.map +0 -1
  247. package/dist/defaults.d.ts +0 -7
  248. package/dist/defaults.d.ts.map +0 -1
  249. package/dist/defaults.js +0 -54
  250. package/dist/defaults.js.map +0 -1
  251. package/dist/graph-builder.d.ts +0 -33
  252. package/dist/graph-builder.d.ts.map +0 -1
  253. package/dist/graph-builder.js +0 -225
  254. package/dist/graph-builder.js.map +0 -1
  255. package/dist/index.d.ts.map +0 -1
  256. package/dist/index.js.map +0 -1
  257. package/dist/metrics.d.ts +0 -34
  258. package/dist/metrics.d.ts.map +0 -1
  259. package/dist/metrics.js +0 -170
  260. package/dist/metrics.js.map +0 -1
  261. package/dist/orchestrator-3L3NAZYP.mjs +0 -10
  262. package/dist/orchestrator-5AL3XBPZ.mjs +0 -10
  263. package/dist/orchestrator-KMAKMHTD.mjs +0 -10
  264. package/dist/orchestrator-MONOZHVW.mjs +0 -10
  265. package/dist/orchestrator-R6MZT4Z2.mjs +0 -10
  266. package/dist/orchestrator-ZR7JSKWI.mjs +0 -10
  267. package/dist/provider.d.ts +0 -6
  268. package/dist/provider.d.ts.map +0 -1
  269. package/dist/provider.js +0 -48
  270. package/dist/provider.js.map +0 -1
  271. package/dist/python-context-3GZKN3LR.mjs +0 -162
  272. package/dist/python-context-GOH747QU.mjs +0 -202
  273. package/dist/python-context-O2EN3M6Z.mjs +0 -162
  274. package/dist/python-context-PAETRLDY.mjs +0 -185
  275. package/dist/python-context-TBI5FVFY.mjs +0 -203
  276. package/dist/python-context-UOPTQH44.mjs +0 -192
  277. package/dist/remediation.d.ts +0 -25
  278. package/dist/remediation.d.ts.map +0 -1
  279. package/dist/remediation.js +0 -98
  280. package/dist/remediation.js.map +0 -1
  281. package/dist/scoring.d.ts +0 -9
  282. package/dist/scoring.d.ts.map +0 -1
  283. package/dist/scoring.js +0 -142
  284. package/dist/scoring.js.map +0 -1
  285. package/dist/semantic-analysis.d.ts +0 -33
  286. package/dist/semantic-analysis.d.ts.map +0 -1
  287. package/dist/semantic-analysis.js +0 -303
  288. package/dist/semantic-analysis.js.map +0 -1
  289. package/dist/summary-7PZVW72O.mjs +0 -7
  290. package/dist/summary-LKUCJAIS.mjs +0 -7
  291. package/dist/summary.d.ts +0 -6
  292. package/dist/summary.d.ts.map +0 -1
  293. package/dist/summary.js +0 -92
  294. package/dist/summary.js.map +0 -1
  295. package/dist/types.d.ts +0 -124
  296. package/dist/types.d.ts.map +0 -1
  297. package/dist/types.js +0 -2
  298. package/dist/types.js.map +0 -1
  299. package/dist/utils/output-formatter.d.ts +0 -14
  300. package/dist/utils/output-formatter.d.ts.map +0 -1
  301. package/dist/utils/output-formatter.js +0 -338
  302. package/dist/utils/output-formatter.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { ToolProvider, Severity, ScanOptions, ExportInfo, FileContent, CostConfig, ToolScoringOutput } from '@aiready/core';
1
+ import { ToolProvider, Severity, ScanOptions, ExportInfo, CostConfig, ToolScoringOutput, FileContent } from '@aiready/core';
2
2
  export { ExportInfo } from '@aiready/core';
3
3
 
4
4
  /**
5
5
  * Context Analyzer Tool Provider
6
6
  */
7
- declare const ContextAnalyzerProvider: ToolProvider;
7
+ declare const CONTEXT_ANALYZER_PROVIDER: ToolProvider;
8
8
 
9
9
  /**
10
10
  * Options for the Context Analyzer tool.
@@ -152,12 +152,6 @@ interface TypeDependency {
152
152
  usedBy: string[];
153
153
  }
154
154
 
155
- interface MappingOptions {
156
- maxDepth: number;
157
- maxContextBudget: number;
158
- minCohesion: number;
159
- maxFragmentation: number;
160
- }
161
155
  /**
162
156
  * Calculate cohesion score (how related are exports in a file).
163
157
  * Legacy wrapper for backward compatibility with exact test expectations.
@@ -179,56 +173,24 @@ declare function calculateCohesion(exports: any[], filePath?: string, options?:
179
173
  declare function analyzeContext(options: ContextAnalyzerOptions): Promise<ContextAnalysisResult[]>;
180
174
 
181
175
  /**
182
- * Auto-detect domain keywords from workspace folder structure.
183
- *
184
- * @param files - Array of file contents to analyze for folder patterns.
185
- * @returns Array of singularized domain keywords.
186
- */
187
- declare function extractDomainKeywordsFromPaths(files: FileContent[]): string[];
188
- /**
189
- * Build a dependency graph from file contents, resolving imports and extracting metadata.
190
- *
191
- * @param files - Array of file contents to process.
192
- * @param options - Optional configuration for domain detection.
193
- * @returns Complete dependency graph with nodes, edges, and semantic matrices.
194
- */
195
- declare function buildDependencyGraph(files: FileContent[], options?: {
196
- domainKeywords?: string[];
197
- }): Promise<DependencyGraph>;
198
- /**
199
- * Calculate the maximum depth of the import tree for a specific file.
200
- *
201
- * @param file - File path to start depth calculation from.
202
- * @param graph - The dependency graph.
203
- * @param visited - Optional set to track visited nodes during traversal.
204
- * @param depth - Current recursion depth.
205
- * @returns Maximum depth of the import chain.
206
- */
207
- declare function calculateImportDepth(file: string, graph: DependencyGraph, visited?: Set<string>, depth?: number): number;
208
- /**
209
- * Retrieve all transitive dependencies for a specific file.
176
+ * Calculate AI Readiness Score for context efficiency (0-100).
210
177
  *
211
- * @param file - File path to analyze.
212
- * @param graph - The dependency graph.
213
- * @param visited - Optional set to track visited nodes.
214
- * @returns Array of all reachable file paths.
215
- */
216
- declare function getTransitiveDependencies(file: string, graph: DependencyGraph, visited?: Set<string>): string[];
217
- /**
218
- * Calculate total context budget (tokens needed to understand this file and its dependencies).
178
+ * Evaluates how efficiently an AI model can process the project's code context
179
+ * based on token budgets, import depth, and file fragmentation.
219
180
  *
220
- * @param file - File path to calculate budget for.
221
- * @param graph - The dependency graph.
222
- * @returns Total token count including recursive dependencies.
181
+ * @param summary - Consolidated context summary from the scan.
182
+ * @param costConfig - Optional configuration for business value calculations.
183
+ * @returns Standardized scoring output for the context analyzer tool.
184
+ * @lastUpdated 2026-03-18
223
185
  */
224
- declare function calculateContextBudget(file: string, graph: DependencyGraph): number;
186
+ declare function calculateContextScore(summary: ContextSummary, costConfig?: Partial<CostConfig>): ToolScoringOutput;
225
187
  /**
226
- * Detect circular dependencies (cycles) within the dependency graph.
188
+ * Maps a numerical score to a human-readable rating slug.
227
189
  *
228
- * @param graph - The dependency graph to scan.
229
- * @returns Array of dependency cycles (each cycle is an array of file paths).
190
+ * @param score - The 0-100 readiness score.
191
+ * @returns A formatted rating string (e.g., "excellent", "at risk").
230
192
  */
231
- declare function detectCircularDependencies(graph: DependencyGraph): string[][];
193
+ declare function mapScoreToRating(score: number): string;
232
194
 
233
195
  /**
234
196
  * Calculates a cohesion score (0-1) for a module based on its exports,
@@ -286,23 +248,61 @@ declare function calculatePathEntropy(files: string[]): number;
286
248
  declare function calculateDirectoryDistance(files: string[]): number;
287
249
 
288
250
  /**
289
- * Constants for file classifications to avoid magic strings
251
+ * Group files by domain to detect module clusters
252
+ * @param graph - The dependency graph to analyze
253
+ * @param options - Optional configuration options
254
+ * @param options.useLogScale - Whether to use logarithmic scaling for calculations
255
+ * @returns Array of module clusters
290
256
  */
291
- declare const Classification: {
292
- BARREL: "barrel-export";
293
- BOILERPLATE: "boilerplate-barrel";
294
- TYPE_DEFINITION: "type-definition";
295
- NEXTJS_PAGE: "nextjs-page";
296
- LAMBDA_HANDLER: "lambda-handler";
297
- SERVICE: "service-file";
298
- EMAIL_TEMPLATE: "email-template";
299
- PARSER: "parser-file";
300
- COHESIVE_MODULE: "cohesive-module";
301
- UTILITY_MODULE: "utility-module";
302
- SPOKE_MODULE: "spoke-module";
303
- MIXED_CONCERNS: "mixed-concerns";
304
- UNKNOWN: "unknown";
305
- };
257
+ declare function detectModuleClusters(graph: DependencyGraph, options?: {
258
+ useLogScale?: boolean;
259
+ }): ModuleCluster[];
260
+
261
+ /**
262
+ * Build a dependency graph from file contents, resolving imports and extracting metadata.
263
+ *
264
+ * @param files - Array of file contents to process.
265
+ * @param options - Optional configuration for domain detection.
266
+ * @returns Complete dependency graph with nodes, edges, and semantic matrices.
267
+ */
268
+ declare function buildDependencyGraph(files: FileContent[], options?: {
269
+ domainKeywords?: string[];
270
+ }): Promise<DependencyGraph>;
271
+ /**
272
+ * Calculate the maximum depth of the import tree for a specific file.
273
+ *
274
+ * @param file - File path to start depth calculation from.
275
+ * @param graph - The dependency graph.
276
+ * @param visited - Optional set to track visited nodes during traversal.
277
+ * @param depth - Current recursion depth.
278
+ * @returns Maximum depth of the import chain.
279
+ */
280
+ declare function calculateImportDepth(file: string, graph: DependencyGraph, visited?: Set<string>, depth?: number): number;
281
+ /**
282
+ * Retrieve all transitive dependencies for a specific file.
283
+ *
284
+ * @param file - File path to analyze.
285
+ * @param graph - The dependency graph.
286
+ * @param visited - Optional set to track visited nodes.
287
+ * @returns Array of all reachable file paths.
288
+ */
289
+ declare function getTransitiveDependencies(file: string, graph: DependencyGraph, visited?: Set<string>): string[];
290
+ /**
291
+ * Calculate total context budget (tokens needed to understand this file and its dependencies).
292
+ *
293
+ * @param file - File path to calculate budget for.
294
+ * @param graph - The dependency graph.
295
+ * @returns Total token count including recursive dependencies.
296
+ */
297
+ declare function calculateContextBudget(file: string, graph: DependencyGraph): number;
298
+ /**
299
+ * Detect circular dependencies (cycles) within the dependency graph.
300
+ *
301
+ * @param graph - The dependency graph to scan.
302
+ * @returns Array of dependency cycles (each cycle is an array of file paths).
303
+ */
304
+ declare function detectCircularDependencies(graph: DependencyGraph): string[][];
305
+
306
306
  /**
307
307
  * Classify a file into a specific type for better analysis context
308
308
  *
@@ -330,17 +330,6 @@ declare function adjustCohesionForClassification(baseCohesion: number, classific
330
330
  */
331
331
  declare function adjustFragmentationForClassification(baseFragmentation: number, classification: FileClassification): number;
332
332
 
333
- /**
334
- * Group files by domain to detect module clusters
335
- * @param graph - The dependency graph to analyze
336
- * @param options - Optional configuration options
337
- * @param options.useLogScale - Whether to use logarithmic scaling for calculations
338
- * @returns Array of module clusters
339
- */
340
- declare function detectModuleClusters(graph: DependencyGraph, options?: {
341
- useLogScale?: boolean;
342
- }): ModuleCluster[];
343
-
344
333
  /**
345
334
  * Get classification-specific recommendations
346
335
  *
@@ -374,35 +363,6 @@ declare function getGeneralRecommendations(metrics: {
374
363
  severity: any;
375
364
  };
376
365
 
377
- /**
378
- * Calculate AI Readiness Score for context efficiency (0-100).
379
- *
380
- * Evaluates how efficiently an AI model can process the project's code context
381
- * based on token budgets, import depth, and file fragmentation.
382
- *
383
- * @param summary - Consolidated context summary from the scan.
384
- * @param costConfig - Optional configuration for business value calculations.
385
- * @returns Standardized scoring output for the context analyzer tool.
386
- * @lastUpdated 2026-03-18
387
- */
388
- declare function calculateContextScore(summary: ContextSummary, costConfig?: Partial<CostConfig>): ToolScoringOutput;
389
- /**
390
- * Maps a numerical score to a human-readable rating slug.
391
- *
392
- * @param score - The 0-100 readiness score.
393
- * @returns A formatted rating string (e.g., "excellent", "at risk").
394
- */
395
- declare function mapScoreToRating(score: number): string;
396
-
397
- /**
398
- * Generate smart defaults for context analysis based on repository size
399
- * Automatically tunes thresholds to target ~10 most serious issues
400
- * @param directory - The root directory to analyze
401
- * @param userOptions - Partial user-provided options to merge with defaults
402
- * @returns Complete ContextAnalyzerOptions with smart defaults
403
- */
404
- declare function getSmartDefaults(directory: string, userOptions: Partial<ContextAnalyzerOptions>): Promise<ContextAnalyzerOptions>;
405
-
406
366
  /**
407
367
  * Generate summary of context analysis results
408
368
  *
@@ -412,232 +372,4 @@ declare function getSmartDefaults(directory: string, userOptions: Partial<Contex
412
372
  */
413
373
  declare function generateSummary(results: ContextAnalysisResult[], options?: any): ContextSummary;
414
374
 
415
- /**
416
- * Build co-usage matrix: track which files are imported together frequently.
417
- *
418
- * @param graph - The dependency graph to analyze.
419
- * @returns Map of file path to nested map of related files and their co-occurrence counts.
420
- */
421
- declare function buildCoUsageMatrix(graph: DependencyGraph): Map<string, Map<string, number>>;
422
- /**
423
- * Find semantic clusters using frequently occurring co-usage patterns.
424
- *
425
- * @param coUsageMatrix - The co-usage matrix from buildCoUsageMatrix.
426
- * @param minCoUsage - Minimum co-usage count to consider a strong relationship (default: 3).
427
- * @returns Map of cluster representative files to their associated cluster members.
428
- */
429
- declare function findSemanticClusters(coUsageMatrix: Map<string, Map<string, number>>, minCoUsage?: number): Map<string, string[]>;
430
- /**
431
- * Retrieve co-usage data for a specific file.
432
- *
433
- * @param file - The file path to look up.
434
- * @param coUsageMatrix - The global co-usage matrix.
435
- * @returns Formatted co-usage data object.
436
- */
437
- declare function getCoUsageData(file: string, coUsageMatrix: Map<string, Map<string, number>>): CoUsageData;
438
-
439
- /**
440
- * Extract type dependencies from AST exports to build a type-based relationship graph.
441
- *
442
- * @param graph - The dependency graph to analyze.
443
- * @returns Map of type reference names to sets of files that consume or export them.
444
- */
445
- declare function buildTypeGraph(graph: DependencyGraph): Map<string, Set<string>>;
446
-
447
- /**
448
- * Calculate confidence score for a domain assignment based on signals.
449
- *
450
- * @param signals - The set of semantic signals detected for a domain.
451
- * @returns Numerical confidence score (0-1).
452
- */
453
- declare function calculateDomainConfidence(signals: DomainSignals): number;
454
- /**
455
- * Infer domain from semantic analysis (co-usage + types) to identify logical modules.
456
- *
457
- * @param file - The file path to infer domain for.
458
- * @param exportName - The specific export identifier.
459
- * @param graph - The full dependency graph.
460
- * @param coUsageMatrix - Matrix of files frequently imported together.
461
- * @param typeGraph - Map of type references to files.
462
- * @param exportTypeRefs - Optional list of types referenced by the export.
463
- * @returns Array of potential domain assignments with confidence scores.
464
- */
465
- declare function inferDomainFromSemantics(file: string, exportName: string, graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, exportTypeRefs?: string[]): DomainAssignment[];
466
- /**
467
- * Regex-based export extraction (legacy/fallback)
468
- *
469
- * @param content - Source code content.
470
- * @param filePath - Optional file path for domain context.
471
- * @param domainOptions - Optional overrides for domain keywords.
472
- * @param fileImports - Optional list of actual imports for semantic context.
473
- * @returns Array of extracted export information.
474
- */
475
- declare function extractExports(content: string, filePath?: string, domainOptions?: {
476
- domainKeywords?: string[];
477
- }, fileImports?: string[]): ExportInfo[];
478
- /**
479
- * Infer domain from name, path, or imports
480
- *
481
- * @param name - The identifier name to analyze.
482
- * @param filePath - Optional file path for structure context.
483
- * @param domainOptions - Optional overrides for domain keywords.
484
- * @param fileImports - Optional list of imports for domain context.
485
- * @returns The inferred domain name (string).
486
- */
487
- declare function inferDomain(name: string, filePath?: string, domainOptions?: {
488
- domainKeywords?: string[];
489
- }, fileImports?: string[]): string;
490
-
491
- /**
492
- * Identify candidates for module consolidation based on high co-usage or shared types.
493
- *
494
- * @param graph - The dependency graph.
495
- * @param coUsageMatrix - Matrix of frequently paired files.
496
- * @param typeGraph - Map of shared type references.
497
- * @param minCoUsage - Minimum co-usage count threshold.
498
- * @param minSharedTypes - Minimum shared types threshold.
499
- * @returns Array of consolidation candidates sorted by strength.
500
- */
501
- declare function findConsolidationCandidates(graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, minCoUsage?: number, minSharedTypes?: number): {
502
- files: string[];
503
- reason: string;
504
- strength: number;
505
- }[];
506
-
507
- /**
508
- * Classification pattern constants for file type detection.
509
- */
510
- /** Minimum exports to consider a file as a barrel export */
511
- declare const BARREL_EXPORT_MIN_EXPORTS = 5;
512
- /** Token cost limit for barrel export detection */
513
- declare const BARREL_EXPORT_TOKEN_LIMIT = 1000;
514
- /** Patterns for Lambda/API handler detection */
515
- declare const HANDLER_NAME_PATTERNS: string[];
516
- /** Patterns for service file detection */
517
- declare const SERVICE_NAME_PATTERNS: string[];
518
- /** Patterns for email template detection */
519
- declare const EMAIL_NAME_PATTERNS: string[];
520
- /** Patterns for parser/transformer detection */
521
- declare const PARSER_NAME_PATTERNS: string[];
522
- /** Patterns for session/state management detection */
523
- declare const SESSION_NAME_PATTERNS: string[];
524
- /** Next.js metadata export names */
525
- declare const NEXTJS_METADATA_EXPORTS: string[];
526
- /** Patterns for configuration file detection */
527
- declare const CONFIG_NAME_PATTERNS: string[];
528
-
529
- /**
530
- * Detect if a file is a boilerplate barrel (architectural theater).
531
- * A boilerplate barrel re-exports from other sources without adding value.
532
- *
533
- * @param node - The dependency node to analyze.
534
- * @returns True if the file matches boilerplate barrel patterns.
535
- */
536
- declare function isBoilerplateBarrel(node: DependencyNode): boolean;
537
- /**
538
- * Detect if a file is a barrel export (index.ts).
539
- *
540
- * @param node - The dependency node to analyze.
541
- * @returns True if the file matches barrel export patterns.
542
- * @lastUpdated 2026-03-20
543
- */
544
- declare function isBarrelExport(node: DependencyNode): boolean;
545
- /**
546
- * Detect if a file is primarily type definitions.
547
- *
548
- * @param node - The dependency node to analyze.
549
- * @returns True if the file contains primarily types or matches type paths.
550
- * @lastUpdated 2026-03-18
551
- */
552
- declare function isTypeDefinition(node: DependencyNode): boolean;
553
- /**
554
- * Detect if a file is a utility module.
555
- *
556
- * @param node - The dependency node to analyze.
557
- * @returns True if the file path or name suggests a utility/helper role.
558
- * @lastUpdated 2026-03-18
559
- */
560
- declare function isUtilityModule(node: DependencyNode): boolean;
561
- /**
562
- * Detect if a file is a Lambda/API handler.
563
- *
564
- * @param node - The dependency node to analyze.
565
- * @returns True if the file serves as a coordination point for requests/lambdas.
566
- * @lastUpdated 2026-03-18
567
- */
568
- declare function isLambdaHandler(node: DependencyNode): boolean;
569
- /**
570
- * Detect if a file is a service file.
571
- *
572
- * @param node - The dependency node to analyze.
573
- * @returns True if the file orchestrates logic or matches service patterns.
574
- * @lastUpdated 2026-03-18
575
- */
576
- declare function isServiceFile(node: DependencyNode): boolean;
577
- /**
578
- * Detect if a file is an email template/layout.
579
- *
580
- * @param node - The dependency node to analyze.
581
- * @returns True if the file is used for rendering notifications or emails.
582
- * @lastUpdated 2026-03-18
583
- */
584
- declare function isEmailTemplate(node: DependencyNode): boolean;
585
- /**
586
- * Detect if a file is a parser/transformer.
587
- *
588
- * @param node - The dependency node to analyze.
589
- * @returns True if the file handles data conversion or serialization.
590
- * @lastUpdated 2026-03-18
591
- */
592
- declare function isParserFile(node: DependencyNode): boolean;
593
- /**
594
- * Detect if a file is a session/state management file.
595
- *
596
- * @param node - The dependency node to analyze.
597
- * @returns True if the file manages application state or sessions.
598
- * @lastUpdated 2026-03-18
599
- */
600
- declare function isSessionFile(node: DependencyNode): boolean;
601
- /**
602
- * Detect if a file is a Next.js App Router page.
603
- *
604
- * @param node - The dependency node to analyze.
605
- * @returns True if the file is a Next.js page or metadata entry.
606
- * @lastUpdated 2026-03-18
607
- */
608
- declare function isNextJsPage(node: DependencyNode): boolean;
609
- /**
610
- * Detect if a file is a configuration or schema file.
611
- *
612
- * @param node - The dependency node to analyze.
613
- * @returns True if the file matches configuration, setting, or schema patterns.
614
- * @lastUpdated 2026-03-18
615
- */
616
- declare function isConfigFile(node: DependencyNode): boolean;
617
- /**
618
- * Detect if a file is part of a hub-and-spoke monorepo architecture.
619
- *
620
- * Many files spread across multiple packages (spokes) is intentional in
621
- * AIReady and shouldn't be penalized as heavily for fragmentation.
622
- *
623
- * @param node - The dependency node to analyze.
624
- * @returns True if the file path suggests it belongs to a spoke package.
625
- */
626
- declare function isHubAndSpokeFile(node: DependencyNode): boolean;
627
-
628
- /**
629
- * Display analysis report in console
630
- */
631
- declare function displayConsoleReport(summary: ReturnType<typeof generateSummary>, results: Awaited<ReturnType<typeof analyzeContext>>, maxResults?: number): void;
632
-
633
- /**
634
- * Generate HTML report
635
- */
636
- declare function generateHTMLReport(summary: ReturnType<typeof generateSummary>, results: Awaited<ReturnType<typeof analyzeContext>>): string;
637
-
638
- /**
639
- * Interactive setup: detect common frameworks and suggest excludes & focus areas
640
- */
641
- declare function runInteractiveSetup(directory: string, current: any): Promise<any>;
642
-
643
- export { BARREL_EXPORT_MIN_EXPORTS, BARREL_EXPORT_TOKEN_LIMIT, CONFIG_NAME_PATTERNS, Classification, type CoUsageData, type ContextAnalysisResult, type ContextAnalyzerOptions, ContextAnalyzerProvider, type ContextSummary, type DependencyGraph, type DependencyNode, type DomainAssignment, type DomainSignals, EMAIL_NAME_PATTERNS, type FileClassification, HANDLER_NAME_PATTERNS, type MappingOptions, type ModuleCluster, NEXTJS_METADATA_EXPORTS, PARSER_NAME_PATTERNS, SERVICE_NAME_PATTERNS, SESSION_NAME_PATTERNS, type TypeDependency, adjustCohesionForClassification, adjustFragmentationForClassification, analyzeContext, buildCoUsageMatrix, buildDependencyGraph, buildTypeGraph, calculateCohesion, calculateContextBudget, calculateContextScore, calculateDirectoryDistance, calculateDomainConfidence, calculateEnhancedCohesion, calculateFragmentation, calculateImportDepth, calculatePathEntropy, calculateStructuralCohesionFromCoUsage, classifyFile, detectCircularDependencies, detectModuleClusters, displayConsoleReport, extractDomainKeywordsFromPaths, extractExports, findConsolidationCandidates, findSemanticClusters, generateHTMLReport, generateSummary, getClassificationRecommendations, getCoUsageData, getGeneralRecommendations, getSmartDefaults, getTransitiveDependencies, inferDomain, inferDomainFromSemantics, isBarrelExport, isBoilerplateBarrel, isConfigFile, isEmailTemplate, isHubAndSpokeFile, isLambdaHandler, isNextJsPage, isParserFile, isServiceFile, isSessionFile, isTypeDefinition, isUtilityModule, mapScoreToRating, runInteractiveSetup };
375
+ export { CONTEXT_ANALYZER_PROVIDER, type CoUsageData, type ContextAnalysisResult, type ContextAnalyzerOptions, type ContextSummary, type DependencyGraph, type DependencyNode, type DomainAssignment, type DomainSignals, type FileClassification, type ModuleCluster, type TypeDependency, adjustCohesionForClassification, adjustFragmentationForClassification, analyzeContext, buildDependencyGraph, calculateCohesion, calculateContextBudget, calculateContextScore, calculateDirectoryDistance, calculateEnhancedCohesion, calculateFragmentation, calculateImportDepth, calculatePathEntropy, calculateStructuralCohesionFromCoUsage, classifyFile, detectCircularDependencies, detectModuleClusters, generateSummary, getClassificationRecommendations, getGeneralRecommendations, getTransitiveDependencies, mapScoreToRating };