@dotcontext/mcp 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +27 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/generators/agents/agentConfig.d.ts +4 -0
- package/dist/generators/agents/agentConfig.d.ts.map +1 -0
- package/dist/generators/agents/agentConfig.js +180 -0
- package/dist/generators/agents/agentConfig.js.map +1 -0
- package/dist/generators/agents/agentGenerator.d.ts +36 -0
- package/dist/generators/agents/agentGenerator.d.ts.map +1 -0
- package/dist/generators/agents/agentGenerator.js +304 -0
- package/dist/generators/agents/agentGenerator.js.map +1 -0
- package/dist/generators/agents/agentTypes.d.ts +4 -0
- package/dist/generators/agents/agentTypes.d.ts.map +1 -0
- package/dist/generators/agents/agentTypes.js +25 -0
- package/dist/generators/agents/agentTypes.js.map +1 -0
- package/dist/generators/agents/index.d.ts +4 -0
- package/dist/generators/agents/index.d.ts.map +1 -0
- package/dist/generators/agents/index.js +12 -0
- package/dist/generators/agents/index.js.map +1 -0
- package/dist/generators/agents/templates/index.d.ts +3 -0
- package/dist/generators/agents/templates/index.d.ts.map +1 -0
- package/dist/generators/agents/templates/index.js +6 -0
- package/dist/generators/agents/templates/index.js.map +1 -0
- package/dist/generators/agents/templates/indexTemplate.d.ts +3 -0
- package/dist/generators/agents/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/agents/templates/indexTemplate.js +36 -0
- package/dist/generators/agents/templates/indexTemplate.js.map +1 -0
- package/dist/generators/agents/templates/types.d.ts +22 -0
- package/dist/generators/agents/templates/types.d.ts.map +1 -0
- package/dist/generators/agents/templates/types.js +3 -0
- package/dist/generators/agents/templates/types.js.map +1 -0
- package/dist/generators/documentation/codebaseMapGenerator.d.ts +126 -0
- package/dist/generators/documentation/codebaseMapGenerator.d.ts.map +1 -0
- package/dist/generators/documentation/codebaseMapGenerator.js +570 -0
- package/dist/generators/documentation/codebaseMapGenerator.js.map +1 -0
- package/dist/generators/documentation/documentationGenerator.d.ts +22 -0
- package/dist/generators/documentation/documentationGenerator.d.ts.map +1 -0
- package/dist/generators/documentation/documentationGenerator.js +268 -0
- package/dist/generators/documentation/documentationGenerator.js.map +1 -0
- package/dist/generators/documentation/guideRegistry.d.ts +6 -0
- package/dist/generators/documentation/guideRegistry.d.ts.map +1 -0
- package/dist/generators/documentation/guideRegistry.js +74 -0
- package/dist/generators/documentation/guideRegistry.js.map +1 -0
- package/dist/generators/documentation/index.d.ts +4 -0
- package/dist/generators/documentation/index.d.ts.map +1 -0
- package/dist/generators/documentation/index.js +8 -0
- package/dist/generators/documentation/index.js.map +1 -0
- package/dist/generators/documentation/templates/common.d.ts +42 -0
- package/dist/generators/documentation/templates/common.d.ts.map +1 -0
- package/dist/generators/documentation/templates/common.js +194 -0
- package/dist/generators/documentation/templates/common.js.map +1 -0
- package/dist/generators/documentation/templates/index.d.ts +3 -0
- package/dist/generators/documentation/templates/index.d.ts.map +1 -0
- package/dist/generators/documentation/templates/index.js +6 -0
- package/dist/generators/documentation/templates/index.js.map +1 -0
- package/dist/generators/documentation/templates/indexTemplate.d.ts +3 -0
- package/dist/generators/documentation/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/indexTemplate.js +25 -0
- package/dist/generators/documentation/templates/indexTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/types.d.ts +24 -0
- package/dist/generators/documentation/templates/types.d.ts.map +1 -0
- package/dist/generators/documentation/templates/types.js +3 -0
- package/dist/generators/documentation/templates/types.js.map +1 -0
- package/dist/generators/plans/index.d.ts +2 -0
- package/dist/generators/plans/index.d.ts.map +1 -0
- package/dist/generators/plans/index.js +6 -0
- package/dist/generators/plans/index.js.map +1 -0
- package/dist/generators/plans/planGenerator.d.ts +26 -0
- package/dist/generators/plans/planGenerator.d.ts.map +1 -0
- package/dist/generators/plans/planGenerator.js +137 -0
- package/dist/generators/plans/planGenerator.js.map +1 -0
- package/dist/generators/plans/templates/indexTemplate.d.ts +3 -0
- package/dist/generators/plans/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/plans/templates/indexTemplate.js +28 -0
- package/dist/generators/plans/templates/indexTemplate.js.map +1 -0
- package/dist/generators/plans/templates/planTemplate.d.ts +14 -0
- package/dist/generators/plans/templates/planTemplate.d.ts.map +1 -0
- package/dist/generators/plans/templates/planTemplate.js +270 -0
- package/dist/generators/plans/templates/planTemplate.js.map +1 -0
- package/dist/generators/plans/templates/types.d.ts +29 -0
- package/dist/generators/plans/templates/types.d.ts.map +1 -0
- package/dist/generators/plans/templates/types.js +3 -0
- package/dist/generators/plans/templates/types.js.map +1 -0
- package/dist/generators/shared/contextGenerator.d.ts +7 -0
- package/dist/generators/shared/contextGenerator.d.ts.map +1 -0
- package/dist/generators/shared/contextGenerator.js +13 -0
- package/dist/generators/shared/contextGenerator.js.map +1 -0
- package/dist/generators/shared/directoryTemplateHelpers.d.ts +2 -0
- package/dist/generators/shared/directoryTemplateHelpers.d.ts.map +1 -0
- package/dist/generators/shared/directoryTemplateHelpers.js +12 -0
- package/dist/generators/shared/directoryTemplateHelpers.js.map +1 -0
- package/dist/generators/shared/generatorUtils.d.ts +16 -0
- package/dist/generators/shared/generatorUtils.d.ts.map +1 -0
- package/dist/generators/shared/generatorUtils.js +116 -0
- package/dist/generators/shared/generatorUtils.js.map +1 -0
- package/dist/generators/shared/index.d.ts +5 -0
- package/dist/generators/shared/index.d.ts.map +1 -0
- package/dist/generators/shared/index.js +26 -0
- package/dist/generators/shared/index.js.map +1 -0
- package/dist/generators/shared/scaffoldStructures.d.ts +13 -0
- package/dist/generators/shared/scaffoldStructures.d.ts.map +1 -0
- package/dist/generators/shared/scaffoldStructures.js +30 -0
- package/dist/generators/shared/scaffoldStructures.js.map +1 -0
- package/dist/generators/shared/structures/agents/definitions.d.ts +18 -0
- package/dist/generators/shared/structures/agents/definitions.d.ts.map +1 -0
- package/dist/generators/shared/structures/agents/definitions.js +561 -0
- package/dist/generators/shared/structures/agents/definitions.js.map +1 -0
- package/dist/generators/shared/structures/agents/factory.d.ts +25 -0
- package/dist/generators/shared/structures/agents/factory.d.ts.map +1 -0
- package/dist/generators/shared/structures/agents/factory.js +138 -0
- package/dist/generators/shared/structures/agents/factory.js.map +1 -0
- package/dist/generators/shared/structures/agents/index.d.ts +6 -0
- package/dist/generators/shared/structures/agents/index.d.ts.map +1 -0
- package/dist/generators/shared/structures/agents/index.js +24 -0
- package/dist/generators/shared/structures/agents/index.js.map +1 -0
- package/dist/generators/shared/structures/documentation/apiReference.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/apiReference.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/apiReference.js +100 -0
- package/dist/generators/shared/structures/documentation/apiReference.js.map +1 -0
- package/dist/generators/shared/structures/documentation/architecture.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/architecture.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/architecture.js +176 -0
- package/dist/generators/shared/structures/documentation/architecture.js.map +1 -0
- package/dist/generators/shared/structures/documentation/dataFlow.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/dataFlow.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/dataFlow.js +107 -0
- package/dist/generators/shared/structures/documentation/dataFlow.js.map +1 -0
- package/dist/generators/shared/structures/documentation/glossary.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/glossary.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/glossary.js +91 -0
- package/dist/generators/shared/structures/documentation/glossary.js.map +1 -0
- package/dist/generators/shared/structures/documentation/index.d.ts +16 -0
- package/dist/generators/shared/structures/documentation/index.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/index.js +31 -0
- package/dist/generators/shared/structures/documentation/index.js.map +1 -0
- package/dist/generators/shared/structures/documentation/migration.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/migration.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/migration.js +113 -0
- package/dist/generators/shared/structures/documentation/migration.js.map +1 -0
- package/dist/generators/shared/structures/documentation/onboarding.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/onboarding.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/onboarding.js +99 -0
- package/dist/generators/shared/structures/documentation/onboarding.js.map +1 -0
- package/dist/generators/shared/structures/documentation/projectOverview.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/projectOverview.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/projectOverview.js +162 -0
- package/dist/generators/shared/structures/documentation/projectOverview.js.map +1 -0
- package/dist/generators/shared/structures/documentation/security.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/security.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/security.js +100 -0
- package/dist/generators/shared/structures/documentation/security.js.map +1 -0
- package/dist/generators/shared/structures/documentation/testing.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/testing.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/testing.js +130 -0
- package/dist/generators/shared/structures/documentation/testing.js.map +1 -0
- package/dist/generators/shared/structures/documentation/tooling.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/tooling.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/tooling.js +114 -0
- package/dist/generators/shared/structures/documentation/tooling.js.map +1 -0
- package/dist/generators/shared/structures/documentation/troubleshooting.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/troubleshooting.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/troubleshooting.js +91 -0
- package/dist/generators/shared/structures/documentation/troubleshooting.js.map +1 -0
- package/dist/generators/shared/structures/documentation/workflow.d.ts +3 -0
- package/dist/generators/shared/structures/documentation/workflow.d.ts.map +1 -0
- package/dist/generators/shared/structures/documentation/workflow.js +116 -0
- package/dist/generators/shared/structures/documentation/workflow.js.map +1 -0
- package/dist/generators/shared/structures/index.d.ts +15 -0
- package/dist/generators/shared/structures/index.d.ts.map +1 -0
- package/dist/generators/shared/structures/index.js +37 -0
- package/dist/generators/shared/structures/index.js.map +1 -0
- package/dist/generators/shared/structures/plans/index.d.ts +5 -0
- package/dist/generators/shared/structures/plans/index.d.ts.map +1 -0
- package/dist/generators/shared/structures/plans/index.js +9 -0
- package/dist/generators/shared/structures/plans/index.js.map +1 -0
- package/dist/generators/shared/structures/plans/planStructure.d.ts +6 -0
- package/dist/generators/shared/structures/plans/planStructure.d.ts.map +1 -0
- package/dist/generators/shared/structures/plans/planStructure.js +65 -0
- package/dist/generators/shared/structures/plans/planStructure.js.map +1 -0
- package/dist/generators/shared/structures/registry.d.ts +18 -0
- package/dist/generators/shared/structures/registry.d.ts.map +1 -0
- package/dist/generators/shared/structures/registry.js +104 -0
- package/dist/generators/shared/structures/registry.js.map +1 -0
- package/dist/generators/shared/structures/serialization.d.ts +15 -0
- package/dist/generators/shared/structures/serialization.d.ts.map +1 -0
- package/dist/generators/shared/structures/serialization.js +124 -0
- package/dist/generators/shared/structures/serialization.js.map +1 -0
- package/dist/generators/shared/structures/skills/definitions.d.ts +25 -0
- package/dist/generators/shared/structures/skills/definitions.d.ts.map +1 -0
- package/dist/generators/shared/structures/skills/definitions.js +427 -0
- package/dist/generators/shared/structures/skills/definitions.js.map +1 -0
- package/dist/generators/shared/structures/skills/factory.d.ts +18 -0
- package/dist/generators/shared/structures/skills/factory.d.ts.map +1 -0
- package/dist/generators/shared/structures/skills/factory.js +79 -0
- package/dist/generators/shared/structures/skills/factory.js.map +1 -0
- package/dist/generators/shared/structures/skills/index.d.ts +6 -0
- package/dist/generators/shared/structures/skills/index.d.ts.map +1 -0
- package/dist/generators/shared/structures/skills/index.js +30 -0
- package/dist/generators/shared/structures/skills/index.js.map +1 -0
- package/dist/generators/shared/structures/types.d.ts +61 -0
- package/dist/generators/shared/structures/types.d.ts.map +1 -0
- package/dist/generators/shared/structures/types.js +6 -0
- package/dist/generators/shared/structures/types.js.map +1 -0
- package/dist/generators/shared/structures/validation.d.ts +13 -0
- package/dist/generators/shared/structures/validation.d.ts.map +1 -0
- package/dist/generators/shared/structures/validation.js +51 -0
- package/dist/generators/shared/structures/validation.js.map +1 -0
- package/dist/generators/skills/index.d.ts +7 -0
- package/dist/generators/skills/index.d.ts.map +1 -0
- package/dist/generators/skills/index.js +15 -0
- package/dist/generators/skills/index.js.map +1 -0
- package/dist/generators/skills/skillGenerator.d.ts +59 -0
- package/dist/generators/skills/skillGenerator.d.ts.map +1 -0
- package/dist/generators/skills/skillGenerator.js +199 -0
- package/dist/generators/skills/skillGenerator.js.map +1 -0
- package/dist/generators/skills/templates/indexTemplate.d.ts +13 -0
- package/dist/generators/skills/templates/indexTemplate.d.ts.map +1 -0
- package/dist/generators/skills/templates/indexTemplate.js +109 -0
- package/dist/generators/skills/templates/indexTemplate.js.map +1 -0
- package/dist/generators/skills/templates/skillTemplate.d.ts +30 -0
- package/dist/generators/skills/templates/skillTemplate.d.ts.map +1 -0
- package/dist/generators/skills/templates/skillTemplate.js +95 -0
- package/dist/generators/skills/templates/skillTemplate.js.map +1 -0
- package/dist/harness/index.d.ts +11 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +33 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1205 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/bin.d.ts +19 -0
- package/dist/mcp/bin.d.ts.map +1 -0
- package/dist/mcp/bin.js +189 -0
- package/dist/mcp/bin.js.map +1 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +28 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/prompts/defaults.d.ts +8 -0
- package/dist/prompts/defaults.d.ts.map +1 -0
- package/dist/prompts/defaults.js +108 -0
- package/dist/prompts/defaults.js.map +1 -0
- package/dist/services/autoFill/autoFillService.d.ts +52 -0
- package/dist/services/autoFill/autoFillService.d.ts.map +1 -0
- package/dist/services/autoFill/autoFillService.js +474 -0
- package/dist/services/autoFill/autoFillService.js.map +1 -0
- package/dist/services/autoFill/index.d.ts +2 -0
- package/dist/services/autoFill/index.d.ts.map +1 -0
- package/dist/services/autoFill/index.js +6 -0
- package/dist/services/autoFill/index.js.map +1 -0
- package/dist/services/cli/index.d.ts +8 -0
- package/dist/services/cli/index.d.ts.map +1 -0
- package/dist/services/cli/index.js +17 -0
- package/dist/services/cli/index.js.map +1 -0
- package/dist/services/cli/mcpInstallService.d.ts +57 -0
- package/dist/services/cli/mcpInstallService.d.ts.map +1 -0
- package/dist/services/cli/mcpInstallService.js +607 -0
- package/dist/services/cli/mcpInstallService.js.map +1 -0
- package/dist/services/cli/stateDetector.d.ts +55 -0
- package/dist/services/cli/stateDetector.d.ts.map +1 -0
- package/dist/services/cli/stateDetector.js +191 -0
- package/dist/services/cli/stateDetector.js.map +1 -0
- package/dist/services/export/contextExportService.d.ts +45 -0
- package/dist/services/export/contextExportService.d.ts.map +1 -0
- package/dist/services/export/contextExportService.js +161 -0
- package/dist/services/export/contextExportService.js.map +1 -0
- package/dist/services/export/exportRulesService.d.ts +77 -0
- package/dist/services/export/exportRulesService.d.ts.map +1 -0
- package/dist/services/export/exportRulesService.js +318 -0
- package/dist/services/export/exportRulesService.js.map +1 -0
- package/dist/services/export/index.d.ts +7 -0
- package/dist/services/export/index.d.ts.map +1 -0
- package/dist/services/export/index.js +12 -0
- package/dist/services/export/index.js.map +1 -0
- package/dist/services/export/skillExportService.d.ts +69 -0
- package/dist/services/export/skillExportService.d.ts.map +1 -0
- package/dist/services/export/skillExportService.js +265 -0
- package/dist/services/export/skillExportService.js.map +1 -0
- package/dist/services/harness/agentsService.d.ts +31 -0
- package/dist/services/harness/agentsService.d.ts.map +1 -0
- package/dist/services/harness/agentsService.js +135 -0
- package/dist/services/harness/agentsService.js.map +1 -0
- package/dist/services/harness/contextService.d.ts +167 -0
- package/dist/services/harness/contextService.d.ts.map +1 -0
- package/dist/services/harness/contextService.js +403 -0
- package/dist/services/harness/contextService.js.map +1 -0
- package/dist/services/harness/contextTools.d.ts +95 -0
- package/dist/services/harness/contextTools.d.ts.map +1 -0
- package/dist/services/harness/contextTools.js +990 -0
- package/dist/services/harness/contextTools.js.map +1 -0
- package/dist/services/harness/datasetService.d.ts +63 -0
- package/dist/services/harness/datasetService.d.ts.map +1 -0
- package/dist/services/harness/datasetService.js +261 -0
- package/dist/services/harness/datasetService.js.map +1 -0
- package/dist/services/harness/executionService.d.ts +74 -0
- package/dist/services/harness/executionService.d.ts.map +1 -0
- package/dist/services/harness/executionService.js +213 -0
- package/dist/services/harness/executionService.js.map +1 -0
- package/dist/services/harness/index.d.ts +21 -0
- package/dist/services/harness/index.d.ts.map +1 -0
- package/dist/services/harness/index.js +52 -0
- package/dist/services/harness/index.js.map +1 -0
- package/dist/services/harness/plansService.d.ts +45 -0
- package/dist/services/harness/plansService.d.ts.map +1 -0
- package/dist/services/harness/plansService.js +251 -0
- package/dist/services/harness/plansService.js.map +1 -0
- package/dist/services/harness/policyService.d.ts +116 -0
- package/dist/services/harness/policyService.d.ts.map +1 -0
- package/dist/services/harness/policyService.js +510 -0
- package/dist/services/harness/policyService.js.map +1 -0
- package/dist/services/harness/replayService.d.ts +63 -0
- package/dist/services/harness/replayService.d.ts.map +1 -0
- package/dist/services/harness/replayService.js +242 -0
- package/dist/services/harness/replayService.js.map +1 -0
- package/dist/services/harness/runtimeStateService.d.ts +120 -0
- package/dist/services/harness/runtimeStateService.d.ts.map +1 -0
- package/dist/services/harness/runtimeStateService.js +316 -0
- package/dist/services/harness/runtimeStateService.js.map +1 -0
- package/dist/services/harness/sensorCatalogService.d.ts +50 -0
- package/dist/services/harness/sensorCatalogService.d.ts.map +1 -0
- package/dist/services/harness/sensorCatalogService.js +308 -0
- package/dist/services/harness/sensorCatalogService.js.map +1 -0
- package/dist/services/harness/sensorsService.d.ts +64 -0
- package/dist/services/harness/sensorsService.d.ts.map +1 -0
- package/dist/services/harness/sensorsService.js +88 -0
- package/dist/services/harness/sensorsService.js.map +1 -0
- package/dist/services/harness/skillsService.d.ts +31 -0
- package/dist/services/harness/skillsService.d.ts.map +1 -0
- package/dist/services/harness/skillsService.js +296 -0
- package/dist/services/harness/skillsService.js.map +1 -0
- package/dist/services/harness/taskContractsService.d.ts +88 -0
- package/dist/services/harness/taskContractsService.d.ts.map +1 -0
- package/dist/services/harness/taskContractsService.js +210 -0
- package/dist/services/harness/taskContractsService.js.map +1 -0
- package/dist/services/harness/workflowStateService.d.ts +51 -0
- package/dist/services/harness/workflowStateService.d.ts.map +1 -0
- package/dist/services/harness/workflowStateService.js +215 -0
- package/dist/services/harness/workflowStateService.js.map +1 -0
- package/dist/services/import/agentsDetector.d.ts +12 -0
- package/dist/services/import/agentsDetector.d.ts.map +1 -0
- package/dist/services/import/agentsDetector.js +189 -0
- package/dist/services/import/agentsDetector.js.map +1 -0
- package/dist/services/import/importAgentsService.d.ts +14 -0
- package/dist/services/import/importAgentsService.d.ts.map +1 -0
- package/dist/services/import/importAgentsService.js +201 -0
- package/dist/services/import/importAgentsService.js.map +1 -0
- package/dist/services/import/importRulesService.d.ts +17 -0
- package/dist/services/import/importRulesService.d.ts.map +1 -0
- package/dist/services/import/importRulesService.js +228 -0
- package/dist/services/import/importRulesService.js.map +1 -0
- package/dist/services/import/index.d.ts +7 -0
- package/dist/services/import/index.d.ts.map +1 -0
- package/dist/services/import/index.js +28 -0
- package/dist/services/import/index.js.map +1 -0
- package/dist/services/import/presets.d.ts +20 -0
- package/dist/services/import/presets.d.ts.map +1 -0
- package/dist/services/import/presets.js +56 -0
- package/dist/services/import/presets.js.map +1 -0
- package/dist/services/import/rulesDetector.d.ts +16 -0
- package/dist/services/import/rulesDetector.d.ts.map +1 -0
- package/dist/services/import/rulesDetector.js +293 -0
- package/dist/services/import/rulesDetector.js.map +1 -0
- package/dist/services/import/types.d.ts +72 -0
- package/dist/services/import/types.d.ts.map +1 -0
- package/dist/services/import/types.js +3 -0
- package/dist/services/import/types.js.map +1 -0
- package/dist/services/mcp/actionLogger.d.ts +20 -0
- package/dist/services/mcp/actionLogger.d.ts.map +1 -0
- package/dist/services/mcp/actionLogger.js +189 -0
- package/dist/services/mcp/actionLogger.js.map +1 -0
- package/dist/services/mcp/gateway/agent.d.ts +17 -0
- package/dist/services/mcp/gateway/agent.d.ts.map +1 -0
- package/dist/services/mcp/gateway/agent.js +58 -0
- package/dist/services/mcp/gateway/agent.js.map +1 -0
- package/dist/services/mcp/gateway/context.d.ts +21 -0
- package/dist/services/mcp/gateway/context.d.ts.map +1 -0
- package/dist/services/mcp/gateway/context.js +137 -0
- package/dist/services/mcp/gateway/context.js.map +1 -0
- package/dist/services/mcp/gateway/explore.d.ts +16 -0
- package/dist/services/mcp/gateway/explore.d.ts.map +1 -0
- package/dist/services/mcp/gateway/explore.js +60 -0
- package/dist/services/mcp/gateway/explore.js.map +1 -0
- package/dist/services/mcp/gateway/harness.d.ts +7 -0
- package/dist/services/mcp/gateway/harness.d.ts.map +1 -0
- package/dist/services/mcp/gateway/harness.js +337 -0
- package/dist/services/mcp/gateway/harness.js.map +1 -0
- package/dist/services/mcp/gateway/index.d.ts +25 -0
- package/dist/services/mcp/gateway/index.d.ts.map +1 -0
- package/dist/services/mcp/gateway/index.js +55 -0
- package/dist/services/mcp/gateway/index.js.map +1 -0
- package/dist/services/mcp/gateway/metrics.d.ts +56 -0
- package/dist/services/mcp/gateway/metrics.d.ts.map +1 -0
- package/dist/services/mcp/gateway/metrics.js +153 -0
- package/dist/services/mcp/gateway/metrics.js.map +1 -0
- package/dist/services/mcp/gateway/plan.d.ts +18 -0
- package/dist/services/mcp/gateway/plan.d.ts.map +1 -0
- package/dist/services/mcp/gateway/plan.js +85 -0
- package/dist/services/mcp/gateway/plan.js.map +1 -0
- package/dist/services/mcp/gateway/response.d.ts +45 -0
- package/dist/services/mcp/gateway/response.d.ts.map +1 -0
- package/dist/services/mcp/gateway/response.js +111 -0
- package/dist/services/mcp/gateway/response.js.map +1 -0
- package/dist/services/mcp/gateway/shared.d.ts +7 -0
- package/dist/services/mcp/gateway/shared.d.ts.map +1 -0
- package/dist/services/mcp/gateway/shared.js +13 -0
- package/dist/services/mcp/gateway/shared.js.map +1 -0
- package/dist/services/mcp/gateway/skill.d.ts +17 -0
- package/dist/services/mcp/gateway/skill.d.ts.map +1 -0
- package/dist/services/mcp/gateway/skill.js +56 -0
- package/dist/services/mcp/gateway/skill.js.map +1 -0
- package/dist/services/mcp/gateway/sync.d.ts +17 -0
- package/dist/services/mcp/gateway/sync.d.ts.map +1 -0
- package/dist/services/mcp/gateway/sync.js +219 -0
- package/dist/services/mcp/gateway/sync.js.map +1 -0
- package/dist/services/mcp/gateway/types.d.ts +187 -0
- package/dist/services/mcp/gateway/types.d.ts.map +1 -0
- package/dist/services/mcp/gateway/types.js +12 -0
- package/dist/services/mcp/gateway/types.js.map +1 -0
- package/dist/services/mcp/gateway/workflowAdvance.d.ts +25 -0
- package/dist/services/mcp/gateway/workflowAdvance.d.ts.map +1 -0
- package/dist/services/mcp/gateway/workflowAdvance.js +161 -0
- package/dist/services/mcp/gateway/workflowAdvance.js.map +1 -0
- package/dist/services/mcp/gateway/workflowInit.d.ts +28 -0
- package/dist/services/mcp/gateway/workflowInit.d.ts.map +1 -0
- package/dist/services/mcp/gateway/workflowInit.js +219 -0
- package/dist/services/mcp/gateway/workflowInit.js.map +1 -0
- package/dist/services/mcp/gateway/workflowManage.d.ts +47 -0
- package/dist/services/mcp/gateway/workflowManage.d.ts.map +1 -0
- package/dist/services/mcp/gateway/workflowManage.js +367 -0
- package/dist/services/mcp/gateway/workflowManage.js.map +1 -0
- package/dist/services/mcp/gateway/workflowStatus.d.ts +17 -0
- package/dist/services/mcp/gateway/workflowStatus.d.ts.map +1 -0
- package/dist/services/mcp/gateway/workflowStatus.js +93 -0
- package/dist/services/mcp/gateway/workflowStatus.js.map +1 -0
- package/dist/services/mcp/gatewayTools.d.ts +15 -0
- package/dist/services/mcp/gatewayTools.d.ts.map +1 -0
- package/dist/services/mcp/gatewayTools.js +39 -0
- package/dist/services/mcp/gatewayTools.js.map +1 -0
- package/dist/services/mcp/index.d.ts +15 -0
- package/dist/services/mcp/index.d.ts.map +1 -0
- package/dist/services/mcp/index.js +34 -0
- package/dist/services/mcp/index.js.map +1 -0
- package/dist/services/mcp/mcpInstallService.d.ts +8 -0
- package/dist/services/mcp/mcpInstallService.d.ts.map +1 -0
- package/dist/services/mcp/mcpInstallService.js +12 -0
- package/dist/services/mcp/mcpInstallService.js.map +1 -0
- package/dist/services/mcp/mcpServer.d.ts +100 -0
- package/dist/services/mcp/mcpServer.d.ts.map +1 -0
- package/dist/services/mcp/mcpServer.js +1036 -0
- package/dist/services/mcp/mcpServer.js.map +1 -0
- package/dist/services/qa/index.d.ts +9 -0
- package/dist/services/qa/index.d.ts.map +1 -0
- package/dist/services/qa/index.js +15 -0
- package/dist/services/qa/index.js.map +1 -0
- package/dist/services/qa/patternInferer.d.ts +12 -0
- package/dist/services/qa/patternInferer.d.ts.map +1 -0
- package/dist/services/qa/patternInferer.js +17 -0
- package/dist/services/qa/patternInferer.js.map +1 -0
- package/dist/services/qa/qaService.d.ts +103 -0
- package/dist/services/qa/qaService.d.ts.map +1 -0
- package/dist/services/qa/qaService.js +838 -0
- package/dist/services/qa/qaService.js.map +1 -0
- package/dist/services/qa/topicDetector.d.ts +54 -0
- package/dist/services/qa/topicDetector.d.ts.map +1 -0
- package/dist/services/qa/topicDetector.js +306 -0
- package/dist/services/qa/topicDetector.js.map +1 -0
- package/dist/services/quickSync/index.d.ts +3 -0
- package/dist/services/quickSync/index.d.ts.map +1 -0
- package/dist/services/quickSync/index.js +7 -0
- package/dist/services/quickSync/index.js.map +1 -0
- package/dist/services/quickSync/quickSyncService.d.ts +70 -0
- package/dist/services/quickSync/quickSyncService.d.ts.map +1 -0
- package/dist/services/quickSync/quickSyncService.js +263 -0
- package/dist/services/quickSync/quickSyncService.js.map +1 -0
- package/dist/services/report/index.d.ts +3 -0
- package/dist/services/report/index.d.ts.map +1 -0
- package/dist/services/report/index.js +6 -0
- package/dist/services/report/index.js.map +1 -0
- package/dist/services/report/reportService.d.ts +131 -0
- package/dist/services/report/reportService.d.ts.map +1 -0
- package/dist/services/report/reportService.js +372 -0
- package/dist/services/report/reportService.js.map +1 -0
- package/dist/services/reverseSync/importSkillsService.d.ts +47 -0
- package/dist/services/reverseSync/importSkillsService.d.ts.map +1 -0
- package/dist/services/reverseSync/importSkillsService.js +365 -0
- package/dist/services/reverseSync/importSkillsService.js.map +1 -0
- package/dist/services/reverseSync/index.d.ts +12 -0
- package/dist/services/reverseSync/index.d.ts.map +1 -0
- package/dist/services/reverseSync/index.js +49 -0
- package/dist/services/reverseSync/index.js.map +1 -0
- package/dist/services/reverseSync/presets.d.ts +51 -0
- package/dist/services/reverseSync/presets.d.ts.map +1 -0
- package/dist/services/reverseSync/presets.js +77 -0
- package/dist/services/reverseSync/presets.js.map +1 -0
- package/dist/services/reverseSync/reverseQuickSyncService.d.ts +37 -0
- package/dist/services/reverseSync/reverseQuickSyncService.d.ts.map +1 -0
- package/dist/services/reverseSync/reverseQuickSyncService.js +269 -0
- package/dist/services/reverseSync/reverseQuickSyncService.js.map +1 -0
- package/dist/services/reverseSync/skillsDetector.d.ts +36 -0
- package/dist/services/reverseSync/skillsDetector.d.ts.map +1 -0
- package/dist/services/reverseSync/skillsDetector.js +287 -0
- package/dist/services/reverseSync/skillsDetector.js.map +1 -0
- package/dist/services/reverseSync/toolDetector.d.ts +36 -0
- package/dist/services/reverseSync/toolDetector.d.ts.map +1 -0
- package/dist/services/reverseSync/toolDetector.js +177 -0
- package/dist/services/reverseSync/toolDetector.js.map +1 -0
- package/dist/services/reverseSync/types.d.ts +203 -0
- package/dist/services/reverseSync/types.d.ts.map +1 -0
- package/dist/services/reverseSync/types.js +9 -0
- package/dist/services/reverseSync/types.js.map +1 -0
- package/dist/services/semantic/codebaseAnalyzer.d.ts +62 -0
- package/dist/services/semantic/codebaseAnalyzer.d.ts.map +1 -0
- package/dist/services/semantic/codebaseAnalyzer.js +1071 -0
- package/dist/services/semantic/codebaseAnalyzer.js.map +1 -0
- package/dist/services/semantic/contextBuilder.d.ts +86 -0
- package/dist/services/semantic/contextBuilder.d.ts.map +1 -0
- package/dist/services/semantic/contextBuilder.js +641 -0
- package/dist/services/semantic/contextBuilder.js.map +1 -0
- package/dist/services/semantic/contextCache.d.ts +67 -0
- package/dist/services/semantic/contextCache.d.ts.map +1 -0
- package/dist/services/semantic/contextCache.js +158 -0
- package/dist/services/semantic/contextCache.js.map +1 -0
- package/dist/services/semantic/index.d.ts +13 -0
- package/dist/services/semantic/index.d.ts.map +1 -0
- package/dist/services/semantic/index.js +35 -0
- package/dist/services/semantic/index.js.map +1 -0
- package/dist/services/semantic/lsp/index.d.ts +2 -0
- package/dist/services/semantic/lsp/index.d.ts.map +1 -0
- package/dist/services/semantic/lsp/index.js +6 -0
- package/dist/services/semantic/lsp/index.js.map +1 -0
- package/dist/services/semantic/lsp/lspLayer.d.ts +32 -0
- package/dist/services/semantic/lsp/lspLayer.d.ts.map +1 -0
- package/dist/services/semantic/lsp/lspLayer.js +378 -0
- package/dist/services/semantic/lsp/lspLayer.js.map +1 -0
- package/dist/services/semantic/semanticSnapshotService.d.ts +86 -0
- package/dist/services/semantic/semanticSnapshotService.d.ts.map +1 -0
- package/dist/services/semantic/semanticSnapshotService.js +573 -0
- package/dist/services/semantic/semanticSnapshotService.js.map +1 -0
- package/dist/services/semantic/treeSitter/index.d.ts +2 -0
- package/dist/services/semantic/treeSitter/index.d.ts.map +1 -0
- package/dist/services/semantic/treeSitter/index.js +6 -0
- package/dist/services/semantic/treeSitter/index.js.map +1 -0
- package/dist/services/semantic/treeSitter/treeSitterLayer.d.ts +37 -0
- package/dist/services/semantic/treeSitter/treeSitterLayer.d.ts.map +1 -0
- package/dist/services/semantic/treeSitter/treeSitterLayer.js +518 -0
- package/dist/services/semantic/treeSitter/treeSitterLayer.js.map +1 -0
- package/dist/services/semantic/types.d.ts +172 -0
- package/dist/services/semantic/types.d.ts.map +1 -0
- package/dist/services/semantic/types.js +33 -0
- package/dist/services/semantic/types.js.map +1 -0
- package/dist/services/shared/contentTypeRegistry.d.ts +66 -0
- package/dist/services/shared/contentTypeRegistry.d.ts.map +1 -0
- package/dist/services/shared/contentTypeRegistry.js +122 -0
- package/dist/services/shared/contentTypeRegistry.js.map +1 -0
- package/dist/services/shared/contextLayout.d.ts +18 -0
- package/dist/services/shared/contextLayout.d.ts.map +1 -0
- package/dist/services/shared/contextLayout.js +139 -0
- package/dist/services/shared/contextLayout.js.map +1 -0
- package/dist/services/shared/contextRootResolver.d.ts +57 -0
- package/dist/services/shared/contextRootResolver.d.ts.map +1 -0
- package/dist/services/shared/contextRootResolver.js +102 -0
- package/dist/services/shared/contextRootResolver.js.map +1 -0
- package/dist/services/shared/executionContext.d.ts +38 -0
- package/dist/services/shared/executionContext.d.ts.map +1 -0
- package/dist/services/shared/executionContext.js +39 -0
- package/dist/services/shared/executionContext.js.map +1 -0
- package/dist/services/shared/globPatterns.d.ts +48 -0
- package/dist/services/shared/globPatterns.d.ts.map +1 -0
- package/dist/services/shared/globPatterns.js +110 -0
- package/dist/services/shared/globPatterns.js.map +1 -0
- package/dist/services/shared/index.d.ts +15 -0
- package/dist/services/shared/index.d.ts.map +1 -0
- package/dist/services/shared/index.js +94 -0
- package/dist/services/shared/index.js.map +1 -0
- package/dist/services/shared/pathHelpers.d.ts +85 -0
- package/dist/services/shared/pathHelpers.d.ts.map +1 -0
- package/dist/services/shared/pathHelpers.js +187 -0
- package/dist/services/shared/pathHelpers.js.map +1 -0
- package/dist/services/shared/toolRegistry.d.ts +141 -0
- package/dist/services/shared/toolRegistry.d.ts.map +1 -0
- package/dist/services/shared/toolRegistry.js +559 -0
- package/dist/services/shared/toolRegistry.js.map +1 -0
- package/dist/services/shared/types.d.ts +68 -0
- package/dist/services/shared/types.d.ts.map +1 -0
- package/dist/services/shared/types.js +44 -0
- package/dist/services/shared/types.js.map +1 -0
- package/dist/services/shared/uiHelpers.d.ts +70 -0
- package/dist/services/shared/uiHelpers.d.ts.map +1 -0
- package/dist/services/shared/uiHelpers.js +131 -0
- package/dist/services/shared/uiHelpers.js.map +1 -0
- package/dist/services/stack/index.d.ts +6 -0
- package/dist/services/stack/index.d.ts.map +1 -0
- package/dist/services/stack/index.js +25 -0
- package/dist/services/stack/index.js.map +1 -0
- package/dist/services/stack/projectTypeClassifier.d.ts +59 -0
- package/dist/services/stack/projectTypeClassifier.d.ts.map +1 -0
- package/dist/services/stack/projectTypeClassifier.js +242 -0
- package/dist/services/stack/projectTypeClassifier.js.map +1 -0
- package/dist/services/stack/scaffoldFilter.d.ts +75 -0
- package/dist/services/stack/scaffoldFilter.d.ts.map +1 -0
- package/dist/services/stack/scaffoldFilter.js +222 -0
- package/dist/services/stack/scaffoldFilter.js.map +1 -0
- package/dist/services/stack/stackDetector.d.ts +43 -0
- package/dist/services/stack/stackDetector.d.ts.map +1 -0
- package/dist/services/stack/stackDetector.js +406 -0
- package/dist/services/stack/stackDetector.js.map +1 -0
- package/dist/services/state/index.d.ts +2 -0
- package/dist/services/state/index.d.ts.map +1 -0
- package/dist/services/state/index.js +6 -0
- package/dist/services/state/index.js.map +1 -0
- package/dist/services/state/stateDetector.d.ts +8 -0
- package/dist/services/state/stateDetector.d.ts.map +1 -0
- package/dist/services/state/stateDetector.js +16 -0
- package/dist/services/state/stateDetector.js.map +1 -0
- package/dist/services/sync/index.d.ts +6 -0
- package/dist/services/sync/index.d.ts.map +1 -0
- package/dist/services/sync/index.js +16 -0
- package/dist/services/sync/index.js.map +1 -0
- package/dist/services/sync/markdownReferenceHandler.d.ts +3 -0
- package/dist/services/sync/markdownReferenceHandler.d.ts.map +1 -0
- package/dist/services/sync/markdownReferenceHandler.js +138 -0
- package/dist/services/sync/markdownReferenceHandler.js.map +1 -0
- package/dist/services/sync/presets.d.ts +9 -0
- package/dist/services/sync/presets.d.ts.map +1 -0
- package/dist/services/sync/presets.js +53 -0
- package/dist/services/sync/presets.js.map +1 -0
- package/dist/services/sync/symlinkHandler.d.ts +7 -0
- package/dist/services/sync/symlinkHandler.d.ts.map +1 -0
- package/dist/services/sync/symlinkHandler.js +134 -0
- package/dist/services/sync/symlinkHandler.js.map +1 -0
- package/dist/services/sync/syncService.d.ts +23 -0
- package/dist/services/sync/syncService.d.ts.map +1 -0
- package/dist/services/sync/syncService.js +254 -0
- package/dist/services/sync/syncService.js.map +1 -0
- package/dist/services/sync/types.d.ts +70 -0
- package/dist/services/sync/types.d.ts.map +1 -0
- package/dist/services/sync/types.js +3 -0
- package/dist/services/sync/types.js.map +1 -0
- package/dist/services/workflow/autoAdvance.d.ts +38 -0
- package/dist/services/workflow/autoAdvance.d.ts.map +1 -0
- package/dist/services/workflow/autoAdvance.js +219 -0
- package/dist/services/workflow/autoAdvance.js.map +1 -0
- package/dist/services/workflow/index.d.ts +6 -0
- package/dist/services/workflow/index.d.ts.map +1 -0
- package/dist/services/workflow/index.js +12 -0
- package/dist/services/workflow/index.js.map +1 -0
- package/dist/services/workflow/workflowService.d.ts +219 -0
- package/dist/services/workflow/workflowService.d.ts.map +1 -0
- package/dist/services/workflow/workflowService.js +698 -0
- package/dist/services/workflow/workflowService.js.map +1 -0
- package/dist/types/scaffoldFrontmatter.d.ts +145 -0
- package/dist/types/scaffoldFrontmatter.d.ts.map +1 -0
- package/dist/types/scaffoldFrontmatter.js +172 -0
- package/dist/types/scaffoldFrontmatter.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cliUI.d.ts +26 -0
- package/dist/utils/cliUI.d.ts.map +1 -0
- package/dist/utils/cliUI.js +216 -0
- package/dist/utils/cliUI.js.map +1 -0
- package/dist/utils/fileMapper.d.ts +13 -0
- package/dist/utils/fileMapper.d.ts.map +1 -0
- package/dist/utils/fileMapper.js +165 -0
- package/dist/utils/fileMapper.js.map +1 -0
- package/dist/utils/frontMatter.d.ts +104 -0
- package/dist/utils/frontMatter.d.ts.map +1 -0
- package/dist/utils/frontMatter.js +325 -0
- package/dist/utils/frontMatter.js.map +1 -0
- package/dist/utils/gitService.d.ts +76 -0
- package/dist/utils/gitService.d.ts.map +1 -0
- package/dist/utils/gitService.js +564 -0
- package/dist/utils/gitService.js.map +1 -0
- package/dist/utils/gitignoreManager.d.ts +69 -0
- package/dist/utils/gitignoreManager.d.ts.map +1 -0
- package/dist/utils/gitignoreManager.js +211 -0
- package/dist/utils/gitignoreManager.js.map +1 -0
- package/dist/utils/i18n.d.ts +530 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +1179 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/pathSecurity.d.ts +55 -0
- package/dist/utils/pathSecurity.d.ts.map +1 -0
- package/dist/utils/pathSecurity.js +132 -0
- package/dist/utils/pathSecurity.js.map +1 -0
- package/dist/utils/processShutdown.d.ts +20 -0
- package/dist/utils/processShutdown.d.ts.map +1 -0
- package/dist/utils/processShutdown.js +47 -0
- package/dist/utils/processShutdown.js.map +1 -0
- package/dist/utils/prompts/configSummary.d.ts +7 -0
- package/dist/utils/prompts/configSummary.d.ts.map +1 -0
- package/dist/utils/prompts/configSummary.js +35 -0
- package/dist/utils/prompts/configSummary.js.map +1 -0
- package/dist/utils/prompts/index.d.ts +27 -0
- package/dist/utils/prompts/index.d.ts.map +1 -0
- package/dist/utils/prompts/index.js +112 -0
- package/dist/utils/prompts/index.js.map +1 -0
- package/dist/utils/prompts/smartDefaults.d.ts +6 -0
- package/dist/utils/prompts/smartDefaults.d.ts.map +1 -0
- package/dist/utils/prompts/smartDefaults.js +82 -0
- package/dist/utils/prompts/smartDefaults.js.map +1 -0
- package/dist/utils/prompts/types.d.ts +27 -0
- package/dist/utils/prompts/types.d.ts.map +1 -0
- package/dist/utils/prompts/types.js +3 -0
- package/dist/utils/prompts/types.js.map +1 -0
- package/dist/utils/splashScreen.d.ts +14 -0
- package/dist/utils/splashScreen.d.ts.map +1 -0
- package/dist/utils/splashScreen.js +106 -0
- package/dist/utils/splashScreen.js.map +1 -0
- package/dist/utils/theme.d.ts +69 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/theme.js +97 -0
- package/dist/utils/theme.js.map +1 -0
- package/dist/utils/themedPrompt.d.ts +46 -0
- package/dist/utils/themedPrompt.d.ts.map +1 -0
- package/dist/utils/themedPrompt.js +47 -0
- package/dist/utils/themedPrompt.js.map +1 -0
- package/dist/utils/versionChecker.d.ts +15 -0
- package/dist/utils/versionChecker.d.ts.map +1 -0
- package/dist/utils/versionChecker.js +58 -0
- package/dist/utils/versionChecker.js.map +1 -0
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +50 -0
- package/dist/version.js.map +1 -0
- package/dist/workflow/agents/agentRegistry.d.ts +82 -0
- package/dist/workflow/agents/agentRegistry.d.ts.map +1 -0
- package/dist/workflow/agents/agentRegistry.js +205 -0
- package/dist/workflow/agents/agentRegistry.js.map +1 -0
- package/dist/workflow/agents/index.d.ts +7 -0
- package/dist/workflow/agents/index.d.ts.map +1 -0
- package/dist/workflow/agents/index.js +14 -0
- package/dist/workflow/agents/index.js.map +1 -0
- package/dist/workflow/collaboration.d.ts +110 -0
- package/dist/workflow/collaboration.d.ts.map +1 -0
- package/dist/workflow/collaboration.js +301 -0
- package/dist/workflow/collaboration.js.map +1 -0
- package/dist/workflow/errors.d.ts +48 -0
- package/dist/workflow/errors.d.ts.map +1 -0
- package/dist/workflow/errors.js +52 -0
- package/dist/workflow/errors.js.map +1 -0
- package/dist/workflow/gates/gateChecker.d.ts +93 -0
- package/dist/workflow/gates/gateChecker.d.ts.map +1 -0
- package/dist/workflow/gates/gateChecker.js +197 -0
- package/dist/workflow/gates/gateChecker.js.map +1 -0
- package/dist/workflow/gates/index.d.ts +7 -0
- package/dist/workflow/gates/index.d.ts.map +1 -0
- package/dist/workflow/gates/index.js +13 -0
- package/dist/workflow/gates/index.js.map +1 -0
- package/dist/workflow/index.d.ts +27 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +140 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/orchestration/agentOrchestrator.d.ts +68 -0
- package/dist/workflow/orchestration/agentOrchestrator.d.ts.map +1 -0
- package/dist/workflow/orchestration/agentOrchestrator.js +280 -0
- package/dist/workflow/orchestration/agentOrchestrator.js.map +1 -0
- package/dist/workflow/orchestration/documentLinker.d.ts +100 -0
- package/dist/workflow/orchestration/documentLinker.d.ts.map +1 -0
- package/dist/workflow/orchestration/documentLinker.js +266 -0
- package/dist/workflow/orchestration/documentLinker.js.map +1 -0
- package/dist/workflow/orchestration/index.d.ts +9 -0
- package/dist/workflow/orchestration/index.d.ts.map +1 -0
- package/dist/workflow/orchestration/index.js +25 -0
- package/dist/workflow/orchestration/index.js.map +1 -0
- package/dist/workflow/orchestrator.d.ts +188 -0
- package/dist/workflow/orchestrator.d.ts.map +1 -0
- package/dist/workflow/orchestrator.js +495 -0
- package/dist/workflow/orchestrator.js.map +1 -0
- package/dist/workflow/phases.d.ts +64 -0
- package/dist/workflow/phases.d.ts.map +1 -0
- package/dist/workflow/phases.js +151 -0
- package/dist/workflow/phases.js.map +1 -0
- package/dist/workflow/plans/index.d.ts +8 -0
- package/dist/workflow/plans/index.d.ts.map +1 -0
- package/dist/workflow/plans/index.js +27 -0
- package/dist/workflow/plans/index.js.map +1 -0
- package/dist/workflow/plans/planLinker.d.ts +208 -0
- package/dist/workflow/plans/planLinker.d.ts.map +1 -0
- package/dist/workflow/plans/planLinker.js +1093 -0
- package/dist/workflow/plans/planLinker.js.map +1 -0
- package/dist/workflow/plans/types.d.ts +237 -0
- package/dist/workflow/plans/types.d.ts.map +1 -0
- package/dist/workflow/plans/types.js +25 -0
- package/dist/workflow/plans/types.js.map +1 -0
- package/dist/workflow/prevcConfig.d.ts +27 -0
- package/dist/workflow/prevcConfig.d.ts.map +1 -0
- package/dist/workflow/prevcConfig.js +153 -0
- package/dist/workflow/prevcConfig.js.map +1 -0
- package/dist/workflow/roles.d.ts +50 -0
- package/dist/workflow/roles.d.ts.map +1 -0
- package/dist/workflow/roles.js +118 -0
- package/dist/workflow/roles.js.map +1 -0
- package/dist/workflow/scaling.d.ts +45 -0
- package/dist/workflow/scaling.d.ts.map +1 -0
- package/dist/workflow/scaling.js +215 -0
- package/dist/workflow/scaling.js.map +1 -0
- package/dist/workflow/skills/frontmatter.d.ts +32 -0
- package/dist/workflow/skills/frontmatter.d.ts.map +1 -0
- package/dist/workflow/skills/frontmatter.js +117 -0
- package/dist/workflow/skills/frontmatter.js.map +1 -0
- package/dist/workflow/skills/index.d.ts +10 -0
- package/dist/workflow/skills/index.d.ts.map +1 -0
- package/dist/workflow/skills/index.js +24 -0
- package/dist/workflow/skills/index.js.map +1 -0
- package/dist/workflow/skills/skillRegistry.d.ts +67 -0
- package/dist/workflow/skills/skillRegistry.d.ts.map +1 -0
- package/dist/workflow/skills/skillRegistry.js +279 -0
- package/dist/workflow/skills/skillRegistry.js.map +1 -0
- package/dist/workflow/skills/skillTemplates.d.ts +20 -0
- package/dist/workflow/skills/skillTemplates.d.ts.map +1 -0
- package/dist/workflow/skills/skillTemplates.js +150 -0
- package/dist/workflow/skills/skillTemplates.js.map +1 -0
- package/dist/workflow/skills/types.d.ts +72 -0
- package/dist/workflow/skills/types.d.ts.map +1 -0
- package/dist/workflow/skills/types.js +48 -0
- package/dist/workflow/skills/types.js.map +1 -0
- package/dist/workflow/status/statusManager.d.ts +142 -0
- package/dist/workflow/status/statusManager.d.ts.map +1 -0
- package/dist/workflow/status/statusManager.js +971 -0
- package/dist/workflow/status/statusManager.js.map +1 -0
- package/dist/workflow/status/templates.d.ts +49 -0
- package/dist/workflow/status/templates.d.ts.map +1 -0
- package/dist/workflow/status/templates.js +162 -0
- package/dist/workflow/status/templates.js.map +1 -0
- package/dist/workflow/types.d.ts +314 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/types.js +24 -0
- package/dist/workflow/types.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,1071 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CodebaseAnalyzer - Main orchestrator for semantic code analysis
|
|
4
|
+
*
|
|
5
|
+
* Combines Tree-sitter for fast syntactic analysis with optional LSP
|
|
6
|
+
* for deeper semantic understanding.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.CodebaseAnalyzer = void 0;
|
|
43
|
+
const glob_1 = require("glob");
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const fs = __importStar(require("fs/promises"));
|
|
46
|
+
const treeSitterLayer_1 = require("./treeSitter/treeSitterLayer");
|
|
47
|
+
const lspLayer_1 = require("./lsp/lspLayer");
|
|
48
|
+
const types_1 = require("./types");
|
|
49
|
+
const DEFAULT_OPTIONS = {
|
|
50
|
+
useLSP: false,
|
|
51
|
+
languages: ['typescript', 'javascript', 'python', 'go'],
|
|
52
|
+
exclude: types_1.DEFAULT_EXCLUDE_PATTERNS,
|
|
53
|
+
include: [],
|
|
54
|
+
maxFiles: 5000,
|
|
55
|
+
cacheEnabled: true,
|
|
56
|
+
};
|
|
57
|
+
class CodebaseAnalyzer {
|
|
58
|
+
constructor(options = {}) {
|
|
59
|
+
this.treeSitter = new treeSitterLayer_1.TreeSitterLayer();
|
|
60
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
61
|
+
// Create LSPLayer if LSP mode is enabled
|
|
62
|
+
if (this.options.useLSP) {
|
|
63
|
+
this.lspLayer = new lspLayer_1.LSPLayer();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async analyze(projectPath) {
|
|
67
|
+
const startTime = Date.now();
|
|
68
|
+
// 1. Find all code files
|
|
69
|
+
const files = await this.findCodeFiles(projectPath);
|
|
70
|
+
// 2. Analyze with Tree-sitter
|
|
71
|
+
const fileAnalyses = await this.analyzeFiles(files);
|
|
72
|
+
// 3. Build base context
|
|
73
|
+
const context = this.buildBaseContext(fileAnalyses, projectPath);
|
|
74
|
+
// 4. Enhance with LSP if enabled (adds type info, references)
|
|
75
|
+
if (this.lspLayer) {
|
|
76
|
+
await this.enhanceWithLSP(context, projectPath);
|
|
77
|
+
}
|
|
78
|
+
// 5. Detect architecture and patterns
|
|
79
|
+
context.architecture = this.detectArchitecture(fileAnalyses, projectPath);
|
|
80
|
+
// 6. Calculate stats
|
|
81
|
+
context.stats.analysisTimeMs = Date.now() - startTime;
|
|
82
|
+
return context;
|
|
83
|
+
}
|
|
84
|
+
async findCodeFiles(projectPath) {
|
|
85
|
+
const extensions = Object.keys(types_1.LANGUAGE_EXTENSIONS);
|
|
86
|
+
const patterns = extensions.map((ext) => `**/*${ext}`);
|
|
87
|
+
const ignorePatterns = this.options.exclude.map((p) => `**/${p}/**`);
|
|
88
|
+
const allFiles = [];
|
|
89
|
+
for (const pattern of patterns) {
|
|
90
|
+
try {
|
|
91
|
+
const matches = await (0, glob_1.glob)(pattern, {
|
|
92
|
+
cwd: projectPath,
|
|
93
|
+
ignore: ignorePatterns,
|
|
94
|
+
absolute: true,
|
|
95
|
+
nodir: true,
|
|
96
|
+
});
|
|
97
|
+
allFiles.push(...matches);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// Ignore glob errors for individual patterns
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Apply include filter if specified
|
|
104
|
+
let filteredFiles = allFiles;
|
|
105
|
+
if (this.options.include.length > 0) {
|
|
106
|
+
filteredFiles = allFiles.filter((file) => this.options.include.some((pattern) => file.includes(pattern)));
|
|
107
|
+
}
|
|
108
|
+
// Limit number of files
|
|
109
|
+
return filteredFiles.slice(0, this.options.maxFiles);
|
|
110
|
+
}
|
|
111
|
+
async analyzeFiles(files) {
|
|
112
|
+
const analyses = new Map();
|
|
113
|
+
const batchSize = 50;
|
|
114
|
+
for (let i = 0; i < files.length; i += batchSize) {
|
|
115
|
+
const batch = files.slice(i, i + batchSize);
|
|
116
|
+
const results = await Promise.all(batch.map((file) => this.treeSitter.analyzeFile(file)));
|
|
117
|
+
for (const analysis of results) {
|
|
118
|
+
analyses.set(analysis.filePath, analysis);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return analyses;
|
|
122
|
+
}
|
|
123
|
+
buildBaseContext(analyses, projectPath) {
|
|
124
|
+
const symbols = {
|
|
125
|
+
classes: [],
|
|
126
|
+
interfaces: [],
|
|
127
|
+
functions: [],
|
|
128
|
+
types: [],
|
|
129
|
+
enums: [],
|
|
130
|
+
};
|
|
131
|
+
const dependencyGraph = new Map();
|
|
132
|
+
const reverseDependencyGraph = new Map();
|
|
133
|
+
const languageCount = {};
|
|
134
|
+
for (const [file, analysis] of analyses) {
|
|
135
|
+
// Count by language
|
|
136
|
+
const ext = path.extname(file);
|
|
137
|
+
languageCount[ext] = (languageCount[ext] || 0) + 1;
|
|
138
|
+
// Categorize symbols
|
|
139
|
+
for (const symbol of analysis.symbols) {
|
|
140
|
+
switch (symbol.kind) {
|
|
141
|
+
case 'class':
|
|
142
|
+
symbols.classes.push(symbol);
|
|
143
|
+
break;
|
|
144
|
+
case 'interface':
|
|
145
|
+
symbols.interfaces.push(symbol);
|
|
146
|
+
break;
|
|
147
|
+
case 'function':
|
|
148
|
+
symbols.functions.push(symbol);
|
|
149
|
+
break;
|
|
150
|
+
case 'type':
|
|
151
|
+
symbols.types.push(symbol);
|
|
152
|
+
break;
|
|
153
|
+
case 'enum':
|
|
154
|
+
symbols.enums.push(symbol);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Build dependency graph
|
|
159
|
+
const importedFiles = analysis.imports
|
|
160
|
+
.map((imp) => this.resolveImportPath(file, imp.source, projectPath))
|
|
161
|
+
.filter((f) => f !== null);
|
|
162
|
+
dependencyGraph.set(file, importedFiles);
|
|
163
|
+
for (const importedFile of importedFiles) {
|
|
164
|
+
if (!reverseDependencyGraph.has(importedFile)) {
|
|
165
|
+
reverseDependencyGraph.set(importedFile, []);
|
|
166
|
+
}
|
|
167
|
+
reverseDependencyGraph.get(importedFile).push(file);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
symbols,
|
|
172
|
+
dependencies: {
|
|
173
|
+
graph: dependencyGraph,
|
|
174
|
+
reverseGraph: reverseDependencyGraph,
|
|
175
|
+
},
|
|
176
|
+
architecture: {
|
|
177
|
+
layers: [],
|
|
178
|
+
patterns: [],
|
|
179
|
+
entryPoints: [],
|
|
180
|
+
publicAPI: [],
|
|
181
|
+
},
|
|
182
|
+
stats: {
|
|
183
|
+
totalFiles: analyses.size,
|
|
184
|
+
totalSymbols: Object.values(symbols).flat().length,
|
|
185
|
+
languageBreakdown: languageCount,
|
|
186
|
+
analysisTimeMs: 0,
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
resolveImportPath(fromFile, importSource, projectPath) {
|
|
191
|
+
// Skip external packages
|
|
192
|
+
if (!importSource.startsWith('.') && !importSource.startsWith('/')) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
const dir = path.dirname(fromFile);
|
|
196
|
+
const resolved = path.resolve(dir, importSource);
|
|
197
|
+
// Try common extensions
|
|
198
|
+
const extensions = ['.ts', '.tsx', '.js', '.jsx', '/index.ts', '/index.js', '.py', '.go'];
|
|
199
|
+
for (const ext of extensions) {
|
|
200
|
+
const withExt = resolved + ext;
|
|
201
|
+
if (this.fileExistsSync(withExt)) {
|
|
202
|
+
return withExt;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// Try without extension (might already have it)
|
|
206
|
+
if (this.fileExistsSync(resolved)) {
|
|
207
|
+
return resolved;
|
|
208
|
+
}
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
fileExistsSync(filePath) {
|
|
212
|
+
try {
|
|
213
|
+
require('fs').accessSync(filePath);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
detectArchitecture(analyses, projectPath) {
|
|
221
|
+
const layers = this.detectLayers(analyses, projectPath);
|
|
222
|
+
const patterns = this.detectPatterns(analyses);
|
|
223
|
+
const entryPoints = this.findEntryPoints(analyses, projectPath);
|
|
224
|
+
const publicAPI = this.findPublicAPI(analyses);
|
|
225
|
+
// Calculate layer dependencies
|
|
226
|
+
this.calculateLayerDependencies(layers, analyses, projectPath);
|
|
227
|
+
return { layers, patterns, entryPoints, publicAPI };
|
|
228
|
+
}
|
|
229
|
+
detectLayers(analyses, projectPath) {
|
|
230
|
+
const layerHeuristics = [
|
|
231
|
+
{
|
|
232
|
+
name: 'Services',
|
|
233
|
+
patterns: [/services?/i, /use-?cases?/i, /application/i],
|
|
234
|
+
description: 'Business logic and orchestration',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: 'Controllers',
|
|
238
|
+
patterns: [/controllers?/i, /handlers?/i, /routes?/i, /api/i],
|
|
239
|
+
description: 'Request handling and routing',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'Models',
|
|
243
|
+
patterns: [/models?/i, /entities/i, /domain/i, /schemas?/i],
|
|
244
|
+
description: 'Data structures and domain objects',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'Repositories',
|
|
248
|
+
patterns: [/repositor/i, /data/i, /database/i, /persistence/i],
|
|
249
|
+
description: 'Data access and persistence',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'Utils',
|
|
253
|
+
patterns: [/utils?/i, /helpers?/i, /lib/i, /common/i, /shared/i],
|
|
254
|
+
description: 'Shared utilities and helpers',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: 'Generators',
|
|
258
|
+
patterns: [/generators?/i, /builders?/i, /factories?/i],
|
|
259
|
+
description: 'Content and object generation',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'Components',
|
|
263
|
+
patterns: [/components?/i, /views?/i, /pages?/i, /screens?/i],
|
|
264
|
+
description: 'UI components and views',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: 'Config',
|
|
268
|
+
patterns: [/config/i, /settings?/i, /constants?/i],
|
|
269
|
+
description: 'Configuration and constants',
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
const layers = [];
|
|
273
|
+
const filesByLayer = new Map();
|
|
274
|
+
for (const [file] of analyses) {
|
|
275
|
+
const relativePath = path.relative(projectPath, file);
|
|
276
|
+
for (const heuristic of layerHeuristics) {
|
|
277
|
+
if (heuristic.patterns.some((p) => p.test(relativePath))) {
|
|
278
|
+
if (!filesByLayer.has(heuristic.name)) {
|
|
279
|
+
filesByLayer.set(heuristic.name, []);
|
|
280
|
+
}
|
|
281
|
+
filesByLayer.get(heuristic.name).push(file);
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
for (const [layerName, files] of filesByLayer) {
|
|
287
|
+
const heuristic = layerHeuristics.find((h) => h.name === layerName);
|
|
288
|
+
const layerSymbols = [];
|
|
289
|
+
const directories = new Set();
|
|
290
|
+
for (const file of files) {
|
|
291
|
+
const analysis = analyses.get(file);
|
|
292
|
+
if (analysis) {
|
|
293
|
+
layerSymbols.push(...analysis.symbols);
|
|
294
|
+
directories.add(path.dirname(path.relative(projectPath, file)));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (layerSymbols.length > 0) {
|
|
298
|
+
layers.push({
|
|
299
|
+
name: layerName,
|
|
300
|
+
description: heuristic.description,
|
|
301
|
+
directories: [...directories],
|
|
302
|
+
symbols: layerSymbols,
|
|
303
|
+
dependsOn: [],
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return layers;
|
|
308
|
+
}
|
|
309
|
+
detectPatterns(analyses) {
|
|
310
|
+
const patterns = [];
|
|
311
|
+
const allSymbols = [...analyses.values()].flatMap((a) => a.symbols);
|
|
312
|
+
// Factory Pattern
|
|
313
|
+
const factories = allSymbols.filter((s) => /Factory$/i.test(s.name) && s.kind === 'class');
|
|
314
|
+
if (factories.length > 0) {
|
|
315
|
+
patterns.push({
|
|
316
|
+
name: 'Factory',
|
|
317
|
+
confidence: 0.9,
|
|
318
|
+
locations: factories.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
319
|
+
description: 'Creates instances of related objects without specifying concrete classes',
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
// Singleton Pattern
|
|
323
|
+
const singletons = allSymbols.filter((s) => s.kind === 'class' && /Singleton|Instance/i.test(s.name));
|
|
324
|
+
if (singletons.length > 0) {
|
|
325
|
+
patterns.push({
|
|
326
|
+
name: 'Singleton',
|
|
327
|
+
confidence: 0.7,
|
|
328
|
+
locations: singletons.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
329
|
+
description: 'Ensures a class has only one instance',
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
// Repository Pattern
|
|
333
|
+
const repositories = allSymbols.filter((s) => /Repository$/i.test(s.name) && (s.kind === 'class' || s.kind === 'interface'));
|
|
334
|
+
if (repositories.length > 0) {
|
|
335
|
+
patterns.push({
|
|
336
|
+
name: 'Repository',
|
|
337
|
+
confidence: 0.9,
|
|
338
|
+
locations: repositories.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
339
|
+
description: 'Abstracts data access logic',
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
// Service Layer Pattern
|
|
343
|
+
const services = allSymbols.filter((s) => /Service$/i.test(s.name) && s.kind === 'class');
|
|
344
|
+
if (services.length > 0) {
|
|
345
|
+
patterns.push({
|
|
346
|
+
name: 'Service Layer',
|
|
347
|
+
confidence: 0.85,
|
|
348
|
+
locations: services.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
349
|
+
description: 'Encapsulates business logic in service classes',
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
// Controller Pattern
|
|
353
|
+
const controllers = allSymbols.filter((s) => /Controller$/i.test(s.name) && s.kind === 'class');
|
|
354
|
+
if (controllers.length > 0) {
|
|
355
|
+
patterns.push({
|
|
356
|
+
name: 'Controller',
|
|
357
|
+
confidence: 0.9,
|
|
358
|
+
locations: controllers.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
359
|
+
description: 'Handles incoming requests and returns responses',
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
// Builder Pattern
|
|
363
|
+
const builders = allSymbols.filter((s) => /Builder$/i.test(s.name) && s.kind === 'class');
|
|
364
|
+
if (builders.length > 0) {
|
|
365
|
+
patterns.push({
|
|
366
|
+
name: 'Builder',
|
|
367
|
+
confidence: 0.85,
|
|
368
|
+
locations: builders.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
369
|
+
description: 'Separates object construction from its representation',
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
// Observer Pattern (event emitters)
|
|
373
|
+
const observers = allSymbols.filter((s) => (s.kind === 'class' || s.kind === 'interface') &&
|
|
374
|
+
/Observer|Listener|Emitter|Handler$/i.test(s.name));
|
|
375
|
+
if (observers.length > 0) {
|
|
376
|
+
patterns.push({
|
|
377
|
+
name: 'Observer',
|
|
378
|
+
confidence: 0.75,
|
|
379
|
+
locations: observers.map((s) => ({ file: s.location.file, symbol: s.name })),
|
|
380
|
+
description: 'Defines a subscription mechanism to notify multiple objects',
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return patterns;
|
|
384
|
+
}
|
|
385
|
+
findEntryPoints(analyses, projectPath) {
|
|
386
|
+
const entryPoints = [];
|
|
387
|
+
const entryPatterns = [
|
|
388
|
+
/^(index|main|app|server|cli)\.(ts|js|tsx|jsx)$/,
|
|
389
|
+
/src\/(index|main|app)\.(ts|js)$/,
|
|
390
|
+
/^bin\//,
|
|
391
|
+
];
|
|
392
|
+
for (const [file] of analyses) {
|
|
393
|
+
const relativePath = path.relative(projectPath, file);
|
|
394
|
+
const basename = path.basename(file);
|
|
395
|
+
if (entryPatterns.some((p) => p.test(basename) || p.test(relativePath))) {
|
|
396
|
+
entryPoints.push(relativePath);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return entryPoints;
|
|
400
|
+
}
|
|
401
|
+
findPublicAPI(analyses) {
|
|
402
|
+
const publicSymbols = [];
|
|
403
|
+
for (const [, analysis] of analyses) {
|
|
404
|
+
for (const symbol of analysis.symbols) {
|
|
405
|
+
if (symbol.exported &&
|
|
406
|
+
(symbol.kind === 'class' ||
|
|
407
|
+
symbol.kind === 'interface' ||
|
|
408
|
+
symbol.kind === 'function' ||
|
|
409
|
+
symbol.kind === 'type')) {
|
|
410
|
+
publicSymbols.push(symbol);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Sort by name for consistency
|
|
415
|
+
return publicSymbols.sort((a, b) => a.name.localeCompare(b.name));
|
|
416
|
+
}
|
|
417
|
+
calculateLayerDependencies(layers, analyses, projectPath) {
|
|
418
|
+
const fileToLayer = new Map();
|
|
419
|
+
for (const layer of layers) {
|
|
420
|
+
for (const dir of layer.directories) {
|
|
421
|
+
for (const [file] of analyses) {
|
|
422
|
+
const relFile = path.relative(projectPath, file);
|
|
423
|
+
if (relFile.startsWith(dir)) {
|
|
424
|
+
fileToLayer.set(file, layer.name);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
for (const layer of layers) {
|
|
430
|
+
const dependsOn = new Set();
|
|
431
|
+
for (const symbol of layer.symbols) {
|
|
432
|
+
const file = symbol.location.file;
|
|
433
|
+
const analysis = analyses.get(file);
|
|
434
|
+
if (!analysis)
|
|
435
|
+
continue;
|
|
436
|
+
for (const imp of analysis.imports) {
|
|
437
|
+
const resolved = this.resolveImportPath(file, imp.source, projectPath);
|
|
438
|
+
if (resolved) {
|
|
439
|
+
const depLayer = fileToLayer.get(resolved);
|
|
440
|
+
if (depLayer && depLayer !== layer.name) {
|
|
441
|
+
dependsOn.add(depLayer);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
layer.dependsOn = [...dependsOn];
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Get a summary suitable for documentation generation
|
|
451
|
+
*/
|
|
452
|
+
getSummary(context, projectPath) {
|
|
453
|
+
const { symbols, architecture, stats } = context;
|
|
454
|
+
const lines = [
|
|
455
|
+
`## Codebase Analysis Summary\n`,
|
|
456
|
+
`**Total Files**: ${stats.totalFiles}`,
|
|
457
|
+
`**Total Symbols**: ${stats.totalSymbols}`,
|
|
458
|
+
`**Analysis Time**: ${stats.analysisTimeMs}ms\n`,
|
|
459
|
+
`### Language Breakdown\n`,
|
|
460
|
+
];
|
|
461
|
+
for (const [ext, count] of Object.entries(stats.languageBreakdown)) {
|
|
462
|
+
lines.push(`- ${ext}: ${count} files`);
|
|
463
|
+
}
|
|
464
|
+
if (architecture.layers.length > 0) {
|
|
465
|
+
lines.push(`\n### Architecture Layers\n`);
|
|
466
|
+
for (const layer of architecture.layers) {
|
|
467
|
+
const symbolCount = layer.symbols.length;
|
|
468
|
+
const deps = layer.dependsOn.length > 0 ? ` → ${layer.dependsOn.join(', ')}` : '';
|
|
469
|
+
lines.push(`- **${layer.name}** (${symbolCount} symbols)${deps}`);
|
|
470
|
+
lines.push(` - ${layer.description}`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (architecture.patterns.length > 0) {
|
|
474
|
+
lines.push(`\n### Detected Patterns\n`);
|
|
475
|
+
for (const pattern of architecture.patterns) {
|
|
476
|
+
const confidence = Math.round(pattern.confidence * 100);
|
|
477
|
+
lines.push(`- **${pattern.name}** (${confidence}% confidence): ${pattern.locations.length} occurrences`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (architecture.entryPoints.length > 0) {
|
|
481
|
+
lines.push(`\n### Entry Points\n`);
|
|
482
|
+
for (const ep of architecture.entryPoints) {
|
|
483
|
+
lines.push(`- \`${ep}\``);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return lines.join('\n');
|
|
487
|
+
}
|
|
488
|
+
clearCache() {
|
|
489
|
+
this.treeSitter.clearCache();
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Shutdown LSP servers gracefully
|
|
493
|
+
*/
|
|
494
|
+
async shutdown() {
|
|
495
|
+
if (this.lspLayer) {
|
|
496
|
+
await this.lspLayer.shutdown();
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Enhance Tree-sitter analysis with LSP semantic information
|
|
501
|
+
* Adds type info, references, and implementations to key symbols
|
|
502
|
+
*/
|
|
503
|
+
async enhanceWithLSP(context, projectPath) {
|
|
504
|
+
const allSymbols = [
|
|
505
|
+
...context.symbols.classes,
|
|
506
|
+
...context.symbols.interfaces,
|
|
507
|
+
...context.symbols.functions,
|
|
508
|
+
...context.symbols.types,
|
|
509
|
+
];
|
|
510
|
+
// Prioritize symbols to enhance (exported and important ones first)
|
|
511
|
+
const prioritizedSymbols = allSymbols
|
|
512
|
+
.filter((s) => s.exported)
|
|
513
|
+
.slice(0, 100); // Limit to avoid excessive LSP calls
|
|
514
|
+
for (const symbol of prioritizedSymbols) {
|
|
515
|
+
try {
|
|
516
|
+
// Get type information via LSP hover
|
|
517
|
+
const typeInfo = await this.lspLayer.getTypeInfo(symbol.location.file, symbol.location.line, symbol.location.column || 0, projectPath);
|
|
518
|
+
if (typeInfo) {
|
|
519
|
+
symbol.typeInfo = typeInfo;
|
|
520
|
+
}
|
|
521
|
+
// For interfaces and classes, find implementations
|
|
522
|
+
if (symbol.kind === 'interface' || symbol.kind === 'class') {
|
|
523
|
+
const implementations = await this.lspLayer.findImplementations(symbol.location.file, symbol.location.line, symbol.location.column || 0, projectPath);
|
|
524
|
+
if (implementations.length > 0) {
|
|
525
|
+
symbol.implementations = implementations;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
// Find references for exported symbols
|
|
529
|
+
const references = await this.lspLayer.findReferences(symbol.location.file, symbol.location.line, symbol.location.column || 0, projectPath);
|
|
530
|
+
if (references.length > 0) {
|
|
531
|
+
symbol.references = references;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
catch {
|
|
535
|
+
// LSP errors are non-fatal, continue with other symbols
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Detect functional patterns in the codebase
|
|
541
|
+
* These patterns indicate functional capabilities like auth, database, API, etc.
|
|
542
|
+
*/
|
|
543
|
+
async detectFunctionalPatterns(projectPath) {
|
|
544
|
+
const files = await this.findCodeFiles(projectPath);
|
|
545
|
+
const analyses = await this.analyzeFiles(files);
|
|
546
|
+
const patterns = [];
|
|
547
|
+
const allSymbols = [...analyses.values()].flatMap((a) => a.symbols);
|
|
548
|
+
const allImports = [...analyses.values()].flatMap((a) => a.imports.map((imp) => ({ ...imp, file: a.filePath })));
|
|
549
|
+
// Authentication pattern detection
|
|
550
|
+
const authPattern = this.detectAuthPattern(allSymbols, allImports, files);
|
|
551
|
+
if (authPattern)
|
|
552
|
+
patterns.push(authPattern);
|
|
553
|
+
// Database pattern detection
|
|
554
|
+
const dbPattern = this.detectDatabasePattern(allSymbols, allImports, files);
|
|
555
|
+
if (dbPattern)
|
|
556
|
+
patterns.push(dbPattern);
|
|
557
|
+
// API pattern detection
|
|
558
|
+
const apiPattern = this.detectApiPattern(allSymbols, allImports, files);
|
|
559
|
+
if (apiPattern)
|
|
560
|
+
patterns.push(apiPattern);
|
|
561
|
+
// Cache pattern detection
|
|
562
|
+
const cachePattern = this.detectCachePattern(allSymbols, allImports, files);
|
|
563
|
+
if (cachePattern)
|
|
564
|
+
patterns.push(cachePattern);
|
|
565
|
+
// Queue/messaging pattern detection
|
|
566
|
+
const queuePattern = this.detectQueuePattern(allSymbols, allImports, files);
|
|
567
|
+
if (queuePattern)
|
|
568
|
+
patterns.push(queuePattern);
|
|
569
|
+
// WebSocket pattern detection
|
|
570
|
+
const wsPattern = this.detectWebSocketPattern(allSymbols, allImports, files);
|
|
571
|
+
if (wsPattern)
|
|
572
|
+
patterns.push(wsPattern);
|
|
573
|
+
// Logging pattern detection
|
|
574
|
+
const loggingPattern = this.detectLoggingPattern(allSymbols, allImports, files);
|
|
575
|
+
if (loggingPattern)
|
|
576
|
+
patterns.push(loggingPattern);
|
|
577
|
+
// Validation pattern detection
|
|
578
|
+
const validationPattern = this.detectValidationPattern(allSymbols, allImports, files);
|
|
579
|
+
if (validationPattern)
|
|
580
|
+
patterns.push(validationPattern);
|
|
581
|
+
// Error handling pattern detection
|
|
582
|
+
const errorPattern = this.detectErrorHandlingPattern(allSymbols, allImports, files);
|
|
583
|
+
if (errorPattern)
|
|
584
|
+
patterns.push(errorPattern);
|
|
585
|
+
// Testing pattern detection
|
|
586
|
+
const testingPattern = this.detectTestingPattern(allSymbols, allImports, files);
|
|
587
|
+
if (testingPattern)
|
|
588
|
+
patterns.push(testingPattern);
|
|
589
|
+
return {
|
|
590
|
+
hasAuthPattern: patterns.some((p) => p.type === 'auth'),
|
|
591
|
+
hasDatabasePattern: patterns.some((p) => p.type === 'database'),
|
|
592
|
+
hasApiPattern: patterns.some((p) => p.type === 'api'),
|
|
593
|
+
hasCachePattern: patterns.some((p) => p.type === 'cache'),
|
|
594
|
+
hasQueuePattern: patterns.some((p) => p.type === 'queue'),
|
|
595
|
+
hasWebSocketPattern: patterns.some((p) => p.type === 'websocket'),
|
|
596
|
+
hasLoggingPattern: patterns.some((p) => p.type === 'logging'),
|
|
597
|
+
hasValidationPattern: patterns.some((p) => p.type === 'validation'),
|
|
598
|
+
hasErrorHandlingPattern: patterns.some((p) => p.type === 'error-handling'),
|
|
599
|
+
hasTestingPattern: patterns.some((p) => p.type === 'testing'),
|
|
600
|
+
patterns,
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
detectAuthPattern(symbols, imports, files) {
|
|
604
|
+
const indicators = [];
|
|
605
|
+
// Check for auth-related symbols
|
|
606
|
+
const authSymbols = symbols.filter((s) => /^(auth|login|logout|verify|jwt|token|session|password|credential|oauth)/i.test(s.name));
|
|
607
|
+
for (const sym of authSymbols) {
|
|
608
|
+
indicators.push({
|
|
609
|
+
file: sym.location.file,
|
|
610
|
+
symbol: sym.name,
|
|
611
|
+
line: sym.location.line,
|
|
612
|
+
reason: `Auth-related symbol: ${sym.name}`,
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
// Check for auth-related imports
|
|
616
|
+
const authImports = imports.filter((imp) => /^(jsonwebtoken|passport|bcrypt|argon2|@auth|next-auth|express-session|cookie-session)/i.test(imp.source));
|
|
617
|
+
for (const imp of authImports) {
|
|
618
|
+
indicators.push({
|
|
619
|
+
file: imp.file,
|
|
620
|
+
reason: `Auth library import: ${imp.source}`,
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
// Check for auth-related files
|
|
624
|
+
const authFiles = files.filter((f) => /\/(auth|login|session|middleware)[\./]/i.test(f));
|
|
625
|
+
for (const f of authFiles) {
|
|
626
|
+
indicators.push({
|
|
627
|
+
file: f,
|
|
628
|
+
reason: 'Auth-related file path',
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
if (indicators.length === 0)
|
|
632
|
+
return null;
|
|
633
|
+
return {
|
|
634
|
+
type: 'auth',
|
|
635
|
+
confidence: Math.min(1, indicators.length * 0.15),
|
|
636
|
+
indicators: indicators.slice(0, 10),
|
|
637
|
+
description: 'Authentication and authorization functionality',
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
detectDatabasePattern(symbols, imports, files) {
|
|
641
|
+
const indicators = [];
|
|
642
|
+
// Check for database-related symbols
|
|
643
|
+
const dbSymbols = symbols.filter((s) => /^(repository|model|entity|schema|migration|query|database|db|prisma|sequelize|mongoose)/i.test(s.name));
|
|
644
|
+
for (const sym of dbSymbols) {
|
|
645
|
+
indicators.push({
|
|
646
|
+
file: sym.location.file,
|
|
647
|
+
symbol: sym.name,
|
|
648
|
+
line: sym.location.line,
|
|
649
|
+
reason: `Database-related symbol: ${sym.name}`,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
// Check for database-related imports
|
|
653
|
+
const dbImports = imports.filter((imp) => /^(prisma|@prisma|sequelize|mongoose|typeorm|knex|pg|mysql|mysql2|sqlite3|better-sqlite3|drizzle-orm|@supabase)/i.test(imp.source));
|
|
654
|
+
for (const imp of dbImports) {
|
|
655
|
+
indicators.push({
|
|
656
|
+
file: imp.file,
|
|
657
|
+
reason: `Database library import: ${imp.source}`,
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
// Check for database-related files
|
|
661
|
+
const dbFiles = files.filter((f) => /\/(models?|repositories|entities|migrations?|schemas?|database)[\./]/i.test(f));
|
|
662
|
+
for (const f of dbFiles) {
|
|
663
|
+
indicators.push({
|
|
664
|
+
file: f,
|
|
665
|
+
reason: 'Database-related file path',
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
if (indicators.length === 0)
|
|
669
|
+
return null;
|
|
670
|
+
return {
|
|
671
|
+
type: 'database',
|
|
672
|
+
confidence: Math.min(1, indicators.length * 0.15),
|
|
673
|
+
indicators: indicators.slice(0, 10),
|
|
674
|
+
description: 'Database access and ORM functionality',
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
detectApiPattern(symbols, imports, files) {
|
|
678
|
+
const indicators = [];
|
|
679
|
+
// Check for API-related symbols
|
|
680
|
+
const apiSymbols = symbols.filter((s) => /^(controller|handler|router|route|endpoint|api|rest|graphql|resolver)/i.test(s.name));
|
|
681
|
+
for (const sym of apiSymbols) {
|
|
682
|
+
indicators.push({
|
|
683
|
+
file: sym.location.file,
|
|
684
|
+
symbol: sym.name,
|
|
685
|
+
line: sym.location.line,
|
|
686
|
+
reason: `API-related symbol: ${sym.name}`,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
// Check for API framework imports
|
|
690
|
+
const apiImports = imports.filter((imp) => /^(express|fastify|koa|hapi|@nestjs|next|nuxt|graphql|apollo|@apollo|trpc|@trpc)/i.test(imp.source));
|
|
691
|
+
for (const imp of apiImports) {
|
|
692
|
+
indicators.push({
|
|
693
|
+
file: imp.file,
|
|
694
|
+
reason: `API framework import: ${imp.source}`,
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
// Check for API-related files
|
|
698
|
+
const apiFiles = files.filter((f) => /\/(routes?|controllers?|handlers?|api|endpoints?|resolvers?)[\./]/i.test(f));
|
|
699
|
+
for (const f of apiFiles) {
|
|
700
|
+
indicators.push({
|
|
701
|
+
file: f,
|
|
702
|
+
reason: 'API-related file path',
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
if (indicators.length === 0)
|
|
706
|
+
return null;
|
|
707
|
+
return {
|
|
708
|
+
type: 'api',
|
|
709
|
+
confidence: Math.min(1, indicators.length * 0.15),
|
|
710
|
+
indicators: indicators.slice(0, 10),
|
|
711
|
+
description: 'API endpoints and routing',
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
detectCachePattern(symbols, imports, _files) {
|
|
715
|
+
const indicators = [];
|
|
716
|
+
// Check for cache-related symbols
|
|
717
|
+
const cacheSymbols = symbols.filter((s) => /^(cache|redis|memcache|lru|ttl)/i.test(s.name));
|
|
718
|
+
for (const sym of cacheSymbols) {
|
|
719
|
+
indicators.push({
|
|
720
|
+
file: sym.location.file,
|
|
721
|
+
symbol: sym.name,
|
|
722
|
+
line: sym.location.line,
|
|
723
|
+
reason: `Cache-related symbol: ${sym.name}`,
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
// Check for cache-related imports
|
|
727
|
+
const cacheImports = imports.filter((imp) => /^(redis|ioredis|memcached|lru-cache|node-cache|cache-manager)/i.test(imp.source));
|
|
728
|
+
for (const imp of cacheImports) {
|
|
729
|
+
indicators.push({
|
|
730
|
+
file: imp.file,
|
|
731
|
+
reason: `Cache library import: ${imp.source}`,
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
if (indicators.length === 0)
|
|
735
|
+
return null;
|
|
736
|
+
return {
|
|
737
|
+
type: 'cache',
|
|
738
|
+
confidence: Math.min(1, indicators.length * 0.2),
|
|
739
|
+
indicators: indicators.slice(0, 10),
|
|
740
|
+
description: 'Caching and data memoization',
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
detectQueuePattern(symbols, imports, _files) {
|
|
744
|
+
const indicators = [];
|
|
745
|
+
// Check for queue-related symbols
|
|
746
|
+
const queueSymbols = symbols.filter((s) => /^(queue|worker|job|task|consumer|producer|message|event)/i.test(s.name));
|
|
747
|
+
for (const sym of queueSymbols) {
|
|
748
|
+
indicators.push({
|
|
749
|
+
file: sym.location.file,
|
|
750
|
+
symbol: sym.name,
|
|
751
|
+
line: sym.location.line,
|
|
752
|
+
reason: `Queue-related symbol: ${sym.name}`,
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
// Check for queue-related imports
|
|
756
|
+
const queueImports = imports.filter((imp) => /^(bull|bullmq|bee-queue|agenda|amqplib|rabbitmq|kafka|kafkajs|sqs)/i.test(imp.source));
|
|
757
|
+
for (const imp of queueImports) {
|
|
758
|
+
indicators.push({
|
|
759
|
+
file: imp.file,
|
|
760
|
+
reason: `Queue library import: ${imp.source}`,
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
if (indicators.length === 0)
|
|
764
|
+
return null;
|
|
765
|
+
return {
|
|
766
|
+
type: 'queue',
|
|
767
|
+
confidence: Math.min(1, indicators.length * 0.2),
|
|
768
|
+
indicators: indicators.slice(0, 10),
|
|
769
|
+
description: 'Message queues and background jobs',
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
detectWebSocketPattern(symbols, imports, _files) {
|
|
773
|
+
const indicators = [];
|
|
774
|
+
// Check for WebSocket-related symbols
|
|
775
|
+
const wsSymbols = symbols.filter((s) => /^(websocket|socket|ws|realtime|broadcast|subscribe)/i.test(s.name));
|
|
776
|
+
for (const sym of wsSymbols) {
|
|
777
|
+
indicators.push({
|
|
778
|
+
file: sym.location.file,
|
|
779
|
+
symbol: sym.name,
|
|
780
|
+
line: sym.location.line,
|
|
781
|
+
reason: `WebSocket-related symbol: ${sym.name}`,
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
// Check for WebSocket-related imports
|
|
785
|
+
const wsImports = imports.filter((imp) => /^(ws|socket\.io|@socket\.io|sockjs|pusher|ably)/i.test(imp.source));
|
|
786
|
+
for (const imp of wsImports) {
|
|
787
|
+
indicators.push({
|
|
788
|
+
file: imp.file,
|
|
789
|
+
reason: `WebSocket library import: ${imp.source}`,
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
if (indicators.length === 0)
|
|
793
|
+
return null;
|
|
794
|
+
return {
|
|
795
|
+
type: 'websocket',
|
|
796
|
+
confidence: Math.min(1, indicators.length * 0.2),
|
|
797
|
+
indicators: indicators.slice(0, 10),
|
|
798
|
+
description: 'Real-time WebSocket communication',
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
detectLoggingPattern(symbols, imports, _files) {
|
|
802
|
+
const indicators = [];
|
|
803
|
+
// Check for logging-related symbols
|
|
804
|
+
const logSymbols = symbols.filter((s) => /^(logger|log|logging|telemetry|metrics)/i.test(s.name));
|
|
805
|
+
for (const sym of logSymbols) {
|
|
806
|
+
indicators.push({
|
|
807
|
+
file: sym.location.file,
|
|
808
|
+
symbol: sym.name,
|
|
809
|
+
line: sym.location.line,
|
|
810
|
+
reason: `Logging-related symbol: ${sym.name}`,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
// Check for logging-related imports
|
|
814
|
+
const logImports = imports.filter((imp) => /^(winston|pino|bunyan|log4js|morgan|@sentry|newrelic|datadog)/i.test(imp.source));
|
|
815
|
+
for (const imp of logImports) {
|
|
816
|
+
indicators.push({
|
|
817
|
+
file: imp.file,
|
|
818
|
+
reason: `Logging library import: ${imp.source}`,
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
if (indicators.length === 0)
|
|
822
|
+
return null;
|
|
823
|
+
return {
|
|
824
|
+
type: 'logging',
|
|
825
|
+
confidence: Math.min(1, indicators.length * 0.2),
|
|
826
|
+
indicators: indicators.slice(0, 10),
|
|
827
|
+
description: 'Logging and observability',
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
detectValidationPattern(symbols, imports, _files) {
|
|
831
|
+
const indicators = [];
|
|
832
|
+
// Check for validation-related symbols
|
|
833
|
+
const validSymbols = symbols.filter((s) => /^(valid|schema|sanitize|parse|check|assert)/i.test(s.name));
|
|
834
|
+
for (const sym of validSymbols) {
|
|
835
|
+
indicators.push({
|
|
836
|
+
file: sym.location.file,
|
|
837
|
+
symbol: sym.name,
|
|
838
|
+
line: sym.location.line,
|
|
839
|
+
reason: `Validation-related symbol: ${sym.name}`,
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
// Check for validation-related imports
|
|
843
|
+
const validImports = imports.filter((imp) => /^(zod|yup|joi|ajv|class-validator|validator|io-ts|valibot)/i.test(imp.source));
|
|
844
|
+
for (const imp of validImports) {
|
|
845
|
+
indicators.push({
|
|
846
|
+
file: imp.file,
|
|
847
|
+
reason: `Validation library import: ${imp.source}`,
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
if (indicators.length === 0)
|
|
851
|
+
return null;
|
|
852
|
+
return {
|
|
853
|
+
type: 'validation',
|
|
854
|
+
confidence: Math.min(1, indicators.length * 0.2),
|
|
855
|
+
indicators: indicators.slice(0, 10),
|
|
856
|
+
description: 'Input validation and schema enforcement',
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
detectErrorHandlingPattern(symbols, imports, files) {
|
|
860
|
+
const indicators = [];
|
|
861
|
+
// Check for error-related symbols
|
|
862
|
+
const errorSymbols = symbols.filter((s) => /^(error|exception|handler|catch|fallback)/i.test(s.name));
|
|
863
|
+
for (const sym of errorSymbols) {
|
|
864
|
+
indicators.push({
|
|
865
|
+
file: sym.location.file,
|
|
866
|
+
symbol: sym.name,
|
|
867
|
+
line: sym.location.line,
|
|
868
|
+
reason: `Error handling symbol: ${sym.name}`,
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
// Check for error-related files
|
|
872
|
+
const errorFiles = files.filter((f) => /\/(errors?|exceptions?)[\./]/i.test(f));
|
|
873
|
+
for (const f of errorFiles) {
|
|
874
|
+
indicators.push({
|
|
875
|
+
file: f,
|
|
876
|
+
reason: 'Error handling file path',
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
if (indicators.length === 0)
|
|
880
|
+
return null;
|
|
881
|
+
return {
|
|
882
|
+
type: 'error-handling',
|
|
883
|
+
confidence: Math.min(1, indicators.length * 0.15),
|
|
884
|
+
indicators: indicators.slice(0, 10),
|
|
885
|
+
description: 'Error handling and exception management',
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
detectTestingPattern(symbols, imports, files) {
|
|
889
|
+
const indicators = [];
|
|
890
|
+
// Check for test-related imports
|
|
891
|
+
const testImports = imports.filter((imp) => /^(jest|vitest|mocha|chai|@testing-library|cypress|playwright|supertest)/i.test(imp.source));
|
|
892
|
+
for (const imp of testImports) {
|
|
893
|
+
indicators.push({
|
|
894
|
+
file: imp.file,
|
|
895
|
+
reason: `Test library import: ${imp.source}`,
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
// Check for test files
|
|
899
|
+
const testFiles = files.filter((f) => /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(f) || /\/__tests__\//.test(f));
|
|
900
|
+
for (const f of testFiles.slice(0, 5)) {
|
|
901
|
+
indicators.push({
|
|
902
|
+
file: f,
|
|
903
|
+
reason: 'Test file',
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
if (indicators.length === 0)
|
|
907
|
+
return null;
|
|
908
|
+
return {
|
|
909
|
+
type: 'testing',
|
|
910
|
+
confidence: Math.min(1, indicators.length * 0.15),
|
|
911
|
+
indicators: indicators.slice(0, 10),
|
|
912
|
+
description: 'Testing infrastructure and test files',
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Trace execution flow from an entry point
|
|
917
|
+
* Uses tree-sitter to extract call expressions and build flow graph
|
|
918
|
+
*/
|
|
919
|
+
async traceFlow(projectPath, entryFile, entryFunction) {
|
|
920
|
+
const absoluteEntryFile = path.isAbsolute(entryFile)
|
|
921
|
+
? entryFile
|
|
922
|
+
: path.join(projectPath, entryFile);
|
|
923
|
+
const nodes = [];
|
|
924
|
+
const edges = [];
|
|
925
|
+
const visited = new Set();
|
|
926
|
+
// Analyze entry file
|
|
927
|
+
const analysis = await this.treeSitter.analyzeFile(absoluteEntryFile);
|
|
928
|
+
// Find entry point
|
|
929
|
+
let entrySymbol = analysis.symbols[0];
|
|
930
|
+
if (entryFunction) {
|
|
931
|
+
const found = analysis.symbols.find((s) => s.name === entryFunction && (s.kind === 'function' || s.kind === 'method'));
|
|
932
|
+
if (found)
|
|
933
|
+
entrySymbol = found;
|
|
934
|
+
}
|
|
935
|
+
if (!entrySymbol) {
|
|
936
|
+
return {
|
|
937
|
+
entryPoint: {
|
|
938
|
+
file: absoluteEntryFile,
|
|
939
|
+
symbol: 'unknown',
|
|
940
|
+
line: 1,
|
|
941
|
+
type: 'entry',
|
|
942
|
+
},
|
|
943
|
+
nodes: [],
|
|
944
|
+
edges: [],
|
|
945
|
+
mermaidDiagram: 'flowchart TD\n A[Entry] --> B[No symbols found]',
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
const entryNode = {
|
|
949
|
+
file: absoluteEntryFile,
|
|
950
|
+
symbol: entrySymbol.name,
|
|
951
|
+
line: entrySymbol.location.line,
|
|
952
|
+
type: 'entry',
|
|
953
|
+
};
|
|
954
|
+
nodes.push(entryNode);
|
|
955
|
+
// Build flow graph using file content analysis
|
|
956
|
+
await this.traceCallsFromFile(absoluteEntryFile, entryNode, nodes, edges, visited, projectPath, 3 // Max depth
|
|
957
|
+
);
|
|
958
|
+
// Generate Mermaid diagram
|
|
959
|
+
const mermaidDiagram = this.generateMermaidDiagram(nodes, edges);
|
|
960
|
+
return {
|
|
961
|
+
entryPoint: entryNode,
|
|
962
|
+
nodes,
|
|
963
|
+
edges,
|
|
964
|
+
mermaidDiagram,
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
async traceCallsFromFile(filePath, currentNode, nodes, edges, visited, projectPath, maxDepth) {
|
|
968
|
+
if (maxDepth <= 0)
|
|
969
|
+
return;
|
|
970
|
+
const nodeKey = `${filePath}:${currentNode.symbol}`;
|
|
971
|
+
if (visited.has(nodeKey))
|
|
972
|
+
return;
|
|
973
|
+
visited.add(nodeKey);
|
|
974
|
+
try {
|
|
975
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
976
|
+
const analysis = await this.treeSitter.analyzeFile(filePath);
|
|
977
|
+
// Extract function calls using regex (simple approximation)
|
|
978
|
+
// This could be enhanced with tree-sitter AST traversal
|
|
979
|
+
const callPattern = /(\w+)\s*\(/g;
|
|
980
|
+
let match;
|
|
981
|
+
const calls = [];
|
|
982
|
+
while ((match = callPattern.exec(content)) !== null) {
|
|
983
|
+
const funcName = match[1];
|
|
984
|
+
// Skip common keywords and built-ins
|
|
985
|
+
if (!/^(if|for|while|switch|return|await|async|function|const|let|var|new|typeof|instanceof|import|export|class|interface|type)$/.test(funcName)) {
|
|
986
|
+
if (!calls.includes(funcName)) {
|
|
987
|
+
calls.push(funcName);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
// Match calls to symbols in the analysis
|
|
992
|
+
for (const call of calls.slice(0, 20)) {
|
|
993
|
+
// Check if it's a local symbol
|
|
994
|
+
const localSymbol = analysis.symbols.find((s) => s.name === call);
|
|
995
|
+
if (localSymbol) {
|
|
996
|
+
const callNode = {
|
|
997
|
+
file: filePath,
|
|
998
|
+
symbol: call,
|
|
999
|
+
line: localSymbol.location.line,
|
|
1000
|
+
type: 'call',
|
|
1001
|
+
};
|
|
1002
|
+
if (!nodes.find((n) => n.file === callNode.file && n.symbol === callNode.symbol)) {
|
|
1003
|
+
nodes.push(callNode);
|
|
1004
|
+
edges.push({ from: currentNode, to: callNode });
|
|
1005
|
+
await this.traceCallsFromFile(filePath, callNode, nodes, edges, visited, projectPath, maxDepth - 1);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
// Check if it's an imported symbol
|
|
1009
|
+
for (const imp of analysis.imports) {
|
|
1010
|
+
if (imp.specifiers.includes(call)) {
|
|
1011
|
+
const resolvedPath = this.resolveImportPath(filePath, imp.source, projectPath);
|
|
1012
|
+
if (resolvedPath) {
|
|
1013
|
+
const importedAnalysis = await this.treeSitter.analyzeFile(resolvedPath);
|
|
1014
|
+
const importedSymbol = importedAnalysis.symbols.find((s) => s.name === call);
|
|
1015
|
+
if (importedSymbol) {
|
|
1016
|
+
const callNode = {
|
|
1017
|
+
file: resolvedPath,
|
|
1018
|
+
symbol: call,
|
|
1019
|
+
line: importedSymbol.location.line,
|
|
1020
|
+
type: 'call',
|
|
1021
|
+
};
|
|
1022
|
+
if (!nodes.find((n) => n.file === callNode.file && n.symbol === callNode.symbol)) {
|
|
1023
|
+
nodes.push(callNode);
|
|
1024
|
+
edges.push({ from: currentNode, to: callNode });
|
|
1025
|
+
await this.traceCallsFromFile(resolvedPath, callNode, nodes, edges, visited, projectPath, maxDepth - 1);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
catch {
|
|
1034
|
+
// File read or analysis error, skip
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
generateMermaidDiagram(nodes, edges) {
|
|
1038
|
+
if (nodes.length === 0) {
|
|
1039
|
+
return 'flowchart TD\n A[No nodes]';
|
|
1040
|
+
}
|
|
1041
|
+
const lines = ['flowchart TD'];
|
|
1042
|
+
const nodeIds = new Map();
|
|
1043
|
+
// Assign IDs to nodes
|
|
1044
|
+
nodes.forEach((node, index) => {
|
|
1045
|
+
const key = `${node.file}:${node.symbol}`;
|
|
1046
|
+
nodeIds.set(key, `N${index}`);
|
|
1047
|
+
});
|
|
1048
|
+
// Add nodes
|
|
1049
|
+
for (const node of nodes) {
|
|
1050
|
+
const key = `${node.file}:${node.symbol}`;
|
|
1051
|
+
const id = nodeIds.get(key);
|
|
1052
|
+
const label = `${node.symbol}`;
|
|
1053
|
+
const shape = node.type === 'entry' ? `([${label}])` : `[${label}]`;
|
|
1054
|
+
lines.push(` ${id}${shape}`);
|
|
1055
|
+
}
|
|
1056
|
+
// Add edges
|
|
1057
|
+
for (const edge of edges) {
|
|
1058
|
+
const fromKey = `${edge.from.file}:${edge.from.symbol}`;
|
|
1059
|
+
const toKey = `${edge.to.file}:${edge.to.symbol}`;
|
|
1060
|
+
const fromId = nodeIds.get(fromKey);
|
|
1061
|
+
const toId = nodeIds.get(toKey);
|
|
1062
|
+
if (fromId && toId) {
|
|
1063
|
+
const label = edge.label ? `|${edge.label}|` : '';
|
|
1064
|
+
lines.push(` ${fromId} -->${label} ${toId}`);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return lines.join('\n');
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
exports.CodebaseAnalyzer = CodebaseAnalyzer;
|
|
1071
|
+
//# sourceMappingURL=codebaseAnalyzer.js.map
|