autosnippet 3.2.21 → 3.3.2
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/dashboard/dist/assets/icons-BJ2mUBi8.js +1 -0
- package/dashboard/dist/assets/index-B659K9t5.js +128 -0
- package/dashboard/dist/assets/index-NCm40PMD.css +1 -0
- package/dashboard/dist/index.html +3 -3
- package/dist/bin/cli.d.ts +1 -1
- package/dist/bin/cli.js +244 -261
- package/dist/lib/agent/context/ExplorationTracker.d.ts +2 -0
- package/dist/lib/agent/context/ExplorationTracker.js +21 -3
- package/dist/lib/agent/core/ToolExecutionPipeline.d.ts +3 -1
- package/dist/lib/agent/core/ToolExecutionPipeline.js +8 -1
- package/dist/lib/agent/forge/DynamicComposer.d.ts +58 -0
- package/dist/lib/agent/forge/DynamicComposer.js +99 -0
- package/dist/lib/agent/forge/SandboxRunner.d.ts +60 -0
- package/dist/lib/agent/forge/SandboxRunner.js +251 -0
- package/dist/lib/agent/forge/TemporaryToolRegistry.d.ts +76 -0
- package/dist/lib/agent/forge/TemporaryToolRegistry.js +154 -0
- package/dist/lib/agent/forge/ToolForge.d.ts +92 -0
- package/dist/lib/agent/forge/ToolForge.js +239 -0
- package/dist/lib/agent/forge/ToolRequirementAnalyzer.d.ts +44 -0
- package/dist/lib/agent/forge/ToolRequirementAnalyzer.js +119 -0
- package/dist/lib/agent/tools/ToolRegistry.d.ts +2 -0
- package/dist/lib/agent/tools/ToolRegistry.js +4 -0
- package/dist/lib/agent/tools/composite.js +0 -1
- package/dist/lib/agent/tools/index.d.ts +2 -50
- package/dist/lib/agent/tools/index.js +2 -3
- package/dist/lib/agent/tools/lifecycle.d.ts +1 -58
- package/dist/lib/agent/tools/lifecycle.js +2 -75
- package/dist/lib/cli/SetupService.d.ts +46 -2
- package/dist/lib/cli/SetupService.js +2 -27
- package/dist/lib/cli/deploy/FileManifest.d.ts +0 -21
- package/dist/lib/cli/deploy/FileManifest.js +0 -11
- package/dist/lib/{platform/ios/spm → core/discovery}/SpmDiscoverer.d.ts +2 -5
- package/dist/lib/{platform/ios/spm → core/discovery}/SpmDiscoverer.js +159 -44
- package/dist/lib/core/discovery/index.d.ts +1 -1
- package/dist/lib/core/discovery/index.js +2 -2
- package/dist/lib/domain/knowledge/KnowledgeEntry.d.ts +10 -0
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +2 -0
- package/dist/lib/domain/knowledge/Lifecycle.d.ts +19 -2
- package/dist/lib/domain/knowledge/Lifecycle.js +32 -6
- package/dist/lib/domain/knowledge/UnifiedValidator.d.ts +1 -5
- package/dist/lib/domain/knowledge/UnifiedValidator.js +7 -44
- package/dist/lib/domain/knowledge/values/Stats.d.ts +29 -0
- package/dist/lib/domain/knowledge/values/Stats.js +41 -0
- package/dist/lib/external/mcp/McpServer.d.ts +19 -38
- package/dist/lib/external/mcp/McpServer.js +145 -117
- package/dist/lib/external/mcp/autoApproveInjector.js +0 -2
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.d.ts +26 -1
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +41 -0
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +49 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +3 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +27 -0
- package/dist/lib/external/mcp/handlers/bootstrap/skills.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +1 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +2 -0
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +116 -6
- package/dist/lib/external/mcp/handlers/consolidated.js +251 -71
- package/dist/lib/external/mcp/handlers/guard.d.ts +150 -0
- package/dist/lib/external/mcp/handlers/guard.js +245 -8
- package/dist/lib/external/mcp/handlers/knowledge.d.ts +0 -29
- package/dist/lib/external/mcp/handlers/knowledge.js +1 -76
- package/dist/lib/external/mcp/handlers/panorama.d.ts +36 -0
- package/dist/lib/external/mcp/handlers/panorama.js +156 -0
- package/dist/lib/external/mcp/handlers/system.d.ts +2 -54
- package/dist/lib/external/mcp/handlers/system.js +3 -113
- package/dist/lib/external/mcp/handlers/task.d.ts +13 -24
- package/dist/lib/external/mcp/handlers/task.js +217 -557
- package/dist/lib/external/mcp/handlers/types.d.ts +91 -8
- package/dist/lib/external/mcp/handlers/types.js +18 -1
- package/dist/lib/external/mcp/handlers/wiki-external.d.ts +18 -1
- package/dist/lib/external/mcp/handlers/wiki-external.js +16 -1
- package/dist/lib/external/mcp/tools.d.ts +14 -20
- package/dist/lib/external/mcp/tools.js +62 -91
- package/dist/lib/http/HttpServer.js +52 -6
- package/dist/lib/http/routes/{snippets.d.ts → audit.d.ts} +4 -2
- package/dist/lib/http/routes/audit.js +51 -0
- package/dist/lib/http/routes/commands.d.ts +1 -1
- package/dist/lib/http/routes/commands.js +1 -66
- package/dist/lib/http/routes/guardReport.d.ts +10 -0
- package/dist/lib/http/routes/guardReport.js +143 -0
- package/dist/lib/http/routes/knowledge.js +32 -1
- package/dist/lib/http/routes/panorama.d.ts +11 -0
- package/dist/lib/http/routes/panorama.js +322 -0
- package/dist/lib/http/routes/remote.js +0 -5
- package/dist/lib/http/routes/signals.d.ts +10 -0
- package/dist/lib/http/routes/signals.js +104 -0
- package/dist/lib/http/routes/task.d.ts +2 -3
- package/dist/lib/http/routes/task.js +17 -347
- package/dist/lib/http/routes/violations.js +1 -1
- package/dist/lib/infrastructure/audit/AuditLogger.d.ts +6 -1
- package/dist/lib/infrastructure/audit/AuditLogger.js +14 -1
- package/dist/lib/infrastructure/database/drizzle/schema.d.ts +181 -583
- package/dist/lib/infrastructure/database/drizzle/schema.js +28 -69
- package/dist/lib/infrastructure/database/migrations/004_evolution_proposals.d.ts +8 -0
- package/dist/lib/infrastructure/database/migrations/004_evolution_proposals.js +43 -0
- package/dist/lib/infrastructure/logging/Logger.d.ts +2 -0
- package/dist/lib/infrastructure/logging/Logger.js +34 -7
- package/dist/lib/infrastructure/monitoring/ErrorTracker.js +3 -1
- package/dist/lib/infrastructure/monitoring/PerformanceMonitor.d.ts +2 -2
- package/dist/lib/infrastructure/monitoring/PerformanceMonitor.js +12 -10
- package/dist/lib/infrastructure/notification/LarkNotifier.d.ts +24 -0
- package/dist/lib/infrastructure/notification/LarkNotifier.js +97 -0
- package/dist/lib/infrastructure/report/ReportStore.d.ts +45 -0
- package/dist/lib/infrastructure/report/ReportStore.js +133 -0
- package/dist/lib/infrastructure/signal/SignalAggregator.d.ts +18 -0
- package/dist/lib/infrastructure/signal/SignalAggregator.js +84 -0
- package/dist/lib/infrastructure/signal/SignalBridge.d.ts +13 -0
- package/dist/lib/infrastructure/signal/SignalBridge.js +20 -0
- package/dist/lib/infrastructure/signal/SignalBus.d.ts +63 -0
- package/dist/lib/infrastructure/signal/SignalBus.js +106 -0
- package/dist/lib/infrastructure/signal/SignalTraceWriter.d.ts +36 -0
- package/dist/lib/infrastructure/signal/SignalTraceWriter.js +130 -0
- package/dist/lib/injection/ServiceContainer.js +6 -0
- package/dist/lib/injection/ServiceMap.d.ts +16 -19
- package/dist/lib/injection/modules/AgentModule.d.ts +1 -1
- package/dist/lib/injection/modules/AgentModule.js +7 -1
- package/dist/lib/injection/modules/AppModule.d.ts +3 -4
- package/dist/lib/injection/modules/AppModule.js +7 -43
- package/dist/lib/injection/modules/GuardModule.js +59 -2
- package/dist/lib/injection/modules/InfraModule.d.ts +0 -1
- package/dist/lib/injection/modules/InfraModule.js +9 -7
- package/dist/lib/injection/modules/KnowledgeModule.js +51 -0
- package/dist/lib/injection/modules/PanoramaModule.d.ts +18 -0
- package/dist/lib/injection/modules/PanoramaModule.js +76 -0
- package/dist/lib/injection/modules/SignalModule.d.ts +10 -0
- package/dist/lib/injection/modules/SignalModule.js +84 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +1 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +6 -0
- package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +3 -1
- package/dist/lib/service/bootstrap/BootstrapTaskManager.js +20 -1
- package/dist/lib/service/delivery/AgentInstructionsGenerator.js +4 -5
- package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +3 -1
- package/dist/lib/service/delivery/CursorDeliveryPipeline.js +13 -10
- package/dist/lib/service/delivery/RulesGenerator.js +3 -2
- package/dist/lib/service/evolution/ConsolidationAdvisor.d.ts +114 -0
- package/dist/lib/service/evolution/ConsolidationAdvisor.js +542 -0
- package/dist/lib/service/evolution/ContradictionDetector.d.ts +54 -0
- package/dist/lib/service/evolution/ContradictionDetector.js +253 -0
- package/dist/lib/service/evolution/DecayDetector.d.ts +71 -0
- package/dist/lib/service/evolution/DecayDetector.js +244 -0
- package/dist/lib/service/evolution/EnhancementSuggester.d.ts +38 -0
- package/dist/lib/service/evolution/EnhancementSuggester.js +220 -0
- package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +82 -0
- package/dist/lib/service/evolution/KnowledgeMetabolism.js +167 -0
- package/dist/lib/service/evolution/RedundancyAnalyzer.d.ts +53 -0
- package/dist/lib/service/evolution/RedundancyAnalyzer.js +210 -0
- package/dist/lib/service/evolution/StagingManager.d.ts +57 -0
- package/dist/lib/service/evolution/StagingManager.js +201 -0
- package/dist/lib/service/guard/ComplianceReporter.d.ts +42 -2
- package/dist/lib/service/guard/ComplianceReporter.js +43 -5
- package/dist/lib/service/guard/CoverageAnalyzer.d.ts +54 -0
- package/dist/lib/service/guard/CoverageAnalyzer.js +149 -0
- package/dist/lib/service/guard/GuardCheckEngine.d.ts +55 -1
- package/dist/lib/service/guard/GuardCheckEngine.js +508 -15
- package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -0
- package/dist/lib/service/guard/GuardFeedbackLoop.js +9 -0
- package/dist/lib/service/guard/ReverseGuard.d.ts +73 -0
- package/dist/lib/service/guard/ReverseGuard.js +256 -0
- package/dist/lib/service/guard/RuleLearner.d.ts +12 -0
- package/dist/lib/service/guard/RuleLearner.js +38 -0
- package/dist/lib/service/guard/UncertaintyCollector.d.ts +83 -0
- package/dist/lib/service/guard/UncertaintyCollector.js +149 -0
- package/dist/lib/service/guard/ViolationsStore.d.ts +1 -0
- package/dist/lib/service/guard/ViolationsStore.js +33 -3
- package/dist/lib/service/knowledge/ConfidenceRouter.d.ts +13 -0
- package/dist/lib/service/knowledge/ConfidenceRouter.js +14 -0
- package/dist/lib/service/knowledge/KnowledgeService.js +22 -4
- package/dist/lib/service/module/ModuleService.js +3 -13
- package/dist/lib/service/panorama/CouplingAnalyzer.d.ts +27 -0
- package/dist/lib/service/panorama/CouplingAnalyzer.js +192 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +28 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.js +320 -0
- package/dist/lib/service/panorama/LayerInferrer.d.ts +19 -0
- package/dist/lib/service/panorama/LayerInferrer.js +182 -0
- package/dist/lib/service/panorama/ModuleDiscoverer.d.ts +24 -0
- package/dist/lib/service/panorama/ModuleDiscoverer.js +185 -0
- package/dist/lib/service/panorama/PanoramaAggregator.d.ts +29 -0
- package/dist/lib/service/panorama/PanoramaAggregator.js +228 -0
- package/dist/lib/service/panorama/PanoramaScanner.d.ts +52 -0
- package/dist/lib/service/panorama/PanoramaScanner.js +188 -0
- package/dist/lib/service/panorama/PanoramaService.d.ts +108 -0
- package/dist/lib/service/panorama/PanoramaService.js +220 -0
- package/dist/lib/service/panorama/PanoramaTypes.d.ts +134 -0
- package/dist/lib/service/panorama/PanoramaTypes.js +6 -0
- package/dist/lib/service/panorama/RoleRefiner.d.ts +48 -0
- package/dist/lib/service/panorama/RoleRefiner.js +535 -0
- package/dist/lib/service/search/MultiSignalRanker.d.ts +1 -0
- package/dist/lib/service/search/MultiSignalRanker.js +16 -0
- package/dist/lib/service/search/SearchEngine.d.ts +1 -0
- package/dist/lib/service/search/SearchEngine.js +9 -1
- package/dist/lib/service/search/SearchTypes.d.ts +2 -0
- package/dist/lib/service/signal/HitRecorder.d.ts +68 -0
- package/dist/lib/service/signal/HitRecorder.js +173 -0
- package/dist/lib/service/skills/SignalCollector.d.ts +3 -1
- package/dist/lib/service/skills/SignalCollector.js +31 -1
- package/dist/lib/service/task/IntentExtractor.d.ts +58 -0
- package/dist/lib/service/task/IntentExtractor.js +142 -0
- package/dist/lib/service/task/PrimeSearchPipeline.d.ts +54 -0
- package/dist/lib/service/task/PrimeSearchPipeline.js +98 -0
- package/dist/lib/shared/constants.d.ts +0 -15
- package/dist/lib/shared/constants.js +0 -10
- package/dist/lib/shared/schemas/config.d.ts +4 -1
- package/dist/lib/shared/schemas/config.js +8 -1
- package/dist/lib/shared/schemas/mcp-tools.d.ts +41 -96
- package/dist/lib/shared/schemas/mcp-tools.js +59 -119
- package/dist/scripts/analyze-signals.d.ts +20 -0
- package/dist/scripts/analyze-signals.js +155 -0
- package/dist/scripts/diagnose-mcp.js +1 -1
- package/dist/scripts/release.js +2 -10
- package/package.json +4 -19
- package/skills/autosnippet-devdocs/SKILL.md +11 -8
- package/templates/claude-code/hooks/autosnippet-session.sh +10 -15
- package/templates/cursor-hooks/hooks/session-start.sh +1 -1
- package/templates/instructions/agent-static.md +2 -1
- package/templates/instructions/conventions.md +5 -6
- package/templates/recipes-setup/README.md +1 -2
- package/dashboard/dist/assets/icons-C1dUryS-.js +0 -1
- package/dashboard/dist/assets/index-D0whuycy.css +0 -1
- package/dashboard/dist/assets/index-DdvZE4Yd.js +0 -128
- package/dist/lib/domain/task/Task.d.ts +0 -140
- package/dist/lib/domain/task/Task.js +0 -254
- package/dist/lib/domain/task/TaskDependency.d.ts +0 -23
- package/dist/lib/domain/task/TaskDependency.js +0 -34
- package/dist/lib/domain/task/TaskIdGenerator.d.ts +0 -40
- package/dist/lib/domain/task/TaskIdGenerator.js +0 -75
- package/dist/lib/domain/task/index.d.ts +0 -4
- package/dist/lib/domain/task/index.js +0 -4
- package/dist/lib/http/routes/snippets.js +0 -49
- package/dist/lib/infrastructure/database/migrations/002_add_tasks.d.ts +0 -11
- package/dist/lib/infrastructure/database/migrations/002_add_tasks.js +0 -86
- package/dist/lib/platform/ClipboardManager.d.ts +0 -24
- package/dist/lib/platform/ClipboardManager.js +0 -142
- package/dist/lib/platform/NativeUi.d.ts +0 -53
- package/dist/lib/platform/NativeUi.js +0 -284
- package/dist/lib/platform/ios/index.d.ts +0 -38
- package/dist/lib/platform/ios/index.js +0 -42
- package/dist/lib/platform/ios/routes/spm.d.ts +0 -9
- package/dist/lib/platform/ios/routes/spm.js +0 -371
- package/dist/lib/platform/ios/snippet/PlaceholderConverter.d.ts +0 -21
- package/dist/lib/platform/ios/snippet/PlaceholderConverter.js +0 -48
- package/dist/lib/platform/ios/snippet/XcodeCodec.d.ts +0 -23
- package/dist/lib/platform/ios/snippet/XcodeCodec.js +0 -96
- package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +0 -56
- package/dist/lib/platform/ios/spm/DependencyGraph.js +0 -195
- package/dist/lib/platform/ios/spm/PackageSwiftParser.d.ts +0 -69
- package/dist/lib/platform/ios/spm/PackageSwiftParser.js +0 -231
- package/dist/lib/platform/ios/spm/PathFinder.d.ts +0 -28
- package/dist/lib/platform/ios/spm/PathFinder.js +0 -117
- package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +0 -44
- package/dist/lib/platform/ios/spm/PolicyEngine.js +0 -79
- package/dist/lib/platform/ios/spm/SpmHelper.d.ts +0 -102
- package/dist/lib/platform/ios/spm/SpmHelper.js +0 -464
- package/dist/lib/platform/ios/xcode/HeaderResolver.d.ts +0 -33
- package/dist/lib/platform/ios/xcode/HeaderResolver.js +0 -90
- package/dist/lib/platform/ios/xcode/SaveEventFilter.d.ts +0 -66
- package/dist/lib/platform/ios/xcode/SaveEventFilter.js +0 -142
- package/dist/lib/platform/ios/xcode/XcodeAutomation.d.ts +0 -71
- package/dist/lib/platform/ios/xcode/XcodeAutomation.js +0 -327
- package/dist/lib/platform/ios/xcode/XcodeImportResolver.d.ts +0 -130
- package/dist/lib/platform/ios/xcode/XcodeImportResolver.js +0 -404
- package/dist/lib/platform/ios/xcode/XcodeIntegration.d.ts +0 -89
- package/dist/lib/platform/ios/xcode/XcodeIntegration.js +0 -588
- package/dist/lib/platform/ios/xcode/XcodeWriteUtils.d.ts +0 -99
- package/dist/lib/platform/ios/xcode/XcodeWriteUtils.js +0 -190
- package/dist/lib/repository/task/TaskRepository.impl.d.ts +0 -171
- package/dist/lib/repository/task/TaskRepository.impl.js +0 -347
- package/dist/lib/service/automation/ActionPipeline.d.ts +0 -34
- package/dist/lib/service/automation/ActionPipeline.js +0 -53
- package/dist/lib/service/automation/AutomationOrchestrator.d.ts +0 -86
- package/dist/lib/service/automation/AutomationOrchestrator.js +0 -57
- package/dist/lib/service/automation/ContextCollector.d.ts +0 -24
- package/dist/lib/service/automation/ContextCollector.js +0 -35
- package/dist/lib/service/automation/DirectiveDetector.d.ts +0 -51
- package/dist/lib/service/automation/DirectiveDetector.js +0 -112
- package/dist/lib/service/automation/FileWatcher.d.ts +0 -51
- package/dist/lib/service/automation/FileWatcher.js +0 -366
- package/dist/lib/service/automation/TriggerResolver.d.ts +0 -36
- package/dist/lib/service/automation/TriggerResolver.js +0 -62
- package/dist/lib/service/automation/handlers/AlinkHandler.d.ts +0 -7
- package/dist/lib/service/automation/handlers/AlinkHandler.js +0 -80
- package/dist/lib/service/automation/handlers/CreateHandler.d.ts +0 -11
- package/dist/lib/service/automation/handlers/CreateHandler.js +0 -170
- package/dist/lib/service/automation/handlers/GuardHandler.d.ts +0 -17
- package/dist/lib/service/automation/handlers/GuardHandler.js +0 -218
- package/dist/lib/service/automation/handlers/HeaderHandler.d.ts +0 -2
- package/dist/lib/service/automation/handlers/HeaderHandler.js +0 -32
- package/dist/lib/service/automation/handlers/SearchHandler.d.ts +0 -11
- package/dist/lib/service/automation/handlers/SearchHandler.js +0 -278
- package/dist/lib/service/snippet/SnippetFactory.d.ts +0 -101
- package/dist/lib/service/snippet/SnippetFactory.js +0 -145
- package/dist/lib/service/snippet/SnippetInstaller.d.ts +0 -91
- package/dist/lib/service/snippet/SnippetInstaller.js +0 -276
- package/dist/lib/service/snippet/codecs/SnippetCodec.d.ts +0 -44
- package/dist/lib/service/snippet/codecs/SnippetCodec.js +0 -35
- package/dist/lib/service/snippet/codecs/VSCodeCodec.d.ts +0 -27
- package/dist/lib/service/snippet/codecs/VSCodeCodec.js +0 -82
- package/dist/lib/service/task/TaskGraphService.d.ts +0 -222
- package/dist/lib/service/task/TaskGraphService.js +0 -597
- package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +0 -95
- package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -298
- package/dist/lib/service/task/TaskReadyEngine.d.ts +0 -84
- package/dist/lib/service/task/TaskReadyEngine.js +0 -115
- package/dist/scripts/build-native-ui.d.ts +0 -3
- package/dist/scripts/build-native-ui.js +0 -62
- package/dist/scripts/init-snippets.d.ts +0 -30
- package/dist/scripts/init-snippets.js +0 -298
- package/dist/scripts/install-full.d.ts +0 -7
- package/dist/scripts/install-full.js +0 -38
- package/resources/native-ui/README.md +0 -29
- package/resources/native-ui/combined-window.swift +0 -494
- package/resources/native-ui/main.swift +0 -598
- package/scripts/postinstall-safe.mjs +0 -89
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PanoramaService — 全景服务主入口
|
|
3
|
+
*
|
|
4
|
+
* 提供 4 个 operation:
|
|
5
|
+
* overview — 项目骨架 + 层级 + token 预算截断
|
|
6
|
+
* module — 单模块详情 + Recipe 覆盖率
|
|
7
|
+
* gaps — 知识空白区 (有代码无 Recipe)
|
|
8
|
+
* health — 全景健康度 (覆盖率 + 耦合度 + 衰退)
|
|
9
|
+
*
|
|
10
|
+
* 模块发现委托给 ModuleDiscoverer(SRP)。
|
|
11
|
+
* 内存缓存 + 24h 过期策略。
|
|
12
|
+
*
|
|
13
|
+
* @module PanoramaService
|
|
14
|
+
*/
|
|
15
|
+
import type { SignalBus } from '../../infrastructure/signal/SignalBus.js';
|
|
16
|
+
import { ModuleDiscoverer } from './ModuleDiscoverer.js';
|
|
17
|
+
import type { PanoramaAggregator } from './PanoramaAggregator.js';
|
|
18
|
+
import type { PanoramaScanner } from './PanoramaScanner.js';
|
|
19
|
+
import type { CeDbLike, HealthRadar, KnowledgeGap, PanoramaModule, PanoramaResult } from './PanoramaTypes.js';
|
|
20
|
+
export interface PanoramaServiceOptions {
|
|
21
|
+
aggregator: PanoramaAggregator;
|
|
22
|
+
db: CeDbLike;
|
|
23
|
+
projectRoot: string;
|
|
24
|
+
scanner?: PanoramaScanner;
|
|
25
|
+
moduleDiscoverer?: ModuleDiscoverer;
|
|
26
|
+
signalBus?: SignalBus;
|
|
27
|
+
}
|
|
28
|
+
export interface PanoramaOverview {
|
|
29
|
+
projectRoot: string;
|
|
30
|
+
moduleCount: number;
|
|
31
|
+
layerCount: number;
|
|
32
|
+
totalFiles: number;
|
|
33
|
+
totalRecipes: number;
|
|
34
|
+
overallCoverage: number;
|
|
35
|
+
layers: Array<{
|
|
36
|
+
level: number;
|
|
37
|
+
name: string;
|
|
38
|
+
modules: Array<{
|
|
39
|
+
name: string;
|
|
40
|
+
role: string;
|
|
41
|
+
fileCount: number;
|
|
42
|
+
recipeCount: number;
|
|
43
|
+
}>;
|
|
44
|
+
}>;
|
|
45
|
+
cycleCount: number;
|
|
46
|
+
gapCount: number;
|
|
47
|
+
/** 多维度知识健康雷达 */
|
|
48
|
+
healthRadar: HealthRadar;
|
|
49
|
+
computedAt: number;
|
|
50
|
+
stale: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface PanoramaModuleDetail {
|
|
53
|
+
module: PanoramaModule;
|
|
54
|
+
layerName: string;
|
|
55
|
+
neighbors: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
direction: 'in' | 'out';
|
|
58
|
+
weight: number;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
export interface PanoramaHealth {
|
|
62
|
+
/** 多维度知识健康雷达 */
|
|
63
|
+
healthRadar: HealthRadar;
|
|
64
|
+
avgCoupling: number;
|
|
65
|
+
cycleCount: number;
|
|
66
|
+
gapCount: number;
|
|
67
|
+
highPriorityGaps: number;
|
|
68
|
+
moduleCount: number;
|
|
69
|
+
/** 综合健康分 0-100 (维度覆盖 60 + 无循环 20 + 无高优空白 10 + 耦合适中 10) */
|
|
70
|
+
healthScore: number;
|
|
71
|
+
}
|
|
72
|
+
export declare class PanoramaService {
|
|
73
|
+
#private;
|
|
74
|
+
constructor(opts: PanoramaServiceOptions);
|
|
75
|
+
/**
|
|
76
|
+
* 获取项目全景概览
|
|
77
|
+
*/
|
|
78
|
+
getOverview(): PanoramaOverview;
|
|
79
|
+
/**
|
|
80
|
+
* 获取单模块详情
|
|
81
|
+
*/
|
|
82
|
+
getModule(moduleName: string): PanoramaModuleDetail | null;
|
|
83
|
+
/**
|
|
84
|
+
* 获取知识空白区
|
|
85
|
+
*/
|
|
86
|
+
getGaps(): KnowledgeGap[];
|
|
87
|
+
/**
|
|
88
|
+
* 获取全景健康度
|
|
89
|
+
*/
|
|
90
|
+
getHealth(): PanoramaHealth;
|
|
91
|
+
/**
|
|
92
|
+
* 获取完整 PanoramaResult(内部使用或 Bootstrap 注入)
|
|
93
|
+
*/
|
|
94
|
+
getResult(): PanoramaResult;
|
|
95
|
+
/**
|
|
96
|
+
* 确保全景数据已就绪(无数据时自动扫描)
|
|
97
|
+
* MCP handler / HTTP route 应在返回数据前调用此方法
|
|
98
|
+
*/
|
|
99
|
+
ensureData(): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* 强制刷新缓存
|
|
102
|
+
*/
|
|
103
|
+
invalidate(): void;
|
|
104
|
+
/**
|
|
105
|
+
* 强制重新扫描(invalidate + 重置 scanner)
|
|
106
|
+
*/
|
|
107
|
+
rescan(): Promise<void>;
|
|
108
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PanoramaService — 全景服务主入口
|
|
3
|
+
*
|
|
4
|
+
* 提供 4 个 operation:
|
|
5
|
+
* overview — 项目骨架 + 层级 + token 预算截断
|
|
6
|
+
* module — 单模块详情 + Recipe 覆盖率
|
|
7
|
+
* gaps — 知识空白区 (有代码无 Recipe)
|
|
8
|
+
* health — 全景健康度 (覆盖率 + 耦合度 + 衰退)
|
|
9
|
+
*
|
|
10
|
+
* 模块发现委托给 ModuleDiscoverer(SRP)。
|
|
11
|
+
* 内存缓存 + 24h 过期策略。
|
|
12
|
+
*
|
|
13
|
+
* @module PanoramaService
|
|
14
|
+
*/
|
|
15
|
+
import { ModuleDiscoverer } from './ModuleDiscoverer.js';
|
|
16
|
+
/* ═══ Constants ═══════════════════════════════════════════ */
|
|
17
|
+
const STALE_THRESHOLD_MS = 24 * 60 * 60 * 1000; // 24h
|
|
18
|
+
/* ═══ PanoramaService Class ═══════════════════════════════ */
|
|
19
|
+
export class PanoramaService {
|
|
20
|
+
#aggregator;
|
|
21
|
+
#db;
|
|
22
|
+
#projectRoot;
|
|
23
|
+
#scanner;
|
|
24
|
+
#moduleDiscoverer;
|
|
25
|
+
#signalBus;
|
|
26
|
+
#cache = null;
|
|
27
|
+
#scanPromise = null;
|
|
28
|
+
#lastOverview = null;
|
|
29
|
+
constructor(opts) {
|
|
30
|
+
this.#aggregator = opts.aggregator;
|
|
31
|
+
this.#db = opts.db;
|
|
32
|
+
this.#projectRoot = opts.projectRoot;
|
|
33
|
+
this.#scanner = opts.scanner ?? null;
|
|
34
|
+
this.#moduleDiscoverer =
|
|
35
|
+
opts.moduleDiscoverer ?? new ModuleDiscoverer(opts.db, opts.projectRoot);
|
|
36
|
+
this.#signalBus = opts.signalBus ?? null;
|
|
37
|
+
// Phase 2: 订阅信号标记缓存失效
|
|
38
|
+
if (this.#signalBus) {
|
|
39
|
+
this.#signalBus.subscribe('guard|lifecycle|usage', () => {
|
|
40
|
+
this.#cache = null;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/* ─── Public API ────────────────────────────────── */
|
|
45
|
+
/**
|
|
46
|
+
* 获取项目全景概览
|
|
47
|
+
*/
|
|
48
|
+
getOverview() {
|
|
49
|
+
const result = this.#getOrCompute();
|
|
50
|
+
const isStale = Date.now() - result.computedAt > STALE_THRESHOLD_MS;
|
|
51
|
+
let totalFiles = 0;
|
|
52
|
+
for (const [, mod] of result.modules) {
|
|
53
|
+
totalFiles += mod.fileCount;
|
|
54
|
+
}
|
|
55
|
+
// 使用项目级 recipe 总数,而非 per-module 之和
|
|
56
|
+
// 因为大多数 recipe scope 为 universal,无法匹配到具体模块
|
|
57
|
+
const totalRecipes = result.projectRecipeCount;
|
|
58
|
+
const overview = {
|
|
59
|
+
projectRoot: this.#projectRoot,
|
|
60
|
+
moduleCount: result.modules.size,
|
|
61
|
+
layerCount: result.layers.levels.length,
|
|
62
|
+
totalFiles,
|
|
63
|
+
totalRecipes,
|
|
64
|
+
overallCoverage: totalFiles > 0 ? totalRecipes / totalFiles : 0,
|
|
65
|
+
layers: result.layers.levels.map((l) => ({
|
|
66
|
+
level: l.level,
|
|
67
|
+
name: l.name,
|
|
68
|
+
modules: l.modules.map((mName) => {
|
|
69
|
+
const mod = result.modules.get(mName);
|
|
70
|
+
return {
|
|
71
|
+
name: mName,
|
|
72
|
+
role: mod?.refinedRole ?? 'feature',
|
|
73
|
+
fileCount: mod?.fileCount ?? 0,
|
|
74
|
+
recipeCount: mod?.recipeCount ?? 0,
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
})),
|
|
78
|
+
cycleCount: result.cycles.length,
|
|
79
|
+
gapCount: result.gaps.length,
|
|
80
|
+
healthRadar: result.healthRadar,
|
|
81
|
+
computedAt: result.computedAt,
|
|
82
|
+
stale: isStale,
|
|
83
|
+
};
|
|
84
|
+
// Phase 3: 发射 panorama 信号 — 覆盖率/健康度变化检测
|
|
85
|
+
if (this.#signalBus && this.#lastOverview) {
|
|
86
|
+
if (Math.abs(overview.overallCoverage - this.#lastOverview.overallCoverage) >= 0.05) {
|
|
87
|
+
this.#signalBus.send('panorama', 'PanoramaService.coverage', overview.overallCoverage, {
|
|
88
|
+
metadata: {
|
|
89
|
+
oldCoverage: this.#lastOverview.overallCoverage,
|
|
90
|
+
newCoverage: overview.overallCoverage,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
this.#lastOverview = overview;
|
|
96
|
+
return overview;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 获取单模块详情
|
|
100
|
+
*/
|
|
101
|
+
getModule(moduleName) {
|
|
102
|
+
const result = this.#getOrCompute();
|
|
103
|
+
const mod = result.modules.get(moduleName);
|
|
104
|
+
if (!mod) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
// 找到该模块所在层级
|
|
108
|
+
const layerName = result.layers.levels.find((l) => l.modules.includes(moduleName))?.name ?? 'Unknown';
|
|
109
|
+
// 从 DB 查邻居边
|
|
110
|
+
const neighbors = [];
|
|
111
|
+
const outNeighbors = this.#db
|
|
112
|
+
.prepare(`SELECT DISTINCT to_id, weight FROM knowledge_edges
|
|
113
|
+
WHERE from_id = ? AND from_type = 'module' AND relation = 'depends_on'`)
|
|
114
|
+
.all(moduleName);
|
|
115
|
+
for (const n of outNeighbors) {
|
|
116
|
+
neighbors.push({
|
|
117
|
+
name: n.to_id,
|
|
118
|
+
direction: 'out',
|
|
119
|
+
weight: Number(n.weight ?? 1),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const inNeighbors = this.#db
|
|
123
|
+
.prepare(`SELECT DISTINCT from_id, weight FROM knowledge_edges
|
|
124
|
+
WHERE to_id = ? AND to_type = 'module' AND relation = 'depends_on'`)
|
|
125
|
+
.all(moduleName);
|
|
126
|
+
for (const n of inNeighbors) {
|
|
127
|
+
neighbors.push({
|
|
128
|
+
name: n.from_id,
|
|
129
|
+
direction: 'in',
|
|
130
|
+
weight: Number(n.weight ?? 1),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return { module: mod, layerName, neighbors };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 获取知识空白区
|
|
137
|
+
*/
|
|
138
|
+
getGaps() {
|
|
139
|
+
const result = this.#getOrCompute();
|
|
140
|
+
return result.gaps;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 获取全景健康度
|
|
144
|
+
*/
|
|
145
|
+
getHealth() {
|
|
146
|
+
const result = this.#getOrCompute();
|
|
147
|
+
let totalCoupling = 0;
|
|
148
|
+
let count = 0;
|
|
149
|
+
for (const [, mod] of result.modules) {
|
|
150
|
+
totalCoupling += mod.fanIn + mod.fanOut;
|
|
151
|
+
count++;
|
|
152
|
+
}
|
|
153
|
+
const avgCoupling = count > 0 ? totalCoupling / count : 0;
|
|
154
|
+
const highPriorityGaps = result.gaps.filter((g) => g.priority === 'high').length;
|
|
155
|
+
const radar = result.healthRadar;
|
|
156
|
+
// 健康分: 100 分制 (基于维度覆盖率 + 结构健康)
|
|
157
|
+
// 维度覆盖 60 分 + 无循环 20 分 + 无高优空白 10 分 + 耦合度适中 10 分
|
|
158
|
+
let healthScore = radar.overallScore * 0.6;
|
|
159
|
+
healthScore += result.cycles.length === 0 ? 20 : Math.max(0, 20 - result.cycles.length * 5);
|
|
160
|
+
healthScore += highPriorityGaps === 0 ? 10 : Math.max(0, 10 - highPriorityGaps * 2);
|
|
161
|
+
healthScore += avgCoupling < 10 ? 10 : Math.max(0, 10 - (avgCoupling - 10));
|
|
162
|
+
healthScore = Math.round(Math.max(0, Math.min(100, healthScore)));
|
|
163
|
+
return {
|
|
164
|
+
healthRadar: radar,
|
|
165
|
+
avgCoupling,
|
|
166
|
+
cycleCount: result.cycles.length,
|
|
167
|
+
gapCount: result.gaps.length,
|
|
168
|
+
highPriorityGaps,
|
|
169
|
+
moduleCount: count,
|
|
170
|
+
healthScore,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* 获取完整 PanoramaResult(内部使用或 Bootstrap 注入)
|
|
175
|
+
*/
|
|
176
|
+
getResult() {
|
|
177
|
+
return this.#getOrCompute();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* 确保全景数据已就绪(无数据时自动扫描)
|
|
181
|
+
* MCP handler / HTTP route 应在返回数据前调用此方法
|
|
182
|
+
*/
|
|
183
|
+
async ensureData() {
|
|
184
|
+
if (!this.#scanner) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (!this.#scanPromise) {
|
|
188
|
+
this.#scanPromise = this.#scanner.ensureData().then(() => {
|
|
189
|
+
this.#cache = null; // 扫描后清除缓存以触发重新计算
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
await this.#scanPromise;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 强制刷新缓存
|
|
196
|
+
*/
|
|
197
|
+
invalidate() {
|
|
198
|
+
this.#cache = null;
|
|
199
|
+
this.#scanPromise = null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 强制重新扫描(invalidate + 重置 scanner)
|
|
203
|
+
*/
|
|
204
|
+
async rescan() {
|
|
205
|
+
this.invalidate();
|
|
206
|
+
if (this.#scanner) {
|
|
207
|
+
this.#scanner.reset();
|
|
208
|
+
await this.ensureData();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/* ─── Cache + Compute ───────────────────────────── */
|
|
212
|
+
#getOrCompute() {
|
|
213
|
+
if (this.#cache) {
|
|
214
|
+
return this.#cache;
|
|
215
|
+
}
|
|
216
|
+
const candidates = this.#moduleDiscoverer.discover();
|
|
217
|
+
this.#cache = this.#aggregator.compute(candidates);
|
|
218
|
+
return this.#cache;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PanoramaTypes — 全景服务共享类型定义
|
|
3
|
+
*
|
|
4
|
+
* @module PanoramaTypes
|
|
5
|
+
*/
|
|
6
|
+
export interface CeDbLike {
|
|
7
|
+
getDb?: () => CeDbLike;
|
|
8
|
+
transaction(fn: () => void): () => void;
|
|
9
|
+
exec(sql: string): void;
|
|
10
|
+
prepare(sql: string): {
|
|
11
|
+
run(...params: unknown[]): {
|
|
12
|
+
changes: number;
|
|
13
|
+
};
|
|
14
|
+
get(...params: unknown[]): Record<string, unknown> | undefined;
|
|
15
|
+
all(...params: unknown[]): Record<string, unknown>[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface Edge {
|
|
19
|
+
from: string;
|
|
20
|
+
to: string;
|
|
21
|
+
weight: number;
|
|
22
|
+
relation: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PanoramaModule {
|
|
25
|
+
name: string;
|
|
26
|
+
inferredRole: string;
|
|
27
|
+
refinedRole: string;
|
|
28
|
+
roleConfidence: number;
|
|
29
|
+
layer: number;
|
|
30
|
+
fanIn: number;
|
|
31
|
+
fanOut: number;
|
|
32
|
+
files: string[];
|
|
33
|
+
fileCount: number;
|
|
34
|
+
recipeCount: number;
|
|
35
|
+
coverageRatio: number;
|
|
36
|
+
}
|
|
37
|
+
export interface LayerLevel {
|
|
38
|
+
level: number;
|
|
39
|
+
name: string;
|
|
40
|
+
modules: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface LayerViolation {
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
fromLayer: number;
|
|
46
|
+
toLayer: number;
|
|
47
|
+
relation: string;
|
|
48
|
+
}
|
|
49
|
+
export interface LayerHierarchy {
|
|
50
|
+
levels: LayerLevel[];
|
|
51
|
+
violations: LayerViolation[];
|
|
52
|
+
}
|
|
53
|
+
export interface CyclicDependency {
|
|
54
|
+
cycle: string[];
|
|
55
|
+
severity: 'error' | 'warning';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 知识维度定义 (灵感来源: ISO/IEC 25010 质量模型 + ThoughtWorks Tech Radar)
|
|
59
|
+
*
|
|
60
|
+
* 每个维度代表项目应具备知识规范的一个方向,
|
|
61
|
+
* score 反映该方向上 Recipe 的丰厚程度。
|
|
62
|
+
*/
|
|
63
|
+
export interface HealthDimension {
|
|
64
|
+
/** 维度 ID */
|
|
65
|
+
id: string;
|
|
66
|
+
/** 人类可读名称 */
|
|
67
|
+
name: string;
|
|
68
|
+
/** 维度说明 */
|
|
69
|
+
description: string;
|
|
70
|
+
/** 该维度匹配到的 recipe 数 */
|
|
71
|
+
recipeCount: number;
|
|
72
|
+
/** 得分 0-100 */
|
|
73
|
+
score: number;
|
|
74
|
+
/** 状态: strong(≥5) / adequate(2-4) / weak(1) / missing(0) */
|
|
75
|
+
status: 'strong' | 'adequate' | 'weak' | 'missing';
|
|
76
|
+
/** 雷达环级: adopt / trial / assess / hold */
|
|
77
|
+
level: 'adopt' | 'trial' | 'assess' | 'hold';
|
|
78
|
+
/** 该维度下 recipe 标题示例 (最多 3 个) */
|
|
79
|
+
topRecipes: string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 项目知识健康雷达图
|
|
83
|
+
*/
|
|
84
|
+
export interface HealthRadar {
|
|
85
|
+
/** 各维度得分 */
|
|
86
|
+
dimensions: HealthDimension[];
|
|
87
|
+
/** 综合健康分 0-100 (加权平均) */
|
|
88
|
+
overallScore: number;
|
|
89
|
+
/** 活跃 recipe 总数 */
|
|
90
|
+
totalRecipes: number;
|
|
91
|
+
/** 已覆盖维度数 (recipeCount > 0) */
|
|
92
|
+
coveredDimensions: number;
|
|
93
|
+
/** 总维度数 */
|
|
94
|
+
totalDimensions: number;
|
|
95
|
+
/** 维度覆盖率 */
|
|
96
|
+
dimensionCoverage: number;
|
|
97
|
+
}
|
|
98
|
+
export interface KnowledgeGap {
|
|
99
|
+
/** 空白维度 ID */
|
|
100
|
+
dimension: string;
|
|
101
|
+
/** 空白维度名称 */
|
|
102
|
+
dimensionName: string;
|
|
103
|
+
/** 该维度已有 recipe 数 */
|
|
104
|
+
recipeCount: number;
|
|
105
|
+
/** 空白状态 */
|
|
106
|
+
status: 'weak' | 'missing';
|
|
107
|
+
/** 优先级 */
|
|
108
|
+
priority: 'high' | 'medium' | 'low';
|
|
109
|
+
/** 建议补充的主题方向 */
|
|
110
|
+
suggestedTopics: string[];
|
|
111
|
+
/** 受影响的模块角色 */
|
|
112
|
+
affectedRoles: string[];
|
|
113
|
+
}
|
|
114
|
+
export interface CallFlowSummary {
|
|
115
|
+
topCalledMethods: Array<{
|
|
116
|
+
id: string;
|
|
117
|
+
callCount: number;
|
|
118
|
+
}>;
|
|
119
|
+
entryPoints: string[];
|
|
120
|
+
dataProducers: string[];
|
|
121
|
+
dataConsumers: string[];
|
|
122
|
+
}
|
|
123
|
+
export interface PanoramaResult {
|
|
124
|
+
modules: Map<string, PanoramaModule>;
|
|
125
|
+
layers: LayerHierarchy;
|
|
126
|
+
cycles: CyclicDependency[];
|
|
127
|
+
gaps: KnowledgeGap[];
|
|
128
|
+
/** 多维度知识健康雷达 */
|
|
129
|
+
healthRadar: HealthRadar;
|
|
130
|
+
callFlowSummary: CallFlowSummary;
|
|
131
|
+
/** 项目级活跃 recipe 总数(不限模块匹配) */
|
|
132
|
+
projectRecipeCount: number;
|
|
133
|
+
computedAt: number;
|
|
134
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RoleRefiner — 四重信号融合角色精化
|
|
3
|
+
*
|
|
4
|
+
* 将 TargetClassifier 的正则推断 (~65% 准确率) 提升到 ≥90%,
|
|
5
|
+
* 通过融合 AST 结构、CallGraph 行为、DataFlow 数据流、EntityGraph 拓扑四重信号。
|
|
6
|
+
*
|
|
7
|
+
* 信号权重:
|
|
8
|
+
* AST 结构 0.30 继承链/协议/import/后缀
|
|
9
|
+
* CallGraph 行为 0.30 被调用分析/扇入扇出比/调用类型
|
|
10
|
+
* DataFlow 数据流 0.15 源汇分析/转换检测
|
|
11
|
+
* EntityGraph 拓扑 0.10 入度分析/模式检测
|
|
12
|
+
* 正则基线 0.15 TargetClassifier 结果
|
|
13
|
+
*
|
|
14
|
+
* @module RoleRefiner
|
|
15
|
+
*/
|
|
16
|
+
import type { CeDbLike } from './PanoramaTypes.js';
|
|
17
|
+
export type ModuleRole = 'core' | 'service' | 'ui' | 'networking' | 'storage' | 'test' | 'app' | 'routing' | 'utility' | 'model' | 'auth' | 'config' | 'feature';
|
|
18
|
+
export interface RoleSignal {
|
|
19
|
+
role: ModuleRole;
|
|
20
|
+
confidence: number;
|
|
21
|
+
weight: number;
|
|
22
|
+
source: string;
|
|
23
|
+
}
|
|
24
|
+
export type RoleResolution = 'clear' | 'uncertain' | 'fallback';
|
|
25
|
+
export interface RefinedRole {
|
|
26
|
+
refinedRole: ModuleRole;
|
|
27
|
+
confidence: number;
|
|
28
|
+
resolution: RoleResolution;
|
|
29
|
+
alternatives?: Array<[string, number]>;
|
|
30
|
+
signals: RoleSignal[];
|
|
31
|
+
}
|
|
32
|
+
export interface ModuleCandidate {
|
|
33
|
+
name: string;
|
|
34
|
+
inferredRole: ModuleRole;
|
|
35
|
+
files: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare class RoleRefiner {
|
|
38
|
+
#private;
|
|
39
|
+
constructor(db: CeDbLike, projectRoot: string);
|
|
40
|
+
/**
|
|
41
|
+
* 精化单个模块的角色
|
|
42
|
+
*/
|
|
43
|
+
refineRole(module: ModuleCandidate): RefinedRole;
|
|
44
|
+
/**
|
|
45
|
+
* 批量精化所有模块
|
|
46
|
+
*/
|
|
47
|
+
refineAll(modules: ModuleCandidate[]): Map<string, RefinedRole>;
|
|
48
|
+
}
|