myaidev-method 0.2.1 โ†’ 0.2.3

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 (30) hide show
  1. package/.claude/mcp/mcp-config.json +93 -10
  2. package/.claude/mcp/sparc-orchestrator-server.js +607 -0
  3. package/DEV_WORKFLOW_GUIDE.md +1353 -0
  4. package/MCP_INTEGRATION.md +373 -0
  5. package/README.md +378 -21
  6. package/TECHNICAL_ARCHITECTURE.md +1868 -0
  7. package/bin/cli.js +44 -3
  8. package/dist/mcp/mcp-config.json +93 -10
  9. package/dist/mcp/sparc-orchestrator-server.js +607 -0
  10. package/package.json +24 -4
  11. package/src/lib/dev-workflow/agent-types.js +163 -0
  12. package/src/lib/dev-workflow/sparc-workflow.js +302 -0
  13. package/src/lib/dev-workflow/task-manager.js +313 -0
  14. package/src/scripts/dev-architect.js +99 -0
  15. package/src/scripts/dev-code.js +106 -0
  16. package/src/scripts/dev-docs.js +122 -0
  17. package/src/scripts/dev-review.js +117 -0
  18. package/src/scripts/dev-test.js +115 -0
  19. package/src/scripts/sparc-workflow.js +186 -0
  20. package/src/templates/claude/agents/dev-architect.md +436 -0
  21. package/src/templates/claude/agents/dev-coder.md +749 -0
  22. package/src/templates/claude/agents/dev-documenter.md +939 -0
  23. package/src/templates/claude/agents/dev-reviewer.md +1152 -0
  24. package/src/templates/claude/agents/dev-tester.md +600 -0
  25. package/src/templates/claude/commands/myai-dev-architect.md +80 -0
  26. package/src/templates/claude/commands/myai-dev-code.md +93 -0
  27. package/src/templates/claude/commands/myai-dev-docs.md +94 -0
  28. package/src/templates/claude/commands/myai-dev-review.md +96 -0
  29. package/src/templates/claude/commands/myai-dev-test.md +95 -0
  30. package/src/templates/claude/commands/myai-sparc-workflow.md +196 -0
