erosolar-cli 1.7.438 → 1.7.439

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 (1017) hide show
  1. package/package.json +2 -1
  2. package/dist/StringUtils.d.ts +0 -8
  3. package/dist/StringUtils.d.ts.map +0 -1
  4. package/dist/StringUtils.js +0 -11
  5. package/dist/StringUtils.js.map +0 -1
  6. package/dist/adapters/browser/index.d.ts +0 -12
  7. package/dist/adapters/browser/index.d.ts.map +0 -1
  8. package/dist/adapters/browser/index.js +0 -11
  9. package/dist/adapters/browser/index.js.map +0 -1
  10. package/dist/adapters/node/index.d.ts +0 -17
  11. package/dist/adapters/node/index.d.ts.map +0 -1
  12. package/dist/adapters/node/index.js +0 -35
  13. package/dist/adapters/node/index.js.map +0 -1
  14. package/dist/adapters/remote/index.d.ts +0 -13
  15. package/dist/adapters/remote/index.d.ts.map +0 -1
  16. package/dist/adapters/remote/index.js +0 -20
  17. package/dist/adapters/remote/index.js.map +0 -1
  18. package/dist/adapters/types.d.ts +0 -14
  19. package/dist/adapters/types.d.ts.map +0 -1
  20. package/dist/adapters/types.js +0 -2
  21. package/dist/adapters/types.js.map +0 -1
  22. package/dist/bin/erosolar.d.ts +0 -9
  23. package/dist/bin/erosolar.d.ts.map +0 -1
  24. package/dist/bin/erosolar.js +0 -93
  25. package/dist/bin/erosolar.js.map +0 -1
  26. package/dist/bin/selfTest.d.ts +0 -14
  27. package/dist/bin/selfTest.d.ts.map +0 -1
  28. package/dist/bin/selfTest.js +0 -304
  29. package/dist/bin/selfTest.js.map +0 -1
  30. package/dist/browser/BrowserSessionManager.d.ts +0 -307
  31. package/dist/browser/BrowserSessionManager.d.ts.map +0 -1
  32. package/dist/browser/BrowserSessionManager.js +0 -713
  33. package/dist/browser/BrowserSessionManager.js.map +0 -1
  34. package/dist/capabilities/advancedTestGenerationCapability.d.ts +0 -17
  35. package/dist/capabilities/advancedTestGenerationCapability.d.ts.map +0 -1
  36. package/dist/capabilities/advancedTestGenerationCapability.js +0 -28
  37. package/dist/capabilities/advancedTestGenerationCapability.js.map +0 -1
  38. package/dist/capabilities/agentSpawningCapability.d.ts +0 -6
  39. package/dist/capabilities/agentSpawningCapability.d.ts.map +0 -1
  40. package/dist/capabilities/agentSpawningCapability.js +0 -168
  41. package/dist/capabilities/agentSpawningCapability.js.map +0 -1
  42. package/dist/capabilities/askUserCapability.d.ts +0 -21
  43. package/dist/capabilities/askUserCapability.d.ts.map +0 -1
  44. package/dist/capabilities/askUserCapability.js +0 -155
  45. package/dist/capabilities/askUserCapability.js.map +0 -1
  46. package/dist/capabilities/bashCapability.d.ts +0 -13
  47. package/dist/capabilities/bashCapability.d.ts.map +0 -1
  48. package/dist/capabilities/bashCapability.js +0 -24
  49. package/dist/capabilities/bashCapability.js.map +0 -1
  50. package/dist/capabilities/browserAutomationCapability.d.ts +0 -37
  51. package/dist/capabilities/browserAutomationCapability.d.ts.map +0 -1
  52. package/dist/capabilities/browserAutomationCapability.js +0 -49
  53. package/dist/capabilities/browserAutomationCapability.js.map +0 -1
  54. package/dist/capabilities/buildCapability.d.ts +0 -24
  55. package/dist/capabilities/buildCapability.d.ts.map +0 -1
  56. package/dist/capabilities/buildCapability.js +0 -25
  57. package/dist/capabilities/buildCapability.js.map +0 -1
  58. package/dist/capabilities/cloudCapability.d.ts +0 -13
  59. package/dist/capabilities/cloudCapability.d.ts.map +0 -1
  60. package/dist/capabilities/cloudCapability.js +0 -38
  61. package/dist/capabilities/cloudCapability.js.map +0 -1
  62. package/dist/capabilities/codeAnalysisCapability.d.ts +0 -13
  63. package/dist/capabilities/codeAnalysisCapability.d.ts.map +0 -1
  64. package/dist/capabilities/codeAnalysisCapability.js +0 -24
  65. package/dist/capabilities/codeAnalysisCapability.js.map +0 -1
  66. package/dist/capabilities/codeGenerationCapability.d.ts +0 -13
  67. package/dist/capabilities/codeGenerationCapability.d.ts.map +0 -1
  68. package/dist/capabilities/codeGenerationCapability.js +0 -25
  69. package/dist/capabilities/codeGenerationCapability.js.map +0 -1
  70. package/dist/capabilities/codeQualityCapability.d.ts +0 -13
  71. package/dist/capabilities/codeQualityCapability.d.ts.map +0 -1
  72. package/dist/capabilities/codeQualityCapability.js +0 -25
  73. package/dist/capabilities/codeQualityCapability.js.map +0 -1
  74. package/dist/capabilities/dependencySecurityCapability.d.ts +0 -13
  75. package/dist/capabilities/dependencySecurityCapability.d.ts.map +0 -1
  76. package/dist/capabilities/dependencySecurityCapability.js +0 -24
  77. package/dist/capabilities/dependencySecurityCapability.js.map +0 -1
  78. package/dist/capabilities/devCapability.d.ts +0 -13
  79. package/dist/capabilities/devCapability.d.ts.map +0 -1
  80. package/dist/capabilities/devCapability.js +0 -24
  81. package/dist/capabilities/devCapability.js.map +0 -1
  82. package/dist/capabilities/editCapability.d.ts +0 -17
  83. package/dist/capabilities/editCapability.d.ts.map +0 -1
  84. package/dist/capabilities/editCapability.js +0 -27
  85. package/dist/capabilities/editCapability.js.map +0 -1
  86. package/dist/capabilities/emailCapability.d.ts +0 -12
  87. package/dist/capabilities/emailCapability.d.ts.map +0 -1
  88. package/dist/capabilities/emailCapability.js +0 -22
  89. package/dist/capabilities/emailCapability.js.map +0 -1
  90. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts +0 -17
  91. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts.map +0 -1
  92. package/dist/capabilities/enhancedCodeIntelligenceCapability.js +0 -28
  93. package/dist/capabilities/enhancedCodeIntelligenceCapability.js.map +0 -1
  94. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts +0 -17
  95. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts.map +0 -1
  96. package/dist/capabilities/enhancedDevWorkflowCapability.js +0 -28
  97. package/dist/capabilities/enhancedDevWorkflowCapability.js.map +0 -1
  98. package/dist/capabilities/enhancedGitCapability.d.ts +0 -7
  99. package/dist/capabilities/enhancedGitCapability.d.ts.map +0 -1
  100. package/dist/capabilities/enhancedGitCapability.js +0 -220
  101. package/dist/capabilities/enhancedGitCapability.js.map +0 -1
  102. package/dist/capabilities/filesystemCapability.d.ts +0 -13
  103. package/dist/capabilities/filesystemCapability.d.ts.map +0 -1
  104. package/dist/capabilities/filesystemCapability.js +0 -24
  105. package/dist/capabilities/filesystemCapability.js.map +0 -1
  106. package/dist/capabilities/frontendTestingCapability.d.ts +0 -13
  107. package/dist/capabilities/frontendTestingCapability.d.ts.map +0 -1
  108. package/dist/capabilities/frontendTestingCapability.js +0 -28
  109. package/dist/capabilities/frontendTestingCapability.js.map +0 -1
  110. package/dist/capabilities/globCapability.d.ts +0 -17
  111. package/dist/capabilities/globCapability.d.ts.map +0 -1
  112. package/dist/capabilities/globCapability.js +0 -27
  113. package/dist/capabilities/globCapability.js.map +0 -1
  114. package/dist/capabilities/index.d.ts +0 -26
  115. package/dist/capabilities/index.d.ts.map +0 -1
  116. package/dist/capabilities/index.js +0 -26
  117. package/dist/capabilities/index.js.map +0 -1
  118. package/dist/capabilities/interactionCapability.d.ts +0 -12
  119. package/dist/capabilities/interactionCapability.d.ts.map +0 -1
  120. package/dist/capabilities/interactionCapability.js +0 -22
  121. package/dist/capabilities/interactionCapability.js.map +0 -1
  122. package/dist/capabilities/learnCapability.d.ts +0 -22
  123. package/dist/capabilities/learnCapability.d.ts.map +0 -1
  124. package/dist/capabilities/learnCapability.js +0 -37
  125. package/dist/capabilities/learnCapability.js.map +0 -1
  126. package/dist/capabilities/mcpCapability.d.ts +0 -6
  127. package/dist/capabilities/mcpCapability.d.ts.map +0 -1
  128. package/dist/capabilities/mcpCapability.js +0 -19
  129. package/dist/capabilities/mcpCapability.js.map +0 -1
  130. package/dist/capabilities/notebookCapability.d.ts +0 -17
  131. package/dist/capabilities/notebookCapability.d.ts.map +0 -1
  132. package/dist/capabilities/notebookCapability.js +0 -27
  133. package/dist/capabilities/notebookCapability.js.map +0 -1
  134. package/dist/capabilities/performanceMonitoringCapability.d.ts +0 -108
  135. package/dist/capabilities/performanceMonitoringCapability.d.ts.map +0 -1
  136. package/dist/capabilities/performanceMonitoringCapability.js +0 -176
  137. package/dist/capabilities/performanceMonitoringCapability.js.map +0 -1
  138. package/dist/capabilities/planningCapability.d.ts +0 -16
  139. package/dist/capabilities/planningCapability.d.ts.map +0 -1
  140. package/dist/capabilities/planningCapability.js +0 -26
  141. package/dist/capabilities/planningCapability.js.map +0 -1
  142. package/dist/capabilities/refactoringCapability.d.ts +0 -13
  143. package/dist/capabilities/refactoringCapability.d.ts.map +0 -1
  144. package/dist/capabilities/refactoringCapability.js +0 -25
  145. package/dist/capabilities/refactoringCapability.js.map +0 -1
  146. package/dist/capabilities/repoChecksCapability.d.ts +0 -10
  147. package/dist/capabilities/repoChecksCapability.d.ts.map +0 -1
  148. package/dist/capabilities/repoChecksCapability.js +0 -24
  149. package/dist/capabilities/repoChecksCapability.js.map +0 -1
  150. package/dist/capabilities/searchCapability.d.ts +0 -13
  151. package/dist/capabilities/searchCapability.d.ts.map +0 -1
  152. package/dist/capabilities/searchCapability.js +0 -24
  153. package/dist/capabilities/searchCapability.js.map +0 -1
  154. package/dist/capabilities/skillCapability.d.ts +0 -3
  155. package/dist/capabilities/skillCapability.d.ts.map +0 -1
  156. package/dist/capabilities/skillCapability.js +0 -77
  157. package/dist/capabilities/skillCapability.js.map +0 -1
  158. package/dist/capabilities/statusCapability.d.ts +0 -4
  159. package/dist/capabilities/statusCapability.d.ts.map +0 -1
  160. package/dist/capabilities/statusCapability.js +0 -92
  161. package/dist/capabilities/statusCapability.js.map +0 -1
  162. package/dist/capabilities/taskManagementCapability.d.ts +0 -12
  163. package/dist/capabilities/taskManagementCapability.d.ts.map +0 -1
  164. package/dist/capabilities/taskManagementCapability.js +0 -22
  165. package/dist/capabilities/taskManagementCapability.js.map +0 -1
  166. package/dist/capabilities/testingCapability.d.ts +0 -13
  167. package/dist/capabilities/testingCapability.d.ts.map +0 -1
  168. package/dist/capabilities/testingCapability.js +0 -25
  169. package/dist/capabilities/testingCapability.js.map +0 -1
  170. package/dist/capabilities/todoCapability.d.ts +0 -19
  171. package/dist/capabilities/todoCapability.d.ts.map +0 -1
  172. package/dist/capabilities/todoCapability.js +0 -169
  173. package/dist/capabilities/todoCapability.js.map +0 -1
  174. package/dist/capabilities/toolManifest.d.ts +0 -3
  175. package/dist/capabilities/toolManifest.d.ts.map +0 -1
  176. package/dist/capabilities/toolManifest.js +0 -160
  177. package/dist/capabilities/toolManifest.js.map +0 -1
  178. package/dist/capabilities/toolRegistry.d.ts +0 -24
  179. package/dist/capabilities/toolRegistry.d.ts.map +0 -1
  180. package/dist/capabilities/toolRegistry.js +0 -150
  181. package/dist/capabilities/toolRegistry.js.map +0 -1
  182. package/dist/capabilities/validationCapability.d.ts +0 -13
  183. package/dist/capabilities/validationCapability.d.ts.map +0 -1
  184. package/dist/capabilities/validationCapability.js +0 -24
  185. package/dist/capabilities/validationCapability.js.map +0 -1
  186. package/dist/capabilities/webCapability.d.ts +0 -12
  187. package/dist/capabilities/webCapability.d.ts.map +0 -1
  188. package/dist/capabilities/webCapability.js +0 -22
  189. package/dist/capabilities/webCapability.js.map +0 -1
  190. package/dist/config.d.ts +0 -25
  191. package/dist/config.d.ts.map +0 -1
  192. package/dist/config.js +0 -140
  193. package/dist/config.js.map +0 -1
  194. package/dist/contracts/v1/agent.d.ts +0 -147
  195. package/dist/contracts/v1/agent.d.ts.map +0 -1
  196. package/dist/contracts/v1/agent.js +0 -8
  197. package/dist/contracts/v1/agent.js.map +0 -1
  198. package/dist/contracts/v1/agentProfileManifest.d.ts +0 -60
  199. package/dist/contracts/v1/agentProfileManifest.d.ts.map +0 -1
  200. package/dist/contracts/v1/agentProfileManifest.js +0 -9
  201. package/dist/contracts/v1/agentProfileManifest.js.map +0 -1
  202. package/dist/contracts/v1/agentRules.d.ts +0 -60
  203. package/dist/contracts/v1/agentRules.d.ts.map +0 -1
  204. package/dist/contracts/v1/agentRules.js +0 -10
  205. package/dist/contracts/v1/agentRules.js.map +0 -1
  206. package/dist/contracts/v1/provider.d.ts +0 -149
  207. package/dist/contracts/v1/provider.d.ts.map +0 -1
  208. package/dist/contracts/v1/provider.js +0 -7
  209. package/dist/contracts/v1/provider.js.map +0 -1
  210. package/dist/contracts/v1/tool.d.ts +0 -136
  211. package/dist/contracts/v1/tool.d.ts.map +0 -1
  212. package/dist/contracts/v1/tool.js +0 -7
  213. package/dist/contracts/v1/tool.js.map +0 -1
  214. package/dist/contracts/v1/toolAccess.d.ts +0 -43
  215. package/dist/contracts/v1/toolAccess.d.ts.map +0 -1
  216. package/dist/contracts/v1/toolAccess.js +0 -9
  217. package/dist/contracts/v1/toolAccess.js.map +0 -1
  218. package/dist/core/LazyLoader.d.ts +0 -129
  219. package/dist/core/LazyLoader.d.ts.map +0 -1
  220. package/dist/core/LazyLoader.js +0 -240
  221. package/dist/core/LazyLoader.js.map +0 -1
  222. package/dist/core/agent.d.ts +0 -153
  223. package/dist/core/agent.d.ts.map +0 -1
  224. package/dist/core/agent.js +0 -889
  225. package/dist/core/agent.js.map +0 -1
  226. package/dist/core/agentProfileManifest.d.ts +0 -3
  227. package/dist/core/agentProfileManifest.d.ts.map +0 -1
  228. package/dist/core/agentProfileManifest.js +0 -188
  229. package/dist/core/agentProfileManifest.js.map +0 -1
  230. package/dist/core/agentProfiles.d.ts +0 -22
  231. package/dist/core/agentProfiles.d.ts.map +0 -1
  232. package/dist/core/agentProfiles.js +0 -35
  233. package/dist/core/agentProfiles.js.map +0 -1
  234. package/dist/core/agentRulebook.d.ts +0 -11
  235. package/dist/core/agentRulebook.d.ts.map +0 -1
  236. package/dist/core/agentRulebook.js +0 -136
  237. package/dist/core/agentRulebook.js.map +0 -1
  238. package/dist/core/agentSchemaLoader.d.ts +0 -131
  239. package/dist/core/agentSchemaLoader.d.ts.map +0 -1
  240. package/dist/core/agentSchemaLoader.js +0 -234
  241. package/dist/core/agentSchemaLoader.js.map +0 -1
  242. package/dist/core/aiErrorFixer.d.ts +0 -70
  243. package/dist/core/aiErrorFixer.d.ts.map +0 -1
  244. package/dist/core/aiErrorFixer.js +0 -402
  245. package/dist/core/aiErrorFixer.js.map +0 -1
  246. package/dist/core/alphaZeroEngine.d.ts +0 -269
  247. package/dist/core/alphaZeroEngine.d.ts.map +0 -1
  248. package/dist/core/alphaZeroEngine.js +0 -523
  249. package/dist/core/alphaZeroEngine.js.map +0 -1
  250. package/dist/core/alphaZeroModular.d.ts +0 -186
  251. package/dist/core/alphaZeroModular.d.ts.map +0 -1
  252. package/dist/core/alphaZeroModular.js +0 -755
  253. package/dist/core/alphaZeroModular.js.map +0 -1
  254. package/dist/core/alphaZeroOrchestrator.d.ts +0 -140
  255. package/dist/core/alphaZeroOrchestrator.d.ts.map +0 -1
  256. package/dist/core/alphaZeroOrchestrator.js +0 -418
  257. package/dist/core/alphaZeroOrchestrator.js.map +0 -1
  258. package/dist/core/bashCommandGuidance.d.ts +0 -16
  259. package/dist/core/bashCommandGuidance.d.ts.map +0 -1
  260. package/dist/core/bashCommandGuidance.js +0 -40
  261. package/dist/core/bashCommandGuidance.js.map +0 -1
  262. package/dist/core/checkpoint.d.ts +0 -76
  263. package/dist/core/checkpoint.d.ts.map +0 -1
  264. package/dist/core/checkpoint.js +0 -278
  265. package/dist/core/checkpoint.js.map +0 -1
  266. package/dist/core/cliTestHarness.d.ts +0 -200
  267. package/dist/core/cliTestHarness.d.ts.map +0 -1
  268. package/dist/core/cliTestHarness.js +0 -549
  269. package/dist/core/cliTestHarness.js.map +0 -1
  270. package/dist/core/contextManager.d.ts +0 -265
  271. package/dist/core/contextManager.d.ts.map +0 -1
  272. package/dist/core/contextManager.js +0 -1060
  273. package/dist/core/contextManager.js.map +0 -1
  274. package/dist/core/contextWindow.d.ts +0 -42
  275. package/dist/core/contextWindow.d.ts.map +0 -1
  276. package/dist/core/contextWindow.js +0 -123
  277. package/dist/core/contextWindow.js.map +0 -1
  278. package/dist/core/costTracker.d.ts +0 -87
  279. package/dist/core/costTracker.d.ts.map +0 -1
  280. package/dist/core/costTracker.js +0 -285
  281. package/dist/core/costTracker.js.map +0 -1
  282. package/dist/core/customCommands.d.ts +0 -19
  283. package/dist/core/customCommands.d.ts.map +0 -1
  284. package/dist/core/customCommands.js +0 -84
  285. package/dist/core/customCommands.js.map +0 -1
  286. package/dist/core/errors/apiKeyErrors.d.ts +0 -11
  287. package/dist/core/errors/apiKeyErrors.d.ts.map +0 -1
  288. package/dist/core/errors/apiKeyErrors.js +0 -159
  289. package/dist/core/errors/apiKeyErrors.js.map +0 -1
  290. package/dist/core/errors/errorTypes.d.ts +0 -111
  291. package/dist/core/errors/errorTypes.d.ts.map +0 -1
  292. package/dist/core/errors/errorTypes.js +0 -348
  293. package/dist/core/errors/errorTypes.js.map +0 -1
  294. package/dist/core/errors/errorUtils.d.ts +0 -87
  295. package/dist/core/errors/errorUtils.d.ts.map +0 -1
  296. package/dist/core/errors/errorUtils.js +0 -158
  297. package/dist/core/errors/errorUtils.js.map +0 -1
  298. package/dist/core/errors/safetyValidator.d.ts +0 -71
  299. package/dist/core/errors/safetyValidator.d.ts.map +0 -1
  300. package/dist/core/errors/safetyValidator.js +0 -302
  301. package/dist/core/errors/safetyValidator.js.map +0 -1
  302. package/dist/core/errors.d.ts +0 -4
  303. package/dist/core/errors.d.ts.map +0 -1
  304. package/dist/core/errors.js +0 -33
  305. package/dist/core/errors.js.map +0 -1
  306. package/dist/core/failureRecovery.d.ts +0 -122
  307. package/dist/core/failureRecovery.d.ts.map +0 -1
  308. package/dist/core/failureRecovery.js +0 -477
  309. package/dist/core/failureRecovery.js.map +0 -1
  310. package/dist/core/hooks.d.ts +0 -113
  311. package/dist/core/hooks.d.ts.map +0 -1
  312. package/dist/core/hooks.js +0 -267
  313. package/dist/core/hooks.js.map +0 -1
  314. package/dist/core/intelligentTestFlows.d.ts +0 -126
  315. package/dist/core/intelligentTestFlows.d.ts.map +0 -1
  316. package/dist/core/intelligentTestFlows.js +0 -678
  317. package/dist/core/intelligentTestFlows.js.map +0 -1
  318. package/dist/core/isolatedVerifier.d.ts +0 -40
  319. package/dist/core/isolatedVerifier.d.ts.map +0 -1
  320. package/dist/core/isolatedVerifier.js +0 -129
  321. package/dist/core/isolatedVerifier.js.map +0 -1
  322. package/dist/core/learningPersistence.d.ts +0 -145
  323. package/dist/core/learningPersistence.d.ts.map +0 -1
  324. package/dist/core/learningPersistence.js +0 -477
  325. package/dist/core/learningPersistence.js.map +0 -1
  326. package/dist/core/memorySystem.d.ts +0 -67
  327. package/dist/core/memorySystem.d.ts.map +0 -1
  328. package/dist/core/memorySystem.js +0 -334
  329. package/dist/core/memorySystem.js.map +0 -1
  330. package/dist/core/metricsTracker.d.ts +0 -157
  331. package/dist/core/metricsTracker.d.ts.map +0 -1
  332. package/dist/core/metricsTracker.js +0 -273
  333. package/dist/core/metricsTracker.js.map +0 -1
  334. package/dist/core/modelDiscovery.d.ts +0 -101
  335. package/dist/core/modelDiscovery.d.ts.map +0 -1
  336. package/dist/core/modelDiscovery.js +0 -780
  337. package/dist/core/modelDiscovery.js.map +0 -1
  338. package/dist/core/multilinePasteHandler.d.ts +0 -35
  339. package/dist/core/multilinePasteHandler.d.ts.map +0 -1
  340. package/dist/core/multilinePasteHandler.js +0 -80
  341. package/dist/core/multilinePasteHandler.js.map +0 -1
  342. package/dist/core/offsecAlphaZero.d.ts +0 -56
  343. package/dist/core/offsecAlphaZero.d.ts.map +0 -1
  344. package/dist/core/offsecAlphaZero.js +0 -395
  345. package/dist/core/offsecAlphaZero.js.map +0 -1
  346. package/dist/core/outputStyles.d.ts +0 -48
  347. package/dist/core/outputStyles.d.ts.map +0 -1
  348. package/dist/core/outputStyles.js +0 -270
  349. package/dist/core/outputStyles.js.map +0 -1
  350. package/dist/core/performanceMonitor.d.ts +0 -124
  351. package/dist/core/performanceMonitor.d.ts.map +0 -1
  352. package/dist/core/performanceMonitor.js +0 -192
  353. package/dist/core/performanceMonitor.js.map +0 -1
  354. package/dist/core/preferences.d.ts +0 -69
  355. package/dist/core/preferences.d.ts.map +0 -1
  356. package/dist/core/preferences.js +0 -316
  357. package/dist/core/preferences.js.map +0 -1
  358. package/dist/core/responseVerifier.d.ts +0 -98
  359. package/dist/core/responseVerifier.d.ts.map +0 -1
  360. package/dist/core/responseVerifier.js +0 -509
  361. package/dist/core/responseVerifier.js.map +0 -1
  362. package/dist/core/resultVerification.d.ts +0 -141
  363. package/dist/core/resultVerification.d.ts.map +0 -1
  364. package/dist/core/resultVerification.js +0 -482
  365. package/dist/core/resultVerification.js.map +0 -1
  366. package/dist/core/schemaValidator.d.ts +0 -44
  367. package/dist/core/schemaValidator.d.ts.map +0 -1
  368. package/dist/core/schemaValidator.js +0 -155
  369. package/dist/core/schemaValidator.js.map +0 -1
  370. package/dist/core/secretStore.d.ts +0 -48
  371. package/dist/core/secretStore.d.ts.map +0 -1
  372. package/dist/core/secretStore.js +0 -367
  373. package/dist/core/secretStore.js.map +0 -1
  374. package/dist/core/securityAssessment.d.ts +0 -91
  375. package/dist/core/securityAssessment.d.ts.map +0 -1
  376. package/dist/core/securityAssessment.js +0 -580
  377. package/dist/core/securityAssessment.js.map +0 -1
  378. package/dist/core/selfEvolution.d.ts +0 -155
  379. package/dist/core/selfEvolution.d.ts.map +0 -1
  380. package/dist/core/selfEvolution.js +0 -1000
  381. package/dist/core/selfEvolution.js.map +0 -1
  382. package/dist/core/selfImprovement.d.ts +0 -141
  383. package/dist/core/selfImprovement.d.ts.map +0 -1
  384. package/dist/core/selfImprovement.js +0 -700
  385. package/dist/core/selfImprovement.js.map +0 -1
  386. package/dist/core/sessionStore.d.ts +0 -35
  387. package/dist/core/sessionStore.d.ts.map +0 -1
  388. package/dist/core/sessionStore.js +0 -189
  389. package/dist/core/sessionStore.js.map +0 -1
  390. package/dist/core/testUtils.d.ts +0 -121
  391. package/dist/core/testUtils.d.ts.map +0 -1
  392. package/dist/core/testUtils.js +0 -235
  393. package/dist/core/testUtils.js.map +0 -1
  394. package/dist/core/toolPreconditions.d.ts +0 -42
  395. package/dist/core/toolPreconditions.d.ts.map +0 -1
  396. package/dist/core/toolPreconditions.js +0 -347
  397. package/dist/core/toolPreconditions.js.map +0 -1
  398. package/dist/core/toolRuntime.d.ts +0 -163
  399. package/dist/core/toolRuntime.d.ts.map +0 -1
  400. package/dist/core/toolRuntime.js +0 -439
  401. package/dist/core/toolRuntime.js.map +0 -1
  402. package/dist/core/toolValidation.d.ts +0 -116
  403. package/dist/core/toolValidation.d.ts.map +0 -1
  404. package/dist/core/toolValidation.js +0 -282
  405. package/dist/core/toolValidation.js.map +0 -1
  406. package/dist/core/types/utilityTypes.d.ts +0 -192
  407. package/dist/core/types/utilityTypes.d.ts.map +0 -1
  408. package/dist/core/types/utilityTypes.js +0 -272
  409. package/dist/core/types/utilityTypes.js.map +0 -1
  410. package/dist/core/types.d.ts +0 -306
  411. package/dist/core/types.d.ts.map +0 -1
  412. package/dist/core/types.js +0 -76
  413. package/dist/core/types.js.map +0 -1
  414. package/dist/core/validationRunner.d.ts +0 -106
  415. package/dist/core/validationRunner.d.ts.map +0 -1
  416. package/dist/core/validationRunner.js +0 -888
  417. package/dist/core/validationRunner.js.map +0 -1
  418. package/dist/core/verification.d.ts +0 -137
  419. package/dist/core/verification.d.ts.map +0 -1
  420. package/dist/core/verification.js +0 -323
  421. package/dist/core/verification.js.map +0 -1
  422. package/dist/headless/headlessApp.d.ts +0 -5
  423. package/dist/headless/headlessApp.d.ts.map +0 -1
  424. package/dist/headless/headlessApp.js +0 -210
  425. package/dist/headless/headlessApp.js.map +0 -1
  426. package/dist/intelligence/codeIntelligence.d.ts +0 -118
  427. package/dist/intelligence/codeIntelligence.d.ts.map +0 -1
  428. package/dist/intelligence/codeIntelligence.js +0 -552
  429. package/dist/intelligence/codeIntelligence.js.map +0 -1
  430. package/dist/intelligence/docGenerator.d.ts +0 -86
  431. package/dist/intelligence/docGenerator.d.ts.map +0 -1
  432. package/dist/intelligence/docGenerator.js +0 -564
  433. package/dist/intelligence/docGenerator.js.map +0 -1
  434. package/dist/intelligence/index.d.ts +0 -51
  435. package/dist/intelligence/index.d.ts.map +0 -1
  436. package/dist/intelligence/index.js +0 -253
  437. package/dist/intelligence/index.js.map +0 -1
  438. package/dist/intelligence/refactoring.d.ts +0 -50
  439. package/dist/intelligence/refactoring.d.ts.map +0 -1
  440. package/dist/intelligence/refactoring.js +0 -354
  441. package/dist/intelligence/refactoring.js.map +0 -1
  442. package/dist/intelligence/testGenerator.d.ts +0 -74
  443. package/dist/intelligence/testGenerator.d.ts.map +0 -1
  444. package/dist/intelligence/testGenerator.js +0 -483
  445. package/dist/intelligence/testGenerator.js.map +0 -1
  446. package/dist/mcp/config.d.ts +0 -8
  447. package/dist/mcp/config.d.ts.map +0 -1
  448. package/dist/mcp/config.js +0 -252
  449. package/dist/mcp/config.js.map +0 -1
  450. package/dist/mcp/sseClient.d.ts +0 -34
  451. package/dist/mcp/sseClient.d.ts.map +0 -1
  452. package/dist/mcp/sseClient.js +0 -327
  453. package/dist/mcp/sseClient.js.map +0 -1
  454. package/dist/mcp/stdioClient.d.ts +0 -24
  455. package/dist/mcp/stdioClient.d.ts.map +0 -1
  456. package/dist/mcp/stdioClient.js +0 -179
  457. package/dist/mcp/stdioClient.js.map +0 -1
  458. package/dist/mcp/toolBridge.d.ts +0 -12
  459. package/dist/mcp/toolBridge.d.ts.map +0 -1
  460. package/dist/mcp/toolBridge.js +0 -117
  461. package/dist/mcp/toolBridge.js.map +0 -1
  462. package/dist/mcp/types.d.ts +0 -60
  463. package/dist/mcp/types.d.ts.map +0 -1
  464. package/dist/mcp/types.js +0 -2
  465. package/dist/mcp/types.js.map +0 -1
  466. package/dist/plugins/index.d.ts +0 -49
  467. package/dist/plugins/index.d.ts.map +0 -1
  468. package/dist/plugins/index.js +0 -114
  469. package/dist/plugins/index.js.map +0 -1
  470. package/dist/plugins/providers/anthropic/index.d.ts +0 -11
  471. package/dist/plugins/providers/anthropic/index.d.ts.map +0 -1
  472. package/dist/plugins/providers/anthropic/index.js +0 -38
  473. package/dist/plugins/providers/anthropic/index.js.map +0 -1
  474. package/dist/plugins/providers/deepseek/index.d.ts +0 -11
  475. package/dist/plugins/providers/deepseek/index.d.ts.map +0 -1
  476. package/dist/plugins/providers/deepseek/index.js +0 -52
  477. package/dist/plugins/providers/deepseek/index.js.map +0 -1
  478. package/dist/plugins/providers/google/index.d.ts +0 -11
  479. package/dist/plugins/providers/google/index.d.ts.map +0 -1
  480. package/dist/plugins/providers/google/index.js +0 -40
  481. package/dist/plugins/providers/google/index.js.map +0 -1
  482. package/dist/plugins/providers/index.d.ts +0 -2
  483. package/dist/plugins/providers/index.d.ts.map +0 -1
  484. package/dist/plugins/providers/index.js +0 -20
  485. package/dist/plugins/providers/index.js.map +0 -1
  486. package/dist/plugins/providers/ollama/index.d.ts +0 -21
  487. package/dist/plugins/providers/ollama/index.d.ts.map +0 -1
  488. package/dist/plugins/providers/ollama/index.js +0 -69
  489. package/dist/plugins/providers/ollama/index.js.map +0 -1
  490. package/dist/plugins/providers/openai/index.d.ts +0 -12
  491. package/dist/plugins/providers/openai/index.d.ts.map +0 -1
  492. package/dist/plugins/providers/openai/index.js +0 -39
  493. package/dist/plugins/providers/openai/index.js.map +0 -1
  494. package/dist/plugins/providers/xai/index.d.ts +0 -11
  495. package/dist/plugins/providers/xai/index.d.ts.map +0 -1
  496. package/dist/plugins/providers/xai/index.js +0 -39
  497. package/dist/plugins/providers/xai/index.js.map +0 -1
  498. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts +0 -3
  499. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts.map +0 -1
  500. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -9
  501. package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js.map +0 -1
  502. package/dist/plugins/tools/bash/localBashPlugin.d.ts +0 -3
  503. package/dist/plugins/tools/bash/localBashPlugin.d.ts.map +0 -1
  504. package/dist/plugins/tools/bash/localBashPlugin.js +0 -14
  505. package/dist/plugins/tools/bash/localBashPlugin.js.map +0 -1
  506. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts +0 -14
  507. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts.map +0 -1
  508. package/dist/plugins/tools/browser/browserAutomationPlugin.js +0 -26
  509. package/dist/plugins/tools/browser/browserAutomationPlugin.js.map +0 -1
  510. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts +0 -3
  511. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts.map +0 -1
  512. package/dist/plugins/tools/checks/localRepoChecksPlugin.js +0 -14
  513. package/dist/plugins/tools/checks/localRepoChecksPlugin.js.map +0 -1
  514. package/dist/plugins/tools/cloud/cloudPlugin.d.ts +0 -3
  515. package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +0 -1
  516. package/dist/plugins/tools/cloud/cloudPlugin.js +0 -14
  517. package/dist/plugins/tools/cloud/cloudPlugin.js.map +0 -1
  518. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts +0 -3
  519. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts.map +0 -1
  520. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -14
  521. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js.map +0 -1
  522. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts +0 -3
  523. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts.map +0 -1
  524. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js +0 -14
  525. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js.map +0 -1
  526. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts +0 -3
  527. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts.map +0 -1
  528. package/dist/plugins/tools/dependency/dependencyPlugin.js +0 -12
  529. package/dist/plugins/tools/dependency/dependencyPlugin.js.map +0 -1
  530. package/dist/plugins/tools/development/devPlugin.d.ts +0 -3
  531. package/dist/plugins/tools/development/devPlugin.d.ts.map +0 -1
  532. package/dist/plugins/tools/development/devPlugin.js +0 -14
  533. package/dist/plugins/tools/development/devPlugin.js.map +0 -1
  534. package/dist/plugins/tools/edit/editPlugin.d.ts +0 -9
  535. package/dist/plugins/tools/edit/editPlugin.d.ts.map +0 -1
  536. package/dist/plugins/tools/edit/editPlugin.js +0 -15
  537. package/dist/plugins/tools/edit/editPlugin.js.map +0 -1
  538. package/dist/plugins/tools/email/emailPlugin.d.ts +0 -3
  539. package/dist/plugins/tools/email/emailPlugin.d.ts.map +0 -1
  540. package/dist/plugins/tools/email/emailPlugin.js +0 -12
  541. package/dist/plugins/tools/email/emailPlugin.js.map +0 -1
  542. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts +0 -3
  543. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts.map +0 -1
  544. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -9
  545. package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js.map +0 -1
  546. package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts +0 -3
  547. package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts.map +0 -1
  548. package/dist/plugins/tools/filesystem/localFilesystemPlugin.js +0 -14
  549. package/dist/plugins/tools/filesystem/localFilesystemPlugin.js.map +0 -1
  550. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts +0 -3
  551. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts.map +0 -1
  552. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js +0 -14
  553. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js.map +0 -1
  554. package/dist/plugins/tools/glob/globPlugin.d.ts +0 -9
  555. package/dist/plugins/tools/glob/globPlugin.d.ts.map +0 -1
  556. package/dist/plugins/tools/glob/globPlugin.js +0 -15
  557. package/dist/plugins/tools/glob/globPlugin.js.map +0 -1
  558. package/dist/plugins/tools/index.d.ts +0 -3
  559. package/dist/plugins/tools/index.d.ts.map +0 -1
  560. package/dist/plugins/tools/index.js +0 -3
  561. package/dist/plugins/tools/index.js.map +0 -1
  562. package/dist/plugins/tools/interaction/interactionPlugin.d.ts +0 -3
  563. package/dist/plugins/tools/interaction/interactionPlugin.d.ts.map +0 -1
  564. package/dist/plugins/tools/interaction/interactionPlugin.js +0 -12
  565. package/dist/plugins/tools/interaction/interactionPlugin.js.map +0 -1
  566. package/dist/plugins/tools/learn/learnPlugin.d.ts +0 -3
  567. package/dist/plugins/tools/learn/learnPlugin.d.ts.map +0 -1
  568. package/dist/plugins/tools/learn/learnPlugin.js +0 -14
  569. package/dist/plugins/tools/learn/learnPlugin.js.map +0 -1
  570. package/dist/plugins/tools/mcp/mcpPlugin.d.ts +0 -3
  571. package/dist/plugins/tools/mcp/mcpPlugin.d.ts.map +0 -1
  572. package/dist/plugins/tools/mcp/mcpPlugin.js +0 -9
  573. package/dist/plugins/tools/mcp/mcpPlugin.js.map +0 -1
  574. package/dist/plugins/tools/nodeDefaults.d.ts +0 -2
  575. package/dist/plugins/tools/nodeDefaults.d.ts.map +0 -1
  576. package/dist/plugins/tools/nodeDefaults.js +0 -65
  577. package/dist/plugins/tools/nodeDefaults.js.map +0 -1
  578. package/dist/plugins/tools/notebook/notebookPlugin.d.ts +0 -9
  579. package/dist/plugins/tools/notebook/notebookPlugin.d.ts.map +0 -1
  580. package/dist/plugins/tools/notebook/notebookPlugin.js +0 -15
  581. package/dist/plugins/tools/notebook/notebookPlugin.js.map +0 -1
  582. package/dist/plugins/tools/planning/planningPlugin.d.ts +0 -9
  583. package/dist/plugins/tools/planning/planningPlugin.d.ts.map +0 -1
  584. package/dist/plugins/tools/planning/planningPlugin.js +0 -15
  585. package/dist/plugins/tools/planning/planningPlugin.js.map +0 -1
  586. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts +0 -3
  587. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts.map +0 -1
  588. package/dist/plugins/tools/refactoring/refactoringPlugin.js +0 -12
  589. package/dist/plugins/tools/refactoring/refactoringPlugin.js.map +0 -1
  590. package/dist/plugins/tools/registry.d.ts +0 -22
  591. package/dist/plugins/tools/registry.d.ts.map +0 -1
  592. package/dist/plugins/tools/registry.js +0 -58
  593. package/dist/plugins/tools/registry.js.map +0 -1
  594. package/dist/plugins/tools/search/localSearchPlugin.d.ts +0 -3
  595. package/dist/plugins/tools/search/localSearchPlugin.d.ts.map +0 -1
  596. package/dist/plugins/tools/search/localSearchPlugin.js +0 -14
  597. package/dist/plugins/tools/search/localSearchPlugin.js.map +0 -1
  598. package/dist/plugins/tools/skills/skillPlugin.d.ts +0 -3
  599. package/dist/plugins/tools/skills/skillPlugin.d.ts.map +0 -1
  600. package/dist/plugins/tools/skills/skillPlugin.js +0 -9
  601. package/dist/plugins/tools/skills/skillPlugin.js.map +0 -1
  602. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts +0 -3
  603. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts.map +0 -1
  604. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js +0 -12
  605. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js.map +0 -1
  606. package/dist/plugins/tools/testing/testingPlugin.d.ts +0 -3
  607. package/dist/plugins/tools/testing/testingPlugin.d.ts.map +0 -1
  608. package/dist/plugins/tools/testing/testingPlugin.js +0 -12
  609. package/dist/plugins/tools/testing/testingPlugin.js.map +0 -1
  610. package/dist/plugins/tools/validation/validationPlugin.d.ts +0 -3
  611. package/dist/plugins/tools/validation/validationPlugin.d.ts.map +0 -1
  612. package/dist/plugins/tools/validation/validationPlugin.js +0 -14
  613. package/dist/plugins/tools/validation/validationPlugin.js.map +0 -1
  614. package/dist/plugins/tools/web/webPlugin.d.ts +0 -3
  615. package/dist/plugins/tools/web/webPlugin.d.ts.map +0 -1
  616. package/dist/plugins/tools/web/webPlugin.js +0 -12
  617. package/dist/plugins/tools/web/webPlugin.js.map +0 -1
  618. package/dist/providers/anthropicProvider.d.ts +0 -41
  619. package/dist/providers/anthropicProvider.d.ts.map +0 -1
  620. package/dist/providers/anthropicProvider.js +0 -446
  621. package/dist/providers/anthropicProvider.js.map +0 -1
  622. package/dist/providers/googleProvider.d.ts +0 -36
  623. package/dist/providers/googleProvider.d.ts.map +0 -1
  624. package/dist/providers/googleProvider.js +0 -312
  625. package/dist/providers/googleProvider.js.map +0 -1
  626. package/dist/providers/openaiChatCompletionsProvider.d.ts +0 -43
  627. package/dist/providers/openaiChatCompletionsProvider.d.ts.map +0 -1
  628. package/dist/providers/openaiChatCompletionsProvider.js +0 -516
  629. package/dist/providers/openaiChatCompletionsProvider.js.map +0 -1
  630. package/dist/providers/openaiResponsesProvider.d.ts +0 -38
  631. package/dist/providers/openaiResponsesProvider.d.ts.map +0 -1
  632. package/dist/providers/openaiResponsesProvider.js +0 -364
  633. package/dist/providers/openaiResponsesProvider.js.map +0 -1
  634. package/dist/providers/providerFactory.d.ts +0 -18
  635. package/dist/providers/providerFactory.d.ts.map +0 -1
  636. package/dist/providers/providerFactory.js +0 -25
  637. package/dist/providers/providerFactory.js.map +0 -1
  638. package/dist/providers/resilientProvider.d.ts +0 -94
  639. package/dist/providers/resilientProvider.d.ts.map +0 -1
  640. package/dist/providers/resilientProvider.js +0 -370
  641. package/dist/providers/resilientProvider.js.map +0 -1
  642. package/dist/runtime/agentController.d.ts +0 -65
  643. package/dist/runtime/agentController.d.ts.map +0 -1
  644. package/dist/runtime/agentController.js +0 -353
  645. package/dist/runtime/agentController.js.map +0 -1
  646. package/dist/runtime/agentHost.d.ts +0 -61
  647. package/dist/runtime/agentHost.d.ts.map +0 -1
  648. package/dist/runtime/agentHost.js +0 -156
  649. package/dist/runtime/agentHost.js.map +0 -1
  650. package/dist/runtime/agentSession.d.ts +0 -40
  651. package/dist/runtime/agentSession.d.ts.map +0 -1
  652. package/dist/runtime/agentSession.js +0 -205
  653. package/dist/runtime/agentSession.js.map +0 -1
  654. package/dist/runtime/browser.d.ts +0 -7
  655. package/dist/runtime/browser.d.ts.map +0 -1
  656. package/dist/runtime/browser.js +0 -10
  657. package/dist/runtime/browser.js.map +0 -1
  658. package/dist/runtime/cloud.d.ts +0 -7
  659. package/dist/runtime/cloud.d.ts.map +0 -1
  660. package/dist/runtime/cloud.js +0 -10
  661. package/dist/runtime/cloud.js.map +0 -1
  662. package/dist/runtime/node.d.ts +0 -8
  663. package/dist/runtime/node.d.ts.map +0 -1
  664. package/dist/runtime/node.js +0 -11
  665. package/dist/runtime/node.js.map +0 -1
  666. package/dist/runtime/universal.d.ts +0 -21
  667. package/dist/runtime/universal.d.ts.map +0 -1
  668. package/dist/runtime/universal.js +0 -29
  669. package/dist/runtime/universal.js.map +0 -1
  670. package/dist/shell/autoExecutor.d.ts +0 -70
  671. package/dist/shell/autoExecutor.d.ts.map +0 -1
  672. package/dist/shell/autoExecutor.js +0 -288
  673. package/dist/shell/autoExecutor.js.map +0 -1
  674. package/dist/shell/composableMessage.d.ts +0 -183
  675. package/dist/shell/composableMessage.d.ts.map +0 -1
  676. package/dist/shell/composableMessage.js +0 -420
  677. package/dist/shell/composableMessage.js.map +0 -1
  678. package/dist/shell/fileChangeTracker.d.ts +0 -39
  679. package/dist/shell/fileChangeTracker.d.ts.map +0 -1
  680. package/dist/shell/fileChangeTracker.js +0 -64
  681. package/dist/shell/fileChangeTracker.js.map +0 -1
  682. package/dist/shell/interactiveShell.d.ts +0 -517
  683. package/dist/shell/interactiveShell.d.ts.map +0 -1
  684. package/dist/shell/interactiveShell.js +0 -6646
  685. package/dist/shell/interactiveShell.js.map +0 -1
  686. package/dist/shell/liveStatus.d.ts +0 -30
  687. package/dist/shell/liveStatus.d.ts.map +0 -1
  688. package/dist/shell/liveStatus.js +0 -102
  689. package/dist/shell/liveStatus.js.map +0 -1
  690. package/dist/shell/shellApp.d.ts +0 -19
  691. package/dist/shell/shellApp.d.ts.map +0 -1
  692. package/dist/shell/shellApp.js +0 -411
  693. package/dist/shell/shellApp.js.map +0 -1
  694. package/dist/shell/systemPrompt.d.ts +0 -3
  695. package/dist/shell/systemPrompt.d.ts.map +0 -1
  696. package/dist/shell/systemPrompt.js +0 -64
  697. package/dist/shell/systemPrompt.js.map +0 -1
  698. package/dist/shell/taskCompletionDetector.d.ts +0 -106
  699. package/dist/shell/taskCompletionDetector.d.ts.map +0 -1
  700. package/dist/shell/taskCompletionDetector.js +0 -402
  701. package/dist/shell/taskCompletionDetector.js.map +0 -1
  702. package/dist/shell/terminalInputAdapter.d.ts +0 -262
  703. package/dist/shell/terminalInputAdapter.d.ts.map +0 -1
  704. package/dist/shell/terminalInputAdapter.js +0 -346
  705. package/dist/shell/terminalInputAdapter.js.map +0 -1
  706. package/dist/shell/vimMode.d.ts +0 -66
  707. package/dist/shell/vimMode.d.ts.map +0 -1
  708. package/dist/shell/vimMode.js +0 -434
  709. package/dist/shell/vimMode.js.map +0 -1
  710. package/dist/skills/skillRepository.d.ts +0 -103
  711. package/dist/skills/skillRepository.d.ts.map +0 -1
  712. package/dist/skills/skillRepository.js +0 -237
  713. package/dist/skills/skillRepository.js.map +0 -1
  714. package/dist/skills/types.d.ts +0 -37
  715. package/dist/skills/types.d.ts.map +0 -1
  716. package/dist/skills/types.js +0 -2
  717. package/dist/skills/types.js.map +0 -1
  718. package/dist/subagents/agentConfig.d.ts +0 -27
  719. package/dist/subagents/agentConfig.d.ts.map +0 -1
  720. package/dist/subagents/agentConfig.js +0 -89
  721. package/dist/subagents/agentConfig.js.map +0 -1
  722. package/dist/subagents/agentRegistry.d.ts +0 -33
  723. package/dist/subagents/agentRegistry.d.ts.map +0 -1
  724. package/dist/subagents/agentRegistry.js +0 -162
  725. package/dist/subagents/agentRegistry.js.map +0 -1
  726. package/dist/subagents/parallelAgentManager.d.ts +0 -99
  727. package/dist/subagents/parallelAgentManager.d.ts.map +0 -1
  728. package/dist/subagents/parallelAgentManager.js +0 -248
  729. package/dist/subagents/parallelAgentManager.js.map +0 -1
  730. package/dist/subagents/taskRunner.d.ts +0 -34
  731. package/dist/subagents/taskRunner.d.ts.map +0 -1
  732. package/dist/subagents/taskRunner.js +0 -459
  733. package/dist/subagents/taskRunner.js.map +0 -1
  734. package/dist/tools/advancedTestGenerationTools.d.ts +0 -21
  735. package/dist/tools/advancedTestGenerationTools.d.ts.map +0 -1
  736. package/dist/tools/advancedTestGenerationTools.js +0 -301
  737. package/dist/tools/advancedTestGenerationTools.js.map +0 -1
  738. package/dist/tools/backgroundBashTools.d.ts +0 -21
  739. package/dist/tools/backgroundBashTools.d.ts.map +0 -1
  740. package/dist/tools/backgroundBashTools.js +0 -215
  741. package/dist/tools/backgroundBashTools.js.map +0 -1
  742. package/dist/tools/bashTools.d.ts +0 -8
  743. package/dist/tools/bashTools.d.ts.map +0 -1
  744. package/dist/tools/bashTools.js +0 -240
  745. package/dist/tools/bashTools.js.map +0 -1
  746. package/dist/tools/browserAutomationTools.d.ts +0 -23
  747. package/dist/tools/browserAutomationTools.d.ts.map +0 -1
  748. package/dist/tools/browserAutomationTools.js +0 -916
  749. package/dist/tools/browserAutomationTools.js.map +0 -1
  750. package/dist/tools/buildTools.d.ts +0 -9
  751. package/dist/tools/buildTools.d.ts.map +0 -1
  752. package/dist/tools/buildTools.js +0 -344
  753. package/dist/tools/buildTools.js.map +0 -1
  754. package/dist/tools/cloudTools.d.ts +0 -49
  755. package/dist/tools/cloudTools.d.ts.map +0 -1
  756. package/dist/tools/cloudTools.js +0 -1258
  757. package/dist/tools/cloudTools.js.map +0 -1
  758. package/dist/tools/code-quality-dashboard.d.ts +0 -57
  759. package/dist/tools/code-quality-dashboard.d.ts.map +0 -1
  760. package/dist/tools/code-quality-dashboard.js +0 -218
  761. package/dist/tools/code-quality-dashboard.js.map +0 -1
  762. package/dist/tools/codeAnalysisTools.d.ts +0 -74
  763. package/dist/tools/codeAnalysisTools.d.ts.map +0 -1
  764. package/dist/tools/codeAnalysisTools.js +0 -664
  765. package/dist/tools/codeAnalysisTools.js.map +0 -1
  766. package/dist/tools/codeGenerationTools.d.ts +0 -3
  767. package/dist/tools/codeGenerationTools.d.ts.map +0 -1
  768. package/dist/tools/codeGenerationTools.js +0 -439
  769. package/dist/tools/codeGenerationTools.js.map +0 -1
  770. package/dist/tools/codeQualityTools.d.ts +0 -3
  771. package/dist/tools/codeQualityTools.d.ts.map +0 -1
  772. package/dist/tools/codeQualityTools.js +0 -296
  773. package/dist/tools/codeQualityTools.js.map +0 -1
  774. package/dist/tools/dependencyTools.d.ts +0 -3
  775. package/dist/tools/dependencyTools.d.ts.map +0 -1
  776. package/dist/tools/dependencyTools.js +0 -283
  777. package/dist/tools/dependencyTools.js.map +0 -1
  778. package/dist/tools/devTools.d.ts +0 -10
  779. package/dist/tools/devTools.d.ts.map +0 -1
  780. package/dist/tools/devTools.js +0 -2125
  781. package/dist/tools/devTools.js.map +0 -1
  782. package/dist/tools/diffUtils.d.ts +0 -36
  783. package/dist/tools/diffUtils.d.ts.map +0 -1
  784. package/dist/tools/diffUtils.js +0 -528
  785. package/dist/tools/diffUtils.js.map +0 -1
  786. package/dist/tools/editTools.d.ts +0 -29
  787. package/dist/tools/editTools.d.ts.map +0 -1
  788. package/dist/tools/editTools.js +0 -419
  789. package/dist/tools/editTools.js.map +0 -1
  790. package/dist/tools/emailTools.d.ts +0 -21
  791. package/dist/tools/emailTools.d.ts.map +0 -1
  792. package/dist/tools/emailTools.js +0 -449
  793. package/dist/tools/emailTools.js.map +0 -1
  794. package/dist/tools/enhancedCodeIntelligenceTools.d.ts +0 -27
  795. package/dist/tools/enhancedCodeIntelligenceTools.d.ts.map +0 -1
  796. package/dist/tools/enhancedCodeIntelligenceTools.js +0 -418
  797. package/dist/tools/enhancedCodeIntelligenceTools.js.map +0 -1
  798. package/dist/tools/enhancedDevWorkflowTools.d.ts +0 -15
  799. package/dist/tools/enhancedDevWorkflowTools.d.ts.map +0 -1
  800. package/dist/tools/enhancedDevWorkflowTools.js +0 -303
  801. package/dist/tools/enhancedDevWorkflowTools.js.map +0 -1
  802. package/dist/tools/fileTools.d.ts +0 -3
  803. package/dist/tools/fileTools.d.ts.map +0 -1
  804. package/dist/tools/fileTools.js +0 -334
  805. package/dist/tools/fileTools.js.map +0 -1
  806. package/dist/tools/frontendTestingTools.d.ts +0 -35
  807. package/dist/tools/frontendTestingTools.d.ts.map +0 -1
  808. package/dist/tools/frontendTestingTools.js +0 -1254
  809. package/dist/tools/frontendTestingTools.js.map +0 -1
  810. package/dist/tools/globTools.d.ts +0 -15
  811. package/dist/tools/globTools.d.ts.map +0 -1
  812. package/dist/tools/globTools.js +0 -174
  813. package/dist/tools/globTools.js.map +0 -1
  814. package/dist/tools/grepTools.d.ts +0 -19
  815. package/dist/tools/grepTools.d.ts.map +0 -1
  816. package/dist/tools/grepTools.js +0 -358
  817. package/dist/tools/grepTools.js.map +0 -1
  818. package/dist/tools/interactionTools.d.ts +0 -13
  819. package/dist/tools/interactionTools.d.ts.map +0 -1
  820. package/dist/tools/interactionTools.js +0 -171
  821. package/dist/tools/interactionTools.js.map +0 -1
  822. package/dist/tools/learnTools.d.ts +0 -164
  823. package/dist/tools/learnTools.d.ts.map +0 -1
  824. package/dist/tools/learnTools.js +0 -2104
  825. package/dist/tools/learnTools.js.map +0 -1
  826. package/dist/tools/localExplore.d.ts +0 -225
  827. package/dist/tools/localExplore.d.ts.map +0 -1
  828. package/dist/tools/localExplore.js +0 -1365
  829. package/dist/tools/localExplore.js.map +0 -1
  830. package/dist/tools/notebookEditTools.d.ts +0 -15
  831. package/dist/tools/notebookEditTools.d.ts.map +0 -1
  832. package/dist/tools/notebookEditTools.js +0 -197
  833. package/dist/tools/notebookEditTools.js.map +0 -1
  834. package/dist/tools/planningTools.d.ts +0 -21
  835. package/dist/tools/planningTools.d.ts.map +0 -1
  836. package/dist/tools/planningTools.js +0 -185
  837. package/dist/tools/planningTools.js.map +0 -1
  838. package/dist/tools/refactoringTools.d.ts +0 -3
  839. package/dist/tools/refactoringTools.d.ts.map +0 -1
  840. package/dist/tools/refactoringTools.js +0 -294
  841. package/dist/tools/refactoringTools.js.map +0 -1
  842. package/dist/tools/repoChecksTools.d.ts +0 -3
  843. package/dist/tools/repoChecksTools.d.ts.map +0 -1
  844. package/dist/tools/repoChecksTools.js +0 -161
  845. package/dist/tools/repoChecksTools.js.map +0 -1
  846. package/dist/tools/searchTools.d.ts +0 -3
  847. package/dist/tools/searchTools.d.ts.map +0 -1
  848. package/dist/tools/searchTools.js +0 -241
  849. package/dist/tools/searchTools.js.map +0 -1
  850. package/dist/tools/skillTools.d.ts +0 -8
  851. package/dist/tools/skillTools.d.ts.map +0 -1
  852. package/dist/tools/skillTools.js +0 -178
  853. package/dist/tools/skillTools.js.map +0 -1
  854. package/dist/tools/softwareEngineeringTools.d.ts +0 -7
  855. package/dist/tools/softwareEngineeringTools.d.ts.map +0 -1
  856. package/dist/tools/softwareEngineeringTools.js +0 -338
  857. package/dist/tools/softwareEngineeringTools.js.map +0 -1
  858. package/dist/tools/taskManagementTools.d.ts +0 -10
  859. package/dist/tools/taskManagementTools.d.ts.map +0 -1
  860. package/dist/tools/taskManagementTools.js +0 -157
  861. package/dist/tools/taskManagementTools.js.map +0 -1
  862. package/dist/tools/testingTools.d.ts +0 -3
  863. package/dist/tools/testingTools.d.ts.map +0 -1
  864. package/dist/tools/testingTools.js +0 -233
  865. package/dist/tools/testingTools.js.map +0 -1
  866. package/dist/tools/validationTools.d.ts +0 -7
  867. package/dist/tools/validationTools.d.ts.map +0 -1
  868. package/dist/tools/validationTools.js +0 -344
  869. package/dist/tools/validationTools.js.map +0 -1
  870. package/dist/tools/webTools.d.ts +0 -3
  871. package/dist/tools/webTools.d.ts.map +0 -1
  872. package/dist/tools/webTools.js +0 -502
  873. package/dist/tools/webTools.js.map +0 -1
  874. package/dist/ui/DisplayEventQueue.d.ts +0 -99
  875. package/dist/ui/DisplayEventQueue.d.ts.map +0 -1
  876. package/dist/ui/DisplayEventQueue.js +0 -167
  877. package/dist/ui/DisplayEventQueue.js.map +0 -1
  878. package/dist/ui/PromptController.d.ts +0 -103
  879. package/dist/ui/PromptController.d.ts.map +0 -1
  880. package/dist/ui/PromptController.js +0 -171
  881. package/dist/ui/PromptController.js.map +0 -1
  882. package/dist/ui/SequentialRenderer.d.ts +0 -69
  883. package/dist/ui/SequentialRenderer.d.ts.map +0 -1
  884. package/dist/ui/SequentialRenderer.js +0 -137
  885. package/dist/ui/SequentialRenderer.js.map +0 -1
  886. package/dist/ui/ShellUIAdapter.d.ts +0 -207
  887. package/dist/ui/ShellUIAdapter.d.ts.map +0 -1
  888. package/dist/ui/ShellUIAdapter.js +0 -1163
  889. package/dist/ui/ShellUIAdapter.js.map +0 -1
  890. package/dist/ui/UnifiedUIController.d.ts +0 -82
  891. package/dist/ui/UnifiedUIController.d.ts.map +0 -1
  892. package/dist/ui/UnifiedUIController.js +0 -207
  893. package/dist/ui/UnifiedUIController.js.map +0 -1
  894. package/dist/ui/UnifiedUIRenderer.d.ts +0 -188
  895. package/dist/ui/UnifiedUIRenderer.d.ts.map +0 -1
  896. package/dist/ui/UnifiedUIRenderer.js +0 -579
  897. package/dist/ui/UnifiedUIRenderer.js.map +0 -1
  898. package/dist/ui/animation/AnimationScheduler.d.ts +0 -192
  899. package/dist/ui/animation/AnimationScheduler.d.ts.map +0 -1
  900. package/dist/ui/animation/AnimationScheduler.js +0 -432
  901. package/dist/ui/animation/AnimationScheduler.js.map +0 -1
  902. package/dist/ui/codeHighlighter.d.ts +0 -6
  903. package/dist/ui/codeHighlighter.d.ts.map +0 -1
  904. package/dist/ui/codeHighlighter.js +0 -855
  905. package/dist/ui/codeHighlighter.js.map +0 -1
  906. package/dist/ui/compactRenderer.d.ts +0 -139
  907. package/dist/ui/compactRenderer.d.ts.map +0 -1
  908. package/dist/ui/compactRenderer.js +0 -398
  909. package/dist/ui/compactRenderer.js.map +0 -1
  910. package/dist/ui/designSystem.d.ts +0 -26
  911. package/dist/ui/designSystem.d.ts.map +0 -1
  912. package/dist/ui/designSystem.js +0 -122
  913. package/dist/ui/designSystem.js.map +0 -1
  914. package/dist/ui/display.d.ts +0 -229
  915. package/dist/ui/display.d.ts.map +0 -1
  916. package/dist/ui/display.js +0 -756
  917. package/dist/ui/display.js.map +0 -1
  918. package/dist/ui/errorFormatter.d.ts +0 -54
  919. package/dist/ui/errorFormatter.d.ts.map +0 -1
  920. package/dist/ui/errorFormatter.js +0 -251
  921. package/dist/ui/errorFormatter.js.map +0 -1
  922. package/dist/ui/globalWriteLock.d.ts +0 -38
  923. package/dist/ui/globalWriteLock.d.ts.map +0 -1
  924. package/dist/ui/globalWriteLock.js +0 -54
  925. package/dist/ui/globalWriteLock.js.map +0 -1
  926. package/dist/ui/inPlaceUpdater.d.ts +0 -181
  927. package/dist/ui/inPlaceUpdater.d.ts.map +0 -1
  928. package/dist/ui/inPlaceUpdater.js +0 -515
  929. package/dist/ui/inPlaceUpdater.js.map +0 -1
  930. package/dist/ui/interrupts/InterruptManager.d.ts +0 -142
  931. package/dist/ui/interrupts/InterruptManager.d.ts.map +0 -1
  932. package/dist/ui/interrupts/InterruptManager.js +0 -439
  933. package/dist/ui/interrupts/InterruptManager.js.map +0 -1
  934. package/dist/ui/layout.d.ts +0 -17
  935. package/dist/ui/layout.d.ts.map +0 -1
  936. package/dist/ui/layout.js +0 -140
  937. package/dist/ui/layout.js.map +0 -1
  938. package/dist/ui/orchestration/StatusOrchestrator.d.ts +0 -156
  939. package/dist/ui/orchestration/StatusOrchestrator.d.ts.map +0 -1
  940. package/dist/ui/orchestration/StatusOrchestrator.js +0 -406
  941. package/dist/ui/orchestration/StatusOrchestrator.js.map +0 -1
  942. package/dist/ui/orchestration/UIUpdateCoordinator.d.ts +0 -77
  943. package/dist/ui/orchestration/UIUpdateCoordinator.d.ts.map +0 -1
  944. package/dist/ui/orchestration/UIUpdateCoordinator.js +0 -265
  945. package/dist/ui/orchestration/UIUpdateCoordinator.js.map +0 -1
  946. package/dist/ui/outputMode.d.ts +0 -22
  947. package/dist/ui/outputMode.d.ts.map +0 -1
  948. package/dist/ui/outputMode.js +0 -40
  949. package/dist/ui/outputMode.js.map +0 -1
  950. package/dist/ui/richText.d.ts +0 -6
  951. package/dist/ui/richText.d.ts.map +0 -1
  952. package/dist/ui/richText.js +0 -391
  953. package/dist/ui/richText.js.map +0 -1
  954. package/dist/ui/shortcutsHelp.d.ts +0 -39
  955. package/dist/ui/shortcutsHelp.d.ts.map +0 -1
  956. package/dist/ui/shortcutsHelp.js +0 -152
  957. package/dist/ui/shortcutsHelp.js.map +0 -1
  958. package/dist/ui/streamingFormatter.d.ts +0 -19
  959. package/dist/ui/streamingFormatter.d.ts.map +0 -1
  960. package/dist/ui/streamingFormatter.js +0 -65
  961. package/dist/ui/streamingFormatter.js.map +0 -1
  962. package/dist/ui/telemetry/ResponseTracker.d.ts +0 -22
  963. package/dist/ui/telemetry/ResponseTracker.d.ts.map +0 -1
  964. package/dist/ui/telemetry/ResponseTracker.js +0 -60
  965. package/dist/ui/telemetry/ResponseTracker.js.map +0 -1
  966. package/dist/ui/telemetry/UITelemetry.d.ts +0 -181
  967. package/dist/ui/telemetry/UITelemetry.d.ts.map +0 -1
  968. package/dist/ui/telemetry/UITelemetry.js +0 -446
  969. package/dist/ui/telemetry/UITelemetry.js.map +0 -1
  970. package/dist/ui/textHighlighter.d.ts +0 -83
  971. package/dist/ui/textHighlighter.d.ts.map +0 -1
  972. package/dist/ui/textHighlighter.js +0 -267
  973. package/dist/ui/textHighlighter.js.map +0 -1
  974. package/dist/ui/theme.d.ts +0 -208
  975. package/dist/ui/theme.d.ts.map +0 -1
  976. package/dist/ui/theme.js +0 -249
  977. package/dist/ui/theme.js.map +0 -1
  978. package/dist/ui/toolDisplay.d.ts +0 -195
  979. package/dist/ui/toolDisplay.d.ts.map +0 -1
  980. package/dist/ui/toolDisplay.js +0 -1526
  981. package/dist/ui/toolDisplay.js.map +0 -1
  982. package/dist/ui/unified/index.d.ts +0 -50
  983. package/dist/ui/unified/index.d.ts.map +0 -1
  984. package/dist/ui/unified/index.js +0 -77
  985. package/dist/ui/unified/index.js.map +0 -1
  986. package/dist/ui/unified/layout.d.ts +0 -12
  987. package/dist/ui/unified/layout.d.ts.map +0 -1
  988. package/dist/ui/unified/layout.js +0 -96
  989. package/dist/ui/unified/layout.js.map +0 -1
  990. package/dist/ui/writeLock.d.ts +0 -65
  991. package/dist/ui/writeLock.d.ts.map +0 -1
  992. package/dist/ui/writeLock.js +0 -114
  993. package/dist/ui/writeLock.js.map +0 -1
  994. package/dist/utils/asyncUtils.d.ts +0 -95
  995. package/dist/utils/asyncUtils.d.ts.map +0 -1
  996. package/dist/utils/asyncUtils.js +0 -286
  997. package/dist/utils/asyncUtils.js.map +0 -1
  998. package/dist/utils/errorUtils.d.ts +0 -16
  999. package/dist/utils/errorUtils.d.ts.map +0 -1
  1000. package/dist/utils/errorUtils.js +0 -66
  1001. package/dist/utils/errorUtils.js.map +0 -1
  1002. package/dist/utils/frontmatter.d.ts +0 -10
  1003. package/dist/utils/frontmatter.d.ts.map +0 -1
  1004. package/dist/utils/frontmatter.js +0 -78
  1005. package/dist/utils/frontmatter.js.map +0 -1
  1006. package/dist/utils/planFormatter.d.ts +0 -34
  1007. package/dist/utils/planFormatter.d.ts.map +0 -1
  1008. package/dist/utils/planFormatter.js +0 -140
  1009. package/dist/utils/planFormatter.js.map +0 -1
  1010. package/dist/workspace.d.ts +0 -8
  1011. package/dist/workspace.d.ts.map +0 -1
  1012. package/dist/workspace.js +0 -107
  1013. package/dist/workspace.js.map +0 -1
  1014. package/dist/workspace.validator.d.ts +0 -49
  1015. package/dist/workspace.validator.d.ts.map +0 -1
  1016. package/dist/workspace.validator.js +0 -214
  1017. package/dist/workspace.validator.js.map +0 -1
