moflo 4.7.8 → 4.8.0
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/hooks.mjs +23 -20
- package/bin/session-start-launcher.mjs +88 -3
- package/package.json +1 -1
- package/src/@claude-flow/cli/dist/src/commands/daemon.js +42 -95
- package/src/@claude-flow/cli/dist/src/commands/doctor.js +11 -5
- package/src/@claude-flow/cli/dist/src/config/moflo-config.d.ts +5 -0
- package/src/@claude-flow/cli/dist/src/config/moflo-config.js +16 -0
- package/src/@claude-flow/cli/dist/src/init/executor.js +74 -0
- package/src/@claude-flow/cli/dist/src/services/daemon-lock.d.ts +39 -0
- package/src/@claude-flow/cli/dist/src/services/daemon-lock.js +213 -0
- package/src/@claude-flow/cli/package.json +1 -1
- package/.claude/helpers/README.md +0 -97
- package/.claude/helpers/adr-compliance.sh +0 -186
- package/.claude/helpers/aggressive-microcompact.mjs +0 -36
- package/.claude/helpers/auto-commit.sh +0 -178
- package/.claude/helpers/checkpoint-manager.sh +0 -251
- package/.claude/helpers/context-persistence-hook.mjs +0 -1979
- package/.claude/helpers/daemon-manager.sh +0 -252
- package/.claude/helpers/ddd-tracker.sh +0 -144
- package/.claude/helpers/github-safe.js +0 -106
- package/.claude/helpers/github-setup.sh +0 -28
- package/.claude/helpers/guidance-hook.sh +0 -13
- package/.claude/helpers/guidance-hooks.sh +0 -102
- package/.claude/helpers/health-monitor.sh +0 -108
- package/.claude/helpers/learning-hooks.sh +0 -329
- package/.claude/helpers/learning-optimizer.sh +0 -127
- package/.claude/helpers/learning-service.mjs +0 -1211
- package/.claude/helpers/memory.cjs +0 -84
- package/.claude/helpers/metrics-db.mjs +0 -492
- package/.claude/helpers/patch-aggressive-prune.mjs +0 -184
- package/.claude/helpers/pattern-consolidator.sh +0 -86
- package/.claude/helpers/perf-worker.sh +0 -160
- package/.claude/helpers/quick-start.sh +0 -19
- package/.claude/helpers/router.cjs +0 -62
- package/.claude/helpers/security-scanner.sh +0 -127
- package/.claude/helpers/session.cjs +0 -125
- package/.claude/helpers/setup-mcp.sh +0 -18
- package/.claude/helpers/standard-checkpoint-hooks.sh +0 -189
- package/.claude/helpers/swarm-comms.sh +0 -353
- package/.claude/helpers/swarm-hooks.sh +0 -761
- package/.claude/helpers/swarm-monitor.sh +0 -211
- package/.claude/helpers/sync-v3-metrics.sh +0 -245
- package/.claude/helpers/update-v3-progress.sh +0 -166
- package/.claude/helpers/v3-quick-status.sh +0 -58
- package/.claude/helpers/v3.sh +0 -111
- package/.claude/helpers/validate-v3-config.sh +0 -216
- package/.claude/helpers/worker-manager.sh +0 -170
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# RuFlo V3 - Daemon Manager
|
|
3
|
-
# Manages background services for real-time statusline updates
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
7
|
-
PID_DIR="$PROJECT_ROOT/.claude-flow/pids"
|
|
8
|
-
LOG_DIR="$PROJECT_ROOT/.claude-flow/logs"
|
|
9
|
-
METRICS_DIR="$PROJECT_ROOT/.claude-flow/metrics"
|
|
10
|
-
|
|
11
|
-
# Ensure directories exist
|
|
12
|
-
mkdir -p "$PID_DIR" "$LOG_DIR" "$METRICS_DIR"
|
|
13
|
-
|
|
14
|
-
# PID files
|
|
15
|
-
SWARM_MONITOR_PID="$PID_DIR/swarm-monitor.pid"
|
|
16
|
-
METRICS_DAEMON_PID="$PID_DIR/metrics-daemon.pid"
|
|
17
|
-
|
|
18
|
-
# Log files
|
|
19
|
-
DAEMON_LOG="$LOG_DIR/daemon.log"
|
|
20
|
-
|
|
21
|
-
# Colors
|
|
22
|
-
GREEN='\033[0;32m'
|
|
23
|
-
YELLOW='\033[1;33m'
|
|
24
|
-
RED='\033[0;31m'
|
|
25
|
-
CYAN='\033[0;36m'
|
|
26
|
-
RESET='\033[0m'
|
|
27
|
-
|
|
28
|
-
log() {
|
|
29
|
-
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] $1"
|
|
30
|
-
echo -e "${CYAN}$msg${RESET}"
|
|
31
|
-
echo "$msg" >> "$DAEMON_LOG"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
success() {
|
|
35
|
-
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] SUCCESS: $1"
|
|
36
|
-
echo -e "${GREEN}$msg${RESET}"
|
|
37
|
-
echo "$msg" >> "$DAEMON_LOG"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
error() {
|
|
41
|
-
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1"
|
|
42
|
-
echo -e "${RED}$msg${RESET}"
|
|
43
|
-
echo "$msg" >> "$DAEMON_LOG"
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Check if a process is running
|
|
47
|
-
is_running() {
|
|
48
|
-
local pid_file="$1"
|
|
49
|
-
if [ -f "$pid_file" ]; then
|
|
50
|
-
local pid=$(cat "$pid_file")
|
|
51
|
-
if ps -p "$pid" > /dev/null 2>&1; then
|
|
52
|
-
return 0
|
|
53
|
-
fi
|
|
54
|
-
fi
|
|
55
|
-
return 1
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# Start the swarm monitor daemon
|
|
59
|
-
start_swarm_monitor() {
|
|
60
|
-
local interval="${1:-30}"
|
|
61
|
-
|
|
62
|
-
if is_running "$SWARM_MONITOR_PID"; then
|
|
63
|
-
log "Swarm monitor already running (PID: $(cat "$SWARM_MONITOR_PID"))"
|
|
64
|
-
return 0
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
log "Starting swarm monitor daemon (interval: ${interval}s)..."
|
|
68
|
-
|
|
69
|
-
# Run the monitor in background
|
|
70
|
-
nohup "$SCRIPT_DIR/swarm-monitor.sh" monitor "$interval" >> "$LOG_DIR/swarm-monitor.log" 2>&1 &
|
|
71
|
-
local pid=$!
|
|
72
|
-
|
|
73
|
-
echo "$pid" > "$SWARM_MONITOR_PID"
|
|
74
|
-
success "Swarm monitor started (PID: $pid)"
|
|
75
|
-
|
|
76
|
-
return 0
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
# Start the metrics update daemon
|
|
80
|
-
start_metrics_daemon() {
|
|
81
|
-
local interval="${1:-60}" # Default 60 seconds - less frequent updates
|
|
82
|
-
|
|
83
|
-
if is_running "$METRICS_DAEMON_PID"; then
|
|
84
|
-
log "Metrics daemon already running (PID: $(cat "$METRICS_DAEMON_PID"))"
|
|
85
|
-
return 0
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
|
-
log "Starting metrics daemon (interval: ${interval}s, using SQLite)..."
|
|
89
|
-
|
|
90
|
-
# Use SQLite-based metrics (10.5x faster than bash/JSON)
|
|
91
|
-
# Run as Node.js daemon process
|
|
92
|
-
nohup node "$SCRIPT_DIR/metrics-db.mjs" daemon "$interval" >> "$LOG_DIR/metrics-daemon.log" 2>&1 &
|
|
93
|
-
local pid=$!
|
|
94
|
-
|
|
95
|
-
echo "$pid" > "$METRICS_DAEMON_PID"
|
|
96
|
-
success "Metrics daemon started (PID: $pid) - SQLite backend"
|
|
97
|
-
|
|
98
|
-
return 0
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
# Stop a daemon by PID file
|
|
102
|
-
stop_daemon() {
|
|
103
|
-
local pid_file="$1"
|
|
104
|
-
local name="$2"
|
|
105
|
-
|
|
106
|
-
if [ -f "$pid_file" ]; then
|
|
107
|
-
local pid=$(cat "$pid_file")
|
|
108
|
-
if ps -p "$pid" > /dev/null 2>&1; then
|
|
109
|
-
log "Stopping $name (PID: $pid)..."
|
|
110
|
-
kill "$pid" 2>/dev/null
|
|
111
|
-
sleep 1
|
|
112
|
-
|
|
113
|
-
# Force kill if still running
|
|
114
|
-
if ps -p "$pid" > /dev/null 2>&1; then
|
|
115
|
-
kill -9 "$pid" 2>/dev/null
|
|
116
|
-
fi
|
|
117
|
-
|
|
118
|
-
success "$name stopped"
|
|
119
|
-
fi
|
|
120
|
-
rm -f "$pid_file"
|
|
121
|
-
else
|
|
122
|
-
log "$name not running"
|
|
123
|
-
fi
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
# Start all daemons
|
|
127
|
-
start_all() {
|
|
128
|
-
log "Starting all Claude Flow daemons..."
|
|
129
|
-
start_swarm_monitor "${1:-30}"
|
|
130
|
-
start_metrics_daemon "${2:-60}"
|
|
131
|
-
|
|
132
|
-
# Initial metrics update
|
|
133
|
-
"$SCRIPT_DIR/swarm-monitor.sh" check > /dev/null 2>&1
|
|
134
|
-
|
|
135
|
-
success "All daemons started"
|
|
136
|
-
show_status
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# Stop all daemons
|
|
140
|
-
stop_all() {
|
|
141
|
-
log "Stopping all Claude Flow daemons..."
|
|
142
|
-
stop_daemon "$SWARM_MONITOR_PID" "Swarm monitor"
|
|
143
|
-
stop_daemon "$METRICS_DAEMON_PID" "Metrics daemon"
|
|
144
|
-
success "All daemons stopped"
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
# Restart all daemons
|
|
148
|
-
restart_all() {
|
|
149
|
-
stop_all
|
|
150
|
-
sleep 1
|
|
151
|
-
start_all "$@"
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
# Show daemon status
|
|
155
|
-
show_status() {
|
|
156
|
-
echo ""
|
|
157
|
-
echo -e "${CYAN}═══════════════════════════════════════════════════${RESET}"
|
|
158
|
-
echo -e "${CYAN} RuFlo V3 Daemon Status${RESET}"
|
|
159
|
-
echo -e "${CYAN}═══════════════════════════════════════════════════${RESET}"
|
|
160
|
-
echo ""
|
|
161
|
-
|
|
162
|
-
# Swarm Monitor
|
|
163
|
-
if is_running "$SWARM_MONITOR_PID"; then
|
|
164
|
-
echo -e " ${GREEN}●${RESET} Swarm Monitor ${GREEN}RUNNING${RESET} (PID: $(cat "$SWARM_MONITOR_PID"))"
|
|
165
|
-
else
|
|
166
|
-
echo -e " ${RED}○${RESET} Swarm Monitor ${RED}STOPPED${RESET}"
|
|
167
|
-
fi
|
|
168
|
-
|
|
169
|
-
# Metrics Daemon
|
|
170
|
-
if is_running "$METRICS_DAEMON_PID"; then
|
|
171
|
-
echo -e " ${GREEN}●${RESET} Metrics Daemon ${GREEN}RUNNING${RESET} (PID: $(cat "$METRICS_DAEMON_PID"))"
|
|
172
|
-
else
|
|
173
|
-
echo -e " ${RED}○${RESET} Metrics Daemon ${RED}STOPPED${RESET}"
|
|
174
|
-
fi
|
|
175
|
-
|
|
176
|
-
# MCP Server
|
|
177
|
-
local mcp_count=$(ps aux 2>/dev/null | grep -E "mcp.*start" | grep -v grep | wc -l)
|
|
178
|
-
if [ "$mcp_count" -gt 0 ]; then
|
|
179
|
-
echo -e " ${GREEN}●${RESET} MCP Server ${GREEN}RUNNING${RESET}"
|
|
180
|
-
else
|
|
181
|
-
echo -e " ${YELLOW}○${RESET} MCP Server ${YELLOW}NOT DETECTED${RESET}"
|
|
182
|
-
fi
|
|
183
|
-
|
|
184
|
-
# Agentic Flow
|
|
185
|
-
local af_count=$(ps aux 2>/dev/null | grep -E "agentic-flow" | grep -v grep | grep -v "daemon-manager" | wc -l)
|
|
186
|
-
if [ "$af_count" -gt 0 ]; then
|
|
187
|
-
echo -e " ${GREEN}●${RESET} Agentic Flow ${GREEN}ACTIVE${RESET} ($af_count processes)"
|
|
188
|
-
else
|
|
189
|
-
echo -e " ${YELLOW}○${RESET} Agentic Flow ${YELLOW}IDLE${RESET}"
|
|
190
|
-
fi
|
|
191
|
-
|
|
192
|
-
echo ""
|
|
193
|
-
echo -e "${CYAN}───────────────────────────────────────────────────${RESET}"
|
|
194
|
-
|
|
195
|
-
# Show latest metrics
|
|
196
|
-
if [ -f "$METRICS_DIR/swarm-activity.json" ]; then
|
|
197
|
-
local last_update=$(jq -r '.timestamp // "unknown"' "$METRICS_DIR/swarm-activity.json" 2>/dev/null)
|
|
198
|
-
local agent_count=$(jq -r '.swarm.agent_count // 0' "$METRICS_DIR/swarm-activity.json" 2>/dev/null)
|
|
199
|
-
echo -e " Last Update: ${last_update}"
|
|
200
|
-
echo -e " Active Agents: ${agent_count}"
|
|
201
|
-
fi
|
|
202
|
-
|
|
203
|
-
echo -e "${CYAN}═══════════════════════════════════════════════════${RESET}"
|
|
204
|
-
echo ""
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
# Main command handling
|
|
208
|
-
case "${1:-status}" in
|
|
209
|
-
"start")
|
|
210
|
-
start_all "${2:-30}" "${3:-60}"
|
|
211
|
-
;;
|
|
212
|
-
"stop")
|
|
213
|
-
stop_all
|
|
214
|
-
;;
|
|
215
|
-
"restart")
|
|
216
|
-
restart_all "${2:-30}" "${3:-60}"
|
|
217
|
-
;;
|
|
218
|
-
"status")
|
|
219
|
-
show_status
|
|
220
|
-
;;
|
|
221
|
-
"start-swarm")
|
|
222
|
-
start_swarm_monitor "${2:-30}"
|
|
223
|
-
;;
|
|
224
|
-
"start-metrics")
|
|
225
|
-
start_metrics_daemon "${2:-60}"
|
|
226
|
-
;;
|
|
227
|
-
"help"|"-h"|"--help")
|
|
228
|
-
echo "RuFlo V3 Daemon Manager"
|
|
229
|
-
echo ""
|
|
230
|
-
echo "Usage: $0 [command] [options]"
|
|
231
|
-
echo ""
|
|
232
|
-
echo "Commands:"
|
|
233
|
-
echo " start [swarm_interval] [metrics_interval] Start all daemons"
|
|
234
|
-
echo " stop Stop all daemons"
|
|
235
|
-
echo " restart [swarm_interval] [metrics_interval] Restart all daemons"
|
|
236
|
-
echo " status Show daemon status"
|
|
237
|
-
echo " start-swarm [interval] Start swarm monitor only"
|
|
238
|
-
echo " start-metrics [interval] Start metrics daemon only"
|
|
239
|
-
echo " help Show this help"
|
|
240
|
-
echo ""
|
|
241
|
-
echo "Examples:"
|
|
242
|
-
echo " $0 start # Start with defaults (30s swarm, 60s metrics)"
|
|
243
|
-
echo " $0 start 10 30 # Start with 10s swarm, 30s metrics intervals"
|
|
244
|
-
echo " $0 status # Show current status"
|
|
245
|
-
echo " $0 stop # Stop all daemons"
|
|
246
|
-
;;
|
|
247
|
-
*)
|
|
248
|
-
error "Unknown command: $1"
|
|
249
|
-
echo "Use '$0 help' for usage information"
|
|
250
|
-
exit 1
|
|
251
|
-
;;
|
|
252
|
-
esac
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# RuFlo V3 - DDD Progress Tracker Worker
|
|
3
|
-
# Tracks Domain-Driven Design implementation progress
|
|
4
|
-
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
9
|
-
METRICS_DIR="$PROJECT_ROOT/.claude-flow/metrics"
|
|
10
|
-
DDD_FILE="$METRICS_DIR/ddd-progress.json"
|
|
11
|
-
V3_PROGRESS="$METRICS_DIR/v3-progress.json"
|
|
12
|
-
LAST_RUN_FILE="$METRICS_DIR/.ddd-last-run"
|
|
13
|
-
|
|
14
|
-
mkdir -p "$METRICS_DIR"
|
|
15
|
-
|
|
16
|
-
# V3 Target Domains
|
|
17
|
-
DOMAINS=("agent-lifecycle" "task-execution" "memory-management" "coordination" "shared-kernel")
|
|
18
|
-
|
|
19
|
-
should_run() {
|
|
20
|
-
if [ ! -f "$LAST_RUN_FILE" ]; then return 0; fi
|
|
21
|
-
local last_run=$(cat "$LAST_RUN_FILE" 2>/dev/null || echo "0")
|
|
22
|
-
local now=$(date +%s)
|
|
23
|
-
[ $((now - last_run)) -ge 600 ] # 10 minutes
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
check_domain() {
|
|
27
|
-
local domain="$1"
|
|
28
|
-
local domain_path="$PROJECT_ROOT/v3/@claude-flow/$domain"
|
|
29
|
-
local alt_path="$PROJECT_ROOT/src/domains/$domain"
|
|
30
|
-
|
|
31
|
-
local score=0
|
|
32
|
-
local max_score=100
|
|
33
|
-
|
|
34
|
-
# Check if domain directory exists (20 points)
|
|
35
|
-
if [ -d "$domain_path" ] || [ -d "$alt_path" ]; then
|
|
36
|
-
score=$((score + 20))
|
|
37
|
-
local path="${domain_path:-$alt_path}"
|
|
38
|
-
[ -d "$domain_path" ] && path="$domain_path" || path="$alt_path"
|
|
39
|
-
|
|
40
|
-
# Check for domain layer (15 points)
|
|
41
|
-
[ -d "$path/domain" ] || [ -d "$path/src/domain" ] && score=$((score + 15))
|
|
42
|
-
|
|
43
|
-
# Check for application layer (15 points)
|
|
44
|
-
[ -d "$path/application" ] || [ -d "$path/src/application" ] && score=$((score + 15))
|
|
45
|
-
|
|
46
|
-
# Check for infrastructure layer (15 points)
|
|
47
|
-
[ -d "$path/infrastructure" ] || [ -d "$path/src/infrastructure" ] && score=$((score + 15))
|
|
48
|
-
|
|
49
|
-
# Check for API/interface layer (10 points)
|
|
50
|
-
[ -d "$path/api" ] || [ -d "$path/src/api" ] && score=$((score + 10))
|
|
51
|
-
|
|
52
|
-
# Check for tests (15 points)
|
|
53
|
-
local test_count=$(find "$path" -name "*.test.ts" -o -name "*.spec.ts" 2>/dev/null | wc -l)
|
|
54
|
-
[ "$test_count" -gt 0 ] && score=$((score + 15))
|
|
55
|
-
|
|
56
|
-
# Check for index/exports (10 points)
|
|
57
|
-
[ -f "$path/index.ts" ] || [ -f "$path/src/index.ts" ] && score=$((score + 10))
|
|
58
|
-
fi
|
|
59
|
-
|
|
60
|
-
echo "$score"
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
count_entities() {
|
|
64
|
-
local type="$1"
|
|
65
|
-
local pattern="$2"
|
|
66
|
-
|
|
67
|
-
find "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | \
|
|
68
|
-
xargs grep -l "$pattern" 2>/dev/null | \
|
|
69
|
-
grep -v node_modules | grep -v ".test." | wc -l || echo "0"
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
track_ddd() {
|
|
73
|
-
echo "[$(date +%H:%M:%S)] Tracking DDD progress..."
|
|
74
|
-
|
|
75
|
-
local total_score=0
|
|
76
|
-
local domain_scores=""
|
|
77
|
-
local completed_domains=0
|
|
78
|
-
|
|
79
|
-
for domain in "${DOMAINS[@]}"; do
|
|
80
|
-
local score=$(check_domain "$domain")
|
|
81
|
-
total_score=$((total_score + score))
|
|
82
|
-
domain_scores="$domain_scores\"$domain\": $score, "
|
|
83
|
-
|
|
84
|
-
[ "$score" -ge 50 ] && completed_domains=$((completed_domains + 1))
|
|
85
|
-
done
|
|
86
|
-
|
|
87
|
-
# Calculate overall progress
|
|
88
|
-
local max_total=$((${#DOMAINS[@]} * 100))
|
|
89
|
-
local progress=$((total_score * 100 / max_total))
|
|
90
|
-
|
|
91
|
-
# Count DDD artifacts
|
|
92
|
-
local entities=$(count_entities "entities" "class.*Entity\|interface.*Entity")
|
|
93
|
-
local value_objects=$(count_entities "value-objects" "class.*VO\|ValueObject")
|
|
94
|
-
local aggregates=$(count_entities "aggregates" "class.*Aggregate\|AggregateRoot")
|
|
95
|
-
local repositories=$(count_entities "repositories" "interface.*Repository\|Repository")
|
|
96
|
-
local services=$(count_entities "services" "class.*Service\|Service")
|
|
97
|
-
local events=$(count_entities "events" "class.*Event\|DomainEvent")
|
|
98
|
-
|
|
99
|
-
# Write DDD metrics
|
|
100
|
-
cat > "$DDD_FILE" << EOF
|
|
101
|
-
{
|
|
102
|
-
"timestamp": "$(date -Iseconds)",
|
|
103
|
-
"progress": $progress,
|
|
104
|
-
"domains": {
|
|
105
|
-
${domain_scores%,*}
|
|
106
|
-
},
|
|
107
|
-
"completed": $completed_domains,
|
|
108
|
-
"total": ${#DOMAINS[@]},
|
|
109
|
-
"artifacts": {
|
|
110
|
-
"entities": $entities,
|
|
111
|
-
"valueObjects": $value_objects,
|
|
112
|
-
"aggregates": $aggregates,
|
|
113
|
-
"repositories": $repositories,
|
|
114
|
-
"services": $services,
|
|
115
|
-
"domainEvents": $events
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
EOF
|
|
119
|
-
|
|
120
|
-
# Update v3-progress.json
|
|
121
|
-
if [ -f "$V3_PROGRESS" ] && command -v jq &>/dev/null; then
|
|
122
|
-
jq --argjson progress "$progress" --argjson completed "$completed_domains" \
|
|
123
|
-
'.ddd.progress = $progress | .domains.completed = $completed' \
|
|
124
|
-
"$V3_PROGRESS" > "$V3_PROGRESS.tmp" && mv "$V3_PROGRESS.tmp" "$V3_PROGRESS"
|
|
125
|
-
fi
|
|
126
|
-
|
|
127
|
-
echo "[$(date +%H:%M:%S)] ✓ DDD: ${progress}% | Domains: $completed_domains/${#DOMAINS[@]} | Entities: $entities | Services: $services"
|
|
128
|
-
|
|
129
|
-
date +%s > "$LAST_RUN_FILE"
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
case "${1:-check}" in
|
|
133
|
-
"run"|"track") track_ddd ;;
|
|
134
|
-
"check") should_run && track_ddd || echo "[$(date +%H:%M:%S)] Skipping (throttled)" ;;
|
|
135
|
-
"force") rm -f "$LAST_RUN_FILE"; track_ddd ;;
|
|
136
|
-
"status")
|
|
137
|
-
if [ -f "$DDD_FILE" ]; then
|
|
138
|
-
jq -r '"Progress: \(.progress)% | Domains: \(.completed)/\(.total) | Entities: \(.artifacts.entities) | Services: \(.artifacts.services)"' "$DDD_FILE"
|
|
139
|
-
else
|
|
140
|
-
echo "No DDD data available"
|
|
141
|
-
fi
|
|
142
|
-
;;
|
|
143
|
-
*) echo "Usage: $0 [run|check|force|status]" ;;
|
|
144
|
-
esac
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Safe GitHub CLI Helper
|
|
5
|
-
* Prevents timeout issues when using gh commands with special characters
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* ./github-safe.js issue comment 123 "Message with `backticks`"
|
|
9
|
-
* ./github-safe.js pr create --title "Title" --body "Complex body"
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { execSync } from 'child_process';
|
|
13
|
-
import { writeFileSync, unlinkSync } from 'fs';
|
|
14
|
-
import { tmpdir } from 'os';
|
|
15
|
-
import { join } from 'path';
|
|
16
|
-
import { randomBytes } from 'crypto';
|
|
17
|
-
|
|
18
|
-
const args = process.argv.slice(2);
|
|
19
|
-
|
|
20
|
-
if (args.length < 2) {
|
|
21
|
-
console.log(`
|
|
22
|
-
Safe GitHub CLI Helper
|
|
23
|
-
|
|
24
|
-
Usage:
|
|
25
|
-
./github-safe.js issue comment <number> <body>
|
|
26
|
-
./github-safe.js pr comment <number> <body>
|
|
27
|
-
./github-safe.js issue create --title <title> --body <body>
|
|
28
|
-
./github-safe.js pr create --title <title> --body <body>
|
|
29
|
-
|
|
30
|
-
This helper prevents timeout issues with special characters like:
|
|
31
|
-
- Backticks in code examples
|
|
32
|
-
- Command substitution \$(...)
|
|
33
|
-
- Directory paths
|
|
34
|
-
- Special shell characters
|
|
35
|
-
`);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const [command, subcommand, ...restArgs] = args;
|
|
40
|
-
|
|
41
|
-
// Handle commands that need body content
|
|
42
|
-
if ((command === 'issue' || command === 'pr') &&
|
|
43
|
-
(subcommand === 'comment' || subcommand === 'create')) {
|
|
44
|
-
|
|
45
|
-
let bodyIndex = -1;
|
|
46
|
-
let body = '';
|
|
47
|
-
|
|
48
|
-
if (subcommand === 'comment' && restArgs.length >= 2) {
|
|
49
|
-
// Simple format: github-safe.js issue comment 123 "body"
|
|
50
|
-
body = restArgs[1];
|
|
51
|
-
bodyIndex = 1;
|
|
52
|
-
} else {
|
|
53
|
-
// Flag format: --body "content"
|
|
54
|
-
bodyIndex = restArgs.indexOf('--body');
|
|
55
|
-
if (bodyIndex !== -1 && bodyIndex < restArgs.length - 1) {
|
|
56
|
-
body = restArgs[bodyIndex + 1];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (body) {
|
|
61
|
-
// Use temporary file for body content
|
|
62
|
-
const tmpFile = join(tmpdir(), `gh-body-${randomBytes(8).toString('hex')}.tmp`);
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
writeFileSync(tmpFile, body, 'utf8');
|
|
66
|
-
|
|
67
|
-
// Build new command with --body-file
|
|
68
|
-
const newArgs = [...restArgs];
|
|
69
|
-
if (subcommand === 'comment' && bodyIndex === 1) {
|
|
70
|
-
// Replace body with --body-file
|
|
71
|
-
newArgs[1] = '--body-file';
|
|
72
|
-
newArgs.push(tmpFile);
|
|
73
|
-
} else if (bodyIndex !== -1) {
|
|
74
|
-
// Replace --body with --body-file
|
|
75
|
-
newArgs[bodyIndex] = '--body-file';
|
|
76
|
-
newArgs[bodyIndex + 1] = tmpFile;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Execute safely
|
|
80
|
-
const ghCommand = `gh ${command} ${subcommand} ${newArgs.join(' ')}`;
|
|
81
|
-
console.log(`Executing: ${ghCommand}`);
|
|
82
|
-
|
|
83
|
-
const result = execSync(ghCommand, {
|
|
84
|
-
stdio: 'inherit',
|
|
85
|
-
timeout: 30000 // 30 second timeout
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error('Error:', error.message);
|
|
90
|
-
process.exit(1);
|
|
91
|
-
} finally {
|
|
92
|
-
// Clean up
|
|
93
|
-
try {
|
|
94
|
-
unlinkSync(tmpFile);
|
|
95
|
-
} catch (e) {
|
|
96
|
-
// Ignore cleanup errors
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
// No body content, execute normally
|
|
101
|
-
execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
104
|
-
// Other commands, execute normally
|
|
105
|
-
execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
|
|
106
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Setup GitHub integration for Claude Flow
|
|
3
|
-
|
|
4
|
-
echo "🔗 Setting up GitHub integration..."
|
|
5
|
-
|
|
6
|
-
# Check for gh CLI
|
|
7
|
-
if ! command -v gh &> /dev/null; then
|
|
8
|
-
echo "⚠️ GitHub CLI (gh) not found"
|
|
9
|
-
echo "Install from: https://cli.github.com/"
|
|
10
|
-
echo "Continuing without GitHub features..."
|
|
11
|
-
else
|
|
12
|
-
echo "✅ GitHub CLI found"
|
|
13
|
-
|
|
14
|
-
# Check auth status
|
|
15
|
-
if gh auth status &> /dev/null; then
|
|
16
|
-
echo "✅ GitHub authentication active"
|
|
17
|
-
else
|
|
18
|
-
echo "⚠️ Not authenticated with GitHub"
|
|
19
|
-
echo "Run: gh auth login"
|
|
20
|
-
fi
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
echo ""
|
|
24
|
-
echo "📦 GitHub swarm commands available:"
|
|
25
|
-
echo " - npx claude-flow github swarm"
|
|
26
|
-
echo " - npx claude-flow repo analyze"
|
|
27
|
-
echo " - npx claude-flow pr enhance"
|
|
28
|
-
echo " - npx claude-flow issue triage"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Capture hook guidance for Claude visibility
|
|
3
|
-
GUIDANCE_FILE=".claude-flow/last-guidance.txt"
|
|
4
|
-
mkdir -p .claude-flow
|
|
5
|
-
|
|
6
|
-
case "$1" in
|
|
7
|
-
"route")
|
|
8
|
-
npx agentic-flow@alpha hooks route "$2" 2>&1 | tee "$GUIDANCE_FILE"
|
|
9
|
-
;;
|
|
10
|
-
"pre-edit")
|
|
11
|
-
npx agentic-flow@alpha hooks pre-edit "$2" 2>&1 | tee "$GUIDANCE_FILE"
|
|
12
|
-
;;
|
|
13
|
-
esac
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Guidance Hooks for RuFlo V3
|
|
3
|
-
# Provides context and routing for Claude Code operations
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
7
|
-
CACHE_DIR="$PROJECT_ROOT/.claude-flow"
|
|
8
|
-
|
|
9
|
-
# Ensure cache directory exists
|
|
10
|
-
mkdir -p "$CACHE_DIR" 2>/dev/null || true
|
|
11
|
-
|
|
12
|
-
# Color codes
|
|
13
|
-
CYAN='\033[0;36m'
|
|
14
|
-
GREEN='\033[0;32m'
|
|
15
|
-
YELLOW='\033[1;33m'
|
|
16
|
-
RED='\033[0;31m'
|
|
17
|
-
RESET='\033[0m'
|
|
18
|
-
DIM='\033[2m'
|
|
19
|
-
|
|
20
|
-
# Get command
|
|
21
|
-
COMMAND="${1:-help}"
|
|
22
|
-
shift || true
|
|
23
|
-
|
|
24
|
-
case "$COMMAND" in
|
|
25
|
-
pre-edit)
|
|
26
|
-
FILE_PATH="$1"
|
|
27
|
-
if [[ -n "$FILE_PATH" ]]; then
|
|
28
|
-
if [[ "$FILE_PATH" =~ (config|secret|credential|password|key|auth) ]]; then
|
|
29
|
-
echo -e "${YELLOW}[Guidance] Security-sensitive file${RESET}"
|
|
30
|
-
fi
|
|
31
|
-
if [[ "$FILE_PATH" =~ ^v3/ ]]; then
|
|
32
|
-
echo -e "${CYAN}[Guidance] V3 module - follow ADR guidelines${RESET}"
|
|
33
|
-
fi
|
|
34
|
-
fi
|
|
35
|
-
exit 0
|
|
36
|
-
;;
|
|
37
|
-
|
|
38
|
-
post-edit)
|
|
39
|
-
FILE_PATH="$1"
|
|
40
|
-
echo "$(date -Iseconds) edit $FILE_PATH" >> "$CACHE_DIR/edit-history.log" 2>/dev/null || true
|
|
41
|
-
exit 0
|
|
42
|
-
;;
|
|
43
|
-
|
|
44
|
-
pre-command)
|
|
45
|
-
COMMAND_STR="$1"
|
|
46
|
-
if [[ "$COMMAND_STR" =~ (rm -rf|sudo|chmod 777) ]]; then
|
|
47
|
-
echo -e "${RED}[Guidance] High-risk command${RESET}"
|
|
48
|
-
fi
|
|
49
|
-
exit 0
|
|
50
|
-
;;
|
|
51
|
-
|
|
52
|
-
route)
|
|
53
|
-
TASK="$1"
|
|
54
|
-
[[ -z "$TASK" ]] && exit 0
|
|
55
|
-
if [[ "$TASK" =~ (security|CVE|vulnerability) ]]; then
|
|
56
|
-
echo -e "${DIM}[Route] security-architect${RESET}"
|
|
57
|
-
elif [[ "$TASK" =~ (memory|AgentDB|HNSW|vector) ]]; then
|
|
58
|
-
echo -e "${DIM}[Route] memory-specialist${RESET}"
|
|
59
|
-
elif [[ "$TASK" =~ (performance|optimize|benchmark) ]]; then
|
|
60
|
-
echo -e "${DIM}[Route] performance-engineer${RESET}"
|
|
61
|
-
elif [[ "$TASK" =~ (test|TDD|spec) ]]; then
|
|
62
|
-
echo -e "${DIM}[Route] test-architect${RESET}"
|
|
63
|
-
fi
|
|
64
|
-
exit 0
|
|
65
|
-
;;
|
|
66
|
-
|
|
67
|
-
session-context)
|
|
68
|
-
cat << 'EOF'
|
|
69
|
-
## V3 Development Context
|
|
70
|
-
|
|
71
|
-
**Architecture**: Domain-Driven Design with 15 @claude-flow modules
|
|
72
|
-
**Priority**: Security-first (CVE-1, CVE-2, CVE-3 remediation)
|
|
73
|
-
**Performance Targets**:
|
|
74
|
-
- HNSW search: 150x-12,500x faster
|
|
75
|
-
- Flash Attention: 2.49x-7.47x speedup
|
|
76
|
-
- Memory: 50-75% reduction
|
|
77
|
-
|
|
78
|
-
**Active Patterns**:
|
|
79
|
-
- Use TDD London School (mock-first)
|
|
80
|
-
- Event sourcing for state changes
|
|
81
|
-
- agentic-flow@alpha as core foundation
|
|
82
|
-
- Bounded contexts with clear interfaces
|
|
83
|
-
|
|
84
|
-
**Code Quality Rules**:
|
|
85
|
-
- Files under 500 lines
|
|
86
|
-
- No hardcoded secrets
|
|
87
|
-
- Input validation at boundaries
|
|
88
|
-
- Typed interfaces for all public APIs
|
|
89
|
-
|
|
90
|
-
**Learned Patterns**: 17 available for reference
|
|
91
|
-
EOF
|
|
92
|
-
exit 0
|
|
93
|
-
;;
|
|
94
|
-
|
|
95
|
-
user-prompt)
|
|
96
|
-
exit 0
|
|
97
|
-
;;
|
|
98
|
-
|
|
99
|
-
*)
|
|
100
|
-
exit 0
|
|
101
|
-
;;
|
|
102
|
-
esac
|