erosolar-cli 2.1.249 → 2.1.252

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 (467) hide show
  1. package/agents/general.rules.json +10 -133
  2. package/agents/general.rules.json.bak +278 -0
  3. package/agents/general.rules.json.bak2 +306 -0
  4. package/dist/bin/erosolar.js +9 -5
  5. package/dist/bin/erosolar.js.map +1 -1
  6. package/dist/capabilities/bidirectionalAuditCapability.d.ts +26 -0
  7. package/dist/capabilities/bidirectionalAuditCapability.d.ts.map +1 -0
  8. package/dist/capabilities/bidirectionalAuditCapability.js +44 -0
  9. package/dist/capabilities/bidirectionalAuditCapability.js.map +1 -0
  10. package/dist/capabilities/globCapability.d.ts +3 -6
  11. package/dist/capabilities/globCapability.d.ts.map +1 -1
  12. package/dist/capabilities/globCapability.js +6 -10
  13. package/dist/capabilities/globCapability.js.map +1 -1
  14. package/dist/capabilities/index.d.ts +1 -18
  15. package/dist/capabilities/index.d.ts.map +1 -1
  16. package/dist/capabilities/index.js +1 -18
  17. package/dist/capabilities/index.js.map +1 -1
  18. package/dist/capabilities/orchestrationCapability.d.ts +2 -0
  19. package/dist/capabilities/orchestrationCapability.d.ts.map +1 -1
  20. package/dist/capabilities/orchestrationCapability.js +980 -2
  21. package/dist/capabilities/orchestrationCapability.js.map +1 -1
  22. package/dist/capabilities/searchCapability.d.ts +8 -2
  23. package/dist/capabilities/searchCapability.d.ts.map +1 -1
  24. package/dist/capabilities/searchCapability.js +11 -6
  25. package/dist/capabilities/searchCapability.js.map +1 -1
  26. package/dist/contracts/tools.schema.json +9 -133
  27. package/dist/core/aiErrorFixer.d.ts +1 -14
  28. package/dist/core/aiErrorFixer.d.ts.map +1 -1
  29. package/dist/core/aiErrorFixer.js +51 -239
  30. package/dist/core/aiErrorFixer.js.map +1 -1
  31. package/dist/core/alphaZeroEngine.d.ts +16 -256
  32. package/dist/core/alphaZeroEngine.d.ts.map +1 -1
  33. package/dist/core/alphaZeroEngine.js +22 -513
  34. package/dist/core/alphaZeroEngine.js.map +1 -1
  35. package/dist/core/completeAttackOrchestrator.d.ts +102 -0
  36. package/dist/core/completeAttackOrchestrator.d.ts.map +1 -0
  37. package/dist/core/completeAttackOrchestrator.js +293 -0
  38. package/dist/core/completeAttackOrchestrator.js.map +1 -0
  39. package/dist/core/defensiveSecurityToolkit.d.ts +373 -0
  40. package/dist/core/defensiveSecurityToolkit.d.ts.map +1 -0
  41. package/dist/core/defensiveSecurityToolkit.js +1304 -0
  42. package/dist/core/defensiveSecurityToolkit.js.map +1 -0
  43. package/dist/core/errors/errorTypes.d.ts +30 -57
  44. package/dist/core/errors/errorTypes.d.ts.map +1 -1
  45. package/dist/core/errors/errorTypes.js +51 -228
  46. package/dist/core/errors/errorTypes.js.map +1 -1
  47. package/dist/core/errors/safetyValidator.d.ts +19 -3
  48. package/dist/core/errors/safetyValidator.d.ts.map +1 -1
  49. package/dist/core/errors/safetyValidator.js +33 -71
  50. package/dist/core/errors/safetyValidator.js.map +1 -1
  51. package/dist/core/failureRecovery.d.ts +4 -100
  52. package/dist/core/failureRecovery.d.ts.map +1 -1
  53. package/dist/core/failureRecovery.js +16 -440
  54. package/dist/core/failureRecovery.js.map +1 -1
  55. package/dist/core/intelligentTargetResearcher.d.ts +142 -0
  56. package/dist/core/intelligentTargetResearcher.d.ts.map +1 -0
  57. package/dist/core/intelligentTargetResearcher.js +367 -0
  58. package/dist/core/intelligentTargetResearcher.js.map +1 -0
  59. package/dist/core/intelligentTestFlows.d.ts +26 -107
  60. package/dist/core/intelligentTestFlows.d.ts.map +1 -1
  61. package/dist/core/intelligentTestFlows.js +15 -659
  62. package/dist/core/intelligentTestFlows.js.map +1 -1
  63. package/dist/core/learningPersistence.d.ts +45 -132
  64. package/dist/core/learningPersistence.d.ts.map +1 -1
  65. package/dist/core/learningPersistence.js +32 -463
  66. package/dist/core/learningPersistence.js.map +1 -1
  67. package/dist/core/metricsTracker.d.ts +22 -139
  68. package/dist/core/metricsTracker.d.ts.map +1 -1
  69. package/dist/core/metricsTracker.js +51 -241
  70. package/dist/core/metricsTracker.js.map +1 -1
  71. package/dist/core/performanceMonitor.d.ts +15 -109
  72. package/dist/core/performanceMonitor.d.ts.map +1 -1
  73. package/dist/core/performanceMonitor.js +27 -184
  74. package/dist/core/performanceMonitor.js.map +1 -1
  75. package/dist/core/resultVerification.d.ts +6 -100
  76. package/dist/core/resultVerification.d.ts.map +1 -1
  77. package/dist/core/resultVerification.js +31 -400
  78. package/dist/core/resultVerification.js.map +1 -1
  79. package/dist/core/selfEvolution.d.ts +32 -126
  80. package/dist/core/selfEvolution.d.ts.map +1 -1
  81. package/dist/core/selfEvolution.js +24 -967
  82. package/dist/core/selfEvolution.js.map +1 -1
  83. package/dist/core/selfImprovement.d.ts +50 -109
  84. package/dist/core/selfImprovement.d.ts.map +1 -1
  85. package/dist/core/selfImprovement.js +14 -689
  86. package/dist/core/selfImprovement.js.map +1 -1
  87. package/dist/core/sourceCodeManager.d.ts +89 -0
  88. package/dist/core/sourceCodeManager.d.ts.map +1 -0
  89. package/dist/core/sourceCodeManager.js +332 -0
  90. package/dist/core/sourceCodeManager.js.map +1 -0
  91. package/dist/core/unifiedOrchestrator.d.ts +88 -0
  92. package/dist/core/unifiedOrchestrator.d.ts.map +1 -0
  93. package/dist/core/unifiedOrchestrator.js +284 -0
  94. package/dist/core/unifiedOrchestrator.js.map +1 -0
  95. package/dist/core/userDefenseOrchestrator.d.ts +202 -0
  96. package/dist/core/userDefenseOrchestrator.d.ts.map +1 -0
  97. package/dist/core/userDefenseOrchestrator.js +1006 -0
  98. package/dist/core/userDefenseOrchestrator.js.map +1 -0
  99. package/dist/plugins/index.d.ts +1 -1
  100. package/dist/plugins/index.d.ts.map +1 -1
  101. package/dist/plugins/index.js +36 -26
  102. package/dist/plugins/index.js.map +1 -1
  103. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts +8 -0
  104. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts.map +1 -0
  105. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js +17 -0
  106. package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js.map +1 -0
  107. package/dist/plugins/tools/nodeDefaults.d.ts +14 -0
  108. package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
  109. package/dist/plugins/tools/nodeDefaults.js +17 -54
  110. package/dist/plugins/tools/nodeDefaults.js.map +1 -1
  111. package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts +9 -0
  112. package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts.map +1 -0
  113. package/dist/plugins/tools/orchestration/orchestrationPlugin.js +18 -0
  114. package/dist/plugins/tools/orchestration/orchestrationPlugin.js.map +1 -0
  115. package/dist/shell/interactiveShell.d.ts +97 -2
  116. package/dist/shell/interactiveShell.d.ts.map +1 -1
  117. package/dist/shell/interactiveShell.js +1001 -6
  118. package/dist/shell/interactiveShell.js.map +1 -1
  119. package/dist/tools/appleExposureTools.d.ts +108 -0
  120. package/dist/tools/appleExposureTools.d.ts.map +1 -0
  121. package/dist/tools/appleExposureTools.js +850 -0
  122. package/dist/tools/appleExposureTools.js.map +1 -0
  123. package/dist/tools/bidirectionalAuditTools.d.ts +104 -0
  124. package/dist/tools/bidirectionalAuditTools.d.ts.map +1 -0
  125. package/dist/tools/bidirectionalAuditTools.js +1280 -0
  126. package/dist/tools/bidirectionalAuditTools.js.map +1 -0
  127. package/dist/tools/defensiveSecurityTools.d.ts +152 -0
  128. package/dist/tools/defensiveSecurityTools.d.ts.map +1 -0
  129. package/dist/tools/defensiveSecurityTools.js +576 -0
  130. package/dist/tools/defensiveSecurityTools.js.map +1 -0
  131. package/dist/tools/forwardAttackChainTracer.d.ts +73 -0
  132. package/dist/tools/forwardAttackChainTracer.d.ts.map +1 -0
  133. package/dist/tools/forwardAttackChainTracer.js +604 -0
  134. package/dist/tools/forwardAttackChainTracer.js.map +1 -0
  135. package/dist/tools/localExplore.d.ts +12 -199
  136. package/dist/tools/localExplore.d.ts.map +1 -1
  137. package/dist/tools/localExplore.js +18 -1352
  138. package/dist/tools/localExplore.js.map +1 -1
  139. package/dist/tools/offensiveTransparencyTools.d.ts +188 -0
  140. package/dist/tools/offensiveTransparencyTools.d.ts.map +1 -0
  141. package/dist/tools/offensiveTransparencyTools.js +890 -0
  142. package/dist/tools/offensiveTransparencyTools.js.map +1 -0
  143. package/dist/tools/planningTools.d.ts +8 -17
  144. package/dist/tools/planningTools.d.ts.map +1 -1
  145. package/dist/tools/planningTools.js +31 -141
  146. package/dist/tools/planningTools.js.map +1 -1
  147. package/dist/tools/searchTools.d.ts +9 -0
  148. package/dist/tools/searchTools.d.ts.map +1 -1
  149. package/dist/tools/searchTools.js +305 -189
  150. package/dist/tools/searchTools.js.map +1 -1
  151. package/dist/tools/skillTools.d.ts +7 -5
  152. package/dist/tools/skillTools.d.ts.map +1 -1
  153. package/dist/tools/skillTools.js +13 -155
  154. package/dist/tools/skillTools.js.map +1 -1
  155. package/dist/tools/threatIntelligenceTools.d.ts +128 -0
  156. package/dist/tools/threatIntelligenceTools.d.ts.map +1 -0
  157. package/dist/tools/threatIntelligenceTools.js +712 -0
  158. package/dist/tools/threatIntelligenceTools.js.map +1 -0
  159. package/dist/ui/PromptController.d.ts +4 -0
  160. package/dist/ui/PromptController.d.ts.map +1 -1
  161. package/dist/ui/PromptController.js +32 -11
  162. package/dist/ui/PromptController.js.map +1 -1
  163. package/dist/ui/UnifiedUIRenderer.d.ts +20 -0
  164. package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
  165. package/dist/ui/UnifiedUIRenderer.js +235 -28
  166. package/dist/ui/UnifiedUIRenderer.js.map +1 -1
  167. package/dist/ui/animatedStatus.d.ts +2 -0
  168. package/dist/ui/animatedStatus.d.ts.map +1 -1
  169. package/dist/ui/animatedStatus.js +36 -2
  170. package/dist/ui/animatedStatus.js.map +1 -1
  171. package/dist/ui/orchestration/StatusOrchestrator.d.ts +10 -0
  172. package/dist/ui/orchestration/StatusOrchestrator.d.ts.map +1 -1
  173. package/dist/ui/orchestration/StatusOrchestrator.js +36 -4
  174. package/dist/ui/orchestration/StatusOrchestrator.js.map +1 -1
  175. package/package.json +1 -1
  176. package/dist/capabilities/advancedTestGenerationCapability.d.ts +0 -17
  177. package/dist/capabilities/advancedTestGenerationCapability.d.ts.map +0 -1
  178. package/dist/capabilities/advancedTestGenerationCapability.js +0 -28
  179. package/dist/capabilities/advancedTestGenerationCapability.js.map +0 -1
  180. package/dist/capabilities/browserAutomationCapability.d.ts +0 -37
  181. package/dist/capabilities/browserAutomationCapability.d.ts.map +0 -1
  182. package/dist/capabilities/browserAutomationCapability.js +0 -49
  183. package/dist/capabilities/browserAutomationCapability.js.map +0 -1
  184. package/dist/capabilities/buildCapability.d.ts +0 -24
  185. package/dist/capabilities/buildCapability.d.ts.map +0 -1
  186. package/dist/capabilities/buildCapability.js +0 -25
  187. package/dist/capabilities/buildCapability.js.map +0 -1
  188. package/dist/capabilities/cloudCapability.d.ts +0 -13
  189. package/dist/capabilities/cloudCapability.d.ts.map +0 -1
  190. package/dist/capabilities/cloudCapability.js +0 -38
  191. package/dist/capabilities/cloudCapability.js.map +0 -1
  192. package/dist/capabilities/codeAnalysisCapability.d.ts +0 -13
  193. package/dist/capabilities/codeAnalysisCapability.d.ts.map +0 -1
  194. package/dist/capabilities/codeAnalysisCapability.js +0 -24
  195. package/dist/capabilities/codeAnalysisCapability.js.map +0 -1
  196. package/dist/capabilities/codeQualityCapability.d.ts +0 -13
  197. package/dist/capabilities/codeQualityCapability.d.ts.map +0 -1
  198. package/dist/capabilities/codeQualityCapability.js +0 -25
  199. package/dist/capabilities/codeQualityCapability.js.map +0 -1
  200. package/dist/capabilities/dependencySecurityCapability.d.ts +0 -13
  201. package/dist/capabilities/dependencySecurityCapability.d.ts.map +0 -1
  202. package/dist/capabilities/dependencySecurityCapability.js +0 -24
  203. package/dist/capabilities/dependencySecurityCapability.js.map +0 -1
  204. package/dist/capabilities/devCapability.d.ts +0 -13
  205. package/dist/capabilities/devCapability.d.ts.map +0 -1
  206. package/dist/capabilities/devCapability.js +0 -24
  207. package/dist/capabilities/devCapability.js.map +0 -1
  208. package/dist/capabilities/emailCapability.d.ts +0 -12
  209. package/dist/capabilities/emailCapability.d.ts.map +0 -1
  210. package/dist/capabilities/emailCapability.js +0 -22
  211. package/dist/capabilities/emailCapability.js.map +0 -1
  212. package/dist/capabilities/enhancedAnalysisCapability.d.ts +0 -13
  213. package/dist/capabilities/enhancedAnalysisCapability.d.ts.map +0 -1
  214. package/dist/capabilities/enhancedAnalysisCapability.js +0 -20
  215. package/dist/capabilities/enhancedAnalysisCapability.js.map +0 -1
  216. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts +0 -17
  217. package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts.map +0 -1
  218. package/dist/capabilities/enhancedCodeIntelligenceCapability.js +0 -28
  219. package/dist/capabilities/enhancedCodeIntelligenceCapability.js.map +0 -1
  220. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts +0 -17
  221. package/dist/capabilities/enhancedDevWorkflowCapability.d.ts.map +0 -1
  222. package/dist/capabilities/enhancedDevWorkflowCapability.js +0 -28
  223. package/dist/capabilities/enhancedDevWorkflowCapability.js.map +0 -1
  224. package/dist/capabilities/frontendTestingCapability.d.ts +0 -13
  225. package/dist/capabilities/frontendTestingCapability.d.ts.map +0 -1
  226. package/dist/capabilities/frontendTestingCapability.js +0 -28
  227. package/dist/capabilities/frontendTestingCapability.js.map +0 -1
  228. package/dist/capabilities/interactionCapability.d.ts +0 -12
  229. package/dist/capabilities/interactionCapability.d.ts.map +0 -1
  230. package/dist/capabilities/interactionCapability.js +0 -22
  231. package/dist/capabilities/interactionCapability.js.map +0 -1
  232. package/dist/capabilities/learnCapability.d.ts +0 -22
  233. package/dist/capabilities/learnCapability.d.ts.map +0 -1
  234. package/dist/capabilities/learnCapability.js +0 -37
  235. package/dist/capabilities/learnCapability.js.map +0 -1
  236. package/dist/capabilities/notebookCapability.d.ts +0 -17
  237. package/dist/capabilities/notebookCapability.d.ts.map +0 -1
  238. package/dist/capabilities/notebookCapability.js +0 -27
  239. package/dist/capabilities/notebookCapability.js.map +0 -1
  240. package/dist/capabilities/planningCapability.d.ts +0 -16
  241. package/dist/capabilities/planningCapability.d.ts.map +0 -1
  242. package/dist/capabilities/planningCapability.js +0 -26
  243. package/dist/capabilities/planningCapability.js.map +0 -1
  244. package/dist/capabilities/refactoringCapability.d.ts +0 -13
  245. package/dist/capabilities/refactoringCapability.d.ts.map +0 -1
  246. package/dist/capabilities/refactoringCapability.js +0 -25
  247. package/dist/capabilities/refactoringCapability.js.map +0 -1
  248. package/dist/capabilities/repoChecksCapability.d.ts +0 -10
  249. package/dist/capabilities/repoChecksCapability.d.ts.map +0 -1
  250. package/dist/capabilities/repoChecksCapability.js +0 -24
  251. package/dist/capabilities/repoChecksCapability.js.map +0 -1
  252. package/dist/capabilities/taskManagementCapability.d.ts +0 -12
  253. package/dist/capabilities/taskManagementCapability.d.ts.map +0 -1
  254. package/dist/capabilities/taskManagementCapability.js +0 -22
  255. package/dist/capabilities/taskManagementCapability.js.map +0 -1
  256. package/dist/capabilities/testingCapability.d.ts +0 -13
  257. package/dist/capabilities/testingCapability.d.ts.map +0 -1
  258. package/dist/capabilities/testingCapability.js +0 -25
  259. package/dist/capabilities/testingCapability.js.map +0 -1
  260. package/dist/capabilities/validationCapability.d.ts +0 -13
  261. package/dist/capabilities/validationCapability.d.ts.map +0 -1
  262. package/dist/capabilities/validationCapability.js +0 -24
  263. package/dist/capabilities/validationCapability.js.map +0 -1
  264. package/dist/capabilities/webCapability.d.ts +0 -12
  265. package/dist/capabilities/webCapability.d.ts.map +0 -1
  266. package/dist/capabilities/webCapability.js +0 -22
  267. package/dist/capabilities/webCapability.js.map +0 -1
  268. package/dist/core/deepBugAnalyzer.d.ts +0 -128
  269. package/dist/core/deepBugAnalyzer.d.ts.map +0 -1
  270. package/dist/core/deepBugAnalyzer.js +0 -406
  271. package/dist/core/deepBugAnalyzer.js.map +0 -1
  272. package/dist/core/hypothesisEngine.d.ts +0 -113
  273. package/dist/core/hypothesisEngine.d.ts.map +0 -1
  274. package/dist/core/hypothesisEngine.js +0 -264
  275. package/dist/core/hypothesisEngine.js.map +0 -1
  276. package/dist/core/productTestHarness.d.ts +0 -113
  277. package/dist/core/productTestHarness.d.ts.map +0 -1
  278. package/dist/core/productTestHarness.js +0 -351
  279. package/dist/core/productTestHarness.js.map +0 -1
  280. package/dist/core/validationRunner.d.ts +0 -106
  281. package/dist/core/validationRunner.d.ts.map +0 -1
  282. package/dist/core/validationRunner.js +0 -892
  283. package/dist/core/validationRunner.js.map +0 -1
  284. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts +0 -14
  285. package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts.map +0 -1
  286. package/dist/plugins/tools/browser/browserAutomationPlugin.js +0 -26
  287. package/dist/plugins/tools/browser/browserAutomationPlugin.js.map +0 -1
  288. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts +0 -3
  289. package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts.map +0 -1
  290. package/dist/plugins/tools/checks/localRepoChecksPlugin.js +0 -14
  291. package/dist/plugins/tools/checks/localRepoChecksPlugin.js.map +0 -1
  292. package/dist/plugins/tools/cloud/cloudPlugin.d.ts +0 -3
  293. package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +0 -1
  294. package/dist/plugins/tools/cloud/cloudPlugin.js +0 -14
  295. package/dist/plugins/tools/cloud/cloudPlugin.js.map +0 -1
  296. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts +0 -3
  297. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts.map +0 -1
  298. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -14
  299. package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js.map +0 -1
  300. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts +0 -3
  301. package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts.map +0 -1
  302. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js +0 -14
  303. package/dist/plugins/tools/codeQuality/codeQualityPlugin.js.map +0 -1
  304. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts +0 -3
  305. package/dist/plugins/tools/dependency/dependencyPlugin.d.ts.map +0 -1
  306. package/dist/plugins/tools/dependency/dependencyPlugin.js +0 -12
  307. package/dist/plugins/tools/dependency/dependencyPlugin.js.map +0 -1
  308. package/dist/plugins/tools/development/devPlugin.d.ts +0 -3
  309. package/dist/plugins/tools/development/devPlugin.d.ts.map +0 -1
  310. package/dist/plugins/tools/development/devPlugin.js +0 -14
  311. package/dist/plugins/tools/development/devPlugin.js.map +0 -1
  312. package/dist/plugins/tools/email/emailPlugin.d.ts +0 -3
  313. package/dist/plugins/tools/email/emailPlugin.d.ts.map +0 -1
  314. package/dist/plugins/tools/email/emailPlugin.js +0 -12
  315. package/dist/plugins/tools/email/emailPlugin.js.map +0 -1
  316. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.d.ts +0 -3
  317. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.d.ts.map +0 -1
  318. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.js +0 -14
  319. package/dist/plugins/tools/enhancedAnalysis/enhancedAnalysisPlugin.js.map +0 -1
  320. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.d.ts +0 -3
  321. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.d.ts.map +0 -1
  322. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.js +0 -12
  323. package/dist/plugins/tools/enhancedCodeIntelligence/enhancedCodeIntelligencePlugin.js.map +0 -1
  324. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.d.ts +0 -3
  325. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.d.ts.map +0 -1
  326. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.js +0 -12
  327. package/dist/plugins/tools/enhancedDevWorkflow/enhancedDevWorkflowPlugin.js.map +0 -1
  328. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts +0 -3
  329. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts.map +0 -1
  330. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js +0 -14
  331. package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js.map +0 -1
  332. package/dist/plugins/tools/interaction/interactionPlugin.d.ts +0 -3
  333. package/dist/plugins/tools/interaction/interactionPlugin.d.ts.map +0 -1
  334. package/dist/plugins/tools/interaction/interactionPlugin.js +0 -12
  335. package/dist/plugins/tools/interaction/interactionPlugin.js.map +0 -1
  336. package/dist/plugins/tools/learn/learnPlugin.d.ts +0 -3
  337. package/dist/plugins/tools/learn/learnPlugin.d.ts.map +0 -1
  338. package/dist/plugins/tools/learn/learnPlugin.js +0 -14
  339. package/dist/plugins/tools/learn/learnPlugin.js.map +0 -1
  340. package/dist/plugins/tools/notebook/notebookPlugin.d.ts +0 -9
  341. package/dist/plugins/tools/notebook/notebookPlugin.d.ts.map +0 -1
  342. package/dist/plugins/tools/notebook/notebookPlugin.js +0 -15
  343. package/dist/plugins/tools/notebook/notebookPlugin.js.map +0 -1
  344. package/dist/plugins/tools/planning/planningPlugin.d.ts +0 -9
  345. package/dist/plugins/tools/planning/planningPlugin.d.ts.map +0 -1
  346. package/dist/plugins/tools/planning/planningPlugin.js +0 -15
  347. package/dist/plugins/tools/planning/planningPlugin.js.map +0 -1
  348. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts +0 -3
  349. package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts.map +0 -1
  350. package/dist/plugins/tools/refactoring/refactoringPlugin.js +0 -12
  351. package/dist/plugins/tools/refactoring/refactoringPlugin.js.map +0 -1
  352. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts +0 -3
  353. package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts.map +0 -1
  354. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js +0 -12
  355. package/dist/plugins/tools/taskManagement/taskManagementPlugin.js.map +0 -1
  356. package/dist/plugins/tools/testing/testingPlugin.d.ts +0 -3
  357. package/dist/plugins/tools/testing/testingPlugin.d.ts.map +0 -1
  358. package/dist/plugins/tools/testing/testingPlugin.js +0 -12
  359. package/dist/plugins/tools/testing/testingPlugin.js.map +0 -1
  360. package/dist/plugins/tools/validation/validationPlugin.d.ts +0 -3
  361. package/dist/plugins/tools/validation/validationPlugin.d.ts.map +0 -1
  362. package/dist/plugins/tools/validation/validationPlugin.js +0 -14
  363. package/dist/plugins/tools/validation/validationPlugin.js.map +0 -1
  364. package/dist/plugins/tools/web/webPlugin.d.ts +0 -3
  365. package/dist/plugins/tools/web/webPlugin.d.ts.map +0 -1
  366. package/dist/plugins/tools/web/webPlugin.js +0 -12
  367. package/dist/plugins/tools/web/webPlugin.js.map +0 -1
  368. package/dist/tools/advancedTestGenerationTools.d.ts +0 -21
  369. package/dist/tools/advancedTestGenerationTools.d.ts.map +0 -1
  370. package/dist/tools/advancedTestGenerationTools.js +0 -304
  371. package/dist/tools/advancedTestGenerationTools.js.map +0 -1
  372. package/dist/tools/browserAutomationTools.d.ts +0 -23
  373. package/dist/tools/browserAutomationTools.d.ts.map +0 -1
  374. package/dist/tools/browserAutomationTools.js +0 -916
  375. package/dist/tools/browserAutomationTools.js.map +0 -1
  376. package/dist/tools/buildTools.d.ts +0 -9
  377. package/dist/tools/buildTools.d.ts.map +0 -1
  378. package/dist/tools/buildTools.js +0 -346
  379. package/dist/tools/buildTools.js.map +0 -1
  380. package/dist/tools/cloudTools.d.ts +0 -49
  381. package/dist/tools/cloudTools.d.ts.map +0 -1
  382. package/dist/tools/cloudTools.js +0 -1258
  383. package/dist/tools/cloudTools.js.map +0 -1
  384. package/dist/tools/codeAnalysisTools.d.ts +0 -74
  385. package/dist/tools/codeAnalysisTools.d.ts.map +0 -1
  386. package/dist/tools/codeAnalysisTools.js +0 -664
  387. package/dist/tools/codeAnalysisTools.js.map +0 -1
  388. package/dist/tools/codeGenerationTools.d.ts +0 -3
  389. package/dist/tools/codeGenerationTools.d.ts.map +0 -1
  390. package/dist/tools/codeGenerationTools.js +0 -439
  391. package/dist/tools/codeGenerationTools.js.map +0 -1
  392. package/dist/tools/codeQualityTools.d.ts +0 -3
  393. package/dist/tools/codeQualityTools.d.ts.map +0 -1
  394. package/dist/tools/codeQualityTools.js +0 -297
  395. package/dist/tools/codeQualityTools.js.map +0 -1
  396. package/dist/tools/dependencyTools.d.ts +0 -3
  397. package/dist/tools/dependencyTools.d.ts.map +0 -1
  398. package/dist/tools/dependencyTools.js +0 -284
  399. package/dist/tools/dependencyTools.js.map +0 -1
  400. package/dist/tools/devTools.d.ts +0 -10
  401. package/dist/tools/devTools.d.ts.map +0 -1
  402. package/dist/tools/devTools.js +0 -2126
  403. package/dist/tools/devTools.js.map +0 -1
  404. package/dist/tools/emailTools.d.ts +0 -21
  405. package/dist/tools/emailTools.d.ts.map +0 -1
  406. package/dist/tools/emailTools.js +0 -449
  407. package/dist/tools/emailTools.js.map +0 -1
  408. package/dist/tools/enhancedAnalysisTools.d.ts +0 -9
  409. package/dist/tools/enhancedAnalysisTools.d.ts.map +0 -1
  410. package/dist/tools/enhancedAnalysisTools.js +0 -370
  411. package/dist/tools/enhancedAnalysisTools.js.map +0 -1
  412. package/dist/tools/enhancedCodeIntelligenceTools.d.ts +0 -7
  413. package/dist/tools/enhancedCodeIntelligenceTools.d.ts.map +0 -1
  414. package/dist/tools/enhancedCodeIntelligenceTools.js +0 -540
  415. package/dist/tools/enhancedCodeIntelligenceTools.js.map +0 -1
  416. package/dist/tools/enhancedDevWorkflowTools.d.ts +0 -7
  417. package/dist/tools/enhancedDevWorkflowTools.d.ts.map +0 -1
  418. package/dist/tools/enhancedDevWorkflowTools.js +0 -432
  419. package/dist/tools/enhancedDevWorkflowTools.js.map +0 -1
  420. package/dist/tools/frontendTestingTools.d.ts +0 -35
  421. package/dist/tools/frontendTestingTools.d.ts.map +0 -1
  422. package/dist/tools/frontendTestingTools.js +0 -1258
  423. package/dist/tools/frontendTestingTools.js.map +0 -1
  424. package/dist/tools/globTools.d.ts +0 -15
  425. package/dist/tools/globTools.d.ts.map +0 -1
  426. package/dist/tools/globTools.js +0 -174
  427. package/dist/tools/globTools.js.map +0 -1
  428. package/dist/tools/grepTools.d.ts +0 -19
  429. package/dist/tools/grepTools.d.ts.map +0 -1
  430. package/dist/tools/grepTools.js +0 -411
  431. package/dist/tools/grepTools.js.map +0 -1
  432. package/dist/tools/interactionTools.d.ts +0 -6
  433. package/dist/tools/interactionTools.d.ts.map +0 -1
  434. package/dist/tools/interactionTools.js +0 -209
  435. package/dist/tools/interactionTools.js.map +0 -1
  436. package/dist/tools/learnTools.d.ts +0 -164
  437. package/dist/tools/learnTools.d.ts.map +0 -1
  438. package/dist/tools/learnTools.js +0 -2098
  439. package/dist/tools/learnTools.js.map +0 -1
  440. package/dist/tools/notebookEditTools.d.ts +0 -15
  441. package/dist/tools/notebookEditTools.d.ts.map +0 -1
  442. package/dist/tools/notebookEditTools.js +0 -197
  443. package/dist/tools/notebookEditTools.js.map +0 -1
  444. package/dist/tools/refactoringTools.d.ts +0 -3
  445. package/dist/tools/refactoringTools.d.ts.map +0 -1
  446. package/dist/tools/refactoringTools.js +0 -294
  447. package/dist/tools/refactoringTools.js.map +0 -1
  448. package/dist/tools/repoChecksTools.d.ts +0 -3
  449. package/dist/tools/repoChecksTools.d.ts.map +0 -1
  450. package/dist/tools/repoChecksTools.js +0 -276
  451. package/dist/tools/repoChecksTools.js.map +0 -1
  452. package/dist/tools/taskManagementTools.d.ts +0 -10
  453. package/dist/tools/taskManagementTools.d.ts.map +0 -1
  454. package/dist/tools/taskManagementTools.js +0 -133
  455. package/dist/tools/taskManagementTools.js.map +0 -1
  456. package/dist/tools/testingTools.d.ts +0 -3
  457. package/dist/tools/testingTools.d.ts.map +0 -1
  458. package/dist/tools/testingTools.js +0 -237
  459. package/dist/tools/testingTools.js.map +0 -1
  460. package/dist/tools/validationTools.d.ts +0 -7
  461. package/dist/tools/validationTools.d.ts.map +0 -1
  462. package/dist/tools/validationTools.js +0 -344
  463. package/dist/tools/validationTools.js.map +0 -1
  464. package/dist/tools/webTools.d.ts +0 -3
  465. package/dist/tools/webTools.d.ts.map +0 -1
  466. package/dist/tools/webTools.js +0 -502
  467. package/dist/tools/webTools.js.map +0 -1
