@winspan/claude-forge 8.26.3 → 8.28.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.
Files changed (55) hide show
  1. package/dist/capability/index.d.ts +9 -0
  2. package/dist/capability/index.d.ts.map +1 -0
  3. package/dist/capability/index.js +9 -0
  4. package/dist/capability/index.js.map +1 -0
  5. package/dist/capability/methodologies/bmad.yaml +69 -0
  6. package/dist/capability/methodologies/harness-engineering.yaml +69 -0
  7. package/dist/capability/methodology-planner.d.ts +33 -0
  8. package/dist/capability/methodology-planner.d.ts.map +1 -0
  9. package/dist/capability/methodology-planner.js +178 -0
  10. package/dist/capability/methodology-planner.js.map +1 -0
  11. package/dist/capability/methodology-registry.d.ts +32 -0
  12. package/dist/capability/methodology-registry.d.ts.map +1 -0
  13. package/dist/capability/methodology-registry.js +97 -0
  14. package/dist/capability/methodology-registry.js.map +1 -0
  15. package/dist/capability/types.d.ts +68 -0
  16. package/dist/capability/types.d.ts.map +1 -0
  17. package/dist/capability/types.js +7 -0
  18. package/dist/capability/types.js.map +1 -0
  19. package/dist/core/storage/schema.sql +40 -0
  20. package/dist/core/storage/sqlite.d.ts +25 -0
  21. package/dist/core/storage/sqlite.d.ts.map +1 -1
  22. package/dist/core/storage/sqlite.js +87 -0
  23. package/dist/core/storage/sqlite.js.map +1 -1
  24. package/dist/daemon/handlers/methodology-formatter.d.ts +9 -0
  25. package/dist/daemon/handlers/methodology-formatter.d.ts.map +1 -0
  26. package/dist/daemon/handlers/methodology-formatter.js +73 -0
  27. package/dist/daemon/handlers/methodology-formatter.js.map +1 -0
  28. package/dist/daemon/handlers/post-tool-use.d.ts +9 -1
  29. package/dist/daemon/handlers/post-tool-use.d.ts.map +1 -1
  30. package/dist/daemon/handlers/post-tool-use.js +94 -2
  31. package/dist/daemon/handlers/post-tool-use.js.map +1 -1
  32. package/dist/daemon/handlers/pre-tool-use.d.ts +5 -0
  33. package/dist/daemon/handlers/pre-tool-use.d.ts.map +1 -1
  34. package/dist/daemon/handlers/pre-tool-use.js +88 -0
  35. package/dist/daemon/handlers/pre-tool-use.js.map +1 -1
  36. package/dist/daemon/handlers/user-prompt.d.ts +5 -1
  37. package/dist/daemon/handlers/user-prompt.d.ts.map +1 -1
  38. package/dist/daemon/handlers/user-prompt.js +106 -16
  39. package/dist/daemon/handlers/user-prompt.js.map +1 -1
  40. package/dist/daemon/index.d.ts.map +1 -1
  41. package/dist/daemon/index.js +8 -2
  42. package/dist/daemon/index.js.map +1 -1
  43. package/dist/daemon/routing-state.d.ts +49 -0
  44. package/dist/daemon/routing-state.d.ts.map +1 -0
  45. package/dist/daemon/routing-state.js +189 -0
  46. package/dist/daemon/routing-state.js.map +1 -0
  47. package/dist/engine/conventions/routing.yaml +5 -0
  48. package/dist/web/server.d.ts.map +1 -1
  49. package/dist/web/server.js +122 -1
  50. package/dist/web/server.js.map +1 -1
  51. package/dist/web/static/assets/index-CtylfoaN.css +1 -0
  52. package/dist/web/static/assets/index-DnaQt27h.js +388 -0
  53. package/dist/web/static/assets/index-DnaQt27h.js.map +1 -0
  54. package/dist/web/static/index.html +12 -2971
  55. package/package.json +5 -2
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Capability System - 方法论编排系统
3
+ *
4
+ * 支持动态编排的方法论执行
5
+ */
6
+ export * from './types.js';
7
+ export * from './methodology-registry.js';
8
+ export * from './methodology-planner.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capability/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Capability System - 方法论编排系统
3
+ *
4
+ * 支持动态编排的方法论执行
5
+ */
6
+ export * from './types.js';
7
+ export * from './methodology-registry.js';
8
+ export * from './methodology-planner.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capability/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,69 @@
1
+ id: bmad
2
+ name: "BMad (敏捷开发方法论)"
3
+ description: "Four-role agile development methodology"
4
+
5
+ trigger:
6
+ taskType:
7
+ - write_code
8
+ - add_feature
9
+ - implement
10
+ complexity:
11
+ - moderate
12
+ - complex
13
+ keywords:
14
+ - feature
15
+ - implement
16
+ - develop
17
+ - build
18
+
19
+ # 阶段模板库
20
+ phase_templates:
21
+ analyze:
22
+ agent: researcher
23
+ prompt_template: "As Product Manager: Analyze requirements for {target}. Output: user stories, acceptance criteria, constraints. Document to docs/{target}-requirements.md"
24
+ description: "Product Manager analyzes requirements"
25
+ artifacts:
26
+ - type: file
27
+ pattern: "docs/**/*requirements*.md"
28
+ required: true
29
+
30
+ design:
31
+ agent: architect
32
+ prompt_template: "As Architect: Design technical solution for {target}. Based on requirements document. Output: architecture design, module structure, interfaces, data flow. Document to docs/{target}-design.md"
33
+ description: "Architect designs technical solution"
34
+ artifacts:
35
+ - type: file
36
+ pattern: "docs/**/*design*.md"
37
+ required: true
38
+
39
+ implement:
40
+ agent: coder
41
+ prompt_template: "As Developer: Implement {target} based on design document. Follow coding standards. Write clean, maintainable code."
42
+ description: "Developer implements the solution"
43
+ artifacts:
44
+ - type: file
45
+ pattern: "src/**/*.ts"
46
+ required: true
47
+
48
+ review:
49
+ agent: reviewer
50
+ prompt_template: "As Tech Lead: Review implementation of {target}. Check: code quality, security, performance, maintainability. Output review report to docs/{target}-review.md"
51
+ description: "Tech Lead reviews implementation"
52
+ artifacts:
53
+ - type: file
54
+ pattern: "docs/**/*review*.md"
55
+ required: true
56
+
57
+ # AI 决策规则
58
+ decision_rules:
59
+ - condition: "complexity == 'simple' && taskType == 'write_code'"
60
+ phases: ["implement"]
61
+ description: "Simple feature: just implement"
62
+
63
+ - condition: "complexity == 'moderate' && taskType == 'add_feature'"
64
+ phases: ["design", "implement", "review"]
65
+ description: "Moderate feature: design + implement + review"
66
+
67
+ - condition: "complexity == 'complex' && taskType == 'add_feature'"
68
+ phases: ["analyze", "design", "implement", "review"]
69
+ description: "Complex feature: full BMad workflow"
@@ -0,0 +1,69 @@
1
+ id: harness-engineering
2
+ name: "Harness Engineering"
3
+ description: "Safe refactoring methodology with test safety net"
4
+
5
+ trigger:
6
+ taskType:
7
+ - refactor
8
+ - migrate
9
+ - cleanup_code
10
+ complexity:
11
+ - moderate
12
+ - complex
13
+ # keywords 是可选的,如果不定义则不检查
14
+ # keywords:
15
+ # - refactor
16
+ # - migrate
17
+ # - legacy
18
+ # - technical debt
19
+
20
+ # 阶段模板库(供 AI Planner 选择)
21
+ phase_templates:
22
+ understand:
23
+ agent: researcher
24
+ prompt_template: "Read {target} and document current behavior. Focus on: inputs, outputs, side effects, dependencies. Output a behavior document to docs/{target}-behavior.md"
25
+ description: "Understand current implementation before making changes"
26
+ artifacts:
27
+ - type: file
28
+ pattern: "docs/**/*behavior*.md"
29
+ required: true
30
+
31
+ characterize:
32
+ agent: tester
33
+ prompt_template: "Based on the behavior document, create characterization tests for {target}. Tests should cover: normal paths, edge cases, error handling. Target coverage > 80%."
34
+ description: "Build test safety net before refactoring"
35
+ artifacts:
36
+ - type: file
37
+ pattern: "tests/**/*.test.ts"
38
+ required: true
39
+ - type: test_coverage
40
+ min: 80
41
+
42
+ refactor:
43
+ agent: refactor-specialist
44
+ prompt_template: "Refactor {target} while keeping tests passing. Focus on: {refactor_goal}. Run tests after each change."
45
+ description: "Make changes with test safety net"
46
+ artifacts:
47
+ - type: git_diff
48
+
49
+ verify:
50
+ agent: tester
51
+ prompt_template: "Run all tests and verify behavior consistency. Compare with original behavior document."
52
+ description: "Verify behavior remains consistent"
53
+ artifacts:
54
+ - type: test_pass
55
+ required: true
56
+
57
+ # AI 决策规则(作为参考,不是硬编码)
58
+ decision_rules:
59
+ - condition: "complexity == 'simple' && taskType == 'refactor'"
60
+ phases: ["characterize", "refactor", "verify"]
61
+ description: "Simple refactor: skip understand phase if code is straightforward"
62
+
63
+ - condition: "complexity == 'moderate' && taskType == 'refactor'"
64
+ phases: ["understand", "characterize", "refactor", "verify"]
65
+ description: "Moderate refactor: full Harness Engineering workflow"
66
+
67
+ - condition: "complexity == 'complex' && taskType == 'migrate'"
68
+ phases: ["understand", "characterize", "refactor", "verify"]
69
+ description: "Complex migration: full workflow with extra caution"
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Methodology Planner
3
+ *
4
+ * 使用 AI 动态生成执行计划
5
+ */
6
+ import type { AIProvider } from '../core/ai/types.js';
7
+ import type { IntentAnalysis } from '../intelligence/classifier.js';
8
+ import type { Methodology, ExecutionPlan } from './types.js';
9
+ export declare class MethodologyPlanner {
10
+ private ai;
11
+ constructor(ai: AIProvider | null);
12
+ /**
13
+ * 根据任务和方法论,动态生成执行计划
14
+ */
15
+ plan(userPrompt: string, intent: IntentAnalysis, methodology: Methodology): Promise<ExecutionPlan>;
16
+ /**
17
+ * 构建 AI Planner 的 prompt
18
+ */
19
+ private buildPlannerPrompt;
20
+ /**
21
+ * 解析 AI 响应
22
+ */
23
+ private parsePlanResponse;
24
+ /**
25
+ * 降级方案:使用预定义规则
26
+ */
27
+ private fallbackPlan;
28
+ /**
29
+ * 简单的规则匹配
30
+ */
31
+ private matchRule;
32
+ }
33
+ //# sourceMappingURL=methodology-planner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methodology-planner.d.ts","sourceRoot":"","sources":["../../src/capability/methodology-planner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAC;AAG3E,qBAAa,kBAAkB;IACjB,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,UAAU,GAAG,IAAI;IAEzC;;OAEG;IACG,IAAI,CACR,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,aAAa,CAAC;IAqBzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAqD1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuCzB;;OAEG;IACH,OAAO,CAAC,YAAY;IA+CpB;;OAEG;IACH,OAAO,CAAC,SAAS;CAgBlB"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Methodology Planner
3
+ *
4
+ * 使用 AI 动态生成执行计划
5
+ */
6
+ import { logger } from '../core/utils/logger.js';
7
+ export class MethodologyPlanner {
8
+ ai;
9
+ constructor(ai) {
10
+ this.ai = ai;
11
+ }
12
+ /**
13
+ * 根据任务和方法论,动态生成执行计划
14
+ */
15
+ async plan(userPrompt, intent, methodology) {
16
+ if (!this.ai) {
17
+ // 降级:使用默认规则
18
+ return this.fallbackPlan(userPrompt, intent, methodology);
19
+ }
20
+ try {
21
+ const prompt = this.buildPlannerPrompt(userPrompt, intent, methodology);
22
+ const response = await this.ai.complete(prompt, {
23
+ maxTokens: 2000,
24
+ });
25
+ const plan = this.parsePlanResponse(response, methodology);
26
+ logger.info(`[MethodologyPlanner] Generated plan: ${plan.phases.length} phases`);
27
+ return plan;
28
+ }
29
+ catch (err) {
30
+ logger.warn(`[MethodologyPlanner] AI planning failed: ${err}, using fallback`);
31
+ return this.fallbackPlan(userPrompt, intent, methodology);
32
+ }
33
+ }
34
+ /**
35
+ * 构建 AI Planner 的 prompt
36
+ */
37
+ buildPlannerPrompt(userPrompt, intent, methodology) {
38
+ const phaseDescriptions = Object.entries(methodology.phase_templates)
39
+ .map(([id, template]) => `- ${id}: ${template.description || template.prompt_template}`)
40
+ .join('\n');
41
+ const decisionRules = methodology.decision_rules
42
+ ?.map(rule => `- ${rule.condition} → [${rule.phases.join(', ')}]: ${rule.description}`)
43
+ .join('\n') || 'No predefined rules';
44
+ return `You are a methodology planner for "${methodology.name}".
45
+
46
+ Task: ${userPrompt}
47
+
48
+ Intent Analysis:
49
+ - Task Type: ${intent.taskType}
50
+ - Complexity: ${intent.complexity}
51
+ - Requirement: ${intent.requirement}
52
+
53
+ Available Phases:
54
+ ${phaseDescriptions}
55
+
56
+ Decision Rules (as reference):
57
+ ${decisionRules}
58
+
59
+ Your job: Generate an execution plan by selecting appropriate phases.
60
+
61
+ Guidelines:
62
+ 1. Simple tasks (complexity: simple): Use minimal phases (1-2)
63
+ 2. Moderate tasks (complexity: moderate): Use core phases (2-3)
64
+ 3. Complex tasks (complexity: complex): Use full workflow (3-4+)
65
+ 4. Consider task type: bug fix needs less phases than architecture change
66
+ 5. Each phase must have a clear rationale
67
+
68
+ Output JSON (no markdown, just JSON):
69
+ {
70
+ "phases": [
71
+ {
72
+ "id": "phase_id",
73
+ "agent": "agent_name",
74
+ "prompt": "Specific instruction for this phase",
75
+ "rationale": "Why this phase is needed"
76
+ }
77
+ ],
78
+ "rationale": "Overall plan rationale"
79
+ }
80
+
81
+ IMPORTANT: Output ONLY valid JSON, no markdown code blocks.`;
82
+ }
83
+ /**
84
+ * 解析 AI 响应
85
+ */
86
+ parsePlanResponse(response, methodology) {
87
+ // 移除可能的 markdown 代码块标记
88
+ let cleaned = response.trim();
89
+ if (cleaned.startsWith('```json')) {
90
+ cleaned = cleaned.slice(7);
91
+ }
92
+ if (cleaned.startsWith('```')) {
93
+ cleaned = cleaned.slice(3);
94
+ }
95
+ if (cleaned.endsWith('```')) {
96
+ cleaned = cleaned.slice(0, -3);
97
+ }
98
+ cleaned = cleaned.trim();
99
+ const parsed = JSON.parse(cleaned);
100
+ // 验证和补充 phases
101
+ const phases = parsed.phases.map((phase) => {
102
+ const template = methodology.phase_templates[phase.id];
103
+ if (!template) {
104
+ throw new Error(`Unknown phase: ${phase.id}`);
105
+ }
106
+ return {
107
+ id: phase.id,
108
+ agent: phase.agent || template.agent,
109
+ prompt: phase.prompt,
110
+ rationale: phase.rationale,
111
+ artifacts: template.artifacts,
112
+ };
113
+ });
114
+ return {
115
+ phases,
116
+ rationale: parsed.rationale,
117
+ methodology_id: methodology.id,
118
+ };
119
+ }
120
+ /**
121
+ * 降级方案:使用预定义规则
122
+ */
123
+ fallbackPlan(userPrompt, intent, methodology) {
124
+ logger.info('[MethodologyPlanner] Using fallback plan');
125
+ // 尝试匹配决策规则
126
+ if (methodology.decision_rules) {
127
+ for (const rule of methodology.decision_rules) {
128
+ if (this.matchRule(rule.condition, intent)) {
129
+ const phases = rule.phases.map(phaseId => {
130
+ const template = methodology.phase_templates[phaseId];
131
+ return {
132
+ id: phaseId,
133
+ agent: template.agent,
134
+ prompt: template.prompt_template.replace('{target}', userPrompt),
135
+ rationale: template.description || `Execute ${phaseId} phase`,
136
+ artifacts: template.artifacts,
137
+ };
138
+ });
139
+ return {
140
+ phases,
141
+ rationale: rule.description || 'Using predefined rule',
142
+ methodology_id: methodology.id,
143
+ };
144
+ }
145
+ }
146
+ }
147
+ // 默认:使用所有阶段
148
+ const allPhases = Object.entries(methodology.phase_templates).map(([id, template]) => ({
149
+ id,
150
+ agent: template.agent,
151
+ prompt: template.prompt_template.replace('{target}', userPrompt),
152
+ rationale: template.description || `Execute ${id} phase`,
153
+ artifacts: template.artifacts,
154
+ }));
155
+ return {
156
+ phases: allPhases,
157
+ rationale: 'Using full methodology workflow (fallback)',
158
+ methodology_id: methodology.id,
159
+ };
160
+ }
161
+ /**
162
+ * 简单的规则匹配
163
+ */
164
+ matchRule(condition, intent) {
165
+ // 简单的字符串匹配实现
166
+ // 例如: "complexity == 'simple' && taskType == 'refactor'"
167
+ const complexityMatch = condition.match(/complexity\s*==\s*'(\w+)'/);
168
+ const taskTypeMatch = condition.match(/taskType\s*==\s*'(\w+)'/);
169
+ if (complexityMatch && complexityMatch[1] !== intent.complexity) {
170
+ return false;
171
+ }
172
+ if (taskTypeMatch && taskTypeMatch[1] !== intent.taskType) {
173
+ return false;
174
+ }
175
+ return true;
176
+ }
177
+ }
178
+ //# sourceMappingURL=methodology-planner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methodology-planner.js","sourceRoot":"","sources":["../../src/capability/methodology-planner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,MAAM,OAAO,kBAAkB;IACT;IAApB,YAAoB,EAAqB;QAArB,OAAE,GAAF,EAAE,CAAmB;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,UAAkB,EAClB,MAAsB,EACtB,WAAwB;QAExB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,YAAY;YACZ,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;YACxE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;gBAC9C,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAC3D,MAAM,CAAC,IAAI,CAAC,wCAAwC,IAAI,CAAC,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;YACjF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC,4CAA4C,GAAG,kBAAkB,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,M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E,MAAsB;QACzD,aAAa;QACb,yDAAyD;QACzD,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACrE,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAEjE,IAAI,eAAe,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,UAAU,EAAE,CAAC;YAChE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Methodology Registry
3
+ *
4
+ * 加载和管理方法论定义
5
+ */
6
+ import type { Methodology } from './types.js';
7
+ import type { IntentAnalysis } from '../intelligence/classifier.js';
8
+ export declare class MethodologyRegistry {
9
+ private methodologies;
10
+ constructor();
11
+ /**
12
+ * 加载所有方法论定义
13
+ */
14
+ private loadAll;
15
+ /**
16
+ * 根据 intent 匹配方法论
17
+ */
18
+ match(intent: IntentAnalysis): Methodology | null;
19
+ /**
20
+ * 检查方法论是否匹配 intent
21
+ */
22
+ private isMatch;
23
+ /**
24
+ * 根据 ID 获取方法论
25
+ */
26
+ get(id: string): Methodology | undefined;
27
+ /**
28
+ * 获取所有方法论
29
+ */
30
+ getAll(): Methodology[];
31
+ }
32
+ //# sourceMappingURL=methodology-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methodology-registry.d.ts","sourceRoot":"","sources":["../../src/capability/methodology-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAMpE,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,aAAa,CAAuC;;IAM5D;;OAEG;IACH,OAAO,CAAC,OAAO;IAwBf;;OAEG;IACH,KAAK,CAAC,MAAM,EAAE,cAAc,GAAG,WAAW,GAAG,IAAI;IASjD;;OAEG;IACH,OAAO,CAAC,OAAO;IAmCf;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxC;;OAEG;IACH,MAAM,IAAI,WAAW,EAAE;CAGxB"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Methodology Registry
3
+ *
4
+ * 加载和管理方法论定义
5
+ */
6
+ import { readFileSync, readdirSync } from 'fs';
7
+ import { join, dirname } from 'path';
8
+ import { fileURLToPath } from 'url';
9
+ import { parse as parseYaml } from 'yaml';
10
+ import { logger } from '../core/utils/logger.js';
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ export class MethodologyRegistry {
14
+ methodologies = new Map();
15
+ constructor() {
16
+ this.loadAll();
17
+ }
18
+ /**
19
+ * 加载所有方法论定义
20
+ */
21
+ loadAll() {
22
+ const methodologiesDir = join(__dirname, 'methodologies');
23
+ try {
24
+ const files = readdirSync(methodologiesDir).filter(f => f.endsWith('.yaml'));
25
+ for (const file of files) {
26
+ try {
27
+ const content = readFileSync(join(methodologiesDir, file), 'utf-8');
28
+ const methodology = parseYaml(content);
29
+ this.methodologies.set(methodology.id, methodology);
30
+ logger.info(`[MethodologyRegistry] Loaded: ${methodology.id}`);
31
+ }
32
+ catch (err) {
33
+ logger.warn(`[MethodologyRegistry] Failed to load ${file}: ${err}`);
34
+ }
35
+ }
36
+ logger.info(`[MethodologyRegistry] Loaded ${this.methodologies.size} methodologies`);
37
+ }
38
+ catch (err) {
39
+ logger.warn(`[MethodologyRegistry] Failed to load methodologies: ${err}`);
40
+ }
41
+ }
42
+ /**
43
+ * 根据 intent 匹配方法论
44
+ */
45
+ match(intent) {
46
+ for (const methodology of this.methodologies.values()) {
47
+ if (this.isMatch(methodology, intent)) {
48
+ return methodology;
49
+ }
50
+ }
51
+ return null;
52
+ }
53
+ /**
54
+ * 检查方法论是否匹配 intent
55
+ */
56
+ isMatch(methodology, intent) {
57
+ const trigger = methodology.trigger;
58
+ // 检查 taskType
59
+ if (trigger.taskType && trigger.taskType.length > 0) {
60
+ if (!trigger.taskType.includes(intent.taskType)) {
61
+ logger.debug(`[MethodologyRegistry] ${methodology.id} taskType mismatch: expected ${trigger.taskType.join('|')}, got ${intent.taskType}`);
62
+ return false;
63
+ }
64
+ }
65
+ // 检查 complexity
66
+ if (trigger.complexity && trigger.complexity.length > 0) {
67
+ if (!trigger.complexity.includes(intent.complexity)) {
68
+ logger.debug(`[MethodologyRegistry] ${methodology.id} complexity mismatch: expected ${trigger.complexity.join('|')}, got ${intent.complexity}`);
69
+ return false;
70
+ }
71
+ }
72
+ // 检查 keywords(简单的关键词匹配)- 如果定义了 keywords,则必须匹配
73
+ if (trigger.keywords && trigger.keywords.length > 0) {
74
+ const requirementLower = intent.requirement?.toLowerCase() || '';
75
+ const hasKeyword = trigger.keywords.some(kw => requirementLower.includes(kw.toLowerCase()));
76
+ if (!hasKeyword) {
77
+ logger.debug(`[MethodologyRegistry] ${methodology.id} keyword mismatch: requirement="${intent.requirement}", expected one of ${trigger.keywords.join('|')}`);
78
+ return false;
79
+ }
80
+ }
81
+ logger.debug(`[MethodologyRegistry] ${methodology.id} matched!`);
82
+ return true;
83
+ }
84
+ /**
85
+ * 根据 ID 获取方法论
86
+ */
87
+ get(id) {
88
+ return this.methodologies.get(id);
89
+ }
90
+ /**
91
+ * 获取所有方法论
92
+ */
93
+ getAll() {
94
+ return Array.from(this.methodologies.values());
95
+ }
96
+ }
97
+ //# sourceMappingURL=methodology-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methodology-registry.js","sourceRoot":"","sources":["../../src/capability/methodology-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,M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7
+ id: string;
8
+ name: string;
9
+ description: string;
10
+ trigger: MethodologyTrigger;
11
+ phase_templates: Record<string, PhaseTemplate>;
12
+ decision_rules?: DecisionRule[];
13
+ }
14
+ export interface MethodologyTrigger {
15
+ taskType?: string[];
16
+ complexity?: string[];
17
+ keywords?: string[];
18
+ }
19
+ export interface PhaseTemplate {
20
+ agent: string;
21
+ prompt_template: string;
22
+ artifacts?: ArtifactRequirement[];
23
+ description?: string;
24
+ }
25
+ export interface ArtifactRequirement {
26
+ type: 'file' | 'test_coverage' | 'test_pass' | 'git_diff';
27
+ pattern?: string;
28
+ min?: number;
29
+ required?: boolean;
30
+ }
31
+ export interface DecisionRule {
32
+ condition: string;
33
+ phases: string[];
34
+ description?: string;
35
+ }
36
+ export interface ExecutionPlan {
37
+ phases: PlannedPhase[];
38
+ rationale: string;
39
+ methodology_id: string;
40
+ }
41
+ export interface PlannedPhase {
42
+ id: string;
43
+ agent: string;
44
+ prompt: string;
45
+ rationale: string;
46
+ artifacts?: ArtifactRequirement[];
47
+ }
48
+ export interface MethodologyExecution {
49
+ id: number;
50
+ session_id: string;
51
+ methodology_id: string;
52
+ plan_json: string;
53
+ current_phase_index: number;
54
+ status: 'running' | 'completed' | 'failed';
55
+ started_at: number;
56
+ completed_at?: number;
57
+ }
58
+ export interface PhaseExecution {
59
+ id: number;
60
+ methodology_execution_id: number;
61
+ phase_id: string;
62
+ agent_name: string;
63
+ prompt: string;
64
+ status: 'pending' | 'running' | 'completed' | 'failed';
65
+ started_at?: number;
66
+ completed_at?: number;
67
+ }
68
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/capability/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,kBAAkB,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EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Capability System Types
3
+ *
4
+ * 支持动态编排的方法论系统
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/capability/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -219,3 +219,43 @@ CREATE TABLE IF NOT EXISTS routing_rule_states (
219
219
  );