@@ -1,2104 +0,0 @@
1
- /**
2
- * Learn Tools - Codebase exploration and learning tools for understanding codebases.
3
- *
4
- * These tools enable deep codebase exploration without requiring external API calls
5
- * for the core analysis. The AI can use these tools to build a comprehensive
6
- * understanding of any codebase's architecture, patterns, and conventions.
7
- *
8
- * Features:
9
- * - Codebase structure analysis
10
- * - Pattern detection and learning
11
- * - Architecture understanding
12
- * - File relationship mapping
13
- * - Topic-based exploration
14
- */
15
- import { createHash } from 'node:crypto';
16
- import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
17
- import { homedir } from 'node:os';
18
- import { join, relative, extname, basename } from 'node:path';
19
- import { buildError } from '../core/errors.js';
20
- // =====================================================
21
- // Constants
22
- // =====================================================
23
- const IGNORED_DIRS = new Set([
24
- 'node_modules',
25
- '.git',
26
- '.svn',
27
- '.hg',
28
- 'dist',
29
- 'build',
30
- 'out',
31
- '.next',
32
- '.nuxt',
33
- '.output',
34
- 'coverage',
35
- '.nyc_output',
36
- '.cache',
37
- '.turbo',
38
- '.vercel',
39
- '.netlify',
40
- '__pycache__',
41
- '.pytest_cache',
42
- '.mypy_cache',
43
- '.ruff_cache',
44
- 'venv',
45
- '.venv',
46
- 'env',
47
- '.env',
48
- 'target',
49
- 'vendor',
50
- '.idea',
51
- '.vscode',
52
- ]);
53
- const LANGUAGE_MAP = {
54
- '.ts': 'TypeScript',
55
- '.tsx': 'TypeScript React',
56
- '.js': 'JavaScript',
57
- '.jsx': 'JavaScript React',
58
- '.mjs': 'JavaScript (ESM)',
59
- '.cjs': 'JavaScript (CJS)',
60
- '.py': 'Python',
61
- '.pyw': 'Python',
62
- '.pyi': 'Python Stub',
63
- '.rs': 'Rust',
64
- '.go': 'Go',
65
- '.java': 'Java',
66
- '.kt': 'Kotlin',
67
- '.kts': 'Kotlin Script',
68
- '.scala': 'Scala',
69
- '.rb': 'Ruby',
70
- '.php': 'PHP',
71
- '.cs': 'C#',
72
- '.fs': 'F#',
73
- '.cpp': 'C++',
74
- '.cc': 'C++',
75
- '.cxx': 'C++',
76
- '.c': 'C',
77
- '.h': 'C/C++ Header',
78
- '.hpp': 'C++ Header',
79
- '.swift': 'Swift',
80
- '.m': 'Objective-C',
81
- '.mm': 'Objective-C++',
82
- '.vue': 'Vue',
83
- '.svelte': 'Svelte',
84
- '.elm': 'Elm',
85
- '.ex': 'Elixir',
86
- '.exs': 'Elixir Script',
87
- '.erl': 'Erlang',
88
- '.hs': 'Haskell',
89
- '.ml': 'OCaml',
90
- '.mli': 'OCaml Interface',
91
- '.lua': 'Lua',
92
- '.pl': 'Perl',
93
- '.pm': 'Perl Module',
94
- '.sh': 'Shell',
95
- '.bash': 'Bash',
96
- '.zsh': 'Zsh',
97
- '.fish': 'Fish',
98
- '.ps1': 'PowerShell',
99
- '.sql': 'SQL',
100
- '.json': 'JSON',
101
- '.yaml': 'YAML',
102
- '.yml': 'YAML',
103
- '.toml': 'TOML',
104
- '.xml': 'XML',
105
- '.md': 'Markdown',
106
- '.mdx': 'MDX',
107
- '.html': 'HTML',
108
- '.htm': 'HTML',
109
- '.css': 'CSS',
110
- '.scss': 'SCSS',
111
- '.sass': 'Sass',
112
- '.less': 'Less',
113
- '.styl': 'Stylus',
114
- };
115
- const CONFIG_FILES = {
116
- 'package.json': { type: 'npm', purpose: 'Node.js package configuration and dependencies' },
117
- 'tsconfig.json': { type: 'typescript', purpose: 'TypeScript compiler configuration' },
118
- 'pyproject.toml': { type: 'python', purpose: 'Python project configuration (PEP 517/518)' },
119
- 'setup.py': { type: 'python', purpose: 'Python package setup (legacy)' },
120
- 'requirements.txt': { type: 'python', purpose: 'Python dependencies' },
121
- 'Cargo.toml': { type: 'rust', purpose: 'Rust package manifest' },
122
- 'go.mod': { type: 'go', purpose: 'Go module definition' },
123
- 'pom.xml': { type: 'maven', purpose: 'Maven project configuration' },
124
- 'build.gradle': { type: 'gradle', purpose: 'Gradle build configuration' },
125
- 'build.gradle.kts': { type: 'gradle', purpose: 'Gradle Kotlin build configuration' },
126
- 'Gemfile': { type: 'ruby', purpose: 'Ruby dependencies (Bundler)' },
127
- 'composer.json': { type: 'php', purpose: 'PHP Composer dependencies' },
128
- '.eslintrc.json': { type: 'linting', purpose: 'ESLint configuration' },
129
- '.eslintrc.js': { type: 'linting', purpose: 'ESLint configuration' },
130
- '.prettierrc': { type: 'formatting', purpose: 'Prettier configuration' },
131
- 'prettier.config.js': { type: 'formatting', purpose: 'Prettier configuration' },
132
- '.gitignore': { type: 'git', purpose: 'Git ignore patterns' },
133
- '.dockerignore': { type: 'docker', purpose: 'Docker ignore patterns' },
134
- 'Dockerfile': { type: 'docker', purpose: 'Docker image definition' },
135
- 'docker-compose.yml': { type: 'docker', purpose: 'Docker Compose services' },
136
- 'docker-compose.yaml': { type: 'docker', purpose: 'Docker Compose services' },
137
- 'Makefile': { type: 'build', purpose: 'Make build automation' },
138
- '.env.example': { type: 'config', purpose: 'Environment variable template' },
139
- 'jest.config.js': { type: 'testing', purpose: 'Jest test configuration' },
140
- 'vitest.config.ts': { type: 'testing', purpose: 'Vitest test configuration' },
141
- 'webpack.config.js': { type: 'bundler', purpose: 'Webpack bundler configuration' },
142
- 'vite.config.ts': { type: 'bundler', purpose: 'Vite build tool configuration' },
143
- 'rollup.config.js': { type: 'bundler', purpose: 'Rollup bundler configuration' },
144
- 'next.config.js': { type: 'framework', purpose: 'Next.js configuration' },
145
- 'nuxt.config.ts': { type: 'framework', purpose: 'Nuxt.js configuration' },
146
- 'tailwind.config.js': { type: 'css', purpose: 'Tailwind CSS configuration' },
147
- '.github/workflows': { type: 'ci', purpose: 'GitHub Actions workflows' },
148
- '.gitlab-ci.yml': { type: 'ci', purpose: 'GitLab CI/CD configuration' },
149
- 'Jenkinsfile': { type: 'ci', purpose: 'Jenkins pipeline definition' },
150
- };
151
- const ARCHITECTURE_PATTERNS = [
152
- {
153
- name: 'MVC (Model-View-Controller)',
154
- indicators: ['models', 'views', 'controllers', 'routes'],
155
- type: 'architectural',
156
- },
157
- {
158
- name: 'Clean Architecture',
159
- indicators: ['domain', 'application', 'infrastructure', 'presentation', 'entities', 'use-cases', 'usecases'],
160
- type: 'architectural',
161
- },
162
- {
163
- name: 'Hexagonal Architecture',
164
- indicators: ['ports', 'adapters', 'domain', 'application'],
165
- type: 'architectural',
166
- },
167
- {
168
- name: 'Feature-based Structure',
169
- indicators: ['features', 'modules'],
170
- type: 'structural',
171
- },
172
- {
173
- name: 'Component-based',
174
- indicators: ['components', 'shared', 'common'],
175
- type: 'structural',
176
- },
177
- {
178
- name: 'Layered Architecture',
179
- indicators: ['api', 'services', 'repositories', 'data', 'business'],
180
- type: 'architectural',
181
- },
182
- {
183
- name: 'Microservices',
184
- indicators: ['services', 'gateway', 'docker-compose'],
185
- type: 'architectural',
186
- },
187
- {
188
- name: 'Monorepo',
189
- indicators: ['packages', 'apps', 'libs', 'workspace'],
190
- type: 'structural',
191
- },
192
- {
193
- name: 'Plugin Architecture',
194
- indicators: ['plugins', 'extensions', 'addons'],
195
- type: 'architectural',
196
- },
197
- {
198
- name: 'Event-Driven',
199
- indicators: ['events', 'handlers', 'listeners', 'subscribers', 'publishers'],
200
- type: 'architectural',
201
- },
202
- ];
203
- // =====================================================
204
- // Tool Creation
205
- // =====================================================
206
- export function createLearnTools(workingDir) {
207
- return [
208
- createLearnCodebaseTool(workingDir),
209
- createLearnFileTool(workingDir),
210
- createLearnTopicTool(workingDir),
211
- createLearnSummaryTool(workingDir),
212
- ];
213
- }
214
- // =====================================================
215
- // learn_codebase Tool
216
- // =====================================================
217
- function createLearnCodebaseTool(workingDir) {
218
- return {
219
- name: 'learn_codebase',
220
- description: `Deprecated: use the explore tool for repo-wide or architectural deep dives.
221
- This legacy deep dive remains available for compatibility; prefer explore (or explore_index) first. Detailed mode is opt-in and heavier.`,
222
- parameters: {
223
- type: 'object',
224
- properties: {
225
- depth: {
226
- type: 'number',
227
- description: 'Maximum directory depth to analyze (default: 5)',
228
- },
229
- includeHidden: {
230
- type: 'boolean',
231
- description: 'Include hidden files/directories in analysis (default: false)',
232
- },
233
- focusPath: {
234
- type: 'string',
235
- description: 'Focus analysis on a specific subdirectory',
236
- },
237
- mode: {
238
- type: 'string',
239
- enum: ['concise', 'detailed'],
240
- description: 'Output mode: concise (default, context-safe) or detailed (full report)',
241
- },
242
- },
243
- additionalProperties: false,
244
- },
245
- cacheable: true,
246
- handler: async (args) => {
247
- try {
248
- const requestedDepth = typeof args['depth'] === 'number' ? args['depth'] : 5;
249
- const includeHidden = args['includeHidden'] === true;
250
- const focusPath = args['focusPath'];
251
- const mode = args['mode'] === 'detailed' ? 'detailed' : 'concise';
252
- const guardrails = createAnalysisGuardrails(requestedDepth, includeHidden, mode);
253
- const deprecatedNote = '⚠️ Deprecated: prefer the explore tool for deep repo discovery. This legacy deep-learn flow remains for compatibility.';
254
- const targetDir = focusPath ? resolveFilePath(workingDir, focusPath) : workingDir;
255
- if (!existsSync(targetDir)) {
256
- return `Error: Directory not found: ${targetDir}`;
257
- }
258
- const indexSnapshot = getRecentExploreIndexSnapshot(workingDir);
259
- if (mode === 'concise' && !focusPath && indexSnapshot?.fresh) {
260
- return `${deprecatedNote}\n\n${formatIndexPreflight(indexSnapshot)}`;
261
- }
262
- // Deep analysis with progressive output (concise by default to protect context)
263
- const analysis = await analyzeCodebaseDeep(targetDir, workingDir, guardrails.maxDepth, guardrails.includeHidden, guardrails);
264
- const body = mode === 'detailed'
265
- ? formatCodebaseAnalysis(analysis)
266
- : formatConciseCodebaseAnalysis(analysis);
267
- return `${deprecatedNote}\n\n${body}`;
268
- }
269
- catch (error) {
270
- return buildError('analyzing codebase', error, { workingDir });
271
- }
272
- },
273
- };
274
- }
275
- // =====================================================
276
- // learn_file Tool
277
- // =====================================================
278
- function createLearnFileTool(workingDir) {
279
- return {
280
- name: 'learn_file',
281
- description: `Deep-learn a specific file's purpose, structure, patterns, and relationships.
282
- This tool provides detailed analysis of a single file including:
283
- - File purpose and responsibilities
284
- - Imports and dependencies
285
- - Exports and public interface
286
- - Functions and classes with their purposes
287
- - Complexity metrics
288
- - Relationships to other files`,
289
- parameters: {
290
- type: 'object',
291
- properties: {
292
- path: {
293
- type: 'string',
294
- description: 'Path to the file to analyze',
295
- },
296
- includeRelationships: {
297
- type: 'boolean',
298
- description: 'Analyze relationships to other files (default: true)',
299
- },
300
- },
301
- required: ['path'],
302
- additionalProperties: false,
303
- },
304
- cacheable: true,
305
- handler: async (args) => {
306
- try {
307
- const filePath = resolveFilePath(workingDir, args['path']);
308
- const includeRelationships = args['includeRelationships'] !== false;
309
- if (!existsSync(filePath)) {
310
- return `Error: File not found: ${filePath}`;
311
- }
312
- const stat = statSync(filePath);
313
- if (stat.isDirectory()) {
314
- return `Error: Path is a directory, not a file: ${filePath}`;
315
- }
316
- const analysis = analyzeFile(filePath, workingDir, includeRelationships);
317
- return formatFileAnalysis(analysis);
318
- }
319
- catch (error) {
320
- return buildError('analyzing file', error, { path: String(args['path']) });
321
- }
322
- },
323
- };
324
- }
325
- // =====================================================
326
- // learn_topic Tool
327
- // =====================================================
328
- function createLearnTopicTool(workingDir) {
329
- return {
330
- name: 'learn_topic',
331
- description: `Learn about a specific topic, pattern, or concept within the codebase.
332
- Use this to understand how specific patterns are implemented, such as:
333
- - Authentication/authorization patterns
334
- - Error handling conventions
335
- - Data validation approaches
336
- - API design patterns
337
- - State management
338
- - Testing patterns
339
- - Any custom pattern or convention`,
340
- parameters: {
341
- type: 'object',
342
- properties: {
343
- topic: {
344
- type: 'string',
345
- description: 'The topic or pattern to learn about (e.g., "authentication", "error handling", "api routes")',
346
- },
347
- maxFiles: {
348
- type: 'number',
349
- description: 'Maximum number of relevant files to analyze (default: 10)',
350
- },
351
- maxExamples: {
352
- type: 'number',
353
- description: 'Maximum number of code examples to include (default: 5)',
354
- },
355
- },
356
- required: ['topic'],
357
- additionalProperties: false,
358
- },
359
- cacheable: true,
360
- handler: async (args) => {
361
- try {
362
- const topic = args['topic'];
363
- const maxFiles = typeof args['maxFiles'] === 'number' ? args['maxFiles'] : 10;
364
- const maxExamples = typeof args['maxExamples'] === 'number' ? args['maxExamples'] : 5;
365
- if (!topic || !topic.trim()) {
366
- return 'Error: topic must be a non-empty string';
367
- }
368
- const analysis = analyzeTopic(workingDir, topic.trim(), maxFiles, maxExamples);
369
- return formatTopicAnalysis(analysis);
370
- }
371
- catch (error) {
372
- return buildError('analyzing topic', error, { topic: String(args['topic']) });
373
- }
374
- },
375
- };
376
- }
377
- // =====================================================
378
- // learn_summary Tool
379
- // =====================================================
380
- function createLearnSummaryTool(workingDir) {
381
- return {
382
- name: 'learn_summary',
383
- description: `Generate a learning summary for the codebase suitable for onboarding.
384
- This creates a comprehensive summary including:
385
- - Quick start guide
386
- - Key concepts and terminology
387
- - Architecture overview
388
- - Important files and their purposes
389
- - Common patterns and conventions
390
- - Development workflow suggestions`,
391
- parameters: {
392
- type: 'object',
393
- properties: {
394
- format: {
395
- type: 'string',
396
- description: 'Output format: "markdown" (default) or "text"',
397
- enum: ['markdown', 'text'],
398
- },
399
- focus: {
400
- type: 'string',
401
- description: 'Focus area for the summary (e.g., "frontend", "backend", "api")',
402
- },
403
- },
404
- additionalProperties: false,
405
- },
406
- cacheable: true,
407
- handler: async (args) => {
408
- try {
409
- const format = args['format'] || 'markdown';
410
- const focus = args['focus'];
411
- const analysis = analyzeCodebase(workingDir, workingDir, 4, false);
412
- return formatLearningSummary(analysis, format, focus);
413
- }
414
- catch (error) {
415
- return buildError('generating learning summary', error, { workingDir });
416
- }
417
- },
418
- };
419
- }
420
- // =====================================================
421
- // Analysis Functions
422
- // =====================================================
423
- /**
424
- * Deep codebase analysis with thorough exploration.
425
- * Does actual file content analysis for better insights.
426
- */
427
- async function analyzeCodebaseDeep(targetDir, workingDir, maxDepth, includeHidden, guardrails) {
428
- const files = [];
429
- const directories = [];
430
- const configFiles = [];
431
- const limits = guardrails ?? createAnalysisGuardrails(maxDepth, includeHidden, 'detailed');
432
- // Phase 1: Directory structure traversal
433
- const structure = buildDirectoryTree(targetDir, workingDir, 0, limits.maxDepth, limits.includeHidden, files, directories, configFiles, limits);
434
- // Phase 2: File type detection and language breakdown
435
- const languageCounts = new Map();
436
- for (const file of files) {
437
- const lang = LANGUAGE_MAP[file.ext] || 'Other';
438
- const existing = languageCounts.get(lang) || { ext: file.ext, count: 0 };
439
- existing.count++;
440
- languageCounts.set(lang, existing);
441
- }
442
- const totalFiles = files.length;
443
- const languages = Array.from(languageCounts.entries())
444
- .map(([language, data]) => ({
445
- language,
446
- extension: data.ext,
447
- fileCount: data.count,
448
- percentage: totalFiles > 0 ? (data.count / totalFiles) * 100 : 0,
449
- }))
450
- .sort((a, b) => b.fileCount - a.fileCount);
451
- // Phase 3: Architecture pattern detection
452
- const dirNames = directories.map((d) => basename(d).toLowerCase());
453
- const patterns = detectPatterns(dirNames, files.map((f) => f.path));
454
- // Phase 4: Configuration file analysis with deep inspection
455
- const configDetails = analyzeConfigFilesDeep(configFiles, targetDir);
456
- // Phase 5: Dependency analysis
457
- const dependencies = analyzeDependencies(targetDir);
458
- // Phase 6: Entry point identification
459
- const entryPoints = findEntryPoints(files.map((f) => f.path), configFiles);
460
- // Phase 7: Component and layer mapping
461
- const architecture = buildArchitectureInsights(patterns, dirNames, targetDir, workingDir);
462
- // Phase 8: Deep source file analysis for patterns and complexity
463
- const keyFiles = files
464
- .filter(f => LANGUAGE_MAP[f.ext] && f.size < 100000)
465
- .slice(0, 50);
466
- const codePatterns = new Map();
467
- let totalComplexity = 0;
468
- let analyzedFiles = 0;
469
- for (const file of keyFiles) {
470
- try {
471
- const fullPath = join(workingDir, file.path);
472
- const content = readFileSync(fullPath, 'utf-8');
473
- const filePatterns = detectCodePatterns(content, file.ext);
474
- // Accumulate pattern counts
475
- for (const pattern of filePatterns) {
476
- codePatterns.set(pattern, (codePatterns.get(pattern) || 0) + 1);
477
- }
478
- // Calculate complexity metrics
479
- const complexity = calculateComplexity(content);
480
- totalComplexity += complexity.cyclomaticComplexity;
481
- analyzedFiles++;
482
- }
483
- catch {
484
- // Skip unreadable files
485
- }
486
- }
487
- // Add detected code patterns to the patterns list
488
- for (const [patternName, count] of codePatterns.entries()) {
489
- if (count >= 3) { // Only include patterns found in multiple files
490
- patterns.push({
491
- name: patternName,
492
- type: 'design',
493
- description: `Found ${patternName} pattern in ${count} files`,
494
- evidence: [`Detected in ${count} source files`],
495
- confidence: count >= 10 ? 'high' : count >= 5 ? 'medium' : 'low',
496
- });
497
- }
498
- }
499
- return {
500
- rootDir: relative(workingDir, targetDir) || '.',
501
- totalFiles,
502
- totalDirectories: directories.length,
503
- languages,
504
- structure,
505
- patterns,
506
- architecture,
507
- entryPoints,
508
- configFiles: configDetails,
509
- dependencies,
510
- guardrails: limits,
511
- };
512
- }
513
- function analyzeConfigFilesDeep(configs, targetDir) {
514
- // Enhance config info with actual content analysis where useful
515
- return configs.map(config => {
516
- try {
517
- const fullPath = join(targetDir, config.path);
518
- if (config.name === 'package.json' && existsSync(fullPath)) {
519
- const content = JSON.parse(readFileSync(fullPath, 'utf-8'));
520
- const scripts = Object.keys(content.scripts || {}).slice(0, 5);
521
- if (scripts.length > 0) {
522
- return {
523
- ...config,
524
- purpose: `${config.purpose} (scripts: ${scripts.join(', ')})`,
525
- };
526
- }
527
- }
528
- }
529
- catch {
530
- // Keep original
531
- }
532
- return config;
533
- });
534
- }
535
- function analyzeCodebase(targetDir, workingDir, maxDepth, includeHidden, guardrails) {
536
- const files = [];
537
- const directories = [];
538
- const configFiles = [];
539
- const limits = guardrails ?? createAnalysisGuardrails(maxDepth, includeHidden, 'concise');
540
- // Build directory tree and collect files
541
- const structure = buildDirectoryTree(targetDir, workingDir, 0, limits.maxDepth, limits.includeHidden, files, directories, configFiles, limits);
542
- // Calculate language breakdown
543
- const languageCounts = new Map();
544
- for (const file of files) {
545
- const lang = LANGUAGE_MAP[file.ext] || 'Other';
546
- const existing = languageCounts.get(lang) || { ext: file.ext, count: 0 };
547
- existing.count++;
548
- languageCounts.set(lang, existing);
549
- }
550
- const totalFiles = files.length;
551
- const languages = Array.from(languageCounts.entries())
552
- .map(([language, data]) => ({
553
- language,
554
- extension: data.ext,
555
- fileCount: data.count,
556
- percentage: totalFiles > 0 ? (data.count / totalFiles) * 100 : 0,
557
- }))
558
- .sort((a, b) => b.fileCount - a.fileCount);
559
- // Detect architecture patterns
560
- const dirNames = directories.map((d) => basename(d).toLowerCase());
561
- const patterns = detectPatterns(dirNames, files.map((f) => f.path));
562
- // Build architecture insights
563
- const architecture = buildArchitectureInsights(patterns, dirNames, targetDir, workingDir);
564
- // Find entry points
565
- const entryPoints = findEntryPoints(files.map((f) => f.path), configFiles);
566
- // Analyze dependencies
567
- const dependencies = analyzeDependencies(targetDir);
568
- return {
569
- rootDir: relative(workingDir, targetDir) || '.',
570
- totalFiles,
571
- totalDirectories: directories.length,
572
- languages,
573
- structure,
574
- patterns,
575
- architecture,
576
- entryPoints,
577
- configFiles,
578
- dependencies,
579
- guardrails: limits,
580
- };
581
- }
582
- function buildDirectoryTree(dir, workingDir, depth, maxDepth, includeHidden, files, directories, configFiles, guardrails) {
583
- const name = basename(dir) || dir;
584
- const relPath = relative(workingDir, dir) || '.';
585
- const node = {
586
- name,
587
- path: relPath,
588
- type: 'directory',
589
- children: [],
590
- };
591
- if (depth >= maxDepth) {
592
- return node;
593
- }
594
- try {
595
- const entries = readdirSync(dir, { withFileTypes: true });
596
- for (const entry of entries) {
597
- if (guardrails.truncated) {
598
- break;
599
- }
600
- // Skip hidden files/dirs if not requested
601
- if (!includeHidden && entry.name.startsWith('.')) {
602
- continue;
603
- }
604
- // Skip ignored directories
605
- if (IGNORED_DIRS.has(entry.name)) {
606
- continue;
607
- }
608
- const fullPath = join(dir, entry.name);
609
- const entryRelPath = relative(workingDir, fullPath);
610
- if (entry.isDirectory()) {
611
- if (!consumeGuardrailSlot(guardrails, 'node_limit'))
612
- break;
613
- directories.push(fullPath);
614
- const childNode = buildDirectoryTree(fullPath, workingDir, depth + 1, maxDepth, includeHidden, files, directories, configFiles, guardrails);
615
- node.children.push(childNode);
616
- }
617
- else if (entry.isFile()) {
618
- if (!consumeGuardrailSlot(guardrails, 'node_limit'))
619
- break;
620
- try {
621
- const stat = statSync(fullPath);
622
- const ext = extname(entry.name).toLowerCase();
623
- const language = LANGUAGE_MAP[ext];
624
- files.push({ path: entryRelPath, ext, size: stat.size });
625
- // Check if it's a config file
626
- const configInfo = CONFIG_FILES[entry.name];
627
- if (configInfo) {
628
- configFiles.push({
629
- name: entry.name,
630
- path: entryRelPath,
631
- type: configInfo.type,
632
- purpose: configInfo.purpose,
633
- });
634
- }
635
- node.children.push({
636
- name: entry.name,
637
- path: entryRelPath,
638
- type: 'file',
639
- size: stat.size,
640
- language,
641
- });
642
- }
643
- catch {
644
- // Skip files we can't stat
645
- }
646
- }
647
- }
648
- }
649
- catch {
650
- // Skip directories we can't read
651
- }
652
- return node;
653
- }
654
- function consumeGuardrailSlot(guardrails, reason) {
655
- if (guardrails.nodeCount >= guardrails.nodeLimit) {
656
- guardrails.truncated = true;
657
- guardrails.truncatedReason = guardrails.truncatedReason ?? reason;
658
- return false;
659
- }
660
- guardrails.nodeCount += 1;
661
- return true;
662
- }
663
- function detectPatterns(dirNames, filePaths) {
664
- const patterns = [];
665
- const dirNameSet = new Set(dirNames);
666
- const filePathsLower = filePaths.map((p) => p.toLowerCase());
667
- for (const pattern of ARCHITECTURE_PATTERNS) {
668
- const matches = pattern.indicators.filter((ind) => dirNameSet.has(ind));
669
- if (matches.length >= 2 || (matches.length >= 1 && pattern.indicators.length <= 2)) {
670
- const confidence = matches.length >= 3 ? 'high' : matches.length >= 2 ? 'medium' : 'low';
671
- patterns.push({
672
- name: pattern.name,
673
- type: pattern.type,
674
- description: `Detected ${pattern.name} pattern based on directory structure`,
675
- evidence: matches.map((m) => `Found "${m}" directory`),
676
- confidence,
677
- });
678
- }
679
- }
680
- // Detect naming conventions
681
- const hasKebabCase = filePathsLower.some((p) => /[a-z]+-[a-z]+/.test(basename(p)));
682
- const hasCamelCase = filePaths.some((p) => /[a-z]+[A-Z][a-z]+/.test(basename(p)));
683
- const hasPascalCase = filePaths.some((p) => /^[A-Z][a-z]+[A-Z]/.test(basename(p)));
684
- const hasSnakeCase = filePathsLower.some((p) => /[a-z]+_[a-z]+/.test(basename(p)));
685
- const namingConventions = [];
686
- if (hasKebabCase)
687
- namingConventions.push('kebab-case');
688
- if (hasCamelCase)
689
- namingConventions.push('camelCase');
690
- if (hasPascalCase)
691
- namingConventions.push('PascalCase');
692
- if (hasSnakeCase)
693
- namingConventions.push('snake_case');
694
- if (namingConventions.length > 0) {
695
- patterns.push({
696
- name: 'File Naming Convention',
697
- type: 'naming',
698
- description: `Uses ${namingConventions.join(', ')} naming convention(s)`,
699
- evidence: namingConventions.map((n) => `Detected ${n} pattern in filenames`),
700
- confidence: 'medium',
701
- });
702
- }
703
- // Detect test patterns
704
- const hasTestDir = dirNameSet.has('test') || dirNameSet.has('tests') || dirNameSet.has('__tests__');
705
- const hasSpecFiles = filePathsLower.some((p) => p.includes('.spec.') || p.includes('.test.'));
706
- if (hasTestDir || hasSpecFiles) {
707
- patterns.push({
708
- name: 'Testing Structure',
709
- type: 'structural',
710
- description: hasTestDir
711
- ? 'Uses dedicated test directory'
712
- : 'Uses co-located test files (.spec/.test)',
713
- evidence: hasTestDir
714
- ? ['Found test/tests/__tests__ directory']
715
- : ['Found .spec or .test files alongside source'],
716
- confidence: 'high',
717
- });
718
- }
719
- return patterns;
720
- }
721
- function buildArchitectureInsights(patterns, dirNames, targetDir, workingDir) {
722
- const archPattern = patterns.find((p) => p.type === 'architectural');
723
- const type = archPattern?.name || 'Custom/Unknown';
724
- const layers = [];
725
- const components = [];
726
- // Identify layers based on common directory names
727
- const layerDirs = ['api', 'routes', 'controllers', 'services', 'models', 'views', 'components', 'utils', 'lib', 'core'];
728
- for (const layer of layerDirs) {
729
- if (dirNames.includes(layer)) {
730
- layers.push(layer);
731
- }
732
- }
733
- // Build component info from top-level directories
734
- try {
735
- const entries = readdirSync(targetDir, { withFileTypes: true });
736
- for (const entry of entries) {
737
- if (entry.isDirectory() && !IGNORED_DIRS.has(entry.name) && !entry.name.startsWith('.')) {
738
- const componentPath = relative(workingDir, join(targetDir, entry.name));
739
- components.push({
740
- name: entry.name,
741
- type: inferComponentType(entry.name),
742
- path: componentPath,
743
- responsibilities: inferResponsibilities(entry.name),
744
- });
745
- }
746
- }
747
- }
748
- catch {
749
- // Ignore errors
750
- }
751
- const dataFlow = inferDataFlow(layers, type);
752
- return {
753
- type,
754
- layers,
755
- components,
756
- dataFlow,
757
- };
758
- }
759
- function inferComponentType(name) {
760
- const lower = name.toLowerCase();
761
- if (['api', 'routes', 'controllers', 'handlers'].includes(lower))
762
- return 'API Layer';
763
- if (['services', 'business', 'domain'].includes(lower))
764
- return 'Business Logic';
765
- if (['models', 'entities', 'schemas'].includes(lower))
766
- return 'Data Models';
767
- if (['views', 'pages', 'screens'].includes(lower))
768
- return 'Presentation';
769
- if (['components', 'ui'].includes(lower))
770
- return 'UI Components';
771
- if (['utils', 'helpers', 'lib', 'common', 'shared'].includes(lower))
772
- return 'Utilities';
773
- if (['config', 'configs', 'settings'].includes(lower))
774
- return 'Configuration';
775
- if (['test', 'tests', '__tests__', 'spec'].includes(lower))
776
- return 'Testing';
777
- if (['types', 'interfaces', 'contracts'].includes(lower))
778
- return 'Type Definitions';
779
- if (['middleware', 'middlewares'].includes(lower))
780
- return 'Middleware';
781
- if (['plugins', 'extensions', 'addons'].includes(lower))
782
- return 'Extensions';
783
- return 'Module';
784
- }
785
- function inferResponsibilities(name) {
786
- const lower = name.toLowerCase();
787
- const responsibilities = [];
788
- if (['api', 'routes'].includes(lower)) {
789
- responsibilities.push('HTTP request handling', 'Route definitions', 'Request/response processing');
790
- }
791
- else if (lower === 'controllers') {
792
- responsibilities.push('Request handling', 'Input validation', 'Response formatting');
793
- }
794
- else if (lower === 'services') {
795
- responsibilities.push('Business logic', 'Data orchestration', 'External integrations');
796
- }
797
- else if (lower === 'models') {
798
- responsibilities.push('Data structures', 'Database schemas', 'Data validation');
799
- }
800
- else if (['views', 'pages'].includes(lower)) {
801
- responsibilities.push('UI rendering', 'Page composition', 'Layout management');
802
- }
803
- else if (lower === 'components') {
804
- responsibilities.push('Reusable UI elements', 'Component logic', 'State management');
805
- }
806
- else if (['utils', 'helpers'].includes(lower)) {
807
- responsibilities.push('Utility functions', 'Common helpers', 'Shared logic');
808
- }
809
- return responsibilities.length > 0 ? responsibilities : ['Module functionality'];
810
- }
811
- function inferDataFlow(layers, archType) {
812
- if (archType.includes('MVC')) {
813
- return ['Request → Controller → Model → View → Response'];
814
- }
815
- if (archType.includes('Clean')) {
816
- return [
817
- 'External → Controllers → Use Cases → Entities',
818
- 'Entities → Use Cases → Presenters → External',
819
- ];
820
- }
821
- if (archType.includes('Layered')) {
822
- return ['API → Services → Repositories → Database'];
823
- }
824
- if (layers.length > 0) {
825
- return [`Request → ${layers.join(' → ')} → Response`];
826
- }
827
- return ['Standard request/response flow'];
828
- }
829
- function findEntryPoints(filePaths, configFiles) {
830
- const entryPoints = [];
831
- // Check for common entry point patterns
832
- const entryPatterns = [
833
- 'index.ts',
834
- 'index.js',
835
- 'main.ts',
836
- 'main.js',
837
- 'app.ts',
838
- 'app.js',
839
- 'server.ts',
840
- 'server.js',
841
- 'cli.ts',
842
- 'cli.js',
843
- '__main__.py',
844
- 'main.py',
845
- 'app.py',
846
- 'manage.py',
847
- 'main.go',
848
- 'main.rs',
849
- 'lib.rs',
850
- ];
851
- for (const pattern of entryPatterns) {
852
- const match = filePaths.find((p) => basename(p) === pattern || p.endsWith(`/src/${pattern}`) || p.endsWith(`/bin/${pattern}`));
853
- if (match) {
854
- entryPoints.push(match);
855
- }
856
- }
857
- // Check package.json for main/bin
858
- const pkgJson = configFiles.find((c) => c.name === 'package.json');
859
- if (pkgJson) {
860
- entryPoints.push(`${pkgJson.path} (see "main" or "bin" fields)`);
861
- }
862
- return [...new Set(entryPoints)];
863
- }
864
- function analyzeDependencies(dir) {
865
- const result = {
866
- dependencies: [],
867
- devDependencies: [],
868
- hasDependencyFile: false,
869
- };
870
- // Check package.json
871
- const pkgPath = join(dir, 'package.json');
872
- if (existsSync(pkgPath)) {
873
- try {
874
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
875
- result.packageManager = 'npm';
876
- result.hasDependencyFile = true;
877
- result.dependencies = Object.keys(pkg.dependencies || {}).slice(0, 20);
878
- result.devDependencies = Object.keys(pkg.devDependencies || {}).slice(0, 20);
879
- }
880
- catch {
881
- // Ignore parse errors
882
- }
883
- }
884
- // Check pyproject.toml
885
- const pyprojectPath = join(dir, 'pyproject.toml');
886
- if (existsSync(pyprojectPath)) {
887
- result.packageManager = result.packageManager || 'pip';
888
- result.hasDependencyFile = true;
889
- // Basic TOML parsing for dependencies
890
- try {
891
- const content = readFileSync(pyprojectPath, 'utf-8');
892
- const depMatch = content.match(/dependencies\s*=\s*\[([\s\S]*?)\]/);
893
- if (depMatch && depMatch[1]) {
894
- const deps = depMatch[1].match(/"([^"]+)"/g) || [];
895
- result.dependencies = deps.map((d) => d.replace(/"/g, '').split(/[<>=!]/)[0]?.trim() ?? '').slice(0, 20);
896
- }
897
- }
898
- catch {
899
- // Ignore parse errors
900
- }
901
- }
902
- // Check Cargo.toml
903
- const cargoPath = join(dir, 'Cargo.toml');
904
- if (existsSync(cargoPath)) {
905
- result.packageManager = 'cargo';
906
- result.hasDependencyFile = true;
907
- }
908
- // Check go.mod
909
- const goModPath = join(dir, 'go.mod');
910
- if (existsSync(goModPath)) {
911
- result.packageManager = 'go modules';
912
- result.hasDependencyFile = true;
913
- }
914
- return result;
915
- }
916
- function analyzeFile(filePath, workingDir, includeRelationships) {
917
- const content = readFileSync(filePath, 'utf-8');
918
- const lines = content.split('\n');
919
- const ext = extname(filePath).toLowerCase();
920
- const language = LANGUAGE_MAP[ext] || 'Unknown';
921
- const relPath = relative(workingDir, filePath);
922
- const imports = extractImports(content, ext);
923
- const exports = extractExports(content, ext);
924
- const functions = extractFunctions(content, ext);
925
- const classes = extractClasses(content, ext);
926
- const patterns = detectCodePatterns(content, ext);
927
- const complexity = calculateComplexity(content);
928
- const purpose = inferFilePurpose(basename(filePath), content, imports, exports, functions, classes);
929
- const relationships = [];
930
- if (includeRelationships) {
931
- // Build relationships from imports
932
- for (const imp of imports) {
933
- if (imp.isRelative) {
934
- relationships.push({
935
- targetFile: imp.resolvedPath || imp.source,
936
- type: 'imports',
937
- symbols: imp.specifiers,
938
- });
939
- }
940
- }
941
- }
942
- return {
943
- path: relPath,
944
- language,
945
- size: content.length,
946
- lineCount: lines.length,
947
- purpose,
948
- imports,
949
- exports,
950
- functions,
951
- classes,
952
- patterns,
953
- relationships,
954
- complexity,
955
- };
956
- }
957
- function extractImports(content, ext) {
958
- const imports = [];
959
- if (['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
960
- // ES6 imports
961
- const importRegex = /import\s+(?:(\*\s+as\s+\w+)|(\{[^}]+\})|(\w+)(?:\s*,\s*\{([^}]+)\})?)\s+from\s+['"]([^'"]+)['"]/g;
962
- let match;
963
- while ((match = importRegex.exec(content)) !== null) {
964
- const source = match[5] || '';
965
- let specifiers = [];
966
- if (match[1]) {
967
- // namespace import
968
- specifiers = [match[1].trim()];
969
- }
970
- else if (match[2]) {
971
- // named imports
972
- specifiers = match[2]
973
- .replace(/[{}]/g, '')
974
- .split(',')
975
- .map((s) => s.trim())
976
- .filter(Boolean);
977
- }
978
- else if (match[3]) {
979
- // default import
980
- specifiers = [match[3]];
981
- if (match[4]) {
982
- // additional named imports
983
- specifiers.push(...match[4]
984
- .split(',')
985
- .map((s) => s.trim())
986
- .filter(Boolean));
987
- }
988
- }
989
- imports.push({
990
- source,
991
- specifiers,
992
- isRelative: source.startsWith('.') || source.startsWith('/'),
993
- });
994
- }
995
- // CommonJS requires
996
- const requireRegex = /(?:const|let|var)\s+(?:(\{[^}]+\})|(\w+))\s*=\s*require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
997
- while ((match = requireRegex.exec(content)) !== null) {
998
- const source = match[3] || '';
999
- let specifiers = [];
1000
- if (match[1]) {
1001
- specifiers = match[1]
1002
- .replace(/[{}]/g, '')
1003
- .split(',')
1004
- .map((s) => s.trim())
1005
- .filter(Boolean);
1006
- }
1007
- else if (match[2]) {
1008
- specifiers = [match[2]];
1009
- }
1010
- imports.push({
1011
- source,
1012
- specifiers,
1013
- isRelative: source.startsWith('.') || source.startsWith('/'),
1014
- });
1015
- }
1016
- }
1017
- else if (ext === '.py') {
1018
- // Python imports
1019
- const fromImportRegex = /from\s+([^\s]+)\s+import\s+(.+)/g;
1020
- let match;
1021
- while ((match = fromImportRegex.exec(content)) !== null) {
1022
- const source = match[1] ?? '';
1023
- const specifiers = (match[2] ?? '')
1024
- .split(',')
1025
- .map((s) => s.trim().split(' as ')[0]?.trim() ?? '')
1026
- .filter(Boolean);
1027
- imports.push({
1028
- source,
1029
- specifiers,
1030
- isRelative: source.startsWith('.'),
1031
- });
1032
- }
1033
- const importRegex = /^import\s+([^\s,]+(?:\s*,\s*[^\s,]+)*)/gm;
1034
- while ((match = importRegex.exec(content)) !== null) {
1035
- const modules = (match[1] ?? '').split(',').map((s) => s.trim().split(' as ')[0]?.trim() ?? '');
1036
- for (const mod of modules) {
1037
- if (mod) {
1038
- imports.push({
1039
- source: mod,
1040
- specifiers: [mod],
1041
- isRelative: mod.startsWith('.'),
1042
- });
1043
- }
1044
- }
1045
- }
1046
- }
1047
- return imports;
1048
- }
1049
- function extractExports(content, ext) {
1050
- const exports = [];
1051
- if (['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
1052
- // Export default
1053
- const defaultMatch = content.match(/export\s+default\s+(?:class|function)?\s*(\w+)?/);
1054
- if (defaultMatch) {
1055
- exports.push({
1056
- name: defaultMatch[1] || 'default',
1057
- type: 'default',
1058
- });
1059
- }
1060
- // Named exports
1061
- const namedExportRegex = /export\s+(?:const|let|var|function|class|interface|type|enum)\s+(\w+)/g;
1062
- let match;
1063
- while ((match = namedExportRegex.exec(content)) !== null) {
1064
- const name = match[1] || '';
1065
- const line = content.substring(0, match.index).split('\n').length;
1066
- const lineContent = content.split('\n')[line - 1] || '';
1067
- let type = 'named';
1068
- if (lineContent.includes('interface'))
1069
- type = 'interface';
1070
- else if (lineContent.includes('type'))
1071
- type = 'type';
1072
- else if (lineContent.includes('class'))
1073
- type = 'class';
1074
- else if (lineContent.includes('function'))
1075
- type = 'function';
1076
- exports.push({ name, type });
1077
- }
1078
- // Re-exports
1079
- const reExportRegex = /export\s+\{([^}]+)\}\s+from/g;
1080
- while ((match = reExportRegex.exec(content)) !== null) {
1081
- const names = (match[1] ?? '').split(',').map((s) => s.trim().split(' as ')[0]?.trim() ?? '');
1082
- for (const name of names) {
1083
- if (name) {
1084
- exports.push({ name, type: 'named' });
1085
- }
1086
- }
1087
- }
1088
- }
1089
- else if (ext === '.py') {
1090
- // Python __all__
1091
- const allMatch = content.match(/__all__\s*=\s*\[([\s\S]*?)\]/);
1092
- if (allMatch && allMatch[1]) {
1093
- const names = (allMatch[1].match(/['"]([^'"]+)['"]/g) || []).map((s) => s.replace(/['"]/g, ''));
1094
- for (const name of names) {
1095
- exports.push({ name, type: 'named' });
1096
- }
1097
- }
1098
- // Public functions/classes (not starting with _)
1099
- const defRegex = /^(?:def|class)\s+([a-zA-Z][a-zA-Z0-9_]*)/gm;
1100
- let match;
1101
- while ((match = defRegex.exec(content)) !== null) {
1102
- const name = match[1] || '';
1103
- if (!name.startsWith('_')) {
1104
- const lineContent = content.split('\n')[content.substring(0, match.index).split('\n').length - 1] || '';
1105
- exports.push({
1106
- name,
1107
- type: lineContent.startsWith('class') ? 'class' : 'function',
1108
- });
1109
- }
1110
- }
1111
- }
1112
- return exports;
1113
- }
1114
- function extractFunctions(content, ext) {
1115
- const functions = [];
1116
- if (['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
1117
- // Regular functions
1118
- const funcRegex = /(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)(?:\s*:\s*([^{]+))?\s*\{/g;
1119
- let match;
1120
- while ((match = funcRegex.exec(content)) !== null) {
1121
- const name = match[1] || '';
1122
- const params = (match[2] || '').split(',').map((p) => p.trim().split(':')[0]?.trim() ?? '').filter(Boolean);
1123
- const returnType = (match[3] || '').trim() || undefined;
1124
- const line = content.substring(0, match.index).split('\n').length;
1125
- const isAsync = content.substring(match.index - 20, match.index).includes('async');
1126
- const isExported = content.substring(match.index - 20, match.index).includes('export');
1127
- functions.push({
1128
- name,
1129
- line,
1130
- parameters: params,
1131
- returnType,
1132
- isAsync,
1133
- isExported,
1134
- complexity: 1,
1135
- });
1136
- }
1137
- // Arrow functions
1138
- const arrowRegex = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\(?([^)=]*)\)?\s*(?::\s*([^=]+))?\s*=>/g;
1139
- while ((match = arrowRegex.exec(content)) !== null) {
1140
- const name = match[1] || '';
1141
- const params = (match[2] || '').split(',').map((p) => p.trim().split(':')[0]?.trim() ?? '').filter(Boolean);
1142
- const returnType = (match[3] || '').trim() || undefined;
1143
- const line = content.substring(0, match.index).split('\n').length;
1144
- const isAsync = content.substring(match.index, match.index + 50).includes('async');
1145
- const isExported = content.substring(match.index - 20, match.index).includes('export');
1146
- functions.push({
1147
- name,
1148
- line,
1149
- parameters: params,
1150
- returnType,
1151
- isAsync,
1152
- isExported,
1153
- complexity: 1,
1154
- });
1155
- }
1156
- }
1157
- else if (ext === '.py') {
1158
- const defRegex = /(?:async\s+)?def\s+(\w+)\s*\(([^)]*)\)(?:\s*->\s*([^:]+))?\s*:/g;
1159
- let match;
1160
- while ((match = defRegex.exec(content)) !== null) {
1161
- const name = match[1] ?? '';
1162
- const params = (match[2] ?? '')
1163
- .split(',')
1164
- .map((p) => (p.trim().split(':')[0]?.split('=')[0]?.trim()) ?? '')
1165
- .filter((p) => p && p !== 'self' && p !== 'cls');
1166
- const returnType = (match[3] || '').trim() || undefined;
1167
- const line = content.substring(0, match.index).split('\n').length;
1168
- const isAsync = content.substring(match.index - 10, match.index).includes('async');
1169
- functions.push({
1170
- name,
1171
- line,
1172
- parameters: params,
1173
- returnType,
1174
- isAsync,
1175
- isExported: !name.startsWith('_'),
1176
- complexity: 1,
1177
- });
1178
- }
1179
- }
1180
- return functions;
1181
- }
1182
- function extractClasses(content, ext) {
1183
- const classes = [];
1184
- if (['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
1185
- const classRegex = /(?:export\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?(?:\s+implements\s+([^{]+))?\s*\{/g;
1186
- let match;
1187
- while ((match = classRegex.exec(content)) !== null) {
1188
- const name = match[1] || '';
1189
- const line = content.substring(0, match.index).split('\n').length;
1190
- const extendsClass = match[2];
1191
- const implementsList = match[3]
1192
- ? match[3]
1193
- .split(',')
1194
- .map((s) => s.trim())
1195
- .filter(Boolean)
1196
- : undefined;
1197
- const isExported = content.substring(match.index - 20, match.index).includes('export');
1198
- // Find class body and extract methods/properties
1199
- const classStart = match.index + match[0].length;
1200
- let braceCount = 1;
1201
- let classEnd = classStart;
1202
- for (let i = classStart; i < content.length && braceCount > 0; i++) {
1203
- if (content[i] === '{')
1204
- braceCount++;
1205
- if (content[i] === '}')
1206
- braceCount--;
1207
- classEnd = i;
1208
- }
1209
- const classBody = content.substring(classStart, classEnd);
1210
- const methods = [];
1211
- const properties = [];
1212
- // Extract methods
1213
- const methodRegex = /(?:async\s+)?(?:public|private|protected)?\s*(\w+)\s*\([^)]*\)/g;
1214
- let methodMatch;
1215
- while ((methodMatch = methodRegex.exec(classBody)) !== null) {
1216
- if (methodMatch[1] && methodMatch[1] !== 'constructor') {
1217
- methods.push(methodMatch[1]);
1218
- }
1219
- }
1220
- // Extract properties
1221
- const propRegex = /(?:public|private|protected|readonly)?\s+(\w+)\s*[:=]/g;
1222
- let propMatch;
1223
- while ((propMatch = propRegex.exec(classBody)) !== null) {
1224
- if (propMatch[1]) {
1225
- properties.push(propMatch[1]);
1226
- }
1227
- }
1228
- classes.push({
1229
- name,
1230
- line,
1231
- methods,
1232
- properties,
1233
- extends: extendsClass,
1234
- implements: implementsList,
1235
- isExported,
1236
- });
1237
- }
1238
- }
1239
- else if (ext === '.py') {
1240
- const classRegex = /class\s+(\w+)(?:\s*\(([^)]*)\))?\s*:/g;
1241
- let match;
1242
- while ((match = classRegex.exec(content)) !== null) {
1243
- const name = match[1] || '';
1244
- const line = content.substring(0, match.index).split('\n').length;
1245
- const parentClasses = match[2]
1246
- ? match[2]
1247
- .split(',')
1248
- .map((s) => s.trim())
1249
- .filter(Boolean)
1250
- : [];
1251
- classes.push({
1252
- name,
1253
- line,
1254
- methods: [],
1255
- properties: [],
1256
- extends: parentClasses[0],
1257
- implements: parentClasses.slice(1),
1258
- isExported: !name.startsWith('_'),
1259
- });
1260
- }
1261
- }
1262
- return classes;
1263
- }
1264
- function detectCodePatterns(content, _ext) {
1265
- const patterns = [];
1266
- // Common patterns detection
1267
- if (/async\s+function|async\s+\(|await\s+/.test(content)) {
1268
- patterns.push('Async/Await');
1269
- }
1270
- if (/Promise\.all|Promise\.race|Promise\.allSettled/.test(content)) {
1271
- patterns.push('Promise Combinators');
1272
- }
1273
- if (/try\s*\{[\s\S]*?\}\s*catch/.test(content)) {
1274
- patterns.push('Try-Catch Error Handling');
1275
- }
1276
- if (/\.map\s*\(|\.filter\s*\(|\.reduce\s*\(/.test(content)) {
1277
- patterns.push('Functional Array Methods');
1278
- }
1279
- if (/Object\.freeze|Object\.seal|readonly\s+/.test(content)) {
1280
- patterns.push('Immutability');
1281
- }
1282
- if (/interface\s+\w+|type\s+\w+\s*=/.test(content)) {
1283
- patterns.push('TypeScript Types');
1284
- }
1285
- if (/\bclass\s+\w+/.test(content)) {
1286
- patterns.push('Object-Oriented');
1287
- }
1288
- if (/export\s+default|export\s+\{|module\.exports/.test(content)) {
1289
- patterns.push('Module Pattern');
1290
- }
1291
- if (/\.test\(|\.spec\.|describe\s*\(|it\s*\(|expect\s*\(/.test(content)) {
1292
- patterns.push('Testing');
1293
- }
1294
- if (/console\.(log|error|warn|debug)/.test(content)) {
1295
- patterns.push('Console Logging');
1296
- }
1297
- if (/@decorator|@\w+\s*\(|@\w+\s*\n/.test(content)) {
1298
- patterns.push('Decorators');
1299
- }
1300
- if (/useEffect|useState|useCallback|useMemo/.test(content)) {
1301
- patterns.push('React Hooks');
1302
- }
1303
- if (/createSlice|createReducer|createAction/.test(content)) {
1304
- patterns.push('Redux Toolkit');
1305
- }
1306
- return patterns;
1307
- }
1308
- function calculateComplexity(content) {
1309
- const lines = content.split('\n');
1310
- const linesOfCode = lines.filter((l) => l.trim() && !l.trim().startsWith('//')).length;
1311
- const linesOfComments = lines.filter((l) => l.trim().startsWith('//')).length;
1312
- // Simple cyclomatic complexity estimation
1313
- let cyclomaticComplexity = 1;
1314
- const controlFlowPatterns = /\bif\b|\belse\b|\bfor\b|\bwhile\b|\bcase\b|\bcatch\b|\b\?\s*:/g;
1315
- const matches = content.match(controlFlowPatterns);
1316
- if (matches) {
1317
- cyclomaticComplexity += matches.length;
1318
- }
1319
- // Cognitive complexity (simplified)
1320
- let cognitiveComplexity = cyclomaticComplexity;
1321
- const nestedPatterns = /\{\s*\{|\bif\b.*\bif\b/g;
1322
- const nestedMatches = content.match(nestedPatterns);
1323
- if (nestedMatches) {
1324
- cognitiveComplexity += nestedMatches.length * 2;
1325
- }
1326
- // Maintainability index (simplified, 0-100 scale)
1327
- const maintainabilityIndex = Math.max(0, Math.min(100, 171 - 5.2 * Math.log(linesOfCode + 1) - 0.23 * cyclomaticComplexity - 16.2 * Math.log(linesOfCode / (linesOfComments + 1) + 1)));
1328
- return {
1329
- cyclomaticComplexity,
1330
- cognitiveComplexity,
1331
- maintainabilityIndex: Math.round(maintainabilityIndex),
1332
- linesOfCode,
1333
- linesOfComments,
1334
- };
1335
- }
1336
- function inferFilePurpose(filename, _content, _imports, exports, functions, classes) {
1337
- const lower = filename.toLowerCase();
1338
- // Check filename patterns
1339
- if (lower.includes('test') || lower.includes('spec')) {
1340
- return 'Test file for unit/integration testing';
1341
- }
1342
- if (lower === 'index.ts' || lower === 'index.js') {
1343
- return 'Module entry point and public API exports';
1344
- }
1345
- if (lower.includes('config')) {
1346
- return 'Configuration settings and constants';
1347
- }
1348
- if (lower.includes('type') || lower.includes('interface')) {
1349
- return 'Type definitions and interfaces';
1350
- }
1351
- if (lower.includes('util') || lower.includes('helper')) {
1352
- return 'Utility functions and helpers';
1353
- }
1354
- if (lower.includes('hook')) {
1355
- return 'Custom React hooks';
1356
- }
1357
- if (lower.includes('context')) {
1358
- return 'React context provider';
1359
- }
1360
- if (lower.includes('store') || lower.includes('reducer')) {
1361
- return 'State management';
1362
- }
1363
- if (lower.includes('service')) {
1364
- return 'Business logic and service layer';
1365
- }
1366
- if (lower.includes('api') || lower.includes('client')) {
1367
- return 'API client and HTTP requests';
1368
- }
1369
- if (lower.includes('route')) {
1370
- return 'Route definitions and handlers';
1371
- }
1372
- if (lower.includes('middleware')) {
1373
- return 'Middleware functions';
1374
- }
1375
- if (lower.includes('model') || lower.includes('entity')) {
1376
- return 'Data models and entities';
1377
- }
1378
- if (lower.includes('schema')) {
1379
- return 'Schema definitions and validation';
1380
- }
1381
- if (lower.includes('component')) {
1382
- return 'UI component';
1383
- }
1384
- // Infer from content
1385
- if (classes.length > 0 && functions.length === 0) {
1386
- return `Class definitions: ${classes.map((c) => c.name).join(', ')}`;
1387
- }
1388
- if (functions.length > 0 && classes.length === 0) {
1389
- const exportedFuncs = functions.filter((f) => f.isExported);
1390
- if (exportedFuncs.length > 0) {
1391
- return `Function library: ${exportedFuncs.map((f) => f.name).slice(0, 3).join(', ')}${exportedFuncs.length > 3 ? '...' : ''}`;
1392
- }
1393
- }
1394
- if (exports.length > 0) {
1395
- return `Module exporting: ${exports.map((e) => e.name).slice(0, 3).join(', ')}${exports.length > 3 ? '...' : ''}`;
1396
- }
1397
- return 'General module';
1398
- }
1399
- function analyzeTopic(workingDir, topic, maxFiles, maxExamples) {
1400
- const topicLower = topic.toLowerCase();
1401
- const relevantFiles = [];
1402
- const patterns = new Map();
1403
- const examples = [];
1404
- // Keywords to search for based on topic
1405
- const keywords = generateTopicKeywords(topicLower);
1406
- // Search through files
1407
- const allFiles = collectAllFiles(workingDir, 4);
1408
- for (const filePath of allFiles) {
1409
- try {
1410
- const content = readFileSync(filePath, 'utf-8');
1411
- const lines = content.split('\n');
1412
- const relPath = relative(workingDir, filePath);
1413
- // Calculate relevance score
1414
- let relevance = 0;
1415
- const snippets = [];
1416
- for (const keyword of keywords) {
1417
- const regex = new RegExp(keyword, 'gi');
1418
- const matches = content.match(regex);
1419
- if (matches) {
1420
- relevance += matches.length;
1421
- // Find snippets containing the keyword
1422
- for (let i = 0; i < lines.length && snippets.length < 3; i++) {
1423
- if (lines[i]?.toLowerCase().includes(keyword)) {
1424
- const snippet = lines.slice(Math.max(0, i - 1), Math.min(lines.length, i + 3)).join('\n');
1425
- if (!snippets.includes(snippet)) {
1426
- snippets.push(snippet);
1427
- // Add to patterns
1428
- const patternName = identifyPattern(lines[i] ?? '', keyword);
1429
- if (patternName) {
1430
- const existing = patterns.get(patternName) || { count: 0, locations: [] };
1431
- existing.count++;
1432
- if (!existing.locations.includes(relPath)) {
1433
- existing.locations.push(relPath);
1434
- }
1435
- patterns.set(patternName, existing);
1436
- }
1437
- // Add to examples
1438
- if (examples.length < maxExamples) {
1439
- examples.push({
1440
- file: relPath,
1441
- line: i + 1,
1442
- code: snippet,
1443
- explanation: `Example of ${topic} usage`,
1444
- });
1445
- }
1446
- }
1447
- }
1448
- }
1449
- }
1450
- }
1451
- if (relevance > 0) {
1452
- relevantFiles.push({
1453
- path: relPath,
1454
- relevance,
1455
- snippets,
1456
- });
1457
- }
1458
- }
1459
- catch {
1460
- // Skip files we can't read
1461
- }
1462
- }
1463
- // Sort by relevance and limit
1464
- relevantFiles.sort((a, b) => b.relevance - a.relevance);
1465
- const topFiles = relevantFiles.slice(0, maxFiles);
1466
- // Convert patterns map to array
1467
- const topicPatterns = Array.from(patterns.entries())
1468
- .map(([name, data]) => ({
1469
- name,
1470
- occurrences: data.count,
1471
- locations: data.locations,
1472
- }))
1473
- .sort((a, b) => b.occurrences - a.occurrences);
1474
- // Generate summary
1475
- const summary = generateTopicSummary(topic, topFiles, topicPatterns, examples);
1476
- return {
1477
- topic,
1478
- relevantFiles: topFiles,
1479
- patterns: topicPatterns,
1480
- examples: examples.slice(0, maxExamples),
1481
- summary,
1482
- };
1483
- }
1484
- function generateTopicKeywords(topic) {
1485
- const keywords = [topic];
1486
- // Add related keywords
1487
- const relatedKeywords = {
1488
- auth: ['authentication', 'authorize', 'login', 'logout', 'session', 'token', 'jwt', 'oauth', 'passport'],
1489
- error: ['error', 'exception', 'catch', 'throw', 'try', 'finally', 'fail', 'handle'],
1490
- api: ['api', 'route', 'endpoint', 'handler', 'request', 'response', 'http', 'rest', 'graphql'],
1491
- test: ['test', 'spec', 'describe', 'it', 'expect', 'mock', 'jest', 'vitest', 'pytest'],
1492
- database: ['database', 'db', 'sql', 'query', 'model', 'schema', 'migration', 'orm', 'prisma', 'mongoose'],
1493
- validation: ['validate', 'validation', 'schema', 'zod', 'yup', 'joi', 'check', 'verify'],
1494
- state: ['state', 'store', 'reducer', 'action', 'dispatch', 'context', 'redux', 'zustand', 'recoil'],
1495
- cache: ['cache', 'memoize', 'memo', 'redis', 'memcached', 'ttl', 'invalidate'],
1496
- logging: ['log', 'logger', 'logging', 'debug', 'trace', 'info', 'warn', 'error', 'console'],
1497
- config: ['config', 'configuration', 'settings', 'env', 'environment', 'options'],
1498
- };
1499
- for (const [key, related] of Object.entries(relatedKeywords)) {
1500
- if (topic.includes(key)) {
1501
- keywords.push(...related);
1502
- }
1503
- }
1504
- return [...new Set(keywords)];
1505
- }
1506
- function identifyPattern(line, _keyword) {
1507
- const lower = line.toLowerCase();
1508
- if (lower.includes('try') && lower.includes('catch'))
1509
- return 'Try-Catch Pattern';
1510
- if (lower.includes('async') && lower.includes('await'))
1511
- return 'Async/Await Pattern';
1512
- if (lower.includes('export') && lower.includes('default'))
1513
- return 'Default Export';
1514
- if (lower.includes('import') && lower.includes('from'))
1515
- return 'ES6 Import';
1516
- if (lower.includes('class') && lower.includes('extends'))
1517
- return 'Class Inheritance';
1518
- if (lower.includes('interface') || lower.includes('type'))
1519
- return 'Type Definition';
1520
- if (/\.(map|filter|reduce)\s*\(/.test(lower))
1521
- return 'Functional Methods';
1522
- if (lower.includes('usestate') || lower.includes('useeffect'))
1523
- return 'React Hooks';
1524
- if (lower.includes('describe') && lower.includes('it'))
1525
- return 'Test Structure';
1526
- return null;
1527
- }
1528
- function generateTopicSummary(topic, files, patterns, examples) {
1529
- const parts = [];
1530
- parts.push(`Analysis of "${topic}" in this codebase:\n`);
1531
- if (files.length === 0) {
1532
- parts.push(`No files found directly related to "${topic}". Consider searching for related terms.`);
1533
- }
1534
- else {
1535
- parts.push(`Found ${files.length} relevant file(s).`);
1536
- if (patterns.length > 0) {
1537
- parts.push(`\nDetected patterns:`);
1538
- for (const pattern of patterns.slice(0, 5)) {
1539
- parts.push(`- ${pattern.name}: ${pattern.occurrences} occurrence(s)`);
1540
- }
1541
- }
1542
- if (examples.length > 0) {
1543
- parts.push(`\n${examples.length} code example(s) available.`);
1544
- }
1545
- parts.push(`\nMost relevant files:`);
1546
- for (const file of files.slice(0, 5)) {
1547
- parts.push(`- ${file.path} (relevance: ${file.relevance})`);
1548
- }
1549
- }
1550
- return parts.join('\n');
1551
- }
1552
- function collectAllFiles(dir, maxDepth, depth = 0) {
1553
- const files = [];
1554
- if (depth >= maxDepth)
1555
- return files;
1556
- try {
1557
- const entries = readdirSync(dir, { withFileTypes: true });
1558
- for (const entry of entries) {
1559
- if (entry.name.startsWith('.') || IGNORED_DIRS.has(entry.name)) {
1560
- continue;
1561
- }
1562
- const fullPath = join(dir, entry.name);
1563
- if (entry.isDirectory()) {
1564
- files.push(...collectAllFiles(fullPath, maxDepth, depth + 1));
1565
- }
1566
- else if (entry.isFile()) {
1567
- const ext = extname(entry.name).toLowerCase();
1568
- if (LANGUAGE_MAP[ext]) {
1569
- files.push(fullPath);
1570
- }
1571
- }
1572
- }
1573
- }
1574
- catch {
1575
- // Skip directories we can't read
1576
- }
1577
- return files;
1578
- }
1579
- function createAnalysisGuardrails(requestedDepth, includeHidden, mode) {
1580
- const normalizedDepth = Number.isFinite(requestedDepth) ? requestedDepth : 5;
1581
- const maxDepth = Math.min(8, Math.max(1, Math.floor(normalizedDepth)));
1582
- const allowHidden = mode === 'detailed' && includeHidden;
1583
- return {
1584
- maxDepth,
1585
- requestedDepth: normalizedDepth,
1586
- includeHidden: allowHidden,
1587
- hiddenRequestBlocked: includeHidden && !allowHidden,
1588
- nodeLimit: mode === 'detailed' ? 12000 : 6000,
1589
- nodeCount: 0,
1590
- truncated: false,
1591
- };
1592
- }
1593
- function getRecentExploreIndexSnapshot(workingDir) {
1594
- try {
1595
- const hash = createHash('md5').update(workingDir).digest('hex').slice(0, 12);
1596
- const indexPath = join(homedir(), '.erosolar', 'explore-cache', `index-${hash}.json`);
1597
- const stats = statSync(indexPath);
1598
- const ageMs = Date.now() - stats.mtimeMs;
1599
- const ageMinutes = Math.max(1, Math.round(ageMs / 60000));
1600
- const payload = JSON.parse(readFileSync(indexPath, 'utf-8'));
1601
- const fileCount = Array.isArray(payload?.files) ? payload.files.length : undefined;
1602
- const freshnessWindowMs = 6 * 60 * 60 * 1000;
1603
- return {
1604
- fileCount,
1605
- fresh: ageMs <= freshnessWindowMs,
1606
- ageMinutes,
1607
- };
1608
- }
1609
- catch {
1610
- return null;
1611
- }
1612
- }
1613
- function formatIndexPreflight(snapshot) {
1614
- const lines = [];
1615
- lines.push('# learn_codebase guardrail');
1616
- lines.push(`Recent explore index detected${snapshot.fileCount ? ` (${snapshot.fileCount} files)` : ''}, ~${snapshot.ageMinutes}m old.`);
1617
- lines.push('Reuse it via `explore` / `explore_index status` before running a fresh deep dive.');
1618
- lines.push('If you truly need a scan, rerun with mode "detailed" or set a focused path to narrow scope.');
1619
- return lines.join('\n');
1620
- }
1621
- function formatGuardrailSummary(guardrails) {
1622
- if (!guardrails)
1623
- return [];
1624
- const parts = [
1625
- `depth<=${guardrails.maxDepth}${guardrails.maxDepth < guardrails.requestedDepth ? ` (was ${guardrails.requestedDepth})` : ''}`,
1626
- `hidden:${guardrails.includeHidden ? 'on' : 'off'}`,
1627
- `node cap:${guardrails.nodeLimit}`,
1628
- ];
1629
- const lines = [`Guardrails: ${parts.join(' | ')}`];
1630
- if (guardrails.hiddenRequestBlocked) {
1631
- lines.push('Hidden files scan disabled in concise mode; rerun in detailed mode to include them.');
1632
- }
1633
- if (guardrails.truncated) {
1634
- lines.push(`Traversal stopped early after ${guardrails.nodeCount} items${guardrails.truncatedReason ? ` (${guardrails.truncatedReason})` : ''}.`);
1635
- }
1636
- return lines;
1637
- }
1638
- // =====================================================
1639
- // Formatting Functions
1640
- // =====================================================
1641
- function formatConciseCodebaseAnalysis(analysis) {
1642
- const lines = [];
1643
- const topLanguages = analysis.languages.slice(0, 3).map((lang) => `${lang.language} (${lang.fileCount} files)`);
1644
- const topPatterns = analysis.patterns.slice(0, 5).map((pattern) => `${pattern.name} (${pattern.confidence})`);
1645
- const keyComponents = analysis.architecture.components.slice(0, 5).map((comp) => `${comp.name} - ${comp.path}`);
1646
- const keyDirs = (analysis.structure.children ?? [])
1647
- .filter((child) => child.type === 'directory')
1648
- .slice(0, 5)
1649
- .map((child) => `${child.name}/`);
1650
- const keyConfigs = analysis.configFiles.slice(0, 5).map((config) => `${config.name}: ${config.purpose}`);
1651
- const keyDependencies = analysis.dependencies.dependencies.slice(0, 8);
1652
- const keyDevDependencies = analysis.dependencies.devDependencies.slice(0, 5);
1653
- lines.push(`# Context-safe repo deep-learn: ${analysis.rootDir}`);
1654
- lines.push('Use only when targeted explore/grep tools are insufficient.');
1655
- const guardrailLines = formatGuardrailSummary(analysis.guardrails);
1656
- if (guardrailLines.length > 0) {
1657
- lines.push(...guardrailLines);
1658
- }
1659
- lines.push('');
1660
- lines.push('## Overview');
1661
- lines.push(`- Files: ${analysis.totalFiles} • Directories: ${analysis.totalDirectories}`);
1662
- lines.push(`- Primary languages: ${topLanguages.length ? topLanguages.join('; ') : 'Unknown'}`);
1663
- lines.push(`- Architecture: ${analysis.architecture.type || 'Unknown'}`);
1664
- if (analysis.entryPoints.length > 0) {
1665
- lines.push(`- Entry points: ${analysis.entryPoints.slice(0, 5).join(', ')}`);
1666
- }
1667
- lines.push('');
1668
- if (topPatterns.length > 0) {
1669
- lines.push('## Patterns & conventions');
1670
- lines.push(`- ${topPatterns.join('; ')}`);
1671
- lines.push('');
1672
- }
1673
- if (keyComponents.length > 0 || keyDirs.length > 0) {
1674
- lines.push('## Key areas to inspect next');
1675
- if (keyComponents.length > 0) {
1676
- lines.push(`- Components: ${keyComponents.join('; ')}`);
1677
- }
1678
- if (keyDirs.length > 0) {
1679
- lines.push(`- Important directories: ${keyDirs.join(', ')}`);
1680
- }
1681
- lines.push('');
1682
- }
1683
- if (keyConfigs.length > 0) {
1684
- lines.push('## Configuration');
1685
- lines.push(`- ${keyConfigs.join('; ')}`);
1686
- lines.push('');
1687
- }
1688
- if (analysis.dependencies.hasDependencyFile && (keyDependencies.length > 0 || keyDevDependencies.length > 0)) {
1689
- lines.push('## Dependencies snapshot');
1690
- if (keyDependencies.length > 0) {
1691
- lines.push(`- Dependencies: ${keyDependencies.join(', ')}${analysis.dependencies.dependencies.length > keyDependencies.length ? ' ...' : ''}`);
1692
- }
1693
- if (keyDevDependencies.length > 0) {
1694
- lines.push(`- Dev dependencies: ${keyDevDependencies.join(', ')}${analysis.dependencies.devDependencies.length > keyDevDependencies.length ? ' ...' : ''}`);
1695
- }
1696
- lines.push('');
1697
- }
1698
- if (analysis.entryPoints.length > 0) {
1699
- lines.push('## Suggested probes');
1700
- const entryProbe = analysis.entryPoints.slice(0, 2).map((entry) => `- Check routing/boot flow around ${entry}`);
1701
- lines.push(...entryProbe);
1702
- }
1703
- lines.push('- Run `explore_index status` to reuse the cached index, or `explore_index rebuild` after large file changes.');
1704
- lines.push('- Use `explore` queries or `Grep` with `head_limit` to target follow-up investigations.');
1705
- lines.push('');
1706
- lines.push('Context guard: concise mode trims output to keep the session responsive. Use learn_codebase as a last resort; set mode to "detailed" only if you truly need the full tree and metrics.');
1707
- return lines.join('\n');
1708
- }
1709
- function formatCodebaseAnalysis(analysis) {
1710
- const output = [];
1711
- // Show analysis phases completed
1712
- output.push('# Codebase Analysis: ' + analysis.rootDir);
1713
- output.push('Use only when targeted explore/grep tools are insufficient.');
1714
- const guardrailLines = formatGuardrailSummary(analysis.guardrails);
1715
- if (guardrailLines.length > 0) {
1716
- output.push(...guardrailLines);
1717
- }
1718
- output.push('');
1719
- output.push('## Analysis Phases Completed');
1720
- output.push('✓ Directory structure traversal');
1721
- output.push('✓ File type detection and language breakdown');
1722
- output.push('✓ Architecture pattern detection');
1723
- output.push('✓ Configuration file analysis');
1724
- output.push('✓ Dependency analysis');
1725
- output.push('✓ Entry point identification');
1726
- output.push('✓ Component and layer mapping');
1727
- output.push('');
1728
- // Overview
1729
- output.push('## Overview');
1730
- output.push(`- Total files analyzed: ${analysis.totalFiles}`);
1731
- output.push(`- Total directories scanned: ${analysis.totalDirectories}`);
1732
- output.push(`- Patterns detected: ${analysis.patterns.length}`);
1733
- output.push(`- Config files found: ${analysis.configFiles.length}`);
1734
- output.push('');
1735
- // Languages
1736
- output.push('## Languages');
1737
- for (const lang of analysis.languages.slice(0, 10)) {
1738
- output.push(`- ${lang.language}: ${lang.fileCount} files (${lang.percentage.toFixed(1)}%)`);
1739
- }
1740
- output.push('');
1741
- // Architecture
1742
- output.push('## Architecture');
1743
- output.push(`- Type: ${analysis.architecture.type}`);
1744
- if (analysis.architecture.layers.length > 0) {
1745
- output.push(`- Layers: ${analysis.architecture.layers.join(', ')}`);
1746
- }
1747
- if (analysis.architecture.dataFlow.length > 0) {
1748
- output.push('- Data Flow:');
1749
- for (const flow of analysis.architecture.dataFlow) {
1750
- output.push(` - ${flow}`);
1751
- }
1752
- }
1753
- output.push('');
1754
- // Detected Patterns
1755
- if (analysis.patterns.length > 0) {
1756
- output.push('## Detected Patterns');
1757
- for (const pattern of analysis.patterns) {
1758
- output.push(`- **${pattern.name}** (${pattern.confidence} confidence)`);
1759
- output.push(` ${pattern.description}`);
1760
- }
1761
- output.push('');
1762
- }
1763
- // Key Components
1764
- if (analysis.architecture.components.length > 0) {
1765
- output.push('## Key Components');
1766
- for (const comp of analysis.architecture.components.slice(0, 15)) {
1767
- output.push(`- **${comp.name}** (${comp.type}): ${comp.path}`);
1768
- if (comp.responsibilities.length > 0) {
1769
- output.push(` Responsibilities: ${comp.responsibilities.join(', ')}`);
1770
- }
1771
- }
1772
- output.push('');
1773
- }
1774
- // Entry Points
1775
- if (analysis.entryPoints.length > 0) {
1776
- output.push('## Entry Points');
1777
- for (const entry of analysis.entryPoints) {
1778
- output.push(`- ${entry}`);
1779
- }
1780
- output.push('');
1781
- }
1782
- // Configuration Files
1783
- if (analysis.configFiles.length > 0) {
1784
- output.push('## Configuration Files');
1785
- for (const config of analysis.configFiles.slice(0, 10)) {
1786
- output.push(`- **${config.name}** (${config.type}): ${config.purpose}`);
1787
- }
1788
- output.push('');
1789
- }
1790
- // Dependencies
1791
- if (analysis.dependencies.hasDependencyFile) {
1792
- output.push('## Dependencies');
1793
- output.push(`- Package Manager: ${analysis.dependencies.packageManager || 'Unknown'}`);
1794
- if (analysis.dependencies.dependencies.length > 0) {
1795
- output.push(`- Dependencies: ${analysis.dependencies.dependencies.slice(0, 10).join(', ')}${analysis.dependencies.dependencies.length > 10 ? '...' : ''}`);
1796
- }
1797
- if (analysis.dependencies.devDependencies.length > 0) {
1798
- output.push(`- Dev Dependencies: ${analysis.dependencies.devDependencies.slice(0, 10).join(', ')}${analysis.dependencies.devDependencies.length > 10 ? '...' : ''}`);
1799
- }
1800
- output.push('');
1801
- }
1802
- // Directory Structure (simplified)
1803
- output.push('## Directory Structure');
1804
- output.push(formatDirectoryTree(analysis.structure, 0, 3));
1805
- return output.join('\n');
1806
- }
1807
- function formatDirectoryTree(node, depth, maxDepth) {
1808
- const indent = ' '.repeat(depth);
1809
- const lines = [];
1810
- if (node.type === 'directory') {
1811
- lines.push(`${indent}${node.name}/`);
1812
- if (node.children && depth < maxDepth) {
1813
- for (const child of node.children.slice(0, 15)) {
1814
- lines.push(formatDirectoryTree(child, depth + 1, maxDepth));
1815
- }
1816
- if (node.children.length > 15) {
1817
- lines.push(`${indent} ... (${node.children.length - 15} more)`);
1818
- }
1819
- }
1820
- }
1821
- else {
1822
- const langSuffix = node.language ? ` [${node.language}]` : '';
1823
- lines.push(`${indent}${node.name}${langSuffix}`);
1824
- }
1825
- return lines.join('\n');
1826
- }
1827
- function formatFileAnalysis(analysis) {
1828
- const output = [];
1829
- output.push(`# File Analysis: ${analysis.path}`);
1830
- output.push('');
1831
- // Overview
1832
- output.push('## Overview');
1833
- output.push(`- Language: ${analysis.language}`);
1834
- output.push(`- Lines: ${analysis.lineCount}`);
1835
- output.push(`- Size: ${(analysis.size / 1024).toFixed(2)} KB`);
1836
- output.push(`- Purpose: ${analysis.purpose}`);
1837
- output.push('');
1838
- // Complexity
1839
- output.push('## Complexity Metrics');
1840
- output.push(`- Cyclomatic Complexity: ${analysis.complexity.cyclomaticComplexity}`);
1841
- output.push(`- Cognitive Complexity: ${analysis.complexity.cognitiveComplexity}`);
1842
- output.push(`- Maintainability Index: ${analysis.complexity.maintainabilityIndex}/100`);
1843
- output.push(`- Lines of Code: ${analysis.complexity.linesOfCode}`);
1844
- output.push(`- Lines of Comments: ${analysis.complexity.linesOfComments}`);
1845
- output.push('');
1846
- // Imports
1847
- if (analysis.imports.length > 0) {
1848
- output.push('## Imports');
1849
- for (const imp of analysis.imports.slice(0, 15)) {
1850
- const type = imp.isRelative ? '(relative)' : '(external)';
1851
- output.push(`- ${imp.source} ${type}`);
1852
- if (imp.specifiers.length > 0) {
1853
- output.push(` Imports: ${imp.specifiers.join(', ')}`);
1854
- }
1855
- }
1856
- if (analysis.imports.length > 15) {
1857
- output.push(`- ... and ${analysis.imports.length - 15} more imports`);
1858
- }
1859
- output.push('');
1860
- }
1861
- // Exports
1862
- if (analysis.exports.length > 0) {
1863
- output.push('## Exports');
1864
- for (const exp of analysis.exports) {
1865
- output.push(`- ${exp.name} (${exp.type})`);
1866
- }
1867
- output.push('');
1868
- }
1869
- // Functions
1870
- if (analysis.functions.length > 0) {
1871
- output.push('## Functions');
1872
- for (const func of analysis.functions.slice(0, 20)) {
1873
- const async = func.isAsync ? 'async ' : '';
1874
- const exported = func.isExported ? 'export ' : '';
1875
- const params = func.parameters.join(', ');
1876
- const ret = func.returnType ? `: ${func.returnType}` : '';
1877
- output.push(`- Line ${func.line}: ${exported}${async}${func.name}(${params})${ret}`);
1878
- }
1879
- if (analysis.functions.length > 20) {
1880
- output.push(`- ... and ${analysis.functions.length - 20} more functions`);
1881
- }
1882
- output.push('');
1883
- }
1884
- // Classes
1885
- if (analysis.classes.length > 0) {
1886
- output.push('## Classes');
1887
- for (const cls of analysis.classes) {
1888
- const exported = cls.isExported ? 'export ' : '';
1889
- const ext = cls.extends ? ` extends ${cls.extends}` : '';
1890
- const impl = cls.implements?.length ? ` implements ${cls.implements.join(', ')}` : '';
1891
- output.push(`- Line ${cls.line}: ${exported}class ${cls.name}${ext}${impl}`);
1892
- if (cls.methods.length > 0) {
1893
- output.push(` Methods: ${cls.methods.join(', ')}`);
1894
- }
1895
- if (cls.properties.length > 0) {
1896
- output.push(` Properties: ${cls.properties.join(', ')}`);
1897
- }
1898
- }
1899
- output.push('');
1900
- }
1901
- // Patterns
1902
- if (analysis.patterns.length > 0) {
1903
- output.push('## Detected Patterns');
1904
- output.push(analysis.patterns.join(', '));
1905
- output.push('');
1906
- }
1907
- // Relationships
1908
- if (analysis.relationships.length > 0) {
1909
- output.push('## File Relationships');
1910
- for (const rel of analysis.relationships) {
1911
- output.push(`- ${rel.type}: ${rel.targetFile}`);
1912
- if (rel.symbols.length > 0) {
1913
- output.push(` Symbols: ${rel.symbols.join(', ')}`);
1914
- }
1915
- }
1916
- output.push('');
1917
- }
1918
- return output.join('\n');
1919
- }
1920
- function formatTopicAnalysis(analysis) {
1921
- const output = [];
1922
- output.push(`# Topic Analysis: "${analysis.topic}"`);
1923
- output.push('');
1924
- output.push(analysis.summary);
1925
- output.push('');
1926
- // Patterns
1927
- if (analysis.patterns.length > 0) {
1928
- output.push('## Patterns Found');
1929
- for (const pattern of analysis.patterns) {
1930
- output.push(`### ${pattern.name}`);
1931
- output.push(`- Occurrences: ${pattern.occurrences}`);
1932
- output.push(`- Found in: ${pattern.locations.slice(0, 5).join(', ')}${pattern.locations.length > 5 ? '...' : ''}`);
1933
- output.push('');
1934
- }
1935
- }
1936
- // Relevant Files
1937
- if (analysis.relevantFiles.length > 0) {
1938
- output.push('## Relevant Files');
1939
- for (const file of analysis.relevantFiles) {
1940
- output.push(`### ${file.path}`);
1941
- output.push(`Relevance Score: ${file.relevance}`);
1942
- if (file.snippets.length > 0) {
1943
- output.push('');
1944
- output.push('Relevant snippets:');
1945
- for (const snippet of file.snippets.slice(0, 2)) {
1946
- output.push('```');
1947
- output.push(snippet);
1948
- output.push('```');
1949
- }
1950
- }
1951
- output.push('');
1952
- }
1953
- }
1954
- // Code Examples
1955
- if (analysis.examples.length > 0) {
1956
- output.push('## Code Examples');
1957
- for (const example of analysis.examples) {
1958
- output.push(`### ${example.file}:${example.line}`);
1959
- output.push(example.explanation);
1960
- output.push('```');
1961
- output.push(example.code);
1962
- output.push('```');
1963
- output.push('');
1964
- }
1965
- }
1966
- return output.join('\n');
1967
- }
1968
- function formatLearningSummary(analysis, format, _focus) {
1969
- const output = [];
1970
- const isMarkdown = format === 'markdown';
1971
- const h1 = (text) => (isMarkdown ? `# ${text}` : text.toUpperCase());
1972
- const h2 = (text) => (isMarkdown ? `## ${text}` : `\n${text}`);
1973
- const bullet = isMarkdown ? '-' : '*';
1974
- output.push(h1('Codebase Learning Summary'));
1975
- output.push('');
1976
- // Quick Start
1977
- output.push(h2('Quick Start'));
1978
- output.push('');
1979
- const mainLang = analysis.languages[0];
1980
- if (mainLang) {
1981
- output.push(`This is primarily a **${mainLang.language}** project.`);
1982
- }
1983
- if (analysis.dependencies.packageManager) {
1984
- output.push(`Package manager: **${analysis.dependencies.packageManager}**`);
1985
- }
1986
- if (analysis.entryPoints.length > 0) {
1987
- output.push(`Main entry point: \`${analysis.entryPoints[0]}\``);
1988
- }
1989
- output.push('');
1990
- // Architecture Overview
1991
- output.push(h2('Architecture Overview'));
1992
- output.push('');
1993
- output.push(`Architecture Type: **${analysis.architecture.type}**`);
1994
- if (analysis.architecture.layers.length > 0) {
1995
- output.push(`Layers: ${analysis.architecture.layers.join(' → ')}`);
1996
- }
1997
- for (const flow of analysis.architecture.dataFlow) {
1998
- output.push(`${bullet} ${flow}`);
1999
- }
2000
- output.push('');
2001
- // Key Concepts
2002
- output.push(h2('Key Concepts'));
2003
- output.push('');
2004
- for (const pattern of analysis.patterns.slice(0, 5)) {
2005
- output.push(`${bullet} **${pattern.name}**: ${pattern.description}`);
2006
- }
2007
- output.push('');
2008
- // Important Files
2009
- output.push(h2('Important Files'));
2010
- output.push('');
2011
- for (const config of analysis.configFiles.slice(0, 5)) {
2012
- output.push(`${bullet} \`${config.path}\`: ${config.purpose}`);
2013
- }
2014
- if (analysis.entryPoints.length > 0) {
2015
- output.push('');
2016
- output.push('Entry points:');
2017
- for (const entry of analysis.entryPoints) {
2018
- output.push(`${bullet} \`${entry}\``);
2019
- }
2020
- }
2021
- output.push('');
2022
- // Directory Guide
2023
- output.push(h2('Directory Guide'));
2024
- output.push('');
2025
- for (const comp of analysis.architecture.components.slice(0, 10)) {
2026
- output.push(`${bullet} **${comp.name}/** (${comp.type})`);
2027
- if (comp.responsibilities.length > 0) {
2028
- output.push(` ${comp.responsibilities.slice(0, 2).join(', ')}`);
2029
- }
2030
- }
2031
- output.push('');
2032
- // Common Patterns
2033
- if (analysis.patterns.length > 0) {
2034
- output.push(h2('Common Patterns'));
2035
- output.push('');
2036
- for (const pattern of analysis.patterns.filter((p) => p.confidence === 'high').slice(0, 5)) {
2037
- output.push(`${bullet} **${pattern.name}**`);
2038
- for (const evidence of pattern.evidence.slice(0, 2)) {
2039
- output.push(` ${bullet} ${evidence}`);
2040
- }
2041
- }
2042
- output.push('');
2043
- }
2044
- // Development Workflow
2045
- output.push(h2('Development Workflow'));
2046
- output.push('');
2047
- const hasTest = analysis.configFiles.some((c) => c.type === 'testing');
2048
- const hasLint = analysis.configFiles.some((c) => c.type === 'linting');
2049
- const hasBundler = analysis.configFiles.some((c) => c.type === 'bundler');
2050
- if (analysis.dependencies.packageManager === 'npm') {
2051
- output.push('```bash');
2052
- output.push('# Install dependencies');
2053
- output.push('npm install');
2054
- output.push('');
2055
- if (hasBundler) {
2056
- output.push('# Build project');
2057
- output.push('npm run build');
2058
- output.push('');
2059
- }
2060
- if (hasTest) {
2061
- output.push('# Run tests');
2062
- output.push('npm test');
2063
- output.push('');
2064
- }
2065
- if (hasLint) {
2066
- output.push('# Lint code');
2067
- output.push('npm run lint');
2068
- }
2069
- output.push('```');
2070
- }
2071
- else if (analysis.dependencies.packageManager === 'pip') {
2072
- output.push('```bash');
2073
- output.push('# Install dependencies');
2074
- output.push('pip install -e .');
2075
- output.push('');
2076
- if (hasTest) {
2077
- output.push('# Run tests');
2078
- output.push('pytest');
2079
- }
2080
- output.push('```');
2081
- }
2082
- output.push('');
2083
- // Next Steps
2084
- output.push(h2('Suggested Next Steps'));
2085
- output.push('');
2086
- output.push(`1. Read the entry point: \`${analysis.entryPoints[0] || 'index file'}\``);
2087
- if (analysis.configFiles.some((c) => c.name === 'package.json')) {
2088
- output.push('2. Review `package.json` for available scripts');
2089
- }
2090
- output.push('3. Explore the main directories to understand the structure');
2091
- if (hasTest) {
2092
- output.push('4. Run the test suite to verify setup');
2093
- }
2094
- output.push('5. Use `learn_topic` to explore specific features');
2095
- return output.join('\n');
2096
- }
2097
- // =====================================================
2098
- // Utilities
2099
- // =====================================================
2100
- function resolveFilePath(workingDir, path) {
2101
- const normalized = path.trim();
2102
- return normalized.startsWith('/') ? normalized : join(workingDir, normalized);
2103
- }
2104
- //# sourceMappingURL=learnTools.js.map