circle-ir-ai 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/LICENSE +15 -0
  3. package/README.md +336 -0
  4. package/dist/action-queue/aggregator.d.ts +40 -0
  5. package/dist/action-queue/aggregator.d.ts.map +1 -0
  6. package/dist/action-queue/aggregator.js +375 -0
  7. package/dist/action-queue/aggregator.js.map +1 -0
  8. package/dist/action-queue/index.d.ts +14 -0
  9. package/dist/action-queue/index.d.ts.map +1 -0
  10. package/dist/action-queue/index.js +17 -0
  11. package/dist/action-queue/index.js.map +1 -0
  12. package/dist/action-queue/queue.d.ts +74 -0
  13. package/dist/action-queue/queue.d.ts.map +1 -0
  14. package/dist/action-queue/queue.js +433 -0
  15. package/dist/action-queue/queue.js.map +1 -0
  16. package/dist/action-queue/types.d.ts +162 -0
  17. package/dist/action-queue/types.d.ts.map +1 -0
  18. package/dist/action-queue/types.js +44 -0
  19. package/dist/action-queue/types.js.map +1 -0
  20. package/dist/agents/enrichment-agent.d.ts +16 -0
  21. package/dist/agents/enrichment-agent.d.ts.map +1 -0
  22. package/dist/agents/enrichment-agent.js +102 -0
  23. package/dist/agents/enrichment-agent.js.map +1 -0
  24. package/dist/agents/index.d.ts +12 -0
  25. package/dist/agents/index.d.ts.map +1 -0
  26. package/dist/agents/index.js +15 -0
  27. package/dist/agents/index.js.map +1 -0
  28. package/dist/agents/mastra/agents.d.ts +373 -0
  29. package/dist/agents/mastra/agents.d.ts.map +1 -0
  30. package/dist/agents/mastra/agents.js +347 -0
  31. package/dist/agents/mastra/agents.js.map +1 -0
  32. package/dist/agents/mastra/index.d.ts +12 -0
  33. package/dist/agents/mastra/index.d.ts.map +1 -0
  34. package/dist/agents/mastra/index.js +17 -0
  35. package/dist/agents/mastra/index.js.map +1 -0
  36. package/dist/agents/mastra/instance.d.ts +383 -0
  37. package/dist/agents/mastra/instance.d.ts.map +1 -0
  38. package/dist/agents/mastra/instance.js +37 -0
  39. package/dist/agents/mastra/instance.js.map +1 -0
  40. package/dist/agents/mastra/steps.d.ts +300 -0
  41. package/dist/agents/mastra/steps.d.ts.map +1 -0
  42. package/dist/agents/mastra/steps.js +468 -0
  43. package/dist/agents/mastra/steps.js.map +1 -0
  44. package/dist/agents/mastra/swarm.d.ts +106 -0
  45. package/dist/agents/mastra/swarm.d.ts.map +1 -0
  46. package/dist/agents/mastra/swarm.js +501 -0
  47. package/dist/agents/mastra/swarm.js.map +1 -0
  48. package/dist/agents/mastra/workflow.d.ts +81 -0
  49. package/dist/agents/mastra/workflow.d.ts.map +1 -0
  50. package/dist/agents/mastra/workflow.js +460 -0
  51. package/dist/agents/mastra/workflow.js.map +1 -0
  52. package/dist/agents/multi/agents/security.d.ts +29 -0
  53. package/dist/agents/multi/agents/security.d.ts.map +1 -0
  54. package/dist/agents/multi/agents/security.js +830 -0
  55. package/dist/agents/multi/agents/security.js.map +1 -0
  56. package/dist/agents/multi/extractor.d.ts +21 -0
  57. package/dist/agents/multi/extractor.d.ts.map +1 -0
  58. package/dist/agents/multi/extractor.js +483 -0
  59. package/dist/agents/multi/extractor.js.map +1 -0
  60. package/dist/agents/multi/index.d.ts +32 -0
  61. package/dist/agents/multi/index.d.ts.map +1 -0
  62. package/dist/agents/multi/index.js +34 -0
  63. package/dist/agents/multi/index.js.map +1 -0
  64. package/dist/agents/multi/runner.d.ts +79 -0
  65. package/dist/agents/multi/runner.d.ts.map +1 -0
  66. package/dist/agents/multi/runner.js +323 -0
  67. package/dist/agents/multi/runner.js.map +1 -0
  68. package/dist/agents/security-agent.d.ts +16 -0
  69. package/dist/agents/security-agent.d.ts.map +1 -0
  70. package/dist/agents/security-agent.js +299 -0
  71. package/dist/agents/security-agent.js.map +1 -0
  72. package/dist/agents/types.d.ts +373 -0
  73. package/dist/agents/types.d.ts.map +1 -0
  74. package/dist/agents/types.js +14 -0
  75. package/dist/agents/types.js.map +1 -0
  76. package/dist/agents/verification-agent.d.ts +23 -0
  77. package/dist/agents/verification-agent.d.ts.map +1 -0
  78. package/dist/agents/verification-agent.js +217 -0
  79. package/dist/agents/verification-agent.js.map +1 -0
  80. package/dist/agents/workflow.d.ts +30 -0
  81. package/dist/agents/workflow.d.ts.map +1 -0
  82. package/dist/agents/workflow.js +79 -0
  83. package/dist/agents/workflow.js.map +1 -0
  84. package/dist/analysis/enriched.d.ts +16 -0
  85. package/dist/analysis/enriched.d.ts.map +1 -0
  86. package/dist/analysis/enriched.js +297 -0
  87. package/dist/analysis/enriched.js.map +1 -0
  88. package/dist/analysis/llm-correlated-predicates.d.ts +80 -0
  89. package/dist/analysis/llm-correlated-predicates.d.ts.map +1 -0
  90. package/dist/analysis/llm-correlated-predicates.js +255 -0
  91. package/dist/analysis/llm-correlated-predicates.js.map +1 -0
  92. package/dist/analysis/llm-cross-file-taint.d.ts +86 -0
  93. package/dist/analysis/llm-cross-file-taint.d.ts.map +1 -0
  94. package/dist/analysis/llm-cross-file-taint.js +264 -0
  95. package/dist/analysis/llm-cross-file-taint.js.map +1 -0
  96. package/dist/analysis/pattern-discovery.d.ts +79 -0
  97. package/dist/analysis/pattern-discovery.d.ts.map +1 -0
  98. package/dist/analysis/pattern-discovery.js +447 -0
  99. package/dist/analysis/pattern-discovery.js.map +1 -0
  100. package/dist/cache/file-cache.d.ts +89 -0
  101. package/dist/cache/file-cache.d.ts.map +1 -0
  102. package/dist/cache/file-cache.js +208 -0
  103. package/dist/cache/file-cache.js.map +1 -0
  104. package/dist/cache/index.d.ts +6 -0
  105. package/dist/cache/index.d.ts.map +1 -0
  106. package/dist/cache/index.js +5 -0
  107. package/dist/cache/index.js.map +1 -0
  108. package/dist/cli/args.d.ts +52 -0
  109. package/dist/cli/args.d.ts.map +1 -0
  110. package/dist/cli/args.js +422 -0
  111. package/dist/cli/args.js.map +1 -0
  112. package/dist/cli/colors.d.ts +31 -0
  113. package/dist/cli/colors.d.ts.map +1 -0
  114. package/dist/cli/colors.js +80 -0
  115. package/dist/cli/colors.js.map +1 -0
  116. package/dist/cli/commands/analyze-skill.d.ts +33 -0
  117. package/dist/cli/commands/analyze-skill.d.ts.map +1 -0
  118. package/dist/cli/commands/analyze-skill.js +217 -0
  119. package/dist/cli/commands/analyze-skill.js.map +1 -0
  120. package/dist/cli/commands/analyze.d.ts +18 -0
  121. package/dist/cli/commands/analyze.d.ts.map +1 -0
  122. package/dist/cli/commands/analyze.js +30 -0
  123. package/dist/cli/commands/analyze.js.map +1 -0
  124. package/dist/cli/commands/benchmark-runner.d.ts +42 -0
  125. package/dist/cli/commands/benchmark-runner.d.ts.map +1 -0
  126. package/dist/cli/commands/benchmark-runner.js +18 -0
  127. package/dist/cli/commands/benchmark-runner.js.map +1 -0
  128. package/dist/cli/commands/benchmark.d.ts +11 -0
  129. package/dist/cli/commands/benchmark.d.ts.map +1 -0
  130. package/dist/cli/commands/benchmark.js +90 -0
  131. package/dist/cli/commands/benchmark.js.map +1 -0
  132. package/dist/cli/commands/dead-code.d.ts +11 -0
  133. package/dist/cli/commands/dead-code.d.ts.map +1 -0
  134. package/dist/cli/commands/dead-code.js +65 -0
  135. package/dist/cli/commands/dead-code.js.map +1 -0
  136. package/dist/cli/commands/generate-spec.d.ts +11 -0
  137. package/dist/cli/commands/generate-spec.d.ts.map +1 -0
  138. package/dist/cli/commands/generate-spec.js +67 -0
  139. package/dist/cli/commands/generate-spec.js.map +1 -0
  140. package/dist/cli/commands/health.d.ts +11 -0
  141. package/dist/cli/commands/health.d.ts.map +1 -0
  142. package/dist/cli/commands/health.js +67 -0
  143. package/dist/cli/commands/health.js.map +1 -0
  144. package/dist/cli/commands/project.d.ts +21 -0
  145. package/dist/cli/commands/project.d.ts.map +1 -0
  146. package/dist/cli/commands/project.js +92 -0
  147. package/dist/cli/commands/project.js.map +1 -0
  148. package/dist/cli/commands/scan.d.ts +11 -0
  149. package/dist/cli/commands/scan.d.ts.map +1 -0
  150. package/dist/cli/commands/scan.js +68 -0
  151. package/dist/cli/commands/scan.js.map +1 -0
  152. package/dist/cli/commands/secrets.d.ts +11 -0
  153. package/dist/cli/commands/secrets.d.ts.map +1 -0
  154. package/dist/cli/commands/secrets.js +71 -0
  155. package/dist/cli/commands/secrets.js.map +1 -0
  156. package/dist/cli/commands/swarm.d.ts +20 -0
  157. package/dist/cli/commands/swarm.d.ts.map +1 -0
  158. package/dist/cli/commands/swarm.js +174 -0
  159. package/dist/cli/commands/swarm.js.map +1 -0
  160. package/dist/cli/config.d.ts +103 -0
  161. package/dist/cli/config.d.ts.map +1 -0
  162. package/dist/cli/config.js +307 -0
  163. package/dist/cli/config.js.map +1 -0
  164. package/dist/cli/discovery.d.ts +31 -0
  165. package/dist/cli/discovery.d.ts.map +1 -0
  166. package/dist/cli/discovery.js +212 -0
  167. package/dist/cli/discovery.js.map +1 -0
  168. package/dist/cli/formatters/index.d.ts +15 -0
  169. package/dist/cli/formatters/index.d.ts.map +1 -0
  170. package/dist/cli/formatters/index.js +51 -0
  171. package/dist/cli/formatters/index.js.map +1 -0
  172. package/dist/cli/formatters/json.d.ts +11 -0
  173. package/dist/cli/formatters/json.d.ts.map +1 -0
  174. package/dist/cli/formatters/json.js +12 -0
  175. package/dist/cli/formatters/json.js.map +1 -0
  176. package/dist/cli/formatters/project-json.d.ts +11 -0
  177. package/dist/cli/formatters/project-json.d.ts.map +1 -0
  178. package/dist/cli/formatters/project-json.js +12 -0
  179. package/dist/cli/formatters/project-json.js.map +1 -0
  180. package/dist/cli/formatters/project-sarif.d.ts +11 -0
  181. package/dist/cli/formatters/project-sarif.d.ts.map +1 -0
  182. package/dist/cli/formatters/project-sarif.js +127 -0
  183. package/dist/cli/formatters/project-sarif.js.map +1 -0
  184. package/dist/cli/formatters/project-summary.d.ts +11 -0
  185. package/dist/cli/formatters/project-summary.d.ts.map +1 -0
  186. package/dist/cli/formatters/project-summary.js +202 -0
  187. package/dist/cli/formatters/project-summary.js.map +1 -0
  188. package/dist/cli/formatters/sarif-shared.d.ts +101 -0
  189. package/dist/cli/formatters/sarif-shared.d.ts.map +1 -0
  190. package/dist/cli/formatters/sarif-shared.js +57 -0
  191. package/dist/cli/formatters/sarif-shared.js.map +1 -0
  192. package/dist/cli/formatters/sarif.d.ts +12 -0
  193. package/dist/cli/formatters/sarif.d.ts.map +1 -0
  194. package/dist/cli/formatters/sarif.js +92 -0
  195. package/dist/cli/formatters/sarif.js.map +1 -0
  196. package/dist/cli/formatters/summary.d.ts +11 -0
  197. package/dist/cli/formatters/summary.d.ts.map +1 -0
  198. package/dist/cli/formatters/summary.js +240 -0
  199. package/dist/cli/formatters/summary.js.map +1 -0
  200. package/dist/cli/formatters/two-phase-summary.d.ts +11 -0
  201. package/dist/cli/formatters/two-phase-summary.d.ts.map +1 -0
  202. package/dist/cli/formatters/two-phase-summary.js +188 -0
  203. package/dist/cli/formatters/two-phase-summary.js.map +1 -0
  204. package/dist/cli/index.d.ts +15 -0
  205. package/dist/cli/index.d.ts.map +1 -0
  206. package/dist/cli/index.js +555 -0
  207. package/dist/cli/index.js.map +1 -0
  208. package/dist/components/clustering.d.ts +60 -0
  209. package/dist/components/clustering.d.ts.map +1 -0
  210. package/dist/components/clustering.js +129 -0
  211. package/dist/components/clustering.js.map +1 -0
  212. package/dist/components/enrichment.d.ts +45 -0
  213. package/dist/components/enrichment.d.ts.map +1 -0
  214. package/dist/components/enrichment.js +193 -0
  215. package/dist/components/enrichment.js.map +1 -0
  216. package/dist/components/index.d.ts +29 -0
  217. package/dist/components/index.d.ts.map +1 -0
  218. package/dist/components/index.js +56 -0
  219. package/dist/components/index.js.map +1 -0
  220. package/dist/dead-code/detector.d.ts +200 -0
  221. package/dist/dead-code/detector.d.ts.map +1 -0
  222. package/dist/dead-code/detector.js +1003 -0
  223. package/dist/dead-code/detector.js.map +1 -0
  224. package/dist/dead-code/index.d.ts +7 -0
  225. package/dist/dead-code/index.d.ts.map +1 -0
  226. package/dist/dead-code/index.js +7 -0
  227. package/dist/dead-code/index.js.map +1 -0
  228. package/dist/extractors/index.d.ts +15 -0
  229. package/dist/extractors/index.d.ts.map +1 -0
  230. package/dist/extractors/index.js +14 -0
  231. package/dist/extractors/index.js.map +1 -0
  232. package/dist/extractors/natural-language.d.ts +46 -0
  233. package/dist/extractors/natural-language.d.ts.map +1 -0
  234. package/dist/extractors/natural-language.js +228 -0
  235. package/dist/extractors/natural-language.js.map +1 -0
  236. package/dist/extractors/tree-sitter.d.ts +33 -0
  237. package/dist/extractors/tree-sitter.d.ts.map +1 -0
  238. package/dist/extractors/tree-sitter.js +69 -0
  239. package/dist/extractors/tree-sitter.js.map +1 -0
  240. package/dist/extractors/types.d.ts +62 -0
  241. package/dist/extractors/types.d.ts.map +1 -0
  242. package/dist/extractors/types.js +54 -0
  243. package/dist/extractors/types.js.map +1 -0
  244. package/dist/health-score/calculator.d.ts +123 -0
  245. package/dist/health-score/calculator.d.ts.map +1 -0
  246. package/dist/health-score/calculator.js +444 -0
  247. package/dist/health-score/calculator.js.map +1 -0
  248. package/dist/health-score/index.d.ts +12 -0
  249. package/dist/health-score/index.d.ts.map +1 -0
  250. package/dist/health-score/index.js +14 -0
  251. package/dist/health-score/index.js.map +1 -0
  252. package/dist/health-score/metrics.d.ts +142 -0
  253. package/dist/health-score/metrics.d.ts.map +1 -0
  254. package/dist/health-score/metrics.js +332 -0
  255. package/dist/health-score/metrics.js.map +1 -0
  256. package/dist/index.d.ts +26 -0
  257. package/dist/index.d.ts.map +1 -0
  258. package/dist/index.js +43 -0
  259. package/dist/index.js.map +1 -0
  260. package/dist/llm/ax-client.d.ts +477 -0
  261. package/dist/llm/ax-client.d.ts.map +1 -0
  262. package/dist/llm/ax-client.js +1641 -0
  263. package/dist/llm/ax-client.js.map +1 -0
  264. package/dist/llm/config.d.ts +58 -0
  265. package/dist/llm/config.d.ts.map +1 -0
  266. package/dist/llm/config.js +97 -0
  267. package/dist/llm/config.js.map +1 -0
  268. package/dist/llm/discovery.d.ts +123 -0
  269. package/dist/llm/discovery.d.ts.map +1 -0
  270. package/dist/llm/discovery.js +505 -0
  271. package/dist/llm/discovery.js.map +1 -0
  272. package/dist/llm/enrichment.d.ts +108 -0
  273. package/dist/llm/enrichment.d.ts.map +1 -0
  274. package/dist/llm/enrichment.js +312 -0
  275. package/dist/llm/enrichment.js.map +1 -0
  276. package/dist/llm/index.d.ts +13 -0
  277. package/dist/llm/index.d.ts.map +1 -0
  278. package/dist/llm/index.js +22 -0
  279. package/dist/llm/index.js.map +1 -0
  280. package/dist/llm/language-context.d.ts +64 -0
  281. package/dist/llm/language-context.d.ts.map +1 -0
  282. package/dist/llm/language-context.js +492 -0
  283. package/dist/llm/language-context.js.map +1 -0
  284. package/dist/llm/pattern-verification.d.ts +39 -0
  285. package/dist/llm/pattern-verification.d.ts.map +1 -0
  286. package/dist/llm/pattern-verification.js +127 -0
  287. package/dist/llm/pattern-verification.js.map +1 -0
  288. package/dist/llm/prompt-security.d.ts +120 -0
  289. package/dist/llm/prompt-security.d.ts.map +1 -0
  290. package/dist/llm/prompt-security.js +301 -0
  291. package/dist/llm/prompt-security.js.map +1 -0
  292. package/dist/llm/prompts/index.d.ts +31 -0
  293. package/dist/llm/prompts/index.d.ts.map +1 -0
  294. package/dist/llm/prompts/index.js +92 -0
  295. package/dist/llm/prompts/index.js.map +1 -0
  296. package/dist/llm/prompts/rust.d.ts +30 -0
  297. package/dist/llm/prompts/rust.d.ts.map +1 -0
  298. package/dist/llm/prompts/rust.js +121 -0
  299. package/dist/llm/prompts/rust.js.map +1 -0
  300. package/dist/llm/schemas.d.ts +892 -0
  301. package/dist/llm/schemas.d.ts.map +1 -0
  302. package/dist/llm/schemas.js +258 -0
  303. package/dist/llm/schemas.js.map +1 -0
  304. package/dist/llm/verification.d.ts +127 -0
  305. package/dist/llm/verification.d.ts.map +1 -0
  306. package/dist/llm/verification.js +394 -0
  307. package/dist/llm/verification.js.map +1 -0
  308. package/dist/project/analyzer.d.ts +30 -0
  309. package/dist/project/analyzer.d.ts.map +1 -0
  310. package/dist/project/analyzer.js +358 -0
  311. package/dist/project/analyzer.js.map +1 -0
  312. package/dist/project/call-graph.d.ts +22 -0
  313. package/dist/project/call-graph.d.ts.map +1 -0
  314. package/dist/project/call-graph.js +246 -0
  315. package/dist/project/call-graph.js.map +1 -0
  316. package/dist/project/index.d.ts +18 -0
  317. package/dist/project/index.d.ts.map +1 -0
  318. package/dist/project/index.js +20 -0
  319. package/dist/project/index.js.map +1 -0
  320. package/dist/project/taint-paths.d.ts +22 -0
  321. package/dist/project/taint-paths.d.ts.map +1 -0
  322. package/dist/project/taint-paths.js +265 -0
  323. package/dist/project/taint-paths.js.map +1 -0
  324. package/dist/project/two-phase-analyzer.d.ts +143 -0
  325. package/dist/project/two-phase-analyzer.d.ts.map +1 -0
  326. package/dist/project/two-phase-analyzer.js +646 -0
  327. package/dist/project/two-phase-analyzer.js.map +1 -0
  328. package/dist/project/type-hierarchy.d.ts +28 -0
  329. package/dist/project/type-hierarchy.d.ts.map +1 -0
  330. package/dist/project/type-hierarchy.js +218 -0
  331. package/dist/project/type-hierarchy.js.map +1 -0
  332. package/dist/secret-scan/index.d.ts +12 -0
  333. package/dist/secret-scan/index.d.ts.map +1 -0
  334. package/dist/secret-scan/index.js +14 -0
  335. package/dist/secret-scan/index.js.map +1 -0
  336. package/dist/secret-scan/patterns.d.ts +38 -0
  337. package/dist/secret-scan/patterns.d.ts.map +1 -0
  338. package/dist/secret-scan/patterns.js +473 -0
  339. package/dist/secret-scan/patterns.js.map +1 -0
  340. package/dist/secret-scan/scanner.d.ts +162 -0
  341. package/dist/secret-scan/scanner.d.ts.map +1 -0
  342. package/dist/secret-scan/scanner.js +511 -0
  343. package/dist/secret-scan/scanner.js.map +1 -0
  344. package/dist/security-scan/index.d.ts +12 -0
  345. package/dist/security-scan/index.d.ts.map +1 -0
  346. package/dist/security-scan/index.js +15 -0
  347. package/dist/security-scan/index.js.map +1 -0
  348. package/dist/security-scan/owasp-mapping.d.ts +29 -0
  349. package/dist/security-scan/owasp-mapping.d.ts.map +1 -0
  350. package/dist/security-scan/owasp-mapping.js +246 -0
  351. package/dist/security-scan/owasp-mapping.js.map +1 -0
  352. package/dist/security-scan/scanner.d.ts +204 -0
  353. package/dist/security-scan/scanner.d.ts.map +1 -0
  354. package/dist/security-scan/scanner.js +693 -0
  355. package/dist/security-scan/scanner.js.map +1 -0
  356. package/dist/security-scan/trend-tracker.d.ts +150 -0
  357. package/dist/security-scan/trend-tracker.d.ts.map +1 -0
  358. package/dist/security-scan/trend-tracker.js +299 -0
  359. package/dist/security-scan/trend-tracker.js.map +1 -0
  360. package/dist/skills/bundle-loader.d.ts +26 -0
  361. package/dist/skills/bundle-loader.d.ts.map +1 -0
  362. package/dist/skills/bundle-loader.js +284 -0
  363. package/dist/skills/bundle-loader.js.map +1 -0
  364. package/dist/skills/capability-mismatch.d.ts +21 -0
  365. package/dist/skills/capability-mismatch.d.ts.map +1 -0
  366. package/dist/skills/capability-mismatch.js +188 -0
  367. package/dist/skills/capability-mismatch.js.map +1 -0
  368. package/dist/skills/index.d.ts +10 -0
  369. package/dist/skills/index.d.ts.map +1 -0
  370. package/dist/skills/index.js +9 -0
  371. package/dist/skills/index.js.map +1 -0
  372. package/dist/skills/skill-analyzer.d.ts +16 -0
  373. package/dist/skills/skill-analyzer.d.ts.map +1 -0
  374. package/dist/skills/skill-analyzer.js +361 -0
  375. package/dist/skills/skill-analyzer.js.map +1 -0
  376. package/dist/skills/types.d.ts +195 -0
  377. package/dist/skills/types.d.ts.map +1 -0
  378. package/dist/skills/types.js +7 -0
  379. package/dist/skills/types.js.map +1 -0
  380. package/dist/specifica/conflict-resolver.d.ts +23 -0
  381. package/dist/specifica/conflict-resolver.d.ts.map +1 -0
  382. package/dist/specifica/conflict-resolver.js +129 -0
  383. package/dist/specifica/conflict-resolver.js.map +1 -0
  384. package/dist/specifica/evidence-aggregator.d.ts +33 -0
  385. package/dist/specifica/evidence-aggregator.d.ts.map +1 -0
  386. package/dist/specifica/evidence-aggregator.js +236 -0
  387. package/dist/specifica/evidence-aggregator.js.map +1 -0
  388. package/dist/specifica/evidence-extractor.d.ts +13 -0
  389. package/dist/specifica/evidence-extractor.d.ts.map +1 -0
  390. package/dist/specifica/evidence-extractor.js +431 -0
  391. package/dist/specifica/evidence-extractor.js.map +1 -0
  392. package/dist/specifica/feature-clustering.d.ts +19 -0
  393. package/dist/specifica/feature-clustering.d.ts.map +1 -0
  394. package/dist/specifica/feature-clustering.js +231 -0
  395. package/dist/specifica/feature-clustering.js.map +1 -0
  396. package/dist/specifica/generator.d.ts +16 -0
  397. package/dist/specifica/generator.d.ts.map +1 -0
  398. package/dist/specifica/generator.js +277 -0
  399. package/dist/specifica/generator.js.map +1 -0
  400. package/dist/specifica/index.d.ts +15 -0
  401. package/dist/specifica/index.d.ts.map +1 -0
  402. package/dist/specifica/index.js +18 -0
  403. package/dist/specifica/index.js.map +1 -0
  404. package/dist/specifica/prompts.d.ts +21 -0
  405. package/dist/specifica/prompts.d.ts.map +1 -0
  406. package/dist/specifica/prompts.js +196 -0
  407. package/dist/specifica/prompts.js.map +1 -0
  408. package/dist/specifica/spec-generator.d.ts +22 -0
  409. package/dist/specifica/spec-generator.d.ts.map +1 -0
  410. package/dist/specifica/spec-generator.js +229 -0
  411. package/dist/specifica/spec-generator.js.map +1 -0
  412. package/dist/specifica/types.d.ts +213 -0
  413. package/dist/specifica/types.d.ts.map +1 -0
  414. package/dist/specifica/types.js +7 -0
  415. package/dist/specifica/types.js.map +1 -0
  416. package/dist/utils/logger.d.ts +17 -0
  417. package/dist/utils/logger.d.ts.map +1 -0
  418. package/dist/utils/logger.js +51 -0
  419. package/dist/utils/logger.js.map +1 -0
  420. package/package.json +99 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Component Feature Clustering & Flow Analysis