@@ -0,0 +1,163 @@
1
+ /**
2
+ * MyAIDev Method - Development Agent Types
3
+ * Defines specialized agents for systematic development workflow
4
+ * Version: 1.0.0
5
+ */
6
+
7
+ export const AGENT_TYPES = {
8
+ ARCHITECT: {
9
+ id: 'myaidev-dev-architect',
10
+ name: 'MyAIDev Architect',
11
+ description: 'Design system architecture and APIs',
12
+ emoji: '๐Ÿ—๏ธ',
13
+ capabilities: [
14
+ 'System design',
15
+ 'API specification',
16
+ 'Data flow modeling',
17
+ 'Technology selection',
18
+ 'Security planning'
19
+ ],
20
+ tools: ['read', 'write', 'edit', 'websearch'],
21
+ outputs: ['.myaidev-method/sparc/architecture.md'],
22
+ phase: 'architecture'
23
+ },
24
+
25
+ CODER: {
26
+ id: 'myaidev-dev-coder',
27
+ name: 'MyAIDev Coder',
28
+ description: 'Implement features and refactor code',
29
+ emoji: '๐Ÿ’ป',
30
+ capabilities: [
31
+ 'Feature implementation',
32
+ 'Code refactoring',
33
+ 'Bug fixing',
34
+ 'Code optimization',
35
+ 'Pattern application'
36
+ ],
37
+ tools: ['read', 'write', 'edit', 'bash', 'grep', 'glob'],
38
+ outputs: ['.myaidev-method/sparc/code-output/'],
39
+ phase: 'implementation'
40
+ },
41
+
42
+ TESTER: {
43
+ id: 'myaidev-dev-tester',
44
+ name: 'MyAIDev Tester',
45
+ description: 'Write and execute comprehensive tests',
46
+ emoji: '๐Ÿงช',
47
+ capabilities: [
48
+ 'Unit testing',
49
+ 'Integration testing',
50
+ 'Test coverage analysis',
51
+ 'Quality assurance',
52
+ 'Test automation'
53
+ ],
54
+ tools: ['read', 'write', 'edit', 'bash'],
55
+ outputs: ['.myaidev-method/sparc/test-results/'],
56
+ phase: 'testing'
57
+ },
58
+
59
+ REVIEWER: {
60
+ id: 'myaidev-dev-reviewer',
61
+ name: 'MyAIDev Reviewer',
62
+ description: 'Analyze code quality and security',
63
+ emoji: '๐Ÿ‘๏ธ',
64
+ capabilities: [
65
+ 'Code review',
66
+ 'Security analysis',
67
+ 'Performance review',
68
+ 'Best practices validation',
69
+ 'Technical debt assessment'
70
+ ],
71
+ tools: ['read', 'grep', 'glob', 'bash'],
72
+ outputs: ['.myaidev-method/sparc/review-report.md'],
73
+ phase: 'review'
74
+ },
75
+
76
+ DOCUMENTER: {
77
+ id: 'myaidev-dev-documenter',
78
+ name: 'MyAIDev Documenter',
79
+ description: 'Generate comprehensive documentation',
80
+ emoji: '๐Ÿ“š',
81
+ capabilities: [
82
+ 'API documentation',
83
+ 'User guides',
84
+ 'Architecture documentation',
85
+ 'Code comments',
86
+ 'Tutorial creation'
87
+ ],
88
+ tools: ['read', 'write', 'edit', 'grep', 'glob'],
89
+ outputs: ['.myaidev-method/sparc/documentation/'],
90
+ phase: 'documentation'
91
+ }
92
+ };
93
+
94
+ /**
95
+ * Get agent definition by ID
96
+ * @param {string} agentId - Agent identifier
97
+ * @returns {Object|null} Agent definition or null if not found
98
+ */
99
+ export function getAgentById(agentId) {
100
+ return Object.values(AGENT_TYPES).find(agent => agent.id === agentId);
101
+ }
102
+
103
+ /**
104
+ * Get agent definition by phase
105
+ * @param {string} phase - Workflow phase name
106
+ * @returns {Object|null} Agent definition or null if not found
107
+ */
108
+ export function getAgentByPhase(phase) {
109
+ return Object.values(AGENT_TYPES).find(agent => agent.phase === phase);
110
+ }
111
+
112
+ /**
113
+ * List all available agents
114
+ * @returns {Array} Array of all agent definitions
115
+ */
116
+ export function listAllAgents() {
117
+ return Object.values(AGENT_TYPES);
118
+ }
119
+
120
+ /**
121
+ * Get agent capabilities
122
+ * @param {string} agentId - Agent identifier
123
+ * @returns {Array} Array of capabilities or empty array
124
+ */
125
+ export function getAgentCapabilities(agentId) {
126
+ const agent = getAgentById(agentId);
127
+ return agent ? agent.capabilities : [];
128
+ }
129
+
130
+ /**
131
+ * Validate agent exists
132
+ * @param {string} agentId - Agent identifier
133
+ * @returns {boolean} True if agent exists
134
+ */
135
+ export function isValidAgent(agentId) {
136
+ return Object.values(AGENT_TYPES).some(agent => agent.id === agentId);
137
+ }
138
+
139
+ /**
140
+ * Get SPARC workflow phases in order
141
+ * @returns {Array} Ordered array of phase names
142
+ */
143
+ export function getWorkflowPhases() {
144
+ return ['architecture', 'implementation', 'testing', 'review', 'documentation'];
145
+ }
146
+
147
+ /**
148
+ * Get agent summary for display
149
+ * @param {string} agentId - Agent identifier
150
+ * @returns {string} Formatted agent summary
151
+ */
152
+ export function getAgentSummary(agentId) {
153
+ const agent = getAgentById(agentId);
154
+ if (!agent) return 'Unknown agent';
155
+
156
+ return `${agent.emoji} ${agent.name}
157
+ Description: ${agent.description}
158
+ Phase: ${agent.phase}
159
+ Capabilities: ${agent.capabilities.join(', ')}
160
+ Tools: ${agent.tools.join(', ')}`;
161
+ }
162
+
163
+ export default AGENT_TYPES;
@@ -0,0 +1,302 @@
1
+ /**
2
+ * MyAIDev Method - SPARC Workflow Orchestrator
3
+ * Systematic development: Specification โ†’ Architecture โ†’ Code โ†’ Test โ†’ Review โ†’ Documentation
4
+ * Version: 1.0.0
5
+ */
6
+
7
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
8
+ import { join } from 'path';
9
+ import { AGENT_TYPES, getAgentByPhase, getWorkflowPhases } from './agent-types.js';
10
+
11
+ export class SparcWorkflow {
12
+ constructor(task, options = {}) {
13
+ this.task = task;
14
+ this.workingDir = options.workingDir || process.cwd();
15
+ this.myaidevDir = join(this.workingDir, '.myaidev-method');
16
+ this.sparcDir = join(this.myaidevDir, 'sparc');
17
+ this.phases = options.phases || getWorkflowPhases();
18
+ this.currentPhase = null;
19
+ this.results = {};
20
+
21
+ // Create MyAIDev Method directories
22
+ this.initializeDirectories();
23
+ }
24
+
25
+ /**
26
+ * Initialize .myaidev-method directory structure
27
+ */
28
+ initializeDirectories() {
29
+ const dirs = [
30
+ this.myaidevDir,
31
+ this.sparcDir,
32
+ join(this.sparcDir, 'code-output'),
33
+ join(this.sparcDir, 'test-results'),
34
+ join(this.sparcDir, 'documentation'),
35
+ join(this.myaidevDir, 'tasks'),
36
+ join(this.myaidevDir, 'workflows')
37
+ ];
38
+
39
+ for (const dir of dirs) {
40
+ if (!existsSync(dir)) {
41
+ mkdirSync(dir, { recursive: true });
42
+ }
43
+ }
44
+
45
+ // Create .gitignore if it doesn't exist
46
+ const gitignorePath = join(this.myaidevDir, '.gitignore');
47
+ if (!existsSync(gitignorePath)) {
48
+ writeFileSync(gitignorePath, `# MyAIDev Method - Generated files
49
+ *.log
50
+ temp/
51
+ cache/
52
+ `, 'utf8');
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Run a specific SPARC phase
58
+ * @param {string} phaseName - Phase to execute
59
+ * @returns {Promise<Object>} Phase execution result
60
+ */
61
+ async runPhase(phaseName) {
62
+ const agent = getAgentByPhase(phaseName);
63
+
64
+ if (!agent) {
65
+ throw new Error(`Unknown phase: ${phaseName}`);
66
+ }
67
+
68
+ this.currentPhase = phaseName;
69
+
70
+ console.log(`\n${'='.repeat(60)}`);
71
+ console.log(`๐Ÿš€ MyAIDev Method: Running ${phaseName} phase`);
72
+ console.log(`${'='.repeat(60)}`);
73
+ console.log(`${agent.emoji} Agent: ${agent.name}`);
74
+ console.log(`๐Ÿ“‹ Task: ${this.task}`);
75
+ console.log(`โš™๏ธ Capabilities: ${agent.capabilities.join(', ')}`);
76
+ console.log('');
77
+
78
+ const result = {
79
+ phase: phaseName,
80
+ agent: agent.id,
81
+ agentName: agent.name,
82
+ task: this.task,
83
+ startTime: new Date().toISOString(),
84
+ status: 'started'
85
+ };
86
+
87
+ try {
88
+ // Execute agent (this will be implemented by CLI scripts)
89
+ // For now, create placeholder result
90
+ const executionResult = await this.executeAgent(agent);
91
+
92
+ result.status = 'completed';
93
+ result.endTime = new Date().toISOString();
94
+ result.output = executionResult;
95
+
96
+ // Save phase result
97
+ await this.savePhaseResult(phaseName, result);
98
+
99
+ console.log(`โœ… ${phaseName} phase completed successfully\n`);
100
+
101
+ } catch (error) {
102
+ result.status = 'failed';
103
+ result.error = error.message;
104
+ result.endTime = new Date().toISOString();
105
+
106
+ console.error(`โŒ ${phaseName} phase failed: ${error.message}\n`);
107
+
108
+ await this.savePhaseResult(phaseName, result);
109
+ throw error;
110
+ }
111
+
112
+ return result;
113
+ }
114
+
115
+ /**
116
+ * Execute agent for current phase
117
+ * @param {Object} agent - Agent definition
118
+ * @returns {Promise<Object>} Execution result
119
+ */
120
+ async executeAgent(agent) {
121
+ // This is a placeholder that will be overridden by CLI scripts
122
+ // The actual implementation will use Claude Code's Task tool or spawn CLI
123
+
124
+ return {
125
+ message: `Agent ${agent.name} executed for task: ${this.task}`,
126
+ outputs: agent.outputs,
127
+ timestamp: new Date().toISOString()
128
+ };
129
+ }
130
+
131
+ /**
132
+ * Save phase result to file
133
+ * @param {string} phase - Phase name
134
+ * @param {Object} result - Phase result object
135
+ */
136
+ async savePhaseResult(phase, result) {
137
+ const resultFile = join(this.sparcDir, `${phase}-result.json`);
138
+ writeFileSync(resultFile, JSON.stringify(result, null, 2), 'utf8');
139
+ }
140
+
141
+ /**
142
+ * Load phase result from file
143
+ * @param {string} phase - Phase name
144
+ * @returns {Object|null} Phase result or null if not found
145
+ */
146
+ loadPhaseResult(phase) {
147
+ const resultFile = join(this.sparcDir, `${phase}-result.json`);
148
+ if (!existsSync(resultFile)) {
149
+ return null;
150
+ }
151
+ return JSON.parse(readFileSync(resultFile, 'utf8'));
152
+ }
153
+
154
+ /**
155
+ * Run complete SPARC workflow (all phases sequentially)
156
+ * @returns {Promise<Object>} Complete workflow results
157
+ */
158
+ async runComplete() {
159
+ console.log('\n' + 'โ•'.repeat(60));
160
+ console.log(' ๐ŸŽฏ MyAIDev Method - SPARC Workflow');
161
+ console.log('โ•'.repeat(60));
162
+ console.log(`\n๐Ÿ“‹ Task: ${this.task}`);
163
+ console.log(`๐Ÿ“ Working Directory: ${this.workingDir}`);
164
+ console.log(`\n๐Ÿ”„ Phases to Execute:`);
165
+ this.phases.forEach((phase, index) => {
166
+ const agent = getAgentByPhase(phase);
167
+ console.log(` ${index + 1}. ${agent.emoji} ${phase} (${agent.name})`);
168
+ });
169
+ console.log('');
170
+
171
+ const workflowStartTime = new Date().toISOString();
172
+ const results = {};
173
+
174
+ for (const phase of this.phases) {
175
+ try {
176
+ results[phase] = await this.runPhase(phase);
177
+ } catch (error) {
178
+ console.error(`\nโš ๏ธ Workflow stopped at ${phase} phase due to error`);
179
+ results[phase] = {
180
+ status: 'failed',
181
+ error: error.message
182
+ };
183
+ break;
184
+ }
185
+ }
186
+
187
+ const workflowEndTime = new Date().toISOString();
188
+
189
+ // Save complete workflow summary
190
+ const summary = {
191
+ task: this.task,
192
+ workingDir: this.workingDir,
193
+ startTime: workflowStartTime,
194
+ endTime: workflowEndTime,
195
+ phases: results,
196
+ status: Object.values(results).every(r => r.status === 'completed') ? 'completed' : 'partial'
197
+ };
198
+
199
+ const summaryFile = join(this.sparcDir, 'workflow-summary.json');
200
+ writeFileSync(summaryFile, JSON.stringify(summary, null, 2), 'utf8');
201
+
202
+ // Print workflow summary
203
+ this.printWorkflowSummary(summary);
204
+
205
+ return summary;
206
+ }
207
+
208
+ /**
209
+ * Run specific phases only
210
+ * @param {Array<string>} phaseNames - Phases to execute
211
+ * @returns {Promise<Object>} Results from specified phases
212
+ */
213
+ async runPhases(phaseNames) {
214
+ const results = {};
215
+
216
+ for (const phase of phaseNames) {
217
+ if (!this.phases.includes(phase)) {
218
+ console.warn(`โš ๏ธ Skipping unknown phase: ${phase}`);
219
+ continue;
220
+ }
221
+ results[phase] = await this.runPhase(phase);
222
+ }
223
+
224
+ return results;
225
+ }
226
+
227
+ /**
228
+ * Print workflow summary
229
+ * @param {Object} summary - Workflow summary object
230
+ */
231
+ printWorkflowSummary(summary) {
232
+ console.log('\n' + 'โ•'.repeat(60));
233
+ console.log(' โœจ MyAIDev Method SPARC Workflow Complete');
234
+ console.log('โ•'.repeat(60));
235
+ console.log(`\n๐Ÿ“Š Summary:`);
236
+ console.log(` Status: ${summary.status === 'completed' ? 'โœ… Completed' : 'โš ๏ธ Partial'}`);
237
+ console.log(` Start: ${new Date(summary.startTime).toLocaleString()}`);
238
+ console.log(` End: ${new Date(summary.endTime).toLocaleString()}`);
239
+
240
+ console.log(`\n๐Ÿ“‹ Phase Results:`);
241
+ Object.entries(summary.phases).forEach(([phase, result]) => {
242
+ const agent = getAgentByPhase(phase);
243
+ const statusEmoji = result.status === 'completed' ? 'โœ…' : 'โŒ';
244
+ console.log(` ${statusEmoji} ${agent.emoji} ${phase}: ${result.status}`);
245
+ });
246
+
247
+ console.log(`\n๐Ÿ“ Results saved to: ${this.sparcDir}`);
248
+ console.log(` - workflow-summary.json`);
249
+ Object.keys(summary.phases).forEach(phase => {
250
+ console.log(` - ${phase}-result.json`);
251
+ });
252
+ console.log('');
253
+ }
254
+
255
+ /**
256
+ * Get workflow status
257
+ * @returns {Object} Current workflow status
258
+ */
259
+ getStatus() {
260
+ const summaryFile = join(this.sparcDir, 'workflow-summary.json');
261
+
262
+ if (!existsSync(summaryFile)) {
263
+ return { status: 'not_started' };
264
+ }
265
+
266
+ return JSON.parse(readFileSync(summaryFile, 'utf8'));
267
+ }
268
+
269
+ /**
270
+ * Clean workflow outputs
271
+ * @param {boolean} confirm - Confirmation flag
272
+ */
273
+ clean(confirm = false) {
274
+ if (!confirm) {
275
+ console.warn('โš ๏ธ Use clean(true) to confirm deletion of workflow outputs');
276
+ return;
277
+ }
278
+
279
+ console.log('๐Ÿงน Cleaning MyAIDev Method workflow outputs...');
280
+
281
+ // Remove phase results
282
+ const phases = getWorkflowPhases();
283
+ phases.forEach(phase => {
284
+ const resultFile = join(this.sparcDir, `${phase}-result.json`);
285
+ if (existsSync(resultFile)) {
286
+ unlinkSync(resultFile);
287
+ console.log(` Removed ${phase}-result.json`);
288
+ }
289
+ });
290
+
291
+ // Remove summary
292
+ const summaryFile = join(this.sparcDir, 'workflow-summary.json');
293
+ if (existsSync(summaryFile)) {
294
+ unlinkSync(summaryFile);
295
+ console.log(` Removed workflow-summary.json`);
296
+ }
297
+
298
+ console.log('โœ… Workflow outputs cleaned');
299
+ }
300
+ }
301
+
302
+ export default SparcWorkflow;