claude-flow 2.5.0-alpha.136 → 2.5.0-alpha.138
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 +1 -1
- package/dist/src/cli/simple-cli.js +165 -188
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/init/index.js +80 -38
- package/dist/src/cli/simple-commands/init/index.js.map +1 -1
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +1 -1
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js +1 -1
- package/dist/src/utils/metrics-reader.js +41 -29
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/simple-commands/init/index.js +80 -38
- package/src/cli/simple-commands/init/templates/enhanced-templates.js +1 -1
- package/src/cli/simple-commands/init/templates/settings.json +1 -1
package/package.json
CHANGED
|
@@ -154,15 +154,13 @@ async function setupMcpServers(dryRun = false) {
|
|
|
154
154
|
* Create statusline script content (embedded fallback for binary builds)
|
|
155
155
|
*/
|
|
156
156
|
function createStatuslineScript() {
|
|
157
|
-
return
|
|
158
|
-
|
|
159
|
-
# Claude Code Status Line with Claude-Flow Integration
|
|
160
|
-
# Displays model, directory, git branch, and real-time swarm metrics
|
|
157
|
+
return `
|
|
158
|
+
#!/bin/bash
|
|
161
159
|
|
|
162
160
|
# Read JSON input from stdin
|
|
163
161
|
INPUT=$(cat)
|
|
164
|
-
MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "Claude"')
|
|
165
|
-
CWD=$(echo "$INPUT" | jq -r '.workspace.current_dir // .cwd')
|
|
162
|
+
MODEL=$(echo "$INPUT" | jq -r \'.model.display_name // "Claude"\')
|
|
163
|
+
CWD=$(echo "$INPUT" | jq -r \'.workspace.current_dir // .cwd\')
|
|
166
164
|
DIR=$(basename "$CWD")
|
|
167
165
|
|
|
168
166
|
# Replace claude-code-flow with branded name
|
|
@@ -183,10 +181,11 @@ FLOW_DIR="$CWD/.claude-flow"
|
|
|
183
181
|
if [ -d "$FLOW_DIR" ]; then
|
|
184
182
|
echo -ne " │"
|
|
185
183
|
|
|
186
|
-
# Swarm Configuration & Topology
|
|
184
|
+
# 1. Swarm Configuration & Topology
|
|
187
185
|
if [ -f "$FLOW_DIR/swarm-config.json" ]; then
|
|
188
|
-
STRATEGY=$(jq -r '.defaultStrategy // empty' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
|
|
186
|
+
STRATEGY=$(jq -r \'.defaultStrategy // empty\' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
|
|
189
187
|
if [ -n "$STRATEGY" ]; then
|
|
188
|
+
# Map strategy to topology icon
|
|
190
189
|
case "$STRATEGY" in
|
|
191
190
|
"balanced") TOPO_ICON="⚡mesh" ;;
|
|
192
191
|
"conservative") TOPO_ICON="⚡hier" ;;
|
|
@@ -195,96 +194,139 @@ if [ -d "$FLOW_DIR" ]; then
|
|
|
195
194
|
esac
|
|
196
195
|
echo -ne " \\033[35m$TOPO_ICON\\033[0m"
|
|
197
196
|
|
|
198
|
-
|
|
197
|
+
# Count agent profiles as "configured agents"
|
|
198
|
+
AGENT_COUNT=$(jq -r \'.agentProfiles | length\' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
|
|
199
199
|
if [ -n "$AGENT_COUNT" ] && [ "$AGENT_COUNT" != "null" ] && [ "$AGENT_COUNT" -gt 0 ]; then
|
|
200
200
|
echo -ne " \\033[35m🤖 $AGENT_COUNT\\033[0m"
|
|
201
201
|
fi
|
|
202
202
|
fi
|
|
203
203
|
fi
|
|
204
204
|
|
|
205
|
-
# Real-time System Metrics
|
|
205
|
+
# 2. Real-time System Metrics
|
|
206
206
|
if [ -f "$FLOW_DIR/metrics/system-metrics.json" ]; then
|
|
207
|
-
|
|
207
|
+
# Get latest metrics (last entry in array)
|
|
208
|
+
LATEST=$(jq -r \'.[-1]\' "$FLOW_DIR/metrics/system-metrics.json" 2>/dev/null)
|
|
208
209
|
|
|
209
210
|
if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
|
|
210
|
-
|
|
211
|
+
# Memory usage
|
|
212
|
+
MEM_PERCENT=$(echo "$LATEST" | jq -r \'.memoryUsagePercent // 0\' | awk \'{printf "%.0f", $1}\')
|
|
211
213
|
if [ -n "$MEM_PERCENT" ] && [ "$MEM_PERCENT" != "null" ]; then
|
|
214
|
+
# Color-coded memory (green <60%, yellow 60-80%, red >80%)
|
|
212
215
|
if [ "$MEM_PERCENT" -lt 60 ]; then
|
|
213
|
-
MEM_COLOR="\\033[32m"
|
|
216
|
+
MEM_COLOR="\\033[32m" # Green
|
|
214
217
|
elif [ "$MEM_PERCENT" -lt 80 ]; then
|
|
215
|
-
MEM_COLOR="\\033[33m"
|
|
218
|
+
MEM_COLOR="\\033[33m" # Yellow
|
|
216
219
|
else
|
|
217
|
-
MEM_COLOR="\\033[31m"
|
|
220
|
+
MEM_COLOR="\\033[31m" # Red
|
|
218
221
|
fi
|
|
219
|
-
echo -ne "
|
|
222
|
+
echo -ne " ${MEM_COLOR}💾 ${MEM_PERCENT}%\\033[0m"
|
|
220
223
|
fi
|
|
221
224
|
|
|
222
|
-
|
|
225
|
+
# CPU load
|
|
226
|
+
CPU_LOAD=$(echo "$LATEST" | jq -r \'.cpuLoad // 0\' | awk \'{printf "%.0f", $1 * 100}\')
|
|
223
227
|
if [ -n "$CPU_LOAD" ] && [ "$CPU_LOAD" != "null" ]; then
|
|
228
|
+
# Color-coded CPU (green <50%, yellow 50-75%, red >75%)
|
|
224
229
|
if [ "$CPU_LOAD" -lt 50 ]; then
|
|
225
|
-
CPU_COLOR="\\033[32m"
|
|
230
|
+
CPU_COLOR="\\033[32m" # Green
|
|
226
231
|
elif [ "$CPU_LOAD" -lt 75 ]; then
|
|
227
|
-
CPU_COLOR="\\033[33m"
|
|
232
|
+
CPU_COLOR="\\033[33m" # Yellow
|
|
228
233
|
else
|
|
229
|
-
CPU_COLOR="\\033[31m"
|
|
234
|
+
CPU_COLOR="\\033[31m" # Red
|
|
230
235
|
fi
|
|
231
|
-
echo -ne "
|
|
236
|
+
echo -ne " ${CPU_COLOR}⚙ ${CPU_LOAD}%\\033[0m"
|
|
232
237
|
fi
|
|
233
238
|
fi
|
|
234
239
|
fi
|
|
235
240
|
|
|
236
|
-
#
|
|
241
|
+
# 3. Session State
|
|
242
|
+
if [ -f "$FLOW_DIR/session-state.json" ]; then
|
|
243
|
+
SESSION_ID=$(jq -r \'.sessionId // empty\' "$FLOW_DIR/session-state.json" 2>/dev/null)
|
|
244
|
+
ACTIVE=$(jq -r \'.active // false\' "$FLOW_DIR/session-state.json" 2>/dev/null)
|
|
245
|
+
|
|
246
|
+
if [ "$ACTIVE" = "true" ] && [ -n "$SESSION_ID" ]; then
|
|
247
|
+
# Show abbreviated session ID
|
|
248
|
+
SHORT_ID=$(echo "$SESSION_ID" | cut -d\'-\' -f1)
|
|
249
|
+
echo -ne " \\033[34m🔄 $SHORT_ID\\033[0m"
|
|
250
|
+
fi
|
|
251
|
+
fi
|
|
252
|
+
|
|
253
|
+
# 4. Performance Metrics from task-metrics.json
|
|
237
254
|
if [ -f "$FLOW_DIR/metrics/task-metrics.json" ]; then
|
|
238
|
-
|
|
255
|
+
# Parse task metrics for success rate, avg time, and streak
|
|
256
|
+
METRICS=$(jq -r \'
|
|
257
|
+
# Calculate metrics
|
|
239
258
|
(map(select(.success == true)) | length) as $successful |
|
|
240
259
|
(length) as $total |
|
|
241
260
|
(if $total > 0 then ($successful / $total * 100) else 0 end) as $success_rate |
|
|
242
261
|
(map(.duration // 0) | add / length) as $avg_duration |
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
262
|
+
# Calculate streak (consecutive successes from end)
|
|
263
|
+
(reverse |
|
|
264
|
+
reduce .[] as $task (0;
|
|
265
|
+
if $task.success == true then . + 1 else 0 end
|
|
266
|
+
)
|
|
267
|
+
) as $streak |
|
|
268
|
+
{
|
|
269
|
+
success_rate: $success_rate,
|
|
270
|
+
avg_duration: $avg_duration,
|
|
271
|
+
streak: $streak,
|
|
272
|
+
total: $total
|
|
273
|
+
} | @json
|
|
274
|
+
\' "$FLOW_DIR/metrics/task-metrics.json" 2>/dev/null)
|
|
246
275
|
|
|
247
276
|
if [ -n "$METRICS" ] && [ "$METRICS" != "null" ]; then
|
|
248
|
-
|
|
249
|
-
|
|
277
|
+
# Success Rate
|
|
278
|
+
SUCCESS_RATE=$(echo "$METRICS" | jq -r \'.success_rate // 0\' | awk \'{printf "%.0f", $1}\')
|
|
279
|
+
TOTAL_TASKS=$(echo "$METRICS" | jq -r \'.total // 0\')
|
|
250
280
|
|
|
251
281
|
if [ -n "$SUCCESS_RATE" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
|
|
282
|
+
# Color-code: Green (>80%), Yellow (60-80%), Red (<60%)
|
|
252
283
|
if [ "$SUCCESS_RATE" -gt 80 ]; then
|
|
253
|
-
SUCCESS_COLOR="\\033[32m"
|
|
284
|
+
SUCCESS_COLOR="\\033[32m" # Green
|
|
254
285
|
elif [ "$SUCCESS_RATE" -ge 60 ]; then
|
|
255
|
-
SUCCESS_COLOR="\\033[33m"
|
|
286
|
+
SUCCESS_COLOR="\\033[33m" # Yellow
|
|
256
287
|
else
|
|
257
|
-
SUCCESS_COLOR="\\033[31m"
|
|
288
|
+
SUCCESS_COLOR="\\033[31m" # Red
|
|
258
289
|
fi
|
|
259
|
-
echo -ne "
|
|
290
|
+
echo -ne " ${SUCCESS_COLOR}🎯 ${SUCCESS_RATE}%\\033[0m"
|
|
260
291
|
fi
|
|
261
292
|
|
|
262
|
-
|
|
293
|
+
# Average Time
|
|
294
|
+
AVG_TIME=$(echo "$METRICS" | jq -r \'.avg_duration // 0\')
|
|
263
295
|
if [ -n "$AVG_TIME" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
|
|
296
|
+
# Format smartly: seconds, minutes, or hours
|
|
264
297
|
if [ $(echo "$AVG_TIME < 60" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
|
|
265
|
-
TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fs", $1}')
|
|
298
|
+
TIME_STR=$(echo "$AVG_TIME" | awk \'{printf "%.1fs", $1}\')
|
|
266
299
|
elif [ $(echo "$AVG_TIME < 3600" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
|
|
267
|
-
TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fm", $1/60}')
|
|
300
|
+
TIME_STR=$(echo "$AVG_TIME" | awk \'{printf "%.1fm", $1/60}\')
|
|
268
301
|
else
|
|
269
|
-
TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fh", $1/3600}')
|
|
302
|
+
TIME_STR=$(echo "$AVG_TIME" | awk \'{printf "%.1fh", $1/3600}\')
|
|
270
303
|
fi
|
|
271
304
|
echo -ne " \\033[36m⏱️ $TIME_STR\\033[0m"
|
|
272
305
|
fi
|
|
273
306
|
|
|
274
|
-
|
|
307
|
+
# Streak (only show if > 0)
|
|
308
|
+
STREAK=$(echo "$METRICS" | jq -r \'.streak // 0\')
|
|
275
309
|
if [ -n "$STREAK" ] && [ "$STREAK" -gt 0 ]; then
|
|
276
310
|
echo -ne " \\033[91m🔥 $STREAK\\033[0m"
|
|
277
311
|
fi
|
|
278
312
|
fi
|
|
279
313
|
fi
|
|
280
314
|
|
|
281
|
-
# Active Tasks
|
|
315
|
+
# 5. Active Tasks (check for task files)
|
|
282
316
|
if [ -d "$FLOW_DIR/tasks" ]; then
|
|
283
317
|
TASK_COUNT=$(find "$FLOW_DIR/tasks" -name "*.json" -type f 2>/dev/null | wc -l)
|
|
284
318
|
if [ "$TASK_COUNT" -gt 0 ]; then
|
|
285
319
|
echo -ne " \\033[36m📋 $TASK_COUNT\\033[0m"
|
|
286
320
|
fi
|
|
287
321
|
fi
|
|
322
|
+
|
|
323
|
+
# 6. Check for hooks activity
|
|
324
|
+
if [ -f "$FLOW_DIR/hooks-state.json" ]; then
|
|
325
|
+
HOOKS_ACTIVE=$(jq -r \'.enabled // false\' "$FLOW_DIR/hooks-state.json" 2>/dev/null)
|
|
326
|
+
if [ "$HOOKS_ACTIVE" = "true" ]; then
|
|
327
|
+
echo -ne " \\033[35m🔗\\033[0m"
|
|
328
|
+
fi
|
|
329
|
+
fi
|
|
288
330
|
fi
|
|
289
331
|
|
|
290
332
|
echo
|