autosnippet 3.3.5 → 3.3.7
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-FHns2ypa.js +1 -0
- package/dashboard/dist/assets/index-BRJv5Y3r.js +135 -0
- package/dashboard/dist/assets/index-DzoB7kxK.css +1 -0
- package/dashboard/dist/index.html +3 -3
- package/dist/bin/api-server.js +1 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +137 -9
- package/dist/lib/agent/AgentFactory.d.ts +0 -17
- package/dist/lib/agent/AgentFactory.js +1 -25
- package/dist/lib/agent/AgentRuntime.d.ts +2 -2
- package/dist/lib/agent/AgentRuntime.js +26 -18
- package/dist/lib/agent/capabilities.d.ts +11 -0
- package/dist/lib/agent/capabilities.js +29 -5
- package/dist/lib/agent/context/ExplorationTracker.js +10 -1
- package/dist/lib/agent/context/exploration/ExplorationStrategies.d.ts +2 -0
- package/dist/lib/agent/context/exploration/ExplorationStrategies.js +2 -2
- package/dist/lib/agent/domain/ChatAgentTasks.js +4 -0
- package/dist/lib/agent/domain/insight-analyst.d.ts +47 -3
- package/dist/lib/agent/domain/insight-analyst.js +111 -11
- package/dist/lib/agent/domain/insight-evolver.d.ts +69 -0
- package/dist/lib/agent/domain/insight-evolver.js +230 -0
- package/dist/lib/agent/domain/insight-gate.d.ts +42 -0
- package/dist/lib/agent/domain/insight-gate.js +41 -0
- package/dist/lib/agent/domain/insight-producer.d.ts +27 -2
- package/dist/lib/agent/domain/insight-producer.js +60 -5
- package/dist/lib/agent/domain/scan-prompts.js +10 -7
- package/dist/lib/agent/forced-summary.js +7 -2
- package/dist/lib/agent/memory/ActiveContext.d.ts +2 -28
- package/dist/lib/agent/memory/MemoryCoordinator.d.ts +2 -2
- package/dist/lib/agent/memory/SessionStore.d.ts +6 -12
- package/dist/lib/agent/memory/SessionStore.js +9 -15
- package/dist/lib/agent/memory/memory-flush-contract.d.ts +49 -0
- package/dist/lib/agent/memory/memory-flush-contract.js +16 -0
- package/dist/lib/agent/memory/session-store-schema.d.ts +20 -0
- package/dist/lib/agent/memory/session-store-schema.js +41 -0
- package/dist/lib/agent/presets.d.ts +89 -1
- package/dist/lib/agent/presets.js +53 -5
- package/dist/lib/agent/tools/_shared.d.ts +7 -15
- package/dist/lib/agent/tools/_shared.js +20 -21
- package/dist/lib/agent/tools/composite.d.ts +25 -22
- package/dist/lib/agent/tools/composite.js +108 -109
- package/dist/lib/agent/tools/evolution-tools.d.ts +145 -0
- package/dist/lib/agent/tools/evolution-tools.js +161 -0
- package/dist/lib/agent/tools/index.d.ts +163 -92
- package/dist/lib/agent/tools/index.js +9 -1
- package/dist/lib/agent/tools/lifecycle.d.ts +7 -1
- package/dist/lib/agent/tools/lifecycle.js +59 -75
- package/dist/lib/cli/AiScanService.js +5 -5
- package/dist/lib/cli/KnowledgeSyncService.js +1 -1
- package/dist/lib/core/AstAnalyzer.d.ts +1 -0
- package/dist/lib/core/discovery/ConfigWatcher.d.ts +64 -0
- package/dist/lib/core/discovery/ConfigWatcher.js +336 -0
- package/dist/lib/core/discovery/CustomConfigDiscoverer.d.ts +30 -0
- package/dist/lib/core/discovery/CustomConfigDiscoverer.js +1305 -0
- package/dist/lib/core/discovery/DiscovererPreference.d.ts +44 -0
- package/dist/lib/core/discovery/DiscovererPreference.js +141 -0
- package/dist/lib/core/discovery/DiscovererRegistry.d.ts +10 -1
- package/dist/lib/core/discovery/DiscovererRegistry.js +42 -2
- package/dist/lib/core/discovery/ProjectDiscoverer.d.ts +19 -0
- package/dist/lib/core/discovery/index.d.ts +2 -0
- package/dist/lib/core/discovery/index.js +4 -0
- package/dist/lib/core/discovery/parsers/CMakeParser.d.ts +32 -0
- package/dist/lib/core/discovery/parsers/CMakeParser.js +148 -0
- package/dist/lib/core/discovery/parsers/GradleDslParser.d.ts +43 -0
- package/dist/lib/core/discovery/parsers/GradleDslParser.js +171 -0
- package/dist/lib/core/discovery/parsers/JsonConfigParser.d.ts +45 -0
- package/dist/lib/core/discovery/parsers/JsonConfigParser.js +122 -0
- package/dist/lib/core/discovery/parsers/RubyDslParser.d.ts +49 -0
- package/dist/lib/core/discovery/parsers/RubyDslParser.js +282 -0
- package/dist/lib/core/discovery/parsers/StarlarkParser.d.ts +33 -0
- package/dist/lib/core/discovery/parsers/StarlarkParser.js +229 -0
- package/dist/lib/core/discovery/parsers/YamlConfigParser.d.ts +37 -0
- package/dist/lib/core/discovery/parsers/YamlConfigParser.js +212 -0
- package/dist/lib/{service/bootstrap/DimensionCopyRegistry.d.ts → domain/dimension/DimensionCopy.d.ts} +2 -2
- package/dist/lib/{service/bootstrap/DimensionCopyRegistry.js → domain/dimension/DimensionCopy.js} +22 -72
- package/dist/lib/domain/dimension/DimensionRegistry.d.ts +54 -0
- package/dist/lib/domain/dimension/DimensionRegistry.js +620 -0
- package/dist/lib/domain/dimension/DimensionSop.d.ts +55 -0
- package/dist/lib/domain/dimension/DimensionSop.js +1604 -0
- package/dist/lib/domain/dimension/UnifiedDimension.d.ts +61 -0
- package/dist/lib/domain/dimension/UnifiedDimension.js +53 -0
- package/dist/lib/domain/dimension/index.d.ts +10 -0
- package/dist/lib/domain/dimension/index.js +9 -0
- package/dist/lib/domain/knowledge/FieldSpec.d.ts +1 -1
- package/dist/lib/domain/knowledge/FieldSpec.js +29 -16
- package/dist/lib/domain/knowledge/KnowledgeEntry.d.ts +40 -112
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +44 -9
- package/dist/lib/domain/knowledge/KnowledgeRepository.d.ts +1 -0
- package/dist/lib/domain/knowledge/KnowledgeRepository.js +3 -0
- package/dist/lib/domain/knowledge/Lifecycle.js +1 -1
- package/dist/lib/domain/knowledge/StyleGuide.d.ts +1 -1
- package/dist/lib/domain/knowledge/StyleGuide.js +1 -1
- package/dist/lib/domain/knowledge/UnifiedValidator.js +15 -0
- package/dist/lib/external/ai/AiProvider.d.ts +12 -0
- package/dist/lib/external/ai/AiProvider.js +24 -0
- package/dist/lib/external/ai/AiProviderManager.d.ts +101 -0
- package/dist/lib/external/ai/AiProviderManager.js +193 -0
- package/dist/lib/external/ai/providers/ClaudeProvider.js +11 -0
- package/dist/lib/external/ai/providers/GoogleGeminiProvider.js +18 -0
- package/dist/lib/external/ai/providers/MockProvider.d.ts +21 -3
- package/dist/lib/external/ai/providers/MockProvider.js +290 -14
- package/dist/lib/external/ai/providers/OpenAiProvider.js +16 -0
- package/dist/lib/external/lark/LarkTransport.d.ts +5 -1
- package/dist/lib/external/lark/LarkTransport.js +10 -2
- package/dist/lib/external/mcp/McpServer.js +4 -0
- package/dist/lib/external/mcp/handlers/TargetClassifier.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/BootstrapSession.d.ts +8 -16
- package/dist/lib/external/mcp/handlers/bootstrap/BootstrapSession.js +10 -10
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.d.ts +7 -0
- package/dist/lib/external/mcp/handlers/bootstrap/ExternalSubmissionTracker.js +20 -0
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.d.ts +52 -132
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +204 -17
- package/dist/lib/external/mcp/handlers/bootstrap/base-dimensions.d.ts +11 -75
- package/dist/lib/external/mcp/handlers/bootstrap/base-dimensions.js +40 -191
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.d.ts +13 -78
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.js +30 -52
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.d.ts +0 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/mock-pipeline.d.ts +20 -0
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/mock-pipeline.js +432 -0
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.d.ts +99 -12
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +188 -169
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/tier-scheduler.js +7 -17
- package/dist/lib/external/mcp/handlers/bootstrap/refine.js +8 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/async-fill-helpers.d.ts +46 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/async-fill-helpers.js +58 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/audit-helpers.d.ts +25 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/audit-helpers.js +47 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +50 -12
- package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +30 -10
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-text.js +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/handler-types.d.ts +24 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/handler-types.js +14 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/panorama-utils.d.ts +14 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/panorama-utils.js +48 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/session-helpers.d.ts +21 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/session-helpers.js +45 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/skill-generator.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/bootstrap/shared/target-file-map.d.ts +27 -0
- package/dist/lib/external/mcp/handlers/bootstrap/shared/target-file-map.js +44 -0
- package/dist/lib/external/mcp/handlers/bootstrap-external.d.ts +23 -10
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +41 -51
- package/dist/lib/external/mcp/handlers/bootstrap-internal.d.ts +2 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +117 -82
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +4 -4
- package/dist/lib/external/mcp/handlers/consolidated.js +108 -332
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +71 -2
- package/dist/lib/external/mcp/handlers/evolve-external.d.ts +54 -0
- package/dist/lib/external/mcp/handlers/evolve-external.js +229 -0
- package/dist/lib/external/mcp/handlers/knowledge.js +30 -5
- package/dist/lib/external/mcp/handlers/rescan-external.d.ts +76 -0
- package/dist/lib/external/mcp/handlers/rescan-external.js +335 -0
- package/dist/lib/external/mcp/handlers/rescan-internal.d.ts +120 -0
- package/dist/lib/external/mcp/handlers/rescan-internal.js +359 -0
- package/dist/lib/external/mcp/handlers/search.d.ts +6 -5
- package/dist/lib/external/mcp/handlers/search.js +6 -5
- package/dist/lib/external/mcp/handlers/types.d.ts +2 -1
- package/dist/lib/external/mcp/handlers/wiki-external.js +2 -2
- package/dist/lib/external/mcp/tools.d.ts +8 -18
- package/dist/lib/external/mcp/tools.js +58 -2
- package/dist/lib/http/routes/ai.js +111 -30
- package/dist/lib/http/routes/candidates.js +11 -4
- package/dist/lib/http/routes/commands.js +10 -1
- package/dist/lib/http/routes/health.js +11 -0
- package/dist/lib/http/routes/knowledge.js +122 -1
- package/dist/lib/http/routes/modules.js +52 -3
- package/dist/lib/http/routes/panorama.js +16 -4
- package/dist/lib/http/routes/recipes.js +7 -0
- package/dist/lib/http/utils/routeHelpers.js +2 -1
- package/dist/lib/infrastructure/cache/CacheCoordinator.d.ts +41 -0
- package/dist/lib/infrastructure/cache/CacheCoordinator.js +105 -0
- package/dist/lib/infrastructure/database/migrations/006_lifecycle_transition_events.d.ts +7 -0
- package/dist/lib/infrastructure/database/migrations/006_lifecycle_transition_events.js +28 -0
- package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +1 -1
- package/dist/lib/injection/ServiceContainer.d.ts +6 -5
- package/dist/lib/injection/ServiceContainer.js +64 -25
- package/dist/lib/injection/ServiceMap.d.ts +10 -1
- package/dist/lib/injection/modules/AiModule.d.ts +6 -9
- package/dist/lib/injection/modules/AiModule.js +82 -39
- package/dist/lib/injection/modules/KnowledgeModule.js +15 -1
- package/dist/lib/injection/modules/PanoramaModule.js +1 -1
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +4 -0
- package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +16 -1
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.d.ts +3 -2
- package/dist/lib/service/bootstrap/BootstrapEventEmitter.js +1 -1
- package/dist/lib/service/bootstrap/DeliveryVerifier.d.ts +51 -0
- package/dist/lib/service/bootstrap/DeliveryVerifier.js +163 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.d.ts +5 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.js +20 -0
- package/dist/lib/service/bootstrap/bootstrap-event-types.d.ts +54 -0
- package/dist/lib/service/bootstrap/bootstrap-event-types.js +10 -0
- package/dist/lib/service/cleanup/CleanupService.d.ts +132 -0
- package/dist/lib/service/cleanup/CleanupService.js +571 -0
- package/dist/lib/service/delivery/AgentInstructionsGenerator.js +39 -43
- package/dist/lib/service/delivery/FileProtection.d.ts +20 -0
- package/dist/lib/service/delivery/FileProtection.js +54 -0
- package/dist/lib/service/delivery/SkillsSyncer.js +16 -21
- package/dist/lib/service/evolution/ContentPatcher.d.ts +44 -0
- package/dist/lib/service/evolution/ContentPatcher.js +310 -0
- package/dist/lib/service/evolution/ProposalExecutor.d.ts +4 -0
- package/dist/lib/service/evolution/ProposalExecutor.js +77 -13
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.d.ts +64 -0
- package/dist/lib/service/evolution/RecipeLifecycleSupervisor.js +458 -0
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.d.ts +89 -0
- package/dist/lib/service/evolution/RecipeRelevanceAuditor.js +492 -0
- package/dist/lib/service/evolution/createSupersedeProposal.d.ts +44 -0
- package/dist/lib/service/evolution/createSupersedeProposal.js +81 -0
- package/dist/lib/service/guard/ComplianceReporter.d.ts +4 -0
- package/dist/lib/service/guard/ComplianceReporter.js +51 -0
- package/dist/lib/service/guard/GuardCheckEngine.js +5 -4
- package/dist/lib/service/knowledge/CodeEntityGraph.d.ts +6 -0
- package/dist/lib/service/knowledge/CodeEntityGraph.js +16 -0
- package/dist/lib/service/knowledge/ConfidenceRouter.js +1 -1
- package/dist/lib/service/knowledge/KnowledgeService.d.ts +11 -1
- package/dist/lib/service/knowledge/KnowledgeService.js +67 -14
- package/dist/lib/service/knowledge/RecipeProductionGateway.d.ts +225 -0
- package/dist/lib/service/knowledge/RecipeProductionGateway.js +384 -0
- package/dist/lib/service/module/ModuleService.js +10 -19
- package/dist/lib/service/panorama/CouplingAnalyzer.d.ts +10 -1
- package/dist/lib/service/panorama/CouplingAnalyzer.js +44 -2
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +4 -3
- package/dist/lib/service/panorama/DimensionAnalyzer.js +40 -151
- package/dist/lib/service/panorama/LayerInferrer.d.ts +16 -1
- package/dist/lib/service/panorama/LayerInferrer.js +118 -1
- package/dist/lib/service/panorama/ModuleDiscoverer.d.ts +9 -0
- package/dist/lib/service/panorama/ModuleDiscoverer.js +58 -2
- package/dist/lib/service/panorama/PanoramaAggregator.d.ts +6 -2
- package/dist/lib/service/panorama/PanoramaAggregator.js +84 -6
- package/dist/lib/service/panorama/PanoramaScanner.js +28 -0
- package/dist/lib/service/panorama/PanoramaService.js +10 -5
- package/dist/lib/service/panorama/PanoramaTypes.d.ts +38 -0
- package/dist/lib/service/panorama/RoleRefiner.d.ts +2 -0
- package/dist/lib/service/panorama/RoleRefiner.js +41 -0
- package/dist/lib/service/panorama/TechStackProfiler.d.ts +13 -0
- package/dist/lib/service/panorama/TechStackProfiler.js +191 -0
- package/dist/lib/service/search/BM25Scorer.d.ts +2 -2
- package/dist/lib/service/search/SearchEngine.d.ts +11 -10
- package/dist/lib/service/search/SearchEngine.js +38 -36
- package/dist/lib/service/search/SearchTypes.d.ts +14 -8
- package/dist/lib/service/search/SearchTypes.js +1 -1
- package/dist/lib/service/search/tokenizer.d.ts +1 -1
- package/dist/lib/service/search/tokenizer.js +2 -2
- package/dist/lib/service/skills/SignalCollector.d.ts +1 -0
- package/dist/lib/service/skills/SignalCollector.js +6 -5
- package/dist/lib/service/vector/ContextualEnricher.d.ts +1 -0
- package/dist/lib/service/vector/ContextualEnricher.js +4 -0
- package/dist/lib/shared/LanguageService.js +3 -0
- package/dist/lib/shared/developer-identity.d.ts +18 -0
- package/dist/lib/shared/developer-identity.js +62 -0
- package/dist/lib/shared/schemas/common.d.ts +4 -4
- package/dist/lib/shared/schemas/http-requests.d.ts +20 -18
- package/dist/lib/shared/schemas/http-requests.js +17 -6
- package/dist/lib/shared/schemas/mcp-tools.d.ts +32 -2
- package/dist/lib/shared/schemas/mcp-tools.js +38 -0
- package/dist/lib/types/evolution.d.ts +135 -0
- package/dist/lib/types/evolution.js +6 -0
- package/dist/lib/types/graph-shared.d.ts +25 -0
- package/dist/lib/types/graph-shared.js +7 -0
- package/dist/lib/types/knowledge-wire.d.ts +132 -0
- package/dist/lib/types/knowledge-wire.js +7 -0
- package/dist/lib/types/project-snapshot-builder.d.ts +19 -0
- package/dist/lib/types/project-snapshot-builder.js +189 -0
- package/dist/lib/types/project-snapshot.d.ts +399 -0
- package/dist/lib/types/project-snapshot.js +17 -0
- package/dist/lib/types/search-wire.d.ts +46 -0
- package/dist/lib/types/search-wire.js +7 -0
- package/dist/lib/types/snapshot-views.d.ts +58 -0
- package/dist/lib/types/snapshot-views.js +103 -0
- package/package.json +1 -1
- package/skills/autosnippet-recipes/SKILL.md +1 -1
- package/templates/instructions/agent-static.md +2 -0
- package/templates/instructions/conventions.md +3 -1
- package/templates/recipes-setup/README.md +2 -2
- package/dashboard/dist/assets/icons-BJ2mUBi8.js +0 -1
- package/dashboard/dist/assets/index-B659K9t5.js +0 -128
- package/dashboard/dist/assets/index-NCm40PMD.css +0 -1
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.d.ts +0 -169
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.js +0 -727
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.d.ts +0 -370
- package/dist/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +0 -821
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DimensionRegistry — 统一维度注册表 (Single Source of Truth)
|
|
3
|
+
*
|
|
4
|
+
* 25 个维度定义:
|
|
5
|
+
* Layer 1 (Universal): D1-D13 — 所有项目适用
|
|
6
|
+
* Layer 2 (Language): DL1-DL7 — 按项目语言激活
|
|
7
|
+
* Layer 3 (Framework): DF1-DF5 — 按检测到的框架激活
|
|
8
|
+
*
|
|
9
|
+
* 这是整个系统中维度定义的唯一来源。
|
|
10
|
+
* Bootstrap / Panorama / Rescan / Dashboard 均从此模块消费维度元数据。
|
|
11
|
+
*
|
|
12
|
+
* 设计文档: docs/copilot/unified-dimension-design.md §4
|
|
13
|
+
*
|
|
14
|
+
* @module domain/dimension/DimensionRegistry
|
|
15
|
+
*/
|
|
16
|
+
import type { DimensionId, UnifiedDimension } from './UnifiedDimension.js';
|
|
17
|
+
export declare const DIMENSION_REGISTRY: readonly UnifiedDimension[];
|
|
18
|
+
/**
|
|
19
|
+
* 维度 ID → 展示分组 ID 映射
|
|
20
|
+
*
|
|
21
|
+
* 展示分组:
|
|
22
|
+
* - 'architecture' — 架构与设计
|
|
23
|
+
* - 'best-practice' — 规范与实践
|
|
24
|
+
* - 'data-event-flow' — 数据与并发
|
|
25
|
+
* - 'deep-scan' — 深度扫描(语言/框架条件维度)
|
|
26
|
+
*/
|
|
27
|
+
export declare const DIMENSION_DISPLAY_GROUP: Record<string, string>;
|
|
28
|
+
/** 按 ID 获取维度 */
|
|
29
|
+
export declare function getDimension(id: string): UnifiedDimension | undefined;
|
|
30
|
+
/** 获取指定层级的所有维度 */
|
|
31
|
+
export declare function getDimensionsByLayer(layer: 'universal' | 'language' | 'framework'): readonly UnifiedDimension[];
|
|
32
|
+
/**
|
|
33
|
+
* 根据项目语言和框架过滤出活跃维度
|
|
34
|
+
*
|
|
35
|
+
* - Layer 1 (universal): 全部返回
|
|
36
|
+
* - Layer 2 (language): 仅当项目语言匹配时返回
|
|
37
|
+
* - Layer 3 (framework): 仅当项目语言+框架均匹配时返回
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveActiveDimensions(primaryLang: string, detectedFrameworks?: string[]): readonly UnifiedDimension[];
|
|
40
|
+
/**
|
|
41
|
+
* 构建 Tier 分层调度计划
|
|
42
|
+
*
|
|
43
|
+
* 基于每个维度的 tierHint 字段将活跃维度分为 3 层:
|
|
44
|
+
* - Tier 1 (tierHint=1): 基础数据层 — architecture + 语言/框架条件维度
|
|
45
|
+
* - Tier 2 (tierHint=2): 规范+设计层 — coding-standards, design-patterns
|
|
46
|
+
* - Tier 3 (tierHint=3): 实践+质量层 — 其余所有维度
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildTierPlan(activeDims?: readonly UnifiedDimension[]): string[][];
|
|
49
|
+
/**
|
|
50
|
+
* 将 Recipe 分类到最匹配的维度
|
|
51
|
+
*
|
|
52
|
+
* 优先级: topicHint 精确匹配 → category 匹配 → null
|
|
53
|
+
*/
|
|
54
|
+
export declare function classifyRecipeToDimension(topicHint: string, category: string): DimensionId | null;
|
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DimensionRegistry — 统一维度注册表 (Single Source of Truth)
|
|
3
|
+
*
|
|
4
|
+
* 25 个维度定义:
|
|
5
|
+
* Layer 1 (Universal): D1-D13 — 所有项目适用
|
|
6
|
+
* Layer 2 (Language): DL1-DL7 — 按项目语言激活
|
|
7
|
+
* Layer 3 (Framework): DF1-DF5 — 按检测到的框架激活
|
|
8
|
+
*
|
|
9
|
+
* 这是整个系统中维度定义的唯一来源。
|
|
10
|
+
* Bootstrap / Panorama / Rescan / Dashboard 均从此模块消费维度元数据。
|
|
11
|
+
*
|
|
12
|
+
* 设计文档: docs/copilot/unified-dimension-design.md §4
|
|
13
|
+
*
|
|
14
|
+
* @module domain/dimension/DimensionRegistry
|
|
15
|
+
*/
|
|
16
|
+
// ═══════════════════════════════════════════════════════════
|
|
17
|
+
// Layer 1: Universal Dimensions (13)
|
|
18
|
+
// ═══════════════════════════════════════════════════════════
|
|
19
|
+
const D1_ARCHITECTURE = {
|
|
20
|
+
id: 'architecture',
|
|
21
|
+
label: '架构与设计',
|
|
22
|
+
layer: 'universal',
|
|
23
|
+
icon: 'Workflow',
|
|
24
|
+
colorFamily: 'sky',
|
|
25
|
+
extractionGuide: '分层架构、模块职责与边界、依赖方向约束、入口点、目标枚举、启动流程、路由表',
|
|
26
|
+
allowedKnowledgeTypes: ['architecture', 'module-dependency', 'boundary-constraint'],
|
|
27
|
+
outputMode: 'candidate-only',
|
|
28
|
+
qualityDescription: '模块边界清晰度、依赖方向合规性、层次分离完整性',
|
|
29
|
+
matchTopics: ['architecture', 'scaffold', 'module-boundary', 'dependency-rule', 'layer-strategy'],
|
|
30
|
+
matchCategories: ['architecture', 'project-profile'],
|
|
31
|
+
weight: 1.0,
|
|
32
|
+
suggestedTopics: ['module-boundary', 'dependency-rule', 'layer-strategy'],
|
|
33
|
+
relatedRoles: ['core', 'foundation', 'app'],
|
|
34
|
+
tierHint: 1,
|
|
35
|
+
displayGroup: 'architecture',
|
|
36
|
+
};
|
|
37
|
+
const D2_CODING_STANDARDS = {
|
|
38
|
+
id: 'coding-standards',
|
|
39
|
+
label: '代码规范',
|
|
40
|
+
layer: 'universal',
|
|
41
|
+
icon: 'BookOpen',
|
|
42
|
+
colorFamily: 'violet',
|
|
43
|
+
extractionGuide: '命名约定(类名/方法/变量/常量)、注释风格、文件组织、import 排序、访问控制约定、MARK 分段',
|
|
44
|
+
allowedKnowledgeTypes: ['code-standard', 'code-style'],
|
|
45
|
+
outputMode: 'candidate-only',
|
|
46
|
+
qualityDescription: '命名一致性、文档注释覆盖率、文件组织标准化程度',
|
|
47
|
+
matchTopics: ['conventions', 'naming-convention', 'code-style', 'documentation'],
|
|
48
|
+
matchCategories: ['code-standard', 'code-style'],
|
|
49
|
+
weight: 0.8,
|
|
50
|
+
suggestedTopics: ['naming-convention', 'code-style', 'documentation'],
|
|
51
|
+
relatedRoles: [],
|
|
52
|
+
tierHint: 2,
|
|
53
|
+
displayGroup: 'best-practice',
|
|
54
|
+
};
|
|
55
|
+
const D3_DESIGN_PATTERNS = {
|
|
56
|
+
id: 'design-patterns',
|
|
57
|
+
label: '设计模式',
|
|
58
|
+
layer: 'universal',
|
|
59
|
+
icon: 'GitBranch',
|
|
60
|
+
colorFamily: 'fuchsia',
|
|
61
|
+
extractionGuide: '单例/委托/工厂/Builder/观察者/Coordinator/Repository/DI 容器等模式、继承层级、基类设计',
|
|
62
|
+
allowedKnowledgeTypes: ['code-pattern', 'code-relation', 'inheritance'],
|
|
63
|
+
outputMode: 'candidate-only',
|
|
64
|
+
qualityDescription: '模式使用一致性、反模式检测、基类复用程度',
|
|
65
|
+
matchTopics: ['design-pattern', 'code-pattern', 'inheritance', 'base-class'],
|
|
66
|
+
matchCategories: ['code-pattern', 'code-relation'],
|
|
67
|
+
weight: 0.8,
|
|
68
|
+
suggestedTopics: ['design-pattern', 'code-pattern', 'inheritance'],
|
|
69
|
+
relatedRoles: [],
|
|
70
|
+
tierHint: 2,
|
|
71
|
+
displayGroup: 'architecture',
|
|
72
|
+
};
|
|
73
|
+
const D4_ERROR_RESILIENCE = {
|
|
74
|
+
id: 'error-resilience',
|
|
75
|
+
label: '错误与健壮性',
|
|
76
|
+
layer: 'universal',
|
|
77
|
+
icon: 'Shield',
|
|
78
|
+
colorFamily: 'emerald',
|
|
79
|
+
extractionGuide: '异常/错误类型定义、错误传播策略、用户可见错误展示、重试/回退/熔断模式、防御性编程、输入验证',
|
|
80
|
+
allowedKnowledgeTypes: ['best-practice'],
|
|
81
|
+
outputMode: 'candidate-only',
|
|
82
|
+
qualityDescription: '错误类型覆盖率、错误恢复完整性、用户错误体验',
|
|
83
|
+
matchTopics: ['error-handling', 'constraints', 'validation', 'error-recovery'],
|
|
84
|
+
matchCategories: ['best-practice'],
|
|
85
|
+
weight: 1.0,
|
|
86
|
+
suggestedTopics: ['exception-pattern', 'error-recovery', 'input-validation'],
|
|
87
|
+
relatedRoles: ['service', 'networking', 'core'],
|
|
88
|
+
tierHint: 3,
|
|
89
|
+
displayGroup: 'best-practice',
|
|
90
|
+
};
|
|
91
|
+
const D5_CONCURRENCY_ASYNC = {
|
|
92
|
+
id: 'concurrency-async',
|
|
93
|
+
label: '并发与异步',
|
|
94
|
+
layer: 'universal',
|
|
95
|
+
icon: 'Repeat',
|
|
96
|
+
colorFamily: 'orange',
|
|
97
|
+
extractionGuide: '线程安全模式(锁/Actor/隔离)、异步编程模型(async-await/RxSwift/Combine/Promise)、竞态条件防护、内存安全(弱引用/捕获列表)',
|
|
98
|
+
allowedKnowledgeTypes: ['best-practice'],
|
|
99
|
+
outputMode: 'candidate-only',
|
|
100
|
+
qualityDescription: '线程安全覆盖率、异步模式一致性、数据竞争风险',
|
|
101
|
+
matchTopics: ['concurrency', 'async', 'thread-safety', 'race-condition', 'memory-safety'],
|
|
102
|
+
matchCategories: [],
|
|
103
|
+
weight: 0.9,
|
|
104
|
+
suggestedTopics: ['thread-safety', 'async-pattern', 'race-condition'],
|
|
105
|
+
relatedRoles: ['service', 'networking', 'storage'],
|
|
106
|
+
tierHint: 3,
|
|
107
|
+
displayGroup: 'data-event-flow',
|
|
108
|
+
};
|
|
109
|
+
const D6_DATA_EVENT_FLOW = {
|
|
110
|
+
id: 'data-event-flow',
|
|
111
|
+
label: '事件与数据流',
|
|
112
|
+
layer: 'universal',
|
|
113
|
+
icon: 'Cog',
|
|
114
|
+
colorFamily: 'amber',
|
|
115
|
+
extractionGuide: '持久化模式(CoreData/UserDefaults/SQLite/Keychain)、缓存策略、序列化约定、事件传播(Delegate/Notification/Closure/RxSwift)、状态管理、数据一致性',
|
|
116
|
+
allowedKnowledgeTypes: ['call-chain', 'data-flow', 'event-and-data-flow'],
|
|
117
|
+
outputMode: 'candidate-only',
|
|
118
|
+
qualityDescription: '数据流完整性、持久化安全性、事件耦合度',
|
|
119
|
+
matchTopics: [
|
|
120
|
+
'data',
|
|
121
|
+
'data-flow',
|
|
122
|
+
'memory',
|
|
123
|
+
'persistence',
|
|
124
|
+
'caching',
|
|
125
|
+
'event',
|
|
126
|
+
'state-management',
|
|
127
|
+
],
|
|
128
|
+
matchCategories: ['event-and-data-flow', 'data-management'],
|
|
129
|
+
weight: 0.8,
|
|
130
|
+
suggestedTopics: ['persistence', 'caching', 'serialization', 'data-integrity'],
|
|
131
|
+
relatedRoles: ['storage', 'model'],
|
|
132
|
+
tierHint: 3,
|
|
133
|
+
displayGroup: 'data-event-flow',
|
|
134
|
+
};
|
|
135
|
+
const D7_NETWORKING_API = {
|
|
136
|
+
id: 'networking-api',
|
|
137
|
+
label: '网络与 API',
|
|
138
|
+
layer: 'universal',
|
|
139
|
+
icon: 'Wifi',
|
|
140
|
+
colorFamily: 'blue',
|
|
141
|
+
extractionGuide: 'API 请求封装模式、响应模型定义、错误码映射、重试/超时策略、实时通信(WebSocket/SSE)、认证流程、CDN 策略',
|
|
142
|
+
allowedKnowledgeTypes: ['best-practice', 'code-pattern'],
|
|
143
|
+
outputMode: 'candidate-only',
|
|
144
|
+
qualityDescription: 'API 抽象一致性、网络错误处理完整性、安全传输',
|
|
145
|
+
matchTopics: ['networking', 'real-time', 'api-contract', 'retry-strategy', 'request-pattern'],
|
|
146
|
+
matchCategories: ['Network'],
|
|
147
|
+
weight: 0.7,
|
|
148
|
+
suggestedTopics: ['api-contract', 'retry-strategy', 'request-pattern'],
|
|
149
|
+
relatedRoles: ['networking'],
|
|
150
|
+
tierHint: 3,
|
|
151
|
+
displayGroup: 'data-event-flow',
|
|
152
|
+
};
|
|
153
|
+
const D8_UI_INTERACTION = {
|
|
154
|
+
id: 'ui-interaction',
|
|
155
|
+
label: '界面与交互',
|
|
156
|
+
layer: 'universal',
|
|
157
|
+
icon: 'Layout',
|
|
158
|
+
colorFamily: 'pink',
|
|
159
|
+
extractionGuide: 'UI 组件基类、布局约束模式、生命周期管理、导航/路由、数据绑定(MVVM/MVI/Redux)、列表分页、动画转场',
|
|
160
|
+
allowedKnowledgeTypes: ['code-pattern', 'best-practice'],
|
|
161
|
+
outputMode: 'candidate-only',
|
|
162
|
+
qualityDescription: 'VC/View 一致性、组件复用率、导航健壮性',
|
|
163
|
+
matchTopics: ['ui', 'binding', 'pagination', 'navigation', 'component-pattern', 'lifecycle'],
|
|
164
|
+
matchCategories: ['View', 'UI'],
|
|
165
|
+
weight: 0.7,
|
|
166
|
+
suggestedTopics: ['component-pattern', 'lifecycle', 'navigation'],
|
|
167
|
+
relatedRoles: ['ui', 'feature'],
|
|
168
|
+
tierHint: 3,
|
|
169
|
+
displayGroup: 'architecture',
|
|
170
|
+
};
|
|
171
|
+
const D9_TESTING_QUALITY = {
|
|
172
|
+
id: 'testing-quality',
|
|
173
|
+
label: '测试与质量',
|
|
174
|
+
layer: 'universal',
|
|
175
|
+
icon: 'FlaskConical',
|
|
176
|
+
colorFamily: 'lime',
|
|
177
|
+
extractionGuide: '单元测试模式、Mock/Stub 策略、集成测试约定、CI/CD 流程、代码覆盖率策略、Snapshot 测试',
|
|
178
|
+
allowedKnowledgeTypes: ['best-practice'],
|
|
179
|
+
outputMode: 'candidate-only',
|
|
180
|
+
qualityDescription: '测试覆盖率、Mock 一致性、CI 可靠性',
|
|
181
|
+
matchTopics: ['testing', 'test', 'ci-cd', 'mock-strategy', 'unit-test', 'snapshot-test'],
|
|
182
|
+
matchCategories: [],
|
|
183
|
+
weight: 0.9,
|
|
184
|
+
suggestedTopics: ['unit-test', 'mock-strategy', 'ci-cd'],
|
|
185
|
+
relatedRoles: [],
|
|
186
|
+
tierHint: 3,
|
|
187
|
+
displayGroup: 'best-practice',
|
|
188
|
+
};
|
|
189
|
+
const D10_SECURITY_AUTH = {
|
|
190
|
+
id: 'security-auth',
|
|
191
|
+
label: '安全与认证',
|
|
192
|
+
layer: 'universal',
|
|
193
|
+
icon: 'Lock',
|
|
194
|
+
colorFamily: 'red',
|
|
195
|
+
extractionGuide: '认证授权流程、Token 管理、加密存储(Keychain/SecureStorage)、证书锁定、输入清理、权限控制、隐私合规',
|
|
196
|
+
allowedKnowledgeTypes: ['best-practice'],
|
|
197
|
+
outputMode: 'candidate-only',
|
|
198
|
+
qualityDescription: '安全实践覆盖率、认证流程完整性、数据保护',
|
|
199
|
+
matchTopics: ['security', 'auth', 'authentication', 'authorization', 'encryption', 'privacy'],
|
|
200
|
+
matchCategories: [],
|
|
201
|
+
weight: 1.0,
|
|
202
|
+
suggestedTopics: ['authentication', 'authorization', 'encryption'],
|
|
203
|
+
relatedRoles: ['networking', 'service'],
|
|
204
|
+
tierHint: 3,
|
|
205
|
+
displayGroup: 'best-practice',
|
|
206
|
+
};
|
|
207
|
+
const D11_PERFORMANCE_OPTIMIZATION = {
|
|
208
|
+
id: 'performance-optimization',
|
|
209
|
+
label: '性能优化',
|
|
210
|
+
layer: 'universal',
|
|
211
|
+
icon: 'Gauge',
|
|
212
|
+
colorFamily: 'yellow',
|
|
213
|
+
extractionGuide: '内存管理(ARC/GC/引用循环)、懒加载策略、缓存层级、渲染优化(离屏渲染/预计算)、启动耗时优化、包体积控制',
|
|
214
|
+
allowedKnowledgeTypes: ['best-practice'],
|
|
215
|
+
outputMode: 'candidate-only',
|
|
216
|
+
qualityDescription: '内存泄漏风险、启动关键路径、资源利用效率',
|
|
217
|
+
matchTopics: ['performance', 'optimization', 'memory-management', 'lazy-loading', 'rendering'],
|
|
218
|
+
matchCategories: [],
|
|
219
|
+
weight: 0.8,
|
|
220
|
+
suggestedTopics: ['memory-management', 'lazy-loading', 'rendering'],
|
|
221
|
+
relatedRoles: ['ui', 'storage'],
|
|
222
|
+
tierHint: 3,
|
|
223
|
+
displayGroup: 'data-event-flow',
|
|
224
|
+
};
|
|
225
|
+
const D12_OBSERVABILITY_LOGGING = {
|
|
226
|
+
id: 'observability-logging',
|
|
227
|
+
label: '可观测性',
|
|
228
|
+
layer: 'universal',
|
|
229
|
+
icon: 'Activity',
|
|
230
|
+
colorFamily: 'slate',
|
|
231
|
+
extractionGuide: '日志框架与分级(OSLog/Logger/Winston/Pino)、事件追踪/埋点、监控指标、诊断工具链、错误上报',
|
|
232
|
+
allowedKnowledgeTypes: ['best-practice'],
|
|
233
|
+
outputMode: 'candidate-only',
|
|
234
|
+
qualityDescription: '日志规范覆盖率、可追踪性、监控完整性',
|
|
235
|
+
matchTopics: ['logging', 'monitoring', 'event-tracking', 'diagnostics', 'tracing'],
|
|
236
|
+
matchCategories: [],
|
|
237
|
+
weight: 0.7,
|
|
238
|
+
suggestedTopics: ['logging-standard', 'event-tracking', 'diagnostics'],
|
|
239
|
+
relatedRoles: ['service', 'core'],
|
|
240
|
+
tierHint: 3,
|
|
241
|
+
displayGroup: 'data-event-flow',
|
|
242
|
+
};
|
|
243
|
+
const D13_AGENT_GUIDELINES = {
|
|
244
|
+
id: 'agent-guidelines',
|
|
245
|
+
label: '开发约束',
|
|
246
|
+
layer: 'universal',
|
|
247
|
+
icon: 'Brain',
|
|
248
|
+
colorFamily: 'rose',
|
|
249
|
+
extractionGuide: "项目强制规则(DO/DON'T)、已废弃 API 标记、架构约束声明、环境特殊约定",
|
|
250
|
+
allowedKnowledgeTypes: ['boundary-constraint', 'code-standard'],
|
|
251
|
+
outputMode: 'candidate-only',
|
|
252
|
+
qualityDescription: '约束覆盖完整性、规则可执行性',
|
|
253
|
+
matchTopics: ['constraints', 'deprecated-api', 'agent-rules'],
|
|
254
|
+
matchCategories: ['agent-guidelines'],
|
|
255
|
+
weight: 0.6,
|
|
256
|
+
suggestedTopics: ['constraints', 'deprecated-api', 'agent-rules'],
|
|
257
|
+
relatedRoles: [],
|
|
258
|
+
tierHint: 3,
|
|
259
|
+
displayGroup: 'best-practice',
|
|
260
|
+
};
|
|
261
|
+
// ═══════════════════════════════════════════════════════════
|
|
262
|
+
// Layer 2: Language Dimensions (7)
|
|
263
|
+
// ═══════════════════════════════════════════════════════════
|
|
264
|
+
const DL1_SWIFT_OBJC_IDIOM = {
|
|
265
|
+
id: 'swift-objc-idiom',
|
|
266
|
+
label: '深度扫描',
|
|
267
|
+
layer: 'language',
|
|
268
|
+
icon: 'ScanSearch',
|
|
269
|
+
colorFamily: 'indigo',
|
|
270
|
+
extractionGuide: '常量定义模式(enum namespace vs global)、Sendable 合规、Method Swizzling 清单、Protocol 命名约定、属性包装器使用、#define 宏/extern 常量、Category/Extension 针对基础类的方法清单',
|
|
271
|
+
allowedKnowledgeTypes: ['code-standard', 'code-pattern'],
|
|
272
|
+
outputMode: 'candidate-only',
|
|
273
|
+
qualityDescription: 'Swift 6.0 并发安全合规度、ObjC 互操作清洁度、常量管理规范性',
|
|
274
|
+
matchTopics: ['swift-idiom', 'objc-idiom', 'sendable', 'method-swizzle', 'macro', 'constant'],
|
|
275
|
+
matchCategories: ['objc-deep-scan', 'category-scan'],
|
|
276
|
+
weight: 0.8,
|
|
277
|
+
suggestedTopics: ['sendable', 'method-swizzle', 'objc-interop'],
|
|
278
|
+
relatedRoles: [],
|
|
279
|
+
conditions: { languages: ['swift', 'objectivec'] },
|
|
280
|
+
tierHint: 1,
|
|
281
|
+
displayGroup: 'deep-scan',
|
|
282
|
+
};
|
|
283
|
+
const DL2_TS_JS_MODULE = {
|
|
284
|
+
id: 'ts-js-module',
|
|
285
|
+
label: '模块导出',
|
|
286
|
+
layer: 'language',
|
|
287
|
+
icon: 'Package',
|
|
288
|
+
colorFamily: 'violet',
|
|
289
|
+
extractionGuide: 'barrel export 结构、re-export 链路、public API surface、tree-shaking 合规性、path alias、类型导出策略',
|
|
290
|
+
allowedKnowledgeTypes: ['code-standard', 'architecture'],
|
|
291
|
+
outputMode: 'candidate-only',
|
|
292
|
+
qualityDescription: '模块封装一致性、exported API 清晰度',
|
|
293
|
+
matchTopics: ['module-export', 'barrel-export', 'public-api', 'tree-shaking'],
|
|
294
|
+
matchCategories: ['module-export-scan'],
|
|
295
|
+
weight: 0.7,
|
|
296
|
+
suggestedTopics: ['module-export', 'barrel-export', 'public-api'],
|
|
297
|
+
relatedRoles: [],
|
|
298
|
+
conditions: { languages: ['typescript', 'javascript'] },
|
|
299
|
+
tierHint: 1,
|
|
300
|
+
displayGroup: 'deep-scan',
|
|
301
|
+
};
|
|
302
|
+
const DL3_PYTHON_STRUCTURE = {
|
|
303
|
+
id: 'python-structure',
|
|
304
|
+
label: 'Python 包结构',
|
|
305
|
+
layer: 'language',
|
|
306
|
+
icon: 'FileCode',
|
|
307
|
+
colorFamily: 'green',
|
|
308
|
+
extractionGuide: '__init__.py 导出策略、相对/绝对导入风格、type hints 覆盖率、decorator 使用模式、__all__ 定义、虚拟环境约定',
|
|
309
|
+
allowedKnowledgeTypes: ['code-standard', 'architecture'],
|
|
310
|
+
outputMode: 'candidate-only',
|
|
311
|
+
qualityDescription: '包结构规范性、导入一致性、类型保障',
|
|
312
|
+
matchTopics: ['python-package', 'import-style', 'type-hints', 'decorator-pattern'],
|
|
313
|
+
matchCategories: ['python-package-scan'],
|
|
314
|
+
weight: 0.7,
|
|
315
|
+
suggestedTopics: ['python-package', 'import-style', 'type-hints'],
|
|
316
|
+
relatedRoles: [],
|
|
317
|
+
conditions: { languages: ['python'] },
|
|
318
|
+
tierHint: 1,
|
|
319
|
+
displayGroup: 'deep-scan',
|
|
320
|
+
};
|
|
321
|
+
const DL4_JVM_ANNOTATION = {
|
|
322
|
+
id: 'jvm-annotation',
|
|
323
|
+
label: '注解体系',
|
|
324
|
+
layer: 'language',
|
|
325
|
+
icon: 'AtSign',
|
|
326
|
+
colorFamily: 'purple',
|
|
327
|
+
extractionGuide: 'DI 注解(@Inject/@Autowired/@Component)、ORM 注解(@Entity/@Table)、API 注解(@RestController)、自定义注解、元编程模式',
|
|
328
|
+
allowedKnowledgeTypes: ['code-pattern', 'architecture'],
|
|
329
|
+
outputMode: 'candidate-only',
|
|
330
|
+
qualityDescription: '注解约定一致性、DI 配置完整性',
|
|
331
|
+
matchTopics: ['annotation', 'di-annotation', 'orm-annotation', 'api-annotation'],
|
|
332
|
+
matchCategories: ['jvm-annotation-scan'],
|
|
333
|
+
weight: 0.7,
|
|
334
|
+
suggestedTopics: ['annotation', 'di-annotation', 'orm-annotation'],
|
|
335
|
+
relatedRoles: [],
|
|
336
|
+
conditions: { languages: ['java', 'kotlin'] },
|
|
337
|
+
tierHint: 1,
|
|
338
|
+
displayGroup: 'deep-scan',
|
|
339
|
+
};
|
|
340
|
+
const DL5_GO_MODULE = {
|
|
341
|
+
id: 'go-module',
|
|
342
|
+
label: 'Go 模块',
|
|
343
|
+
layer: 'language',
|
|
344
|
+
icon: 'Boxes',
|
|
345
|
+
colorFamily: 'cyan',
|
|
346
|
+
extractionGuide: 'go.mod 依赖图、internal 包隔离、cmd/ 入口、build tags、interface 分布与实现、init() 函数清单',
|
|
347
|
+
allowedKnowledgeTypes: ['architecture', 'code-pattern'],
|
|
348
|
+
outputMode: 'candidate-only',
|
|
349
|
+
qualityDescription: '模块隔离完整性、接口设计合理性',
|
|
350
|
+
matchTopics: ['go-module', 'internal-package', 'interface-impl', 'build-tags'],
|
|
351
|
+
matchCategories: ['go-module-scan'],
|
|
352
|
+
weight: 0.7,
|
|
353
|
+
suggestedTopics: ['go-module', 'internal-package', 'interface-impl'],
|
|
354
|
+
relatedRoles: [],
|
|
355
|
+
conditions: { languages: ['go'] },
|
|
356
|
+
tierHint: 1,
|
|
357
|
+
displayGroup: 'deep-scan',
|
|
358
|
+
};
|
|
359
|
+
const DL6_RUST_OWNERSHIP = {
|
|
360
|
+
id: 'rust-ownership',
|
|
361
|
+
label: 'Rust 所有权',
|
|
362
|
+
layer: 'language',
|
|
363
|
+
icon: 'Link2',
|
|
364
|
+
colorFamily: 'stone',
|
|
365
|
+
extractionGuide: '所有权转移模式、生命周期标注约定、trait 实现层次、derive 宏使用、unsafe 块审计、Error 类型层级',
|
|
366
|
+
allowedKnowledgeTypes: ['code-pattern', 'best-practice'],
|
|
367
|
+
outputMode: 'candidate-only',
|
|
368
|
+
qualityDescription: '所有权安全性、trait 设计合理性',
|
|
369
|
+
matchTopics: ['ownership', 'lifetime', 'trait-impl', 'unsafe-audit'],
|
|
370
|
+
matchCategories: [],
|
|
371
|
+
weight: 0.7,
|
|
372
|
+
suggestedTopics: ['ownership', 'lifetime', 'trait-impl'],
|
|
373
|
+
relatedRoles: [],
|
|
374
|
+
conditions: { languages: ['rust'] },
|
|
375
|
+
tierHint: 1,
|
|
376
|
+
displayGroup: 'deep-scan',
|
|
377
|
+
};
|
|
378
|
+
const DL7_CSHARP_DOTNET = {
|
|
379
|
+
id: 'csharp-dotnet',
|
|
380
|
+
label: '.NET 模式',
|
|
381
|
+
layer: 'language',
|
|
382
|
+
icon: 'Component',
|
|
383
|
+
colorFamily: 'teal',
|
|
384
|
+
extractionGuide: 'DI 容器注册模式、LINQ 查询约定、async/await 模式、EF Core 映射、Middleware pipeline、特性标注([Attribute])',
|
|
385
|
+
allowedKnowledgeTypes: ['code-pattern', 'architecture'],
|
|
386
|
+
outputMode: 'candidate-only',
|
|
387
|
+
qualityDescription: 'DI 注册完整性、EF Core 映射正确性',
|
|
388
|
+
matchTopics: ['di-container', 'linq-pattern', 'ef-core', 'middleware', 'attribute'],
|
|
389
|
+
matchCategories: [],
|
|
390
|
+
weight: 0.7,
|
|
391
|
+
suggestedTopics: ['di-container', 'linq-pattern', 'ef-core'],
|
|
392
|
+
relatedRoles: [],
|
|
393
|
+
conditions: { languages: ['csharp'] },
|
|
394
|
+
tierHint: 1,
|
|
395
|
+
displayGroup: 'deep-scan',
|
|
396
|
+
};
|
|
397
|
+
// ═══════════════════════════════════════════════════════════
|
|
398
|
+
// Layer 3: Framework Dimensions (5)
|
|
399
|
+
// ═══════════════════════════════════════════════════════════
|
|
400
|
+
const DF1_REACT_PATTERNS = {
|
|
401
|
+
id: 'react-patterns',
|
|
402
|
+
label: 'React 模式',
|
|
403
|
+
layer: 'framework',
|
|
404
|
+
icon: 'Atom',
|
|
405
|
+
colorFamily: 'sky',
|
|
406
|
+
extractionGuide: '组件目录结构、状态管理约定(Redux/Zustand/Jotai)、Router 约定、数据获取模式(SWR/TanStack Query/Server Components)、样式方案',
|
|
407
|
+
allowedKnowledgeTypes: ['code-standard', 'architecture'],
|
|
408
|
+
outputMode: 'candidate-only',
|
|
409
|
+
qualityDescription: '组件结构一致性、状态管理规范性',
|
|
410
|
+
matchTopics: ['react-component', 'state-management', 'data-fetching', 'ssr-pattern'],
|
|
411
|
+
matchCategories: ['framework-convention-scan'],
|
|
412
|
+
weight: 0.7,
|
|
413
|
+
suggestedTopics: ['react-component', 'state-management', 'data-fetching'],
|
|
414
|
+
relatedRoles: ['ui', 'feature'],
|
|
415
|
+
conditions: { languages: ['typescript', 'javascript'], frameworks: ['react', 'nextjs'] },
|
|
416
|
+
tierHint: 1,
|
|
417
|
+
displayGroup: 'deep-scan',
|
|
418
|
+
};
|
|
419
|
+
const DF2_VUE_PATTERNS = {
|
|
420
|
+
id: 'vue-patterns',
|
|
421
|
+
label: 'Vue 模式',
|
|
422
|
+
layer: 'framework',
|
|
423
|
+
icon: 'Wind',
|
|
424
|
+
colorFamily: 'emerald',
|
|
425
|
+
extractionGuide: 'Composition API vs Options API、Pinia 状态管理、路由守卫、Nuxt 目录约定(pages/layouts/middleware)',
|
|
426
|
+
allowedKnowledgeTypes: ['code-standard', 'architecture'],
|
|
427
|
+
outputMode: 'candidate-only',
|
|
428
|
+
qualityDescription: 'Composition API 一致性、Pinia 约定规范性',
|
|
429
|
+
matchTopics: ['vue-composition', 'pinia', 'nuxt-convention'],
|
|
430
|
+
matchCategories: [],
|
|
431
|
+
weight: 0.7,
|
|
432
|
+
suggestedTopics: ['vue-composition', 'pinia', 'nuxt-convention'],
|
|
433
|
+
relatedRoles: ['ui', 'feature'],
|
|
434
|
+
conditions: { languages: ['typescript', 'javascript'], frameworks: ['vue', 'nuxt'] },
|
|
435
|
+
tierHint: 1,
|
|
436
|
+
displayGroup: 'deep-scan',
|
|
437
|
+
};
|
|
438
|
+
const DF3_SPRING_PATTERNS = {
|
|
439
|
+
id: 'spring-patterns',
|
|
440
|
+
label: 'Spring 模式',
|
|
441
|
+
layer: 'framework',
|
|
442
|
+
icon: 'Leaf',
|
|
443
|
+
colorFamily: 'green',
|
|
444
|
+
extractionGuide: 'Bean 生命周期管理、配置属性绑定、AOP 切面约定、异常处理器、Repository/Service 分层、Actuator 端点',
|
|
445
|
+
allowedKnowledgeTypes: ['code-pattern', 'architecture'],
|
|
446
|
+
outputMode: 'candidate-only',
|
|
447
|
+
qualityDescription: 'Bean 管理完整性、AOP 一致性',
|
|
448
|
+
matchTopics: ['spring-bean', 'aop-aspect', 'config-properties', 'actuator'],
|
|
449
|
+
matchCategories: [],
|
|
450
|
+
weight: 0.7,
|
|
451
|
+
suggestedTopics: ['spring-bean', 'aop-aspect', 'config-properties'],
|
|
452
|
+
relatedRoles: ['service', 'core'],
|
|
453
|
+
conditions: { languages: ['java', 'kotlin'], frameworks: ['spring', 'spring-boot'] },
|
|
454
|
+
tierHint: 1,
|
|
455
|
+
displayGroup: 'deep-scan',
|
|
456
|
+
};
|
|
457
|
+
const DF4_SWIFTUI_PATTERNS = {
|
|
458
|
+
id: 'swiftui-patterns',
|
|
459
|
+
label: 'SwiftUI 模式',
|
|
460
|
+
layer: 'framework',
|
|
461
|
+
icon: 'PaintBucket',
|
|
462
|
+
colorFamily: 'blue',
|
|
463
|
+
extractionGuide: 'View 组合模式、@State/@Binding/@ObservableObject 管理、Navigation 策略、PreferenceKey 使用、环境值注入',
|
|
464
|
+
allowedKnowledgeTypes: ['code-pattern', 'best-practice'],
|
|
465
|
+
outputMode: 'candidate-only',
|
|
466
|
+
qualityDescription: 'View 组合健壮性、状态管理分层合理性',
|
|
467
|
+
matchTopics: ['swiftui-view', 'state-management', 'navigation', 'environment'],
|
|
468
|
+
matchCategories: [],
|
|
469
|
+
weight: 0.7,
|
|
470
|
+
suggestedTopics: ['swiftui-view', 'state-management', 'navigation'],
|
|
471
|
+
relatedRoles: ['ui', 'feature'],
|
|
472
|
+
conditions: { languages: ['swift'], frameworks: ['swiftui'] },
|
|
473
|
+
tierHint: 1,
|
|
474
|
+
displayGroup: 'deep-scan',
|
|
475
|
+
};
|
|
476
|
+
const DF5_DJANGO_FASTAPI = {
|
|
477
|
+
id: 'django-fastapi',
|
|
478
|
+
label: 'Django/FastAPI',
|
|
479
|
+
layer: 'framework',
|
|
480
|
+
icon: 'Server',
|
|
481
|
+
colorFamily: 'amber',
|
|
482
|
+
extractionGuide: 'URL routing 约定、Model/Serializer 分层、Middleware 管线、Dependency Injection(FastAPI)、Admin 定制',
|
|
483
|
+
allowedKnowledgeTypes: ['code-standard', 'architecture'],
|
|
484
|
+
outputMode: 'candidate-only',
|
|
485
|
+
qualityDescription: '路由组织清晰度、ORM 使用规范性',
|
|
486
|
+
matchTopics: ['url-routing', 'model-serializer', 'middleware', 'dependency-injection'],
|
|
487
|
+
matchCategories: [],
|
|
488
|
+
weight: 0.7,
|
|
489
|
+
suggestedTopics: ['url-routing', 'model-serializer', 'middleware'],
|
|
490
|
+
relatedRoles: ['service', 'core'],
|
|
491
|
+
conditions: { languages: ['python'], frameworks: ['django', 'fastapi', 'flask'] },
|
|
492
|
+
tierHint: 1,
|
|
493
|
+
displayGroup: 'deep-scan',
|
|
494
|
+
};
|
|
495
|
+
// ═══════════════════════════════════════════════════════════
|
|
496
|
+
// 维度注册表(唯一来源)
|
|
497
|
+
// ═══════════════════════════════════════════════════════════
|
|
498
|
+
export const DIMENSION_REGISTRY = [
|
|
499
|
+
// Layer 1: Universal (13)
|
|
500
|
+
D1_ARCHITECTURE,
|
|
501
|
+
D2_CODING_STANDARDS,
|
|
502
|
+
D3_DESIGN_PATTERNS,
|
|
503
|
+
D4_ERROR_RESILIENCE,
|
|
504
|
+
D5_CONCURRENCY_ASYNC,
|
|
505
|
+
D6_DATA_EVENT_FLOW,
|
|
506
|
+
D7_NETWORKING_API,
|
|
507
|
+
D8_UI_INTERACTION,
|
|
508
|
+
D9_TESTING_QUALITY,
|
|
509
|
+
D10_SECURITY_AUTH,
|
|
510
|
+
D11_PERFORMANCE_OPTIMIZATION,
|
|
511
|
+
D12_OBSERVABILITY_LOGGING,
|
|
512
|
+
D13_AGENT_GUIDELINES,
|
|
513
|
+
// Layer 2: Language (7)
|
|
514
|
+
DL1_SWIFT_OBJC_IDIOM,
|
|
515
|
+
DL2_TS_JS_MODULE,
|
|
516
|
+
DL3_PYTHON_STRUCTURE,
|
|
517
|
+
DL4_JVM_ANNOTATION,
|
|
518
|
+
DL5_GO_MODULE,
|
|
519
|
+
DL6_RUST_OWNERSHIP,
|
|
520
|
+
DL7_CSHARP_DOTNET,
|
|
521
|
+
// Layer 3: Framework (5)
|
|
522
|
+
DF1_REACT_PATTERNS,
|
|
523
|
+
DF2_VUE_PATTERNS,
|
|
524
|
+
DF3_SPRING_PATTERNS,
|
|
525
|
+
DF4_SWIFTUI_PATTERNS,
|
|
526
|
+
DF5_DJANGO_FASTAPI,
|
|
527
|
+
];
|
|
528
|
+
// ═══════════════════════════════════════════════════════════
|
|
529
|
+
// 查询辅助函数
|
|
530
|
+
// ═══════════════════════════════════════════════════════════
|
|
531
|
+
// ═══════════════════════════════════════════════════════════
|
|
532
|
+
// 维度展示分组映射 — 从注册表自动派生
|
|
533
|
+
// ═══════════════════════════════════════════════════════════
|
|
534
|
+
/**
|
|
535
|
+
* 维度 ID → 展示分组 ID 映射
|
|
536
|
+
*
|
|
537
|
+
* 展示分组:
|
|
538
|
+
* - 'architecture' — 架构与设计
|
|
539
|
+
* - 'best-practice' — 规范与实践
|
|
540
|
+
* - 'data-event-flow' — 数据与并发
|
|
541
|
+
* - 'deep-scan' — 深度扫描(语言/框架条件维度)
|
|
542
|
+
*/
|
|
543
|
+
export const DIMENSION_DISPLAY_GROUP = Object.fromEntries(DIMENSION_REGISTRY.map((d) => [d.id, d.displayGroup]));
|
|
544
|
+
/** 按 ID 获取维度 */
|
|
545
|
+
export function getDimension(id) {
|
|
546
|
+
return DIMENSION_REGISTRY.find((d) => d.id === id);
|
|
547
|
+
}
|
|
548
|
+
/** 获取指定层级的所有维度 */
|
|
549
|
+
export function getDimensionsByLayer(layer) {
|
|
550
|
+
return DIMENSION_REGISTRY.filter((d) => d.layer === layer);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* 根据项目语言和框架过滤出活跃维度
|
|
554
|
+
*
|
|
555
|
+
* - Layer 1 (universal): 全部返回
|
|
556
|
+
* - Layer 2 (language): 仅当项目语言匹配时返回
|
|
557
|
+
* - Layer 3 (framework): 仅当项目语言+框架均匹配时返回
|
|
558
|
+
*/
|
|
559
|
+
export function resolveActiveDimensions(primaryLang, detectedFrameworks = []) {
|
|
560
|
+
return DIMENSION_REGISTRY.filter((dim) => {
|
|
561
|
+
if (!dim.conditions) {
|
|
562
|
+
return true; // Layer 1: 无条件 → 通用维度
|
|
563
|
+
}
|
|
564
|
+
const langMatch = !dim.conditions.languages || dim.conditions.languages.includes(primaryLang);
|
|
565
|
+
const fwMatch = !dim.conditions.frameworks ||
|
|
566
|
+
dim.conditions.frameworks.some((f) => detectedFrameworks.includes(f));
|
|
567
|
+
// languages 必须匹配;frameworks 条件存在时也需匹配
|
|
568
|
+
return langMatch && (dim.conditions.frameworks ? fwMatch : true);
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* 构建 Tier 分层调度计划
|
|
573
|
+
*
|
|
574
|
+
* 基于每个维度的 tierHint 字段将活跃维度分为 3 层:
|
|
575
|
+
* - Tier 1 (tierHint=1): 基础数据层 — architecture + 语言/框架条件维度
|
|
576
|
+
* - Tier 2 (tierHint=2): 规范+设计层 — coding-standards, design-patterns
|
|
577
|
+
* - Tier 3 (tierHint=3): 实践+质量层 — 其余所有维度
|
|
578
|
+
*/
|
|
579
|
+
export function buildTierPlan(activeDims = DIMENSION_REGISTRY) {
|
|
580
|
+
const tier1 = [];
|
|
581
|
+
const tier2 = [];
|
|
582
|
+
const tier3 = [];
|
|
583
|
+
for (const dim of activeDims) {
|
|
584
|
+
const hint = dim.tierHint ?? 3;
|
|
585
|
+
if (hint === 1) {
|
|
586
|
+
tier1.push(dim.id);
|
|
587
|
+
}
|
|
588
|
+
else if (hint === 2) {
|
|
589
|
+
tier2.push(dim.id);
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
tier3.push(dim.id);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return [tier1, tier2, tier3].filter((t) => t.length > 0);
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* 将 Recipe 分类到最匹配的维度
|
|
599
|
+
*
|
|
600
|
+
* 优先级: topicHint 精确匹配 → category 匹配 → null
|
|
601
|
+
*/
|
|
602
|
+
export function classifyRecipeToDimension(topicHint, category) {
|
|
603
|
+
// 1. topicHint 精确匹配
|
|
604
|
+
if (topicHint) {
|
|
605
|
+
for (const dim of DIMENSION_REGISTRY) {
|
|
606
|
+
if (dim.matchTopics.includes(topicHint)) {
|
|
607
|
+
return dim.id;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
// 2. category 匹配
|
|
612
|
+
if (category) {
|
|
613
|
+
for (const dim of DIMENSION_REGISTRY) {
|
|
614
|
+
if (dim.matchCategories.includes(category)) {
|
|
615
|
+
return dim.id;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return null;
|
|
620
|
+
}
|