autosnippet 3.3.4 → 3.3.6
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/README.md +174 -83
- package/config/constitution.yaml +2 -0
- package/dashboard/dist/assets/icons-D1aVZYFW.js +1 -0
- package/dashboard/dist/assets/index-CxHOu8Hd.css +1 -0
- package/dashboard/dist/assets/index-DDdAOpYT.js +128 -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 +136 -9
- package/dist/lib/agent/AgentFactory.d.ts +0 -17
- package/dist/lib/agent/AgentFactory.js +1 -25
- 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/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/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 +1 -1
- package/dist/lib/cli/KnowledgeSyncService.d.ts +5 -1
- package/dist/lib/cli/KnowledgeSyncService.js +6 -3
- package/dist/lib/core/AstAnalyzer.d.ts +1 -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 +33 -111
- package/dist/lib/domain/knowledge/KnowledgeEntry.js +27 -6
- 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/domain/knowledge/values/Stats.d.ts +1 -1
- package/dist/lib/domain/knowledge/values/Stats.js +2 -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/orchestrator.d.ts +99 -12
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +172 -161
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/tier-scheduler.js +7 -17
- 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 +14 -10
- package/dist/lib/external/mcp/handlers/bootstrap-external.js +39 -51
- package/dist/lib/external/mcp/handlers/bootstrap-internal.d.ts +2 -0
- package/dist/lib/external/mcp/handlers/bootstrap-internal.js +115 -82
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +4 -4
- package/dist/lib/external/mcp/handlers/consolidated.js +115 -162
- package/dist/lib/external/mcp/handlers/dimension-complete-external.js +69 -1
- package/dist/lib/external/mcp/handlers/evolve-external.d.ts +54 -0
- package/dist/lib/external/mcp/handlers/evolve-external.js +226 -0
- package/dist/lib/external/mcp/handlers/knowledge.js +26 -2
- 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 +60 -3
- package/dist/lib/http/routes/knowledge.js +122 -1
- package/dist/lib/http/routes/modules.js +25 -3
- package/dist/lib/http/routes/panorama.js +16 -4
- 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.js +55 -0
- package/dist/lib/injection/ServiceMap.d.ts +8 -1
- package/dist/lib/injection/modules/InfraModule.js +4 -1
- package/dist/lib/injection/modules/KnowledgeModule.js +38 -1
- package/dist/lib/repository/evolution/ProposalRepository.d.ts +99 -0
- package/dist/lib/repository/evolution/ProposalRepository.js +255 -0
- 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 +22 -4
- package/dist/lib/service/bootstrap/UiStartupTasks.js +73 -5
- 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 +85 -0
- package/dist/lib/service/cleanup/CleanupService.js +324 -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/DecayDetector.d.ts +4 -3
- package/dist/lib/service/evolution/DecayDetector.js +97 -22
- package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +4 -2
- package/dist/lib/service/evolution/KnowledgeMetabolism.js +29 -2
- package/dist/lib/service/evolution/ProposalExecutor.d.ts +66 -0
- package/dist/lib/service/evolution/ProposalExecutor.js +424 -0
- 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/StagingManager.js +5 -3
- 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/guard/GuardCrossFileChecks.js +2 -0
- package/dist/lib/service/guard/ReverseGuard.d.ts +1 -1
- package/dist/lib/service/guard/ReverseGuard.js +32 -2
- 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 +44 -4
- package/dist/lib/service/knowledge/RecipeProductionGateway.d.ts +225 -0
- package/dist/lib/service/knowledge/RecipeProductionGateway.js +384 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.d.ts +2 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.js +48 -0
- package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +3 -2
- package/dist/lib/service/panorama/DimensionAnalyzer.js +15 -140
- 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/shared/schemas/common.d.ts +4 -4
- package/dist/lib/shared/schemas/http-requests.d.ts +12 -1
- package/dist/lib/shared/schemas/http-requests.js +8 -0
- package/dist/lib/shared/schemas/mcp-tools.d.ts +33 -2
- package/dist/lib/shared/schemas/mcp-tools.js +42 -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 +131 -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,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedDimension — 统一维度类型定义
|
|
3
|
+
*
|
|
4
|
+
* Bootstrap / Panorama / Rescan 共用的维度接口,
|
|
5
|
+
* 消除三套维度体系之间的 ID 不一致和字段缺失问题。
|
|
6
|
+
*
|
|
7
|
+
* 设计文档: docs/copilot/unified-dimension-design.md §4
|
|
8
|
+
*
|
|
9
|
+
* @module domain/dimension/UnifiedDimension
|
|
10
|
+
*/
|
|
11
|
+
/** 统一维度定义 — Bootstrap/Panorama/Rescan 共用 */
|
|
12
|
+
export interface UnifiedDimension {
|
|
13
|
+
/** 维度唯一 ID,kebab-case */
|
|
14
|
+
readonly id: string;
|
|
15
|
+
/** 维度中文标签(Dashboard 分组标签) */
|
|
16
|
+
readonly label: string;
|
|
17
|
+
/** 层级: universal | language | framework */
|
|
18
|
+
readonly layer: 'universal' | 'language' | 'framework';
|
|
19
|
+
/** Lucide 图标名 */
|
|
20
|
+
readonly icon: string;
|
|
21
|
+
/** Tailwind 颜色族(如 'violet', 'fuchsia', 'sky') */
|
|
22
|
+
readonly colorFamily: string;
|
|
23
|
+
/** 提取指南 — 告诉 Agent 从项目中挖掘什么 */
|
|
24
|
+
readonly extractionGuide: string;
|
|
25
|
+
/** 允许的 knowledgeType */
|
|
26
|
+
readonly allowedKnowledgeTypes: readonly string[];
|
|
27
|
+
/** 输出模式(当前阶段仅 candidate-only,Skill 后续规划) */
|
|
28
|
+
readonly outputMode: 'candidate-only';
|
|
29
|
+
/** 健康评估描述 */
|
|
30
|
+
readonly qualityDescription: string;
|
|
31
|
+
/** 主匹配字段: topicHint */
|
|
32
|
+
readonly matchTopics: readonly string[];
|
|
33
|
+
/** 次匹配字段: category */
|
|
34
|
+
readonly matchCategories: readonly string[];
|
|
35
|
+
/** 维度权重 (0-1, Panorama 加权平均) */
|
|
36
|
+
readonly weight: number;
|
|
37
|
+
/** gap 时的建议主题 */
|
|
38
|
+
readonly suggestedTopics: readonly string[];
|
|
39
|
+
/** 关联模块角色 (gap 优先级推断) */
|
|
40
|
+
readonly relatedRoles: readonly string[];
|
|
41
|
+
readonly conditions?: {
|
|
42
|
+
readonly languages?: readonly string[];
|
|
43
|
+
readonly frameworks?: readonly string[];
|
|
44
|
+
};
|
|
45
|
+
/** 1=最先 (Tier 1), 2=中间, 3=最后 */
|
|
46
|
+
readonly tierHint?: number;
|
|
47
|
+
/** Dashboard 展示分组 */
|
|
48
|
+
readonly displayGroup: 'architecture' | 'best-practice' | 'data-event-flow' | 'deep-scan';
|
|
49
|
+
}
|
|
50
|
+
/** Layer 1: 通用维度 ID */
|
|
51
|
+
export declare const UNIVERSAL_DIM_IDS: readonly ["architecture", "coding-standards", "design-patterns", "error-resilience", "concurrency-async", "data-event-flow", "networking-api", "ui-interaction", "testing-quality", "security-auth", "performance-optimization", "observability-logging", "agent-guidelines"];
|
|
52
|
+
/** Layer 2: 语言维度 ID */
|
|
53
|
+
export declare const LANGUAGE_DIM_IDS: readonly ["swift-objc-idiom", "ts-js-module", "python-structure", "jvm-annotation", "go-module", "rust-ownership", "csharp-dotnet"];
|
|
54
|
+
/** Layer 3: 框架维度 ID */
|
|
55
|
+
export declare const FRAMEWORK_DIM_IDS: readonly ["react-patterns", "vue-patterns", "spring-patterns", "swiftui-patterns", "django-fastapi"];
|
|
56
|
+
export type UniversalDimId = (typeof UNIVERSAL_DIM_IDS)[number];
|
|
57
|
+
export type LanguageDimId = (typeof LANGUAGE_DIM_IDS)[number];
|
|
58
|
+
export type FrameworkDimId = (typeof FRAMEWORK_DIM_IDS)[number];
|
|
59
|
+
export type DimensionId = UniversalDimId | LanguageDimId | FrameworkDimId;
|
|
60
|
+
/** 所有维度 ID 数组 */
|
|
61
|
+
export declare const ALL_DIMENSION_IDS: readonly ["architecture", "coding-standards", "design-patterns", "error-resilience", "concurrency-async", "data-event-flow", "networking-api", "ui-interaction", "testing-quality", "security-auth", "performance-optimization", "observability-logging", "agent-guidelines", "swift-objc-idiom", "ts-js-module", "python-structure", "jvm-annotation", "go-module", "rust-ownership", "csharp-dotnet", "react-patterns", "vue-patterns", "spring-patterns", "swiftui-patterns", "django-fastapi"];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedDimension — 统一维度类型定义
|
|
3
|
+
*
|
|
4
|
+
* Bootstrap / Panorama / Rescan 共用的维度接口,
|
|
5
|
+
* 消除三套维度体系之间的 ID 不一致和字段缺失问题。
|
|
6
|
+
*
|
|
7
|
+
* 设计文档: docs/copilot/unified-dimension-design.md §4
|
|
8
|
+
*
|
|
9
|
+
* @module domain/dimension/UnifiedDimension
|
|
10
|
+
*/
|
|
11
|
+
// ═══════════════════════════════════════════════════════════
|
|
12
|
+
// 维度 ID 常量
|
|
13
|
+
// ═══════════════════════════════════════════════════════════
|
|
14
|
+
/** Layer 1: 通用维度 ID */
|
|
15
|
+
export const UNIVERSAL_DIM_IDS = [
|
|
16
|
+
'architecture',
|
|
17
|
+
'coding-standards',
|
|
18
|
+
'design-patterns',
|
|
19
|
+
'error-resilience',
|
|
20
|
+
'concurrency-async',
|
|
21
|
+
'data-event-flow',
|
|
22
|
+
'networking-api',
|
|
23
|
+
'ui-interaction',
|
|
24
|
+
'testing-quality',
|
|
25
|
+
'security-auth',
|
|
26
|
+
'performance-optimization',
|
|
27
|
+
'observability-logging',
|
|
28
|
+
'agent-guidelines',
|
|
29
|
+
];
|
|
30
|
+
/** Layer 2: 语言维度 ID */
|
|
31
|
+
export const LANGUAGE_DIM_IDS = [
|
|
32
|
+
'swift-objc-idiom',
|
|
33
|
+
'ts-js-module',
|
|
34
|
+
'python-structure',
|
|
35
|
+
'jvm-annotation',
|
|
36
|
+
'go-module',
|
|
37
|
+
'rust-ownership',
|
|
38
|
+
'csharp-dotnet',
|
|
39
|
+
];
|
|
40
|
+
/** Layer 3: 框架维度 ID */
|
|
41
|
+
export const FRAMEWORK_DIM_IDS = [
|
|
42
|
+
'react-patterns',
|
|
43
|
+
'vue-patterns',
|
|
44
|
+
'spring-patterns',
|
|
45
|
+
'swiftui-patterns',
|
|
46
|
+
'django-fastapi',
|
|
47
|
+
];
|
|
48
|
+
/** 所有维度 ID 数组 */
|
|
49
|
+
export const ALL_DIMENSION_IDS = [
|
|
50
|
+
...UNIVERSAL_DIM_IDS,
|
|
51
|
+
...LANGUAGE_DIM_IDS,
|
|
52
|
+
...FRAMEWORK_DIM_IDS,
|
|
53
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dimension domain — 统一维度体系
|
|
3
|
+
*
|
|
4
|
+
* @module domain/dimension
|
|
5
|
+
*/
|
|
6
|
+
export { DimensionCopy } from './DimensionCopy.js';
|
|
7
|
+
export { buildTierPlan, classifyRecipeToDimension, DIMENSION_DISPLAY_GROUP, DIMENSION_REGISTRY, getDimension, getDimensionsByLayer, resolveActiveDimensions, } from './DimensionRegistry.js';
|
|
8
|
+
export { getDimensionFocusKeywords, getDimensionSOP, PRE_SUBMIT_CHECKLIST, sopToCompactText, } from './DimensionSop.js';
|
|
9
|
+
export type { DimensionId, FrameworkDimId, LanguageDimId, UnifiedDimension, UniversalDimId, } from './UnifiedDimension.js';
|
|
10
|
+
export { ALL_DIMENSION_IDS, FRAMEWORK_DIM_IDS, LANGUAGE_DIM_IDS, UNIVERSAL_DIM_IDS, } from './UnifiedDimension.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dimension domain — 统一维度体系
|
|
3
|
+
*
|
|
4
|
+
* @module domain/dimension
|
|
5
|
+
*/
|
|
6
|
+
export { DimensionCopy } from './DimensionCopy.js';
|
|
7
|
+
export { buildTierPlan, classifyRecipeToDimension, DIMENSION_DISPLAY_GROUP, DIMENSION_REGISTRY, getDimension, getDimensionsByLayer, resolveActiveDimensions, } from './DimensionRegistry.js';
|
|
8
|
+
export { getDimensionFocusKeywords, getDimensionSOP, PRE_SUBMIT_CHECKLIST, sopToCompactText, } from './DimensionSop.js';
|
|
9
|
+
export { ALL_DIMENSION_IDS, FRAMEWORK_DIM_IDS, LANGUAGE_DIM_IDS, UNIVERSAL_DIM_IDS, } from './UnifiedDimension.js';
|
|
@@ -54,7 +54,7 @@ export declare const V3_FIELD_SPEC: ({
|
|
|
54
54
|
systemInjected?: undefined;
|
|
55
55
|
})[];
|
|
56
56
|
export declare const STANDARD_CATEGORIES: string[];
|
|
57
|
-
/** category 白名单 —
|
|
57
|
+
/** category 白名单 — 统一维度 ID + 特殊流程中的合法 category */
|
|
58
58
|
export declare const WHITELISTED_CATEGORIES: string[];
|
|
59
59
|
export declare const VALID_KINDS: string[];
|
|
60
60
|
export declare const VALID_TOPIC_HINTS: string[];
|
|
@@ -32,7 +32,7 @@ export const V3_FIELD_SPEC = [
|
|
|
32
32
|
name: 'title',
|
|
33
33
|
level: FieldLevel.REQUIRED,
|
|
34
34
|
type: 'string',
|
|
35
|
-
rule: '中文 ≤20
|
|
35
|
+
rule: '中文 ≤20 字,引用项目真实类名(不以项目名开头)',
|
|
36
36
|
pipeline: 'identity + dedup + search + QualityScorer(completeness 0.25)',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -226,24 +226,37 @@ export const STANDARD_CATEGORIES = [
|
|
|
226
226
|
'UI',
|
|
227
227
|
'Utility',
|
|
228
228
|
];
|
|
229
|
-
/** category 白名单 —
|
|
229
|
+
/** category 白名单 — 统一维度 ID + 特殊流程中的合法 category */
|
|
230
230
|
export const WHITELISTED_CATEGORIES = [
|
|
231
|
-
//
|
|
231
|
+
// ── Layer 1: 通用维度 ──
|
|
232
232
|
'architecture',
|
|
233
|
-
'
|
|
234
|
-
'
|
|
235
|
-
'
|
|
233
|
+
'coding-standards',
|
|
234
|
+
'design-patterns',
|
|
235
|
+
'error-resilience',
|
|
236
|
+
'concurrency-async',
|
|
237
|
+
'data-event-flow',
|
|
238
|
+
'networking-api',
|
|
239
|
+
'ui-interaction',
|
|
240
|
+
'testing-quality',
|
|
241
|
+
'security-auth',
|
|
242
|
+
'performance-optimization',
|
|
243
|
+
'observability-logging',
|
|
236
244
|
'agent-guidelines',
|
|
237
|
-
//
|
|
238
|
-
'
|
|
239
|
-
'
|
|
240
|
-
'
|
|
241
|
-
'
|
|
242
|
-
'module
|
|
243
|
-
'
|
|
244
|
-
'
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
// ── Layer 2: 语言维度 ──
|
|
246
|
+
'swift-objc-idiom',
|
|
247
|
+
'ts-js-module',
|
|
248
|
+
'python-structure',
|
|
249
|
+
'jvm-annotation',
|
|
250
|
+
'go-module',
|
|
251
|
+
'rust-ownership',
|
|
252
|
+
'csharp-dotnet',
|
|
253
|
+
// ── Layer 3: 框架维度 ──
|
|
254
|
+
'react-patterns',
|
|
255
|
+
'vue-patterns',
|
|
256
|
+
'spring-patterns',
|
|
257
|
+
'swiftui-patterns',
|
|
258
|
+
'django-fastapi',
|
|
259
|
+
// ── 特殊来源 ──
|
|
247
260
|
'bootstrap',
|
|
248
261
|
'knowledge',
|
|
249
262
|
'general',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnowledgeEntryWire } from '#types/knowledge-wire.js';
|
|
2
2
|
import { Constraints, Content, Quality, Reasoning, Relations, Stats } from './values/index.js';
|
|
3
3
|
export interface KnowledgeEntryProps {
|
|
4
4
|
id?: string;
|
|
@@ -104,24 +104,49 @@ export declare class KnowledgeEntry {
|
|
|
104
104
|
publishedBy: string | null;
|
|
105
105
|
constructor(props?: KnowledgeEntryProps);
|
|
106
106
|
/**
|
|
107
|
-
* 发布 (pending → active)
|
|
108
|
-
* @returns }
|
|
107
|
+
* 发布 (pending|staging|evolving → active)
|
|
109
108
|
*/
|
|
110
109
|
publish(publisher: string): {
|
|
111
110
|
success: boolean;
|
|
112
111
|
error?: string;
|
|
113
112
|
};
|
|
114
113
|
/**
|
|
115
|
-
*
|
|
116
|
-
|
|
114
|
+
* 进入暂存期 (pending → staging)
|
|
115
|
+
*/
|
|
116
|
+
stage(): {
|
|
117
|
+
success: boolean;
|
|
118
|
+
error?: string;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* 进入进化态 (active → evolving)
|
|
122
|
+
*/
|
|
123
|
+
evolve(): {
|
|
124
|
+
success: boolean;
|
|
125
|
+
error?: string;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* 进入衰退观察 (active|evolving → decaying)
|
|
129
|
+
*/
|
|
130
|
+
decay(): {
|
|
131
|
+
success: boolean;
|
|
132
|
+
error?: string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 恢复为已发布 (decaying|evolving → active),不更新 publishedAt
|
|
136
|
+
*/
|
|
137
|
+
restore(): {
|
|
138
|
+
success: boolean;
|
|
139
|
+
error?: string;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* 弃用 (pending|active|decaying → deprecated)
|
|
117
143
|
*/
|
|
118
144
|
deprecate(reason: string): {
|
|
119
145
|
success: boolean;
|
|
120
146
|
error?: string;
|
|
121
147
|
};
|
|
122
148
|
/**
|
|
123
|
-
* 重新激活 (deprecated → pending)
|
|
124
|
-
* @returns }
|
|
149
|
+
* 重新激活 (deprecated|staging → pending)
|
|
125
150
|
*/
|
|
126
151
|
reactivate(): {
|
|
127
152
|
success: boolean;
|
|
@@ -165,110 +190,7 @@ export declare class KnowledgeEntry {
|
|
|
165
190
|
* Domain → JSON (camelCase 直出,全链路统一)
|
|
166
191
|
* 注意: tags 保留原始值(含系统标签),对外 API 使用 sanitizeForAPI() 过滤
|
|
167
192
|
*/
|
|
168
|
-
toJSON():
|
|
169
|
-
id: string;
|
|
170
|
-
title: string;
|
|
171
|
-
description: string;
|
|
172
|
-
lifecycle: string;
|
|
173
|
-
lifecycleHistory: {
|
|
174
|
-
from: string;
|
|
175
|
-
to: string;
|
|
176
|
-
at: number;
|
|
177
|
-
}[];
|
|
178
|
-
autoApprovable: boolean;
|
|
179
|
-
language: string;
|
|
180
|
-
category: string;
|
|
181
|
-
kind: string;
|
|
182
|
-
knowledgeType: string;
|
|
183
|
-
complexity: string;
|
|
184
|
-
scope: string;
|
|
185
|
-
difficulty: string | null;
|
|
186
|
-
tags: string[];
|
|
187
|
-
trigger: string;
|
|
188
|
-
topicHint: string;
|
|
189
|
-
whenClause: string;
|
|
190
|
-
doClause: string;
|
|
191
|
-
dontClause: string;
|
|
192
|
-
coreCode: string;
|
|
193
|
-
usageGuide: string;
|
|
194
|
-
content: {
|
|
195
|
-
pattern: string;
|
|
196
|
-
markdown: string;
|
|
197
|
-
rationale: string;
|
|
198
|
-
steps: {
|
|
199
|
-
title?: string;
|
|
200
|
-
description?: string;
|
|
201
|
-
code?: string;
|
|
202
|
-
}[];
|
|
203
|
-
codeChanges: {
|
|
204
|
-
file: string;
|
|
205
|
-
before: string;
|
|
206
|
-
after: string;
|
|
207
|
-
explanation: string;
|
|
208
|
-
}[];
|
|
209
|
-
verification: {
|
|
210
|
-
method?: string;
|
|
211
|
-
expected_result?: string;
|
|
212
|
-
test_code?: string;
|
|
213
|
-
} | null;
|
|
214
|
-
};
|
|
215
|
-
relations: {
|
|
216
|
-
[x: string]: import("./values/Relations.js").RelationEntry[];
|
|
217
|
-
};
|
|
218
|
-
constraints: {
|
|
219
|
-
guards: Guard[];
|
|
220
|
-
boundaries: string[];
|
|
221
|
-
preconditions: string[];
|
|
222
|
-
sideEffects: string[];
|
|
223
|
-
};
|
|
224
|
-
reasoning: {
|
|
225
|
-
whyStandard: string;
|
|
226
|
-
sources: string[];
|
|
227
|
-
confidence: number;
|
|
228
|
-
qualitySignals: Record<string, number>;
|
|
229
|
-
alternatives: string[];
|
|
230
|
-
};
|
|
231
|
-
quality: {
|
|
232
|
-
completeness: number;
|
|
233
|
-
adaptation: number;
|
|
234
|
-
documentation: number;
|
|
235
|
-
overall: number;
|
|
236
|
-
grade: string;
|
|
237
|
-
};
|
|
238
|
-
stats: {
|
|
239
|
-
views: number;
|
|
240
|
-
adoptions: number;
|
|
241
|
-
applications: number;
|
|
242
|
-
guardHits: number;
|
|
243
|
-
searchHits: number;
|
|
244
|
-
authority: number;
|
|
245
|
-
lastHitAt: number | null;
|
|
246
|
-
lastSearchedAt: number | null;
|
|
247
|
-
lastGuardHitAt: number | null;
|
|
248
|
-
hitsLast30d: number;
|
|
249
|
-
hitsLast90d: number;
|
|
250
|
-
searchHitsLast30d: number;
|
|
251
|
-
version: number;
|
|
252
|
-
ruleFalsePositiveRate: number | null;
|
|
253
|
-
};
|
|
254
|
-
headers: string[];
|
|
255
|
-
headerPaths: string[];
|
|
256
|
-
moduleName: string;
|
|
257
|
-
includeHeaders: boolean;
|
|
258
|
-
agentNotes: string | null;
|
|
259
|
-
aiInsight: string | null;
|
|
260
|
-
reviewedBy: string | null;
|
|
261
|
-
reviewedAt: number | null;
|
|
262
|
-
rejectionReason: string | null;
|
|
263
|
-
source: string;
|
|
264
|
-
sourceFile: string | null;
|
|
265
|
-
sourceCandidateId: string | null;
|
|
266
|
-
createdBy: string;
|
|
267
|
-
createdAt: number;
|
|
268
|
-
updatedAt: number;
|
|
269
|
-
publishedAt: number | null;
|
|
270
|
-
publishedBy: string | null;
|
|
271
|
-
};
|
|
193
|
+
toJSON(): KnowledgeEntryWire;
|
|
272
194
|
/** JSON → Domain (camelCase 直入) */
|
|
273
195
|
static fromJSON(data: unknown): KnowledgeEntry;
|
|
274
196
|
/** @returns } */
|
|
@@ -116,8 +116,7 @@ export class KnowledgeEntry {
|
|
|
116
116
|
}
|
|
117
117
|
/* ═══ 生命周期操作 ═══════════════════════════════════ */
|
|
118
118
|
/**
|
|
119
|
-
* 发布 (pending → active)
|
|
120
|
-
* @returns }
|
|
119
|
+
* 发布 (pending|staging|evolving → active)
|
|
121
120
|
*/
|
|
122
121
|
publish(publisher) {
|
|
123
122
|
if (!this.isValid()) {
|
|
@@ -131,8 +130,31 @@ export class KnowledgeEntry {
|
|
|
131
130
|
return result;
|
|
132
131
|
}
|
|
133
132
|
/**
|
|
134
|
-
*
|
|
135
|
-
|
|
133
|
+
* 进入暂存期 (pending → staging)
|
|
134
|
+
*/
|
|
135
|
+
stage() {
|
|
136
|
+
return this._transition(Lifecycle.STAGING);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 进入进化态 (active → evolving)
|
|
140
|
+
*/
|
|
141
|
+
evolve() {
|
|
142
|
+
return this._transition(Lifecycle.EVOLVING);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 进入衰退观察 (active|evolving → decaying)
|
|
146
|
+
*/
|
|
147
|
+
decay() {
|
|
148
|
+
return this._transition(Lifecycle.DECAYING);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 恢复为已发布 (decaying|evolving → active),不更新 publishedAt
|
|
152
|
+
*/
|
|
153
|
+
restore() {
|
|
154
|
+
return this._transition(Lifecycle.ACTIVE);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 弃用 (pending|active|decaying → deprecated)
|
|
136
158
|
*/
|
|
137
159
|
deprecate(reason) {
|
|
138
160
|
const result = this._transition(Lifecycle.DEPRECATED);
|
|
@@ -142,8 +164,7 @@ export class KnowledgeEntry {
|
|
|
142
164
|
return result;
|
|
143
165
|
}
|
|
144
166
|
/**
|
|
145
|
-
* 重新激活 (deprecated → pending)
|
|
146
|
-
* @returns }
|
|
167
|
+
* 重新激活 (deprecated|staging → pending)
|
|
147
168
|
*/
|
|
148
169
|
reactivate() {
|
|
149
170
|
const result = this._transition(Lifecycle.PENDING);
|
|
@@ -16,6 +16,7 @@ export interface PaginatedResult {
|
|
|
16
16
|
export declare class KnowledgeRepository {
|
|
17
17
|
create(entry: KnowledgeEntry): Promise<KnowledgeEntry>;
|
|
18
18
|
findById(id: string): Promise<KnowledgeEntry | null>;
|
|
19
|
+
findByTitle(title: string): Promise<KnowledgeEntry | null>;
|
|
19
20
|
findWithPagination(filters?: Record<string, unknown>, options?: PaginationOptions & {
|
|
20
21
|
orderBy?: string;
|
|
21
22
|
order?: string;
|
|
@@ -11,6 +11,9 @@ export class KnowledgeRepository {
|
|
|
11
11
|
async findById(id) {
|
|
12
12
|
throw new Error('Not implemented');
|
|
13
13
|
}
|
|
14
|
+
async findByTitle(title) {
|
|
15
|
+
throw new Error('Not implemented');
|
|
16
|
+
}
|
|
14
17
|
async findWithPagination(filters, options) {
|
|
15
18
|
throw new Error('Not implemented');
|
|
16
19
|
}
|
|
@@ -33,7 +33,7 @@ const VALID_TRANSITIONS = {
|
|
|
33
33
|
[Lifecycle.PENDING]: [Lifecycle.STAGING, Lifecycle.ACTIVE, Lifecycle.DEPRECATED],
|
|
34
34
|
[Lifecycle.STAGING]: [Lifecycle.ACTIVE, Lifecycle.PENDING],
|
|
35
35
|
[Lifecycle.ACTIVE]: [Lifecycle.EVOLVING, Lifecycle.DECAYING, Lifecycle.DEPRECATED],
|
|
36
|
-
[Lifecycle.EVOLVING]: [Lifecycle.ACTIVE, Lifecycle.DECAYING],
|
|
36
|
+
[Lifecycle.EVOLVING]: [Lifecycle.STAGING, Lifecycle.ACTIVE, Lifecycle.DECAYING],
|
|
37
37
|
[Lifecycle.DECAYING]: [Lifecycle.ACTIVE, Lifecycle.DEPRECATED],
|
|
38
38
|
[Lifecycle.DEPRECATED]: [Lifecycle.PENDING],
|
|
39
39
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module shared/StyleGuide
|
|
8
8
|
*/
|
|
9
|
-
export declare const PROJECT_SNAPSHOT_STYLE_GUIDE = "# \u300C\u9879\u76EE\u7279\u5199\u300D\u5199\u4F5C\u8981\u6C42\n\nsubmit_knowledge \u7684 content.markdown \u5B57\u6BB5\u5FC5\u987B\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\u3002\n\n## \u4EC0\u4E48\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\n\u5C06\u4E00\u79CD\u6280\u672F\u7684**\u57FA\u672C\u7528\u6CD5**\u4E0E**\u672C\u9879\u76EE\u7684\u5177\u4F53\u7279\u5F81**\u878D\u5408\u4E3A\u4E00\u4F53\u3002\n\n## \u56DB\u5927\u6838\u5FC3\u5185\u5BB9\n1. **\u9879\u76EE\u9009\u62E9\u4E86\u4EC0\u4E48** \u2014 \u91C7\u7528\u4E86\u54EA\u79CD\u5199\u6CD5/\u6A21\u5F0F/\u7EA6\u5B9A\n2. **\u4E3A\u4EC0\u4E48\u8FD9\u6837\u9009** \u2014 \u7EDF\u8BA1\u5206\u5E03\u3001\u5360\u6BD4\u3001\u5386\u53F2\u51B3\u7B56\n3. **\u9879\u76EE\u7981\u6B62\u4EC0\u4E48** \u2014 \u53CD\u6A21\u5F0F\u3001\u5DF2\u5E9F\u5F03\u5199\u6CD5\n4. **\u65B0\u4EE3\u7801\u600E\u4E48\u5199** \u2014 \u53EF\u76F4\u63A5\u590D\u5236\u4F7F\u7528\u7684\u4EE3\u7801\u6A21\u677F + \u6765\u6E90\u6807\u6CE8 (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n\n## \u683C\u5F0F\u8981\u6C42\n- \u6807\u9898\u4F7F\u7528\u9879\u76EE\u771F\u5B9E\u7C7B\u540D/\u524D\u7F00\uFF0C\u4E0D\u7528\u5360\u4F4D\u540D\n- \u4EE3\u7801\u6765\u6E90\u6807\u6CE8: (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n- \u4E0D\u8981\u7EAF\u4EE3\u7801\u7F57\u5217\uFF0C\u5FC5\u987B\u6709\u9879\u76EE\u4E0A\u4E0B\u6587\n- \u6807\u9898\u548C\u6B63\u6587\u4E2D\u4E0D\u5F97\u51FA\u73B0 \"Agent\" \u5B57\u6837";
|
|
9
|
+
export declare const PROJECT_SNAPSHOT_STYLE_GUIDE = "# \u300C\u9879\u76EE\u7279\u5199\u300D\u5199\u4F5C\u8981\u6C42\n\nsubmit_knowledge \u7684 content.markdown \u5B57\u6BB5\u5FC5\u987B\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\u3002\n\n## \u4EC0\u4E48\u662F\u300C\u9879\u76EE\u7279\u5199\u300D\n\u5C06\u4E00\u79CD\u6280\u672F\u7684**\u57FA\u672C\u7528\u6CD5**\u4E0E**\u672C\u9879\u76EE\u7684\u5177\u4F53\u7279\u5F81**\u878D\u5408\u4E3A\u4E00\u4F53\u3002\n\n## \u56DB\u5927\u6838\u5FC3\u5185\u5BB9\n1. **\u9879\u76EE\u9009\u62E9\u4E86\u4EC0\u4E48** \u2014 \u91C7\u7528\u4E86\u54EA\u79CD\u5199\u6CD5/\u6A21\u5F0F/\u7EA6\u5B9A\n2. **\u4E3A\u4EC0\u4E48\u8FD9\u6837\u9009** \u2014 \u7EDF\u8BA1\u5206\u5E03\u3001\u5360\u6BD4\u3001\u5386\u53F2\u51B3\u7B56\n3. **\u9879\u76EE\u7981\u6B62\u4EC0\u4E48** \u2014 \u53CD\u6A21\u5F0F\u3001\u5DF2\u5E9F\u5F03\u5199\u6CD5\n4. **\u65B0\u4EE3\u7801\u600E\u4E48\u5199** \u2014 \u53EF\u76F4\u63A5\u590D\u5236\u4F7F\u7528\u7684\u4EE3\u7801\u6A21\u677F + \u6765\u6E90\u6807\u6CE8 (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n\n## \u683C\u5F0F\u8981\u6C42\n- \u6807\u9898\u4F7F\u7528\u9879\u76EE\u771F\u5B9E\u7C7B\u540D/\u524D\u7F00\uFF0C\u4E0D\u7528\u5360\u4F4D\u540D\uFF0C\u4E0D\u4EE5\u9879\u76EE\u540D\u5F00\u5934\n- \u4EE3\u7801\u6765\u6E90\u6807\u6CE8: (\u6765\u6E90: FileName.ext:\u884C\u53F7)\n- \u4E0D\u8981\u7EAF\u4EE3\u7801\u7F57\u5217\uFF0C\u5FC5\u987B\u6709\u9879\u76EE\u4E0A\u4E0B\u6587\n- \u6807\u9898\u548C\u6B63\u6587\u4E2D\u4E0D\u5F97\u51FA\u73B0 \"Agent\" \u5B57\u6837";
|
|
10
10
|
/** 生成 Cursor 交付字段规范文本(供 Producer STYLE_GUIDE 和 MissionBriefing 使用) */
|
|
11
11
|
export declare function getCursorDeliverySpec(): string;
|
|
12
12
|
/** 构建完整的 Producer STYLE_GUIDE(合并项目特写要求 + Cursor 交付字段规范) */
|
|
@@ -22,7 +22,7 @@ submit_knowledge 的 content.markdown 字段必须是「项目特写」。
|
|
|
22
22
|
4. **新代码怎么写** — 可直接复制使用的代码模板 + 来源标注 (来源: FileName.ext:行号)
|
|
23
23
|
|
|
24
24
|
## 格式要求
|
|
25
|
-
-
|
|
25
|
+
- 标题使用项目真实类名/前缀,不用占位名,不以项目名开头
|
|
26
26
|
- 代码来源标注: (来源: FileName.ext:行号)
|
|
27
27
|
- 不要纯代码罗列,必须有项目上下文
|
|
28
28
|
- 标题和正文中不得出现 "Agent" 字样`;
|
|
@@ -132,6 +132,12 @@ export class UnifiedValidator {
|
|
|
132
132
|
if (!hasSourceRef) {
|
|
133
133
|
warnings.push('建议在内容中标注代码来源 (来源: FileName.ext:行号)');
|
|
134
134
|
}
|
|
135
|
+
// 源码位置质量检查 — 优先使用完整相对路径
|
|
136
|
+
const hasFullPathRef = /来源[::]\s*\S+\/\S+\.\w+:\d+/.test(markdown) || /\(\S+\/\S+\.\w+:\d+\)/.test(markdown);
|
|
137
|
+
const hasBareName = /来源[::]\s*[A-Z]\w+\.\w+:\d+/.test(markdown) || /\([A-Z]\w+\.\w+:\d+\)/.test(markdown);
|
|
138
|
+
if (hasBareName && !hasFullPathRef) {
|
|
139
|
+
warnings.push('源码位置应使用完整相对路径+行号(如 Packages/ModuleName/Sources/.../FileName.swift:42),而非仅文件名');
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
// coreCode 语法完整性
|
|
137
143
|
{
|
|
@@ -156,6 +162,15 @@ export class UnifiedValidator {
|
|
|
156
162
|
warnings.push(`内容仅 ${lines.length} 行 — 建议包含更多代码片段和设计意图描述`);
|
|
157
163
|
}
|
|
158
164
|
}
|
|
165
|
+
// reasoning.sources 路径质量检查 — 应包含路径分隔符,而非仅类名/文件名
|
|
166
|
+
const reasoning = candidate.reasoning;
|
|
167
|
+
const sources = reasoning?.sources;
|
|
168
|
+
if (Array.isArray(sources) && sources.length > 0) {
|
|
169
|
+
const bareSources = sources.filter((s) => typeof s === 'string' && !s.includes('/') && !s.includes('\\'));
|
|
170
|
+
if (bareSources.length > 0 && bareSources.length === sources.length) {
|
|
171
|
+
warnings.push(`reasoning.sources 中的路径缺少目录结构(如 "${bareSources[0]}")— 应使用完整相对路径(如 Packages/ModuleName/Sources/.../FileName.swift)`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
159
174
|
}
|
|
160
175
|
// ── Layer 3: 去重 ────────────────────────────────────────
|
|
161
176
|
#checkUniqueness(candidate, errors) {
|
|
@@ -43,7 +43,7 @@ export declare class Stats {
|
|
|
43
43
|
static from(input: unknown): Stats;
|
|
44
44
|
/** 增加计数 */
|
|
45
45
|
increment(counter: StatsCounter, delta?: number): Stats;
|
|
46
|
-
/**
|
|
46
|
+
/** 记录一次命中,同时更新时间戳(Unix 秒) */
|
|
47
47
|
recordHit(counter: StatsCounter, timestamp?: number): Stats;
|
|
48
48
|
/** 转换为 JSON */
|
|
49
49
|
toJSON(): {
|
|
@@ -60,8 +60,8 @@ export class Stats {
|
|
|
60
60
|
this[counter] += delta;
|
|
61
61
|
return this;
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
recordHit(counter, timestamp = Date.now()) {
|
|
63
|
+
/** 记录一次命中,同时更新时间戳(Unix 秒) */
|
|
64
|
+
recordHit(counter, timestamp = Math.floor(Date.now() / 1000)) {
|
|
65
65
|
this[counter] += 1;
|
|
66
66
|
this.lastHitAt = timestamp;
|
|
67
67
|
if (counter === 'searchHits') {
|
|
@@ -36,7 +36,9 @@ import * as systemHandlers from './handlers/system.js';
|
|
|
36
36
|
// ─── External Agent Bootstrap 新 handler ──────────────────────
|
|
37
37
|
import { bootstrapExternal } from './handlers/bootstrap-external.js';
|
|
38
38
|
import { dimensionComplete } from './handlers/dimension-complete-external.js';
|
|
39
|
+
import { evolveExternal } from './handlers/evolve-external.js';
|
|
39
40
|
import { panoramaHandler } from './handlers/panorama.js';
|
|
41
|
+
import { rescanExternal } from './handlers/rescan-external.js';
|
|
40
42
|
import { taskHandler } from './handlers/task.js';
|
|
41
43
|
import { wikiRouter } from './handlers/wiki-external.js';
|
|
42
44
|
// ─── McpServer 类 ─────────────────────────────────────────────
|
|
@@ -363,6 +365,8 @@ export class McpServer {
|
|
|
363
365
|
autosnippet_panorama: (ctx, args) => panoramaHandler(ctx, args),
|
|
364
366
|
// ── External Agent Bootstrap (v3.1) ──
|
|
365
367
|
autosnippet_bootstrap: (ctx, _args) => bootstrapExternal(ctx),
|
|
368
|
+
autosnippet_rescan: (ctx, args) => rescanExternal(ctx, args),
|
|
369
|
+
autosnippet_evolve: (ctx, args) => evolveExternal(ctx, args),
|
|
366
370
|
autosnippet_dimension_complete: (ctx, args) => dimensionComplete(ctx, args),
|
|
367
371
|
autosnippet_wiki: (ctx, args) => wikiRouter(ctx, args),
|
|
368
372
|
// ── Admin 层 (+4) ──
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* - 文件名 → 分析优先级推断
|
|
7
7
|
*/
|
|
8
8
|
/** 根据 Target 名称推断模块职责 */
|
|
9
|
-
export declare function inferTargetRole(targetName: string): "model" | "config" | "networking" | "ui" | "
|
|
9
|
+
export declare function inferTargetRole(targetName: string): "model" | "config" | "networking" | "ui" | "core" | "app" | "service" | "storage" | "feature" | "test" | "auth" | "routing" | "utility";
|
|
10
10
|
/** 根据文件名推断分析优先级 */
|
|
11
11
|
export declare function inferFilePriority(filename: string): "high" | "medium" | "low";
|
|
@@ -15,18 +15,10 @@
|
|
|
15
15
|
* @module bootstrap/BootstrapSession
|
|
16
16
|
*/
|
|
17
17
|
import { SessionStore } from '#agent/memory/SessionStore.js';
|
|
18
|
+
import type { DimensionDef } from '#types/project-snapshot.js';
|
|
19
|
+
import type { SessionCacheShape } from '#types/snapshot-views.js';
|
|
18
20
|
import type { DimensionQualityReport } from './ExternalSubmissionTracker.js';
|
|
19
21
|
import { ExternalSubmissionTracker } from './ExternalSubmissionTracker.js';
|
|
20
|
-
/** 维度定义 */
|
|
21
|
-
export interface DimensionDef {
|
|
22
|
-
id: string;
|
|
23
|
-
label?: string;
|
|
24
|
-
skillWorthy?: boolean;
|
|
25
|
-
skillMeta?: {
|
|
26
|
-
name?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
22
|
/** Bootstrap 会话构造参数 */
|
|
31
23
|
interface BootstrapSessionOpts {
|
|
32
24
|
projectRoot: string;
|
|
@@ -61,7 +53,7 @@ export declare class BootstrapSession {
|
|
|
61
53
|
completedDimensions: Map<string, DimensionCompletion>;
|
|
62
54
|
crossDimensionHints: Record<string, CrossDimensionHint[]>;
|
|
63
55
|
dimensions: DimensionDef[];
|
|
64
|
-
|
|
56
|
+
snapshotCache: SessionCacheShape | null;
|
|
65
57
|
sessionStore: SessionStore;
|
|
66
58
|
submissionTracker: ExternalSubmissionTracker;
|
|
67
59
|
/**
|
|
@@ -101,12 +93,12 @@ export declare class BootstrapSession {
|
|
|
101
93
|
*/
|
|
102
94
|
getAccumulatedHints(): Record<string, CrossDimensionHint[]>;
|
|
103
95
|
/**
|
|
104
|
-
* 缓存 Phase 1-4
|
|
105
|
-
* @param cache
|
|
96
|
+
* 缓存 Phase 1-4 分析结果(ProjectSnapshot 的 session cache 形式)
|
|
97
|
+
* @param cache toSessionCache(snapshot) 的返回值
|
|
106
98
|
*/
|
|
107
|
-
|
|
108
|
-
/** 获取
|
|
109
|
-
|
|
99
|
+
setSnapshotCache(cache: SessionCacheShape | null): void;
|
|
100
|
+
/** 获取 Snapshot 缓存(wiki_plan / dimension-complete 复用) */
|
|
101
|
+
getSnapshotCache(): SessionCacheShape | null;
|
|
110
102
|
toJSON(): {
|
|
111
103
|
id: string;
|
|
112
104
|
projectRoot: string;
|