erosolar-cli 1.7.439 → 1.7.441
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.
- package/dist/StringUtils.d.ts +8 -0
- package/dist/StringUtils.d.ts.map +1 -0
- package/dist/StringUtils.js +11 -0
- package/dist/StringUtils.js.map +1 -0
- package/dist/adapters/browser/index.d.ts +12 -0
- package/dist/adapters/browser/index.d.ts.map +1 -0
- package/dist/adapters/browser/index.js +11 -0
- package/dist/adapters/browser/index.js.map +1 -0
- package/dist/adapters/node/index.d.ts +17 -0
- package/dist/adapters/node/index.d.ts.map +1 -0
- package/dist/adapters/node/index.js +35 -0
- package/dist/adapters/node/index.js.map +1 -0
- package/dist/adapters/remote/index.d.ts +13 -0
- package/dist/adapters/remote/index.d.ts.map +1 -0
- package/dist/adapters/remote/index.js +20 -0
- package/dist/adapters/remote/index.js.map +1 -0
- package/dist/adapters/types.d.ts +14 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/bin/erosolar.d.ts +9 -0
- package/dist/bin/erosolar.d.ts.map +1 -0
- package/dist/bin/erosolar.js +93 -0
- package/dist/bin/erosolar.js.map +1 -0
- package/dist/bin/selfTest.d.ts +14 -0
- package/dist/bin/selfTest.d.ts.map +1 -0
- package/dist/bin/selfTest.js +304 -0
- package/dist/bin/selfTest.js.map +1 -0
- package/dist/browser/BrowserSessionManager.d.ts +307 -0
- package/dist/browser/BrowserSessionManager.d.ts.map +1 -0
- package/dist/browser/BrowserSessionManager.js +713 -0
- package/dist/browser/BrowserSessionManager.js.map +1 -0
- package/dist/capabilities/advancedTestGenerationCapability.d.ts +17 -0
- package/dist/capabilities/advancedTestGenerationCapability.d.ts.map +1 -0
- package/dist/capabilities/advancedTestGenerationCapability.js +28 -0
- package/dist/capabilities/advancedTestGenerationCapability.js.map +1 -0
- package/dist/capabilities/agentSpawningCapability.d.ts +6 -0
- package/dist/capabilities/agentSpawningCapability.d.ts.map +1 -0
- package/dist/capabilities/agentSpawningCapability.js +168 -0
- package/dist/capabilities/agentSpawningCapability.js.map +1 -0
- package/dist/capabilities/askUserCapability.d.ts +21 -0
- package/dist/capabilities/askUserCapability.d.ts.map +1 -0
- package/dist/capabilities/askUserCapability.js +155 -0
- package/dist/capabilities/askUserCapability.js.map +1 -0
- package/dist/capabilities/bashCapability.d.ts +13 -0
- package/dist/capabilities/bashCapability.d.ts.map +1 -0
- package/dist/capabilities/bashCapability.js +24 -0
- package/dist/capabilities/bashCapability.js.map +1 -0
- package/dist/capabilities/browserAutomationCapability.d.ts +37 -0
- package/dist/capabilities/browserAutomationCapability.d.ts.map +1 -0
- package/dist/capabilities/browserAutomationCapability.js +49 -0
- package/dist/capabilities/browserAutomationCapability.js.map +1 -0
- package/dist/capabilities/buildCapability.d.ts +24 -0
- package/dist/capabilities/buildCapability.d.ts.map +1 -0
- package/dist/capabilities/buildCapability.js +25 -0
- package/dist/capabilities/buildCapability.js.map +1 -0
- package/dist/capabilities/cloudCapability.d.ts +13 -0
- package/dist/capabilities/cloudCapability.d.ts.map +1 -0
- package/dist/capabilities/cloudCapability.js +38 -0
- package/dist/capabilities/cloudCapability.js.map +1 -0
- package/dist/capabilities/codeAnalysisCapability.d.ts +13 -0
- package/dist/capabilities/codeAnalysisCapability.d.ts.map +1 -0
- package/dist/capabilities/codeAnalysisCapability.js +24 -0
- package/dist/capabilities/codeAnalysisCapability.js.map +1 -0
- package/dist/capabilities/codeGenerationCapability.d.ts +13 -0
- package/dist/capabilities/codeGenerationCapability.d.ts.map +1 -0
- package/dist/capabilities/codeGenerationCapability.js +25 -0
- package/dist/capabilities/codeGenerationCapability.js.map +1 -0
- package/dist/capabilities/codeQualityCapability.d.ts +13 -0
- package/dist/capabilities/codeQualityCapability.d.ts.map +1 -0
- package/dist/capabilities/codeQualityCapability.js +25 -0
- package/dist/capabilities/codeQualityCapability.js.map +1 -0
- package/dist/capabilities/dependencySecurityCapability.d.ts +13 -0
- package/dist/capabilities/dependencySecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/dependencySecurityCapability.js +24 -0
- package/dist/capabilities/dependencySecurityCapability.js.map +1 -0
- package/dist/capabilities/devCapability.d.ts +13 -0
- package/dist/capabilities/devCapability.d.ts.map +1 -0
- package/dist/capabilities/devCapability.js +24 -0
- package/dist/capabilities/devCapability.js.map +1 -0
- package/dist/capabilities/editCapability.d.ts +17 -0
- package/dist/capabilities/editCapability.d.ts.map +1 -0
- package/dist/capabilities/editCapability.js +27 -0
- package/dist/capabilities/editCapability.js.map +1 -0
- package/dist/capabilities/emailCapability.d.ts +12 -0
- package/dist/capabilities/emailCapability.d.ts.map +1 -0
- package/dist/capabilities/emailCapability.js +22 -0
- package/dist/capabilities/emailCapability.js.map +1 -0
- package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts +17 -0
- package/dist/capabilities/enhancedCodeIntelligenceCapability.d.ts.map +1 -0
- package/dist/capabilities/enhancedCodeIntelligenceCapability.js +28 -0
- package/dist/capabilities/enhancedCodeIntelligenceCapability.js.map +1 -0
- package/dist/capabilities/enhancedDevWorkflowCapability.d.ts +17 -0
- package/dist/capabilities/enhancedDevWorkflowCapability.d.ts.map +1 -0
- package/dist/capabilities/enhancedDevWorkflowCapability.js +28 -0
- package/dist/capabilities/enhancedDevWorkflowCapability.js.map +1 -0
- package/dist/capabilities/enhancedGitCapability.d.ts +7 -0
- package/dist/capabilities/enhancedGitCapability.d.ts.map +1 -0
- package/dist/capabilities/enhancedGitCapability.js +220 -0
- package/dist/capabilities/enhancedGitCapability.js.map +1 -0
- package/dist/capabilities/filesystemCapability.d.ts +13 -0
- package/dist/capabilities/filesystemCapability.d.ts.map +1 -0
- package/dist/capabilities/filesystemCapability.js +24 -0
- package/dist/capabilities/filesystemCapability.js.map +1 -0
- package/dist/capabilities/frontendTestingCapability.d.ts +13 -0
- package/dist/capabilities/frontendTestingCapability.d.ts.map +1 -0
- package/dist/capabilities/frontendTestingCapability.js +28 -0
- package/dist/capabilities/frontendTestingCapability.js.map +1 -0
- package/dist/capabilities/globCapability.d.ts +17 -0
- package/dist/capabilities/globCapability.d.ts.map +1 -0
- package/dist/capabilities/globCapability.js +27 -0
- package/dist/capabilities/globCapability.js.map +1 -0
- package/dist/capabilities/index.d.ts +26 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +26 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/interactionCapability.d.ts +12 -0
- package/dist/capabilities/interactionCapability.d.ts.map +1 -0
- package/dist/capabilities/interactionCapability.js +22 -0
- package/dist/capabilities/interactionCapability.js.map +1 -0
- package/dist/capabilities/learnCapability.d.ts +22 -0
- package/dist/capabilities/learnCapability.d.ts.map +1 -0
- package/dist/capabilities/learnCapability.js +37 -0
- package/dist/capabilities/learnCapability.js.map +1 -0
- package/dist/capabilities/mcpCapability.d.ts +6 -0
- package/dist/capabilities/mcpCapability.d.ts.map +1 -0
- package/dist/capabilities/mcpCapability.js +19 -0
- package/dist/capabilities/mcpCapability.js.map +1 -0
- package/dist/capabilities/notebookCapability.d.ts +17 -0
- package/dist/capabilities/notebookCapability.d.ts.map +1 -0
- package/dist/capabilities/notebookCapability.js +27 -0
- package/dist/capabilities/notebookCapability.js.map +1 -0
- package/dist/capabilities/performanceMonitoringCapability.d.ts +108 -0
- package/dist/capabilities/performanceMonitoringCapability.d.ts.map +1 -0
- package/dist/capabilities/performanceMonitoringCapability.js +176 -0
- package/dist/capabilities/performanceMonitoringCapability.js.map +1 -0
- package/dist/capabilities/planningCapability.d.ts +16 -0
- package/dist/capabilities/planningCapability.d.ts.map +1 -0
- package/dist/capabilities/planningCapability.js +26 -0
- package/dist/capabilities/planningCapability.js.map +1 -0
- package/dist/capabilities/refactoringCapability.d.ts +13 -0
- package/dist/capabilities/refactoringCapability.d.ts.map +1 -0
- package/dist/capabilities/refactoringCapability.js +25 -0
- package/dist/capabilities/refactoringCapability.js.map +1 -0
- package/dist/capabilities/repoChecksCapability.d.ts +10 -0
- package/dist/capabilities/repoChecksCapability.d.ts.map +1 -0
- package/dist/capabilities/repoChecksCapability.js +24 -0
- package/dist/capabilities/repoChecksCapability.js.map +1 -0
- package/dist/capabilities/searchCapability.d.ts +13 -0
- package/dist/capabilities/searchCapability.d.ts.map +1 -0
- package/dist/capabilities/searchCapability.js +24 -0
- package/dist/capabilities/searchCapability.js.map +1 -0
- package/dist/capabilities/skillCapability.d.ts +3 -0
- package/dist/capabilities/skillCapability.d.ts.map +1 -0
- package/dist/capabilities/skillCapability.js +77 -0
- package/dist/capabilities/skillCapability.js.map +1 -0
- package/dist/capabilities/statusCapability.d.ts +4 -0
- package/dist/capabilities/statusCapability.d.ts.map +1 -0
- package/dist/capabilities/statusCapability.js +92 -0
- package/dist/capabilities/statusCapability.js.map +1 -0
- package/dist/capabilities/taskManagementCapability.d.ts +12 -0
- package/dist/capabilities/taskManagementCapability.d.ts.map +1 -0
- package/dist/capabilities/taskManagementCapability.js +22 -0
- package/dist/capabilities/taskManagementCapability.js.map +1 -0
- package/dist/capabilities/testingCapability.d.ts +13 -0
- package/dist/capabilities/testingCapability.d.ts.map +1 -0
- package/dist/capabilities/testingCapability.js +25 -0
- package/dist/capabilities/testingCapability.js.map +1 -0
- package/dist/capabilities/todoCapability.d.ts +19 -0
- package/dist/capabilities/todoCapability.d.ts.map +1 -0
- package/dist/capabilities/todoCapability.js +169 -0
- package/dist/capabilities/todoCapability.js.map +1 -0
- package/dist/capabilities/toolManifest.d.ts +3 -0
- package/dist/capabilities/toolManifest.d.ts.map +1 -0
- package/dist/capabilities/toolManifest.js +160 -0
- package/dist/capabilities/toolManifest.js.map +1 -0
- package/dist/capabilities/toolRegistry.d.ts +24 -0
- package/dist/capabilities/toolRegistry.d.ts.map +1 -0
- package/dist/capabilities/toolRegistry.js +150 -0
- package/dist/capabilities/toolRegistry.js.map +1 -0
- package/dist/capabilities/validationCapability.d.ts +13 -0
- package/dist/capabilities/validationCapability.d.ts.map +1 -0
- package/dist/capabilities/validationCapability.js +24 -0
- package/dist/capabilities/validationCapability.js.map +1 -0
- package/dist/capabilities/webCapability.d.ts +12 -0
- package/dist/capabilities/webCapability.d.ts.map +1 -0
- package/dist/capabilities/webCapability.js +22 -0
- package/dist/capabilities/webCapability.js.map +1 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +140 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts/v1/agent.d.ts +147 -0
- package/dist/contracts/v1/agent.d.ts.map +1 -0
- package/dist/contracts/v1/agent.js +8 -0
- package/dist/contracts/v1/agent.js.map +1 -0
- package/dist/contracts/v1/agentProfileManifest.d.ts +60 -0
- package/dist/contracts/v1/agentProfileManifest.d.ts.map +1 -0
- package/dist/contracts/v1/agentProfileManifest.js +9 -0
- package/dist/contracts/v1/agentProfileManifest.js.map +1 -0
- package/dist/contracts/v1/agentRules.d.ts +60 -0
- package/dist/contracts/v1/agentRules.d.ts.map +1 -0
- package/dist/contracts/v1/agentRules.js +10 -0
- package/dist/contracts/v1/agentRules.js.map +1 -0
- package/dist/contracts/v1/provider.d.ts +149 -0
- package/dist/contracts/v1/provider.d.ts.map +1 -0
- package/dist/contracts/v1/provider.js +7 -0
- package/dist/contracts/v1/provider.js.map +1 -0
- package/dist/contracts/v1/tool.d.ts +136 -0
- package/dist/contracts/v1/tool.d.ts.map +1 -0
- package/dist/contracts/v1/tool.js +7 -0
- package/dist/contracts/v1/tool.js.map +1 -0
- package/dist/contracts/v1/toolAccess.d.ts +43 -0
- package/dist/contracts/v1/toolAccess.d.ts.map +1 -0
- package/dist/contracts/v1/toolAccess.js +9 -0
- package/dist/contracts/v1/toolAccess.js.map +1 -0
- package/dist/core/LazyLoader.d.ts +129 -0
- package/dist/core/LazyLoader.d.ts.map +1 -0
- package/dist/core/LazyLoader.js +240 -0
- package/dist/core/LazyLoader.js.map +1 -0
- package/dist/core/agent.d.ts +153 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +889 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/agentProfileManifest.d.ts +3 -0
- package/dist/core/agentProfileManifest.d.ts.map +1 -0
- package/dist/core/agentProfileManifest.js +188 -0
- package/dist/core/agentProfileManifest.js.map +1 -0
- package/dist/core/agentProfiles.d.ts +22 -0
- package/dist/core/agentProfiles.d.ts.map +1 -0
- package/dist/core/agentProfiles.js +35 -0
- package/dist/core/agentProfiles.js.map +1 -0
- package/dist/core/agentRulebook.d.ts +11 -0
- package/dist/core/agentRulebook.d.ts.map +1 -0
- package/dist/core/agentRulebook.js +136 -0
- package/dist/core/agentRulebook.js.map +1 -0
- package/dist/core/agentSchemaLoader.d.ts +131 -0
- package/dist/core/agentSchemaLoader.d.ts.map +1 -0
- package/dist/core/agentSchemaLoader.js +234 -0
- package/dist/core/agentSchemaLoader.js.map +1 -0
- package/dist/core/aiErrorFixer.d.ts +70 -0
- package/dist/core/aiErrorFixer.d.ts.map +1 -0
- package/dist/core/aiErrorFixer.js +402 -0
- package/dist/core/aiErrorFixer.js.map +1 -0
- package/dist/core/alphaZeroEngine.d.ts +269 -0
- package/dist/core/alphaZeroEngine.d.ts.map +1 -0
- package/dist/core/alphaZeroEngine.js +523 -0
- package/dist/core/alphaZeroEngine.js.map +1 -0
- package/dist/core/alphaZeroModular.d.ts +186 -0
- package/dist/core/alphaZeroModular.d.ts.map +1 -0
- package/dist/core/alphaZeroModular.js +755 -0
- package/dist/core/alphaZeroModular.js.map +1 -0
- package/dist/core/alphaZeroOrchestrator.d.ts +140 -0
- package/dist/core/alphaZeroOrchestrator.d.ts.map +1 -0
- package/dist/core/alphaZeroOrchestrator.js +418 -0
- package/dist/core/alphaZeroOrchestrator.js.map +1 -0
- package/dist/core/bashCommandGuidance.d.ts +16 -0
- package/dist/core/bashCommandGuidance.d.ts.map +1 -0
- package/dist/core/bashCommandGuidance.js +40 -0
- package/dist/core/bashCommandGuidance.js.map +1 -0
- package/dist/core/checkpoint.d.ts +76 -0
- package/dist/core/checkpoint.d.ts.map +1 -0
- package/dist/core/checkpoint.js +278 -0
- package/dist/core/checkpoint.js.map +1 -0
- package/dist/core/cliTestHarness.d.ts +200 -0
- package/dist/core/cliTestHarness.d.ts.map +1 -0
- package/dist/core/cliTestHarness.js +549 -0
- package/dist/core/cliTestHarness.js.map +1 -0
- package/dist/core/contextManager.d.ts +265 -0
- package/dist/core/contextManager.d.ts.map +1 -0
- package/dist/core/contextManager.js +1060 -0
- package/dist/core/contextManager.js.map +1 -0
- package/dist/core/contextWindow.d.ts +42 -0
- package/dist/core/contextWindow.d.ts.map +1 -0
- package/dist/core/contextWindow.js +123 -0
- package/dist/core/contextWindow.js.map +1 -0
- package/dist/core/costTracker.d.ts +87 -0
- package/dist/core/costTracker.d.ts.map +1 -0
- package/dist/core/costTracker.js +285 -0
- package/dist/core/costTracker.js.map +1 -0
- package/dist/core/customCommands.d.ts +19 -0
- package/dist/core/customCommands.d.ts.map +1 -0
- package/dist/core/customCommands.js +84 -0
- package/dist/core/customCommands.js.map +1 -0
- package/dist/core/errors/apiKeyErrors.d.ts +11 -0
- package/dist/core/errors/apiKeyErrors.d.ts.map +1 -0
- package/dist/core/errors/apiKeyErrors.js +159 -0
- package/dist/core/errors/apiKeyErrors.js.map +1 -0
- package/dist/core/errors/errorTypes.d.ts +111 -0
- package/dist/core/errors/errorTypes.d.ts.map +1 -0
- package/dist/core/errors/errorTypes.js +348 -0
- package/dist/core/errors/errorTypes.js.map +1 -0
- package/dist/core/errors/errorUtils.d.ts +87 -0
- package/dist/core/errors/errorUtils.d.ts.map +1 -0
- package/dist/core/errors/errorUtils.js +158 -0
- package/dist/core/errors/errorUtils.js.map +1 -0
- package/dist/core/errors/safetyValidator.d.ts +71 -0
- package/dist/core/errors/safetyValidator.d.ts.map +1 -0
- package/dist/core/errors/safetyValidator.js +302 -0
- package/dist/core/errors/safetyValidator.js.map +1 -0
- package/dist/core/errors.d.ts +4 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +33 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/failureRecovery.d.ts +122 -0
- package/dist/core/failureRecovery.d.ts.map +1 -0
- package/dist/core/failureRecovery.js +477 -0
- package/dist/core/failureRecovery.js.map +1 -0
- package/dist/core/hooks.d.ts +113 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +267 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/intelligentTestFlows.d.ts +126 -0
- package/dist/core/intelligentTestFlows.d.ts.map +1 -0
- package/dist/core/intelligentTestFlows.js +678 -0
- package/dist/core/intelligentTestFlows.js.map +1 -0
- package/dist/core/isolatedVerifier.d.ts +40 -0
- package/dist/core/isolatedVerifier.d.ts.map +1 -0
- package/dist/core/isolatedVerifier.js +129 -0
- package/dist/core/isolatedVerifier.js.map +1 -0
- package/dist/core/learningPersistence.d.ts +145 -0
- package/dist/core/learningPersistence.d.ts.map +1 -0
- package/dist/core/learningPersistence.js +477 -0
- package/dist/core/learningPersistence.js.map +1 -0
- package/dist/core/memorySystem.d.ts +67 -0
- package/dist/core/memorySystem.d.ts.map +1 -0
- package/dist/core/memorySystem.js +334 -0
- package/dist/core/memorySystem.js.map +1 -0
- package/dist/core/metricsTracker.d.ts +157 -0
- package/dist/core/metricsTracker.d.ts.map +1 -0
- package/dist/core/metricsTracker.js +273 -0
- package/dist/core/metricsTracker.js.map +1 -0
- package/dist/core/modelDiscovery.d.ts +101 -0
- package/dist/core/modelDiscovery.d.ts.map +1 -0
- package/dist/core/modelDiscovery.js +780 -0
- package/dist/core/modelDiscovery.js.map +1 -0
- package/dist/core/multilinePasteHandler.d.ts +35 -0
- package/dist/core/multilinePasteHandler.d.ts.map +1 -0
- package/dist/core/multilinePasteHandler.js +80 -0
- package/dist/core/multilinePasteHandler.js.map +1 -0
- package/dist/core/offsecAlphaZero.d.ts +56 -0
- package/dist/core/offsecAlphaZero.d.ts.map +1 -0
- package/dist/core/offsecAlphaZero.js +395 -0
- package/dist/core/offsecAlphaZero.js.map +1 -0
- package/dist/core/outputStyles.d.ts +48 -0
- package/dist/core/outputStyles.d.ts.map +1 -0
- package/dist/core/outputStyles.js +270 -0
- package/dist/core/outputStyles.js.map +1 -0
- package/dist/core/performanceMonitor.d.ts +124 -0
- package/dist/core/performanceMonitor.d.ts.map +1 -0
- package/dist/core/performanceMonitor.js +192 -0
- package/dist/core/performanceMonitor.js.map +1 -0
- package/dist/core/preferences.d.ts +69 -0
- package/dist/core/preferences.d.ts.map +1 -0
- package/dist/core/preferences.js +316 -0
- package/dist/core/preferences.js.map +1 -0
- package/dist/core/responseVerifier.d.ts +98 -0
- package/dist/core/responseVerifier.d.ts.map +1 -0
- package/dist/core/responseVerifier.js +509 -0
- package/dist/core/responseVerifier.js.map +1 -0
- package/dist/core/resultVerification.d.ts +141 -0
- package/dist/core/resultVerification.d.ts.map +1 -0
- package/dist/core/resultVerification.js +482 -0
- package/dist/core/resultVerification.js.map +1 -0
- package/dist/core/schemaValidator.d.ts +44 -0
- package/dist/core/schemaValidator.d.ts.map +1 -0
- package/dist/core/schemaValidator.js +155 -0
- package/dist/core/schemaValidator.js.map +1 -0
- package/dist/core/secretStore.d.ts +48 -0
- package/dist/core/secretStore.d.ts.map +1 -0
- package/dist/core/secretStore.js +367 -0
- package/dist/core/secretStore.js.map +1 -0
- package/dist/core/securityAssessment.d.ts +91 -0
- package/dist/core/securityAssessment.d.ts.map +1 -0
- package/dist/core/securityAssessment.js +580 -0
- package/dist/core/securityAssessment.js.map +1 -0
- package/dist/core/selfEvolution.d.ts +155 -0
- package/dist/core/selfEvolution.d.ts.map +1 -0
- package/dist/core/selfEvolution.js +1000 -0
- package/dist/core/selfEvolution.js.map +1 -0
- package/dist/core/selfImprovement.d.ts +141 -0
- package/dist/core/selfImprovement.d.ts.map +1 -0
- package/dist/core/selfImprovement.js +700 -0
- package/dist/core/selfImprovement.js.map +1 -0
- package/dist/core/sessionStore.d.ts +35 -0
- package/dist/core/sessionStore.d.ts.map +1 -0
- package/dist/core/sessionStore.js +189 -0
- package/dist/core/sessionStore.js.map +1 -0
- package/dist/core/testUtils.d.ts +121 -0
- package/dist/core/testUtils.d.ts.map +1 -0
- package/dist/core/testUtils.js +235 -0
- package/dist/core/testUtils.js.map +1 -0
- package/dist/core/toolPreconditions.d.ts +42 -0
- package/dist/core/toolPreconditions.d.ts.map +1 -0
- package/dist/core/toolPreconditions.js +347 -0
- package/dist/core/toolPreconditions.js.map +1 -0
- package/dist/core/toolRuntime.d.ts +163 -0
- package/dist/core/toolRuntime.d.ts.map +1 -0
- package/dist/core/toolRuntime.js +439 -0
- package/dist/core/toolRuntime.js.map +1 -0
- package/dist/core/toolValidation.d.ts +116 -0
- package/dist/core/toolValidation.d.ts.map +1 -0
- package/dist/core/toolValidation.js +282 -0
- package/dist/core/toolValidation.js.map +1 -0
- package/dist/core/types/utilityTypes.d.ts +192 -0
- package/dist/core/types/utilityTypes.d.ts.map +1 -0
- package/dist/core/types/utilityTypes.js +272 -0
- package/dist/core/types/utilityTypes.js.map +1 -0
- package/dist/core/types.d.ts +306 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +76 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validationRunner.d.ts +106 -0
- package/dist/core/validationRunner.d.ts.map +1 -0
- package/dist/core/validationRunner.js +888 -0
- package/dist/core/validationRunner.js.map +1 -0
- package/dist/core/verification.d.ts +137 -0
- package/dist/core/verification.d.ts.map +1 -0
- package/dist/core/verification.js +323 -0
- package/dist/core/verification.js.map +1 -0
- package/dist/headless/headlessApp.d.ts +5 -0
- package/dist/headless/headlessApp.d.ts.map +1 -0
- package/dist/headless/headlessApp.js +210 -0
- package/dist/headless/headlessApp.js.map +1 -0
- package/dist/intelligence/codeIntelligence.d.ts +118 -0
- package/dist/intelligence/codeIntelligence.d.ts.map +1 -0
- package/dist/intelligence/codeIntelligence.js +552 -0
- package/dist/intelligence/codeIntelligence.js.map +1 -0
- package/dist/intelligence/docGenerator.d.ts +86 -0
- package/dist/intelligence/docGenerator.d.ts.map +1 -0
- package/dist/intelligence/docGenerator.js +564 -0
- package/dist/intelligence/docGenerator.js.map +1 -0
- package/dist/intelligence/index.d.ts +51 -0
- package/dist/intelligence/index.d.ts.map +1 -0
- package/dist/intelligence/index.js +253 -0
- package/dist/intelligence/index.js.map +1 -0
- package/dist/intelligence/refactoring.d.ts +50 -0
- package/dist/intelligence/refactoring.d.ts.map +1 -0
- package/dist/intelligence/refactoring.js +354 -0
- package/dist/intelligence/refactoring.js.map +1 -0
- package/dist/intelligence/testGenerator.d.ts +74 -0
- package/dist/intelligence/testGenerator.d.ts.map +1 -0
- package/dist/intelligence/testGenerator.js +483 -0
- package/dist/intelligence/testGenerator.js.map +1 -0
- package/dist/mcp/config.d.ts +8 -0
- package/dist/mcp/config.d.ts.map +1 -0
- package/dist/mcp/config.js +252 -0
- package/dist/mcp/config.js.map +1 -0
- package/dist/mcp/sseClient.d.ts +34 -0
- package/dist/mcp/sseClient.d.ts.map +1 -0
- package/dist/mcp/sseClient.js +327 -0
- package/dist/mcp/sseClient.js.map +1 -0
- package/dist/mcp/stdioClient.d.ts +24 -0
- package/dist/mcp/stdioClient.d.ts.map +1 -0
- package/dist/mcp/stdioClient.js +179 -0
- package/dist/mcp/stdioClient.js.map +1 -0
- package/dist/mcp/toolBridge.d.ts +12 -0
- package/dist/mcp/toolBridge.d.ts.map +1 -0
- package/dist/mcp/toolBridge.js +117 -0
- package/dist/mcp/toolBridge.js.map +1 -0
- package/dist/mcp/types.d.ts +60 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/plugins/index.d.ts +49 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +114 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/providers/anthropic/index.d.ts +11 -0
- package/dist/plugins/providers/anthropic/index.d.ts.map +1 -0
- package/dist/plugins/providers/anthropic/index.js +38 -0
- package/dist/plugins/providers/anthropic/index.js.map +1 -0
- package/dist/plugins/providers/deepseek/index.d.ts +11 -0
- package/dist/plugins/providers/deepseek/index.d.ts.map +1 -0
- package/dist/plugins/providers/deepseek/index.js +52 -0
- package/dist/plugins/providers/deepseek/index.js.map +1 -0
- package/dist/plugins/providers/google/index.d.ts +11 -0
- package/dist/plugins/providers/google/index.d.ts.map +1 -0
- package/dist/plugins/providers/google/index.js +40 -0
- package/dist/plugins/providers/google/index.js.map +1 -0
- package/dist/plugins/providers/index.d.ts +2 -0
- package/dist/plugins/providers/index.d.ts.map +1 -0
- package/dist/plugins/providers/index.js +20 -0
- package/dist/plugins/providers/index.js.map +1 -0
- package/dist/plugins/providers/ollama/index.d.ts +21 -0
- package/dist/plugins/providers/ollama/index.d.ts.map +1 -0
- package/dist/plugins/providers/ollama/index.js +69 -0
- package/dist/plugins/providers/ollama/index.js.map +1 -0
- package/dist/plugins/providers/openai/index.d.ts +12 -0
- package/dist/plugins/providers/openai/index.d.ts.map +1 -0
- package/dist/plugins/providers/openai/index.js +39 -0
- package/dist/plugins/providers/openai/index.js.map +1 -0
- package/dist/plugins/providers/xai/index.d.ts +11 -0
- package/dist/plugins/providers/xai/index.d.ts.map +1 -0
- package/dist/plugins/providers/xai/index.js +39 -0
- package/dist/plugins/providers/xai/index.js.map +1 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts +3 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js +9 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js.map +1 -0
- package/dist/plugins/tools/bash/localBashPlugin.d.ts +3 -0
- package/dist/plugins/tools/bash/localBashPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/bash/localBashPlugin.js +14 -0
- package/dist/plugins/tools/bash/localBashPlugin.js.map +1 -0
- package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts +14 -0
- package/dist/plugins/tools/browser/browserAutomationPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/browser/browserAutomationPlugin.js +26 -0
- package/dist/plugins/tools/browser/browserAutomationPlugin.js.map +1 -0
- package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts +3 -0
- package/dist/plugins/tools/checks/localRepoChecksPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/checks/localRepoChecksPlugin.js +14 -0
- package/dist/plugins/tools/checks/localRepoChecksPlugin.js.map +1 -0
- package/dist/plugins/tools/cloud/cloudPlugin.d.ts +3 -0
- package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/cloud/cloudPlugin.js +14 -0
- package/dist/plugins/tools/cloud/cloudPlugin.js.map +1 -0
- package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts +3 -0
- package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +14 -0
- package/dist/plugins/tools/codeAnalysis/codeAnalysisPlugin.js.map +1 -0
- package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts +3 -0
- package/dist/plugins/tools/codeQuality/codeQualityPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/codeQuality/codeQualityPlugin.js +14 -0
- package/dist/plugins/tools/codeQuality/codeQualityPlugin.js.map +1 -0
- package/dist/plugins/tools/dependency/dependencyPlugin.d.ts +3 -0
- package/dist/plugins/tools/dependency/dependencyPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/dependency/dependencyPlugin.js +12 -0
- package/dist/plugins/tools/dependency/dependencyPlugin.js.map +1 -0
- package/dist/plugins/tools/development/devPlugin.d.ts +3 -0
- package/dist/plugins/tools/development/devPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/development/devPlugin.js +14 -0
- package/dist/plugins/tools/development/devPlugin.js.map +1 -0
- package/dist/plugins/tools/edit/editPlugin.d.ts +9 -0
- package/dist/plugins/tools/edit/editPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/edit/editPlugin.js +15 -0
- package/dist/plugins/tools/edit/editPlugin.js.map +1 -0
- package/dist/plugins/tools/email/emailPlugin.d.ts +3 -0
- package/dist/plugins/tools/email/emailPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/email/emailPlugin.js +12 -0
- package/dist/plugins/tools/email/emailPlugin.js.map +1 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts +3 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js +9 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js.map +1 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts +3 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.js +14 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.js.map +1 -0
- package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts +3 -0
- package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js +14 -0
- package/dist/plugins/tools/frontendTesting/frontendTestingPlugin.js.map +1 -0
- package/dist/plugins/tools/glob/globPlugin.d.ts +9 -0
- package/dist/plugins/tools/glob/globPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/glob/globPlugin.js +15 -0
- package/dist/plugins/tools/glob/globPlugin.js.map +1 -0
- package/dist/plugins/tools/index.d.ts +3 -0
- package/dist/plugins/tools/index.d.ts.map +1 -0
- package/dist/plugins/tools/index.js +3 -0
- package/dist/plugins/tools/index.js.map +1 -0
- package/dist/plugins/tools/interaction/interactionPlugin.d.ts +3 -0
- package/dist/plugins/tools/interaction/interactionPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/interaction/interactionPlugin.js +12 -0
- package/dist/plugins/tools/interaction/interactionPlugin.js.map +1 -0
- package/dist/plugins/tools/learn/learnPlugin.d.ts +3 -0
- package/dist/plugins/tools/learn/learnPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/learn/learnPlugin.js +14 -0
- package/dist/plugins/tools/learn/learnPlugin.js.map +1 -0
- package/dist/plugins/tools/mcp/mcpPlugin.d.ts +3 -0
- package/dist/plugins/tools/mcp/mcpPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/mcp/mcpPlugin.js +9 -0
- package/dist/plugins/tools/mcp/mcpPlugin.js.map +1 -0
- package/dist/plugins/tools/nodeDefaults.d.ts +2 -0
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -0
- package/dist/plugins/tools/nodeDefaults.js +65 -0
- package/dist/plugins/tools/nodeDefaults.js.map +1 -0
- package/dist/plugins/tools/notebook/notebookPlugin.d.ts +9 -0
- package/dist/plugins/tools/notebook/notebookPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/notebook/notebookPlugin.js +15 -0
- package/dist/plugins/tools/notebook/notebookPlugin.js.map +1 -0
- package/dist/plugins/tools/planning/planningPlugin.d.ts +9 -0
- package/dist/plugins/tools/planning/planningPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/planning/planningPlugin.js +15 -0
- package/dist/plugins/tools/planning/planningPlugin.js.map +1 -0
- package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts +3 -0
- package/dist/plugins/tools/refactoring/refactoringPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/refactoring/refactoringPlugin.js +12 -0
- package/dist/plugins/tools/refactoring/refactoringPlugin.js.map +1 -0
- package/dist/plugins/tools/registry.d.ts +22 -0
- package/dist/plugins/tools/registry.d.ts.map +1 -0
- package/dist/plugins/tools/registry.js +58 -0
- package/dist/plugins/tools/registry.js.map +1 -0
- package/dist/plugins/tools/search/localSearchPlugin.d.ts +3 -0
- package/dist/plugins/tools/search/localSearchPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/search/localSearchPlugin.js +14 -0
- package/dist/plugins/tools/search/localSearchPlugin.js.map +1 -0
- package/dist/plugins/tools/skills/skillPlugin.d.ts +3 -0
- package/dist/plugins/tools/skills/skillPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/skills/skillPlugin.js +9 -0
- package/dist/plugins/tools/skills/skillPlugin.js.map +1 -0
- package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts +3 -0
- package/dist/plugins/tools/taskManagement/taskManagementPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/taskManagement/taskManagementPlugin.js +12 -0
- package/dist/plugins/tools/taskManagement/taskManagementPlugin.js.map +1 -0
- package/dist/plugins/tools/testing/testingPlugin.d.ts +3 -0
- package/dist/plugins/tools/testing/testingPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/testing/testingPlugin.js +12 -0
- package/dist/plugins/tools/testing/testingPlugin.js.map +1 -0
- package/dist/plugins/tools/validation/validationPlugin.d.ts +3 -0
- package/dist/plugins/tools/validation/validationPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/validation/validationPlugin.js +14 -0
- package/dist/plugins/tools/validation/validationPlugin.js.map +1 -0
- package/dist/plugins/tools/web/webPlugin.d.ts +3 -0
- package/dist/plugins/tools/web/webPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/web/webPlugin.js +12 -0
- package/dist/plugins/tools/web/webPlugin.js.map +1 -0
- package/dist/providers/anthropicProvider.d.ts +41 -0
- package/dist/providers/anthropicProvider.d.ts.map +1 -0
- package/dist/providers/anthropicProvider.js +446 -0
- package/dist/providers/anthropicProvider.js.map +1 -0
- package/dist/providers/googleProvider.d.ts +36 -0
- package/dist/providers/googleProvider.d.ts.map +1 -0
- package/dist/providers/googleProvider.js +312 -0
- package/dist/providers/googleProvider.js.map +1 -0
- package/dist/providers/openaiChatCompletionsProvider.d.ts +43 -0
- package/dist/providers/openaiChatCompletionsProvider.d.ts.map +1 -0
- package/dist/providers/openaiChatCompletionsProvider.js +516 -0
- package/dist/providers/openaiChatCompletionsProvider.js.map +1 -0
- package/dist/providers/openaiResponsesProvider.d.ts +38 -0
- package/dist/providers/openaiResponsesProvider.d.ts.map +1 -0
- package/dist/providers/openaiResponsesProvider.js +364 -0
- package/dist/providers/openaiResponsesProvider.js.map +1 -0
- package/dist/providers/providerFactory.d.ts +18 -0
- package/dist/providers/providerFactory.d.ts.map +1 -0
- package/dist/providers/providerFactory.js +25 -0
- package/dist/providers/providerFactory.js.map +1 -0
- package/dist/providers/resilientProvider.d.ts +94 -0
- package/dist/providers/resilientProvider.d.ts.map +1 -0
- package/dist/providers/resilientProvider.js +370 -0
- package/dist/providers/resilientProvider.js.map +1 -0
- package/dist/runtime/agentController.d.ts +65 -0
- package/dist/runtime/agentController.d.ts.map +1 -0
- package/dist/runtime/agentController.js +353 -0
- package/dist/runtime/agentController.js.map +1 -0
- package/dist/runtime/agentHost.d.ts +61 -0
- package/dist/runtime/agentHost.d.ts.map +1 -0
- package/dist/runtime/agentHost.js +156 -0
- package/dist/runtime/agentHost.js.map +1 -0
- package/dist/runtime/agentSession.d.ts +40 -0
- package/dist/runtime/agentSession.d.ts.map +1 -0
- package/dist/runtime/agentSession.js +205 -0
- package/dist/runtime/agentSession.js.map +1 -0
- package/dist/runtime/browser.d.ts +7 -0
- package/dist/runtime/browser.d.ts.map +1 -0
- package/dist/runtime/browser.js +10 -0
- package/dist/runtime/browser.js.map +1 -0
- package/dist/runtime/cloud.d.ts +7 -0
- package/dist/runtime/cloud.d.ts.map +1 -0
- package/dist/runtime/cloud.js +10 -0
- package/dist/runtime/cloud.js.map +1 -0
- package/dist/runtime/node.d.ts +8 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +11 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/universal.d.ts +21 -0
- package/dist/runtime/universal.d.ts.map +1 -0
- package/dist/runtime/universal.js +29 -0
- package/dist/runtime/universal.js.map +1 -0
- package/dist/shell/autoExecutor.d.ts +70 -0
- package/dist/shell/autoExecutor.d.ts.map +1 -0
- package/dist/shell/autoExecutor.js +288 -0
- package/dist/shell/autoExecutor.js.map +1 -0
- package/dist/shell/composableMessage.d.ts +183 -0
- package/dist/shell/composableMessage.d.ts.map +1 -0
- package/dist/shell/composableMessage.js +420 -0
- package/dist/shell/composableMessage.js.map +1 -0
- package/dist/shell/fileChangeTracker.d.ts +39 -0
- package/dist/shell/fileChangeTracker.d.ts.map +1 -0
- package/dist/shell/fileChangeTracker.js +64 -0
- package/dist/shell/fileChangeTracker.js.map +1 -0
- package/dist/shell/interactiveShell.d.ts +517 -0
- package/dist/shell/interactiveShell.d.ts.map +1 -0
- package/dist/shell/interactiveShell.js +6641 -0
- package/dist/shell/interactiveShell.js.map +1 -0
- package/dist/shell/liveStatus.d.ts +30 -0
- package/dist/shell/liveStatus.d.ts.map +1 -0
- package/dist/shell/liveStatus.js +102 -0
- package/dist/shell/liveStatus.js.map +1 -0
- package/dist/shell/shellApp.d.ts +19 -0
- package/dist/shell/shellApp.d.ts.map +1 -0
- package/dist/shell/shellApp.js +411 -0
- package/dist/shell/shellApp.js.map +1 -0
- package/dist/shell/systemPrompt.d.ts +3 -0
- package/dist/shell/systemPrompt.d.ts.map +1 -0
- package/dist/shell/systemPrompt.js +64 -0
- package/dist/shell/systemPrompt.js.map +1 -0
- package/dist/shell/taskCompletionDetector.d.ts +106 -0
- package/dist/shell/taskCompletionDetector.d.ts.map +1 -0
- package/dist/shell/taskCompletionDetector.js +402 -0
- package/dist/shell/taskCompletionDetector.js.map +1 -0
- package/dist/shell/vimMode.d.ts +66 -0
- package/dist/shell/vimMode.d.ts.map +1 -0
- package/dist/shell/vimMode.js +434 -0
- package/dist/shell/vimMode.js.map +1 -0
- package/dist/skills/skillRepository.d.ts +103 -0
- package/dist/skills/skillRepository.d.ts.map +1 -0
- package/dist/skills/skillRepository.js +237 -0
- package/dist/skills/skillRepository.js.map +1 -0
- package/dist/skills/types.d.ts +37 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +2 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/subagents/agentConfig.d.ts +27 -0
- package/dist/subagents/agentConfig.d.ts.map +1 -0
- package/dist/subagents/agentConfig.js +89 -0
- package/dist/subagents/agentConfig.js.map +1 -0
- package/dist/subagents/agentRegistry.d.ts +33 -0
- package/dist/subagents/agentRegistry.d.ts.map +1 -0
- package/dist/subagents/agentRegistry.js +162 -0
- package/dist/subagents/agentRegistry.js.map +1 -0
- package/dist/subagents/parallelAgentManager.d.ts +99 -0
- package/dist/subagents/parallelAgentManager.d.ts.map +1 -0
- package/dist/subagents/parallelAgentManager.js +248 -0
- package/dist/subagents/parallelAgentManager.js.map +1 -0
- package/dist/subagents/taskRunner.d.ts +34 -0
- package/dist/subagents/taskRunner.d.ts.map +1 -0
- package/dist/subagents/taskRunner.js +459 -0
- package/dist/subagents/taskRunner.js.map +1 -0
- package/dist/tools/advancedTestGenerationTools.d.ts +21 -0
- package/dist/tools/advancedTestGenerationTools.d.ts.map +1 -0
- package/dist/tools/advancedTestGenerationTools.js +301 -0
- package/dist/tools/advancedTestGenerationTools.js.map +1 -0
- package/dist/tools/backgroundBashTools.d.ts +21 -0
- package/dist/tools/backgroundBashTools.d.ts.map +1 -0
- package/dist/tools/backgroundBashTools.js +215 -0
- package/dist/tools/backgroundBashTools.js.map +1 -0
- package/dist/tools/bashTools.d.ts +8 -0
- package/dist/tools/bashTools.d.ts.map +1 -0
- package/dist/tools/bashTools.js +240 -0
- package/dist/tools/bashTools.js.map +1 -0
- package/dist/tools/browserAutomationTools.d.ts +23 -0
- package/dist/tools/browserAutomationTools.d.ts.map +1 -0
- package/dist/tools/browserAutomationTools.js +916 -0
- package/dist/tools/browserAutomationTools.js.map +1 -0
- package/dist/tools/buildTools.d.ts +9 -0
- package/dist/tools/buildTools.d.ts.map +1 -0
- package/dist/tools/buildTools.js +344 -0
- package/dist/tools/buildTools.js.map +1 -0
- package/dist/tools/cloudTools.d.ts +49 -0
- package/dist/tools/cloudTools.d.ts.map +1 -0
- package/dist/tools/cloudTools.js +1258 -0
- package/dist/tools/cloudTools.js.map +1 -0
- package/dist/tools/code-quality-dashboard.d.ts +57 -0
- package/dist/tools/code-quality-dashboard.d.ts.map +1 -0
- package/dist/tools/code-quality-dashboard.js +218 -0
- package/dist/tools/code-quality-dashboard.js.map +1 -0
- package/dist/tools/codeAnalysisTools.d.ts +74 -0
- package/dist/tools/codeAnalysisTools.d.ts.map +1 -0
- package/dist/tools/codeAnalysisTools.js +664 -0
- package/dist/tools/codeAnalysisTools.js.map +1 -0
- package/dist/tools/codeGenerationTools.d.ts +3 -0
- package/dist/tools/codeGenerationTools.d.ts.map +1 -0
- package/dist/tools/codeGenerationTools.js +439 -0
- package/dist/tools/codeGenerationTools.js.map +1 -0
- package/dist/tools/codeQualityTools.d.ts +3 -0
- package/dist/tools/codeQualityTools.d.ts.map +1 -0
- package/dist/tools/codeQualityTools.js +296 -0
- package/dist/tools/codeQualityTools.js.map +1 -0
- package/dist/tools/dependencyTools.d.ts +3 -0
- package/dist/tools/dependencyTools.d.ts.map +1 -0
- package/dist/tools/dependencyTools.js +283 -0
- package/dist/tools/dependencyTools.js.map +1 -0
- package/dist/tools/devTools.d.ts +10 -0
- package/dist/tools/devTools.d.ts.map +1 -0
- package/dist/tools/devTools.js +2125 -0
- package/dist/tools/devTools.js.map +1 -0
- package/dist/tools/diffUtils.d.ts +36 -0
- package/dist/tools/diffUtils.d.ts.map +1 -0
- package/dist/tools/diffUtils.js +528 -0
- package/dist/tools/diffUtils.js.map +1 -0
- package/dist/tools/editTools.d.ts +29 -0
- package/dist/tools/editTools.d.ts.map +1 -0
- package/dist/tools/editTools.js +419 -0
- package/dist/tools/editTools.js.map +1 -0
- package/dist/tools/emailTools.d.ts +21 -0
- package/dist/tools/emailTools.d.ts.map +1 -0
- package/dist/tools/emailTools.js +449 -0
- package/dist/tools/emailTools.js.map +1 -0
- package/dist/tools/enhancedCodeIntelligenceTools.d.ts +27 -0
- package/dist/tools/enhancedCodeIntelligenceTools.d.ts.map +1 -0
- package/dist/tools/enhancedCodeIntelligenceTools.js +418 -0
- package/dist/tools/enhancedCodeIntelligenceTools.js.map +1 -0
- package/dist/tools/enhancedDevWorkflowTools.d.ts +15 -0
- package/dist/tools/enhancedDevWorkflowTools.d.ts.map +1 -0
- package/dist/tools/enhancedDevWorkflowTools.js +303 -0
- package/dist/tools/enhancedDevWorkflowTools.js.map +1 -0
- package/dist/tools/fileTools.d.ts +3 -0
- package/dist/tools/fileTools.d.ts.map +1 -0
- package/dist/tools/fileTools.js +334 -0
- package/dist/tools/fileTools.js.map +1 -0
- package/dist/tools/frontendTestingTools.d.ts +35 -0
- package/dist/tools/frontendTestingTools.d.ts.map +1 -0
- package/dist/tools/frontendTestingTools.js +1254 -0
- package/dist/tools/frontendTestingTools.js.map +1 -0
- package/dist/tools/globTools.d.ts +15 -0
- package/dist/tools/globTools.d.ts.map +1 -0
- package/dist/tools/globTools.js +174 -0
- package/dist/tools/globTools.js.map +1 -0
- package/dist/tools/grepTools.d.ts +19 -0
- package/dist/tools/grepTools.d.ts.map +1 -0
- package/dist/tools/grepTools.js +358 -0
- package/dist/tools/grepTools.js.map +1 -0
- package/dist/tools/interactionTools.d.ts +13 -0
- package/dist/tools/interactionTools.d.ts.map +1 -0
- package/dist/tools/interactionTools.js +171 -0
- package/dist/tools/interactionTools.js.map +1 -0
- package/dist/tools/learnTools.d.ts +164 -0
- package/dist/tools/learnTools.d.ts.map +1 -0
- package/dist/tools/learnTools.js +2104 -0
- package/dist/tools/learnTools.js.map +1 -0
- package/dist/tools/localExplore.d.ts +225 -0
- package/dist/tools/localExplore.d.ts.map +1 -0
- package/dist/tools/localExplore.js +1365 -0
- package/dist/tools/localExplore.js.map +1 -0
- package/dist/tools/notebookEditTools.d.ts +15 -0
- package/dist/tools/notebookEditTools.d.ts.map +1 -0
- package/dist/tools/notebookEditTools.js +197 -0
- package/dist/tools/notebookEditTools.js.map +1 -0
- package/dist/tools/planningTools.d.ts +21 -0
- package/dist/tools/planningTools.d.ts.map +1 -0
- package/dist/tools/planningTools.js +185 -0
- package/dist/tools/planningTools.js.map +1 -0
- package/dist/tools/refactoringTools.d.ts +3 -0
- package/dist/tools/refactoringTools.d.ts.map +1 -0
- package/dist/tools/refactoringTools.js +294 -0
- package/dist/tools/refactoringTools.js.map +1 -0
- package/dist/tools/repoChecksTools.d.ts +3 -0
- package/dist/tools/repoChecksTools.d.ts.map +1 -0
- package/dist/tools/repoChecksTools.js +161 -0
- package/dist/tools/repoChecksTools.js.map +1 -0
- package/dist/tools/searchTools.d.ts +3 -0
- package/dist/tools/searchTools.d.ts.map +1 -0
- package/dist/tools/searchTools.js +241 -0
- package/dist/tools/searchTools.js.map +1 -0
- package/dist/tools/skillTools.d.ts +8 -0
- package/dist/tools/skillTools.d.ts.map +1 -0
- package/dist/tools/skillTools.js +178 -0
- package/dist/tools/skillTools.js.map +1 -0
- package/dist/tools/softwareEngineeringTools.d.ts +7 -0
- package/dist/tools/softwareEngineeringTools.d.ts.map +1 -0
- package/dist/tools/softwareEngineeringTools.js +338 -0
- package/dist/tools/softwareEngineeringTools.js.map +1 -0
- package/dist/tools/taskManagementTools.d.ts +10 -0
- package/dist/tools/taskManagementTools.d.ts.map +1 -0
- package/dist/tools/taskManagementTools.js +157 -0
- package/dist/tools/taskManagementTools.js.map +1 -0
- package/dist/tools/testingTools.d.ts +3 -0
- package/dist/tools/testingTools.d.ts.map +1 -0
- package/dist/tools/testingTools.js +233 -0
- package/dist/tools/testingTools.js.map +1 -0
- package/dist/tools/validationTools.d.ts +7 -0
- package/dist/tools/validationTools.d.ts.map +1 -0
- package/dist/tools/validationTools.js +344 -0
- package/dist/tools/validationTools.js.map +1 -0
- package/dist/tools/webTools.d.ts +3 -0
- package/dist/tools/webTools.d.ts.map +1 -0
- package/dist/tools/webTools.js +502 -0
- package/dist/tools/webTools.js.map +1 -0
- package/dist/ui/DisplayEventQueue.d.ts +99 -0
- package/dist/ui/DisplayEventQueue.d.ts.map +1 -0
- package/dist/ui/DisplayEventQueue.js +167 -0
- package/dist/ui/DisplayEventQueue.js.map +1 -0
- package/dist/ui/PromptController.d.ts +121 -0
- package/dist/ui/PromptController.d.ts.map +1 -0
- package/dist/ui/PromptController.js +212 -0
- package/dist/ui/PromptController.js.map +1 -0
- package/dist/ui/SequentialRenderer.d.ts +69 -0
- package/dist/ui/SequentialRenderer.d.ts.map +1 -0
- package/dist/ui/SequentialRenderer.js +137 -0
- package/dist/ui/SequentialRenderer.js.map +1 -0
- package/dist/ui/ShellUIAdapter.d.ts +207 -0
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -0
- package/dist/ui/ShellUIAdapter.js +1163 -0
- package/dist/ui/ShellUIAdapter.js.map +1 -0
- package/dist/ui/UnifiedUIController.d.ts +82 -0
- package/dist/ui/UnifiedUIController.d.ts.map +1 -0
- package/dist/ui/UnifiedUIController.js +207 -0
- package/dist/ui/UnifiedUIController.js.map +1 -0
- package/dist/ui/UnifiedUIRenderer.d.ts +188 -0
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -0
- package/dist/ui/UnifiedUIRenderer.js +588 -0
- package/dist/ui/UnifiedUIRenderer.js.map +1 -0
- package/dist/ui/animation/AnimationScheduler.d.ts +192 -0
- package/dist/ui/animation/AnimationScheduler.d.ts.map +1 -0
- package/dist/ui/animation/AnimationScheduler.js +432 -0
- package/dist/ui/animation/AnimationScheduler.js.map +1 -0
- package/dist/ui/codeHighlighter.d.ts +6 -0
- package/dist/ui/codeHighlighter.d.ts.map +1 -0
- package/dist/ui/codeHighlighter.js +855 -0
- package/dist/ui/codeHighlighter.js.map +1 -0
- package/dist/ui/compactRenderer.d.ts +139 -0
- package/dist/ui/compactRenderer.d.ts.map +1 -0
- package/dist/ui/compactRenderer.js +398 -0
- package/dist/ui/compactRenderer.js.map +1 -0
- package/dist/ui/designSystem.d.ts +26 -0
- package/dist/ui/designSystem.d.ts.map +1 -0
- package/dist/ui/designSystem.js +122 -0
- package/dist/ui/designSystem.js.map +1 -0
- package/dist/ui/display.d.ts +229 -0
- package/dist/ui/display.d.ts.map +1 -0
- package/dist/ui/display.js +756 -0
- package/dist/ui/display.js.map +1 -0
- package/dist/ui/errorFormatter.d.ts +54 -0
- package/dist/ui/errorFormatter.d.ts.map +1 -0
- package/dist/ui/errorFormatter.js +251 -0
- package/dist/ui/errorFormatter.js.map +1 -0
- package/dist/ui/globalWriteLock.d.ts +38 -0
- package/dist/ui/globalWriteLock.d.ts.map +1 -0
- package/dist/ui/globalWriteLock.js +54 -0
- package/dist/ui/globalWriteLock.js.map +1 -0
- package/dist/ui/inPlaceUpdater.d.ts +181 -0
- package/dist/ui/inPlaceUpdater.d.ts.map +1 -0
- package/dist/ui/inPlaceUpdater.js +515 -0
- package/dist/ui/inPlaceUpdater.js.map +1 -0
- package/dist/ui/interrupts/InterruptManager.d.ts +142 -0
- package/dist/ui/interrupts/InterruptManager.d.ts.map +1 -0
- package/dist/ui/interrupts/InterruptManager.js +439 -0
- package/dist/ui/interrupts/InterruptManager.js.map +1 -0
- package/dist/ui/layout.d.ts +17 -0
- package/dist/ui/layout.d.ts.map +1 -0
- package/dist/ui/layout.js +140 -0
- package/dist/ui/layout.js.map +1 -0
- package/dist/ui/orchestration/StatusOrchestrator.d.ts +156 -0
- package/dist/ui/orchestration/StatusOrchestrator.d.ts.map +1 -0
- package/dist/ui/orchestration/StatusOrchestrator.js +406 -0
- package/dist/ui/orchestration/StatusOrchestrator.js.map +1 -0
- package/dist/ui/orchestration/UIUpdateCoordinator.d.ts +77 -0
- package/dist/ui/orchestration/UIUpdateCoordinator.d.ts.map +1 -0
- package/dist/ui/orchestration/UIUpdateCoordinator.js +265 -0
- package/dist/ui/orchestration/UIUpdateCoordinator.js.map +1 -0
- package/dist/ui/outputMode.d.ts +22 -0
- package/dist/ui/outputMode.d.ts.map +1 -0
- package/dist/ui/outputMode.js +40 -0
- package/dist/ui/outputMode.js.map +1 -0
- package/dist/ui/richText.d.ts +6 -0
- package/dist/ui/richText.d.ts.map +1 -0
- package/dist/ui/richText.js +391 -0
- package/dist/ui/richText.js.map +1 -0
- package/dist/ui/shortcutsHelp.d.ts +39 -0
- package/dist/ui/shortcutsHelp.d.ts.map +1 -0
- package/dist/ui/shortcutsHelp.js +152 -0
- package/dist/ui/shortcutsHelp.js.map +1 -0
- package/dist/ui/streamingFormatter.d.ts +19 -0
- package/dist/ui/streamingFormatter.d.ts.map +1 -0
- package/dist/ui/streamingFormatter.js +65 -0
- package/dist/ui/streamingFormatter.js.map +1 -0
- package/dist/ui/telemetry/ResponseTracker.d.ts +22 -0
- package/dist/ui/telemetry/ResponseTracker.d.ts.map +1 -0
- package/dist/ui/telemetry/ResponseTracker.js +60 -0
- package/dist/ui/telemetry/ResponseTracker.js.map +1 -0
- package/dist/ui/telemetry/UITelemetry.d.ts +181 -0
- package/dist/ui/telemetry/UITelemetry.d.ts.map +1 -0
- package/dist/ui/telemetry/UITelemetry.js +446 -0
- package/dist/ui/telemetry/UITelemetry.js.map +1 -0
- package/dist/ui/textHighlighter.d.ts +83 -0
- package/dist/ui/textHighlighter.d.ts.map +1 -0
- package/dist/ui/textHighlighter.js +267 -0
- package/dist/ui/textHighlighter.js.map +1 -0
- package/dist/ui/theme.d.ts +208 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +249 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/toolDisplay.d.ts +195 -0
- package/dist/ui/toolDisplay.d.ts.map +1 -0
- package/dist/ui/toolDisplay.js +1526 -0
- package/dist/ui/toolDisplay.js.map +1 -0
- package/dist/ui/unified/index.d.ts +50 -0
- package/dist/ui/unified/index.d.ts.map +1 -0
- package/dist/ui/unified/index.js +77 -0
- package/dist/ui/unified/index.js.map +1 -0
- package/dist/ui/unified/layout.d.ts +12 -0
- package/dist/ui/unified/layout.d.ts.map +1 -0
- package/dist/ui/unified/layout.js +96 -0
- package/dist/ui/unified/layout.js.map +1 -0
- package/dist/ui/writeLock.d.ts +65 -0
- package/dist/ui/writeLock.d.ts.map +1 -0
- package/dist/ui/writeLock.js +114 -0
- package/dist/ui/writeLock.js.map +1 -0
- package/dist/utils/asyncUtils.d.ts +95 -0
- package/dist/utils/asyncUtils.d.ts.map +1 -0
- package/dist/utils/asyncUtils.js +286 -0
- package/dist/utils/asyncUtils.js.map +1 -0
- package/dist/utils/errorUtils.d.ts +16 -0
- package/dist/utils/errorUtils.d.ts.map +1 -0
- package/dist/utils/errorUtils.js +66 -0
- package/dist/utils/errorUtils.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +10 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +78 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/planFormatter.d.ts +34 -0
- package/dist/utils/planFormatter.d.ts.map +1 -0
- package/dist/utils/planFormatter.js +140 -0
- package/dist/utils/planFormatter.js.map +1 -0
- package/dist/workspace.d.ts +8 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +107 -0
- package/dist/workspace.js.map +1 -0
- package/dist/workspace.validator.d.ts +49 -0
- package/dist/workspace.validator.d.ts.map +1 -0
- package/dist/workspace.validator.js +214 -0
- package/dist/workspace.validator.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Explore Engine - Erosolar-CLI-style codebase exploration.
|
|
3
|
+
*
|
|
4
|
+
* This module implements an exploration system that mimics how Erosolar-CLI's
|
|
5
|
+
* explore agent works. It can work fully offline OR use the active AI model
|
|
6
|
+
* for enhanced query understanding and result summarization.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* 1. Codebase indexing - Build a searchable index of files, functions, classes, imports
|
|
10
|
+
* 2. Query processing - Parse natural language questions and map to search strategies
|
|
11
|
+
* 3. Smart search - Combine glob, grep, and structure analysis
|
|
12
|
+
* 4. Answer generation - Format results in a Erosolar-CLI-like way
|
|
13
|
+
* 5. Caching - Store the index for fast subsequent queries
|
|
14
|
+
* 6. AI Enhancement (optional) - Use the active model for better query understanding
|
|
15
|
+
*/
|
|
16
|
+
import { readFileSync, existsSync, readdirSync, statSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
17
|
+
import { join, relative, extname, basename, dirname } from 'node:path';
|
|
18
|
+
import { createHash } from 'node:crypto';
|
|
19
|
+
import { homedir } from 'node:os';
|
|
20
|
+
import { reportToolProgress } from '../core/toolRuntime.js';
|
|
21
|
+
import { buildError } from '../core/errors.js';
|
|
22
|
+
// =====================================================
|
|
23
|
+
// Global AI Enhancer Registry
|
|
24
|
+
// =====================================================
|
|
25
|
+
/**
|
|
26
|
+
* Global registry for the AI enhancer.
|
|
27
|
+
* This allows the explore tool to automatically use the active AI model
|
|
28
|
+
* without requiring explicit wiring at tool creation time.
|
|
29
|
+
*
|
|
30
|
+
* Usage:
|
|
31
|
+
* 1. When a session starts, call: setGlobalAIEnhancer(enhancerFn)
|
|
32
|
+
* 2. When the session ends, call: setGlobalAIEnhancer(null)
|
|
33
|
+
* 3. The explore tool will automatically use the registered enhancer
|
|
34
|
+
*/
|
|
35
|
+
let globalAIEnhancer = null;
|
|
36
|
+
/**
|
|
37
|
+
* Register the global AI enhancer function.
|
|
38
|
+
* Call this when an AI session becomes available.
|
|
39
|
+
*/
|
|
40
|
+
export function setGlobalAIEnhancer(enhancer) {
|
|
41
|
+
globalAIEnhancer = enhancer;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get the current global AI enhancer.
|
|
45
|
+
*/
|
|
46
|
+
export function getGlobalAIEnhancer() {
|
|
47
|
+
return globalAIEnhancer;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if an AI enhancer is available (globally or in context).
|
|
51
|
+
*/
|
|
52
|
+
function resolveAIEnhancer(context) {
|
|
53
|
+
return context.aiEnhancer ?? globalAIEnhancer ?? undefined;
|
|
54
|
+
}
|
|
55
|
+
// =====================================================
|
|
56
|
+
// Constants
|
|
57
|
+
// =====================================================
|
|
58
|
+
const INDEX_VERSION = 1;
|
|
59
|
+
const CACHE_DIR = join(homedir(), '.erosolar', 'explore-cache');
|
|
60
|
+
const IGNORED_DIRS = new Set([
|
|
61
|
+
'node_modules', '.git', '.svn', '.hg', 'dist', 'build', 'out',
|
|
62
|
+
'.next', '.nuxt', '.output', 'coverage', '.nyc_output', '.cache',
|
|
63
|
+
'.turbo', '.vercel', '.netlify', '__pycache__', '.pytest_cache',
|
|
64
|
+
'.mypy_cache', '.ruff_cache', 'venv', '.venv', 'env', '.env',
|
|
65
|
+
'target', 'vendor', '.idea', '.vscode',
|
|
66
|
+
]);
|
|
67
|
+
const LANGUAGE_MAP = {
|
|
68
|
+
'.ts': 'TypeScript', '.tsx': 'TypeScript React', '.js': 'JavaScript',
|
|
69
|
+
'.jsx': 'JavaScript React', '.mjs': 'JavaScript', '.cjs': 'JavaScript',
|
|
70
|
+
'.py': 'Python', '.rs': 'Rust', '.go': 'Go', '.java': 'Java',
|
|
71
|
+
'.kt': 'Kotlin', '.rb': 'Ruby', '.php': 'PHP', '.cs': 'C#',
|
|
72
|
+
'.cpp': 'C++', '.c': 'C', '.h': 'C/C++ Header', '.swift': 'Swift',
|
|
73
|
+
'.vue': 'Vue', '.svelte': 'Svelte', '.md': 'Markdown',
|
|
74
|
+
'.json': 'JSON', '.yaml': 'YAML', '.yml': 'YAML', '.toml': 'TOML',
|
|
75
|
+
};
|
|
76
|
+
// Query type detection patterns
|
|
77
|
+
const QUERY_PATTERNS = [
|
|
78
|
+
{ pattern: /where\s+(?:is|are|can\s+i\s+find)\s+.*(file|module|component)/i, type: 'find_file' },
|
|
79
|
+
{ pattern: /find\s+(?:the\s+)?(?:file|module|component)/i, type: 'find_file' },
|
|
80
|
+
{ pattern: /which\s+file/i, type: 'find_file' },
|
|
81
|
+
{ pattern: /where\s+(?:is|are)\s+(?:the\s+)?(\w+)\s+(?:defined|declared|implemented)/i, type: 'find_symbol' },
|
|
82
|
+
{ pattern: /find\s+(?:the\s+)?(?:function|class|type|interface)\s+/i, type: 'find_symbol' },
|
|
83
|
+
{ pattern: /definition\s+of/i, type: 'find_symbol' },
|
|
84
|
+
{ pattern: /where\s+(?:is\s+)?(\w+)\s+used/i, type: 'find_usage' },
|
|
85
|
+
{ pattern: /who\s+(?:uses|calls|imports)/i, type: 'find_usage' },
|
|
86
|
+
{ pattern: /usages?\s+of/i, type: 'find_usage' },
|
|
87
|
+
{ pattern: /how\s+(?:does|do|is)/i, type: 'understand' },
|
|
88
|
+
{ pattern: /(what(?:'s)?|what\s+is|explain)\s+(?:in|about)\s+(?:this\s+)?(repo|repository|project|codebase)/i, type: 'architecture' },
|
|
89
|
+
{ pattern: /explain\s+(?:the\s+)?(?:how|what)/i, type: 'explain' },
|
|
90
|
+
{ pattern: /what\s+(?:is|are|does)/i, type: 'explain' },
|
|
91
|
+
{ pattern: /architecture|structure|organization|layout/i, type: 'architecture' },
|
|
92
|
+
{ pattern: /dependencies|imports|relationships/i, type: 'dependencies' },
|
|
93
|
+
{ pattern: /./, type: 'search' }, // Default fallback
|
|
94
|
+
];
|
|
95
|
+
// =====================================================
|
|
96
|
+
// Local Explore Engine
|
|
97
|
+
// =====================================================
|
|
98
|
+
export class LocalExploreEngine {
|
|
99
|
+
workingDir;
|
|
100
|
+
index = null;
|
|
101
|
+
indexPath;
|
|
102
|
+
context;
|
|
103
|
+
constructor(workingDir, context = {}) {
|
|
104
|
+
this.workingDir = workingDir;
|
|
105
|
+
this.context = context;
|
|
106
|
+
const hash = createHash('md5').update(workingDir).digest('hex').slice(0, 12);
|
|
107
|
+
this.indexPath = join(CACHE_DIR, `index-${hash}.json`);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Set or update the AI enhancer context.
|
|
111
|
+
* Call this to enable AI-enhanced exploration with the active model.
|
|
112
|
+
*/
|
|
113
|
+
setContext(context) {
|
|
114
|
+
this.context = { ...this.context, ...context };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Initialize or load the codebase index.
|
|
118
|
+
* Returns true if a fresh index was built.
|
|
119
|
+
*/
|
|
120
|
+
async initialize(forceRebuild = false) {
|
|
121
|
+
if (!forceRebuild && this.tryLoadCache()) {
|
|
122
|
+
return { rebuilt: false, fileCount: this.index.files.length };
|
|
123
|
+
}
|
|
124
|
+
this.index = await this.buildIndex();
|
|
125
|
+
this.saveCache();
|
|
126
|
+
return { rebuilt: true, fileCount: this.index.files.length };
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Process a natural language query and return exploration results.
|
|
130
|
+
* Automatically uses the active AI model for better results when available.
|
|
131
|
+
*/
|
|
132
|
+
async explore(query, options) {
|
|
133
|
+
const startTime = Date.now();
|
|
134
|
+
if (!this.index) {
|
|
135
|
+
await this.initialize();
|
|
136
|
+
}
|
|
137
|
+
// Resolve AI enhancer (from context or global registry)
|
|
138
|
+
const useAI = options?.useAI !== false; // Default to true
|
|
139
|
+
const aiEnhancer = useAI ? resolveAIEnhancer(this.context) : undefined;
|
|
140
|
+
// Use AI for query parsing if available and enabled
|
|
141
|
+
let parsedQuery;
|
|
142
|
+
if (aiEnhancer && this.context.aiQueryParsing !== false) {
|
|
143
|
+
parsedQuery = await this.parseQueryWithAI(query, aiEnhancer);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
parsedQuery = this.parseQuery(query);
|
|
147
|
+
}
|
|
148
|
+
const result = await this.executeQuery(parsedQuery);
|
|
149
|
+
// Use AI for result summarization if available and enabled
|
|
150
|
+
if (aiEnhancer && this.context.aiSummarization !== false && result.files.length + result.symbols.length > 0) {
|
|
151
|
+
result.answer = await this.summarizeWithAI(query, result, aiEnhancer);
|
|
152
|
+
}
|
|
153
|
+
result.timeTaken = Date.now() - startTime;
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Use AI to parse a natural language query into structured exploration.
|
|
158
|
+
*/
|
|
159
|
+
async parseQueryWithAI(query, aiEnhancer) {
|
|
160
|
+
try {
|
|
161
|
+
const prompt = `You are helping parse a codebase exploration query. Extract the intent and keywords.
|
|
162
|
+
|
|
163
|
+
Query: "${query}"
|
|
164
|
+
|
|
165
|
+
Respond in this exact JSON format (no markdown, just JSON):
|
|
166
|
+
{
|
|
167
|
+
"type": "find_file" | "find_symbol" | "find_usage" | "understand" | "explain" | "search" | "architecture" | "dependencies",
|
|
168
|
+
"keywords": ["keyword1", "keyword2"],
|
|
169
|
+
"symbolKind": "function" | "class" | "type" | "interface" | null,
|
|
170
|
+
"filePattern": "pattern or null"
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
Types:
|
|
174
|
+
- find_file: Looking for specific files
|
|
175
|
+
- find_symbol: Looking for function/class/type definitions
|
|
176
|
+
- find_usage: Finding where something is used/called
|
|
177
|
+
- understand/explain: Understanding how something works
|
|
178
|
+
- architecture: Codebase structure overview
|
|
179
|
+
- dependencies: Import/export relationships
|
|
180
|
+
- search: General keyword search`;
|
|
181
|
+
const response = await aiEnhancer(prompt);
|
|
182
|
+
// Parse the JSON response
|
|
183
|
+
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
184
|
+
if (jsonMatch) {
|
|
185
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
186
|
+
return {
|
|
187
|
+
type: parsed.type || 'search',
|
|
188
|
+
keywords: Array.isArray(parsed.keywords) ? parsed.keywords : [query],
|
|
189
|
+
filters: {
|
|
190
|
+
symbolKind: parsed.symbolKind || undefined,
|
|
191
|
+
filePattern: parsed.filePattern || undefined,
|
|
192
|
+
limit: 10,
|
|
193
|
+
},
|
|
194
|
+
originalQuery: query,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// Fall back to rule-based parsing
|
|
200
|
+
}
|
|
201
|
+
return this.parseQuery(query);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Use AI to generate a natural language summary of exploration results.
|
|
205
|
+
*/
|
|
206
|
+
async summarizeWithAI(query, result, aiEnhancer) {
|
|
207
|
+
try {
|
|
208
|
+
const filesInfo = result.files.slice(0, 5).map(f => `- ${f.path}: ${f.reason}`).join('\n');
|
|
209
|
+
const symbolsInfo = result.symbols.slice(0, 5).map(s => `- ${s.name} (${s.kind}) at ${s.file}:${s.line}`).join('\n');
|
|
210
|
+
const prompt = `Summarize these codebase exploration results concisely.
|
|
211
|
+
|
|
212
|
+
User asked: "${query}"
|
|
213
|
+
|
|
214
|
+
Files found (${result.files.length} total):
|
|
215
|
+
${filesInfo || 'None'}
|
|
216
|
+
|
|
217
|
+
Symbols found (${result.symbols.length} total):
|
|
218
|
+
${symbolsInfo || 'None'}
|
|
219
|
+
|
|
220
|
+
Provide a helpful 2-4 sentence summary that directly answers the user's question. Include the most relevant file paths. Be specific and actionable.`;
|
|
221
|
+
const summary = await aiEnhancer(prompt);
|
|
222
|
+
return summary.trim();
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
return result.answer;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get a quick overview of the codebase.
|
|
230
|
+
*/
|
|
231
|
+
getOverview() {
|
|
232
|
+
if (!this.index) {
|
|
233
|
+
return 'Index not loaded. Call initialize() first.';
|
|
234
|
+
}
|
|
235
|
+
const idx = this.index;
|
|
236
|
+
const lines = [
|
|
237
|
+
`# Codebase Overview: ${basename(idx.rootDir)}`,
|
|
238
|
+
'',
|
|
239
|
+
`**Files indexed:** ${idx.files.length}`,
|
|
240
|
+
`**Last indexed:** ${idx.createdAt}`,
|
|
241
|
+
'',
|
|
242
|
+
'## Quick Access',
|
|
243
|
+
'',
|
|
244
|
+
];
|
|
245
|
+
if (idx.quickLookup.entryPoints.length) {
|
|
246
|
+
lines.push(`**Entry Points:** ${idx.quickLookup.entryPoints.slice(0, 5).join(', ')}`);
|
|
247
|
+
}
|
|
248
|
+
if (idx.quickLookup.configFiles.length) {
|
|
249
|
+
lines.push(`**Config Files:** ${idx.quickLookup.configFiles.slice(0, 5).join(', ')}`);
|
|
250
|
+
}
|
|
251
|
+
if (idx.quickLookup.testFiles.length) {
|
|
252
|
+
lines.push(`**Test Files:** ${idx.quickLookup.testFiles.length} files`);
|
|
253
|
+
}
|
|
254
|
+
lines.push('', '## Architecture');
|
|
255
|
+
if (idx.patterns.architecture.length) {
|
|
256
|
+
lines.push(`**Detected:** ${idx.patterns.architecture.join(', ')}`);
|
|
257
|
+
}
|
|
258
|
+
if (idx.patterns.designPatterns.length) {
|
|
259
|
+
lines.push(`**Patterns:** ${idx.patterns.designPatterns.slice(0, 5).join(', ')}`);
|
|
260
|
+
}
|
|
261
|
+
return lines.join('\n');
|
|
262
|
+
}
|
|
263
|
+
// =====================================================
|
|
264
|
+
// Private Methods
|
|
265
|
+
// =====================================================
|
|
266
|
+
tryLoadCache() {
|
|
267
|
+
try {
|
|
268
|
+
if (!existsSync(this.indexPath)) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
const content = readFileSync(this.indexPath, 'utf-8');
|
|
272
|
+
const cached = JSON.parse(content);
|
|
273
|
+
// Check version and hash
|
|
274
|
+
if (cached.version !== INDEX_VERSION) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
// Quick validation: check if file count roughly matches
|
|
278
|
+
const currentFileCount = this.countFiles(this.workingDir, 0, 4);
|
|
279
|
+
const cachedFileCount = cached.files.length;
|
|
280
|
+
const drift = Math.abs(currentFileCount - cachedFileCount);
|
|
281
|
+
// Allow 10% drift before rebuilding
|
|
282
|
+
if (drift > cachedFileCount * 0.1 && drift > 10) {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
// Restore Map objects from JSON
|
|
286
|
+
this.index = {
|
|
287
|
+
...cached,
|
|
288
|
+
symbols: {
|
|
289
|
+
byName: new Map(Object.entries(cached.symbols.byName || {})),
|
|
290
|
+
byKind: new Map(Object.entries(cached.symbols.byKind || {})),
|
|
291
|
+
byFile: new Map(Object.entries(cached.symbols.byFile || {})),
|
|
292
|
+
},
|
|
293
|
+
imports: {
|
|
294
|
+
imports: new Map(Object.entries(cached.imports.imports || {})),
|
|
295
|
+
importedBy: new Map(Object.entries(cached.imports.importedBy || {})),
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
saveCache() {
|
|
305
|
+
try {
|
|
306
|
+
mkdirSync(CACHE_DIR, { recursive: true });
|
|
307
|
+
// Convert Maps to objects for JSON serialization
|
|
308
|
+
const serializable = {
|
|
309
|
+
...this.index,
|
|
310
|
+
symbols: {
|
|
311
|
+
byName: Object.fromEntries(this.index.symbols.byName),
|
|
312
|
+
byKind: Object.fromEntries(this.index.symbols.byKind),
|
|
313
|
+
byFile: Object.fromEntries(this.index.symbols.byFile),
|
|
314
|
+
},
|
|
315
|
+
imports: {
|
|
316
|
+
imports: Object.fromEntries(this.index.imports.imports),
|
|
317
|
+
importedBy: Object.fromEntries(this.index.imports.importedBy),
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
writeFileSync(this.indexPath, JSON.stringify(serializable, null, 2));
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
// Ignore cache save errors
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
countFiles(dir, depth, maxDepth) {
|
|
327
|
+
if (depth >= maxDepth)
|
|
328
|
+
return 0;
|
|
329
|
+
let count = 0;
|
|
330
|
+
try {
|
|
331
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
332
|
+
for (const entry of entries) {
|
|
333
|
+
if (entry.name.startsWith('.') || IGNORED_DIRS.has(entry.name))
|
|
334
|
+
continue;
|
|
335
|
+
if (entry.isDirectory()) {
|
|
336
|
+
count += this.countFiles(join(dir, entry.name), depth + 1, maxDepth);
|
|
337
|
+
}
|
|
338
|
+
else if (entry.isFile() && LANGUAGE_MAP[extname(entry.name).toLowerCase()]) {
|
|
339
|
+
count++;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
// Ignore errors
|
|
345
|
+
}
|
|
346
|
+
return count;
|
|
347
|
+
}
|
|
348
|
+
async buildIndex() {
|
|
349
|
+
const files = [];
|
|
350
|
+
const symbolsByName = new Map();
|
|
351
|
+
const symbolsByKind = new Map();
|
|
352
|
+
const symbolsByFile = new Map();
|
|
353
|
+
const importsMap = new Map();
|
|
354
|
+
const importedByMap = new Map();
|
|
355
|
+
const quickLookup = {
|
|
356
|
+
entryPoints: [],
|
|
357
|
+
configFiles: [],
|
|
358
|
+
testFiles: [],
|
|
359
|
+
componentFiles: [],
|
|
360
|
+
typeFiles: [],
|
|
361
|
+
utilityFiles: [],
|
|
362
|
+
routeFiles: [],
|
|
363
|
+
modelFiles: [],
|
|
364
|
+
};
|
|
365
|
+
const patterns = {
|
|
366
|
+
architecture: [],
|
|
367
|
+
designPatterns: [],
|
|
368
|
+
namingConventions: [],
|
|
369
|
+
testPatterns: [],
|
|
370
|
+
componentPatterns: [],
|
|
371
|
+
};
|
|
372
|
+
// Collect all files
|
|
373
|
+
const allFiles = this.collectFiles(this.workingDir, 0, 6);
|
|
374
|
+
const totalFiles = allFiles.length;
|
|
375
|
+
let processed = 0;
|
|
376
|
+
let lastProgressAt = 0;
|
|
377
|
+
const sendProgress = (message) => {
|
|
378
|
+
if (totalFiles === 0)
|
|
379
|
+
return;
|
|
380
|
+
const now = Date.now();
|
|
381
|
+
const shouldEmit = processed === totalFiles || now - lastProgressAt > 50;
|
|
382
|
+
if (!shouldEmit)
|
|
383
|
+
return;
|
|
384
|
+
lastProgressAt = now;
|
|
385
|
+
try {
|
|
386
|
+
reportToolProgress({
|
|
387
|
+
current: processed,
|
|
388
|
+
total: totalFiles,
|
|
389
|
+
message,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
// Best-effort progress reporting; ignore failures
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
// Initial progress update so UI can display total file count
|
|
397
|
+
if (totalFiles > 0) {
|
|
398
|
+
sendProgress();
|
|
399
|
+
}
|
|
400
|
+
// Index each file
|
|
401
|
+
for (const filePath of allFiles) {
|
|
402
|
+
try {
|
|
403
|
+
processed += 1;
|
|
404
|
+
const relPath = relative(this.workingDir, filePath);
|
|
405
|
+
const indexed = this.indexFile(filePath);
|
|
406
|
+
if (indexed) {
|
|
407
|
+
files.push(indexed);
|
|
408
|
+
// Build symbol index
|
|
409
|
+
const relPath = indexed.path;
|
|
410
|
+
const fileSymbols = [];
|
|
411
|
+
for (const sym of [...indexed.symbols.functions, ...indexed.symbols.classes,
|
|
412
|
+
...indexed.symbols.interfaces, ...indexed.symbols.types]) {
|
|
413
|
+
const location = {
|
|
414
|
+
file: relPath,
|
|
415
|
+
line: sym.line,
|
|
416
|
+
kind: sym.kind,
|
|
417
|
+
signature: sym.signature,
|
|
418
|
+
};
|
|
419
|
+
// By name
|
|
420
|
+
const existing = symbolsByName.get(sym.name.toLowerCase()) || [];
|
|
421
|
+
existing.push(location);
|
|
422
|
+
symbolsByName.set(sym.name.toLowerCase(), existing);
|
|
423
|
+
// By kind
|
|
424
|
+
const byKind = symbolsByKind.get(sym.kind) || [];
|
|
425
|
+
byKind.push(location);
|
|
426
|
+
symbolsByKind.set(sym.kind, byKind);
|
|
427
|
+
fileSymbols.push(sym.name);
|
|
428
|
+
}
|
|
429
|
+
symbolsByFile.set(relPath, fileSymbols);
|
|
430
|
+
// Build import graph
|
|
431
|
+
importsMap.set(relPath, indexed.imports);
|
|
432
|
+
for (const imp of indexed.imports) {
|
|
433
|
+
const existing = importedByMap.get(imp) || [];
|
|
434
|
+
existing.push(relPath);
|
|
435
|
+
importedByMap.set(imp, existing);
|
|
436
|
+
}
|
|
437
|
+
// Categorize files
|
|
438
|
+
this.categorizeFile(indexed, quickLookup);
|
|
439
|
+
}
|
|
440
|
+
sendProgress(relPath);
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
// Skip files we can't index
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// Detect patterns
|
|
447
|
+
this.detectPatterns(files, patterns);
|
|
448
|
+
// Create hash for cache validation
|
|
449
|
+
const hash = createHash('md5')
|
|
450
|
+
.update(files.map(f => f.path).sort().join('\n'))
|
|
451
|
+
.digest('hex');
|
|
452
|
+
return {
|
|
453
|
+
version: INDEX_VERSION,
|
|
454
|
+
createdAt: new Date().toISOString(),
|
|
455
|
+
rootDir: this.workingDir,
|
|
456
|
+
hash,
|
|
457
|
+
files,
|
|
458
|
+
symbols: {
|
|
459
|
+
byName: symbolsByName,
|
|
460
|
+
byKind: symbolsByKind,
|
|
461
|
+
byFile: symbolsByFile,
|
|
462
|
+
},
|
|
463
|
+
imports: {
|
|
464
|
+
imports: importsMap,
|
|
465
|
+
importedBy: importedByMap,
|
|
466
|
+
},
|
|
467
|
+
patterns,
|
|
468
|
+
quickLookup,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
collectFiles(dir, depth, maxDepth) {
|
|
472
|
+
if (depth >= maxDepth)
|
|
473
|
+
return [];
|
|
474
|
+
const files = [];
|
|
475
|
+
try {
|
|
476
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
477
|
+
for (const entry of entries) {
|
|
478
|
+
if (entry.name.startsWith('.') || IGNORED_DIRS.has(entry.name))
|
|
479
|
+
continue;
|
|
480
|
+
const fullPath = join(dir, entry.name);
|
|
481
|
+
if (entry.isDirectory()) {
|
|
482
|
+
files.push(...this.collectFiles(fullPath, depth + 1, maxDepth));
|
|
483
|
+
}
|
|
484
|
+
else if (entry.isFile()) {
|
|
485
|
+
const ext = extname(entry.name).toLowerCase();
|
|
486
|
+
if (LANGUAGE_MAP[ext]) {
|
|
487
|
+
files.push(fullPath);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
catch {
|
|
493
|
+
// Ignore errors
|
|
494
|
+
}
|
|
495
|
+
return files;
|
|
496
|
+
}
|
|
497
|
+
indexFile(filePath) {
|
|
498
|
+
try {
|
|
499
|
+
const stat = statSync(filePath);
|
|
500
|
+
if (stat.size > 500000)
|
|
501
|
+
return null; // Skip large files
|
|
502
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
503
|
+
const lines = content.split('\n');
|
|
504
|
+
const ext = extname(filePath).toLowerCase();
|
|
505
|
+
const language = LANGUAGE_MAP[ext] || 'Unknown';
|
|
506
|
+
const relPath = relative(this.workingDir, filePath);
|
|
507
|
+
const symbols = this.extractSymbols(content, ext);
|
|
508
|
+
const imports = this.extractImports(content, ext);
|
|
509
|
+
const exports = this.extractExports(content, ext);
|
|
510
|
+
const purpose = this.inferPurpose(basename(filePath), content, symbols);
|
|
511
|
+
const tags = this.generateTags(relPath, content, symbols, purpose);
|
|
512
|
+
return {
|
|
513
|
+
path: relPath,
|
|
514
|
+
language,
|
|
515
|
+
size: stat.size,
|
|
516
|
+
lineCount: lines.length,
|
|
517
|
+
lastModified: stat.mtimeMs,
|
|
518
|
+
symbols,
|
|
519
|
+
imports,
|
|
520
|
+
exports,
|
|
521
|
+
purpose,
|
|
522
|
+
tags,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
catch {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
extractSymbols(content, ext) {
|
|
530
|
+
const symbols = {
|
|
531
|
+
functions: [],
|
|
532
|
+
classes: [],
|
|
533
|
+
interfaces: [],
|
|
534
|
+
types: [],
|
|
535
|
+
constants: [],
|
|
536
|
+
variables: [],
|
|
537
|
+
};
|
|
538
|
+
if (!['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
|
|
539
|
+
return symbols; // Only analyze JS/TS for now
|
|
540
|
+
}
|
|
541
|
+
const lines = content.split('\n');
|
|
542
|
+
// Extract functions
|
|
543
|
+
const funcRegex = /(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)/g;
|
|
544
|
+
let match;
|
|
545
|
+
while ((match = funcRegex.exec(content)) !== null) {
|
|
546
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
547
|
+
symbols.functions.push({
|
|
548
|
+
name: match[1] || '',
|
|
549
|
+
line,
|
|
550
|
+
kind: 'function',
|
|
551
|
+
isExported: content.substring(match.index - 20, match.index).includes('export'),
|
|
552
|
+
signature: `${match[1]}(${match[2]})`,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
// Arrow functions
|
|
556
|
+
const arrowRegex = /(?:export\s+)?(?:const|let)\s+(\w+)\s*=\s*(?:async\s+)?\(?([^)=]*)\)?\s*=>/g;
|
|
557
|
+
while ((match = arrowRegex.exec(content)) !== null) {
|
|
558
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
559
|
+
symbols.functions.push({
|
|
560
|
+
name: match[1] || '',
|
|
561
|
+
line,
|
|
562
|
+
kind: 'function',
|
|
563
|
+
isExported: content.substring(match.index - 20, match.index).includes('export'),
|
|
564
|
+
signature: `${match[1]}(${match[2] || ''})`,
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
// Classes
|
|
568
|
+
const classRegex = /(?:export\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?/g;
|
|
569
|
+
while ((match = classRegex.exec(content)) !== null) {
|
|
570
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
571
|
+
symbols.classes.push({
|
|
572
|
+
name: match[1] || '',
|
|
573
|
+
line,
|
|
574
|
+
kind: 'class',
|
|
575
|
+
isExported: content.substring(match.index - 20, match.index).includes('export'),
|
|
576
|
+
signature: match[2] ? `class ${match[1]} extends ${match[2]}` : `class ${match[1]}`,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
// Interfaces
|
|
580
|
+
const interfaceRegex = /(?:export\s+)?interface\s+(\w+)(?:\s+extends\s+([^{]+))?/g;
|
|
581
|
+
while ((match = interfaceRegex.exec(content)) !== null) {
|
|
582
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
583
|
+
symbols.interfaces.push({
|
|
584
|
+
name: match[1] || '',
|
|
585
|
+
line,
|
|
586
|
+
kind: 'interface',
|
|
587
|
+
isExported: content.substring(match.index - 20, match.index).includes('export'),
|
|
588
|
+
signature: `interface ${match[1]}`,
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
// Types
|
|
592
|
+
const typeRegex = /(?:export\s+)?type\s+(\w+)\s*=/g;
|
|
593
|
+
while ((match = typeRegex.exec(content)) !== null) {
|
|
594
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
595
|
+
symbols.types.push({
|
|
596
|
+
name: match[1] || '',
|
|
597
|
+
line,
|
|
598
|
+
kind: 'type',
|
|
599
|
+
isExported: content.substring(match.index - 20, match.index).includes('export'),
|
|
600
|
+
signature: `type ${match[1]}`,
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
// Constants
|
|
604
|
+
const constRegex = /(?:export\s+)?const\s+([A-Z][A-Z_0-9]+)\s*=/g;
|
|
605
|
+
while ((match = constRegex.exec(content)) !== null) {
|
|
606
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
607
|
+
symbols.constants.push({
|
|
608
|
+
name: match[1] || '',
|
|
609
|
+
line,
|
|
610
|
+
kind: 'const',
|
|
611
|
+
isExported: content.substring(match.index - 20, match.index).includes('export'),
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
return symbols;
|
|
615
|
+
}
|
|
616
|
+
extractImports(content, ext) {
|
|
617
|
+
const imports = [];
|
|
618
|
+
if (!['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
|
|
619
|
+
return imports;
|
|
620
|
+
}
|
|
621
|
+
// ES6 imports
|
|
622
|
+
const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
|
|
623
|
+
let match;
|
|
624
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
625
|
+
const source = match[1] || '';
|
|
626
|
+
if (source.startsWith('.')) {
|
|
627
|
+
// Resolve relative imports
|
|
628
|
+
imports.push(source);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return imports;
|
|
632
|
+
}
|
|
633
|
+
extractExports(content, ext) {
|
|
634
|
+
const exports = [];
|
|
635
|
+
if (!['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'].includes(ext)) {
|
|
636
|
+
return exports;
|
|
637
|
+
}
|
|
638
|
+
// Named exports
|
|
639
|
+
const namedExportRegex = /export\s+(?:const|let|var|function|class|interface|type|enum)\s+(\w+)/g;
|
|
640
|
+
let match;
|
|
641
|
+
while ((match = namedExportRegex.exec(content)) !== null) {
|
|
642
|
+
if (match[1])
|
|
643
|
+
exports.push(match[1]);
|
|
644
|
+
}
|
|
645
|
+
// Default export
|
|
646
|
+
if (/export\s+default/.test(content)) {
|
|
647
|
+
exports.push('default');
|
|
648
|
+
}
|
|
649
|
+
return exports;
|
|
650
|
+
}
|
|
651
|
+
inferPurpose(filename, content, symbols) {
|
|
652
|
+
const lower = filename.toLowerCase();
|
|
653
|
+
if (lower.includes('test') || lower.includes('spec'))
|
|
654
|
+
return 'Test file';
|
|
655
|
+
if (lower === 'index.ts' || lower === 'index.js')
|
|
656
|
+
return 'Module entry point';
|
|
657
|
+
if (lower.includes('config'))
|
|
658
|
+
return 'Configuration';
|
|
659
|
+
if (lower.includes('type') || lower.includes('interface'))
|
|
660
|
+
return 'Type definitions';
|
|
661
|
+
if (lower.includes('util') || lower.includes('helper'))
|
|
662
|
+
return 'Utilities';
|
|
663
|
+
if (lower.includes('hook'))
|
|
664
|
+
return 'React hooks';
|
|
665
|
+
if (lower.includes('context'))
|
|
666
|
+
return 'Context provider';
|
|
667
|
+
if (lower.includes('store') || lower.includes('reducer'))
|
|
668
|
+
return 'State management';
|
|
669
|
+
if (lower.includes('service'))
|
|
670
|
+
return 'Business logic';
|
|
671
|
+
if (lower.includes('api') || lower.includes('client'))
|
|
672
|
+
return 'API client';
|
|
673
|
+
if (lower.includes('route'))
|
|
674
|
+
return 'Routes';
|
|
675
|
+
if (lower.includes('middleware'))
|
|
676
|
+
return 'Middleware';
|
|
677
|
+
if (lower.includes('model') || lower.includes('entity'))
|
|
678
|
+
return 'Data models';
|
|
679
|
+
if (lower.includes('schema'))
|
|
680
|
+
return 'Schema definitions';
|
|
681
|
+
if (lower.includes('component'))
|
|
682
|
+
return 'UI component';
|
|
683
|
+
if (symbols.classes.length > 0)
|
|
684
|
+
return `Class: ${symbols.classes[0]?.name}`;
|
|
685
|
+
if (symbols.interfaces.length > 0)
|
|
686
|
+
return `Types/Interfaces`;
|
|
687
|
+
if (symbols.functions.length > 0)
|
|
688
|
+
return `Functions: ${symbols.functions.slice(0, 3).map(f => f.name).join(', ')}`;
|
|
689
|
+
return 'General module';
|
|
690
|
+
}
|
|
691
|
+
generateTags(path, content, symbols, purpose) {
|
|
692
|
+
const tags = [];
|
|
693
|
+
// Add purpose-based tags
|
|
694
|
+
tags.push(purpose.toLowerCase().split(':')[0] || '');
|
|
695
|
+
// Add path-based tags
|
|
696
|
+
const parts = path.split('/');
|
|
697
|
+
for (const part of parts.slice(0, -1)) {
|
|
698
|
+
if (part && !part.startsWith('.')) {
|
|
699
|
+
tags.push(part.toLowerCase());
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
// Add symbol-based tags
|
|
703
|
+
for (const sym of symbols.functions) {
|
|
704
|
+
if (sym.isExported)
|
|
705
|
+
tags.push(sym.name.toLowerCase());
|
|
706
|
+
}
|
|
707
|
+
for (const sym of symbols.classes) {
|
|
708
|
+
if (sym.isExported)
|
|
709
|
+
tags.push(sym.name.toLowerCase());
|
|
710
|
+
}
|
|
711
|
+
// Add content-based tags
|
|
712
|
+
if (/useEffect|useState|useCallback/.test(content))
|
|
713
|
+
tags.push('react', 'hooks');
|
|
714
|
+
if (/async\s+function|await\s+/.test(content))
|
|
715
|
+
tags.push('async');
|
|
716
|
+
if (/express|fastify|koa/.test(content))
|
|
717
|
+
tags.push('server', 'http');
|
|
718
|
+
if (/import.*prisma|import.*mongoose/.test(content))
|
|
719
|
+
tags.push('database');
|
|
720
|
+
if (/import.*zod|import.*yup|import.*joi/.test(content))
|
|
721
|
+
tags.push('validation');
|
|
722
|
+
if (/describe\s*\(|it\s*\(|test\s*\(/.test(content))
|
|
723
|
+
tags.push('test');
|
|
724
|
+
return [...new Set(tags.filter(Boolean))];
|
|
725
|
+
}
|
|
726
|
+
categorizeFile(file, lookup) {
|
|
727
|
+
const lower = file.path.toLowerCase();
|
|
728
|
+
const name = basename(file.path).toLowerCase();
|
|
729
|
+
// Entry points
|
|
730
|
+
if (['index.ts', 'index.js', 'main.ts', 'main.js', 'app.ts', 'app.js'].includes(name)) {
|
|
731
|
+
lookup.entryPoints.push(file.path);
|
|
732
|
+
}
|
|
733
|
+
// Config files
|
|
734
|
+
if (name.includes('config') || name.includes('settings') || name.includes('.rc')) {
|
|
735
|
+
lookup.configFiles.push(file.path);
|
|
736
|
+
}
|
|
737
|
+
// Test files
|
|
738
|
+
if (lower.includes('test') || lower.includes('spec') || lower.includes('__tests__')) {
|
|
739
|
+
lookup.testFiles.push(file.path);
|
|
740
|
+
}
|
|
741
|
+
// Component files
|
|
742
|
+
if (lower.includes('component') || lower.includes('components/') ||
|
|
743
|
+
file.language.includes('React')) {
|
|
744
|
+
lookup.componentFiles.push(file.path);
|
|
745
|
+
}
|
|
746
|
+
// Type files
|
|
747
|
+
if (lower.includes('type') || lower.includes('interface') || name.endsWith('.d.ts')) {
|
|
748
|
+
lookup.typeFiles.push(file.path);
|
|
749
|
+
}
|
|
750
|
+
// Utility files
|
|
751
|
+
if (lower.includes('util') || lower.includes('helper') || lower.includes('lib/')) {
|
|
752
|
+
lookup.utilityFiles.push(file.path);
|
|
753
|
+
}
|
|
754
|
+
// Route files
|
|
755
|
+
if (lower.includes('route') || lower.includes('api/')) {
|
|
756
|
+
lookup.routeFiles.push(file.path);
|
|
757
|
+
}
|
|
758
|
+
// Model files
|
|
759
|
+
if (lower.includes('model') || lower.includes('entity') || lower.includes('schema')) {
|
|
760
|
+
lookup.modelFiles.push(file.path);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
detectPatterns(files, patterns) {
|
|
764
|
+
const dirs = new Set();
|
|
765
|
+
for (const file of files) {
|
|
766
|
+
const dir = dirname(file.path);
|
|
767
|
+
dirs.add(dir.split('/')[0] || dir);
|
|
768
|
+
}
|
|
769
|
+
// Detect architecture patterns
|
|
770
|
+
if (dirs.has('src') && (dirs.has('components') || dirs.has('views'))) {
|
|
771
|
+
patterns.architecture.push('Component-based');
|
|
772
|
+
}
|
|
773
|
+
if (dirs.has('api') || dirs.has('routes')) {
|
|
774
|
+
patterns.architecture.push('API-driven');
|
|
775
|
+
}
|
|
776
|
+
if (dirs.has('services') && dirs.has('controllers')) {
|
|
777
|
+
patterns.architecture.push('Layered');
|
|
778
|
+
}
|
|
779
|
+
if (dirs.has('domain') || dirs.has('entities')) {
|
|
780
|
+
patterns.architecture.push('Domain-driven');
|
|
781
|
+
}
|
|
782
|
+
// Detect design patterns
|
|
783
|
+
const allContent = files.slice(0, 50).map(f => {
|
|
784
|
+
try {
|
|
785
|
+
return readFileSync(join(this.workingDir, f.path), 'utf-8');
|
|
786
|
+
}
|
|
787
|
+
catch {
|
|
788
|
+
return '';
|
|
789
|
+
}
|
|
790
|
+
}).join('\n');
|
|
791
|
+
if (/singleton|getInstance/i.test(allContent))
|
|
792
|
+
patterns.designPatterns.push('Singleton');
|
|
793
|
+
if (/factory|create\w+/i.test(allContent))
|
|
794
|
+
patterns.designPatterns.push('Factory');
|
|
795
|
+
if (/observer|subscribe|emit/i.test(allContent))
|
|
796
|
+
patterns.designPatterns.push('Observer');
|
|
797
|
+
if (/strategy|\bstrategy\b/i.test(allContent))
|
|
798
|
+
patterns.designPatterns.push('Strategy');
|
|
799
|
+
if (/decorator|@\w+/i.test(allContent))
|
|
800
|
+
patterns.designPatterns.push('Decorator');
|
|
801
|
+
// Detect naming conventions
|
|
802
|
+
const fileNames = files.map(f => basename(f.path, extname(f.path)));
|
|
803
|
+
if (fileNames.some(n => /[a-z]+-[a-z]+/.test(n)))
|
|
804
|
+
patterns.namingConventions.push('kebab-case');
|
|
805
|
+
if (fileNames.some(n => /[a-z]+[A-Z]/.test(n)))
|
|
806
|
+
patterns.namingConventions.push('camelCase');
|
|
807
|
+
if (fileNames.some(n => /^[A-Z][a-z]+[A-Z]/.test(n)))
|
|
808
|
+
patterns.namingConventions.push('PascalCase');
|
|
809
|
+
if (fileNames.some(n => /[a-z]+_[a-z]+/.test(n)))
|
|
810
|
+
patterns.namingConventions.push('snake_case');
|
|
811
|
+
}
|
|
812
|
+
parseQuery(query) {
|
|
813
|
+
const normalized = query.trim().toLowerCase();
|
|
814
|
+
let type = 'search';
|
|
815
|
+
for (const { pattern, type: queryType } of QUERY_PATTERNS) {
|
|
816
|
+
if (pattern.test(query)) {
|
|
817
|
+
type = queryType;
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
// Extract keywords
|
|
822
|
+
const stopWords = new Set(['the', 'a', 'an', 'is', 'are', 'where', 'what', 'how', 'which', 'find', 'show', 'get', 'me', 'i', 'can', 'do', 'does', 'for', 'to', 'in', 'of']);
|
|
823
|
+
const keywords = normalized
|
|
824
|
+
.replace(/[^\w\s]/g, ' ')
|
|
825
|
+
.split(/\s+/)
|
|
826
|
+
.filter(w => w.length > 2 && !stopWords.has(w));
|
|
827
|
+
// Extract filters from query
|
|
828
|
+
const filters = { limit: 10 };
|
|
829
|
+
// File pattern filter
|
|
830
|
+
const fileMatch = query.match(/(?:in|from|file)\s+([^\s]+\.[a-z]+)/i);
|
|
831
|
+
if (fileMatch) {
|
|
832
|
+
filters.filePattern = fileMatch[1];
|
|
833
|
+
}
|
|
834
|
+
// Language filter
|
|
835
|
+
const langMatch = query.match(/(typescript|javascript|python|rust|go)/i);
|
|
836
|
+
if (langMatch) {
|
|
837
|
+
filters.language = langMatch[1];
|
|
838
|
+
}
|
|
839
|
+
// Symbol kind filter
|
|
840
|
+
const kindMatch = query.match(/(function|class|type|interface|constant)/i);
|
|
841
|
+
if (kindMatch && kindMatch[1]) {
|
|
842
|
+
filters.symbolKind = kindMatch[1].toLowerCase();
|
|
843
|
+
}
|
|
844
|
+
return {
|
|
845
|
+
type,
|
|
846
|
+
keywords,
|
|
847
|
+
filters,
|
|
848
|
+
originalQuery: query,
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
async executeQuery(query) {
|
|
852
|
+
const result = {
|
|
853
|
+
query: query.originalQuery,
|
|
854
|
+
queryType: query.type,
|
|
855
|
+
files: [],
|
|
856
|
+
symbols: [],
|
|
857
|
+
answer: '',
|
|
858
|
+
suggestions: [],
|
|
859
|
+
timeTaken: 0,
|
|
860
|
+
};
|
|
861
|
+
switch (query.type) {
|
|
862
|
+
case 'find_file':
|
|
863
|
+
this.findFiles(query, result);
|
|
864
|
+
break;
|
|
865
|
+
case 'find_symbol':
|
|
866
|
+
this.findSymbols(query, result);
|
|
867
|
+
break;
|
|
868
|
+
case 'find_usage':
|
|
869
|
+
this.findUsages(query, result);
|
|
870
|
+
break;
|
|
871
|
+
case 'architecture':
|
|
872
|
+
this.explainArchitecture(query, result);
|
|
873
|
+
break;
|
|
874
|
+
case 'dependencies':
|
|
875
|
+
this.showDependencies(query, result);
|
|
876
|
+
break;
|
|
877
|
+
case 'understand':
|
|
878
|
+
case 'explain':
|
|
879
|
+
this.explainConcept(query, result);
|
|
880
|
+
break;
|
|
881
|
+
case 'search':
|
|
882
|
+
default:
|
|
883
|
+
this.generalSearch(query, result);
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
// Generate suggestions
|
|
887
|
+
this.generateSuggestions(query, result);
|
|
888
|
+
return result;
|
|
889
|
+
}
|
|
890
|
+
findFiles(query, result) {
|
|
891
|
+
const matches = [];
|
|
892
|
+
for (const file of this.index.files) {
|
|
893
|
+
let relevance = 0;
|
|
894
|
+
for (const keyword of query.keywords) {
|
|
895
|
+
const keywordLower = keyword.toLowerCase();
|
|
896
|
+
// Match in path
|
|
897
|
+
if (file.path.toLowerCase().includes(keywordLower)) {
|
|
898
|
+
relevance += 10;
|
|
899
|
+
}
|
|
900
|
+
// Match in tags
|
|
901
|
+
if (file.tags.some(t => t.includes(keywordLower))) {
|
|
902
|
+
relevance += 5;
|
|
903
|
+
}
|
|
904
|
+
// Match in purpose
|
|
905
|
+
if (file.purpose.toLowerCase().includes(keywordLower)) {
|
|
906
|
+
relevance += 3;
|
|
907
|
+
}
|
|
908
|
+
// Match symbol names
|
|
909
|
+
const allSymbols = [...file.symbols.functions, ...file.symbols.classes];
|
|
910
|
+
if (allSymbols.some(s => s.name.toLowerCase().includes(keywordLower))) {
|
|
911
|
+
relevance += 7;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
// Apply filters
|
|
915
|
+
if (query.filters.filePattern && !file.path.includes(query.filters.filePattern)) {
|
|
916
|
+
relevance = 0;
|
|
917
|
+
}
|
|
918
|
+
if (query.filters.language && !file.language.toLowerCase().includes(query.filters.language.toLowerCase())) {
|
|
919
|
+
relevance = 0;
|
|
920
|
+
}
|
|
921
|
+
if (relevance > 0) {
|
|
922
|
+
matches.push({
|
|
923
|
+
path: file.path,
|
|
924
|
+
relevance,
|
|
925
|
+
reason: file.purpose,
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
// Sort by relevance and limit
|
|
930
|
+
matches.sort((a, b) => b.relevance - a.relevance);
|
|
931
|
+
result.files = matches.slice(0, query.filters.limit || 10);
|
|
932
|
+
// Generate answer
|
|
933
|
+
if (result.files.length > 0) {
|
|
934
|
+
const topFiles = result.files.slice(0, 5);
|
|
935
|
+
result.answer = [
|
|
936
|
+
`Found ${result.files.length} relevant file(s) for "${query.keywords.join(' ')}":`,
|
|
937
|
+
'',
|
|
938
|
+
...topFiles.map(f => `• **${f.path}** - ${f.reason}`),
|
|
939
|
+
result.files.length > 5 ? `\n...and ${result.files.length - 5} more files` : '',
|
|
940
|
+
].join('\n');
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
result.answer = `No files found matching "${query.keywords.join(' ')}". Try different keywords or check the spelling.`;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
findSymbols(query, result) {
|
|
947
|
+
const matches = [];
|
|
948
|
+
for (const keyword of query.keywords) {
|
|
949
|
+
const keywordLower = keyword.toLowerCase();
|
|
950
|
+
const locations = this.index.symbols.byName.get(keywordLower) || [];
|
|
951
|
+
for (const loc of locations) {
|
|
952
|
+
// Check kind filter
|
|
953
|
+
if (query.filters.symbolKind && loc.kind !== query.filters.symbolKind) {
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
matches.push({
|
|
957
|
+
name: keyword,
|
|
958
|
+
file: loc.file,
|
|
959
|
+
line: loc.line,
|
|
960
|
+
kind: loc.kind,
|
|
961
|
+
relevance: 10,
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
// Also search partial matches
|
|
966
|
+
for (const [name, locations] of this.index.symbols.byName) {
|
|
967
|
+
for (const keyword of query.keywords) {
|
|
968
|
+
if (name.includes(keyword.toLowerCase()) && !matches.some(m => m.name === name)) {
|
|
969
|
+
for (const loc of locations) {
|
|
970
|
+
if (query.filters.symbolKind && loc.kind !== query.filters.symbolKind)
|
|
971
|
+
continue;
|
|
972
|
+
matches.push({
|
|
973
|
+
name,
|
|
974
|
+
file: loc.file,
|
|
975
|
+
line: loc.line,
|
|
976
|
+
kind: loc.kind,
|
|
977
|
+
relevance: 5,
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
matches.sort((a, b) => b.relevance - a.relevance);
|
|
984
|
+
result.symbols = matches.slice(0, query.filters.limit || 10);
|
|
985
|
+
// Generate answer
|
|
986
|
+
if (result.symbols.length > 0) {
|
|
987
|
+
const topSymbols = result.symbols.slice(0, 5);
|
|
988
|
+
result.answer = [
|
|
989
|
+
`Found ${result.symbols.length} symbol(s) matching "${query.keywords.join(' ')}":`,
|
|
990
|
+
'',
|
|
991
|
+
...topSymbols.map(s => `• **${s.name}** (${s.kind}) at ${s.file}:${s.line}`),
|
|
992
|
+
result.symbols.length > 5 ? `\n...and ${result.symbols.length - 5} more symbols` : '',
|
|
993
|
+
].join('\n');
|
|
994
|
+
}
|
|
995
|
+
else {
|
|
996
|
+
result.answer = `No symbols found matching "${query.keywords.join(' ')}".`;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
findUsages(query, result) {
|
|
1000
|
+
for (const keyword of query.keywords) {
|
|
1001
|
+
const keywordLower = keyword.toLowerCase();
|
|
1002
|
+
// Find files that import this symbol
|
|
1003
|
+
for (const file of this.index.files) {
|
|
1004
|
+
// Check if file content mentions the keyword
|
|
1005
|
+
const fullPath = join(this.workingDir, file.path);
|
|
1006
|
+
try {
|
|
1007
|
+
const content = readFileSync(fullPath, 'utf-8');
|
|
1008
|
+
if (content.toLowerCase().includes(keywordLower)) {
|
|
1009
|
+
const lines = content.split('\n');
|
|
1010
|
+
const matchingLines = lines
|
|
1011
|
+
.map((line, i) => ({ line, num: i + 1 }))
|
|
1012
|
+
.filter(({ line }) => line.toLowerCase().includes(keywordLower))
|
|
1013
|
+
.slice(0, 3);
|
|
1014
|
+
result.files.push({
|
|
1015
|
+
path: file.path,
|
|
1016
|
+
relevance: matchingLines.length * 3,
|
|
1017
|
+
reason: `Used on line${matchingLines.length > 1 ? 's' : ''} ${matchingLines.map(l => l.num).join(', ')}`,
|
|
1018
|
+
snippets: matchingLines.map(l => l.line.trim()),
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
catch {
|
|
1023
|
+
// Skip unreadable files
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
result.files.sort((a, b) => b.relevance - a.relevance);
|
|
1028
|
+
result.files = result.files.slice(0, query.filters.limit || 10);
|
|
1029
|
+
if (result.files.length > 0) {
|
|
1030
|
+
result.answer = [
|
|
1031
|
+
`Found ${result.files.length} file(s) using "${query.keywords.join(' ')}":`,
|
|
1032
|
+
'',
|
|
1033
|
+
...result.files.slice(0, 5).map(f => `• **${f.path}** - ${f.reason}`),
|
|
1034
|
+
].join('\n');
|
|
1035
|
+
}
|
|
1036
|
+
else {
|
|
1037
|
+
result.answer = `No usages found for "${query.keywords.join(' ')}".`;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
explainArchitecture(_query, result) {
|
|
1041
|
+
const patterns = this.index.patterns;
|
|
1042
|
+
const lookup = this.index.quickLookup;
|
|
1043
|
+
const lines = [
|
|
1044
|
+
'# Architecture Overview',
|
|
1045
|
+
'',
|
|
1046
|
+
];
|
|
1047
|
+
if (patterns.architecture.length) {
|
|
1048
|
+
lines.push(`**Architectural Style:** ${patterns.architecture.join(', ')}`);
|
|
1049
|
+
lines.push('');
|
|
1050
|
+
}
|
|
1051
|
+
if (patterns.designPatterns.length) {
|
|
1052
|
+
lines.push(`**Design Patterns:** ${patterns.designPatterns.join(', ')}`);
|
|
1053
|
+
lines.push('');
|
|
1054
|
+
}
|
|
1055
|
+
lines.push('## Key Areas');
|
|
1056
|
+
lines.push('');
|
|
1057
|
+
if (lookup.entryPoints.length) {
|
|
1058
|
+
lines.push(`**Entry Points:** ${lookup.entryPoints.slice(0, 3).join(', ')}`);
|
|
1059
|
+
}
|
|
1060
|
+
if (lookup.componentFiles.length) {
|
|
1061
|
+
lines.push(`**Components:** ${lookup.componentFiles.length} files`);
|
|
1062
|
+
}
|
|
1063
|
+
if (lookup.routeFiles.length) {
|
|
1064
|
+
lines.push(`**Routes/API:** ${lookup.routeFiles.length} files`);
|
|
1065
|
+
}
|
|
1066
|
+
if (lookup.modelFiles.length) {
|
|
1067
|
+
lines.push(`**Models:** ${lookup.modelFiles.length} files`);
|
|
1068
|
+
}
|
|
1069
|
+
if (lookup.testFiles.length) {
|
|
1070
|
+
lines.push(`**Tests:** ${lookup.testFiles.length} files`);
|
|
1071
|
+
}
|
|
1072
|
+
if (patterns.namingConventions.length) {
|
|
1073
|
+
lines.push('');
|
|
1074
|
+
lines.push(`**Naming Conventions:** ${patterns.namingConventions.join(', ')}`);
|
|
1075
|
+
}
|
|
1076
|
+
result.answer = lines.join('\n');
|
|
1077
|
+
}
|
|
1078
|
+
showDependencies(query, result) {
|
|
1079
|
+
// Find the most relevant file
|
|
1080
|
+
const targetFile = query.keywords.length > 0
|
|
1081
|
+
? this.index.files.find(f => query.keywords.some(k => f.path.toLowerCase().includes(k.toLowerCase())))
|
|
1082
|
+
: this.index.quickLookup.entryPoints[0];
|
|
1083
|
+
if (!targetFile) {
|
|
1084
|
+
result.answer = 'Specify a file to show dependencies for.';
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
const filePath = typeof targetFile === 'string' ? targetFile : targetFile.path;
|
|
1088
|
+
const imports = this.index.imports.imports.get(filePath) || [];
|
|
1089
|
+
const importedBy = this.index.imports.importedBy.get(filePath) || [];
|
|
1090
|
+
const lines = [
|
|
1091
|
+
`# Dependencies for ${filePath}`,
|
|
1092
|
+
'',
|
|
1093
|
+
'## Imports (dependencies)',
|
|
1094
|
+
imports.length ? imports.map(i => `• ${i}`).join('\n') : 'No local imports',
|
|
1095
|
+
'',
|
|
1096
|
+
'## Imported by (dependents)',
|
|
1097
|
+
importedBy.length ? importedBy.map(i => `• ${i}`).join('\n') : 'Not imported by other files',
|
|
1098
|
+
];
|
|
1099
|
+
result.answer = lines.join('\n');
|
|
1100
|
+
}
|
|
1101
|
+
explainConcept(query, result) {
|
|
1102
|
+
// Combine file and symbol search for conceptual queries
|
|
1103
|
+
this.findFiles(query, result);
|
|
1104
|
+
this.findSymbols(query, result);
|
|
1105
|
+
// Enhanced answer
|
|
1106
|
+
const allMatches = result.files.length + result.symbols.length;
|
|
1107
|
+
if (allMatches > 0) {
|
|
1108
|
+
const parts = [
|
|
1109
|
+
`Found ${allMatches} relevant result(s) for "${query.keywords.join(' ')}":`,
|
|
1110
|
+
'',
|
|
1111
|
+
];
|
|
1112
|
+
if (result.symbols.length > 0) {
|
|
1113
|
+
parts.push('**Symbols:**');
|
|
1114
|
+
for (const s of result.symbols.slice(0, 3)) {
|
|
1115
|
+
parts.push(`• ${s.name} (${s.kind}) at ${s.file}:${s.line}`);
|
|
1116
|
+
}
|
|
1117
|
+
parts.push('');
|
|
1118
|
+
}
|
|
1119
|
+
if (result.files.length > 0) {
|
|
1120
|
+
parts.push('**Files:**');
|
|
1121
|
+
for (const f of result.files.slice(0, 3)) {
|
|
1122
|
+
parts.push(`• ${f.path} - ${f.reason}`);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
result.answer = parts.join('\n');
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
generalSearch(query, result) {
|
|
1129
|
+
// Combine all search methods
|
|
1130
|
+
this.findFiles(query, result);
|
|
1131
|
+
const fileMatches = [...result.files];
|
|
1132
|
+
result.files = [];
|
|
1133
|
+
this.findSymbols(query, result);
|
|
1134
|
+
const symbolMatches = [...result.symbols];
|
|
1135
|
+
// Merge results
|
|
1136
|
+
result.files = fileMatches;
|
|
1137
|
+
result.symbols = symbolMatches;
|
|
1138
|
+
// Generate combined answer
|
|
1139
|
+
const parts = [];
|
|
1140
|
+
if (symbolMatches.length > 0) {
|
|
1141
|
+
parts.push(`**Symbols (${symbolMatches.length}):**`);
|
|
1142
|
+
for (const s of symbolMatches.slice(0, 5)) {
|
|
1143
|
+
parts.push(` • ${s.name} (${s.kind}) → ${s.file}:${s.line}`);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (fileMatches.length > 0) {
|
|
1147
|
+
if (parts.length)
|
|
1148
|
+
parts.push('');
|
|
1149
|
+
parts.push(`**Files (${fileMatches.length}):**`);
|
|
1150
|
+
for (const f of fileMatches.slice(0, 5)) {
|
|
1151
|
+
parts.push(` • ${f.path} - ${f.reason}`);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
if (parts.length === 0) {
|
|
1155
|
+
result.answer = `No results found for "${query.keywords.join(' ')}". Try different terms.`;
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
result.answer = parts.join('\n');
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
generateSuggestions(query, result) {
|
|
1162
|
+
result.suggestions = [];
|
|
1163
|
+
if (result.files.length > 0) {
|
|
1164
|
+
result.suggestions.push(`Explore: ${result.files[0]?.path}`);
|
|
1165
|
+
}
|
|
1166
|
+
if (query.type === 'find_file' && result.files.length === 0) {
|
|
1167
|
+
result.suggestions.push('Try broader search terms');
|
|
1168
|
+
result.suggestions.push('Check the architecture overview: "show architecture"');
|
|
1169
|
+
}
|
|
1170
|
+
if (query.type === 'find_symbol') {
|
|
1171
|
+
result.suggestions.push('Find usages: "where is X used"');
|
|
1172
|
+
}
|
|
1173
|
+
// Suggest related queries based on patterns
|
|
1174
|
+
const patterns = this.index.patterns;
|
|
1175
|
+
if (patterns.designPatterns.length > 0) {
|
|
1176
|
+
result.suggestions.push(`Explore pattern: ${patterns.designPatterns[0]}`);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
export function createLocalExploreTool(workingDir, options) {
|
|
1181
|
+
const context = {
|
|
1182
|
+
aiEnhancer: options?.aiEnhancer,
|
|
1183
|
+
aiQueryParsing: options?.aiQueryParsing,
|
|
1184
|
+
aiSummarization: options?.aiSummarization,
|
|
1185
|
+
};
|
|
1186
|
+
const engine = new LocalExploreEngine(workingDir, context);
|
|
1187
|
+
let initialized = false;
|
|
1188
|
+
// Store reference for dynamic AI enhancer updates
|
|
1189
|
+
const toolState = { engine, context };
|
|
1190
|
+
return {
|
|
1191
|
+
name: 'explore',
|
|
1192
|
+
description: `Explore and understand the codebase using natural language queries.
|
|
1193
|
+
Works offline by default, but uses the active AI model for better results when available.
|
|
1194
|
+
|
|
1195
|
+
Example queries:
|
|
1196
|
+
- "Where is authentication handled?"
|
|
1197
|
+
- "Find the UserService class"
|
|
1198
|
+
- "Show architecture overview"
|
|
1199
|
+
- "What's in this repo?"
|
|
1200
|
+
- "Explain this project"
|
|
1201
|
+
- "Where is handleSubmit used?"
|
|
1202
|
+
- "What are the entry points?"
|
|
1203
|
+
- "Show dependencies for src/app.ts"
|
|
1204
|
+
|
|
1205
|
+
Returns file locations, symbol definitions, and explanations.`,
|
|
1206
|
+
parameters: {
|
|
1207
|
+
type: 'object',
|
|
1208
|
+
properties: {
|
|
1209
|
+
query: {
|
|
1210
|
+
type: 'string',
|
|
1211
|
+
description: 'Natural language query about the codebase',
|
|
1212
|
+
},
|
|
1213
|
+
rebuild: {
|
|
1214
|
+
type: 'boolean',
|
|
1215
|
+
description: 'Force rebuild of the codebase index (default: false)',
|
|
1216
|
+
},
|
|
1217
|
+
useAI: {
|
|
1218
|
+
type: 'boolean',
|
|
1219
|
+
description: 'Use AI for enhanced results (default: true if AI is available)',
|
|
1220
|
+
},
|
|
1221
|
+
mode: {
|
|
1222
|
+
type: 'string',
|
|
1223
|
+
enum: ['concise', 'detailed'],
|
|
1224
|
+
description: 'Output mode. Concise trims long lists for context safety (default).',
|
|
1225
|
+
},
|
|
1226
|
+
},
|
|
1227
|
+
required: ['query'],
|
|
1228
|
+
additionalProperties: false,
|
|
1229
|
+
},
|
|
1230
|
+
cacheable: false,
|
|
1231
|
+
// Expose engine for dynamic context updates
|
|
1232
|
+
_engine: toolState,
|
|
1233
|
+
handler: async (args) => {
|
|
1234
|
+
try {
|
|
1235
|
+
const query = args['query'];
|
|
1236
|
+
const rebuild = args['rebuild'] === true;
|
|
1237
|
+
const useAI = args['useAI'] !== false; // Default to true - AI is used by default
|
|
1238
|
+
const mode = args['mode'] === 'detailed' ? 'detailed' : 'concise';
|
|
1239
|
+
if (!query || !query.trim()) {
|
|
1240
|
+
return 'Error: query must be a non-empty string';
|
|
1241
|
+
}
|
|
1242
|
+
// Initialize on first use
|
|
1243
|
+
if (!initialized || rebuild) {
|
|
1244
|
+
const { rebuilt, fileCount } = await toolState.engine.initialize(rebuild);
|
|
1245
|
+
initialized = true;
|
|
1246
|
+
if (rebuilt) {
|
|
1247
|
+
const exploreResult = await toolState.engine.explore(query, { useAI });
|
|
1248
|
+
return `Indexed ${fileCount} files. Now exploring: "${query}"\n\n${exploreResult.answer}`;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
// Handle special queries
|
|
1252
|
+
if (query.toLowerCase() === 'overview' || query.toLowerCase() === 'help') {
|
|
1253
|
+
return toolState.engine.getOverview();
|
|
1254
|
+
}
|
|
1255
|
+
// Execute exploration (AI is used by default when available)
|
|
1256
|
+
const result = await toolState.engine.explore(query, { useAI });
|
|
1257
|
+
// Check if AI was actually available and used
|
|
1258
|
+
const aiAvailable = resolveAIEnhancer(toolState.context) !== undefined;
|
|
1259
|
+
return formatExploreOutput(result, {
|
|
1260
|
+
query,
|
|
1261
|
+
mode,
|
|
1262
|
+
aiUsed: aiAvailable && useAI,
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
catch (error) {
|
|
1266
|
+
return buildError('exploring codebase', error, { workingDir });
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Create all local exploration tools (explore + index management).
|
|
1273
|
+
*/
|
|
1274
|
+
export function createLocalExploreTools(workingDir, options) {
|
|
1275
|
+
return [
|
|
1276
|
+
createLocalExploreTool(workingDir, options),
|
|
1277
|
+
createIndexTool(workingDir, options),
|
|
1278
|
+
];
|
|
1279
|
+
}
|
|
1280
|
+
function createIndexTool(workingDir, options) {
|
|
1281
|
+
const context = {
|
|
1282
|
+
aiEnhancer: options?.aiEnhancer,
|
|
1283
|
+
};
|
|
1284
|
+
const engine = new LocalExploreEngine(workingDir, context);
|
|
1285
|
+
return {
|
|
1286
|
+
name: 'explore_index',
|
|
1287
|
+
description: 'Manage the codebase index for exploration. Use action "rebuild" to force re-index, "status" to check index state.',
|
|
1288
|
+
parameters: {
|
|
1289
|
+
type: 'object',
|
|
1290
|
+
properties: {
|
|
1291
|
+
action: {
|
|
1292
|
+
type: 'string',
|
|
1293
|
+
enum: ['rebuild', 'status'],
|
|
1294
|
+
description: 'Action to perform on the index',
|
|
1295
|
+
},
|
|
1296
|
+
},
|
|
1297
|
+
required: ['action'],
|
|
1298
|
+
additionalProperties: false,
|
|
1299
|
+
},
|
|
1300
|
+
cacheable: false,
|
|
1301
|
+
handler: async (args) => {
|
|
1302
|
+
try {
|
|
1303
|
+
const action = args['action'];
|
|
1304
|
+
if (action === 'rebuild') {
|
|
1305
|
+
const { fileCount } = await engine.initialize(true);
|
|
1306
|
+
return `✓ Rebuilt codebase index: ${fileCount} files analyzed`;
|
|
1307
|
+
}
|
|
1308
|
+
if (action === 'status') {
|
|
1309
|
+
const { rebuilt, fileCount } = await engine.initialize(false);
|
|
1310
|
+
return rebuilt
|
|
1311
|
+
? `Built new index: ${fileCount} files`
|
|
1312
|
+
: `Using cached index: ${fileCount} files`;
|
|
1313
|
+
}
|
|
1314
|
+
return 'Unknown action. Use "rebuild" or "status".';
|
|
1315
|
+
}
|
|
1316
|
+
catch (error) {
|
|
1317
|
+
return buildError('managing index', error, { workingDir });
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
function formatExploreOutput(result, options) {
|
|
1323
|
+
const { query, mode, aiUsed } = options;
|
|
1324
|
+
const lines = [];
|
|
1325
|
+
if (mode === 'concise') {
|
|
1326
|
+
const answer = clampText(result.answer, 1200);
|
|
1327
|
+
lines.push(answer);
|
|
1328
|
+
const topFiles = result.files.slice(0, 4);
|
|
1329
|
+
const topSymbols = result.symbols.slice(0, 3);
|
|
1330
|
+
if (topFiles.length || topSymbols.length) {
|
|
1331
|
+
lines.push('');
|
|
1332
|
+
lines.push(`Files: ${result.files.length}${result.files.length > topFiles.length ? ` (showing ${topFiles.length})` : ''}`);
|
|
1333
|
+
for (const f of topFiles) {
|
|
1334
|
+
lines.push(`• ${f.path}${f.reason ? ` — ${f.reason}` : ''}`);
|
|
1335
|
+
}
|
|
1336
|
+
if (topSymbols.length) {
|
|
1337
|
+
lines.push('');
|
|
1338
|
+
lines.push(`Symbols: ${result.symbols.length}${result.symbols.length > topSymbols.length ? ` (showing ${topSymbols.length})` : ''}`);
|
|
1339
|
+
for (const s of topSymbols) {
|
|
1340
|
+
lines.push(`• ${s.name} (${s.kind}) → ${s.file}:${s.line}`);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
else {
|
|
1346
|
+
lines.push(result.answer);
|
|
1347
|
+
}
|
|
1348
|
+
if (result.suggestions.length > 0 && (mode === 'detailed' || result.files.length + result.symbols.length < 3)) {
|
|
1349
|
+
lines.push('');
|
|
1350
|
+
lines.push('**Suggestions:**');
|
|
1351
|
+
for (const s of result.suggestions.slice(0, 3)) {
|
|
1352
|
+
lines.push(`• ${s}`);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
lines.push('');
|
|
1356
|
+
lines.push(`_Query: "${query}" | Type: ${result.queryType} | Time: ${result.timeTaken}ms${aiUsed ? ' | AI' : ''}_`);
|
|
1357
|
+
return clampText(lines.join('\n'), mode === 'concise' ? 2200 : 3200);
|
|
1358
|
+
}
|
|
1359
|
+
function clampText(text, maxLength) {
|
|
1360
|
+
if (text.length <= maxLength)
|
|
1361
|
+
return text;
|
|
1362
|
+
const slice = text.slice(0, Math.max(0, maxLength - 60));
|
|
1363
|
+
return `${slice}\n... (truncated for brevity)`;
|
|
1364
|
+
}
|
|
1365
|
+
//# sourceMappingURL=localExplore.js.map
|