claude-flow 1.0.63 → 1.0.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "description": "Advanced AI agent orchestration system for Claude Code",
5
5
  "main": "src/cli/main.ts",
6
6
  "bin": {
@@ -1,4 +1,179 @@
1
1
  // init.js - Initialize Claude Code integration files
2
- // This file now re-exports from the modular init structure
2
+ import { printSuccess, printError, printWarning, printInfo } from '../utils.js';
3
+ import { claudeFlowCommandsTemplate, sparcCommandsTemplate } from './init/claude-commands/index.js';
4
+ import path from 'node:path';
3
5
 
4
- export { initCommand } from './init/index.js';
6
+ // CLAUDE.md template
7
+ const claudeMdTemplate = `# Claude Code Configuration - SPARC Development Environment
8
+
9
+ ## Project Overview
10
+ This project uses the SPARC (Specification, Pseudocode, Architecture, Refinement, Completion) methodology for systematic Test-Driven Development with AI assistance through Claude-Flow orchestration.
11
+
12
+ ## SPARC Development Commands
13
+
14
+ ### Core SPARC Commands
15
+ - \`npx claude-flow sparc modes\`: List all available SPARC development modes
16
+ - \`npx claude-flow sparc run <mode> "<task>"\`: Execute specific SPARC mode for a task
17
+ - \`npx claude-flow sparc tdd "<feature>"\`: Run complete TDD workflow using SPARC methodology
18
+ - \`npx claude-flow sparc info <mode>\`: Get detailed information about a specific mode
19
+
20
+ ### Standard Build Commands
21
+ - \`npm run build\`: Build the project
22
+ - \`npm run test\`: Run the test suite
23
+ - \`npm run lint\`: Run linter and format checks
24
+ - \`npm run typecheck\`: Run TypeScript type checking
25
+
26
+ ## SPARC Methodology Workflow
27
+
28
+ ### 1. Specification Phase
29
+ Define clear functional requirements, edge cases, and acceptance criteria.
30
+
31
+ ### 2. Pseudocode Phase
32
+ Break down complex logic into steps and plan data structures.
33
+
34
+ ### 3. Architecture Phase
35
+ Design system architecture and component relationships.
36
+
37
+ ### 4. Refinement Phase (TDD Implementation)
38
+ Execute Test-Driven Development cycle:
39
+ - **Red**: Write failing tests first
40
+ - **Green**: Implement minimal code to pass tests
41
+ - **Refactor**: Optimize and clean up code
42
+ - **Repeat**: Continue until feature is complete
43
+
44
+ ### 5. Completion Phase
45
+ Integration testing, documentation, and validation.
46
+
47
+ ## Important Notes
48
+ - Always run tests before committing (\`npm run test\`)
49
+ - Use SPARC memory system to maintain context across sessions
50
+ - Follow the Red-Green-Refactor cycle during TDD phases
51
+ - Document architectural decisions in memory for future reference
52
+ - Regular security reviews for any authentication or data handling code
53
+
54
+ For more information about SPARC methodology, see: https://github.com/ruvnet/claude-code-flow/docs/sparc.md
55
+ `;
56
+
57
+ export async function initCommand(subArgs, flags) {
58
+ const force = flags.force || false;
59
+ const minimal = flags.minimal || false;
60
+ const sparc = flags.sparc || false;
61
+
62
+ try {
63
+ // Initialize Claude Code directory
64
+ const claudeDir = '.claude';
65
+ const commandsDir = path.join(claudeDir, 'commands');
66
+
67
+ // Create directories
68
+ await Deno.mkdir(claudeDir, { recursive: true });
69
+ await Deno.mkdir(commandsDir, { recursive: true });
70
+
71
+ // Check if CLAUDE.md exists
72
+ const claudeMdPath = 'CLAUDE.md';
73
+ const claudeMdExists = await checkFileExists(claudeMdPath);
74
+
75
+ if (claudeMdExists && !force) {
76
+ printWarning('CLAUDE.md already exists. Use --force to overwrite.');
77
+ } else {
78
+ // Write CLAUDE.md
79
+ await Deno.writeTextFile(claudeMdPath, claudeMdTemplate);
80
+ printSuccess('Created CLAUDE.md with project instructions');
81
+ }
82
+
83
+ // Initialize SPARC modes if requested
84
+ if (sparc && !minimal) {
85
+ await initSparcModes(force);
86
+ }
87
+
88
+ // Create Claude Code commands
89
+ if (!minimal) {
90
+ await createClaudeCommands(commandsDir, force);
91
+ }
92
+
93
+ printSuccess('Claude Code integration initialized successfully!');
94
+
95
+ if (sparc) {
96
+ printInfo('\nSPARC development environment ready. Try:');
97
+ printInfo(' npx claude-flow sparc modes # List available modes');
98
+ printInfo(' npx claude-flow sparc tdd "your feature" # Start TDD workflow');
99
+ }
100
+
101
+ } catch (error) {
102
+ printError(`Failed to initialize: ${error.message}`);
103
+ throw error;
104
+ }
105
+ }
106
+
107
+ async function checkFileExists(path) {
108
+ try {
109
+ await Deno.stat(path);
110
+ return true;
111
+ } catch {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ async function initSparcModes(force) {
117
+ const roomodesPath = '.roomodes';
118
+ const roomodesExists = await checkFileExists(roomodesPath);
119
+
120
+ if (roomodesExists && !force) {
121
+ printWarning('.roomodes file already exists. Use --force to overwrite.');
122
+ return;
123
+ }
124
+
125
+ // Create default SPARC modes configuration
126
+ const sparcModes = {
127
+ modes: {
128
+ architect: {
129
+ name: "System Architect",
130
+ description: "Design system architecture and component structure",
131
+ tools: ["Read", "Write", "Edit", "Bash", "WebSearch"],
132
+ systemPrompt: "You are a system architect focused on designing scalable, maintainable architectures..."
133
+ },
134
+ code: {
135
+ name: "Code Developer",
136
+ description: "Write clean, modular, and efficient code",
137
+ tools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"],
138
+ systemPrompt: "You are a senior developer focused on writing clean, efficient code..."
139
+ },
140
+ tdd: {
141
+ name: "TDD Developer",
142
+ description: "Test-driven development with Red-Green-Refactor cycle",
143
+ tools: ["Read", "Write", "Edit", "Bash", "Grep"],
144
+ systemPrompt: "You are a TDD expert following strict test-first development..."
145
+ },
146
+ debug: {
147
+ name: "Debug Specialist",
148
+ description: "Troubleshoot and fix bugs systematically",
149
+ tools: ["Read", "Edit", "Bash", "Grep", "Glob"],
150
+ systemPrompt: "You are a debugging specialist who systematically identifies and fixes bugs..."
151
+ },
152
+ "security-review": {
153
+ name: "Security Reviewer",
154
+ description: "Analyze code for security vulnerabilities",
155
+ tools: ["Read", "Grep", "WebSearch"],
156
+ systemPrompt: "You are a security expert reviewing code for vulnerabilities..."
157
+ }
158
+ }
159
+ };
160
+
161
+ await Deno.writeTextFile(roomodesPath, JSON.stringify(sparcModes, null, 2));
162
+ printSuccess('Created .roomodes with SPARC development modes');
163
+ }
164
+
165
+ async function createClaudeCommands(commandsDir, force) {
166
+ // Create claude-flow-help command
167
+ const helpCommandPath = path.join(commandsDir, 'claude-flow-help.js');
168
+ if (!await checkFileExists(helpCommandPath) || force) {
169
+ await Deno.writeTextFile(helpCommandPath, claudeFlowCommandsTemplate);
170
+ printSuccess('Created Claude Code command: claude-flow-help');
171
+ }
172
+
173
+ // Create SPARC commands
174
+ const sparcCommandPath = path.join(commandsDir, 'sparc.js');
175
+ if (!await checkFileExists(sparcCommandPath) || force) {
176
+ await Deno.writeTextFile(sparcCommandPath, sparcCommandsTemplate);
177
+ printSuccess('Created Claude Code command: sparc');
178
+ }
179
+ }