220
220
 
221
221
  CREATE INDEX IF NOT EXISTS idx_rule_states_disabled ON routing_rule_states(disabled);
222
+
223
+ -- ── Methodology Executions (方法论执行追踪) ──────────────────────────────
224
+ -- 记录方法论的执行实例和动态生成的执行计划
225
+
226
+ CREATE TABLE IF NOT EXISTS methodology_executions (
227
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
228
+ session_id TEXT NOT NULL,
229
+ methodology_id TEXT NOT NULL,
230
+ plan_json TEXT NOT NULL, -- 动态生成的执行计划(JSON)
231
+ current_phase_index INTEGER DEFAULT 0,
232
+ status TEXT NOT NULL DEFAULT 'running' CHECK(status IN ('running', 'completed', 'failed', 'cancelled')),
233
+ started_at INTEGER NOT NULL,
234
+ completed_at INTEGER,
235
+ created_at TEXT DEFAULT (datetime('now'))
236
+ );
237
+
238
+ CREATE INDEX IF NOT EXISTS idx_methodology_exec_session ON methodology_executions(session_id);
239
+ CREATE INDEX IF NOT EXISTS idx_methodology_exec_status ON methodology_executions(status);
240
+
241
+ -- ── Phase Executions (阶段执行记录) ──────────────────────────────────────
242
+ -- 记录每个阶段的执行情况
243
+
244
+ CREATE TABLE IF NOT EXISTS phase_executions (
245
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
246
+ methodology_execution_id INTEGER NOT NULL,
247
+ phase_id TEXT NOT NULL,
248
+ phase_index INTEGER NOT NULL,
249
+ agent_name TEXT NOT NULL,
250
+ prompt TEXT NOT NULL,
251
+ status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'running', 'completed', 'failed')),
252
+ started_at INTEGER,
253
+ completed_at INTEGER,
254
+ duration_ms INTEGER,
255
+ artifacts_json TEXT, -- 产物记录(JSON)
256
+ created_at TEXT DEFAULT (datetime('now')),
257
+ FOREIGN KEY (methodology_execution_id) REFERENCES methodology_executions(id)
258
+ );
259
+
260
+ CREATE INDEX IF NOT EXISTS idx_phase_exec_methodology ON phase_executions(methodology_execution_id);
261
+ CREATE INDEX IF NOT EXISTS idx_phase_exec_status ON phase_executions(status);