claude-flow 1.0.34 ā 1.0.38
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/README.md +10 -3
- package/package.json +1 -1
- package/src/cli/cli-core.ts +1 -1
- package/src/cli/command-registry.js +13 -0
- package/src/cli/index-remote.ts +1 -1
- package/src/cli/index.ts +1 -1
- package/src/cli/main.ts +1 -1
- package/src/cli/simple-cli.js +1 -1
- package/src/cli/simple-cli.ts +1 -1
- package/src/cli/simple-commands/config.js +1 -1
- package/src/cli/simple-commands/init.js +115 -18
- package/src/cli/simple-commands/sparc-modes/index.js +2 -1
- package/src/cli/simple-commands/sparc.js +13 -4
- package/src/cli/simple-commands/start.js +182 -0
- package/src/cli/simple-commands/status.js +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
## š **What's New in v1.0.
|
|
15
|
+
## š **What's New in v1.0.38**
|
|
16
16
|
|
|
17
17
|
- **š Simplified SPARC Syntax**: `npx claude-flow sparc "build app"` (no more double sparc!)
|
|
18
18
|
- **ā” Auto-Skip Permissions**: `--dangerously-skip-permissions` by default (use `--enable-permissions` to restore prompts)
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- **š Directory Safety**: Enhanced guidance to prevent files in node_modules
|
|
21
21
|
- **š¤ Non-Interactive Mode**: Full automation support with `--non-interactive` flag
|
|
22
22
|
- **šÆ 17+ SPARC Modes**: Including new `sparc-orchestrator` for complex workflows
|
|
23
|
+
- **š Local Executable**: `init` now creates `./claude-flow` wrapper to ensure correct working directory
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
## šÆ **Transform Your Development Workflow**
|
|
@@ -176,12 +177,18 @@ This creates:
|
|
|
176
177
|
- `.roomodes` - SPARC development mode configurations
|
|
177
178
|
- `.roo/` - SPARC templates and workflows
|
|
178
179
|
- Memory folder structure with placeholders
|
|
180
|
+
- `./claude-flow` - Local executable wrapper (use instead of npx)
|
|
179
181
|
|
|
180
182
|
### 2. **Start the Orchestrator**
|
|
181
183
|
```bash
|
|
182
|
-
|
|
184
|
+
# After init, use the local wrapper:
|
|
185
|
+
./claude-flow start
|
|
186
|
+
|
|
183
187
|
# Or run as daemon
|
|
184
|
-
|
|
188
|
+
./claude-flow start --daemon
|
|
189
|
+
|
|
190
|
+
# If not initialized yet, use npx:
|
|
191
|
+
npx claude-flow start
|
|
185
192
|
```
|
|
186
193
|
|
|
187
194
|
### 3. **Spawn Agents**
|
package/package.json
CHANGED
package/src/cli/cli-core.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { red, green, yellow, blue, bold, cyan } from "https://deno.land/std@0.22
|
|
|
8
8
|
import { ensureDir } from "https://deno.land/std@0.224.0/fs/mod.ts";
|
|
9
9
|
import { join } from "https://deno.land/std@0.224.0/path/mod.ts";
|
|
10
10
|
|
|
11
|
-
export const VERSION = "1.0.
|
|
11
|
+
export const VERSION = "1.0.38";
|
|
12
12
|
|
|
13
13
|
interface CommandContext {
|
|
14
14
|
args: string[];
|
|
@@ -8,6 +8,7 @@ import { configCommand } from './simple-commands/config.js';
|
|
|
8
8
|
import { statusCommand } from './simple-commands/status.js';
|
|
9
9
|
import { mcpCommand } from './simple-commands/mcp.js';
|
|
10
10
|
import { monitorCommand } from './simple-commands/monitor.js';
|
|
11
|
+
import { startCommand } from './simple-commands/start.js';
|
|
11
12
|
|
|
12
13
|
// Command registry for extensible CLI
|
|
13
14
|
export const commandRegistry = new Map();
|
|
@@ -34,6 +35,18 @@ The --sparc flag creates a complete development environment:
|
|
|
34
35
|
First-time users should run: npx claude-flow@latest init --sparc`
|
|
35
36
|
});
|
|
36
37
|
|
|
38
|
+
commandRegistry.set('start', {
|
|
39
|
+
handler: startCommand,
|
|
40
|
+
description: 'Start the Claude-Flow orchestration system',
|
|
41
|
+
usage: 'start [--daemon] [--port <port>] [--verbose]',
|
|
42
|
+
examples: [
|
|
43
|
+
'start # Start in interactive mode',
|
|
44
|
+
'start --daemon # Start as background daemon',
|
|
45
|
+
'start --port 8080 # Use custom MCP port',
|
|
46
|
+
'start --verbose # Show detailed system activity'
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
|
|
37
50
|
commandRegistry.set('memory', {
|
|
38
51
|
handler: memoryCommand,
|
|
39
52
|
description: 'Memory management operations',
|
package/src/cli/index-remote.ts
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { startREPL } from './repl.ts';
|
|
|
25
25
|
import { CompletionGenerator } from './completion.ts';
|
|
26
26
|
|
|
27
27
|
// Version information
|
|
28
|
-
const VERSION = '1.0.
|
|
28
|
+
const VERSION = '1.0.38';
|
|
29
29
|
const BUILD_DATE = new Date().toISOString().split('T')[0];
|
|
30
30
|
|
|
31
31
|
// Main CLI command
|
package/src/cli/main.ts
CHANGED
package/src/cli/simple-cli.js
CHANGED
package/src/cli/simple-cli.ts
CHANGED
|
@@ -14,19 +14,27 @@ export async function initCommand(subArgs, flags) {
|
|
|
14
14
|
const initSparc = subArgs.includes('--sparc') || subArgs.includes('-s') || flags.sparc;
|
|
15
15
|
|
|
16
16
|
// Get the actual working directory (where the command was run from)
|
|
17
|
+
// Use PWD environment variable which preserves the original directory
|
|
17
18
|
const workingDir = Deno.env.get('PWD') || Deno.cwd();
|
|
18
19
|
console.log(`š Initializing in: ${workingDir}`);
|
|
19
20
|
|
|
21
|
+
// Change to the working directory to ensure all file operations happen there
|
|
22
|
+
try {
|
|
23
|
+
Deno.chdir(workingDir);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
printWarning(`Could not change to directory ${workingDir}: ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
try {
|
|
21
29
|
printSuccess('Initializing Claude Code integration files...');
|
|
22
30
|
|
|
23
|
-
// Check if files already exist
|
|
31
|
+
// Check if files already exist in the working directory
|
|
24
32
|
const files = ['CLAUDE.md', 'memory-bank.md', 'coordination.md'];
|
|
25
33
|
const existingFiles = [];
|
|
26
34
|
|
|
27
35
|
for (const file of files) {
|
|
28
36
|
try {
|
|
29
|
-
await Deno.stat(file);
|
|
37
|
+
await Deno.stat(`${workingDir}/${file}`);
|
|
30
38
|
existingFiles.push(file);
|
|
31
39
|
} catch {
|
|
32
40
|
// File doesn't exist, which is what we want
|
|
@@ -95,6 +103,9 @@ export async function initCommand(subArgs, flags) {
|
|
|
95
103
|
await Deno.writeTextFile('memory/claude-flow-data.json', JSON.stringify(initialData, null, 2));
|
|
96
104
|
console.log(' ā Created memory/claude-flow-data.json (persistence database)');
|
|
97
105
|
|
|
106
|
+
// Create local claude-flow executable wrapper
|
|
107
|
+
await createLocalExecutable(workingDir);
|
|
108
|
+
|
|
98
109
|
// SPARC initialization
|
|
99
110
|
if (initSparc) {
|
|
100
111
|
console.log('\nš Initializing SPARC development environment...');
|
|
@@ -103,9 +114,13 @@ export async function initCommand(subArgs, flags) {
|
|
|
103
114
|
try {
|
|
104
115
|
const createSparcCommand = new Deno.Command('npx', {
|
|
105
116
|
args: ['-y', 'create-sparc', 'init', '--force'],
|
|
106
|
-
cwd:
|
|
117
|
+
cwd: workingDir, // Use the original working directory
|
|
107
118
|
stdout: 'inherit',
|
|
108
119
|
stderr: 'inherit',
|
|
120
|
+
env: {
|
|
121
|
+
...Deno.env.toObject(),
|
|
122
|
+
PWD: workingDir, // Ensure PWD is set correctly
|
|
123
|
+
},
|
|
109
124
|
});
|
|
110
125
|
|
|
111
126
|
console.log(' š Running: npx -y create-sparc init --force');
|
|
@@ -130,13 +145,15 @@ export async function initCommand(subArgs, flags) {
|
|
|
130
145
|
printSuccess('Claude Code integration files initialized successfully!');
|
|
131
146
|
console.log('\nNext steps:');
|
|
132
147
|
console.log('1. Review and customize the generated files for your project');
|
|
133
|
-
console.log('2. Run \'
|
|
134
|
-
console.log('3. Use \'claude
|
|
148
|
+
console.log('2. Run \'./claude-flow start\' to begin the orchestration system');
|
|
149
|
+
console.log('3. Use \'./claude-flow\' instead of \'npx claude-flow\' for all commands');
|
|
150
|
+
console.log('4. Use \'claude --dangerously-skip-permissions\' for unattended operation');
|
|
135
151
|
if (initSparc) {
|
|
136
|
-
console.log('
|
|
137
|
-
console.log('
|
|
152
|
+
console.log('5. Explore SPARC modes with \'./claude-flow sparc modes\'');
|
|
153
|
+
console.log('6. Try TDD workflow with \'./claude-flow sparc tdd "your task"\'');
|
|
138
154
|
}
|
|
139
|
-
console.log('\nNote:
|
|
155
|
+
console.log('\nNote: Local executable created at ./claude-flow');
|
|
156
|
+
console.log('Note: Persistence database initialized at memory/claude-flow-data.json');
|
|
140
157
|
if (initSparc) {
|
|
141
158
|
console.log('Note: SPARC development environment available in .roo/ directory');
|
|
142
159
|
}
|
|
@@ -146,16 +163,96 @@ export async function initCommand(subArgs, flags) {
|
|
|
146
163
|
}
|
|
147
164
|
}
|
|
148
165
|
|
|
166
|
+
// Create local executable wrapper
|
|
167
|
+
async function createLocalExecutable(workingDir) {
|
|
168
|
+
try {
|
|
169
|
+
if (Deno.build.os === 'windows') {
|
|
170
|
+
// Create Windows batch file
|
|
171
|
+
const wrapperScript = `@echo off
|
|
172
|
+
REM Claude-Flow local wrapper
|
|
173
|
+
REM This script ensures claude-flow runs from your project directory
|
|
174
|
+
|
|
175
|
+
set PROJECT_DIR=%CD%
|
|
176
|
+
set PWD=%PROJECT_DIR%
|
|
177
|
+
set CLAUDE_WORKING_DIR=%PROJECT_DIR%
|
|
178
|
+
|
|
179
|
+
if exist "%PROJECT_DIR%\\node_modules\\.bin\\claude-flow.cmd" (
|
|
180
|
+
REM Use local installation if available
|
|
181
|
+
cd /d "%PROJECT_DIR%"
|
|
182
|
+
"%PROJECT_DIR%\\node_modules\\.bin\\claude-flow.cmd" %*
|
|
183
|
+
) else if where claude-flow >nul 2>nul (
|
|
184
|
+
REM Use global installation
|
|
185
|
+
cd /d "%PROJECT_DIR%"
|
|
186
|
+
claude-flow %*
|
|
187
|
+
) else (
|
|
188
|
+
REM Try using npx as fallback
|
|
189
|
+
cd /d "%PROJECT_DIR%"
|
|
190
|
+
npx claude-flow %*
|
|
191
|
+
)
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
// Write the Windows batch file
|
|
195
|
+
await Deno.writeTextFile(`${workingDir}/claude-flow.cmd`, wrapperScript);
|
|
196
|
+
console.log(' ā Created local claude-flow.cmd executable wrapper');
|
|
197
|
+
console.log(' You can now use: claude-flow instead of npx claude-flow');
|
|
198
|
+
|
|
199
|
+
} else {
|
|
200
|
+
// Create Unix/Linux/Mac shell script
|
|
201
|
+
const wrapperScript = `#!/usr/bin/env bash
|
|
202
|
+
# Claude-Flow local wrapper
|
|
203
|
+
# This script ensures claude-flow runs from your project directory
|
|
204
|
+
|
|
205
|
+
# Save the current directory
|
|
206
|
+
PROJECT_DIR="\${PWD}"
|
|
207
|
+
|
|
208
|
+
# Set environment to ensure correct working directory
|
|
209
|
+
export PWD="\${PROJECT_DIR}"
|
|
210
|
+
export CLAUDE_WORKING_DIR="\${PROJECT_DIR}"
|
|
211
|
+
|
|
212
|
+
# Execute claude-flow with all arguments
|
|
213
|
+
if [ -f "\${PROJECT_DIR}/node_modules/.bin/claude-flow" ]; then
|
|
214
|
+
# Use local installation if available
|
|
215
|
+
cd "\${PROJECT_DIR}"
|
|
216
|
+
exec "\${PROJECT_DIR}/node_modules/.bin/claude-flow" "$@"
|
|
217
|
+
elif command -v claude-flow &> /dev/null; then
|
|
218
|
+
# Use global installation
|
|
219
|
+
cd "\${PROJECT_DIR}"
|
|
220
|
+
exec claude-flow "$@"
|
|
221
|
+
else
|
|
222
|
+
# Try using npx as fallback
|
|
223
|
+
cd "\${PROJECT_DIR}"
|
|
224
|
+
exec npx claude-flow "$@"
|
|
225
|
+
fi
|
|
226
|
+
`;
|
|
227
|
+
|
|
228
|
+
// Write the wrapper script
|
|
229
|
+
await Deno.writeTextFile(`${workingDir}/claude-flow`, wrapperScript);
|
|
230
|
+
|
|
231
|
+
// Make it executable
|
|
232
|
+
await Deno.chmod(`${workingDir}/claude-flow`, 0o755);
|
|
233
|
+
|
|
234
|
+
console.log(' ā Created local claude-flow executable wrapper');
|
|
235
|
+
console.log(' You can now use: ./claude-flow instead of npx claude-flow');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
} catch (err) {
|
|
239
|
+
console.log(` ā ļø Could not create local executable: ${err.message}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
149
243
|
// Helper function to create SPARC structure manually
|
|
150
244
|
async function createSparcStructureManually() {
|
|
151
245
|
try {
|
|
152
|
-
//
|
|
246
|
+
// Ensure we're in the working directory
|
|
247
|
+
const workingDir = Deno.env.get('PWD') || Deno.cwd();
|
|
248
|
+
|
|
249
|
+
// Create .roo directory structure in working directory
|
|
153
250
|
const rooDirectories = [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
251
|
+
`${workingDir}/.roo`,
|
|
252
|
+
`${workingDir}/.roo/templates`,
|
|
253
|
+
`${workingDir}/.roo/workflows`,
|
|
254
|
+
`${workingDir}/.roo/modes`,
|
|
255
|
+
`${workingDir}/.roo/configs`
|
|
159
256
|
];
|
|
160
257
|
|
|
161
258
|
for (const dir of rooDirectories) {
|
|
@@ -173,23 +270,23 @@ async function createSparcStructureManually() {
|
|
|
173
270
|
let roomodesContent;
|
|
174
271
|
try {
|
|
175
272
|
// Check if .roomodes already exists and read it
|
|
176
|
-
roomodesContent = await Deno.readTextFile(
|
|
273
|
+
roomodesContent = await Deno.readTextFile(`${workingDir}/.roomodes`);
|
|
177
274
|
console.log(' ā Using existing .roomodes configuration');
|
|
178
275
|
} catch {
|
|
179
276
|
// Create basic .roomodes configuration
|
|
180
277
|
roomodesContent = createBasicRoomodesConfig();
|
|
181
|
-
await Deno.writeTextFile(
|
|
278
|
+
await Deno.writeTextFile(`${workingDir}/.roomodes`, roomodesContent);
|
|
182
279
|
console.log(' ā Created .roomodes configuration');
|
|
183
280
|
}
|
|
184
281
|
|
|
185
282
|
// Create basic workflow templates
|
|
186
283
|
const basicWorkflow = createBasicSparcWorkflow();
|
|
187
|
-
await Deno.writeTextFile(
|
|
284
|
+
await Deno.writeTextFile(`${workingDir}/.roo/workflows/basic-tdd.json`, basicWorkflow);
|
|
188
285
|
console.log(' ā Created .roo/workflows/basic-tdd.json');
|
|
189
286
|
|
|
190
287
|
// Create README for .roo directory
|
|
191
288
|
const rooReadme = createRooReadme();
|
|
192
|
-
await Deno.writeTextFile(
|
|
289
|
+
await Deno.writeTextFile(`${workingDir}/.roo/README.md`, rooReadme);
|
|
193
290
|
console.log(' ā Created .roo/README.md');
|
|
194
291
|
|
|
195
292
|
console.log(' ā
Basic SPARC structure created successfully');
|
|
@@ -64,7 +64,8 @@ export function getModeOrchestration(modeSlug, taskDescription, memoryNamespace)
|
|
|
64
64
|
*/
|
|
65
65
|
export function createSparcPrompt(mode, taskDescription, memoryNamespace) {
|
|
66
66
|
const orchestration = getModeOrchestration(mode.slug, taskDescription, memoryNamespace);
|
|
67
|
-
|
|
67
|
+
// Get the actual working directory where the command was run from
|
|
68
|
+
const cwd = Deno.env.get('PWD') || Deno.cwd();
|
|
68
69
|
|
|
69
70
|
return `# ${mode.name} - Task Execution
|
|
70
71
|
|
|
@@ -69,13 +69,16 @@ export async function sparcCommand(subArgs, flags) {
|
|
|
69
69
|
|
|
70
70
|
async function listSparcModes(subArgs) {
|
|
71
71
|
try {
|
|
72
|
-
|
|
72
|
+
// Get the actual working directory where the command was run from
|
|
73
|
+
const workingDir = Deno.env.get('PWD') || Deno.cwd();
|
|
74
|
+
const configPath = `${workingDir}/.roomodes`;
|
|
73
75
|
let configContent;
|
|
74
76
|
try {
|
|
75
77
|
configContent = await Deno.readTextFile(configPath);
|
|
76
78
|
} catch (error) {
|
|
77
79
|
printError('SPARC configuration file (.roomodes) not found');
|
|
78
|
-
console.log(
|
|
80
|
+
console.log(`Please ensure .roomodes file exists in: ${workingDir}`);
|
|
81
|
+
console.log('Run "claude-flow init --sparc" to create it');
|
|
79
82
|
return;
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -111,7 +114,10 @@ async function showModeInfo(subArgs) {
|
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
try {
|
|
114
|
-
|
|
117
|
+
// Get the actual working directory where the command was run from
|
|
118
|
+
const workingDir = Deno.env.get('PWD') || Deno.cwd();
|
|
119
|
+
const configPath = `${workingDir}/.roomodes`;
|
|
120
|
+
const configContent = await Deno.readTextFile(configPath);
|
|
115
121
|
const config = JSON.parse(configContent);
|
|
116
122
|
const mode = config.customModes.find(m => m.slug === modeSlug);
|
|
117
123
|
|
|
@@ -153,7 +159,10 @@ async function runSparcMode(subArgs, flags) {
|
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
try {
|
|
156
|
-
|
|
162
|
+
// Get the actual working directory where the command was run from
|
|
163
|
+
const workingDir = Deno.env.get('PWD') || Deno.cwd();
|
|
164
|
+
const configPath = `${workingDir}/.roomodes`;
|
|
165
|
+
const configContent = await Deno.readTextFile(configPath);
|
|
157
166
|
const config = JSON.parse(configContent);
|
|
158
167
|
const mode = config.customModes.find(m => m.slug === runModeSlug);
|
|
159
168
|
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// start.js - Start the Claude-Flow orchestration system
|
|
2
|
+
import { printSuccess, printError, printWarning, printInfo } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
export async function startCommand(subArgs, flags) {
|
|
5
|
+
// Show help if requested
|
|
6
|
+
if (flags.help || flags.h || subArgs.includes('--help') || subArgs.includes('-h')) {
|
|
7
|
+
showStartHelp();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Parse start options
|
|
12
|
+
const daemon = subArgs.includes('--daemon') || subArgs.includes('-d') || flags.daemon;
|
|
13
|
+
const port = flags.port || getArgValue(subArgs, '--port') || getArgValue(subArgs, '-p') || 3000;
|
|
14
|
+
const verbose = subArgs.includes('--verbose') || subArgs.includes('-v') || flags.verbose;
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
printSuccess('Starting Claude-Flow Orchestration System...');
|
|
18
|
+
console.log();
|
|
19
|
+
|
|
20
|
+
// Check if required directories exist
|
|
21
|
+
const requiredDirs = ['memory', 'coordination'];
|
|
22
|
+
let missingDirs = [];
|
|
23
|
+
|
|
24
|
+
for (const dir of requiredDirs) {
|
|
25
|
+
try {
|
|
26
|
+
await Deno.stat(dir);
|
|
27
|
+
} catch {
|
|
28
|
+
missingDirs.push(dir);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (missingDirs.length > 0) {
|
|
33
|
+
printWarning('Missing required directories: ' + missingDirs.join(', '));
|
|
34
|
+
console.log('Run "claude-flow init" first to create the necessary structure');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Display startup information
|
|
39
|
+
console.log('š System Configuration:');
|
|
40
|
+
console.log(` Mode: ${daemon ? 'Daemon (background)' : 'Interactive'}`);
|
|
41
|
+
console.log(` MCP Port: ${port}`);
|
|
42
|
+
console.log(` Working Directory: ${Deno.cwd()}`);
|
|
43
|
+
console.log(` Memory Backend: JSON (default)`);
|
|
44
|
+
console.log(` Terminal Pool: 5 instances (default)`);
|
|
45
|
+
console.log();
|
|
46
|
+
|
|
47
|
+
// Initialize components
|
|
48
|
+
console.log('š Initializing Components:');
|
|
49
|
+
|
|
50
|
+
// Memory system
|
|
51
|
+
console.log(' ā Memory Bank: Ready');
|
|
52
|
+
console.log(' - Backend: JSON file (memory/claude-flow-data.json)');
|
|
53
|
+
console.log(' - Namespaces: Enabled');
|
|
54
|
+
|
|
55
|
+
// Terminal pool
|
|
56
|
+
console.log(' ā Terminal Pool: Ready');
|
|
57
|
+
console.log(' - Pool Size: 5');
|
|
58
|
+
console.log(' - Shell: ' + (Deno.build.os === 'windows' ? 'cmd.exe' : '/bin/bash'));
|
|
59
|
+
|
|
60
|
+
// Task queue
|
|
61
|
+
console.log(' ā Task Queue: Ready');
|
|
62
|
+
console.log(' - Max Concurrent: 10');
|
|
63
|
+
console.log(' - Priority Queue: Enabled');
|
|
64
|
+
|
|
65
|
+
// MCP Server
|
|
66
|
+
console.log(' ā MCP Server: Ready');
|
|
67
|
+
console.log(` - Port: ${port}`);
|
|
68
|
+
console.log(' - Transport: stdio/HTTP');
|
|
69
|
+
|
|
70
|
+
console.log();
|
|
71
|
+
|
|
72
|
+
if (daemon) {
|
|
73
|
+
// Daemon mode - would normally fork process
|
|
74
|
+
printInfo('Starting in daemon mode...');
|
|
75
|
+
console.log('Note: Full daemon mode requires the TypeScript version');
|
|
76
|
+
console.log('The orchestrator would run in the background on port ' + port);
|
|
77
|
+
|
|
78
|
+
// Create a simple PID file to simulate daemon
|
|
79
|
+
const pid = Deno.pid;
|
|
80
|
+
await Deno.writeTextFile('.claude-flow.pid', pid.toString());
|
|
81
|
+
console.log(`Process ID: ${pid} (saved to .claude-flow.pid)`);
|
|
82
|
+
|
|
83
|
+
} else {
|
|
84
|
+
// Interactive mode
|
|
85
|
+
printSuccess('Orchestration system started!');
|
|
86
|
+
console.log();
|
|
87
|
+
console.log('šÆ Available Actions:');
|
|
88
|
+
console.log(' ⢠Open another terminal and run:');
|
|
89
|
+
console.log(' - claude-flow agent spawn researcher');
|
|
90
|
+
console.log(' - claude-flow task create "your task"');
|
|
91
|
+
console.log(' - claude-flow sparc "build feature"');
|
|
92
|
+
console.log(' - claude-flow monitor');
|
|
93
|
+
console.log();
|
|
94
|
+
console.log(' ⢠View system status:');
|
|
95
|
+
console.log(' - claude-flow status');
|
|
96
|
+
console.log();
|
|
97
|
+
console.log(' ⢠Press Ctrl+C to stop the orchestrator');
|
|
98
|
+
console.log();
|
|
99
|
+
|
|
100
|
+
if (verbose) {
|
|
101
|
+
console.log('š Verbose Mode - Showing system activity:');
|
|
102
|
+
console.log('[' + new Date().toISOString() + '] System initialized');
|
|
103
|
+
console.log('[' + new Date().toISOString() + '] Waiting for commands...');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Keep the process running
|
|
107
|
+
console.log('š¢ System is running...');
|
|
108
|
+
|
|
109
|
+
// Set up signal handlers
|
|
110
|
+
const abortController = new AbortController();
|
|
111
|
+
|
|
112
|
+
Deno.addSignalListener("SIGINT", () => {
|
|
113
|
+
console.log('\nā¹ļø Shutting down orchestrator...');
|
|
114
|
+
cleanup();
|
|
115
|
+
Deno.exit(0);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Simple heartbeat to show system is alive
|
|
119
|
+
if (!daemon) {
|
|
120
|
+
const heartbeat = setInterval(() => {
|
|
121
|
+
if (verbose) {
|
|
122
|
+
console.log('[' + new Date().toISOString() + '] Heartbeat - System healthy');
|
|
123
|
+
}
|
|
124
|
+
}, 30000); // Every 30 seconds
|
|
125
|
+
|
|
126
|
+
// Wait indefinitely (until Ctrl+C)
|
|
127
|
+
await new Promise(() => {});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
} catch (err) {
|
|
132
|
+
printError(`Failed to start orchestration system: ${err.message}`);
|
|
133
|
+
console.error('Stack trace:', err.stack);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function getArgValue(args, flag) {
|
|
138
|
+
const index = args.indexOf(flag);
|
|
139
|
+
if (index !== -1 && index < args.length - 1) {
|
|
140
|
+
return args[index + 1];
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async function cleanup() {
|
|
146
|
+
// Clean up resources
|
|
147
|
+
try {
|
|
148
|
+
await Deno.remove('.claude-flow.pid');
|
|
149
|
+
} catch {
|
|
150
|
+
// File might not exist
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
console.log('ā Terminal pool closed');
|
|
154
|
+
console.log('ā Task queue cleared');
|
|
155
|
+
console.log('ā Memory bank saved');
|
|
156
|
+
console.log('ā Cleanup complete');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function showStartHelp() {
|
|
160
|
+
console.log('Start the Claude-Flow orchestration system');
|
|
161
|
+
console.log();
|
|
162
|
+
console.log('Usage: claude-flow start [options]');
|
|
163
|
+
console.log();
|
|
164
|
+
console.log('Options:');
|
|
165
|
+
console.log(' -d, --daemon Run as daemon in background');
|
|
166
|
+
console.log(' -p, --port <port> MCP server port (default: 3000)');
|
|
167
|
+
console.log(' -v, --verbose Show detailed system activity');
|
|
168
|
+
console.log(' -h, --help Show this help message');
|
|
169
|
+
console.log();
|
|
170
|
+
console.log('Examples:');
|
|
171
|
+
console.log(' claude-flow start # Start in interactive mode');
|
|
172
|
+
console.log(' claude-flow start --daemon # Start as background daemon');
|
|
173
|
+
console.log(' claude-flow start --port 8080 # Use custom MCP port');
|
|
174
|
+
console.log(' claude-flow start --verbose # Show detailed logs');
|
|
175
|
+
console.log();
|
|
176
|
+
console.log('Notes:');
|
|
177
|
+
console.log(' - Requires "claude-flow init" to be run first');
|
|
178
|
+
console.log(' - Interactive mode shows real-time system status');
|
|
179
|
+
console.log(' - Daemon mode runs in background (check logs)');
|
|
180
|
+
console.log(' - Use "claude-flow status" to check if running');
|
|
181
|
+
console.log(' - Use Ctrl+C or "claude-flow stop" to shutdown');
|
|
182
|
+
}
|