claude-flow 2.7.0-alpha.11 β†’ 2.7.0-alpha.13

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.
@@ -0,0 +1,175 @@
1
+ #!/bin/bash
2
+
3
+ # Read JSON input from stdin
4
+ INPUT=$(cat)
5
+ MODEL=$(echo "$INPUT" | jq -r '.model.display_name // "Claude"')
6
+ CWD=$(echo "$INPUT" | jq -r '.workspace.current_dir // .cwd')
7
+ DIR=$(basename "$CWD")
8
+
9
+ # Replace claude-code-flow with branded name
10
+ if [ "$DIR" = "claude-code-flow" ]; then
11
+ DIR="🌊 Claude Flow"
12
+ fi
13
+
14
+ # Get git branch
15
+ BRANCH=$(cd "$CWD" 2>/dev/null && git branch --show-current 2>/dev/null)
16
+
17
+ # Start building statusline
18
+ echo -ne "\033[1m$MODEL\033[0m in \033[36m$DIR\033[0m"
19
+ [ -n "$BRANCH" ] && echo -ne " on \033[33mβŽ‡ $BRANCH\033[0m"
20
+
21
+ # Claude-Flow integration
22
+ FLOW_DIR="$CWD/.claude-flow"
23
+
24
+ if [ -d "$FLOW_DIR" ]; then
25
+ echo -ne " β”‚"
26
+
27
+ # 1. Swarm Configuration & Topology
28
+ if [ -f "$FLOW_DIR/swarm-config.json" ]; then
29
+ STRATEGY=$(jq -r '.defaultStrategy // empty' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
30
+ if [ -n "$STRATEGY" ]; then
31
+ # Map strategy to topology icon
32
+ case "$STRATEGY" in
33
+ "balanced") TOPO_ICON="⚑mesh" ;;
34
+ "conservative") TOPO_ICON="⚑hier" ;;
35
+ "aggressive") TOPO_ICON="⚑ring" ;;
36
+ *) TOPO_ICON="⚑$STRATEGY" ;;
37
+ esac
38
+ echo -ne " \033[35m$TOPO_ICON\033[0m"
39
+
40
+ # Count agent profiles as "configured agents"
41
+ AGENT_COUNT=$(jq -r '.agentProfiles | length' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
42
+ if [ -n "$AGENT_COUNT" ] && [ "$AGENT_COUNT" != "null" ] && [ "$AGENT_COUNT" -gt 0 ]; then
43
+ echo -ne " \033[35mπŸ€– $AGENT_COUNT\033[0m"
44
+ fi
45
+ fi
46
+ fi
47
+
48
+ # 2. Real-time System Metrics
49
+ if [ -f "$FLOW_DIR/metrics/system-metrics.json" ]; then
50
+ # Get latest metrics (last entry in array)
51
+ LATEST=$(jq -r '.[-1]' "$FLOW_DIR/metrics/system-metrics.json" 2>/dev/null)
52
+
53
+ if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
54
+ # Memory usage
55
+ MEM_PERCENT=$(echo "$LATEST" | jq -r '.memoryUsagePercent // 0' | awk '{printf "%.0f", $1}')
56
+ if [ -n "$MEM_PERCENT" ] && [ "$MEM_PERCENT" != "null" ]; then
57
+ # Color-coded memory (green <60%, yellow 60-80%, red >80%)
58
+ if [ "$MEM_PERCENT" -lt 60 ]; then
59
+ MEM_COLOR="\033[32m" # Green
60
+ elif [ "$MEM_PERCENT" -lt 80 ]; then
61
+ MEM_COLOR="\033[33m" # Yellow
62
+ else
63
+ MEM_COLOR="\033[31m" # Red
64
+ fi
65
+ echo -ne " ${MEM_COLOR}πŸ’Ύ ${MEM_PERCENT}%\033[0m"
66
+ fi
67
+
68
+ # CPU load
69
+ CPU_LOAD=$(echo "$LATEST" | jq -r '.cpuLoad // 0' | awk '{printf "%.0f", $1 * 100}')
70
+ if [ -n "$CPU_LOAD" ] && [ "$CPU_LOAD" != "null" ]; then
71
+ # Color-coded CPU (green <50%, yellow 50-75%, red >75%)
72
+ if [ "$CPU_LOAD" -lt 50 ]; then
73
+ CPU_COLOR="\033[32m" # Green
74
+ elif [ "$CPU_LOAD" -lt 75 ]; then
75
+ CPU_COLOR="\033[33m" # Yellow
76
+ else
77
+ CPU_COLOR="\033[31m" # Red
78
+ fi
79
+ echo -ne " ${CPU_COLOR}βš™ ${CPU_LOAD}%\033[0m"
80
+ fi
81
+ fi
82
+ fi
83
+
84
+ # 3. Session State
85
+ if [ -f "$FLOW_DIR/session-state.json" ]; then
86
+ SESSION_ID=$(jq -r '.sessionId // empty' "$FLOW_DIR/session-state.json" 2>/dev/null)
87
+ ACTIVE=$(jq -r '.active // false' "$FLOW_DIR/session-state.json" 2>/dev/null)
88
+
89
+ if [ "$ACTIVE" = "true" ] && [ -n "$SESSION_ID" ]; then
90
+ # Show abbreviated session ID
91
+ SHORT_ID=$(echo "$SESSION_ID" | cut -d'-' -f1)
92
+ echo -ne " \033[34mπŸ”„ $SHORT_ID\033[0m"
93
+ fi
94
+ fi
95
+
96
+ # 4. Performance Metrics from task-metrics.json
97
+ if [ -f "$FLOW_DIR/metrics/task-metrics.json" ]; then
98
+ # Parse task metrics for success rate, avg time, and streak
99
+ METRICS=$(jq -r '
100
+ # Calculate metrics
101
+ (map(select(.success == true)) | length) as $successful |
102
+ (length) as $total |
103
+ (if $total > 0 then ($successful / $total * 100) else 0 end) as $success_rate |
104
+ (map(.duration // 0) | add / length) as $avg_duration |
105
+ # Calculate streak (consecutive successes from end)
106
+ (reverse |
107
+ reduce .[] as $task (0;
108
+ if $task.success == true then . + 1 else 0 end
109
+ )
110
+ ) as $streak |
111
+ {
112
+ success_rate: $success_rate,
113
+ avg_duration: $avg_duration,
114
+ streak: $streak,
115
+ total: $total
116
+ } | @json
117
+ ' "$FLOW_DIR/metrics/task-metrics.json" 2>/dev/null)
118
+
119
+ if [ -n "$METRICS" ] && [ "$METRICS" != "null" ]; then
120
+ # Success Rate
121
+ SUCCESS_RATE=$(echo "$METRICS" | jq -r '.success_rate // 0' | awk '{printf "%.0f", $1}')
122
+ TOTAL_TASKS=$(echo "$METRICS" | jq -r '.total // 0')
123
+
124
+ if [ -n "$SUCCESS_RATE" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
125
+ # Color-code: Green (>80%), Yellow (60-80%), Red (<60%)
126
+ if [ "$SUCCESS_RATE" -gt 80 ]; then
127
+ SUCCESS_COLOR="\033[32m" # Green
128
+ elif [ "$SUCCESS_RATE" -ge 60 ]; then
129
+ SUCCESS_COLOR="\033[33m" # Yellow
130
+ else
131
+ SUCCESS_COLOR="\033[31m" # Red
132
+ fi
133
+ echo -ne " ${SUCCESS_COLOR}🎯 ${SUCCESS_RATE}%\033[0m"
134
+ fi
135
+
136
+ # Average Time
137
+ AVG_TIME=$(echo "$METRICS" | jq -r '.avg_duration // 0')
138
+ if [ -n "$AVG_TIME" ] && [ "$TOTAL_TASKS" -gt 0 ]; then
139
+ # Format smartly: seconds, minutes, or hours
140
+ if [ $(echo "$AVG_TIME < 60" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
141
+ TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fs", $1}')
142
+ elif [ $(echo "$AVG_TIME < 3600" | bc -l 2>/dev/null || echo 0) -eq 1 ]; then
143
+ TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fm", $1/60}')
144
+ else
145
+ TIME_STR=$(echo "$AVG_TIME" | awk '{printf "%.1fh", $1/3600}')
146
+ fi
147
+ echo -ne " \033[36m⏱️ $TIME_STR\033[0m"
148
+ fi
149
+
150
+ # Streak (only show if > 0)
151
+ STREAK=$(echo "$METRICS" | jq -r '.streak // 0')
152
+ if [ -n "$STREAK" ] && [ "$STREAK" -gt 0 ]; then
153
+ echo -ne " \033[91mπŸ”₯ $STREAK\033[0m"
154
+ fi
155
+ fi
156
+ fi
157
+
158
+ # 5. Active Tasks (check for task files)
159
+ if [ -d "$FLOW_DIR/tasks" ]; then
160
+ TASK_COUNT=$(find "$FLOW_DIR/tasks" -name "*.json" -type f 2>/dev/null | wc -l)
161
+ if [ "$TASK_COUNT" -gt 0 ]; then
162
+ echo -ne " \033[36mπŸ“‹ $TASK_COUNT\033[0m"
163
+ fi
164
+ fi
165
+
166
+ # 6. Check for hooks activity
167
+ if [ -f "$FLOW_DIR/hooks-state.json" ]; then
168
+ HOOKS_ACTIVE=$(jq -r '.enabled // false' "$FLOW_DIR/hooks-state.json" 2>/dev/null)
169
+ if [ "$HOOKS_ACTIVE" = "true" ]; then
170
+ echo -ne " \033[35mπŸ”—\033[0m"
171
+ fi
172
+ fi
173
+ fi
174
+
175
+ echo
package/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.7.0-alpha.12] - 2025-10-20
9
+
10
+ > **πŸ”§ Critical Bug Fixes**: Skills system and statusline initialization now work correctly in all npm install scenarios
11
+
12
+ ### πŸ› Bug Fixes
13
+
14
+ #### **Skills System Initialization**
15
+ - **Fixed**: Skills copier path resolution in both `bin/init/skills-copier.js` and `src/cli/simple-commands/init/skills-copier.js`
16
+ - Skills now copy correctly from npm package installations (global and local)
17
+ - All 21 built-in skills properly initialize during `npx claude-flow init`
18
+ - Tested and verified in Docker environment
19
+ - Resolves issue where `.claude/skills/` directory remained empty after init
20
+
21
+ #### **Statusline Script Creation**
22
+ - **Fixed**: Statusline script creation with proper bash variable escaping and missing imports
23
+ - Escaped bash variables (`${MEM_COLOR}`, `${CPU_COLOR}`, `${SUCCESS_COLOR}`) to prevent JavaScript template literal conflicts
24
+ - Added missing `path` and `os` module imports in `enhancedClaudeFlowInit()` function
25
+ - Script now creates successfully with executable permissions (755) in both `.claude/` and `~/.claude/`
26
+ - Resolves "⚠️ Could not create statusline script, skipping..." warning during init
27
+ - Verified in Docker with proper file permissions: `-rwxr-xr-x`
28
+
29
+ ### βœ… Verification
30
+ - **Docker Testing**: All fixes validated in isolated Docker environment before publishing
31
+ - **Skills Validation**: All 21 skills copy successfully
32
+ - **Statusline Validation**: Script creates with correct permissions and executable functionality
33
+
8
34
  ## [2.7.0-alpha.11] - 2025-10-20
9
35
 
10
36
  > **🎨 Skills System Integration**: Complete migration from commands to skills + comprehensive documentation
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.7.0-alpha.11"
4
+ VERSION="2.7.0-alpha.13"
5
5
 
6
6
  # Determine the correct path based on how the script is invoked
7
7
  if [ -L "$0" ]; then
@@ -1,7 +1,7 @@
1
1
  {
2
- "startTime": 1760388535754,
3
- "sessionId": "session-1760388535754",
4
- "lastActivity": 1760388535754,
2
+ "startTime": 1760925323833,
3
+ "sessionId": "session-1760925323833",
4
+ "lastActivity": 1760925323833,
5
5
  "sessionDuration": 0,
6
6
  "totalTasks": 1,
7
7
  "successfulTasks": 1,
@@ -1,10 +1,10 @@
1
1
  [
2
2
  {
3
- "id": "cmd-hooks-1760388535858",
3
+ "id": "cmd-hooks-1760925323933",
4
4
  "type": "hooks",
5
5
  "success": true,
6
- "duration": 8.673302000000035,
7
- "timestamp": 1760388535866,
6
+ "duration": 7.107392000000004,
7
+ "timestamp": 1760925323940,
8
8
  "metadata": {}
9
9
  }
10
10
  ]
@@ -0,0 +1,26 @@
1
+ # Dockerfile for testing claude-flow@2.7.0-alpha.11
2
+ # Tests: init command, skills system, MCP server, regressions
3
+
4
+ FROM node:20-slim
5
+
6
+ # Set working directory
7
+ WORKDIR /test
8
+
9
+ # Install required dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ git \
12
+ curl \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Install claude-flow@alpha globally
16
+ RUN npm install -g claude-flow@alpha
17
+
18
+ # Verify version is alpha.11
19
+ RUN claude-flow --version | grep "2.7.0-alpha.11" || exit 1
20
+
21
+ # Create test script
22
+ COPY test-alpha11.sh /test/test-alpha11.sh
23
+ RUN chmod +x /test/test-alpha11.sh
24
+
25
+ # Default command
26
+ CMD ["/test/test-alpha11.sh"]
@@ -0,0 +1,47 @@
1
+ FROM node:20-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ git \
8
+ curl \
9
+ jq \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install claude-flow@2.7.0-alpha.12 from npm
13
+ RUN npm install -g claude-flow@2.7.0-alpha.12
14
+
15
+ # Verify version
16
+ RUN claude-flow --version
17
+
18
+ # Create test directory
19
+ WORKDIR /test
20
+
21
+ # Test the init command
22
+ CMD echo "Testing claude-flow@2.7.0-alpha.12 from npm registry..." && \
23
+ claude-flow init --skip-open --project-name alpha12-test && \
24
+ echo "" && \
25
+ echo "========================================" && \
26
+ echo "βœ… VERIFICATION RESULTS" && \
27
+ echo "========================================" && \
28
+ echo "" && \
29
+ echo "πŸ“ Directory Structure:" && \
30
+ ls -la .claude/ && \
31
+ echo "" && \
32
+ echo "πŸ“‹ Skills Directory:" && \
33
+ ls -la .claude/skills/ 2>/dev/null || echo "⚠️ Skills directory not found" && \
34
+ echo "" && \
35
+ echo "πŸ“Š Skills Count:" && \
36
+ find .claude/skills -name "SKILL.md" 2>/dev/null | wc -l && \
37
+ echo "" && \
38
+ echo "πŸ”§ Statusline Script:" && \
39
+ ls -lh .claude/statusline-command.sh && \
40
+ stat -c "Permissions: %a" .claude/statusline-command.sh && \
41
+ echo "" && \
42
+ echo "✨ Testing statusline execution:" && \
43
+ bash .claude/statusline-command.sh <<< '{"model": {"display_name": "Claude"}, "workspace": {"current_dir": "/test"}}' && \
44
+ echo "" && \
45
+ echo "========================================" && \
46
+ echo "βœ… All tests passed!" && \
47
+ echo "========================================"
@@ -0,0 +1,42 @@
1
+ # Dockerfile for testing LOCAL claude-flow (with skills-copier fix)
2
+ # Tests the fix BEFORE publishing to npm
3
+
4
+ FROM node:20-slim
5
+
6
+ # Set working directory
7
+ WORKDIR /app
8
+
9
+ # Install required dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ git \
12
+ curl \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Copy package files first (for better layer caching)
16
+ COPY package.json package-lock.json ./
17
+
18
+ # Copy source files
19
+ COPY bin/ ./bin/
20
+ COPY src/ ./src/
21
+ COPY .claude/ ./.claude/
22
+ COPY scripts/ ./scripts/
23
+ COPY docs/ ./docs/
24
+
25
+ # Install dependencies (use legacy-peer-deps to avoid conflicts in Docker)
26
+ RUN npm install --legacy-peer-deps
27
+
28
+ # Link locally so we can test with npx/global commands
29
+ RUN npm link
30
+
31
+ # Verify local version
32
+ RUN claude-flow --version
33
+
34
+ # Create test directory
35
+ WORKDIR /test
36
+
37
+ # Create test script
38
+ COPY docker-test/test-local-fix.sh /test/test-local-fix.sh
39
+ RUN chmod +x /test/test-local-fix.sh
40
+
41
+ # Default command
42
+ CMD ["/test/test-local-fix.sh"]
@@ -0,0 +1,244 @@
1
+ #!/bin/bash
2
+ # Test script for claude-flow@2.7.0-alpha.11
3
+
4
+ set -e # Exit on error
5
+
6
+ echo "=================================================="
7
+ echo "🐳 Testing claude-flow@2.7.0-alpha.11 in Docker"
8
+ echo "=================================================="
9
+ echo ""
10
+
11
+ # Color codes
12
+ GREEN='\033[0;32m'
13
+ RED='\033[0;31m'
14
+ YELLOW='\033[1;33m'
15
+ NC='\033[0m' # No Color
16
+
17
+ # Test counter
18
+ PASSED=0
19
+ FAILED=0
20
+
21
+ # Helper functions
22
+ pass() {
23
+ echo -e "${GREEN}βœ… PASS:${NC} $1"
24
+ ((PASSED++))
25
+ }
26
+
27
+ fail() {
28
+ echo -e "${RED}❌ FAIL:${NC} $1"
29
+ ((FAILED++))
30
+ }
31
+
32
+ info() {
33
+ echo -e "${YELLOW}ℹ️ INFO:${NC} $1"
34
+ }
35
+
36
+ section() {
37
+ echo ""
38
+ echo "=================================================="
39
+ echo "πŸ” $1"
40
+ echo "=================================================="
41
+ }
42
+
43
+ # Test 1: Version Check
44
+ section "Test 1: Version Check"
45
+ VERSION=$(claude-flow --version 2>&1 | grep -oP '\d+\.\d+\.\d+-alpha\.\d+' || echo "unknown")
46
+ if [ "$VERSION" = "2.7.0-alpha.11" ]; then
47
+ pass "Version is 2.7.0-alpha.11"
48
+ else
49
+ fail "Version is $VERSION, expected 2.7.0-alpha.11"
50
+ fi
51
+
52
+ # Test 2: Init Command
53
+ section "Test 2: Init Command Creates Directory Structure"
54
+ cd /test
55
+ npx claude-flow init --skip-open --project-name "test-project" 2>&1 || true
56
+
57
+ # Check .claude directory created
58
+ if [ -d ".claude" ]; then
59
+ pass ".claude directory created"
60
+ else
61
+ fail ".claude directory not created"
62
+ fi
63
+
64
+ # Check subdirectories
65
+ EXPECTED_DIRS=("agents" "commands" "skills" "checkpoints" "cache")
66
+ for dir in "${EXPECTED_DIRS[@]}"; do
67
+ if [ -d ".claude/$dir" ]; then
68
+ pass ".claude/$dir directory created"
69
+ else
70
+ fail ".claude/$dir directory not created"
71
+ fi
72
+ done
73
+
74
+ # Test 3: Skills Files
75
+ section "Test 3: Skills System Files"
76
+
77
+ # Count skills files
78
+ SKILL_COUNT=$(find .claude/skills -name "SKILL.md" 2>/dev/null | wc -l)
79
+ if [ "$SKILL_COUNT" -gt 0 ]; then
80
+ pass "Found $SKILL_COUNT skill files"
81
+ else
82
+ fail "No skill files found in .claude/skills/"
83
+ fi
84
+
85
+ # Check for specific important skills
86
+ CRITICAL_SKILLS=(
87
+ "agentdb-vector-search/SKILL.md"
88
+ "swarm-orchestration/SKILL.md"
89
+ "sparc-methodology/SKILL.md"
90
+ "skill-builder/SKILL.md"
91
+ )
92
+
93
+ for skill in "${CRITICAL_SKILLS[@]}"; do
94
+ if [ -f ".claude/skills/$skill" ]; then
95
+ pass "Critical skill exists: $skill"
96
+ else
97
+ fail "Missing critical skill: $skill"
98
+ fi
99
+ done
100
+
101
+ # Test 4: SKILL.md YAML Frontmatter Validation
102
+ section "Test 4: YAML Frontmatter Validation"
103
+
104
+ VALID_SKILLS=0
105
+ INVALID_SKILLS=0
106
+
107
+ for skill_file in .claude/skills/*/SKILL.md; do
108
+ if [ -f "$skill_file" ]; then
109
+ # Check for YAML frontmatter
110
+ if head -n 5 "$skill_file" | grep -q "^---$"; then
111
+ # Check for name field
112
+ if head -n 20 "$skill_file" | grep -q "^name:"; then
113
+ # Check for description field
114
+ if head -n 20 "$skill_file" | grep -q "^description:"; then
115
+ ((VALID_SKILLS++))
116
+ else
117
+ info "Missing description in: $skill_file"
118
+ ((INVALID_SKILLS++))
119
+ fi
120
+ else
121
+ info "Missing name in: $skill_file"
122
+ ((INVALID_SKILLS++))
123
+ fi
124
+ else
125
+ info "Missing YAML frontmatter in: $skill_file"
126
+ ((INVALID_SKILLS++))
127
+ fi
128
+ fi
129
+ done
130
+
131
+ if [ $INVALID_SKILLS -eq 0 ]; then
132
+ pass "All $VALID_SKILLS skills have valid YAML frontmatter"
133
+ else
134
+ fail "$INVALID_SKILLS skills have invalid YAML frontmatter"
135
+ fi
136
+
137
+ # Test 5: Memory Commands
138
+ section "Test 5: Memory System (Regression Test)"
139
+
140
+ # Test memory store
141
+ npx claude-flow memory store test-key "test value" --namespace test 2>&1 > /tmp/memory-test.log || true
142
+ if grep -q "Stored" /tmp/memory-test.log || grep -q "stored" /tmp/memory-test.log || grep -q "success" /tmp/memory-test.log; then
143
+ pass "Memory store command works"
144
+ else
145
+ info "Memory store output: $(cat /tmp/memory-test.log)"
146
+ fail "Memory store command failed"
147
+ fi
148
+
149
+ # Test 6: Help Command
150
+ section "Test 6: Help Command (Regression Test)"
151
+ npx claude-flow --help > /tmp/help.txt 2>&1
152
+ if grep -q "claude-flow" /tmp/help.txt; then
153
+ pass "Help command works"
154
+ else
155
+ fail "Help command failed"
156
+ fi
157
+
158
+ # Test 7: Init Help
159
+ section "Test 7: Init Help (Regression Test)"
160
+ npx claude-flow init --help > /tmp/init-help.txt 2>&1
161
+ if grep -q "init" /tmp/init-help.txt; then
162
+ pass "Init help command works"
163
+ else
164
+ fail "Init help command failed"
165
+ fi
166
+
167
+ # Test 8: File Structure Validation
168
+ section "Test 8: File Structure Validation"
169
+
170
+ # Check that important files exist
171
+ IMPORTANT_FILES=(
172
+ ".claude/settings.json"
173
+ )
174
+
175
+ for file in "${IMPORTANT_FILES[@]}"; do
176
+ if [ -f "$file" ]; then
177
+ pass "Important file exists: $file"
178
+ else
179
+ info "Optional file not found: $file (may be created on first use)"
180
+ fi
181
+ done
182
+
183
+ # Test 9: Agents Directory
184
+ section "Test 9: Agents Directory Structure"
185
+ AGENT_COUNT=$(find .claude/agents -name "*.md" 2>/dev/null | wc -l)
186
+ if [ "$AGENT_COUNT" -gt 0 ]; then
187
+ pass "Found $AGENT_COUNT agent files"
188
+ else
189
+ fail "No agent files found"
190
+ fi
191
+
192
+ # Test 10: Package Integrity
193
+ section "Test 10: Package Integrity"
194
+ if npm list -g claude-flow 2>&1 | grep -q "claude-flow@2.7.0-alpha.11"; then
195
+ pass "Package installed correctly"
196
+ else
197
+ fail "Package not installed correctly"
198
+ fi
199
+
200
+ # Test 11: Skills Content Validation
201
+ section "Test 11: Skills Content Validation"
202
+
203
+ # Check that skills have content (not just frontmatter)
204
+ SKILLS_WITH_CONTENT=0
205
+ for skill_file in .claude/skills/*/SKILL.md; do
206
+ if [ -f "$skill_file" ]; then
207
+ LINE_COUNT=$(wc -l < "$skill_file")
208
+ if [ "$LINE_COUNT" -gt 20 ]; then
209
+ ((SKILLS_WITH_CONTENT++))
210
+ fi
211
+ fi
212
+ done
213
+
214
+ if [ $SKILLS_WITH_CONTENT -gt 15 ]; then
215
+ pass "$SKILLS_WITH_CONTENT skills have substantial content"
216
+ else
217
+ fail "Only $SKILLS_WITH_CONTENT skills have substantial content (expected 15+)"
218
+ fi
219
+
220
+ # Test 12: ReasoningBank Integration
221
+ section "Test 12: ReasoningBank Integration (Regression Test)"
222
+ npx claude-flow memory query "test" --reasoningbank 2>&1 > /tmp/rb-test.log || true
223
+ if grep -q "No results" /tmp/rb-test.log || grep -q "Found" /tmp/rb-test.log || grep -q "Querying" /tmp/rb-test.log; then
224
+ pass "ReasoningBank integration works"
225
+ else
226
+ info "ReasoningBank output: $(cat /tmp/rb-test.log)"
227
+ fail "ReasoningBank integration failed"
228
+ fi
229
+
230
+ # Test Summary
231
+ section "Test Summary"
232
+ echo ""
233
+ echo "Total Tests Run: $((PASSED + FAILED))"
234
+ echo -e "${GREEN}Passed: $PASSED${NC}"
235
+ echo -e "${RED}Failed: $FAILED${NC}"
236
+ echo ""
237
+
238
+ if [ $FAILED -eq 0 ]; then
239
+ echo -e "${GREEN}πŸŽ‰ All tests passed!${NC}"
240
+ exit 0
241
+ else
242
+ echo -e "${RED}❌ Some tests failed${NC}"
243
+ exit 1
244
+ fi
@@ -0,0 +1,235 @@
1
+ #!/bin/bash
2
+ # Test script for LOCAL claude-flow (skills-copier fix validation)
3
+
4
+ set -e # Exit on error
5
+
6
+ echo "=========================================="
7
+ echo "πŸ”§ Testing LOCAL claude-flow Skills Fix"
8
+ echo "=========================================="
9
+ echo ""
10
+
11
+ # Color codes
12
+ GREEN='\033[0;32m'
13
+ RED='\033[0;31m'
14
+ YELLOW='\033[1;33m'
15
+ NC='\033[0m' # No Color
16
+
17
+ # Test counter
18
+ PASSED=0
19
+ FAILED=0
20
+
21
+ # Helper functions
22
+ pass() {
23
+ echo -e "${GREEN}βœ… PASS:${NC} $1"
24
+ ((PASSED++))
25
+ }
26
+
27
+ fail() {
28
+ echo -e "${RED}❌ FAIL:${NC} $1"
29
+ ((FAILED++))
30
+ }
31
+
32
+ info() {
33
+ echo -e "${YELLOW}ℹ️ INFO:${NC} $1"
34
+ }
35
+
36
+ section() {
37
+ echo ""
38
+ echo "=========================================="
39
+ echo "πŸ” $1"
40
+ echo "=========================================="
41
+ }
42
+
43
+ # Test 1: Version Check
44
+ section "Test 1: Version Check"
45
+ VERSION=$(claude-flow --version 2>&1)
46
+ info "Version: $VERSION"
47
+ if [[ "$VERSION" == *"2.7.0-alpha.11"* ]]; then
48
+ pass "Version detected"
49
+ else
50
+ fail "Unexpected version: $VERSION"
51
+ fi
52
+
53
+ # Test 2: Init Command
54
+ section "Test 2: Init Command with Skills System"
55
+ cd /test
56
+
57
+ # Run init with verbose output
58
+ info "Running: npx claude-flow init --skip-open --project-name test-project"
59
+ npx claude-flow init --skip-open --project-name "test-project" 2>&1 | tee /tmp/init-output.log
60
+
61
+ echo ""
62
+ info "Init output saved to /tmp/init-output.log"
63
+ echo ""
64
+
65
+ # Test 3: Directory Structure
66
+ section "Test 3: Directory Structure Created"
67
+
68
+ # Check .claude directory created
69
+ if [ -d ".claude" ]; then
70
+ pass ".claude directory created"
71
+ else
72
+ fail ".claude directory not created"
73
+ exit 1
74
+ fi
75
+
76
+ # Check subdirectories
77
+ EXPECTED_DIRS=("agents" "commands" "skills" "checkpoints" "cache")
78
+ for dir in "${EXPECTED_DIRS[@]}"; do
79
+ if [ -d ".claude/$dir" ]; then
80
+ pass ".claude/$dir directory created"
81
+ else
82
+ fail ".claude/$dir directory not created"
83
+ fi
84
+ done
85
+
86
+ # Test 4: Skills Files (CRITICAL TEST)
87
+ section "Test 4: Skills Files Created (CRITICAL)"
88
+
89
+ # Count skills directories
90
+ SKILL_DIR_COUNT=$(find .claude/skills -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
91
+ info "Found $SKILL_DIR_COUNT skill directories"
92
+
93
+ # Count SKILL.md files
94
+ SKILL_COUNT=$(find .claude/skills -name "SKILL.md" 2>/dev/null | wc -l)
95
+ if [ "$SKILL_COUNT" -gt 0 ]; then
96
+ pass "✨ Found $SKILL_COUNT skill files (fix is working!)"
97
+ else
98
+ fail "❌ CRITICAL: No skill files found - fix failed!"
99
+ info "Init output:"
100
+ cat /tmp/init-output.log
101
+ exit 1
102
+ fi
103
+
104
+ # Expected minimum skills (should be 21)
105
+ if [ "$SKILL_COUNT" -ge 21 ]; then
106
+ pass "All 21+ skills present"
107
+ else
108
+ fail "Only $SKILL_COUNT skills found (expected 21+)"
109
+ fi
110
+
111
+ # Test 5: Critical Skills Verification
112
+ section "Test 5: Critical Skills Verification"
113
+
114
+ CRITICAL_SKILLS=(
115
+ "agentdb-vector-search/SKILL.md"
116
+ "agentdb-memory-patterns/SKILL.md"
117
+ "swarm-orchestration/SKILL.md"
118
+ "sparc-methodology/SKILL.md"
119
+ "skill-builder/SKILL.md"
120
+ "flow-nexus-platform/SKILL.md"
121
+ "github-code-review/SKILL.md"
122
+ "pair-programming/SKILL.md"
123
+ "hive-mind-advanced/SKILL.md"
124
+ "reasoningbank-intelligence/SKILL.md"
125
+ )
126
+
127
+ for skill in "${CRITICAL_SKILLS[@]}"; do
128
+ if [ -f ".claude/skills/$skill" ]; then
129
+ pass "Critical skill exists: $skill"
130
+ else
131
+ fail "Missing critical skill: $skill"
132
+ fi
133
+ done
134
+
135
+ # Test 6: YAML Frontmatter Validation
136
+ section "Test 6: YAML Frontmatter Validation"
137
+
138
+ VALID_SKILLS=0
139
+ INVALID_SKILLS=0
140
+
141
+ for skill_file in .claude/skills/*/SKILL.md; do
142
+ if [ -f "$skill_file" ]; then
143
+ # Check for YAML frontmatter
144
+ if head -n 5 "$skill_file" | grep -q "^---$"; then
145
+ # Check for name field
146
+ if head -n 20 "$skill_file" | grep -q "^name:"; then
147
+ # Check for description field
148
+ if head -n 20 "$skill_file" | grep -q "^description:"; then
149
+ ((VALID_SKILLS++))
150
+ else
151
+ info "Missing description in: $skill_file"
152
+ ((INVALID_SKILLS++))
153
+ fi
154
+ else
155
+ info "Missing name in: $skill_file"
156
+ ((INVALID_SKILLS++))
157
+ fi
158
+ else
159
+ info "Missing YAML frontmatter in: $skill_file"
160
+ ((INVALID_SKILLS++))
161
+ fi
162
+ fi
163
+ done
164
+
165
+ if [ $INVALID_SKILLS -eq 0 ]; then
166
+ pass "All $VALID_SKILLS skills have valid YAML frontmatter"
167
+ else
168
+ fail "$INVALID_SKILLS skills have invalid YAML frontmatter"
169
+ fi
170
+
171
+ # Test 7: Skills Content Validation
172
+ section "Test 7: Skills Content Validation"
173
+
174
+ SKILLS_WITH_CONTENT=0
175
+ for skill_file in .claude/skills/*/SKILL.md; do
176
+ if [ -f "$skill_file" ]; then
177
+ LINE_COUNT=$(wc -l < "$skill_file")
178
+ if [ "$LINE_COUNT" -gt 20 ]; then
179
+ ((SKILLS_WITH_CONTENT++))
180
+ fi
181
+ fi
182
+ done
183
+
184
+ if [ $SKILLS_WITH_CONTENT -gt 15 ]; then
185
+ pass "$SKILLS_WITH_CONTENT skills have substantial content"
186
+ else
187
+ fail "Only $SKILLS_WITH_CONTENT skills have substantial content (expected 15+)"
188
+ fi
189
+
190
+ # Test 8: Skills Discoverability
191
+ section "Test 8: Skills Discoverability"
192
+
193
+ # List all skill directories
194
+ info "Discovered skills:"
195
+ for skill_dir in .claude/skills/*/; do
196
+ if [ -d "$skill_dir" ]; then
197
+ skill_name=$(basename "$skill_dir")
198
+ if [ -f "$skill_dir/SKILL.md" ]; then
199
+ echo " βœ“ $skill_name"
200
+ fi
201
+ fi
202
+ done
203
+
204
+ # Test 9: File Paths Debug
205
+ section "Test 9: Skills Source Path Validation"
206
+
207
+ info "Checking skills-copier source paths..."
208
+ if grep -q "Using packaged skill files" /tmp/init-output.log; then
209
+ pass "Skills copied from npm package location"
210
+ elif grep -q "Using local development skill files" /tmp/init-output.log; then
211
+ pass "Skills copied from local development location"
212
+ elif grep -q "Using global npm skill files" /tmp/init-output.log; then
213
+ pass "Skills copied from global npm location"
214
+ else
215
+ info "Source path detection:"
216
+ grep "πŸ“ Using" /tmp/init-output.log || echo "No source path logged"
217
+ fi
218
+
219
+ # Test Summary
220
+ section "Test Summary"
221
+ echo ""
222
+ echo "Total Tests Run: $((PASSED + FAILED))"
223
+ echo -e "${GREEN}Passed: $PASSED${NC}"
224
+ echo -e "${RED}Failed: $FAILED${NC}"
225
+ echo ""
226
+
227
+ if [ $FAILED -eq 0 ]; then
228
+ echo -e "${GREEN}πŸŽ‰ All tests passed! Skills-copier fix is working!${NC}"
229
+ echo ""
230
+ echo "βœ… READY TO PUBLISH alpha.12"
231
+ exit 0
232
+ else
233
+ echo -e "${RED}❌ Some tests failed - fix needs more work${NC}"
234
+ exit 1
235
+ fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.7.0-alpha.11",
3
+ "version": "2.7.0-alpha.13",
4
4
  "description": "Enterprise-grade AI agent orchestration with WASM-powered ReasoningBank memory and AgentDB vector database (always uses latest agentic-flow)",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": "cli.mjs",
@@ -173,14 +173,14 @@ fi
173
173
  BRANCH=$(cd "$CWD" 2>/dev/null && git branch --show-current 2>/dev/null)
174
174
 
175
175
  # Start building statusline
176
- echo -ne "\\033[1m$MODEL\\033[0m in \\033[36m$DIR\\033[0m"
177
- [ -n "$BRANCH" ] && echo -ne " on \\033[33mβŽ‡ $BRANCH\\033[0m"
176
+ printf "\\033[1m$MODEL\\033[0m in \\033[36m$DIR\\033[0m"
177
+ [ -n "$BRANCH" ] && printf " on \\033[33mβŽ‡ $BRANCH\\033[0m"
178
178
 
179
179
  # Claude-Flow integration
180
180
  FLOW_DIR="$CWD/.claude-flow"
181
181
 
182
182
  if [ -d "$FLOW_DIR" ]; then
183
- echo -ne " β”‚"
183
+ printf " β”‚"
184
184
 
185
185
  # 1. Swarm Configuration & Topology
186
186
  if [ -f "$FLOW_DIR/swarm-config.json" ]; then
@@ -193,12 +193,12 @@ if [ -d "$FLOW_DIR" ]; then
193
193
  "aggressive") TOPO_ICON="⚑ring" ;;
194
194
  *) TOPO_ICON="⚑$STRATEGY" ;;
195
195
  esac
196
- echo -ne " \\033[35m$TOPO_ICON\\033[0m"
196
+ printf " \\033[35m$TOPO_ICON\\033[0m"
197
197
 
198
198
  # Count agent profiles as "configured agents"
199
199
  AGENT_COUNT=$(jq -r \'.agentProfiles | length\' "$FLOW_DIR/swarm-config.json" 2>/dev/null)
200
200
  if [ -n "$AGENT_COUNT" ] && [ "$AGENT_COUNT" != "null" ] && [ "$AGENT_COUNT" -gt 0 ]; then
201
- echo -ne " \\033[35mπŸ€– $AGENT_COUNT\\033[0m"
201
+ printf " \\033[35mπŸ€– $AGENT_COUNT\\033[0m"
202
202
  fi
203
203
  fi
204
204
  fi
@@ -220,7 +220,7 @@ if [ -d "$FLOW_DIR" ]; then
220
220
  else
221
221
  MEM_COLOR="\\033[31m" # Red
222
222
  fi
223
- echo -ne " ${MEM_COLOR}πŸ’Ύ ${MEM_PERCENT}%\\033[0m"
223
+ printf " \${MEM_COLOR}πŸ’Ύ \${MEM_PERCENT}%\\033[0m"
224
224
  fi
225
225
 
226
226
  # CPU load
@@ -234,7 +234,7 @@ if [ -d "$FLOW_DIR" ]; then
234
234
  else
235
235
  CPU_COLOR="\\033[31m" # Red
236
236
  fi
237
- echo -ne " ${CPU_COLOR}βš™ ${CPU_LOAD}%\\033[0m"
237
+ printf " \${CPU_COLOR}βš™ \${CPU_LOAD}%\\033[0m"
238
238
  fi
239
239
  fi
240
240
  fi
@@ -247,7 +247,7 @@ if [ -d "$FLOW_DIR" ]; then
247
247
  if [ "$ACTIVE" = "true" ] && [ -n "$SESSION_ID" ]; then
248
248
  # Show abbreviated session ID
249
249
  SHORT_ID=$(echo "$SESSION_ID" | cut -d\'-\' -f1)
250
- echo -ne " \\033[34mπŸ”„ $SHORT_ID\\033[0m"
250
+ printf " \\033[34mπŸ”„ $SHORT_ID\\033[0m"
251
251
  fi
252
252
  fi
253
253
 
@@ -288,7 +288,7 @@ if [ -d "$FLOW_DIR" ]; then
288
288
  else
289
289
  SUCCESS_COLOR="\\033[31m" # Red
290
290
  fi
291
- echo -ne " ${SUCCESS_COLOR}🎯 ${SUCCESS_RATE}%\\033[0m"
291
+ printf " \${SUCCESS_COLOR}🎯 \${SUCCESS_RATE}%\\033[0m"
292
292
  fi
293
293
 
294
294
  # Average Time
@@ -302,13 +302,13 @@ if [ -d "$FLOW_DIR" ]; then
302
302
  else
303
303
  TIME_STR=$(echo "$AVG_TIME" | awk \'{printf "%.1fh", $1/3600}\')
304
304
  fi
305
- echo -ne " \\033[36m⏱️ $TIME_STR\\033[0m"
305
+ printf " \\033[36m⏱️ $TIME_STR\\033[0m"
306
306
  fi
307
307
 
308
308
  # Streak (only show if > 0)
309
309
  STREAK=$(echo "$METRICS" | jq -r \'.streak // 0\')
310
310
  if [ -n "$STREAK" ] && [ "$STREAK" -gt 0 ]; then
311
- echo -ne " \\033[91mπŸ”₯ $STREAK\\033[0m"
311
+ printf " \\033[91mπŸ”₯ $STREAK\\033[0m"
312
312
  fi
313
313
  fi
314
314
  fi
@@ -317,7 +317,7 @@ if [ -d "$FLOW_DIR" ]; then
317
317
  if [ -d "$FLOW_DIR/tasks" ]; then
318
318
  TASK_COUNT=$(find "$FLOW_DIR/tasks" -name "*.json" -type f 2>/dev/null | wc -l)
319
319
  if [ "$TASK_COUNT" -gt 0 ]; then
320
- echo -ne " \\033[36mπŸ“‹ $TASK_COUNT\\033[0m"
320
+ printf " \\033[36mπŸ“‹ $TASK_COUNT\\033[0m"
321
321
  fi
322
322
  fi
323
323
 
@@ -325,7 +325,7 @@ if [ -d "$FLOW_DIR" ]; then
325
325
  if [ -f "$FLOW_DIR/hooks-state.json" ]; then
326
326
  HOOKS_ACTIVE=$(jq -r \'.enabled // false\' "$FLOW_DIR/hooks-state.json" 2>/dev/null)
327
327
  if [ "$HOOKS_ACTIVE" = "true" ]; then
328
- echo -ne " \\033[35mπŸ”—\\033[0m"
328
+ printf " \\033[35mπŸ”—\\033[0m"
329
329
  fi
330
330
  fi
331
331
  fi
@@ -1332,9 +1332,11 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
1332
1332
  const args = subArgs || [];
1333
1333
  const options = flags || {};
1334
1334
 
1335
- // Import fs module for Node.js
1335
+ // Import fs, path, and os modules for Node.js
1336
1336
  const fs = await import('fs/promises');
1337
1337
  const { chmod } = fs;
1338
+ const path = await import('path');
1339
+ const os = await import('os');
1338
1340
 
1339
1341
  try {
1340
1342
  // Check existing files
@@ -1418,6 +1420,7 @@ async function enhancedClaudeFlowInit(flags, subArgs = []) {
1418
1420
  // Not critical, just skip
1419
1421
  if (!dryRun) {
1420
1422
  console.log(' ⚠️ Could not create statusline script, skipping...');
1423
+ console.log(` ℹ️ Error: ${err.message}`);
1421
1424
  }
1422
1425
  }
1423
1426
 
@@ -10,37 +10,55 @@ const __dirname = dirname(__filename);
10
10
  * Copy all skill files from the installed package to project directory
11
11
  */
12
12
  export async function copySkillFiles(targetDir, options = {}) {
13
+ console.log(' πŸš€ copySkillFiles function called');
14
+ console.log(` πŸ“‚ Target directory: ${targetDir}`);
15
+ console.log(` βš™οΈ Options:`, options);
16
+ console.log(` πŸ“ __dirname: ${__dirname}`);
17
+
13
18
  const { force = false, dryRun = false } = options;
14
19
 
15
20
  // Path to skill files - try multiple locations
16
- const packageSkillsDir = join(__dirname, '../../../../../.claude/skills'); // From npm package
17
- const localSkillsDir = '/workspaces/claude-code-flow/.claude/skills'; // Local development
18
- const cwdSkillsDir = join(process.cwd(), '.claude/skills'); // Current working directory
21
+ // From npm package: src/cli/simple-commands/init/ -> root = ../../../../
22
+ const packageSkillsDir = join(__dirname, '../../../../.claude/skills');
23
+ const localSkillsDir = join(__dirname, '../../../../../.claude/skills'); // Local development (one more level up)
24
+ const globalNpmSkillsDir = '/usr/local/lib/node_modules/claude-flow/.claude/skills'; // Global npm install
19
25
 
20
26
  let sourceSkillsDir;
21
27
 
22
- // Try local development first, then package, then cwd
23
- try {
24
- await fs.access(localSkillsDir);
25
- sourceSkillsDir = localSkillsDir;
26
- console.log(' πŸ“ Using local development skill files');
27
- } catch {
28
+ // Try package location first (most common for npm installs), then local dev, then global npm
29
+ const locationsToTry = [
30
+ { path: packageSkillsDir, label: 'packaged skill files' },
31
+ { path: localSkillsDir, label: 'local development skill files' },
32
+ { path: globalNpmSkillsDir, label: 'global npm skill files' }
33
+ ];
34
+
35
+ for (const location of locationsToTry) {
28
36
  try {
29
- await fs.access(packageSkillsDir);
30
- sourceSkillsDir = packageSkillsDir;
31
- console.log(' πŸ“ Using packaged skill files');
32
- } catch {
33
- try {
34
- await fs.access(cwdSkillsDir);
35
- sourceSkillsDir = cwdSkillsDir;
36
- console.log(' πŸ“ Using current directory skill files');
37
- } catch {
38
- console.log(' ⚠️ No skill files found in any location');
39
- return { success: false, error: 'Skill files not found' };
37
+ console.log(` πŸ” Checking: ${location.path}`);
38
+ await fs.access(location.path);
39
+ // Verify it's actually a directory with skills
40
+ const items = await fs.readdir(location.path);
41
+ console.log(` πŸ“Š Found ${items.length} items at ${location.path}`);
42
+ if (items.length > 0) {
43
+ sourceSkillsDir = location.path;
44
+ console.log(` πŸ“ Using ${location.label}`);
45
+ console.log(` πŸ“ Path: ${location.path}`);
46
+ break;
40
47
  }
48
+ } catch (err) {
49
+ console.log(` ❌ Failed to access ${location.path}: ${err.message}`);
50
+ // Try next location
51
+ continue;
41
52
  }
42
53
  }
43
54
 
55
+ if (!sourceSkillsDir) {
56
+ console.log(' ⚠️ No skill files found in any location');
57
+ console.log(' πŸ” Searched locations:');
58
+ locationsToTry.forEach(loc => console.log(` - ${loc.path}`));
59
+ return { success: false, error: 'Skill files not found' };
60
+ }
61
+
44
62
  const targetSkillsDir = join(targetDir, '.claude/skills');
45
63
 
46
64
  console.log('πŸ“ Copying skill system files...');