claude-flow 2.0.0-alpha.55 → 2.0.0-alpha.56

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/bin/claude-flow CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
 
4
- VERSION="2.0.0-alpha.55"
4
+ VERSION="2.0.0-alpha.56"
5
5
 
6
6
  # Determine the correct path based on how the script is invoked
7
7
  if [ -L "$0" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.0.0-alpha.55",
3
+ "version": "2.0.0-alpha.56",
4
4
  "description": "Enterprise-grade AI agent orchestration with ruv-swarm integration (Alpha Release)",
5
5
  "main": "cli.mjs",
6
6
  "bin": {
@@ -111,6 +111,7 @@
111
111
  "cli-table3": "^0.6.3",
112
112
  "commander": "^11.1.0",
113
113
  "cors": "^2.8.5",
114
+ "diskusage": "^1.1.3",
114
115
  "express": "^4.18.2",
115
116
  "figlet": "^1.8.1",
116
117
  "fs-extra": "^11.2.0",
@@ -26,25 +26,43 @@ export interface PreEditOptions extends BaseHookOptions {
26
26
  file: string;
27
27
  operation?: 'read' | 'write' | 'edit' | 'delete';
28
28
  validate?: boolean;
29
+ autoAssignAgents?: boolean;
30
+ 'auto-assign-agents'?: boolean;
31
+ loadContext?: boolean;
32
+ 'load-context'?: boolean;
29
33
  }
30
34
 
31
35
  export interface PostEditOptions extends BaseHookOptions {
32
36
  file: string;
33
37
  memoryKey?: string;
38
+ 'memory-key'?: string;
34
39
  format?: boolean;
35
40
  analyze?: boolean;
41
+ updateMemory?: boolean;
42
+ 'update-memory'?: boolean;
43
+ trainNeural?: boolean;
44
+ 'train-neural'?: boolean;
36
45
  }
37
46
 
38
47
  export interface PreCommandOptions extends BaseHookOptions {
39
48
  command: string;
40
49
  validate?: boolean;
50
+ 'validate-safety'?: boolean;
41
51
  sandbox?: boolean;
52
+ prepareResources?: boolean;
53
+ 'prepare-resources'?: boolean;
42
54
  }
43
55
 
44
56
  export interface PostCommandOptions extends BaseHookOptions {
45
57
  command: string;
46
58
  exitCode?: number;
59
+ 'exit-code'?: number;
47
60
  duration?: number;
61
+ trackMetrics?: boolean;
62
+ 'track-metrics'?: boolean;
63
+ storeResults?: boolean;
64
+ 'store-results'?: boolean;
65
+ output?: string;
48
66
  }
49
67
 
50
68
  export interface SessionStartOptions extends BaseHookOptions {
@@ -56,7 +74,11 @@ export interface SessionStartOptions extends BaseHookOptions {
56
74
  export interface SessionEndOptions extends BaseHookOptions {
57
75
  sessionId?: string;
58
76
  exportMetrics?: boolean;
77
+ 'export-metrics'?: boolean;
59
78
  generateSummary?: boolean;
79
+ 'generate-summary'?: boolean;
80
+ persistState?: boolean;
81
+ 'persist-state'?: boolean;
60
82
  saveTo?: string;
61
83
  }
62
84
 
@@ -3,14 +3,14 @@
3
3
  * Provides clear, actionable command documentation
4
4
  */
5
5
 
6
- export const VERSION = '2.0.0-alpha.55';
6
+ export const VERSION = '2.0.0-alpha.56';
7
7
 
8
8
  export const MAIN_HELP = `
9
9
  🌊 Claude-Flow v${VERSION} - Enterprise-Grade AI Agent Orchestration Platform
10
10
 
11
11
  🎯 ENTERPRISE FEATURES: Complete ruv-swarm integration with 87 MCP tools, neural networking, and production-ready infrastructure
12
12
  🐝 NEW: Advanced Hive Mind System with Queen-led coordination, collective intelligence, and unlimited scaling
13
- ⚡ ALPHA 55: Fixed configuration placement and process management issues
13
+ ⚡ ALPHA 56: Enhanced code quality - Fixed UI rendering, real metrics, CLI parsing, and portability
14
14
 
15
15
  USAGE:
16
16
  claude-flow <command> [options]
@@ -8,6 +8,7 @@ import { existsSync } from 'fs';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { dirname, join } from 'path';
10
10
  import process from 'process';
11
+ import { spawn } from 'child_process';
11
12
 
12
13
  // Process arguments (remove first two: node executable and script path)
13
14
  export const args = process.argv.slice(2);
@@ -75,6 +76,53 @@ export const exit = (code = 0) => {
75
76
  process.exit(code);
76
77
  };
77
78
 
79
+ export const execPath = () => process.execPath;
80
+
81
+ // stdin/stdout/stderr support
82
+ export const stdin = {
83
+ read: async (buffer) => {
84
+ return new Promise((resolve) => {
85
+ if (process.stdin.isTTY) {
86
+ process.stdin.setRawMode(true);
87
+ }
88
+ process.stdin.resume();
89
+ process.stdin.once('data', (data) => {
90
+ const bytes = Math.min(data.length, buffer.length);
91
+ for (let i = 0; i < bytes; i++) {
92
+ buffer[i] = data[i];
93
+ }
94
+ if (process.stdin.isTTY) {
95
+ process.stdin.setRawMode(false);
96
+ }
97
+ process.stdin.pause();
98
+ resolve(bytes);
99
+ });
100
+ });
101
+ }
102
+ };
103
+
104
+ export const stdout = {
105
+ write: async (data) => {
106
+ return new Promise((resolve, reject) => {
107
+ process.stdout.write(data, (err) => {
108
+ if (err) reject(err);
109
+ else resolve(data.length);
110
+ });
111
+ });
112
+ }
113
+ };
114
+
115
+ export const stderr = {
116
+ write: async (data) => {
117
+ return new Promise((resolve, reject) => {
118
+ process.stderr.write(data, (err) => {
119
+ if (err) reject(err);
120
+ else resolve(data.length);
121
+ });
122
+ });
123
+ }
124
+ };
125
+
78
126
  // Deno.errors compatibility
79
127
  export const errors = {
80
128
  NotFound: class NotFound extends Error {
@@ -130,6 +178,74 @@ export const build = {
130
178
  target: `${process.arch}-${process.platform}`
131
179
  };
132
180
 
181
+ // Environment variables support
182
+ export const env = {
183
+ get: (key) => process.env[key],
184
+ set: (key, value) => { process.env[key] = value; },
185
+ toObject: () => ({ ...process.env })
186
+ };
187
+
188
+ // Deno.Command compatibility
189
+ export class Command {
190
+ constructor(command, options = {}) {
191
+ this.command = command;
192
+ this.options = options;
193
+ }
194
+
195
+ async output() {
196
+ return new Promise((resolve, reject) => {
197
+ const child = spawn(this.command, this.options.args || [], {
198
+ cwd: this.options.cwd,
199
+ env: this.options.env,
200
+ stdio: ['pipe', 'pipe', 'pipe']
201
+ });
202
+
203
+ let stdout = [];
204
+ let stderr = [];
205
+
206
+ child.stdout.on('data', (data) => {
207
+ stdout.push(data);
208
+ });
209
+
210
+ child.stderr.on('data', (data) => {
211
+ stderr.push(data);
212
+ });
213
+
214
+ child.on('close', (code) => {
215
+ resolve({
216
+ code,
217
+ success: code === 0,
218
+ stdout: Buffer.concat(stdout),
219
+ stderr: Buffer.concat(stderr)
220
+ });
221
+ });
222
+
223
+ child.on('error', (err) => {
224
+ reject(err);
225
+ });
226
+ });
227
+ }
228
+
229
+ spawn() {
230
+ const child = spawn(this.command, this.options.args || [], {
231
+ cwd: this.options.cwd,
232
+ env: this.options.env,
233
+ stdio: this.options.stdio || 'inherit'
234
+ });
235
+
236
+ return {
237
+ status: new Promise((resolve) => {
238
+ child.on('close', (code) => {
239
+ resolve({ code, success: code === 0 });
240
+ });
241
+ }),
242
+ stdout: child.stdout,
243
+ stderr: child.stderr,
244
+ kill: (signal) => child.kill(signal)
245
+ };
246
+ }
247
+ }
248
+
133
249
  // Export a Deno-like object for easier migration
134
250
  export const Deno = {
135
251
  args,
@@ -143,8 +259,14 @@ export const Deno = {
143
259
  pid,
144
260
  kill,
145
261
  exit,
262
+ execPath,
146
263
  errors,
147
- build
264
+ build,
265
+ stdin,
266
+ stdout,
267
+ stderr,
268
+ env,
269
+ Command
148
270
  };
149
271
 
150
272
  export default Deno;
@@ -18,7 +18,7 @@ import process from 'process';
18
18
  import readline from 'readline';
19
19
  import { getMainHelp, getCommandHelp } from './help-text.js';
20
20
 
21
- const VERSION = '2.0.0-alpha.55';
21
+ const VERSION = '2.0.0-alpha.56';
22
22
 
23
23
  function printHelp() {
24
24
  console.log(getMainHelp());
@@ -5,6 +5,61 @@
5
5
  */
6
6
 
7
7
  import { printSuccess, printError, printWarning } from '../utils.js';
8
+ import { platform } from 'os';
9
+ import { access, constants } from 'fs/promises';
10
+ import { join } from 'path';
11
+
12
+ /**
13
+ * Cross-platform check for executable availability
14
+ * @param {string} command - The command to check
15
+ * @returns {Promise<boolean>} - True if command is available
16
+ */
17
+ async function checkCommandAvailable(command) {
18
+ const { execSync } = await import('child_process');
19
+
20
+ if (platform() === 'win32') {
21
+ // Windows: Use 'where' command
22
+ try {
23
+ execSync(`where ${command}`, { stdio: 'ignore' });
24
+ return true;
25
+ } catch (e) {
26
+ return false;
27
+ }
28
+ } else {
29
+ // Unix-like systems: Check common paths and use 'command -v'
30
+ try {
31
+ execSync(`command -v ${command}`, { stdio: 'ignore', shell: true });
32
+ return true;
33
+ } catch (e) {
34
+ // Fallback: Check common installation paths
35
+ const commonPaths = [
36
+ '/usr/local/bin',
37
+ '/usr/bin',
38
+ '/opt/homebrew/bin',
39
+ join(process.env.HOME || '', '.local', 'bin'),
40
+ join(process.env.HOME || '', 'bin')
41
+ ];
42
+
43
+ for (const dir of commonPaths) {
44
+ try {
45
+ await access(join(dir, command), constants.X_OK);
46
+ return true;
47
+ } catch (e) {
48
+ // Continue checking other paths
49
+ }
50
+ }
51
+ return false;
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Check if Claude CLI is available
58
+ * @returns {Promise<boolean>} - True if Claude is available
59
+ */
60
+ async function checkClaudeAvailable() {
61
+ return checkCommandAvailable('claude');
62
+ }
8
63
 
9
64
  const GITHUB_MODES = {
10
65
  'gh-coordinator': {
@@ -149,9 +204,9 @@ export async function githubCommand(args, flags) {
149
204
  // Check if Claude is available
150
205
  const { execSync } = await import('child_process');
151
206
 
152
- try {
153
- execSync('which claude', { stdio: 'ignore' });
154
- } catch (e) {
207
+ // Cross-platform check for Claude CLI
208
+ const isClaudeAvailable = await checkClaudeAvailable();
209
+ if (!isClaudeAvailable) {
155
210
  printWarning('⚠️ Claude CLI not found. GitHub automation requires Claude.');
156
211
  console.log('Install Claude: https://claude.ai/code');
157
212
  console.log('\nAlternatively, this would execute:');