@mycodemap/mycodemap 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +559 -0
- package/dist/ai/claude.d.ts +38 -0
- package/dist/ai/claude.d.ts.map +1 -0
- package/dist/ai/claude.js +169 -0
- package/dist/ai/claude.js.map +1 -0
- package/dist/ai/codex.d.ts +38 -0
- package/dist/ai/codex.d.ts.map +1 -0
- package/dist/ai/codex.js +169 -0
- package/dist/ai/codex.js.map +1 -0
- package/dist/ai/factory.d.ts +48 -0
- package/dist/ai/factory.d.ts.map +1 -0
- package/dist/ai/factory.js +95 -0
- package/dist/ai/factory.js.map +1 -0
- package/dist/ai/index.d.ts +12 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +29 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/provider.d.ts +70 -0
- package/dist/ai/provider.d.ts.map +1 -0
- package/dist/ai/provider.js +31 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/ai/subagent-caller.d.ts +90 -0
- package/dist/ai/subagent-caller.d.ts.map +1 -0
- package/dist/ai/subagent-caller.js +280 -0
- package/dist/ai/subagent-caller.js.map +1 -0
- package/dist/ai/types.d.ts +70 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +5 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/cache/file-hash-cache.d.ts +76 -0
- package/dist/cache/file-hash-cache.d.ts.map +1 -0
- package/dist/cache/file-hash-cache.js +159 -0
- package/dist/cache/file-hash-cache.js.map +1 -0
- package/dist/cache/index.d.ts +151 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +303 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/lru-cache.d.ts +93 -0
- package/dist/cache/lru-cache.d.ts.map +1 -0
- package/dist/cache/lru-cache.js +194 -0
- package/dist/cache/lru-cache.js.map +1 -0
- package/dist/cache/parse-cache.d.ts +68 -0
- package/dist/cache/parse-cache.d.ts.map +1 -0
- package/dist/cache/parse-cache.js +173 -0
- package/dist/cache/parse-cache.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +96 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +567 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/ci.d.ts +25 -0
- package/dist/cli/commands/ci.d.ts.map +1 -0
- package/dist/cli/commands/ci.js +481 -0
- package/dist/cli/commands/ci.js.map +1 -0
- package/dist/cli/commands/complexity.d.ts +70 -0
- package/dist/cli/commands/complexity.d.ts.map +1 -0
- package/dist/cli/commands/complexity.js +479 -0
- package/dist/cli/commands/complexity.js.map +1 -0
- package/dist/cli/commands/cycles.d.ts +10 -0
- package/dist/cli/commands/cycles.d.ts.map +1 -0
- package/dist/cli/commands/cycles.js +202 -0
- package/dist/cli/commands/cycles.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +61 -0
- package/dist/cli/commands/deps.d.ts.map +1 -0
- package/dist/cli/commands/deps.js +340 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +8 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +61 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/impact.d.ts +55 -0
- package/dist/cli/commands/impact.d.ts.map +1 -0
- package/dist/cli/commands/impact.js +455 -0
- package/dist/cli/commands/impact.js.map +1 -0
- package/dist/cli/commands/init.d.ts +4 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +50 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/query.d.ts +22 -0
- package/dist/cli/commands/query.d.ts.map +1 -0
- package/dist/cli/commands/query.js +718 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/watch-foreground.d.ts +9 -0
- package/dist/cli/commands/watch-foreground.d.ts.map +1 -0
- package/dist/cli/commands/watch-foreground.js +67 -0
- package/dist/cli/commands/watch-foreground.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +12 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +114 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/commands/workflow.d.ts +25 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +488 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +115 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/paths.d.ts +90 -0
- package/dist/cli/paths.d.ts.map +1 -0
- package/dist/cli/paths.js +136 -0
- package/dist/cli/paths.js.map +1 -0
- package/dist/cli/runtime-logger.d.ts +13 -0
- package/dist/cli/runtime-logger.d.ts.map +1 -0
- package/dist/cli/runtime-logger.js +213 -0
- package/dist/cli/runtime-logger.js.map +1 -0
- package/dist/core/analyzer.d.ts +3 -0
- package/dist/core/analyzer.d.ts.map +1 -0
- package/dist/core/analyzer.js +359 -0
- package/dist/core/analyzer.js.map +1 -0
- package/dist/core/ast-complexity-analyzer.d.ts +40 -0
- package/dist/core/ast-complexity-analyzer.d.ts.map +1 -0
- package/dist/core/ast-complexity-analyzer.js +279 -0
- package/dist/core/ast-complexity-analyzer.js.map +1 -0
- package/dist/core/global-index.d.ts +69 -0
- package/dist/core/global-index.d.ts.map +1 -0
- package/dist/core/global-index.js +388 -0
- package/dist/core/global-index.js.map +1 -0
- package/dist/generator/ai-overview.d.ts +51 -0
- package/dist/generator/ai-overview.d.ts.map +1 -0
- package/dist/generator/ai-overview.js +160 -0
- package/dist/generator/ai-overview.js.map +1 -0
- package/dist/generator/context.d.ts +5 -0
- package/dist/generator/context.d.ts.map +1 -0
- package/dist/generator/context.js +514 -0
- package/dist/generator/context.js.map +1 -0
- package/dist/generator/file-describer.d.ts +93 -0
- package/dist/generator/file-describer.d.ts.map +1 -0
- package/dist/generator/file-describer.js +375 -0
- package/dist/generator/file-describer.js.map +1 -0
- package/dist/generator/index.d.ts +8 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +259 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.d.ts +75 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.js +242 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/base-adapter.d.ts +24 -0
- package/dist/orchestrator/adapters/base-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/base-adapter.js +2 -0
- package/dist/orchestrator/adapters/base-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/codemap-adapter.d.ts +56 -0
- package/dist/orchestrator/adapters/codemap-adapter.d.ts.map +1 -0
- package/dist/orchestrator/adapters/codemap-adapter.js +163 -0
- package/dist/orchestrator/adapters/codemap-adapter.js.map +1 -0
- package/dist/orchestrator/adapters/index.d.ts +10 -0
- package/dist/orchestrator/adapters/index.d.ts.map +1 -0
- package/dist/orchestrator/adapters/index.js +3 -0
- package/dist/orchestrator/adapters/index.js.map +1 -0
- package/dist/orchestrator/ai-feed-generator.d.ts +210 -0
- package/dist/orchestrator/ai-feed-generator.d.ts.map +1 -0
- package/dist/orchestrator/ai-feed-generator.js +377 -0
- package/dist/orchestrator/ai-feed-generator.js.map +1 -0
- package/dist/orchestrator/commit-validator.d.ts +30 -0
- package/dist/orchestrator/commit-validator.d.ts.map +1 -0
- package/dist/orchestrator/commit-validator.js +87 -0
- package/dist/orchestrator/commit-validator.js.map +1 -0
- package/dist/orchestrator/confidence.d.ts +25 -0
- package/dist/orchestrator/confidence.d.ts.map +1 -0
- package/dist/orchestrator/confidence.js +138 -0
- package/dist/orchestrator/confidence.js.map +1 -0
- package/dist/orchestrator/file-header-scanner.d.ts +48 -0
- package/dist/orchestrator/file-header-scanner.d.ts.map +1 -0
- package/dist/orchestrator/file-header-scanner.js +158 -0
- package/dist/orchestrator/file-header-scanner.js.map +1 -0
- package/dist/orchestrator/git-analyzer.d.ts +192 -0
- package/dist/orchestrator/git-analyzer.d.ts.map +1 -0
- package/dist/orchestrator/git-analyzer.js +539 -0
- package/dist/orchestrator/git-analyzer.js.map +1 -0
- package/dist/orchestrator/index.d.ts +20 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +16 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/intent-router.d.ts +41 -0
- package/dist/orchestrator/intent-router.d.ts.map +1 -0
- package/dist/orchestrator/intent-router.js +98 -0
- package/dist/orchestrator/intent-router.js.map +1 -0
- package/dist/orchestrator/result-fusion.d.ts +114 -0
- package/dist/orchestrator/result-fusion.d.ts.map +1 -0
- package/dist/orchestrator/result-fusion.js +332 -0
- package/dist/orchestrator/result-fusion.js.map +1 -0
- package/dist/orchestrator/test-linker.d.ts +166 -0
- package/dist/orchestrator/test-linker.d.ts.map +1 -0
- package/dist/orchestrator/test-linker.js +570 -0
- package/dist/orchestrator/test-linker.js.map +1 -0
- package/dist/orchestrator/tool-orchestrator.d.ts +108 -0
- package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/tool-orchestrator.js +247 -0
- package/dist/orchestrator/tool-orchestrator.js.map +1 -0
- package/dist/orchestrator/types.d.ts +162 -0
- package/dist/orchestrator/types.d.ts.map +1 -0
- package/dist/orchestrator/types.js +39 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/workflow/ci-executor.d.ts +157 -0
- package/dist/orchestrator/workflow/ci-executor.d.ts.map +1 -0
- package/dist/orchestrator/workflow/ci-executor.js +423 -0
- package/dist/orchestrator/workflow/ci-executor.js.map +1 -0
- package/dist/orchestrator/workflow/config.d.ts +97 -0
- package/dist/orchestrator/workflow/config.d.ts.map +1 -0
- package/dist/orchestrator/workflow/config.js +115 -0
- package/dist/orchestrator/workflow/config.js.map +1 -0
- package/dist/orchestrator/workflow/git-analyzer.d.ts +173 -0
- package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -0
- package/dist/orchestrator/workflow/git-analyzer.js +473 -0
- package/dist/orchestrator/workflow/git-analyzer.js.map +1 -0
- package/dist/orchestrator/workflow/index.d.ts +21 -0
- package/dist/orchestrator/workflow/index.d.ts.map +1 -0
- package/dist/orchestrator/workflow/index.js +21 -0
- package/dist/orchestrator/workflow/index.js.map +1 -0
- package/dist/orchestrator/workflow/phase-checkpoint.d.ts +38 -0
- package/dist/orchestrator/workflow/phase-checkpoint.d.ts.map +1 -0
- package/dist/orchestrator/workflow/phase-checkpoint.js +75 -0
- package/dist/orchestrator/workflow/phase-checkpoint.js.map +1 -0
- package/dist/orchestrator/workflow/phase-inheritance.d.ts +128 -0
- package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -0
- package/dist/orchestrator/workflow/phase-inheritance.js +266 -0
- package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -0
- package/dist/orchestrator/workflow/result-fusion.d.ts +117 -0
- package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -0
- package/dist/orchestrator/workflow/result-fusion.js +246 -0
- package/dist/orchestrator/workflow/result-fusion.js.map +1 -0
- package/dist/orchestrator/workflow/templates.d.ts +116 -0
- package/dist/orchestrator/workflow/templates.d.ts.map +1 -0
- package/dist/orchestrator/workflow/templates.js +546 -0
- package/dist/orchestrator/workflow/templates.js.map +1 -0
- package/dist/orchestrator/workflow/test-linker.d.ts +152 -0
- package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -0
- package/dist/orchestrator/workflow/test-linker.js +342 -0
- package/dist/orchestrator/workflow/test-linker.js.map +1 -0
- package/dist/orchestrator/workflow/types.d.ts +202 -0
- package/dist/orchestrator/workflow/types.d.ts.map +1 -0
- package/dist/orchestrator/workflow/types.js +4 -0
- package/dist/orchestrator/workflow/types.js.map +1 -0
- package/dist/orchestrator/workflow/visualizer.d.ts +56 -0
- package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -0
- package/dist/orchestrator/workflow/visualizer.js +300 -0
- package/dist/orchestrator/workflow/visualizer.js.map +1 -0
- package/dist/orchestrator/workflow/workflow-context.d.ts +50 -0
- package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -0
- package/dist/orchestrator/workflow/workflow-context.js +105 -0
- package/dist/orchestrator/workflow/workflow-context.js.map +1 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +126 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.js +489 -0
- package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -0
- package/dist/orchestrator/workflow/workflow-persistence.d.ts +38 -0
- package/dist/orchestrator/workflow/workflow-persistence.d.ts.map +1 -0
- package/dist/orchestrator/workflow/workflow-persistence.js +166 -0
- package/dist/orchestrator/workflow/workflow-persistence.js.map +1 -0
- package/dist/parser/implementations/fast-parser.d.ts +65 -0
- package/dist/parser/implementations/fast-parser.d.ts.map +1 -0
- package/dist/parser/implementations/fast-parser.js +299 -0
- package/dist/parser/implementations/fast-parser.js.map +1 -0
- package/dist/parser/implementations/smart-parser.d.ts +220 -0
- package/dist/parser/implementations/smart-parser.d.ts.map +1 -0
- package/dist/parser/implementations/smart-parser.js +1536 -0
- package/dist/parser/implementations/smart-parser.js.map +1 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts +57 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts.map +1 -0
- package/dist/parser/implementations/tree-sitter-parser.js +375 -0
- package/dist/parser/implementations/tree-sitter-parser.js.map +1 -0
- package/dist/parser/index.d.ts +19 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +449 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/interfaces/IParser.d.ts +218 -0
- package/dist/parser/interfaces/IParser.d.ts.map +1 -0
- package/dist/parser/interfaces/IParser.js +22 -0
- package/dist/parser/interfaces/IParser.js.map +1 -0
- package/dist/plugins/built-in/call-graph.d.ts +38 -0
- package/dist/plugins/built-in/call-graph.d.ts.map +1 -0
- package/dist/plugins/built-in/call-graph.js +135 -0
- package/dist/plugins/built-in/call-graph.js.map +1 -0
- package/dist/plugins/built-in/complexity-analyzer.d.ts +45 -0
- package/dist/plugins/built-in/complexity-analyzer.d.ts.map +1 -0
- package/dist/plugins/built-in/complexity-analyzer.js +155 -0
- package/dist/plugins/built-in/complexity-analyzer.js.map +1 -0
- package/dist/plugins/index.d.ts +34 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +103 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-loader.d.ts +22 -0
- package/dist/plugins/plugin-loader.d.ts.map +1 -0
- package/dist/plugins/plugin-loader.js +200 -0
- package/dist/plugins/plugin-loader.js.map +1 -0
- package/dist/plugins/plugin-registry.d.ts +20 -0
- package/dist/plugins/plugin-registry.d.ts.map +1 -0
- package/dist/plugins/plugin-registry.js +143 -0
- package/dist/plugins/plugin-registry.js.map +1 -0
- package/dist/plugins/types.d.ts +72 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +5 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/types/index.d.ts +373 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/watcher/daemon.d.ts +64 -0
- package/dist/watcher/daemon.d.ts.map +1 -0
- package/dist/watcher/daemon.js +189 -0
- package/dist/watcher/daemon.js.map +1 -0
- package/dist/watcher/file-watcher.d.ts +70 -0
- package/dist/watcher/file-watcher.d.ts.map +1 -0
- package/dist/watcher/file-watcher.js +127 -0
- package/dist/watcher/file-watcher.js.map +1 -0
- package/dist/watcher/index.d.ts +5 -0
- package/dist/watcher/index.d.ts.map +1 -0
- package/dist/watcher/index.js +6 -0
- package/dist/watcher/index.js.map +1 -0
- package/dist/watcher/watch-worker.d.ts +2 -0
- package/dist/watcher/watch-worker.d.ts.map +1 -0
- package/dist/watcher/watch-worker.js +57 -0
- package/dist/watcher/watch-worker.js.map +1 -0
- package/dist/worker/index.d.ts +76 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +155 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/parse-worker.d.ts +2 -0
- package/dist/worker/parse-worker.d.ts.map +1 -0
- package/dist/worker/parse-worker.js +202 -0
- package/dist/worker/parse-worker.js.map +1 -0
- package/mycodemap.config.schema.json +42 -0
- package/package.json +69 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [META] since:2026-03 | owner:codemap-team | stable:false
|
|
3
|
+
* [WHY] @version 2.5
|
|
4
|
+
*/
|
|
5
|
+
// ============================================
|
|
6
|
+
// 阶段权重配置
|
|
7
|
+
// ============================================
|
|
8
|
+
/**
|
|
9
|
+
* 工作流阶段权重表
|
|
10
|
+
* 越近期的阶段权重越高
|
|
11
|
+
*/
|
|
12
|
+
const PHASE_WEIGHTS = {
|
|
13
|
+
'reference': 0.8, // 参考搜索阶段
|
|
14
|
+
'impact': 0.9, // 影响分析阶段
|
|
15
|
+
'risk': 1.0, // 风险评估阶段(最高权重)
|
|
16
|
+
'implementation': 0.7, // 代码实现阶段
|
|
17
|
+
'commit': 0.6, // 提交阶段
|
|
18
|
+
'ci': 0.5 // CI阶段
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 源到阶段的映射
|
|
22
|
+
* 用于推断结果的来源阶段
|
|
23
|
+
*/
|
|
24
|
+
const SOURCE_TO_PHASE = {
|
|
25
|
+
'ast-grep': 'reference',
|
|
26
|
+
'codemap': 'reference',
|
|
27
|
+
'ai-feed': 'risk',
|
|
28
|
+
'rg-internal': 'reference'
|
|
29
|
+
};
|
|
30
|
+
// ============================================
|
|
31
|
+
// WorkflowResultFusion 类
|
|
32
|
+
// ============================================
|
|
33
|
+
export class WorkflowResultFusion {
|
|
34
|
+
/**
|
|
35
|
+
* 创建空的融合上下文
|
|
36
|
+
*/
|
|
37
|
+
static createEmptyContext() {
|
|
38
|
+
return {
|
|
39
|
+
phaseResults: new Map(),
|
|
40
|
+
accumulatedContext: new Map()
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 从阶段产物构建融合上下文
|
|
45
|
+
*/
|
|
46
|
+
static buildContextFromArtifacts(artifacts) {
|
|
47
|
+
const context = this.createEmptyContext();
|
|
48
|
+
for (const [phase, artifact] of artifacts) {
|
|
49
|
+
if (artifact.results && artifact.results.length > 0) {
|
|
50
|
+
context.phaseResults.set(phase, artifact.results);
|
|
51
|
+
// 添加到累积上下文
|
|
52
|
+
for (const result of artifact.results) {
|
|
53
|
+
const key = this.getResultKey(result);
|
|
54
|
+
context.accumulatedContext.set(key, result);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return context;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* 将新阶段结果与已有上下文合并
|
|
62
|
+
*
|
|
63
|
+
* @param newResults - 新阶段的结果
|
|
64
|
+
* @param context - 当前融合上下文
|
|
65
|
+
* @param currentPhase - 当前阶段
|
|
66
|
+
* @param options - 融合选项
|
|
67
|
+
* @returns 融合后的结果列表
|
|
68
|
+
*/
|
|
69
|
+
mergeWithContext(newResults, context, currentPhase, options = {}) {
|
|
70
|
+
const { topK = 20, applyPhaseWeights = true } = options;
|
|
71
|
+
// 1. 存储新结果到阶段结果映射
|
|
72
|
+
context.phaseResults.set(currentPhase, newResults);
|
|
73
|
+
// 2. 合并所有历史结果
|
|
74
|
+
const allResults = this.collectAllResults(context, newResults);
|
|
75
|
+
// 3. 去重(保留最新/最高分的结果)
|
|
76
|
+
const dedupedResults = this.deduplicateResults(allResults);
|
|
77
|
+
// 4. 应用工作流阶段权重
|
|
78
|
+
let weightedResults = dedupedResults;
|
|
79
|
+
if (applyPhaseWeights) {
|
|
80
|
+
weightedResults = this.applyWorkflowWeights(dedupedResults, context);
|
|
81
|
+
}
|
|
82
|
+
// 5. 应用关键词加权
|
|
83
|
+
if (options.keywordWeights && Object.keys(options.keywordWeights).length > 0) {
|
|
84
|
+
weightedResults = this.applyKeywordBoost(weightedResults, options.keywordWeights);
|
|
85
|
+
}
|
|
86
|
+
// 6. 按相关度排序
|
|
87
|
+
const sortedResults = this.sortByRelevance(weightedResults);
|
|
88
|
+
// 7. 更新累积上下文
|
|
89
|
+
this.updateAccumulatedContext(context, sortedResults);
|
|
90
|
+
// 8. 返回 Top-K 结果
|
|
91
|
+
return sortedResults.slice(0, topK);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 收集所有历史结果
|
|
95
|
+
*/
|
|
96
|
+
collectAllResults(context, newResults) {
|
|
97
|
+
const allResults = [];
|
|
98
|
+
// 添加所有阶段的历史结果
|
|
99
|
+
for (const results of context.phaseResults.values()) {
|
|
100
|
+
allResults.push(...results);
|
|
101
|
+
}
|
|
102
|
+
// 添加新结果
|
|
103
|
+
allResults.push(...newResults);
|
|
104
|
+
return allResults;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 去重结果(基于文件+行号)
|
|
108
|
+
* 保留相关度更高的结果
|
|
109
|
+
*/
|
|
110
|
+
deduplicateResults(results) {
|
|
111
|
+
const seen = new Map();
|
|
112
|
+
for (const result of results) {
|
|
113
|
+
const key = WorkflowResultFusion.getResultKey(result);
|
|
114
|
+
if (!seen.has(key)) {
|
|
115
|
+
seen.set(key, result);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// 保留分数更高的
|
|
119
|
+
const existing = seen.get(key);
|
|
120
|
+
if (result.relevance > existing.relevance) {
|
|
121
|
+
seen.set(key, result);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return Array.from(seen.values());
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 应用工作流阶段权重
|
|
129
|
+
* 根据结果来源的阶段调整相关度
|
|
130
|
+
*/
|
|
131
|
+
applyWorkflowWeights(results, context) {
|
|
132
|
+
return results.map(result => {
|
|
133
|
+
// 推断结果来源的阶段
|
|
134
|
+
const sourcePhase = this.inferPhase(result.source);
|
|
135
|
+
const weight = PHASE_WEIGHTS[sourcePhase] || 0.5;
|
|
136
|
+
return {
|
|
137
|
+
...result,
|
|
138
|
+
relevance: Math.min(1, result.relevance * weight)
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 应用关键词加权
|
|
144
|
+
*/
|
|
145
|
+
applyKeywordBoost(results, keywordWeights) {
|
|
146
|
+
return results
|
|
147
|
+
.map(result => {
|
|
148
|
+
let boost = 0;
|
|
149
|
+
for (const keyword of result.keywords || []) {
|
|
150
|
+
boost += keywordWeights[keyword] || 0;
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
...result,
|
|
154
|
+
relevance: Math.min(1, result.relevance + boost)
|
|
155
|
+
};
|
|
156
|
+
})
|
|
157
|
+
.sort((a, b) => b.relevance - a.relevance);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 按相关度排序
|
|
161
|
+
*/
|
|
162
|
+
sortByRelevance(results) {
|
|
163
|
+
return results.sort((a, b) => b.relevance - a.relevance);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 按工作流阶段优先级排序
|
|
167
|
+
* 用于特定场景下的排序需求
|
|
168
|
+
*/
|
|
169
|
+
sortByWorkflowPriority(results) {
|
|
170
|
+
return results.sort((a, b) => {
|
|
171
|
+
const phaseA = this.inferPhase(a.source);
|
|
172
|
+
const phaseB = this.inferPhase(b.source);
|
|
173
|
+
// 按阶段权重排序(高权重优先)
|
|
174
|
+
const weightDiff = PHASE_WEIGHTS[phaseB] - PHASE_WEIGHTS[phaseA];
|
|
175
|
+
if (weightDiff !== 0)
|
|
176
|
+
return weightDiff;
|
|
177
|
+
// 同阶段按相关度排序
|
|
178
|
+
return b.relevance - a.relevance;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 推断结果来源的阶段
|
|
183
|
+
*/
|
|
184
|
+
inferPhase(source) {
|
|
185
|
+
return SOURCE_TO_PHASE[source] || 'reference';
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 更新累积上下文
|
|
189
|
+
*/
|
|
190
|
+
updateAccumulatedContext(context, results) {
|
|
191
|
+
for (const result of results) {
|
|
192
|
+
const key = WorkflowResultFusion.getResultKey(result);
|
|
193
|
+
context.accumulatedContext.set(key, result);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* 获取结果的唯一键
|
|
198
|
+
*/
|
|
199
|
+
static getResultKey(result) {
|
|
200
|
+
return `${result.file}:${result.line || ''}`;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* 获取特定阶段的结果
|
|
204
|
+
*/
|
|
205
|
+
getPhaseResults(context, phase) {
|
|
206
|
+
return context.phaseResults.get(phase) || [];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* 获取累积上下文中的所有结果
|
|
210
|
+
*/
|
|
211
|
+
getAccumulatedResults(context) {
|
|
212
|
+
return Array.from(context.accumulatedContext.values());
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* 清除特定阶段的结果
|
|
216
|
+
*/
|
|
217
|
+
clearPhaseResults(context, phase) {
|
|
218
|
+
context.phaseResults.delete(phase);
|
|
219
|
+
// 重新构建累积上下文
|
|
220
|
+
context.accumulatedContext.clear();
|
|
221
|
+
for (const results of context.phaseResults.values()) {
|
|
222
|
+
for (const result of results) {
|
|
223
|
+
const key = WorkflowResultFusion.getResultKey(result);
|
|
224
|
+
context.accumulatedContext.set(key, result);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// ============================================
|
|
230
|
+
// 便捷函数
|
|
231
|
+
// ============================================
|
|
232
|
+
/**
|
|
233
|
+
* 创建结果融合器实例
|
|
234
|
+
*/
|
|
235
|
+
export function createResultFusion() {
|
|
236
|
+
return new WorkflowResultFusion();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 快速融合结果(便捷函数)
|
|
240
|
+
*/
|
|
241
|
+
export function fuseResults(newResults, context, currentPhase, options) {
|
|
242
|
+
const fusion = createResultFusion();
|
|
243
|
+
return fusion.mergeWithContext(newResults, context, currentPhase, options);
|
|
244
|
+
}
|
|
245
|
+
export default WorkflowResultFusion;
|
|
246
|
+
//# sourceMappingURL=result-fusion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-fusion.js","sourceRoot":"","sources":["../../../src/orchestrator/workflow/result-fusion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0CH,+CAA+C;AAC/C,SAAS;AACT,+CAA+C;AAE/C;;;GAGG;AACH,MAAM,aAAa,GAAkC;IACnD,WAAW,EAAE,GAAG,EAAO,SAAS;IAChC,QAAQ,EAAE,GAAG,EAAU,SAAS;IAChC,MAAM,EAAE,GAAG,EAAY,eAAe;IACtC,gBAAgB,EAAE,GAAG,EAAE,SAAS;IAChC,QAAQ,EAAE,GAAG,EAAU,OAAO;IAC9B,IAAI,EAAE,GAAG,CAAa,OAAO;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,eAAe,GAAkC;IACrD,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,WAAW;CAC3B,CAAC;AAEF,+CAA+C;AAC/C,yBAAyB;AACzB,+CAA+C;AAE/C,MAAM,OAAO,oBAAoB;IAC/B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AAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,OAAO,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [META] 工作流模板系统
|
|
3
|
+
* [WHY] 提供预定义的工作流模板,加速常见开发场景
|
|
4
|
+
*/
|
|
5
|
+
import type { PhaseDefinition } from './types.js';
|
|
6
|
+
/** 工作流模板类型 */
|
|
7
|
+
export type WorkflowTemplateType = 'refactoring' | 'bugfix' | 'feature' | 'hotfix' | 'custom';
|
|
8
|
+
/** 工作流模板接口 */
|
|
9
|
+
export interface WorkflowTemplate {
|
|
10
|
+
/** 模板名称 */
|
|
11
|
+
name: string;
|
|
12
|
+
/** 模板类型 */
|
|
13
|
+
type: WorkflowTemplateType;
|
|
14
|
+
/** 模板描述 */
|
|
15
|
+
description: string;
|
|
16
|
+
/** 适用场景 */
|
|
17
|
+
useCases: string[];
|
|
18
|
+
/** 阶段定义 */
|
|
19
|
+
phases: PhaseDefinition[];
|
|
20
|
+
/** 模板版本 */
|
|
21
|
+
version: string;
|
|
22
|
+
/** 创建时间 */
|
|
23
|
+
createdAt: string;
|
|
24
|
+
/** 元数据 */
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
/** 模板保存配置 */
|
|
28
|
+
export interface TemplateSaveOptions {
|
|
29
|
+
/** 覆盖已有模板 */
|
|
30
|
+
overwrite?: boolean;
|
|
31
|
+
/** 模板描述 */
|
|
32
|
+
description?: string;
|
|
33
|
+
/** 适用场景 */
|
|
34
|
+
useCases?: string[];
|
|
35
|
+
}
|
|
36
|
+
/** 模板加载选项 */
|
|
37
|
+
export interface TemplateLoadOptions {
|
|
38
|
+
/** 是否验证模板 */
|
|
39
|
+
validate?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** 重构模板 - 用于代码重构任务 */
|
|
42
|
+
export declare const REFACTORING_TEMPLATE: WorkflowTemplate;
|
|
43
|
+
/** Bug 修复模板 - 用于快速修复生产环境问题 */
|
|
44
|
+
export declare const BUGFIX_TEMPLATE: WorkflowTemplate;
|
|
45
|
+
/** 功能开发模板 - 用于新功能开发 */
|
|
46
|
+
export declare const FEATURE_TEMPLATE: WorkflowTemplate;
|
|
47
|
+
/** 热修复模板 - 用于紧急生产修复 */
|
|
48
|
+
export declare const HOTFIX_TEMPLATE: WorkflowTemplate;
|
|
49
|
+
/** 所有预定义模板 */
|
|
50
|
+
export declare const BUILTIN_TEMPLATES: Record<string, WorkflowTemplate>;
|
|
51
|
+
export declare class WorkflowTemplateManager {
|
|
52
|
+
private templatesDir;
|
|
53
|
+
private customTemplates;
|
|
54
|
+
constructor(templatesDir?: string);
|
|
55
|
+
/**
|
|
56
|
+
* 获取预定义模板
|
|
57
|
+
*/
|
|
58
|
+
getBuiltinTemplate(name: string): WorkflowTemplate | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* 获取所有预定义模板
|
|
61
|
+
*/
|
|
62
|
+
getAllBuiltinTemplates(): WorkflowTemplate[];
|
|
63
|
+
/**
|
|
64
|
+
* 获取自定义模板
|
|
65
|
+
*/
|
|
66
|
+
getCustomTemplate(name: string): WorkflowTemplate | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* 获取所有自定义模板
|
|
69
|
+
*/
|
|
70
|
+
getAllCustomTemplates(): WorkflowTemplate[];
|
|
71
|
+
/**
|
|
72
|
+
* 获取所有可用模板(内置 + 自定义)
|
|
73
|
+
*/
|
|
74
|
+
getAllTemplates(): WorkflowTemplate[];
|
|
75
|
+
/**
|
|
76
|
+
* 获取模板(优先自定义,其次内置)
|
|
77
|
+
*/
|
|
78
|
+
getTemplate(name: string): WorkflowTemplate | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* 检查模板是否存在
|
|
81
|
+
*/
|
|
82
|
+
hasTemplate(name: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* 保存自定义模板
|
|
85
|
+
*/
|
|
86
|
+
saveTemplate(template: WorkflowTemplate, options?: TemplateSaveOptions): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* 从当前阶段配置创建模板
|
|
89
|
+
*/
|
|
90
|
+
createTemplateFromPhases(name: string, phases: PhaseDefinition[], options?: TemplateSaveOptions): Promise<WorkflowTemplate>;
|
|
91
|
+
/**
|
|
92
|
+
* 加载自定义模板
|
|
93
|
+
*/
|
|
94
|
+
loadCustomTemplates(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* 删除自定义模板
|
|
97
|
+
*/
|
|
98
|
+
deleteTemplate(name: string): Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* 验证模板
|
|
101
|
+
*/
|
|
102
|
+
validateTemplate(template: unknown): template is WorkflowTemplate;
|
|
103
|
+
/**
|
|
104
|
+
* 渲染模板信息
|
|
105
|
+
*/
|
|
106
|
+
renderTemplateInfo(template: WorkflowTemplate): string;
|
|
107
|
+
private ensureTemplatesDir;
|
|
108
|
+
private incrementVersion;
|
|
109
|
+
}
|
|
110
|
+
/** 创建模板管理器 */
|
|
111
|
+
export declare function createTemplateManager(templatesDir?: string): WorkflowTemplateManager;
|
|
112
|
+
/** 获取默认模板 */
|
|
113
|
+
export declare function getDefaultTemplate(): WorkflowTemplate;
|
|
114
|
+
/** 根据任务描述推荐模板 */
|
|
115
|
+
export declare function recommendTemplate(taskDescription: string): WorkflowTemplate;
|
|
116
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/workflow/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,eAAe,EAA8C,MAAM,YAAY,CAAC;AA+C9F,cAAc;AACd,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,QAAQ,GAAG,SAA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