@@ -1,981 +1,38 @@
1
1
  /**
2
- * Self-Evolution System for erosolar-cli
3
- *
4
- * When erosolar-cli is run in its own source repository, this module enables
5
- * fully automatic self-improvement using AlphaZero-style techniques.
6
- *
7
- * The system:
8
- * 1. Analyzes its own source code for improvement opportunities
9
- * 2. Generates fixes using dual-response + self-critique
10
- * 3. Validates with build + tests
11
- * 4. Commits successful changes
12
- * 5. Relaunches to run the improved version
13
- * 6. Continues until no more improvements found
14
- *
15
- * Safety:
16
- * - Git checkpoint before any changes
17
- * - Every change validated with build + tests
18
- * - Automatic rollback on any failure
19
- * - Max iterations to prevent infinite loops
20
- * - Human-readable commit messages
21
- *
22
- * Principal Investigator: Bo Shang
2
+ * Self Evolution - Minimal stub for backward compatibility
23
3
  */
24
- import { execSync, spawn } from 'node:child_process';
25
- import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from 'node:fs';
26
- import { join, relative } from 'node:path';
27
- import { homedir } from 'node:os';
28
- // ============================================================================
29
- // CONSTANTS
30
- // ============================================================================
31
- const DEFAULT_CONFIG = {
32
- maxIterations: 50,
33
- minConfidence: 0.8,
34
- runTests: true,
35
- autoRelaunch: true,
36
- verboseLogging: true,
37
- targetAreas: ['bugs', 'types', 'performance'],
38
- priorityPaths: ['tools', 'core', 'providers', 'mcp', 'subagents'], // Critical modular parts first
39
- anyRepo: true, // Now works on any repo
40
- };
41
- // File priority scoring - higher means more important to fix first
42
- const FILE_PRIORITY_MAP = {
43
- 'tools': 100, // Tool source code - highest priority
44
- 'core': 90, // Core functionality
45
- 'providers': 85, // Provider integrations
46
- 'mcp': 80, // MCP servers
47
- 'subagents': 75, // Subagent implementations
48
- 'capabilities': 70,
49
- 'runtime': 65,
50
- 'shell': 60,
51
- 'ui': 50,
52
- 'config': 45,
53
- 'utils': 40,
54
- 'tests': 30,
55
- };
56
- const STATE_FILE = join(homedir(), '.erosolar', 'evolution-state.json');
57
- const EVOLUTION_LOG = join(homedir(), '.erosolar', 'evolution.log');
58
- // Known patterns to look for in erosolar-cli source
59
- const SOURCE_PATTERNS = {
60
- typeErrors: [
61
- /as\s+any\b/g, // Unsafe type assertions
62
- /\/\/\s*@ts-ignore/g, // Type suppressions
63
- /\/\/\s*@ts-expect-error/g, // Expected errors
64
- /:\s*any\b/g, // Explicit any types
65
- ],
66
- bugs: [
67
- /catch\s*\(\s*\)\s*\{/g, // Empty catch blocks
68
- /console\.(log|warn|error)\(/g, // Debug statements
69
- /TODO|FIXME|HACK|XXX/gi, // Code markers
70
- /throw\s+new\s+Error\s*\(\s*\)/g, // Empty error messages
71
- ],
72
- performance: [
73
- /\.forEach\s*\(/g, // forEach (consider for...of)
74
- /JSON\.parse\(JSON\.stringify/g, // Deep clone antipattern
75
- /new\s+RegExp\(/g, // Dynamic regex (could be static)
76
- ],
77
- };
78
- // ============================================================================
79
- // STATE MANAGEMENT
80
- // ============================================================================
81
- let evolutionState = {
82
- isRunning: false,
83
- startTime: null,
84
- iteration: 0,
85
- totalFixed: 0,
86
- totalFailed: 0,
87
- checkpointTag: null,
88
- lastCommit: null,
89
- relaunchCount: 0,
90
- };
91
- function loadState() {
92
- try {
93
- if (existsSync(STATE_FILE)) {
94
- return JSON.parse(readFileSync(STATE_FILE, 'utf-8'));
95
- }
96
- }
97
- catch {
98
- // Ignore
99
- }
100
- return evolutionState;
4
+ export function isValidSourceRepo(_path) {
5
+ return false;
101
6
  }
102
- function saveState() {
103
- const dir = join(homedir(), '.erosolar');
104
- if (!existsSync(dir)) {
105
- mkdirSync(dir, { recursive: true });
106
- }
107
- writeFileSync(STATE_FILE, JSON.stringify(evolutionState, null, 2));
7
+ export function getRepoName(_path) {
8
+ return 'unknown';
108
9
  }
109
- function log(message) {
110
- const timestamp = new Date().toISOString();
111
- const line = `[${timestamp}] ${message}\n`;
112
- // Append to log file
113
- const dir = join(homedir(), '.erosolar');
114
- if (!existsSync(dir)) {
115
- mkdirSync(dir, { recursive: true });
116
- }
117
- try {
118
- const existing = existsSync(EVOLUTION_LOG) ? readFileSync(EVOLUTION_LOG, 'utf-8') : '';
119
- writeFileSync(EVOLUTION_LOG, existing + line);
120
- }
121
- catch {
122
- // Ignore logging errors
123
- }
124
- }
125
- // ============================================================================
126
- // DETECTION
127
- // ============================================================================
128
- /**
129
- * Check if we're running in the erosolar-cli source repository
130
- */
131
- export function isErosolarRepo(workingDir) {
132
- try {
133
- const packagePath = join(workingDir, 'package.json');
134
- if (!existsSync(packagePath))
135
- return false;
136
- const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));
137
- return pkg.name === 'erosolar-cli';
138
- }
139
- catch {
140
- return false;
141
- }
142
- }
143
- /**
144
- * Get the erosolar-cli version
145
- */
146
- export function getVersion(workingDir) {
147
- try {
148
- const packagePath = join(workingDir, 'package.json');
149
- const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));
150
- return pkg.version ?? 'unknown';
151
- }
152
- catch {
153
- return 'unknown';
154
- }
155
- }
156
- // ============================================================================
157
- // SOURCE ANALYSIS
158
- // ============================================================================
159
- /**
160
- * Calculate priority score for a file based on its path
161
- */
162
- function getFilePriority(filePath) {
163
- // Check each priority path
164
- for (const [pathKey, priority] of Object.entries(FILE_PRIORITY_MAP)) {
165
- if (filePath.includes(`/${pathKey}/`) || filePath.includes(`\\${pathKey}\\`) || filePath.startsWith(`${pathKey}/`)) {
166
- return priority;
167
- }
168
- }
169
- return 20; // Default priority for unclassified files
170
- }
171
- /**
172
- * Check if the directory is a valid git repository with source code
173
- */
174
- export function isValidSourceRepo(workingDir) {
175
- try {
176
- // Check for git
177
- const gitDir = join(workingDir, '.git');
178
- if (!existsSync(gitDir))
179
- return false;
180
- // Check for package.json or src directory
181
- const packagePath = join(workingDir, 'package.json');
182
- const srcDir = join(workingDir, 'src');
183
- return existsSync(packagePath) || existsSync(srcDir);
184
- }
185
- catch {
186
- return false;
187
- }
188
- }
189
- /**
190
- * Get the repository name from package.json or directory name
191
- */
192
- export function getRepoName(workingDir) {
193
- try {
194
- const packagePath = join(workingDir, 'package.json');
195
- if (existsSync(packagePath)) {
196
- const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));
197
- if (pkg.name)
198
- return pkg.name;
199
- }
200
- }
201
- catch {
202
- // Ignore
203
- }
204
- return workingDir.split(/[/\\]/).pop() ?? 'unknown';
205
- }
206
- /**
207
- * Analyze source code for improvement opportunities
208
- */
209
- export function analyzeSource(workingDir) {
210
- const issues = [];
211
- const srcDir = join(workingDir, 'src');
212
- if (!existsSync(srcDir)) {
213
- return issues;
214
- }
215
- // Recursively find all TypeScript files
216
- const tsFiles = findFiles(srcDir, '.ts');
217
- for (const file of tsFiles) {
218
- const content = readFileSync(file, 'utf-8');
219
- const relativePath = relative(workingDir, file);
220
- const filePriority = getFilePriority(relativePath);
221
- // Check for type issues
222
- for (const pattern of SOURCE_PATTERNS.typeErrors) {
223
- let match;
224
- pattern.lastIndex = 0;
225
- while ((match = pattern.exec(content)) !== null) {
226
- const lineNum = content.slice(0, match.index).split('\n').length;
227
- issues.push({
228
- type: 'type-error',
229
- severity: pattern.source.includes('any') ? 'medium' : 'low',
230
- file: relativePath,
231
- line: lineNum,
232
- description: `Found ${match[0]} - consider adding proper types`,
233
- confidence: 0.7,
234
- priority: filePriority,
235
- });
236
- }
237
- }
238
- // Check for bugs
239
- for (const pattern of SOURCE_PATTERNS.bugs) {
240
- let match;
241
- pattern.lastIndex = 0;
242
- while ((match = pattern.exec(content)) !== null) {
243
- const lineNum = content.slice(0, match.index).split('\n').length;
244
- const isTodo = /TODO|FIXME|HACK|XXX/i.test(match[0]);
245
- issues.push({
246
- type: isTodo ? 'todo' : 'bug',
247
- severity: isTodo ? 'low' : 'medium',
248
- file: relativePath,
249
- line: lineNum,
250
- description: isTodo
251
- ? `Found ${match[0]} marker - needs attention`
252
- : `Found potential issue: ${match[0]}`,
253
- confidence: isTodo ? 0.9 : 0.6,
254
- priority: filePriority,
255
- });
256
- }
257
- }
258
- // Check for performance issues
259
- for (const pattern of SOURCE_PATTERNS.performance) {
260
- let match;
261
- pattern.lastIndex = 0;
262
- while ((match = pattern.exec(content)) !== null) {
263
- const lineNum = content.slice(0, match.index).split('\n').length;
264
- issues.push({
265
- type: 'performance',
266
- severity: 'low',
267
- file: relativePath,
268
- line: lineNum,
269
- description: `Performance: ${match[0]} could be optimized`,
270
- confidence: 0.5,
271
- priority: filePriority,
272
- });
273
- }
274
- }
275
- }
276
- // Run TypeScript compiler to find real type errors
277
- try {
278
- execSync('npx tsc --noEmit 2>&1', { cwd: workingDir, encoding: 'utf-8' });
279
- }
280
- catch (error) {
281
- if (error instanceof Error && 'stdout' in error) {
282
- const output = error.stdout;
283
- const errorLines = output.split('\n').filter(l => l.includes('error TS'));
284
- for (const line of errorLines.slice(0, 20)) { // Limit to 20 errors
285
- const match = line.match(/(.+)\((\d+),\d+\):\s*error\s+TS\d+:\s*(.+)/);
286
- if (match) {
287
- const errorFile = match[1];
288
- issues.push({
289
- type: 'type-error',
290
- severity: 'high',
291
- file: errorFile,
292
- line: parseInt(match[2], 10),
293
- description: match[3],
294
- confidence: 1.0, // Real TypeScript errors
295
- priority: getFilePriority(errorFile),
296
- });
297
- }
298
- }
299
- }
300
- }
301
- // Sort by priority first (higher = more important), then severity, then confidence
302
- const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
303
- issues.sort((a, b) => {
304
- // Priority first (higher priority = should come first)
305
- const prioDiff = b.priority - a.priority;
306
- if (prioDiff !== 0)
307
- return prioDiff;
308
- // Then severity
309
- const sevDiff = severityOrder[a.severity] - severityOrder[b.severity];
310
- if (sevDiff !== 0)
311
- return sevDiff;
312
- // Then confidence
313
- return b.confidence - a.confidence;
314
- });
315
- return issues;
316
- }
317
- function findFiles(dir, extension) {
318
- const files = [];
319
- try {
320
- const entries = readdirSync(dir, { withFileTypes: true });
321
- for (const entry of entries) {
322
- const fullPath = join(dir, entry.name);
323
- if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules' && entry.name !== 'dist') {
324
- files.push(...findFiles(fullPath, extension));
325
- }
326
- else if (entry.isFile() && entry.name.endsWith(extension)) {
327
- files.push(fullPath);
328
- }
329
- }
330
- }
331
- catch {
332
- // Ignore directory access errors
333
- }
334
- return files;
335
- }
336
- // ============================================================================
337
- // GIT OPERATIONS
338
- // ============================================================================
339
- function createCheckpoint(workingDir) {
340
- const timestamp = Date.now();
341
- const tag = `evolution-checkpoint-${timestamp}`;
342
- // Stash any uncommitted changes
343
- try {
344
- const status = execSync('git status --porcelain', { cwd: workingDir, encoding: 'utf-8' }).trim();
345
- if (status) {
346
- execSync('git stash push -m "evolution-auto-stash"', { cwd: workingDir, encoding: 'utf-8' });
347
- }
348
- }
349
- catch {
350
- // Ignore stash errors
351
- }
352
- // Create tag
353
- execSync(`git tag ${tag}`, { cwd: workingDir, encoding: 'utf-8' });
354
- return tag;
355
- }
356
- function rollbackToCheckpoint(workingDir, tag) {
357
- try {
358
- execSync(`git reset --hard ${tag}`, { cwd: workingDir, encoding: 'utf-8' });
359
- execSync(`git tag -d ${tag}`, { cwd: workingDir, encoding: 'utf-8' });
360
- // Try to restore stash
361
- try {
362
- execSync('git stash pop', { cwd: workingDir, encoding: 'utf-8' });
363
- }
364
- catch {
365
- // No stash to pop
366
- }
367
- return true;
368
- }
369
- catch {
370
- return false;
371
- }
372
- }
373
- // ============================================================================
374
- // BUILD & TEST
375
- // ============================================================================
376
- function runBuild(workingDir) {
377
- try {
378
- execSync('npm run build', { cwd: workingDir, encoding: 'utf-8', stdio: 'pipe' });
379
- return { success: true };
380
- }
381
- catch (error) {
382
- const msg = error instanceof Error ? error.message : String(error);
383
- return { success: false, error: msg.slice(0, 500) };
384
- }
385
- }
386
- function runTests(workingDir) {
387
- try {
388
- execSync('npm test', { cwd: workingDir, encoding: 'utf-8', stdio: 'pipe', timeout: 120000 });
389
- return { success: true };
390
- }
391
- catch (error) {
392
- const msg = error instanceof Error ? error.message : String(error);
393
- return { success: false, error: msg.slice(0, 500) };
394
- }
395
- }
396
- // ============================================================================
397
- // RELAUNCH
398
- // ============================================================================
399
- /**
400
- * Relaunch erosolar-cli with the new code
401
- */
402
- export function relaunchWithNewCode(workingDir) {
403
- log('Relaunching with new code...');
404
- // Increment relaunch count
405
- evolutionState.relaunchCount++;
406
- saveState();
407
- // Spawn new process
408
- const args = process.argv.slice(2);
409
- args.push('--continue-evolution'); // Flag to continue evolution
410
- spawn('node', ['dist/bin/erosolar.js', ...args], {
411
- cwd: workingDir,
412
- stdio: 'inherit',
413
- detached: false,
414
- });
415
- // Exit current process
416
- process.exit(0);
10
+ export function analyzeSource(_path) {
11
+ return [];
417
12
  }
418
- /**
419
- * Run the full self-evolution loop
420
- */
421
- export async function runSelfEvolution(workingDir, config = {}, callbacks = {}) {
422
- const cfg = { ...DEFAULT_CONFIG, ...config };
423
- // Verify we're in erosolar repo
424
- if (!isErosolarRepo(workingDir)) {
425
- return {
426
- success: false,
427
- iteration: 0,
428
- issuesFound: 0,
429
- issuesFixed: 0,
430
- filesChanged: [],
431
- nextAction: 'done',
432
- error: 'Not in erosolar-cli repository',
433
- };
434
- }
435
- // Load or initialize state
436
- evolutionState = loadState();
437
- // Check if this is a continuation
438
- const isContinuation = process.argv.includes('--continue-evolution');
439
- if (!isContinuation) {
440
- // Fresh start - create checkpoint
441
- evolutionState = {
442
- isRunning: true,
443
- startTime: new Date().toISOString(),
444
- iteration: 0,
445
- totalFixed: 0,
446
- totalFailed: 0,
447
- checkpointTag: createCheckpoint(workingDir),
448
- lastCommit: null,
449
- relaunchCount: 0,
450
- };
451
- saveState();
452
- log(`Started self-evolution. Checkpoint: ${evolutionState.checkpointTag}`);
453
- }
454
- else {
455
- evolutionState.isRunning = true;
456
- log(`Continuing self-evolution. Iteration: ${evolutionState.iteration}, Relaunch: ${evolutionState.relaunchCount}`);
457
- }
458
- callbacks.onStart?.();
459
- try {
460
- while (evolutionState.isRunning && evolutionState.iteration < cfg.maxIterations) {
461
- evolutionState.iteration++;
462
- saveState();
463
- log(`=== Iteration ${evolutionState.iteration} ===`);
464
- // Analyze source
465
- const issues = analyzeSource(workingDir);
466
- const highConfidence = issues.filter(i => i.confidence >= cfg.minConfidence);
467
- callbacks.onIteration?.(evolutionState.iteration, highConfidence);
468
- if (highConfidence.length === 0) {
469
- log('No high-confidence issues found. Evolution complete.');
470
- return {
471
- success: true,
472
- iteration: evolutionState.iteration,
473
- issuesFound: issues.length,
474
- issuesFixed: evolutionState.totalFixed,
475
- filesChanged: [],
476
- nextAction: 'done',
477
- };
478
- }
479
- log(`Found ${highConfidence.length} high-confidence issues`);
480
- // Take the highest priority issue
481
- const issue = highConfidence[0];
482
- log(`Attempting to fix: ${issue.file}:${issue.line} - ${issue.description}`);
483
- // For now, we can only fix issues we have automated fixes for
484
- // In a full implementation, we would use the LLM to generate fixes
485
- // Validate current state
486
- const buildResult = runBuild(workingDir);
487
- if (!buildResult.success) {
488
- log(`Build failed: ${buildResult.error}`);
489
- evolutionState.totalFailed++;
490
- callbacks.onFix?.(issue, false);
491
- // Rollback if we made changes
492
- if (evolutionState.checkpointTag) {
493
- rollbackToCheckpoint(workingDir, evolutionState.checkpointTag);
494
- evolutionState.checkpointTag = createCheckpoint(workingDir);
495
- }
496
- continue;
497
- }
498
- if (cfg.runTests) {
499
- const testResult = runTests(workingDir);
500
- if (!testResult.success) {
501
- log(`Tests failed: ${testResult.error}`);
502
- evolutionState.totalFailed++;
503
- callbacks.onFix?.(issue, false);
504
- continue;
505
- }
506
- }
507
- // If we get here with no actual fixes applied, continue to next iteration
508
- // In a full implementation, we would have applied a fix
509
- // Simulate some delay
510
- await new Promise(resolve => setTimeout(resolve, 1000));
511
- // Check if we should relaunch (every 10 successful fixes)
512
- if (cfg.autoRelaunch && evolutionState.totalFixed > 0 && evolutionState.totalFixed % 10 === 0) {
513
- callbacks.onRelaunch?.();
514
- relaunchWithNewCode(workingDir);
515
- return {
516
- success: true,
517
- iteration: evolutionState.iteration,
518
- issuesFound: issues.length,
519
- issuesFixed: evolutionState.totalFixed,
520
- filesChanged: [],
521
- nextAction: 'relaunch',
522
- };
523
- }
524
- }
525
- // Reached max iterations
526
- return {
527
- success: true,
528
- iteration: evolutionState.iteration,
529
- issuesFound: 0,
530
- issuesFixed: evolutionState.totalFixed,
531
- filesChanged: [],
532
- nextAction: 'done',
533
- };
534
- }
535
- catch (error) {
536
- const errorMsg = error instanceof Error ? error.message : String(error);
537
- log(`Evolution error: ${errorMsg}`);
538
- callbacks.onError?.(errorMsg);
539
- // Rollback on error
540
- if (evolutionState.checkpointTag) {
541
- rollbackToCheckpoint(workingDir, evolutionState.checkpointTag);
542
- }
543
- return {
544
- success: false,
545
- iteration: evolutionState.iteration,
546
- issuesFound: 0,
547
- issuesFixed: evolutionState.totalFixed,
548
- filesChanged: [],
549
- nextAction: 'rollback',
550
- error: errorMsg,
551
- };
552
- }
553
- finally {
554
- evolutionState.isRunning = false;
555
- saveState();
556
- }
13
+ export async function runSelfEvolution(_sourcePath, _options, _callbacks) {
14
+ return {
15
+ success: false,
16
+ iteration: 0,
17
+ issuesFound: 0,
18
+ issuesFixed: 0,
19
+ error: 'Feature deprecated',
20
+ nextAction: 'none',
21
+ };
557
22
  }
558
- /**
559
- * Stop the evolution process
560
- */
561
23
  export function stopEvolution() {
562
- evolutionState.isRunning = false;
563
- saveState();
564
- log('Evolution stopped by user');
565
- }
566
- /**
567
- * Get current evolution state
568
- */
569
- export function getEvolutionState() {
570
- return { ...loadState() };
571
- }
572
- /**
573
- * Emergency rollback to last checkpoint
574
- */
575
- export function emergencyEvolutionRollback(workingDir) {
576
- const state = loadState();
577
- if (!state.checkpointTag) {
578
- return { success: false, message: 'No checkpoint found' };
579
- }
580
- const success = rollbackToCheckpoint(workingDir, state.checkpointTag);
581
- if (success) {
582
- // Reset state
583
- evolutionState = {
584
- isRunning: false,
585
- startTime: null,
586
- iteration: 0,
587
- totalFixed: 0,
588
- totalFailed: 0,
589
- checkpointTag: null,
590
- lastCommit: null,
591
- relaunchCount: 0,
592
- };
593
- saveState();
594
- return { success: true, message: `Rolled back to ${state.checkpointTag}` };
595
- }
596
- return { success: false, message: 'Rollback failed' };
597
- }
598
- /**
599
- * Get formatted status for display
600
- */
601
- export function getEvolutionStatus(workingDir) {
602
- const state = loadState();
603
- const version = getVersion(workingDir);
604
- const isValid = isValidSourceRepo(workingDir);
605
- const repoName = getRepoName(workingDir);
606
- const isErosolar = isErosolarRepo(workingDir);
607
- const lines = [];
608
- lines.push('═══════════════════════════════════════════════════════════');
609
- lines.push(' 🧬 Self-Evolution System');
610
- lines.push('═══════════════════════════════════════════════════════════');
611
- lines.push('');
612
- lines.push(`Repository: ${isValid ? `✅ ${repoName}` : '❌ Not a valid source repo'}`);
613
- if (isErosolar) {
614
- lines.push(`Type: erosolar-cli (enhanced self-improvement)`);
615
- }
616
- lines.push(`Version: ${version}`);
617
- lines.push('');
618
- if (state.isRunning) {
619
- lines.push('Status: 🔄 RUNNING');
620
- lines.push(` Started: ${state.startTime}`);
621
- lines.push(` Iteration: ${state.iteration}`);
622
- lines.push(` Fixed: ${state.totalFixed}`);
623
- lines.push(` Failed: ${state.totalFailed}`);
624
- lines.push(` Relaunches: ${state.relaunchCount}`);
625
- }
626
- else if (state.totalFixed > 0 || state.totalFailed > 0) {
627
- lines.push('Status: ⏸️ PAUSED');
628
- lines.push(` Last run: ${state.startTime}`);
629
- lines.push(` Total fixed: ${state.totalFixed}`);
630
- lines.push(` Total failed: ${state.totalFailed}`);
631
- }
632
- else {
633
- lines.push('Status: ⏹️ NOT STARTED');
634
- }
635
- lines.push('');
636
- lines.push('Commands:');
637
- lines.push(' /evolve start - Start self-evolution loop');
638
- lines.push(' /evolve stop - Stop evolution');
639
- lines.push(' /evolve status - Show this status');
640
- lines.push(' /evolve rollback - Emergency rollback');
641
- lines.push(' /evolve analyze - Analyze source without fixing');
642
- lines.push(' /evolve learn - Learn patterns from source code');
643
- lines.push(' /evolve fix - Generate fix suggestions');
644
- lines.push('');
645
- lines.push('═══════════════════════════════════════════════════════════');
646
- return lines.join('\n');
647
- }
648
- const LEARNED_PATTERNS_FILE = join(homedir(), '.erosolar', 'source-patterns.json');
649
- /**
650
- * Learn optimal patterns from erosolar-cli's own source code
651
- */
652
- export function learnSourcePatterns(workingDir) {
653
- const patterns = [];
654
- const srcDir = join(workingDir, 'src');
655
- if (!existsSync(srcDir)) {
656
- return patterns;
657
- }
658
- const tsFiles = findFiles(srcDir, '.ts');
659
- for (const file of tsFiles) {
660
- const content = readFileSync(file, 'utf-8');
661
- const relativePath = relative(workingDir, file);
662
- // Learn tool implementation patterns from tools/ directory
663
- if (relativePath.includes('/tools/')) {
664
- const toolPatterns = extractToolPatterns(content, relativePath);
665
- patterns.push(...toolPatterns);
666
- }
667
- // Learn error handling patterns
668
- const errorPatterns = extractErrorHandlingPatterns(content, relativePath);
669
- patterns.push(...errorPatterns);
670
- // Learn type patterns from well-typed code
671
- const typePatterns = extractTypePatterns(content, relativePath);
672
- patterns.push(...typePatterns);
673
- // Learn API design patterns from core modules
674
- if (relativePath.includes('/core/') || relativePath.includes('/providers/')) {
675
- const apiPatterns = extractApiPatterns(content, relativePath);
676
- patterns.push(...apiPatterns);
677
- }
678
- }
679
- // Deduplicate and rank by confidence
680
- const uniquePatterns = deduplicatePatterns(patterns);
681
- // Save learned patterns
682
- saveLearnedPatterns(uniquePatterns);
683
- return uniquePatterns;
684
- }
685
- function extractToolPatterns(content, sourceFile) {
686
- const patterns = [];
687
- // Extract tool definition patterns
688
- const toolDefMatch = content.match(/export\s+(?:const|function)\s+(\w+Tool)\s*[=:]/);
689
- if (toolDefMatch) {
690
- patterns.push({
691
- category: 'tool-implementation',
692
- description: 'Tool export pattern using named function/const',
693
- example: toolDefMatch[0],
694
- sourceFile,
695
- confidence: 0.9,
696
- usageCount: 1,
697
- });
698
- }
699
- // Extract schema validation patterns
700
- const schemaMatch = content.match(/inputSchema:\s*\{[\s\S]*?type:\s*['"]object['"]/);
701
- if (schemaMatch) {
702
- patterns.push({
703
- category: 'tool-implementation',
704
- description: 'Tool input schema with JSON Schema validation',
705
- example: schemaMatch[0].slice(0, 200),
706
- sourceFile,
707
- confidence: 0.95,
708
- usageCount: 1,
709
- });
710
- }
711
- // Extract handler patterns
712
- const handlerMatch = content.match(/handler:\s*async\s*\([\s\S]*?\)\s*=>\s*\{/);
713
- if (handlerMatch) {
714
- patterns.push({
715
- category: 'tool-implementation',
716
- description: 'Async tool handler pattern',
717
- example: handlerMatch[0],
718
- sourceFile,
719
- confidence: 0.9,
720
- usageCount: 1,
721
- });
722
- }
723
- return patterns;
724
- }
725
- function extractErrorHandlingPatterns(content, sourceFile) {
726
- const patterns = [];
727
- // Good: Typed catch blocks
728
- const typedCatch = content.match(/catch\s*\(\s*(\w+)\s*\)\s*\{[\s\S]*?instanceof\s+Error/g);
729
- if (typedCatch && typedCatch.length > 0) {
730
- patterns.push({
731
- category: 'error-handling',
732
- description: 'Typed error handling with instanceof check',
733
- example: typedCatch[0].slice(0, 150),
734
- sourceFile,
735
- confidence: 0.85,
736
- usageCount: typedCatch.length,
737
- });
738
- }
739
- // Good: Result type patterns
740
- const resultPattern = content.match(/:\s*\{\s*success:\s*boolean[;,]\s*(?:error|message|data)/);
741
- if (resultPattern) {
742
- patterns.push({
743
- category: 'error-handling',
744
- description: 'Result object pattern { success, error/data }',
745
- example: resultPattern[0],
746
- sourceFile,
747
- confidence: 0.9,
748
- usageCount: 1,
749
- });
750
- }
751
- return patterns;
24
+ // No-op stub
752
25
  }
753
- function extractTypePatterns(content, sourceFile) {
754
- const patterns = [];
755
- // Interface definitions
756
- const interfaces = content.match(/export\s+interface\s+\w+\s*\{[^}]+\}/g);
757
- if (interfaces && interfaces.length > 0) {
758
- for (const iface of interfaces.slice(0, 3)) {
759
- patterns.push({
760
- category: 'type-pattern',
761
- description: 'Exported interface definition',
762
- example: iface.slice(0, 200),
763
- sourceFile,
764
- confidence: 0.8,
765
- usageCount: 1,
766
- });
767
- }
768
- }
769
- // Type guards
770
- const typeGuards = content.match(/function\s+is\w+\s*\([^)]+\):\s*\w+\s+is\s+\w+/g);
771
- if (typeGuards && typeGuards.length > 0) {
772
- patterns.push({
773
- category: 'type-pattern',
774
- description: 'Type guard function pattern',
775
- example: typeGuards[0],
776
- sourceFile,
777
- confidence: 0.95,
778
- usageCount: typeGuards.length,
779
- });
780
- }
781
- return patterns;
26
+ export function getEvolutionStatus(_workingDir) {
27
+ return 'Evolution feature is deprecated';
782
28
  }
783
- function extractApiPatterns(content, sourceFile) {
784
- const patterns = [];
785
- // Factory functions
786
- const factory = content.match(/export\s+(?:async\s+)?function\s+create\w+\s*\(/);
787
- if (factory) {
788
- patterns.push({
789
- category: 'api-design',
790
- description: 'Factory function pattern (createX)',
791
- example: factory[0],
792
- sourceFile,
793
- confidence: 0.85,
794
- usageCount: 1,
795
- });
796
- }
797
- // Builder patterns
798
- const builder = content.match(/export\s+(?:async\s+)?function\s+build\w+\s*\(/);
799
- if (builder) {
800
- patterns.push({
801
- category: 'api-design',
802
- description: 'Builder function pattern (buildX)',
803
- example: builder[0],
804
- sourceFile,
805
- confidence: 0.85,
806
- usageCount: 1,
807
- });
808
- }
809
- return patterns;
29
+ export function emergencyEvolutionRollback(_workingDir) {
30
+ return { success: true, message: 'No rollback needed (feature deprecated)' };
810
31
  }
811
- function deduplicatePatterns(patterns) {
812
- const seen = new Map();
813
- for (const pattern of patterns) {
814
- const key = `${pattern.category}:${pattern.description}`;
815
- const existing = seen.get(key);
816
- if (existing) {
817
- existing.usageCount += pattern.usageCount;
818
- existing.confidence = Math.max(existing.confidence, pattern.confidence);
819
- }
820
- else {
821
- seen.set(key, { ...pattern });
822
- }
823
- }
824
- return Array.from(seen.values())
825
- .sort((a, b) => b.confidence - a.confidence);
826
- }
827
- function saveLearnedPatterns(patterns) {
828
- const dir = join(homedir(), '.erosolar');
829
- if (!existsSync(dir)) {
830
- mkdirSync(dir, { recursive: true });
831
- }
832
- writeFileSync(LEARNED_PATTERNS_FILE, JSON.stringify(patterns, null, 2));
833
- }
834
- /**
835
- * Get all learned patterns
836
- */
837
- export function getLearnedPatterns() {
838
- try {
839
- if (existsSync(LEARNED_PATTERNS_FILE)) {
840
- return JSON.parse(readFileSync(LEARNED_PATTERNS_FILE, 'utf-8'));
841
- }
842
- }
843
- catch {
844
- // Ignore
845
- }
32
+ export function learnSourcePatterns(_path) {
846
33
  return [];
847
34
  }
848
- /**
849
- * Generate a fix for a source issue using learned patterns
850
- * Note: This uses pattern matching; full LLM integration requires runtime context
851
- */
852
- export function generateFix(issue, workingDir) {
853
- const filePath = join(workingDir, issue.file);
854
- if (!existsSync(filePath)) {
855
- return null;
856
- }
857
- const content = readFileSync(filePath, 'utf-8');
858
- const lines = content.split('\n');
859
- // Get the problematic line
860
- const lineIndex = (issue.line ?? 1) - 1;
861
- if (lineIndex < 0 || lineIndex >= lines.length) {
862
- return null;
863
- }
864
- const problemLine = lines[lineIndex];
865
- // Apply pattern-based fixes
866
- let suggestedCode = null;
867
- let explanation = '';
868
- let confidence = 0.5;
869
- let requiresManualReview = true;
870
- // Fix: as any -> add proper type annotation
871
- if (issue.description.includes('as any')) {
872
- const match = problemLine.match(/(\w+)\s+as\s+any/);
873
- if (match) {
874
- suggestedCode = problemLine.replace(/as\s+any/, `as unknown /* TODO: add proper type */`);
875
- explanation = 'Replace "as any" with "as unknown" as a safer intermediate step. Add proper type annotation.';
876
- confidence = 0.7;
877
- }
878
- }
879
- // Fix: empty catch blocks -> add error handling
880
- if (issue.description.includes('catch') && issue.description.includes('empty')) {
881
- suggestedCode = problemLine.replace(/catch\s*\(\s*\)\s*\{/, 'catch (error) {\n // Log error for debugging\n console.error(error);');
882
- explanation = 'Added error parameter and logging to empty catch block.';
883
- confidence = 0.8;
884
- }
885
- // Fix: @ts-ignore -> @ts-expect-error with reason
886
- if (issue.description.includes('@ts-ignore')) {
887
- suggestedCode = problemLine.replace(/\/\/\s*@ts-ignore.*/, '// @ts-expect-error - TODO: fix underlying type issue');
888
- explanation = 'Replace @ts-ignore with @ts-expect-error which is preferred for intentional suppressions.';
889
- confidence = 0.85;
890
- }
891
- // Fix: forEach -> for...of for better performance
892
- if (issue.description.includes('forEach')) {
893
- const match = problemLine.match(/(\w+)\.forEach\s*\(\s*(?:\(([^)]+)\)|(\w+))\s*=>/);
894
- if (match) {
895
- const arr = match[1];
896
- // Can't auto-fix reliably without understanding the full block
897
- explanation = `Consider replacing ${arr}.forEach with for...of loop for better performance and break/continue support.`;
898
- confidence = 0.4;
899
- requiresManualReview = true;
900
- }
901
- }
902
- if (!suggestedCode) {
903
- return null;
904
- }
905
- return {
906
- issue,
907
- suggestedCode,
908
- explanation,
909
- confidence,
910
- requiresManualReview,
911
- };
912
- }
913
- /**
914
- * Apply a fix to the source file
915
- */
916
- export function applyFix(fix, workingDir) {
917
- const filePath = join(workingDir, fix.issue.file);
918
- if (!existsSync(filePath)) {
919
- return false;
920
- }
921
- try {
922
- const content = readFileSync(filePath, 'utf-8');
923
- const lines = content.split('\n');
924
- const lineIndex = (fix.issue.line ?? 1) - 1;
925
- if (lineIndex < 0 || lineIndex >= lines.length) {
926
- return false;
927
- }
928
- // Replace the line
929
- lines[lineIndex] = fix.suggestedCode;
930
- writeFileSync(filePath, lines.join('\n'));
931
- log(`Applied fix to ${fix.issue.file}:${fix.issue.line}`);
932
- return true;
933
- }
934
- catch (error) {
935
- log(`Failed to apply fix: ${error instanceof Error ? error.message : String(error)}`);
936
- return false;
937
- }
938
- }
939
- /**
940
- * Get a summary of what can be learned from the source code
941
- */
942
- export function getSourceLearningSummary(workingDir) {
943
- const patterns = learnSourcePatterns(workingDir);
944
- const existingPatterns = getLearnedPatterns();
945
- const lines = [];
946
- lines.push('═══════════════════════════════════════════════════════════');
947
- lines.push(' 📚 Source Code Learning Summary');
948
- lines.push('═══════════════════════════════════════════════════════════');
949
- lines.push('');
950
- const byCategory = {
951
- 'tool-implementation': patterns.filter(p => p.category === 'tool-implementation'),
952
- 'error-handling': patterns.filter(p => p.category === 'error-handling'),
953
- 'type-pattern': patterns.filter(p => p.category === 'type-pattern'),
954
- 'api-design': patterns.filter(p => p.category === 'api-design'),
955
- 'performance': patterns.filter(p => p.category === 'performance'),
956
- };
957
- lines.push(`Total patterns learned: ${patterns.length}`);
958
- lines.push(`Previously learned: ${existingPatterns.length}`);
959
- lines.push('');
960
- lines.push('By Category:');
961
- for (const [category, catPatterns] of Object.entries(byCategory)) {
962
- if (catPatterns.length > 0) {
963
- const icon = category === 'tool-implementation' ? '🔧' :
964
- category === 'error-handling' ? '⚠️' :
965
- category === 'type-pattern' ? '📝' :
966
- category === 'api-design' ? '🏗️' : '⚡';
967
- lines.push(` ${icon} ${category}: ${catPatterns.length}`);
968
- }
969
- }
970
- lines.push('');
971
- lines.push('Top Patterns (by confidence):');
972
- for (const pattern of patterns.slice(0, 5)) {
973
- lines.push(` • ${pattern.description}`);
974
- lines.push(` Source: ${pattern.sourceFile}`);
975
- lines.push(` Confidence: ${Math.round(pattern.confidence * 100)}%`);
976
- }
977
- lines.push('');
978
- lines.push('═══════════════════════════════════════════════════════════');
979
- return lines.join('\n');
35
+ export function generateFix(_issue, _workingDirOrContext) {
36
+ return null;
980
37
  }
981
38
  //# sourceMappingURL=selfEvolution.js.map