Repository navigation
Expand file tree
/
Copy pathsparc-modes.ts
More file actions
278 lines (250 loc) · 8.83 KB
/
Copy pathsparc-modes.ts
File metadata and controls
278 lines (250 loc) · 8.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
/**
* SPARC Development Modes
*
* 17 specialized development modes for systematic TDD with AI assistance
*/
export interface SparcMode {
id: string;
name: string;
description: string;
phases: string[];
agents: string[];
workflow: string;
temperature?: number;
maxTokens?: number;
}
export const SPARC_MODES: Record<string, SparcMode> = {
// Core SPARC Modes
'spec-pseudocode': {
id: 'spec-pseudocode',
name: 'Specification & Pseudocode',
description: 'Define requirements and create algorithmic logic',
phases: ['specification', 'pseudocode'],
agents: ['planner', 'researcher', 'architect'],
workflow: 'sequential',
temperature: 0.6
},
'architect': {
id: 'architect',
name: 'Architecture Design',
description: 'Design system architecture and component structure',
phases: ['architecture', 'design'],
agents: ['architect', 'planner', 'reviewer'],
workflow: 'collaborative',
temperature: 0.7
},
'tdd': {
id: 'tdd',
name: 'Test-Driven Development',
description: 'Complete TDD cycle with tests first, then implementation',
phases: ['test-design', 'test-implementation', 'code-implementation', 'refactoring'],
agents: ['tester', 'coder', 'reviewer'],
workflow: 'iterative',
temperature: 0.4
},
'refinement': {
id: 'refinement',
name: 'Code Refinement',
description: 'Iterative improvement of existing code',
phases: ['analysis', 'optimization', 'refactoring', 'validation'],
agents: ['reviewer', 'coder', 'performance-monitor'],
workflow: 'iterative',
temperature: 0.5
},
'integration': {
id: 'integration',
name: 'System Integration',
description: 'Integrate components and validate system behavior',
phases: ['component-analysis', 'integration-planning', 'implementation', 'testing'],
agents: ['integration-expert', 'tester', 'devops-engineer'],
workflow: 'sequential',
temperature: 0.4
},
// Development Modes
'dev': {
id: 'dev',
name: 'Full Development Cycle',
description: 'Complete development from specification to deployment',
phases: ['spec', 'design', 'implement', 'test', 'deploy'],
agents: ['planner', 'coder', 'tester', 'devops-engineer'],
workflow: 'pipeline',
temperature: 0.5
},
'api': {
id: 'api',
name: 'API Development',
description: 'Design and implement RESTful or GraphQL APIs',
phases: ['api-design', 'implementation', 'documentation', 'testing'],
agents: ['api-designer', 'coder', 'documentation-writer', 'tester'],
workflow: 'sequential',
temperature: 0.4
},
'ui': {
id: 'ui',
name: 'UI Development',
description: 'User interface design and implementation',
phases: ['design', 'component-creation', 'styling', 'testing'],
agents: ['ui-designer', 'coder', 'ux-researcher', 'tester'],
workflow: 'iterative',
temperature: 0.6
},
'test': {
id: 'test',
name: 'Comprehensive Testing',
description: 'Create and execute comprehensive test suites',
phases: ['test-planning', 'unit-tests', 'integration-tests', 'e2e-tests'],
agents: ['tester', 'performance-monitor', 'security-auditor'],
workflow: 'parallel',
temperature: 0.3
},
'refactor': {
id: 'refactor',
name: 'Code Refactoring',
description: 'Systematic code improvement without changing behavior',
phases: ['analysis', 'planning', 'refactoring', 'validation'],
agents: ['reviewer', 'coder', 'tester'],
workflow: 'iterative',
temperature: 0.4
},
// Specialized Modes
'security': {
id: 'security',
name: 'Security Hardening',
description: 'Security analysis and implementation',
phases: ['audit', 'vulnerability-assessment', 'remediation', 'validation'],
agents: ['security-auditor', 'penetration-tester', 'coder', 'tester'],
workflow: 'sequential',
temperature: 0.3
},
'performance': {
id: 'performance',
name: 'Performance Optimization',
description: 'Analyze and optimize system performance',
phases: ['profiling', 'bottleneck-analysis', 'optimization', 'benchmarking'],
agents: ['performance-monitor', 'bottleneck-analyzer', 'coder', 'tester'],
workflow: 'iterative',
temperature: 0.4
},
'ml': {
id: 'ml',
name: 'Machine Learning Development',
description: 'ML model development and deployment',
phases: ['data-analysis', 'model-design', 'training', 'deployment'],
agents: ['data-analyst', 'neural-architect', 'training-coordinator', 'model-deployer'],
workflow: 'pipeline',
temperature: 0.5
},
'migration': {
id: 'migration',
name: 'System Migration',
description: 'Migrate legacy systems or upgrade technologies',
phases: ['analysis', 'planning', 'implementation', 'validation'],
agents: ['migration-specialist', 'coder', 'tester', 'devops-engineer'],
workflow: 'sequential',
temperature: 0.4
},
'documentation': {
id: 'documentation',
name: 'Documentation Generation',
description: 'Create comprehensive project documentation',
phases: ['analysis', 'structure-planning', 'writing', 'review'],
agents: ['documentation-writer', 'reviewer', 'api-designer'],
workflow: 'sequential',
temperature: 0.6
},
'quantum': {
id: 'quantum',
name: 'Quantum Computing',
description: 'Quantum algorithm and circuit development',
phases: ['algorithm-design', 'circuit-creation', 'simulation', 'optimization'],
agents: ['quantum-algorithm-specialist', 'quantum-circuit-designer', 'qubit-state-manager'],
workflow: 'specialized',
temperature: 0.4,
maxTokens: 16384
},
'consensus': {
id: 'consensus',
name: 'Distributed Consensus',
description: 'Implement distributed consensus mechanisms',
phases: ['protocol-selection', 'implementation', 'fault-tolerance', 'testing'],
agents: ['byzantine-fault-tolerant', 'raft-consensus', 'crdt-manager', 'tester'],
workflow: 'parallel',
temperature: 0.3
}
};
// SPARC Workflow Types
export enum SparcWorkflow {
Sequential = 'sequential', // Phases execute one after another
Parallel = 'parallel', // Phases can execute simultaneously
Iterative = 'iterative', // Phases repeat in cycles
Pipeline = 'pipeline', // Continuous flow through phases
Collaborative = 'collaborative', // Agents work together on phases
Specialized = 'specialized' // Custom workflow for specific domains
}
// SPARC Phase Definitions
export interface SparcPhase {
id: string;
name: string;
description: string;
requiredAgents: string[];
outputs: string[];
successCriteria: string[];
}
export const SPARC_PHASES: Record<string, SparcPhase> = {
'specification': {
id: 'specification',
name: 'Specification',
description: 'Define detailed requirements and acceptance criteria',
requiredAgents: ['planner', 'researcher'],
outputs: ['requirements.md', 'acceptance-criteria.md'],
successCriteria: ['Clear requirements', 'Measurable criteria', 'Stakeholder approval']
},
'pseudocode': {
id: 'pseudocode',
name: 'Pseudocode',
description: 'Create algorithmic logic in pseudocode',
requiredAgents: ['planner', 'architect'],
outputs: ['algorithms.md', 'data-structures.md'],
successCriteria: ['Complete logic coverage', 'Optimal algorithms', 'Clear structure']
},
'architecture': {
id: 'architecture',
name: 'Architecture',
description: 'Design system architecture and components',
requiredAgents: ['architect', 'planner'],
outputs: ['architecture.md', 'component-diagram.svg'],
successCriteria: ['Scalable design', 'Clear boundaries', 'Technology decisions']
},
'test-design': {
id: 'test-design',
name: 'Test Design',
description: 'Design comprehensive test cases',
requiredAgents: ['tester', 'planner'],
outputs: ['test-plan.md', 'test-cases.json'],
successCriteria: ['Full coverage', 'Edge cases', 'Performance criteria']
},
'implementation': {
id: 'implementation',
name: 'Implementation',
description: 'Write production code',
requiredAgents: ['coder', 'reviewer'],
outputs: ['src/**/*.ts', 'tests/**/*.test.ts'],
successCriteria: ['Tests pass', 'Code quality', 'Performance targets']
},
'refinement': {
id: 'refinement',
name: 'Refinement',
description: 'Iterative improvement and optimization',
requiredAgents: ['reviewer', 'coder', 'performance-monitor'],
outputs: ['refactored-code', 'performance-report.md'],
successCriteria: ['Improved metrics', 'Maintained functionality', 'Clean code']
}
};
// Export SPARC mode runner
export class SparcModeRunner {
constructor(private mode: SparcMode) {}
async execute(task: string, options?: any): Promise<any> {
// Implementation will coordinate agents through the specified workflow
throw new Error('SparcModeRunner.execute() to be implemented');
}
}