claude-flow 2.7.33 → 2.7.35
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/.claude/settings.local.json +9 -2
- package/.claude/skills/agentic-jujutsu/SKILL.md +1 -1
- package/CHANGELOG.md +140 -0
- package/bin/claude-flow +1 -1
- package/dist/src/cli/commands/mcp.js +61 -7
- package/dist/src/cli/commands/mcp.js.map +1 -1
- package/dist/src/cli/init/index.js +55 -33
- package/dist/src/cli/init/index.js.map +1 -1
- package/dist/src/cli/simple-cli.js +182 -172
- package/dist/src/cli/simple-cli.js.map +1 -1
- package/dist/src/cli/simple-commands/init/agent-copier.js +9 -3
- package/dist/src/cli/simple-commands/init/agent-copier.js.map +1 -1
- package/dist/src/core/DatabaseManager.js +39 -9
- package/dist/src/core/DatabaseManager.js.map +1 -1
- package/dist/src/mcp/async/job-manager-mcp25.js +240 -0
- package/dist/src/mcp/async/job-manager-mcp25.js.map +1 -0
- package/dist/src/mcp/index.js +8 -0
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/mcp/protocol/version-negotiation.js +182 -0
- package/dist/src/mcp/protocol/version-negotiation.js.map +1 -0
- package/dist/src/mcp/registry/mcp-registry-client-2025.js +210 -0
- package/dist/src/mcp/registry/mcp-registry-client-2025.js.map +1 -0
- package/dist/src/mcp/server-factory.js +189 -0
- package/dist/src/mcp/server-factory.js.map +1 -0
- package/dist/src/mcp/server-mcp-2025.js +283 -0
- package/dist/src/mcp/server-mcp-2025.js.map +1 -0
- package/dist/src/mcp/tool-registry-progressive.js +319 -0
- package/dist/src/mcp/tool-registry-progressive.js.map +1 -0
- package/dist/src/mcp/tools/_template.js +62 -0
- package/dist/src/mcp/tools/_template.js.map +1 -0
- package/dist/src/mcp/tools/loader.js +228 -0
- package/dist/src/mcp/tools/loader.js.map +1 -0
- package/dist/src/mcp/tools/system/search.js +224 -0
- package/dist/src/mcp/tools/system/search.js.map +1 -0
- package/dist/src/mcp/tools/system/status.js +168 -0
- package/dist/src/mcp/tools/system/status.js.map +1 -0
- package/dist/src/mcp/validation/schema-validator-2025.js +198 -0
- package/dist/src/mcp/validation/schema-validator-2025.js.map +1 -0
- package/dist/src/utils/error-recovery.js +215 -0
- package/dist/src/utils/error-recovery.js.map +1 -0
- package/dist/src/utils/metrics-reader.js +10 -0
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/docs/.claude-flow/metrics/performance.json +3 -3
- package/docs/.claude-flow/metrics/task-metrics.json +3 -3
- package/docs/.github-release-issue-v2.7.33.md +488 -0
- package/docs/AGENTDB_BRANCH_MERGE_VERIFICATION.md +436 -0
- package/docs/AUTOMATIC_ERROR_RECOVERY_v2.7.35.md +321 -0
- package/docs/BRANCH_REVIEW_SUMMARY.md +439 -0
- package/docs/CONFIRMATION_AUTOMATIC_ERROR_RECOVERY.md +384 -0
- package/docs/DEEP_CODE_REVIEW_v2.7.33.md +1159 -0
- package/docs/DOCKER_TEST_RESULTS_v2.7.35.md +305 -0
- package/docs/MCP_2025_FEATURE_CONFIRMATION.md +698 -0
- package/docs/NPM_PUBLISH_GUIDE_v2.7.33.md +628 -0
- package/docs/REGRESSION_TEST_REPORT_v2.7.33.md +397 -0
- package/docs/RELEASE_NOTES_v2.7.33.md +618 -0
- package/docs/RELEASE_READINESS_SUMMARY.md +377 -0
- package/docs/RELEASE_SUMMARY_v2.7.33.md +456 -0
- package/docs/agentic-flow-agentdb-mcp-integration.md +1198 -0
- package/docs/features/automatic-error-recovery.md +333 -0
- package/docs/github-issues/README.md +88 -0
- package/docs/github-issues/wsl-enotempty-automatic-recovery.md +470 -0
- package/docs/mcp-2025-implementation-summary.md +459 -0
- package/docs/mcp-spec-2025-implementation-plan.md +1330 -0
- package/docs/phase-1-2-implementation-summary.md +676 -0
- package/docs/regression-analysis-phase-1-2.md +555 -0
- package/docs/troubleshooting/wsl-better-sqlite3-error.md +239 -0
- package/package.json +5 -2
- package/scripts/create-github-issue.sh +64 -0
- package/scripts/test-docker-wsl.sh +198 -0
- package/src/cli/commands/mcp.ts +86 -9
- package/src/cli/init/index.ts +72 -42
- package/src/cli/simple-commands/init/agent-copier.js +10 -5
- package/src/core/DatabaseManager.ts +55 -9
- package/src/mcp/async/job-manager-mcp25.ts +456 -0
- package/src/mcp/index.ts +60 -0
- package/src/mcp/protocol/version-negotiation.ts +329 -0
- package/src/mcp/registry/mcp-registry-client-2025.ts +334 -0
- package/src/mcp/server-factory.ts +426 -0
- package/src/mcp/server-mcp-2025.ts +507 -0
- package/src/mcp/tool-registry-progressive.ts +539 -0
- package/src/mcp/tools/_template.ts +174 -0
- package/src/mcp/tools/loader.ts +362 -0
- package/src/mcp/tools/system/search.ts +276 -0
- package/src/mcp/tools/system/status.ts +206 -0
- package/src/mcp/validation/schema-validator-2025.ts +294 -0
- package/src/utils/error-recovery.ts +325 -0
- package/docs/AGENTDB_V1.6.1_DEEP_REVIEW.md +0 -386
- package/docs/AGENT_FOLDER_STRUCTURE_FIX.md +0 -192
- package/docs/RECENT_RELEASES_SUMMARY.md +0 -375
- package/docs/V2.7.31_RELEASE_NOTES.md +0 -375
- /package/.claude/agents/analysis/{analyze-code-quality.md → code-review/analyze-code-quality.md} +0 -0
- /package/.claude/agents/architecture/{arch-system-design.md → system-design/arch-system-design.md} +0 -0
- /package/.claude/agents/data/{data-ml-model.md → ml/data-ml-model.md} +0 -0
- /package/.claude/agents/development/{dev-backend-api.md → backend/dev-backend-api.md} +0 -0
- /package/.claude/agents/devops/{ops-cicd-github.md → ci-cd/ops-cicd-github.md} +0 -0
- /package/.claude/agents/documentation/{docs-api-openapi.md → api-docs/docs-api-openapi.md} +0 -0
- /package/.claude/agents/specialized/{spec-mobile-react-native.md → mobile/spec-mobile-react-native.md} +0 -0
- /package/.claude/agents/testing/{tdd-london-swarm.md → unit/tdd-london-swarm.md} +0 -0
- /package/.claude/agents/testing/{production-validator.md → validation/production-validator.md} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# WSL better-sqlite3 Error - Troubleshooting Guide
|
|
2
|
+
|
|
3
|
+
## ⚡ Automatic Error Recovery (v2.7.35+)
|
|
4
|
+
|
|
5
|
+
**Good news!** Starting with v2.7.35, claude-flow includes **automatic error recovery** that handles this issue without manual intervention.
|
|
6
|
+
|
|
7
|
+
### What Happens Automatically:
|
|
8
|
+
1. ✅ Detects ENOTEMPTY and better-sqlite3 errors
|
|
9
|
+
2. ✅ Cleans npm/npx cache automatically
|
|
10
|
+
3. ✅ Applies WSL-specific fixes
|
|
11
|
+
4. ✅ Retries initialization (up to 5 times with `--force`)
|
|
12
|
+
5. ✅ Falls back to JSON storage if SQLite fails
|
|
13
|
+
|
|
14
|
+
### Just Run:
|
|
15
|
+
```bash
|
|
16
|
+
npx claude-flow@alpha init --force
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The `--force` flag enables **automatic error recovery** and will:
|
|
20
|
+
- Detect and clean npm cache errors
|
|
21
|
+
- Apply WSL environment optimizations
|
|
22
|
+
- Retry up to 5 times with exponential backoff
|
|
23
|
+
- Automatically switch to JSON storage if needed
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Error Description
|
|
28
|
+
```
|
|
29
|
+
[Error: ENOTEMPTY: directory not empty, rmdir '/home/username/.npm/_npx/xxxxx/node_modules/better-sqlite3']
|
|
30
|
+
errno: -39
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
When running: `npx claude-flow@alpha init --force` on Windows Subsystem for Linux (WSL)
|
|
34
|
+
|
|
35
|
+
**Note:** If you're using v2.7.35+, automatic recovery handles this. Manual fixes below are only needed for older versions or edge cases.
|
|
36
|
+
|
|
37
|
+
## Root Causes
|
|
38
|
+
|
|
39
|
+
1. **File locking conflicts** between Windows and WSL filesystems
|
|
40
|
+
2. **NPX cache corruption** due to interrupted installations
|
|
41
|
+
3. **Permission issues** with npm cache directories
|
|
42
|
+
4. **Native module compilation** issues specific to WSL
|
|
43
|
+
|
|
44
|
+
## Solutions (Try in order)
|
|
45
|
+
|
|
46
|
+
### Solution 1: Clear NPM/NPX Cache
|
|
47
|
+
```bash
|
|
48
|
+
# Clear npm cache
|
|
49
|
+
npm cache clean --force
|
|
50
|
+
|
|
51
|
+
# Remove npx cache directory
|
|
52
|
+
rm -rf ~/.npm/_npx
|
|
53
|
+
|
|
54
|
+
# Retry installation
|
|
55
|
+
npx claude-flow@alpha init --force
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Solution 2: Use npm instead of npx
|
|
59
|
+
```bash
|
|
60
|
+
# Install globally first
|
|
61
|
+
npm install -g claude-flow@alpha
|
|
62
|
+
|
|
63
|
+
# Then run init
|
|
64
|
+
claude-flow init --force
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Solution 3: Manual Directory Cleanup
|
|
68
|
+
```bash
|
|
69
|
+
# Find the problematic directory
|
|
70
|
+
ls -la ~/.npm/_npx/
|
|
71
|
+
|
|
72
|
+
# Force remove with elevated permissions if needed
|
|
73
|
+
sudo rm -rf ~/.npm/_npx/*/node_modules/better-sqlite3
|
|
74
|
+
|
|
75
|
+
# Clear entire npx cache
|
|
76
|
+
rm -rf ~/.npm/_npx
|
|
77
|
+
|
|
78
|
+
# Retry
|
|
79
|
+
npx claude-flow@alpha init --force
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Solution 4: Fix WSL File Permissions
|
|
83
|
+
```bash
|
|
84
|
+
# Ensure proper ownership
|
|
85
|
+
sudo chown -R $(whoami) ~/.npm
|
|
86
|
+
|
|
87
|
+
# Fix permissions
|
|
88
|
+
chmod -R 755 ~/.npm
|
|
89
|
+
|
|
90
|
+
# Clear and retry
|
|
91
|
+
npm cache clean --force
|
|
92
|
+
npx claude-flow@alpha init --force
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Solution 5: Rebuild better-sqlite3
|
|
96
|
+
```bash
|
|
97
|
+
# Install build tools if missing
|
|
98
|
+
sudo apt-get update
|
|
99
|
+
sudo apt-get install -y build-essential python3
|
|
100
|
+
|
|
101
|
+
# Clear cache and retry with rebuild flag
|
|
102
|
+
npm cache clean --force
|
|
103
|
+
rm -rf ~/.npm/_npx
|
|
104
|
+
npx claude-flow@alpha init --force
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Solution 6: Use WSL2 with Proper Node Version
|
|
108
|
+
```bash
|
|
109
|
+
# Check WSL version
|
|
110
|
+
wsl --list --verbose
|
|
111
|
+
|
|
112
|
+
# Ensure using WSL2 (not WSL1)
|
|
113
|
+
wsl --set-version Ubuntu 2
|
|
114
|
+
|
|
115
|
+
# Use Node 18+ (better-sqlite3 compatibility)
|
|
116
|
+
node --version
|
|
117
|
+
|
|
118
|
+
# Install/update node if needed via nvm
|
|
119
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
120
|
+
source ~/.bashrc
|
|
121
|
+
nvm install 20
|
|
122
|
+
nvm use 20
|
|
123
|
+
|
|
124
|
+
# Retry installation
|
|
125
|
+
npx claude-flow@alpha init --force
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Solution 7: Run from Linux Filesystem (Not Windows Mount)
|
|
129
|
+
```bash
|
|
130
|
+
# Bad: Running from /mnt/c/Users/... (Windows filesystem)
|
|
131
|
+
cd /mnt/c/Users/username/project # ❌
|
|
132
|
+
|
|
133
|
+
# Good: Running from WSL filesystem
|
|
134
|
+
cd ~/projects/your-project # ✅
|
|
135
|
+
|
|
136
|
+
# Copy project to WSL if needed
|
|
137
|
+
cp -r /mnt/c/Users/username/project ~/projects/
|
|
138
|
+
|
|
139
|
+
# Run from WSL filesystem
|
|
140
|
+
cd ~/projects/project
|
|
141
|
+
npx claude-flow@alpha init --force
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Prevention
|
|
145
|
+
|
|
146
|
+
### Best Practices for WSL Users
|
|
147
|
+
|
|
148
|
+
1. **Always work in WSL filesystem** (`~/` not `/mnt/c/`)
|
|
149
|
+
2. **Use Node 18+** for better native module support
|
|
150
|
+
3. **Keep npm updated**: `npm install -g npm@latest`
|
|
151
|
+
4. **Regular cache cleanup**: Add to `.bashrc`:
|
|
152
|
+
```bash
|
|
153
|
+
alias npm-clean="npm cache clean --force && rm -rf ~/.npm/_npx"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Quick Fix Script
|
|
157
|
+
|
|
158
|
+
Create a script to automate the fix:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
#!/bin/bash
|
|
162
|
+
# wsl-fix-npx.sh
|
|
163
|
+
|
|
164
|
+
echo "🔧 Fixing WSL NPX cache issues..."
|
|
165
|
+
|
|
166
|
+
# Stop any running node processes
|
|
167
|
+
pkill -f node || true
|
|
168
|
+
|
|
169
|
+
# Clean npm cache
|
|
170
|
+
echo "📦 Cleaning npm cache..."
|
|
171
|
+
npm cache clean --force
|
|
172
|
+
|
|
173
|
+
# Remove npx cache
|
|
174
|
+
echo "🗑️ Removing npx cache..."
|
|
175
|
+
rm -rf ~/.npm/_npx
|
|
176
|
+
|
|
177
|
+
# Fix permissions
|
|
178
|
+
echo "🔐 Fixing permissions..."
|
|
179
|
+
sudo chown -R $(whoami) ~/.npm
|
|
180
|
+
chmod -R 755 ~/.npm
|
|
181
|
+
|
|
182
|
+
# Verify node/npm
|
|
183
|
+
echo "✅ Verifying Node.js..."
|
|
184
|
+
node --version
|
|
185
|
+
npm --version
|
|
186
|
+
|
|
187
|
+
echo "🎉 Cleanup complete! Try running your command again."
|
|
188
|
+
echo "Command: npx claude-flow@alpha init --force"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Usage:
|
|
192
|
+
```bash
|
|
193
|
+
chmod +x wsl-fix-npx.sh
|
|
194
|
+
./wsl-fix-npx.sh
|
|
195
|
+
npx claude-flow@alpha init --force
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Still Having Issues?
|
|
199
|
+
|
|
200
|
+
### Report the Issue
|
|
201
|
+
If none of the solutions work, gather this information:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# System info
|
|
205
|
+
cat /etc/os-release
|
|
206
|
+
node --version
|
|
207
|
+
npm --version
|
|
208
|
+
wsl --list --verbose # Run from Windows PowerShell
|
|
209
|
+
|
|
210
|
+
# Error details
|
|
211
|
+
npx claude-flow@alpha init --force --verbose 2>&1 | tee error-log.txt
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Then report at: https://github.com/ruvnet/claude-flow/issues
|
|
215
|
+
|
|
216
|
+
### Alternative: Use Docker
|
|
217
|
+
If WSL issues persist, consider using Docker:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Pull claude-flow Docker image (if available)
|
|
221
|
+
docker pull ruvnet/claude-flow:latest
|
|
222
|
+
|
|
223
|
+
# Run in container
|
|
224
|
+
docker run -it -v $(pwd):/workspace ruvnet/claude-flow:latest init --force
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Technical Background
|
|
228
|
+
|
|
229
|
+
The `ENOTEMPTY` error occurs because:
|
|
230
|
+
|
|
231
|
+
1. **WSL filesystem translation layer** can cause delays in file operations
|
|
232
|
+
2. **better-sqlite3** is a native Node.js module requiring compilation
|
|
233
|
+
3. **NPX temporary directories** may not be fully cleaned before reuse
|
|
234
|
+
4. **Windows Defender** or antivirus may lock files during scanning
|
|
235
|
+
|
|
236
|
+
The error code `-39` (ENOTEMPTY) means the system tried to remove a directory that still contains files, typically due to:
|
|
237
|
+
- Race conditions in cleanup
|
|
238
|
+
- File handles still open
|
|
239
|
+
- Filesystem caching inconsistencies
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.35",
|
|
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",
|
|
@@ -121,6 +121,9 @@
|
|
|
121
121
|
"@anthropic-ai/sdk": "^0.65.0",
|
|
122
122
|
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
123
123
|
"agentic-flow": "^1.9.4",
|
|
124
|
+
"ajv": "^8.17.1",
|
|
125
|
+
"ajv-errors": "^3.0.0",
|
|
126
|
+
"ajv-formats": "^3.0.1",
|
|
124
127
|
"blessed": "^0.1.81",
|
|
125
128
|
"chalk": "^4.1.2",
|
|
126
129
|
"cli-table3": "^0.6.3",
|
|
@@ -137,6 +140,7 @@
|
|
|
137
140
|
"ora": "^7.0.1",
|
|
138
141
|
"p-queue": "^8.1.0",
|
|
139
142
|
"ruv-swarm": "^1.0.14",
|
|
143
|
+
"uuid": "^13.0.0",
|
|
140
144
|
"ws": "^8.18.3",
|
|
141
145
|
"yaml": "^2.8.0",
|
|
142
146
|
"yoctocolors-cjs": "^2.1.3"
|
|
@@ -168,7 +172,6 @@
|
|
|
168
172
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
169
173
|
"@typescript-eslint/parser": "^6.21.0",
|
|
170
174
|
"@vercel/ncc": "^0.38.3",
|
|
171
|
-
"agentic-jujutsu": "^2.3.2",
|
|
172
175
|
"babel-jest": "^29.7.0",
|
|
173
176
|
"eslint": "^8.57.1",
|
|
174
177
|
"eslint-plugin-react": "^7.37.5",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Create GitHub Issue for Automatic Error Recovery
|
|
3
|
+
# Run this after confirming fix works in Docker/CLI
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "📝 Creating GitHub Issue for Automatic Error Recovery"
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Check if gh CLI is installed
|
|
11
|
+
if ! command -v gh &> /dev/null; then
|
|
12
|
+
echo "❌ GitHub CLI (gh) is not installed"
|
|
13
|
+
echo " Install: https://cli.github.com/"
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Check if authenticated
|
|
18
|
+
if ! gh auth status &> /dev/null; then
|
|
19
|
+
echo "❌ Not authenticated with GitHub CLI"
|
|
20
|
+
echo " Run: gh auth login"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
echo "✅ GitHub CLI ready"
|
|
25
|
+
echo ""
|
|
26
|
+
|
|
27
|
+
# Issue title
|
|
28
|
+
TITLE="✅ Fixed: Automatic recovery for WSL better-sqlite3 ENOTEMPTY error during init"
|
|
29
|
+
|
|
30
|
+
# Issue body (from template)
|
|
31
|
+
BODY=$(cat docs/github-issues/wsl-enotempty-automatic-recovery.md)
|
|
32
|
+
|
|
33
|
+
# Labels
|
|
34
|
+
LABELS="enhancement,bug-fix,wsl,user-experience,v2.7.35"
|
|
35
|
+
|
|
36
|
+
# Milestone
|
|
37
|
+
MILESTONE="v2.7.35"
|
|
38
|
+
|
|
39
|
+
echo "Creating issue..."
|
|
40
|
+
echo "Title: $TITLE"
|
|
41
|
+
echo "Labels: $LABELS"
|
|
42
|
+
echo "Milestone: $MILESTONE"
|
|
43
|
+
echo ""
|
|
44
|
+
|
|
45
|
+
# Create the issue
|
|
46
|
+
gh issue create \
|
|
47
|
+
--title "$TITLE" \
|
|
48
|
+
--body "$BODY" \
|
|
49
|
+
--label "$LABELS" \
|
|
50
|
+
--milestone "$MILESTONE"
|
|
51
|
+
|
|
52
|
+
if [ $? -eq 0 ]; then
|
|
53
|
+
echo ""
|
|
54
|
+
echo "✅ GitHub issue created successfully!"
|
|
55
|
+
echo ""
|
|
56
|
+
echo "Next steps:"
|
|
57
|
+
echo "1. Add test results to the issue"
|
|
58
|
+
echo "2. Attach screenshots if available"
|
|
59
|
+
echo "3. Request review from maintainers"
|
|
60
|
+
else
|
|
61
|
+
echo ""
|
|
62
|
+
echo "❌ Failed to create issue"
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Test automatic error recovery in Docker (simulates WSL)
|
|
3
|
+
# Run this before creating GitHub issue
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "🐳 Testing Automatic Error Recovery in Docker"
|
|
8
|
+
echo ""
|
|
9
|
+
|
|
10
|
+
# Colors for output
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# Test configurations
|
|
17
|
+
DISTROS=("ubuntu:22.04" "ubuntu:20.04" "debian:11" "debian:12")
|
|
18
|
+
TEST_RESULTS=()
|
|
19
|
+
|
|
20
|
+
# Function to test on a distro
|
|
21
|
+
test_distro() {
|
|
22
|
+
local distro=$1
|
|
23
|
+
echo ""
|
|
24
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
25
|
+
echo "Testing on: $distro"
|
|
26
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
27
|
+
echo ""
|
|
28
|
+
|
|
29
|
+
# Run test in Docker
|
|
30
|
+
docker run --rm -i $distro bash -c "
|
|
31
|
+
set -e
|
|
32
|
+
|
|
33
|
+
echo '📦 Installing dependencies...'
|
|
34
|
+
apt-get update -qq
|
|
35
|
+
apt-get install -y -qq curl build-essential python3 git > /dev/null 2>&1
|
|
36
|
+
|
|
37
|
+
echo '📥 Installing Node.js...'
|
|
38
|
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - > /dev/null 2>&1
|
|
39
|
+
apt-get install -y -qq nodejs > /dev/null 2>&1
|
|
40
|
+
|
|
41
|
+
echo '🔍 Node version:'
|
|
42
|
+
node --version
|
|
43
|
+
npm --version
|
|
44
|
+
|
|
45
|
+
echo ''
|
|
46
|
+
echo '🚀 Running claude-flow init --force...'
|
|
47
|
+
echo ''
|
|
48
|
+
|
|
49
|
+
# Run the actual test
|
|
50
|
+
npx claude-flow@alpha init --force
|
|
51
|
+
|
|
52
|
+
echo ''
|
|
53
|
+
echo '✅ Test completed successfully on $distro'
|
|
54
|
+
" && {
|
|
55
|
+
echo -e "${GREEN}✅ PASS: $distro${NC}"
|
|
56
|
+
TEST_RESULTS+=("PASS: $distro")
|
|
57
|
+
} || {
|
|
58
|
+
echo -e "${RED}❌ FAIL: $distro${NC}"
|
|
59
|
+
TEST_RESULTS+=("FAIL: $distro")
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Function to test with corrupted cache simulation
|
|
64
|
+
test_corrupted_cache() {
|
|
65
|
+
echo ""
|
|
66
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
67
|
+
echo "Testing with corrupted npm cache simulation"
|
|
68
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
69
|
+
echo ""
|
|
70
|
+
|
|
71
|
+
docker run --rm -i ubuntu:22.04 bash -c "
|
|
72
|
+
set -e
|
|
73
|
+
|
|
74
|
+
apt-get update -qq
|
|
75
|
+
apt-get install -y -qq curl build-essential python3 git > /dev/null 2>&1
|
|
76
|
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - > /dev/null 2>&1
|
|
77
|
+
apt-get install -y -qq nodejs > /dev/null 2>&1
|
|
78
|
+
|
|
79
|
+
echo '💥 Simulating corrupted npm cache...'
|
|
80
|
+
mkdir -p ~/.npm/_npx/test-corrupt/node_modules/better-sqlite3
|
|
81
|
+
touch ~/.npm/_npx/test-corrupt/node_modules/better-sqlite3/.lock
|
|
82
|
+
|
|
83
|
+
echo ''
|
|
84
|
+
echo '🚀 Running claude-flow init --force with corrupted cache...'
|
|
85
|
+
echo ''
|
|
86
|
+
|
|
87
|
+
npx claude-flow@alpha init --force
|
|
88
|
+
|
|
89
|
+
echo ''
|
|
90
|
+
echo '✅ Recovery from corrupted cache successful'
|
|
91
|
+
" && {
|
|
92
|
+
echo -e "${GREEN}✅ PASS: Corrupted cache recovery${NC}"
|
|
93
|
+
TEST_RESULTS+=("PASS: Corrupted cache recovery")
|
|
94
|
+
} || {
|
|
95
|
+
echo -e "${RED}❌ FAIL: Corrupted cache recovery${NC}"
|
|
96
|
+
TEST_RESULTS+=("FAIL: Corrupted cache recovery")
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Function to test without --force flag
|
|
101
|
+
test_without_force() {
|
|
102
|
+
echo ""
|
|
103
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
104
|
+
echo "Testing without --force flag (3 retries max)"
|
|
105
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
106
|
+
echo ""
|
|
107
|
+
|
|
108
|
+
docker run --rm -i ubuntu:22.04 bash -c "
|
|
109
|
+
set -e
|
|
110
|
+
|
|
111
|
+
apt-get update -qq
|
|
112
|
+
apt-get install -y -qq curl build-essential python3 git > /dev/null 2>&1
|
|
113
|
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - > /dev/null 2>&1
|
|
114
|
+
apt-get install -y -qq nodejs > /dev/null 2>&1
|
|
115
|
+
|
|
116
|
+
echo '🚀 Running claude-flow init (no --force)...'
|
|
117
|
+
echo ''
|
|
118
|
+
|
|
119
|
+
npx claude-flow@alpha init
|
|
120
|
+
|
|
121
|
+
echo ''
|
|
122
|
+
echo '✅ Init without --force successful'
|
|
123
|
+
" && {
|
|
124
|
+
echo -e "${GREEN}✅ PASS: Init without --force${NC}"
|
|
125
|
+
TEST_RESULTS+=("PASS: Init without --force")
|
|
126
|
+
} || {
|
|
127
|
+
echo -e "${RED}❌ FAIL: Init without --force${NC}"
|
|
128
|
+
TEST_RESULTS+=("FAIL: Init without --force")
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# Main test execution
|
|
133
|
+
echo "Starting comprehensive Docker tests..."
|
|
134
|
+
echo ""
|
|
135
|
+
echo "This will test:"
|
|
136
|
+
echo " - Multiple Linux distributions"
|
|
137
|
+
echo " - Corrupted cache recovery"
|
|
138
|
+
echo " - With and without --force flag"
|
|
139
|
+
echo ""
|
|
140
|
+
|
|
141
|
+
read -p "Continue? (y/n) " -n 1 -r
|
|
142
|
+
echo ""
|
|
143
|
+
|
|
144
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
145
|
+
echo "Aborted"
|
|
146
|
+
exit 1
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# Run tests
|
|
150
|
+
for distro in "${DISTROS[@]}"; do
|
|
151
|
+
test_distro "$distro"
|
|
152
|
+
done
|
|
153
|
+
|
|
154
|
+
test_corrupted_cache
|
|
155
|
+
test_without_force
|
|
156
|
+
|
|
157
|
+
# Print summary
|
|
158
|
+
echo ""
|
|
159
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
160
|
+
echo "TEST SUMMARY"
|
|
161
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
162
|
+
echo ""
|
|
163
|
+
|
|
164
|
+
PASS_COUNT=0
|
|
165
|
+
FAIL_COUNT=0
|
|
166
|
+
|
|
167
|
+
for result in "${TEST_RESULTS[@]}"; do
|
|
168
|
+
if [[ $result == PASS* ]]; then
|
|
169
|
+
echo -e "${GREEN}✅ $result${NC}"
|
|
170
|
+
((PASS_COUNT++))
|
|
171
|
+
else
|
|
172
|
+
echo -e "${RED}❌ $result${NC}"
|
|
173
|
+
((FAIL_COUNT++))
|
|
174
|
+
fi
|
|
175
|
+
done
|
|
176
|
+
|
|
177
|
+
echo ""
|
|
178
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
179
|
+
echo "Total: $((PASS_COUNT + FAIL_COUNT)) tests"
|
|
180
|
+
echo -e "${GREEN}Passed: $PASS_COUNT${NC}"
|
|
181
|
+
echo -e "${RED}Failed: $FAIL_COUNT${NC}"
|
|
182
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
183
|
+
echo ""
|
|
184
|
+
|
|
185
|
+
if [ $FAIL_COUNT -eq 0 ]; then
|
|
186
|
+
echo -e "${GREEN}✅ All tests passed!${NC}"
|
|
187
|
+
echo ""
|
|
188
|
+
echo "Next steps:"
|
|
189
|
+
echo "1. Review test results above"
|
|
190
|
+
echo "2. Run: bash scripts/create-github-issue.sh"
|
|
191
|
+
echo "3. Update issue with test results"
|
|
192
|
+
exit 0
|
|
193
|
+
else
|
|
194
|
+
echo -e "${RED}❌ Some tests failed${NC}"
|
|
195
|
+
echo ""
|
|
196
|
+
echo "Please fix failing tests before creating GitHub issue"
|
|
197
|
+
exit 1
|
|
198
|
+
fi
|
package/src/cli/commands/mcp.ts
CHANGED
|
@@ -6,10 +6,17 @@ import { Command } from '@cliffy/command';
|
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import { logger } from '../../core/logger.js';
|
|
8
8
|
import { configManager } from '../../core/config.js';
|
|
9
|
-
import { MCPServer } from '../../mcp/server.js';
|
|
9
|
+
import { MCPServer, type IMCPServer } from '../../mcp/server.js';
|
|
10
10
|
import { eventBus } from '../../core/event-bus.js';
|
|
11
|
+
import {
|
|
12
|
+
createMCPServer,
|
|
13
|
+
isMCP2025Available,
|
|
14
|
+
getServerCapabilities,
|
|
15
|
+
type ExtendedMCPConfig,
|
|
16
|
+
} from '../../mcp/server-factory.js';
|
|
17
|
+
import type { MCP2025Server } from '../../mcp/server-mcp-2025.js';
|
|
11
18
|
|
|
12
|
-
let mcpServer:
|
|
19
|
+
let mcpServer: IMCPServer | MCP2025Server | null = null;
|
|
13
20
|
|
|
14
21
|
export const mcpCommand = new Command()
|
|
15
22
|
.description('Manage MCP server and tools')
|
|
@@ -32,29 +39,95 @@ export const mcpCommand = new Command()
|
|
|
32
39
|
.option('--transport <transport:string>', 'Transport type (stdio, http)', {
|
|
33
40
|
default: 'stdio',
|
|
34
41
|
})
|
|
42
|
+
.option('--mcp2025', 'Enable MCP 2025-11 features (version negotiation, async jobs, etc.)', {
|
|
43
|
+
default: false,
|
|
44
|
+
})
|
|
45
|
+
.option('--no-legacy', 'Disable legacy client support', { default: false })
|
|
35
46
|
.action(async (options: any) => {
|
|
36
47
|
try {
|
|
37
48
|
const config = await configManager.load();
|
|
38
49
|
|
|
39
|
-
//
|
|
40
|
-
const
|
|
50
|
+
// Check if MCP 2025-11 dependencies are available
|
|
51
|
+
const mcp2025Available = isMCP2025Available();
|
|
52
|
+
const enableMCP2025 = options.mcp2025 && mcp2025Available;
|
|
53
|
+
|
|
54
|
+
if (options.mcp2025 && !mcp2025Available) {
|
|
55
|
+
console.log(
|
|
56
|
+
chalk.yellow(
|
|
57
|
+
'⚠️ MCP 2025-11 dependencies not found. Install with: npm install uuid ajv ajv-formats ajv-errors'
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
console.log(chalk.yellow(' Falling back to legacy MCP server...'));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Build extended configuration
|
|
64
|
+
const mcpConfig: ExtendedMCPConfig = {
|
|
41
65
|
...config.mcp,
|
|
42
66
|
port: options.port,
|
|
43
67
|
host: options.host,
|
|
44
68
|
transport: options.transport,
|
|
69
|
+
features: {
|
|
70
|
+
enableMCP2025,
|
|
71
|
+
supportLegacyClients: options.legacy !== false,
|
|
72
|
+
enableVersionNegotiation: enableMCP2025,
|
|
73
|
+
enableAsyncJobs: enableMCP2025,
|
|
74
|
+
enableRegistryIntegration: false, // Opt-in via env var
|
|
75
|
+
enableSchemaValidation: enableMCP2025,
|
|
76
|
+
enableProgressiveDisclosure: true, // Phase 1 feature (always enabled)
|
|
77
|
+
},
|
|
78
|
+
mcp2025: enableMCP2025
|
|
79
|
+
? {
|
|
80
|
+
async: {
|
|
81
|
+
enabled: true,
|
|
82
|
+
maxJobs: 100,
|
|
83
|
+
jobTTL: 3600000,
|
|
84
|
+
},
|
|
85
|
+
registry: {
|
|
86
|
+
enabled: process.env.MCP_REGISTRY_ENABLED === 'true',
|
|
87
|
+
url: process.env.MCP_REGISTRY_URL,
|
|
88
|
+
apiKey: process.env.MCP_REGISTRY_API_KEY,
|
|
89
|
+
},
|
|
90
|
+
validation: {
|
|
91
|
+
enabled: true,
|
|
92
|
+
strictMode: false,
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
: undefined,
|
|
45
96
|
};
|
|
46
97
|
|
|
47
|
-
|
|
98
|
+
// Create server using factory
|
|
99
|
+
mcpServer = await createMCPServer(mcpConfig, eventBus, logger, {
|
|
100
|
+
autoDetectFeatures: false, // Use explicit config
|
|
101
|
+
});
|
|
102
|
+
|
|
48
103
|
await mcpServer.start();
|
|
49
104
|
|
|
105
|
+
// Get capabilities
|
|
106
|
+
const capabilities = getServerCapabilities(mcpConfig);
|
|
107
|
+
|
|
50
108
|
console.log(chalk.green(`✅ MCP server started on ${options.host}:${options.port}`));
|
|
51
|
-
console.log(chalk.cyan(`📡 Server URL: http://${options.host}:${options.port}`));
|
|
52
|
-
console.log(chalk.cyan(`🔧 Available tools: Research, Code, Terminal, Memory`));
|
|
53
109
|
console.log(
|
|
54
|
-
chalk.cyan(
|
|
110
|
+
chalk.cyan(`🎯 Mode: ${enableMCP2025 ? 'MCP 2025-11 Enhanced' : 'Legacy Compatible'}`)
|
|
55
111
|
);
|
|
112
|
+
console.log(chalk.cyan(`📡 Transport: ${options.transport}`));
|
|
113
|
+
|
|
114
|
+
if (capabilities.length > 0) {
|
|
115
|
+
console.log(chalk.cyan(`✨ Capabilities: ${capabilities.join(', ')}`));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (enableMCP2025) {
|
|
119
|
+
console.log(chalk.green(' • Version negotiation (YYYY-MM format)'));
|
|
120
|
+
console.log(chalk.green(' • Async job support (poll/resume)'));
|
|
121
|
+
console.log(chalk.green(' • JSON Schema 1.1 validation'));
|
|
122
|
+
console.log(chalk.green(' • Progressive disclosure (98.7% token reduction)'));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (options.transport === 'http') {
|
|
126
|
+
console.log(chalk.cyan(`📚 Server URL: http://${options.host}:${options.port}`));
|
|
127
|
+
}
|
|
56
128
|
} catch (error) {
|
|
57
129
|
console.error(chalk.red(`❌ Failed to start MCP server: ${(error as Error).message}`));
|
|
130
|
+
logger.error('MCP server startup failed', { error });
|
|
58
131
|
process.exit(1);
|
|
59
132
|
}
|
|
60
133
|
}),
|
|
@@ -151,7 +224,11 @@ export const mcpCommand = new Command()
|
|
|
151
224
|
|
|
152
225
|
console.log(chalk.yellow('🔄 Starting MCP server...'));
|
|
153
226
|
const config = await configManager.load();
|
|
154
|
-
|
|
227
|
+
|
|
228
|
+
// Use factory to create server with same capabilities as before
|
|
229
|
+
mcpServer = await createMCPServer(config.mcp, eventBus, logger, {
|
|
230
|
+
autoDetectFeatures: true, // Auto-detect on restart
|
|
231
|
+
});
|
|
155
232
|
await mcpServer.start();
|
|
156
233
|
|
|
157
234
|
console.log(
|