@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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作流上下文管理
|
|
3
|
+
* 提供工作流上下文的创建、验证和管理功能
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 工作流上下文工厂
|
|
7
|
+
*/
|
|
8
|
+
export class WorkflowContextFactory {
|
|
9
|
+
/**
|
|
10
|
+
* 创建新的工作流上下文
|
|
11
|
+
*/
|
|
12
|
+
static create(task) {
|
|
13
|
+
return {
|
|
14
|
+
id: this.generateId(),
|
|
15
|
+
task,
|
|
16
|
+
currentPhase: 'reference',
|
|
17
|
+
phaseStatus: 'pending',
|
|
18
|
+
artifacts: new Map(),
|
|
19
|
+
cachedResults: {},
|
|
20
|
+
userConfirmed: new Set(),
|
|
21
|
+
startedAt: new Date(),
|
|
22
|
+
updatedAt: new Date()
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 生成唯一 ID
|
|
27
|
+
*/
|
|
28
|
+
static generateId() {
|
|
29
|
+
return `wf-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 验证工作流上下文
|
|
33
|
+
*/
|
|
34
|
+
static validate(context) {
|
|
35
|
+
const errors = [];
|
|
36
|
+
if (!context.id) {
|
|
37
|
+
errors.push('Missing workflow ID');
|
|
38
|
+
}
|
|
39
|
+
if (!context.task) {
|
|
40
|
+
errors.push('Missing task description');
|
|
41
|
+
}
|
|
42
|
+
if (!context.currentPhase) {
|
|
43
|
+
errors.push('Missing current phase');
|
|
44
|
+
}
|
|
45
|
+
if (!context.phaseStatus) {
|
|
46
|
+
errors.push('Missing phase status');
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
valid: errors.length === 0,
|
|
50
|
+
errors
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 创建阶段产物
|
|
55
|
+
*/
|
|
56
|
+
static createPhaseArtifacts(phase, results, confidence, metadata) {
|
|
57
|
+
return {
|
|
58
|
+
phase,
|
|
59
|
+
results: results,
|
|
60
|
+
confidence: confidence,
|
|
61
|
+
metadata,
|
|
62
|
+
createdAt: new Date()
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 工作流上下文验证器
|
|
68
|
+
*/
|
|
69
|
+
export class WorkflowContextValidator {
|
|
70
|
+
/**
|
|
71
|
+
* 验证是否可以推进到下一阶段
|
|
72
|
+
*/
|
|
73
|
+
static canProceed(context) {
|
|
74
|
+
// 检查当前阶段是否完成
|
|
75
|
+
if (context.phaseStatus !== 'completed' && context.phaseStatus !== 'verified') {
|
|
76
|
+
return {
|
|
77
|
+
valid: false,
|
|
78
|
+
reason: `Current phase ${context.currentPhase} is not completed (status: ${context.phaseStatus})`
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// 检查是否有产物
|
|
82
|
+
const artifacts = context.artifacts.get(context.currentPhase);
|
|
83
|
+
if (!artifacts) {
|
|
84
|
+
return {
|
|
85
|
+
valid: false,
|
|
86
|
+
reason: `No artifacts found for phase ${context.currentPhase}`
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return { valid: true };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 验证阶段状态转换是否有效
|
|
93
|
+
*/
|
|
94
|
+
static isValidStatusTransition(currentStatus, newStatus) {
|
|
95
|
+
const validTransitions = {
|
|
96
|
+
'pending': ['running'],
|
|
97
|
+
'running': ['completed', 'pending'],
|
|
98
|
+
'completed': ['verified', 'skipped'],
|
|
99
|
+
'verified': ['pending'],
|
|
100
|
+
'skipped': []
|
|
101
|
+
};
|
|
102
|
+
return validTransitions[currentStatus]?.includes(newStatus) ?? false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=workflow-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-context.js","sourceRoot":"","sources":["../../../src/orchestrator/workflow/workflow-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,MAAM,OAAO,sBAAsB;IACjC;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,IAAY;QACxB,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE;YACrB,IAAI;YACJ,YAAY,EAAE,WAA4B;YAC1C,WAAW,EAAE,SAAwB;YACrC,SAAS,EAAE,IAAI,GAAG,EAAiC;YACnD,aAAa,EAAE,EAAmB;YAClC,aAAa,EAAE,IAAI,GAAG,EAAiB;YACvC,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,UAAU;QACvB,OAAO,MAAM,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QA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AO,CAAC,YAAY,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,gCAAgC,OAAO,CAAC,YAAY,EAAE;aAC/D,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAC5B,aAA0B,EAC1B,SAAsB;QAEtB,MAAM,gBAAgB,GAAuC;YAC3D,SAAS,EAAE,CAAC,SAAS,CAAC;YACtB,SAAS,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;YACnC,WAAW,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;YACpC,UAAU,EAAE,CAAC,SAAS,CAAC;YACvB,SAAS,EAAE,EAAE;SACd,CAAC;QAEF,OAAO,gBAAgB,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC;IACvE,CAAC;CACF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [META] 工作流编排器
|
|
3
|
+
* [WHY] 串联所有模块的"粘合剂",解决阶段割裂问题
|
|
4
|
+
*/
|
|
5
|
+
import type { AnalyzeArgs, ConfidenceResult } from '../types.js';
|
|
6
|
+
import { type WorkflowContext, type WorkflowPhase, type PhaseDefinition, type WorkflowStatus, type PhaseResult, type Guidance } from './types.js';
|
|
7
|
+
interface StartWorkflowOptions {
|
|
8
|
+
template?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 工作流编排器类
|
|
12
|
+
*/
|
|
13
|
+
export declare class WorkflowOrchestrator {
|
|
14
|
+
private context;
|
|
15
|
+
private phaseDefinitions;
|
|
16
|
+
private persistence;
|
|
17
|
+
private phaseCheckpoint;
|
|
18
|
+
private toolOrchestrator;
|
|
19
|
+
private intentRouter;
|
|
20
|
+
private resultFusion;
|
|
21
|
+
private templateManager;
|
|
22
|
+
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* 注册工具适配器
|
|
25
|
+
*/
|
|
26
|
+
private registerAdapters;
|
|
27
|
+
/**
|
|
28
|
+
* 启动新的工作流
|
|
29
|
+
*/
|
|
30
|
+
start(task: string, options?: StartWorkflowOptions): Promise<WorkflowContext>;
|
|
31
|
+
/**
|
|
32
|
+
* 执行当前阶段
|
|
33
|
+
*/
|
|
34
|
+
executeCurrentPhase(analyzeArgs: AnalyzeArgs): Promise<PhaseResult>;
|
|
35
|
+
/**
|
|
36
|
+
* 计算阶段置信度
|
|
37
|
+
*/
|
|
38
|
+
private calculatePhaseConfidence;
|
|
39
|
+
/**
|
|
40
|
+
* 运行阶段
|
|
41
|
+
*/
|
|
42
|
+
private runPhase;
|
|
43
|
+
/**
|
|
44
|
+
* 运行分析
|
|
45
|
+
*
|
|
46
|
+
* 集成 ToolOrchestrator 和 ResultFusion 执行真实的分析
|
|
47
|
+
*/
|
|
48
|
+
private runAnalysis;
|
|
49
|
+
/**
|
|
50
|
+
* 根据意图选择要执行的工具列表
|
|
51
|
+
*/
|
|
52
|
+
private selectTools;
|
|
53
|
+
/**
|
|
54
|
+
* 构建关键词权重映射
|
|
55
|
+
*/
|
|
56
|
+
private buildKeywordWeights;
|
|
57
|
+
/**
|
|
58
|
+
* 运行 CI 命令
|
|
59
|
+
*/
|
|
60
|
+
private runCICommand;
|
|
61
|
+
/**
|
|
62
|
+
* 验证是否可以进入下一阶段
|
|
63
|
+
*/
|
|
64
|
+
private checkProceedCondition;
|
|
65
|
+
/**
|
|
66
|
+
* 推进到下一阶段
|
|
67
|
+
*/
|
|
68
|
+
proceedToNextPhase(force?: boolean): Promise<WorkflowPhase>;
|
|
69
|
+
/**
|
|
70
|
+
* 获取工作流状态
|
|
71
|
+
*/
|
|
72
|
+
getStatus(): Promise<WorkflowStatus>;
|
|
73
|
+
/**
|
|
74
|
+
* 恢复指定的工作流
|
|
75
|
+
*/
|
|
76
|
+
resume(id: string): Promise<WorkflowContext | null>;
|
|
77
|
+
/**
|
|
78
|
+
* 恢复当前活动工作流
|
|
79
|
+
*/
|
|
80
|
+
resumeActive(): Promise<WorkflowContext | null>;
|
|
81
|
+
/**
|
|
82
|
+
* 为活动工作流应用模板
|
|
83
|
+
*/
|
|
84
|
+
applyTemplate(templateName: string): Promise<WorkflowContext>;
|
|
85
|
+
/**
|
|
86
|
+
* 创建检查点
|
|
87
|
+
*/
|
|
88
|
+
checkpoint(): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* 获取置信度引导
|
|
91
|
+
*/
|
|
92
|
+
getGuidance(confidence: ConfidenceResult, phase: WorkflowPhase): Guidance;
|
|
93
|
+
/**
|
|
94
|
+
* 计算进度
|
|
95
|
+
*/
|
|
96
|
+
private calculateProgress;
|
|
97
|
+
/**
|
|
98
|
+
* 初始化阶段定义
|
|
99
|
+
*/
|
|
100
|
+
private initializePhaseDefinitions;
|
|
101
|
+
private syncPhaseDefinitionsWithContext;
|
|
102
|
+
private resolvePhaseDefinitions;
|
|
103
|
+
private getFirstPhase;
|
|
104
|
+
/**
|
|
105
|
+
* 获取阶段定义
|
|
106
|
+
*/
|
|
107
|
+
getPhaseDefinition(phase: WorkflowPhase): PhaseDefinition | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* 获取所有阶段定义
|
|
110
|
+
*/
|
|
111
|
+
getAllPhaseDefinitions(): PhaseDefinition[];
|
|
112
|
+
/**
|
|
113
|
+
* 获取当前上下文
|
|
114
|
+
*/
|
|
115
|
+
getContext(): WorkflowContext | null;
|
|
116
|
+
/**
|
|
117
|
+
* 列出所有工作流
|
|
118
|
+
*/
|
|
119
|
+
listWorkflows(): Promise<unknown[]>;
|
|
120
|
+
/**
|
|
121
|
+
* 删除工作流
|
|
122
|
+
*/
|
|
123
|
+
deleteWorkflow(id: string): Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
export {};
|
|
126
|
+
//# sourceMappingURL=workflow-orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-orchestrator.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/workflow/workflow-orchestrator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAiB,gBAAgB,EAAiB,MAAM,aAAa,CAAC;AAU/F,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAEhB,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AAyBpB,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,gBAAgB,CAAsC;IAC9D,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAA0B;;IAejD;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,eAAe,CAAC;IAcvF;;OAEG;IACG,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IA4CzE;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAUhC;;OAEG;YACW,QAAQ;IAetB;;;;OAIG;YACW,WAAW;IAkCzB;;OAEG;IACH,OAAO,CAAC,WAAW;IAmBnB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;OAEG;YACW,YAAY;IAQ1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;OAEG;IACG,kBAAkB,CAAC,KAAK,GAAE,OAA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