3
+ *
4
+ * Phase 2: Cross-file analysis (holistic)
5
+ * Groups components into features and understands cross-component flows
6
+ */
7
+ import type { EnrichedComponent } from './enrichment.js';
8
+ export interface FeatureCluster {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ components: string[];
13
+ architectural_pattern: string;
14
+ entry_points: string[];
15
+ data_entities: string[];
16
+ business_value: string;
17
+ integration_points: string[];
18
+ }
19
+ export interface ComponentFlow {
20
+ id: string;
21
+ name: string;
22
+ type: 'use_case' | 'data_flow' | 'integration';
23
+ description: string;
24
+ steps: Array<{
25
+ step: number;
26
+ component_id: string;
27
+ action: string;
28
+ data: string;
29
+ }>;
30
+ components_involved: string[];
31
+ data_flow: string;
32
+ security_critical: boolean;
33
+ }
34
+ export interface ArchitectureInsights {
35
+ pattern: string;
36
+ layers: Array<{
37
+ name: string;
38
+ components: string[];
39
+ }>;
40
+ design_patterns: string[];
41
+ insights: {
42
+ strengths: string[];
43
+ weaknesses: string[];
44
+ recommendations: string[];
45
+ };
46
+ }
47
+ export interface ClusteringResult {
48
+ features: FeatureCluster[];
49
+ flows: ComponentFlow[];
50
+ architecture: ArchitectureInsights;
51
+ }
52
+ /**
53
+ * Cluster components into features and analyze flows
54
+ */
55
+ export declare function clusterComponents(components: EnrichedComponent[], staticFlows?: Array<{
56
+ from: string;
57
+ to: string;
58
+ type: string;
59
+ }>): Promise<ClusteringResult>;
60
+ //# sourceMappingURL=clustering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clustering.d.ts","sourceRoot":"","sources":["../../src/components/clustering.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MA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 * Component Feature Clustering & Flow Analysis
3
+ *
4
+ * Phase 2: Cross-file analysis (holistic)
5
+ * Groups components into features and understands cross-component flows
6
+ */
7
+ import { getAxLLMClient } from '../llm/ax-client.js';
8
+ /**
9
+ * Cluster components into features and analyze flows
10
+ */
11
+ export async function clusterComponents(components, staticFlows) {
12
+ const client = getAxLLMClient();
13
+ // Option A: Compact component summary (55% token reduction)
14
+ const componentSummary = components.map(c => ({
15
+ id: c.id,
16
+ name: c.name,
17
+ role: c.semantic.architectural_role,
18
+ category: c.semantic.feature_category,
19
+ endpoints: c.endpoints?.slice(0, 3).map(e => `${e.method} ${e.path}`),
20
+ }));
21
+ // Option B: Simplified prompt and output (67% output token reduction)
22
+ const systemPrompt = 'You are a software architecture expert. Cluster components into features. Respond only in valid JSON format.';
23
+ const prompt = `Cluster these ${components.length} components into features (related component groups):
24
+
25
+ ${JSON.stringify(componentSummary)}
26
+
27
+ Output:
28
+ {
29
+ "features": [
30
+ {
31
+ "id": "feature-1",
32
+ "name": "Feature Name",
33
+ "description": "What it does",
34
+ "components": ["component-1", "component-2"],
35
+ "architectural_pattern": "Pattern",
36
+ "entry_points": ["Endpoints"],
37
+ "data_entities": ["Entities"],
38
+ "business_value": "Value",
39
+ "integration_points": ["Integrations"]
40
+ }
41
+ ],
42
+ "flows": [],
43
+ "architecture": {
44
+ "pattern": "Architecture Pattern",
45
+ "layers": [{"name": "Layer", "components": ["ids"]}],
46
+ "design_patterns": ["Patterns"],
47
+ "insights": {"strengths": [], "weaknesses": [], "recommendations": []}
48
+ }
49
+ }`;
50
+ try {
51
+ // Use componentEnrichment phase (with 60s timeout, 0 retries)
52
+ const result = await client.chatJSON(systemPrompt, prompt, 'componentEnrichment');
53
+ if (!result) {
54
+ throw new Error('Empty response from LLM');
55
+ }
56
+ return result;
57
+ }
58
+ catch (error) {
59
+ console.error('Component clustering failed:', error);
60
+ // Fallback to static clustering
61
+ return fallbackClustering(components);
62
+ }
63
+ }
64
+ /**
65
+ * Fallback clustering based on feature categories from Phase 1
66
+ */
67
+ function fallbackClustering(components) {
68
+ // Group by feature_category from Phase 1 enrichment
69
+ const featureMap = new Map();
70
+ for (const component of components) {
71
+ const category = component.semantic.feature_category;
72
+ if (!featureMap.has(category)) {
73
+ featureMap.set(category, []);
74
+ }
75
+ featureMap.get(category).push(component);
76
+ }
77
+ const features = [];
78
+ let featureId = 0;
79
+ for (const [category, comps] of featureMap.entries()) {
80
+ // Extract entry points (endpoints from controllers)
81
+ const entryPoints = comps
82
+ .filter(c => c.endpoints && c.endpoints.length > 0)
83
+ .flatMap(c => c.endpoints.map(e => `${e.method} ${e.path}`));
84
+ // Extract data entities
85
+ const dataEntities = [...new Set(comps.flatMap(c => c.semantic.business_entities))];
86
+ // Extract integration points
87
+ const integrationPoints = [...new Set(comps.flatMap(c => c.semantic.integration_points))];
88
+ features.push({
89
+ id: `feature-${featureId++}`,
90
+ name: category,
91
+ description: `Feature cluster: ${category}`,
92
+ components: comps.map(c => c.id),
93
+ architectural_pattern: 'Layered Architecture',
94
+ entry_points: entryPoints,
95
+ data_entities: dataEntities,
96
+ business_value: `Provides ${category} capabilities`,
97
+ integration_points: integrationPoints,
98
+ });
99
+ }
100
+ // Detect architectural layers
101
+ const presentationLayer = components
102
+ .filter(c => c.semantic.architectural_role === 'presentation_layer')
103
+ .map(c => c.id);
104
+ const businessLogicLayer = components
105
+ .filter(c => c.semantic.architectural_role === 'business_logic')
106
+ .map(c => c.id);
107
+ const dataAccessLayer = components
108
+ .filter(c => c.semantic.architectural_role === 'data_access')
109
+ .map(c => c.id);
110
+ return {
111
+ features,
112
+ flows: [], // No flows in fallback mode
113
+ architecture: {
114
+ pattern: 'Layered Architecture',
115
+ layers: [
116
+ { name: 'Presentation Layer', components: presentationLayer },
117
+ { name: 'Business Logic Layer', components: businessLogicLayer },
118
+ { name: 'Data Access Layer', components: dataAccessLayer },
119
+ ],
120
+ design_patterns: ['MVC', 'Layered'],
121
+ insights: {
122
+ strengths: ['Modular design'],
123
+ weaknesses: [],
124
+ recommendations: ['Enable LLM clustering for detailed insights'],
125
+ },
126
+ },
127
+ };
128
+ }
129
+ //# sourceMappingURL=clustering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clustering.js","sourceRoot":"","sources":["../../src/components/clustering.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAmDrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAA+B,EAC/B,WAA+D;IAE/D,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAEhC,4DAA4D;IAC5D,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB;QACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB;QACrC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;KACtE,CAAC,CAAC,CAAC;IAEJ,sEAAsE;IACtE,MAAM,YAAY,GAAG,8GAA8G,CAAC;IACpI,MAAM,MAAM,GAAG,iBAAiB,UAAU,CAAC,MAAM;;EAEjD,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;EAwBhC,CAAC;IAED,IAAI,CAAC;QACH,8DAA8D;QAC9D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAmB,YAAY,EAAE,MAAM,EAAE,qBAAqB,CAAC,CAAC;QAEpG,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MA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CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,KAAK,aAAa,CAAC;SAC5D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAElB,OAAO;QACL,QAAQ;QACR,KAAK,EAAE,EAAE,EAAE,4BAA4B;QACvC,YAAY,EAAE;YACZ,OAAO,EAAE,sBAAsB;YAC/B,MAAM,EAAE;gBACN,EAAE,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,iBAAiB,EAAE;gBAC7D,EAAE,IAAI,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB,EAAE;gBAChE,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAE,eAAe,EAAE;aAC3D;YACD,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC;YACnC,QAAQ,EAAE;gBACR,SAAS,EAAE,CAAC,gBAAgB,CAAC;gBAC7B,UAAU,EAAE,EAAE;gBACd,eAAe,EAAE,CAAC,6CAA6C,CAAC;aACjE;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Component Semantic Enrichment
3
+ *
4
+ * Phase 1: Per-file semantic enrichment (parallel)
5
+ * Adds business context to statically extracted components
6
+ */
7
+ export interface Component {
8
+ id: string;
9
+ type: 'controller' | 'service' | 'repository' | 'model' | 'utility' | 'endpoint' | 'dependency';
10
+ name: string;
11
+ file: string;
12
+ line_start: number;
13
+ line_end: number;
14
+ methods: string[];
15
+ annotations?: string[];
16
+ endpoints?: Array<{
17
+ path: string;
18
+ method: string;
19
+ }>;
20
+ }
21
+ export interface SemanticEnrichment {
22
+ business_purpose: string;
23
+ responsibilities: string[];
24
+ architectural_role: 'presentation_layer' | 'business_logic' | 'data_access' | 'integration' | 'utility';
25
+ feature_category: string;
26
+ security_concerns: string[];
27
+ integration_points: string[];
28
+ business_entities: string[];
29
+ }
30
+ export interface EnrichedComponent extends Component {
31
+ semantic: SemanticEnrichment;
32
+ }
33
+ /**
34
+ * Enrich a single component with semantic understanding
35
+ */
36
+ export declare function enrichComponent(component: Component, codeSnippet?: string): Promise<EnrichedComponent>;
37
+ /**
38
+ * Enrich multiple components in parallel (original implementation - no batching)
39
+ */
40
+ export declare function enrichComponents(components: Component[], options?: {
41
+ maxConcurrency?: number;
42
+ includeCode?: boolean;
43
+ onComponentComplete?: (component: EnrichedComponent, index: number, total: number) => void;
44
+ }): Promise<EnrichedComponent[]>;
45
+ //# sourceMappingURL=enrichment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrichment.d.ts","sourceRoot":"","sources":["../../src/components/enrichment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,kBAAkB,EAAE,oBAAoB,GAAG,gBAAgB,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;IACxG,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAkE5B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,GAAE;IACP,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvF,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA0B9B"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Component Semantic Enrichment
3
+ *
4
+ * Phase 1: Per-file semantic enrichment (parallel)
5
+ * Adds business context to statically extracted components
6
+ */
7
+ import { getAxLLMClient } from '../llm/ax-client.js';
8
+ /**
9
+ * Enrich a single component with semantic understanding
10
+ */
11
+ export async function enrichComponent(component, codeSnippet) {
12
+ // Option 3: Skip LLM for components with obvious roles
13
+ const obviousCheck = hasObviousRole(component);
14
+ if (obviousCheck.hasObvious) {
15
+ return {
16
+ ...component,
17
+ semantic: {
18
+ business_purpose: `${component.type} component for ${obviousCheck.category}`,
19
+ responsibilities: component.methods.slice(0, 5).map(m => `Handles ${m}`),
20
+ architectural_role: obviousCheck.role,
21
+ feature_category: obviousCheck.category,
22
+ security_concerns: [],
23
+ integration_points: [],
24
+ business_entities: [],
25
+ },
26
+ };
27
+ }
28
+ const client = getAxLLMClient();
29
+ // Option D: Compact prompt (50% token reduction)
30
+ const systemPrompt = 'Analyze component semantics. Return valid JSON only.';
31
+ const prompt = `Component: ${component.name} (${component.type})
32
+ Methods: ${component.methods.slice(0, 5).join(', ')}${component.methods.length > 5 ? '...' : ''}
33
+ ${component.endpoints ? `Endpoints: ${component.endpoints.slice(0, 3).map(e => `${e.method} ${e.path}`).join(', ')}` : ''}
34
+
35
+ Return JSON:
36
+ {
37
+ "business_purpose": "1 sentence",
38
+ "responsibilities": ["3-5 items"],
39
+ "architectural_role": "presentation_layer|business_logic|data_access|integration|utility",
40
+ "feature_category": "Category name",
41
+ "security_concerns": ["concerns"],
42
+ "integration_points": ["systems"],
43
+ "business_entities": ["entities"]
44
+ }`;
45
+ try {
46
+ // Use componentEnrichment phase (with 60s timeout, 0 retries)
47
+ const semantic = await client.chatJSON(systemPrompt, prompt, 'componentEnrichment');
48
+ if (!semantic) {
49
+ throw new Error('Empty response from LLM');
50
+ }
51
+ return {
52
+ ...component,
53
+ semantic,
54
+ };
55
+ }
56
+ catch (error) {
57
+ console.warn(`Failed to enrich component ${component.name}:`, error);
58
+ // Fallback to basic enrichment based on static analysis
59
+ return {
60
+ ...component,
61
+ semantic: {
62
+ business_purpose: `${component.type} component: ${component.name}`,
63
+ responsibilities: component.methods.map(m => `Provides ${m} functionality`),
64
+ architectural_role: inferArchitecturalRole(component.type),
65
+ feature_category: inferFeatureCategory(component.name, component.file),
66
+ security_concerns: [],
67
+ integration_points: [],
68
+ business_entities: [],
69
+ },
70
+ };
71
+ }
72
+ }
73
+ /**
74
+ * Enrich multiple components in parallel (original implementation - no batching)
75
+ */
76
+ export async function enrichComponents(components, options = {}) {
77
+ const { maxConcurrency = 10, onComponentComplete } = options;
78
+ const enriched = [];
79
+ const batches = [];
80
+ // Create batches for parallel processing (simple concurrency control)
81
+ for (let i = 0; i < components.length; i += maxConcurrency) {
82
+ batches.push(components.slice(i, i + maxConcurrency));
83
+ }
84
+ let completed = 0;
85
+ for (const batch of batches) {
86
+ const batchResults = await Promise.all(batch.map(component => enrichComponent(component)));
87
+ for (const result of batchResults) {
88
+ enriched.push(result);
89
+ completed++;
90
+ if (onComponentComplete) {
91
+ onComponentComplete(result, completed, components.length);
92
+ }
93
+ }
94
+ }
95
+ return enriched;
96
+ }
97
+ /**
98
+ * Infer architectural role from component type (fallback)
99
+ */
100
+ function inferArchitecturalRole(type) {
101
+ switch (type) {
102
+ case 'controller':
103
+ case 'endpoint':
104
+ return 'presentation_layer';
105
+ case 'service':
106
+ return 'business_logic';
107
+ case 'repository':
108
+ return 'data_access';
109
+ case 'utility':
110
+ return 'utility';
111
+ case 'dependency':
112
+ return 'integration';
113
+ default:
114
+ return 'business_logic';
115
+ }
116
+ }
117
+ /**
118
+ * Infer feature category from name/path (fallback)
119
+ */
120
+ function inferFeatureCategory(name, file) {
121
+ const nameLower = name.toLowerCase();
122
+ const fileLower = file.toLowerCase();
123
+ if (nameLower.includes('auth') || nameLower.includes('login') || fileLower.includes('auth')) {
124
+ return 'Authentication';
125
+ }
126
+ if (nameLower.includes('user') || fileLower.includes('user')) {
127
+ return 'User Management';
128
+ }
129
+ if (nameLower.includes('order') || fileLower.includes('order')) {
130
+ return 'Order Management';
131
+ }
132
+ if (nameLower.includes('payment') || fileLower.includes('payment')) {
133
+ return 'Payment Processing';
134
+ }
135
+ if (nameLower.includes('product') || fileLower.includes('product')) {
136
+ return 'Product Catalog';
137
+ }
138
+ // Extract from file path
139
+ const pathParts = file.split('/');
140
+ if (pathParts.length > 1) {
141
+ const folder = pathParts[pathParts.length - 2];
142
+ return folder.charAt(0).toUpperCase() + folder.slice(1);
143
+ }
144
+ return 'General';
145
+ }
146
+ /**
147
+ * Check if component has obvious role from annotations (Option 3 optimization)
148
+ */
149
+ function hasObviousRole(component) {
150
+ const annotations = component.annotations || [];
151
+ const nameLower = component.name.toLowerCase();
152
+ // Controller patterns
153
+ if (annotations.some(a => a.includes('Controller') ||
154
+ a.includes('RestController') ||
155
+ a.includes('Resource') ||
156
+ a.includes('@RequestMapping'))) {
157
+ return {
158
+ hasObvious: true,
159
+ role: 'presentation_layer',
160
+ category: inferFeatureCategory(component.name, component.file),
161
+ };
162
+ }
163
+ // Repository/DAO patterns
164
+ if (annotations.some(a => a.includes('Repository') ||
165
+ a.includes('Dao') ||
166
+ a.includes('@Entity') ||
167
+ a.includes('@Table')) || nameLower.includes('repository') || nameLower.includes('dao')) {
168
+ return {
169
+ hasObvious: true,
170
+ role: 'data_access',
171
+ category: inferFeatureCategory(component.name, component.file),
172
+ };
173
+ }
174
+ // Service patterns
175
+ if (annotations.some(a => a.includes('Service') ||
176
+ a.includes('@Transactional')) || (nameLower.includes('service') && component.type === 'service')) {
177
+ return {
178
+ hasObvious: true,
179
+ role: 'business_logic',
180
+ category: inferFeatureCategory(component.name, component.file),
181
+ };
182
+ }
183
+ // Utility patterns
184
+ if (component.type === 'utility' || nameLower.includes('util') || nameLower.includes('helper')) {
185
+ return {
186
+ hasObvious: true,
187
+ role: 'utility',
188
+ category: 'Utilities',
189
+ };
190
+ }
191
+ return { hasObvious: false };
192
+ }
193
+ //# sourceMappingURL=enrichment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrichment.js","sourceRoot":"","sources":["../../src/components/enrichment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4BrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,SAAoB,EACpB,WAAoB;IAEpB,uDAAuD;IACvD,MAAM,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,OAAO;YACL,GAAG,SAAS;YACZ,QAAQ,EAAE;gBACR,gBAAgB,EAAE,GAAG,SAAS,CAAC,IAAI,kBAAkB,YAAY,CAAC,QAAQ,EAAE;gBAC5E,gBAAgB,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;gBACxE,kBAAkB,EAAE,YAAY,CAAC,IAAK;g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,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,WAAW;SACtB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Component Analysis Module
3
+ *
4
+ * Two-phase component enrichment:
5
+ * - Phase 1: Per-file semantic enrichment (parallel)
6
+ * - Phase 2: Cross-file clustering and flow analysis (holistic)
7
+ */
8
+ export { enrichComponent, enrichComponents } from './enrichment.js';
9
+ export { clusterComponents } from './clustering.js';
10
+ export type { Component, SemanticEnrichment, EnrichedComponent, } from './enrichment.js';
11
+ export type { FeatureCluster, ComponentFlow, ArchitectureInsights, ClusteringResult, } from './clustering.js';
12
+ import type { Component, EnrichedComponent } from './enrichment.js';
13
+ import type { ClusteringResult } from './clustering.js';
14
+ export interface ComponentAnalysisOptions {
15
+ enablePhase1?: boolean;
16
+ enablePhase2?: boolean;
17
+ maxConcurrency?: number;
18
+ onPhase1Progress?: (component: EnrichedComponent, index: number, total: number) => void;
19
+ onPhase2Start?: () => void;
20
+ }
21
+ export interface ComponentAnalysisResult {
22
+ components: EnrichedComponent[];
23
+ clustering?: ClusteringResult;
24
+ }
25
+ /**
26
+ * Complete two-phase component analysis
27
+ */
28
+ export declare function analyzeComponents(components: Component[], options?: ComponentAnalysisOptions): Promise<ComponentAnalysisResult>;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxF,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,SAAS,EAAE,EACvB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,uBAAuB,CAAC,CAiDlC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Component Analysis Module
3
+ *
4
+ * Two-phase component enrichment:
5
+ * - Phase 1: Per-file semantic enrichment (parallel)
6
+ * - Phase 2: Cross-file clustering and flow analysis (holistic)
7
+ */
8
+ export { enrichComponent, enrichComponents } from './enrichment.js';
9
+ export { clusterComponents } from './clustering.js';
10
+ import { enrichComponents } from './enrichment.js';
11
+ import { clusterComponents } from './clustering.js';
12
+ /**
13
+ * Complete two-phase component analysis
14
+ */
15
+ export async function analyzeComponents(components, options = {}) {
16
+ const { enablePhase1 = true, enablePhase2 = true, maxConcurrency = 10, onPhase1Progress, onPhase2Start, } = options;
17
+ let enriched;
18
+ // Phase 1: Semantic enrichment (parallel)
19
+ if (enablePhase1) {
20
+ console.log(`Phase 1: Enriching ${components.length} components...`);
21
+ enriched = await enrichComponents(components, {
22
+ maxConcurrency,
23
+ onComponentComplete: onPhase1Progress,
24
+ });
25
+ console.log(`Phase 1: Complete (${enriched.length} components enriched)`);
26
+ }
27
+ else {
28
+ // Cast to EnrichedComponent with empty semantic data
29
+ enriched = components.map(c => ({
30
+ ...c,
31
+ semantic: {
32
+ business_purpose: '',
33
+ responsibilities: [],
34
+ architectural_role: 'business_logic',
35
+ feature_category: 'General',
36
+ security_concerns: [],
37
+ integration_points: [],
38
+ business_entities: [],
39
+ },
40
+ }));
41
+ }
42
+ // Phase 2: Clustering and flow analysis (holistic)
43
+ let clustering;
44
+ if (enablePhase2) {
45
+ if (onPhase2Start)
46
+ onPhase2Start();
47
+ console.log('Phase 2: Clustering components and analyzing flows...');
48
+ clustering = await clusterComponents(enriched);
49
+ console.log(`Phase 2: Complete (${clustering.features.length} features, ${clustering.flows.length} flows)`);
50
+ }
51
+ return {
52
+ components: enriched,
53
+ clustering,
54
+ };
55
+ }
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAiBpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAepD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAuB,EACvB,UAAoC,EAAE;IAEtC,MAAM,EACJ,YAAY,GAAG,IAAI,EACnB,YAAY,GAAG,IAAI,EACnB,cAAc,GAAG,EAAE,EACnB,gBAAgB,EAChB,aAAa,GACd,GAAG,OAAO,CAAC;IAEZ,IAAI,QAA6B,CAAC;IAElC,0CAA0C;IAC1C,IAAI,YAAY,EAAE,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