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.
Files changed (99) hide show
  1. package/.claude/settings.local.json +9 -2
  2. package/.claude/skills/agentic-jujutsu/SKILL.md +1 -1
  3. package/CHANGELOG.md +140 -0
  4. package/bin/claude-flow +1 -1
  5. package/dist/src/cli/commands/mcp.js +61 -7
  6. package/dist/src/cli/commands/mcp.js.map +1 -1
  7. package/dist/src/cli/init/index.js +55 -33
  8. package/dist/src/cli/init/index.js.map +1 -1
  9. package/dist/src/cli/simple-cli.js +182 -172
  10. package/dist/src/cli/simple-cli.js.map +1 -1
  11. package/dist/src/cli/simple-commands/init/agent-copier.js +9 -3
  12. package/dist/src/cli/simple-commands/init/agent-copier.js.map +1 -1
  13. package/dist/src/core/DatabaseManager.js +39 -9
  14. package/dist/src/core/DatabaseManager.js.map +1 -1
  15. package/dist/src/mcp/async/job-manager-mcp25.js +240 -0
  16. package/dist/src/mcp/async/job-manager-mcp25.js.map +1 -0
  17. package/dist/src/mcp/index.js +8 -0
  18. package/dist/src/mcp/index.js.map +1 -1
  19. package/dist/src/mcp/protocol/version-negotiation.js +182 -0
  20. package/dist/src/mcp/protocol/version-negotiation.js.map +1 -0
  21. package/dist/src/mcp/registry/mcp-registry-client-2025.js +210 -0
  22. package/dist/src/mcp/registry/mcp-registry-client-2025.js.map +1 -0
  23. package/dist/src/mcp/server-factory.js +189 -0
  24. package/dist/src/mcp/server-factory.js.map +1 -0
  25. package/dist/src/mcp/server-mcp-2025.js +283 -0
  26. package/dist/src/mcp/server-mcp-2025.js.map +1 -0
  27. package/dist/src/mcp/tool-registry-progressive.js +319 -0
  28. package/dist/src/mcp/tool-registry-progressive.js.map +1 -0
  29. package/dist/src/mcp/tools/_template.js +62 -0
  30. package/dist/src/mcp/tools/_template.js.map +1 -0
  31. package/dist/src/mcp/tools/loader.js +228 -0
  32. package/dist/src/mcp/tools/loader.js.map +1 -0
  33. package/dist/src/mcp/tools/system/search.js +224 -0
  34. package/dist/src/mcp/tools/system/search.js.map +1 -0
  35. package/dist/src/mcp/tools/system/status.js +168 -0
  36. package/dist/src/mcp/tools/system/status.js.map +1 -0
  37. package/dist/src/mcp/validation/schema-validator-2025.js +198 -0
  38. package/dist/src/mcp/validation/schema-validator-2025.js.map +1 -0
  39. package/dist/src/utils/error-recovery.js +215 -0
  40. package/dist/src/utils/error-recovery.js.map +1 -0
  41. package/dist/src/utils/metrics-reader.js +10 -0
  42. package/dist/src/utils/metrics-reader.js.map +1 -1
  43. package/docs/.claude-flow/metrics/performance.json +3 -3
  44. package/docs/.claude-flow/metrics/task-metrics.json +3 -3
  45. package/docs/.github-release-issue-v2.7.33.md +488 -0
  46. package/docs/AGENTDB_BRANCH_MERGE_VERIFICATION.md +436 -0
  47. package/docs/AUTOMATIC_ERROR_RECOVERY_v2.7.35.md +321 -0
  48. package/docs/BRANCH_REVIEW_SUMMARY.md +439 -0
  49. package/docs/CONFIRMATION_AUTOMATIC_ERROR_RECOVERY.md +384 -0
  50. package/docs/DEEP_CODE_REVIEW_v2.7.33.md +1159 -0
  51. package/docs/DOCKER_TEST_RESULTS_v2.7.35.md +305 -0
  52. package/docs/MCP_2025_FEATURE_CONFIRMATION.md +698 -0
  53. package/docs/NPM_PUBLISH_GUIDE_v2.7.33.md +628 -0
  54. package/docs/REGRESSION_TEST_REPORT_v2.7.33.md +397 -0
  55. package/docs/RELEASE_NOTES_v2.7.33.md +618 -0
  56. package/docs/RELEASE_READINESS_SUMMARY.md +377 -0
  57. package/docs/RELEASE_SUMMARY_v2.7.33.md +456 -0
  58. package/docs/agentic-flow-agentdb-mcp-integration.md +1198 -0
  59. package/docs/features/automatic-error-recovery.md +333 -0
  60. package/docs/github-issues/README.md +88 -0
  61. package/docs/github-issues/wsl-enotempty-automatic-recovery.md +470 -0
  62. package/docs/mcp-2025-implementation-summary.md +459 -0
  63. package/docs/mcp-spec-2025-implementation-plan.md +1330 -0
  64. package/docs/phase-1-2-implementation-summary.md +676 -0
  65. package/docs/regression-analysis-phase-1-2.md +555 -0
  66. package/docs/troubleshooting/wsl-better-sqlite3-error.md +239 -0
  67. package/package.json +5 -2
  68. package/scripts/create-github-issue.sh +64 -0
  69. package/scripts/test-docker-wsl.sh +198 -0
  70. package/src/cli/commands/mcp.ts +86 -9
  71. package/src/cli/init/index.ts +72 -42
  72. package/src/cli/simple-commands/init/agent-copier.js +10 -5
  73. package/src/core/DatabaseManager.ts +55 -9
  74. package/src/mcp/async/job-manager-mcp25.ts +456 -0
  75. package/src/mcp/index.ts +60 -0
  76. package/src/mcp/protocol/version-negotiation.ts +329 -0
  77. package/src/mcp/registry/mcp-registry-client-2025.ts +334 -0
  78. package/src/mcp/server-factory.ts +426 -0
  79. package/src/mcp/server-mcp-2025.ts +507 -0
  80. package/src/mcp/tool-registry-progressive.ts +539 -0
  81. package/src/mcp/tools/_template.ts +174 -0
  82. package/src/mcp/tools/loader.ts +362 -0
  83. package/src/mcp/tools/system/search.ts +276 -0
  84. package/src/mcp/tools/system/status.ts +206 -0
  85. package/src/mcp/validation/schema-validator-2025.ts +294 -0
  86. package/src/utils/error-recovery.ts +325 -0
  87. package/docs/AGENTDB_V1.6.1_DEEP_REVIEW.md +0 -386
  88. package/docs/AGENT_FOLDER_STRUCTURE_FIX.md +0 -192
  89. package/docs/RECENT_RELEASES_SUMMARY.md +0 -375
  90. package/docs/V2.7.31_RELEASE_NOTES.md +0 -375
  91. /package/.claude/agents/analysis/{analyze-code-quality.md → code-review/analyze-code-quality.md} +0 -0
  92. /package/.claude/agents/architecture/{arch-system-design.md → system-design/arch-system-design.md} +0 -0
  93. /package/.claude/agents/data/{data-ml-model.md → ml/data-ml-model.md} +0 -0
  94. /package/.claude/agents/development/{dev-backend-api.md → backend/dev-backend-api.md} +0 -0
  95. /package/.claude/agents/devops/{ops-cicd-github.md → ci-cd/ops-cicd-github.md} +0 -0
  96. /package/.claude/agents/documentation/{docs-api-openapi.md → api-docs/docs-api-openapi.md} +0 -0
  97. /package/.claude/agents/specialized/{spec-mobile-react-native.md → mobile/spec-mobile-react-native.md} +0 -0
  98. /package/.claude/agents/testing/{tdd-london-swarm.md → unit/tdd-london-swarm.md} +0 -0
  99. /package/.claude/agents/testing/{production-validator.md → validation/production-validator.md} +0 -0
@@ -5,6 +5,7 @@ import { createSwarmCommands } from './swarm-commands.js';
5
5
  import { createSparcEnvironment } from './sparc-environment.js';
6
6
  import { createClaudeConfig } from './claude-config.js';
7
7
  import { createBatchToolsGuide } from './batch-tools.js';
8
+ import { errorRecovery } from '../../utils/error-recovery.js';
8
9
 
9
10
  export interface InitOptions {
10
11
  sparc?: boolean;
@@ -12,56 +13,85 @@ export interface InitOptions {
12
13
  }
13
14
 
14
15
  export async function initCommand(options: InitOptions = {}) {
15
- try {
16
- const fs = await import('fs/promises');
17
- const path = await import('path');
16
+ // Wrap entire initialization in retry logic with automatic recovery
17
+ return errorRecovery.retryWithRecovery(
18
+ async () => {
19
+ try {
20
+ const fs = await import('fs/promises');
21
+ const path = await import('path');
18
22
 
19
- printSuccess('Initializing Claude-Flow project...');
23
+ printSuccess('Initializing Claude-Flow project...');
20
24
 
21
- // Phase 1: Create directory structure
22
- console.log('\nšŸ“ Phase 1: Creating directory structure...');
23
- await createDirectoryStructure();
25
+ // Check WSL environment and apply fixes proactively
26
+ if (errorRecovery.isWSL()) {
27
+ console.log('šŸ” WSL environment detected');
28
+ const wslCheck = await errorRecovery.recoverWSLErrors();
29
+ if (wslCheck.recovered) {
30
+ console.log('āœ… WSL environment optimized\n');
31
+ }
32
+ }
24
33
 
25
- // Phase 2: Create base configuration
26
- console.log('\nāš™ļø Phase 2: Creating configuration...');
27
- await createClaudeConfig(options);
34
+ // Phase 1: Create directory structure
35
+ console.log('\nšŸ“ Phase 1: Creating directory structure...');
36
+ await createDirectoryStructure();
28
37
 
29
- // Phase 3: Create swarm commands and documentation
30
- console.log('\nšŸ¤– Phase 3: Creating swarm commands...');
31
- await createSwarmCommands();
38
+ // Phase 2: Create base configuration
39
+ console.log('\nāš™ļø Phase 2: Creating configuration...');
40
+ await createClaudeConfig(options);
32
41
 
33
- // Phase 4: Create batch tools guides
34
- console.log('\nšŸ”§ Phase 4: Creating batch tools guides...');
35
- await createBatchToolsGuide();
42
+ // Phase 3: Create swarm commands and documentation
43
+ console.log('\nšŸ¤– Phase 3: Creating swarm commands...');
44
+ await createSwarmCommands();
36
45
 
37
- // Phase 5: SPARC environment (if requested)
38
- if (options.sparc) {
39
- console.log('\nšŸš€ Phase 5: Creating SPARC environment...');
40
- await createSparcEnvironment();
41
- }
46
+ // Phase 4: Create batch tools guides
47
+ console.log('\nšŸ”§ Phase 4: Creating batch tools guides...');
48
+ await createBatchToolsGuide();
49
+
50
+ // Phase 5: SPARC environment (if requested)
51
+ if (options.sparc) {
52
+ console.log('\nšŸš€ Phase 5: Creating SPARC environment...');
53
+ await createSparcEnvironment();
54
+ }
55
+
56
+ // Success summary
57
+ console.log('\nšŸŽ‰ Project initialized successfully!');
58
+ console.log(' šŸ“ Created .claude/ directory structure');
59
+ console.log(' šŸ“‹ Created comprehensive swarm command documentation');
60
+ console.log(' šŸ”§ Created batch tools coordination guides');
61
+ console.log(' šŸ“– Created detailed usage examples with orchestration');
42
62
 
43
- // Success summary
44
- console.log('\nšŸŽ‰ Project initialized successfully!');
45
- console.log(' šŸ“ Created .claude/ directory structure');
46
- console.log(' šŸ“‹ Created comprehensive swarm command documentation');
47
- console.log(' šŸ”§ Created batch tools coordination guides');
48
- console.log(' šŸ“– Created detailed usage examples with orchestration');
63
+ console.log('\n Next steps:');
64
+ console.log(' 1. Run "claude-flow swarm --help" to see swarm options');
65
+ console.log(' 2. Check .claude/commands/swarm/ for detailed documentation');
66
+ console.log(' 3. Review batch tools guide for orchestration patterns');
67
+ console.log(' 4. Run "claude-flow help" for all available commands');
49
68
 
50
- console.log('\n Next steps:');
51
- console.log(' 1. Run "claude-flow swarm --help" to see swarm options');
52
- console.log(' 2. Check .claude/commands/swarm/ for detailed documentation');
53
- console.log(' 3. Review batch tools guide for orchestration patterns');
54
- console.log(' 4. Run "claude-flow help" for all available commands');
69
+ if (options.sparc) {
70
+ console.log(' 5. Run "claude-flow sparc modes" to see available SPARC modes');
71
+ console.log(' 6. Use TodoWrite/TodoRead for task coordination');
72
+ console.log(' 7. Use Task tool for parallel agent execution');
73
+ }
74
+ } catch (error) {
75
+ // Attempt automatic error recovery
76
+ const recovery = await errorRecovery.recoverInitErrors(error);
55
77
 
56
- if (options.sparc) {
57
- console.log(' 5. Run "claude-flow sparc modes" to see available SPARC modes');
58
- console.log(' 6. Use TodoWrite/TodoRead for task coordination');
59
- console.log(' 7. Use Task tool for parallel agent execution');
78
+ if (recovery.recovered) {
79
+ console.log('āœ… Recovered from error, retrying initialization...\n');
80
+ throw error; // Trigger retry
81
+ } else {
82
+ printError(
83
+ `Failed to initialize project: ${error instanceof Error ? error.message : String(error)}`,
84
+ );
85
+ throw error;
86
+ }
87
+ }
88
+ },
89
+ {
90
+ maxRetries: options.force ? 5 : 3,
91
+ delay: 1000,
92
+ onRetry: (attempt, error) => {
93
+ console.log(`\nšŸ”„ Retry attempt ${attempt} after error recovery...`);
94
+ }
60
95
  }
61
- } catch (error) {
62
- printError(
63
- `Failed to initialize project: ${error instanceof Error ? error.message : String(error)}`,
64
- );
65
- throw error;
66
- }
96
+ );
67
97
  }
@@ -135,30 +135,35 @@ export async function copyAgentFiles(targetDir, options = {}) {
135
135
  * Create agent directories structure
136
136
  */
137
137
  export async function createAgentDirectories(targetDir, dryRun = false) {
138
- // Flat structure - all .md files directly in category folders
139
138
  const agentDirs = [
140
139
  '.claude',
141
140
  '.claude/agents',
142
141
  '.claude/agents/core',
143
- '.claude/agents/swarm',
142
+ '.claude/agents/swarm',
144
143
  '.claude/agents/hive-mind',
145
144
  '.claude/agents/consensus',
146
145
  '.claude/agents/optimization',
147
146
  '.claude/agents/github',
148
147
  '.claude/agents/sparc',
149
148
  '.claude/agents/testing',
149
+ '.claude/agents/testing/unit',
150
+ '.claude/agents/testing/validation',
150
151
  '.claude/agents/templates',
151
152
  '.claude/agents/analysis',
153
+ '.claude/agents/analysis/code-review',
152
154
  '.claude/agents/architecture',
155
+ '.claude/agents/architecture/system-design',
153
156
  '.claude/agents/data',
157
+ '.claude/agents/data/ml',
154
158
  '.claude/agents/development',
159
+ '.claude/agents/development/backend',
155
160
  '.claude/agents/devops',
161
+ '.claude/agents/devops/ci-cd',
156
162
  '.claude/agents/documentation',
163
+ '.claude/agents/documentation/api-docs',
157
164
  '.claude/agents/specialized',
165
+ '.claude/agents/specialized/mobile',
158
166
  '.claude/agents/flow-nexus',
159
- '.claude/agents/goal',
160
- '.claude/agents/neural',
161
- '.claude/agents/reasoning',
162
167
  '.claude/commands',
163
168
  '.claude/commands/flow-nexus'
164
169
  ];
@@ -12,6 +12,8 @@ export class DatabaseManager implements IDatabaseProvider {
12
12
  private dbType: 'sqlite' | 'json';
13
13
  private dbPath: string;
14
14
  private initialized: boolean = false;
15
+ private retryCount: number = 0;
16
+ private maxRetries: number = 3;
15
17
 
16
18
  constructor(dbType: 'sqlite' | 'json' = 'sqlite', dbPath?: string) {
17
19
  this.dbType = dbType;
@@ -19,18 +21,36 @@ export class DatabaseManager implements IDatabaseProvider {
19
21
 
20
22
  // Try SQLite first, fallback to JSON if needed
21
23
  if (this.dbType === 'sqlite') {
22
- try {
23
- this.provider = new SQLiteProvider(this.dbPath);
24
- } catch (error) {
25
- console.warn('SQLite not available, falling back to JSON storage:', error);
26
- this.provider = new JSONProvider(this.dbPath.replace('.sqlite', '.json'));
27
- this.dbType = 'json';
28
- }
24
+ this.provider = this.initializeSQLiteWithRecovery();
29
25
  } else {
30
26
  this.provider = new JSONProvider(this.dbPath);
31
27
  }
32
28
  }
33
29
 
30
+ /**
31
+ * Initialize SQLite with automatic error recovery
32
+ */
33
+ private initializeSQLiteWithRecovery(): IDatabaseProvider {
34
+ try {
35
+ return new SQLiteProvider(this.dbPath);
36
+ } catch (error) {
37
+ const errorMsg = error instanceof Error ? error.message : String(error);
38
+
39
+ // Check if it's an npm cache error
40
+ if (errorMsg.includes('ENOTEMPTY') || errorMsg.includes('better-sqlite3')) {
41
+ console.warn('āš ļø SQLite initialization failed due to npm cache error');
42
+ console.warn(' Will attempt automatic recovery during initialize()');
43
+ } else {
44
+ console.warn('SQLite not available, falling back to JSON storage:', error);
45
+ }
46
+
47
+ // Fallback to JSON for now
48
+ this.provider = new JSONProvider(this.dbPath.replace('.sqlite', '.json'));
49
+ this.dbType = 'json';
50
+ return this.provider;
51
+ }
52
+ }
53
+
34
54
  private getDefaultPath(): string {
35
55
  const baseDir = path.join(process.cwd(), '.claude-flow');
36
56
  return this.dbType === 'sqlite'
@@ -40,8 +60,34 @@ export class DatabaseManager implements IDatabaseProvider {
40
60
 
41
61
  async initialize(): Promise<void> {
42
62
  await fs.ensureDir(path.dirname(this.dbPath));
43
- await this.provider.initialize();
44
- this.initialized = true;
63
+
64
+ try {
65
+ await this.provider.initialize();
66
+ this.initialized = true;
67
+ } catch (error) {
68
+ // If JSON provider failed, just propagate the error
69
+ if (this.dbType === 'json') {
70
+ throw error;
71
+ }
72
+
73
+ // For SQLite errors, attempt recovery
74
+ const errorMsg = error instanceof Error ? error.message : String(error);
75
+ if (this.retryCount < this.maxRetries) {
76
+ console.warn(`āš ļø Database initialization failed (attempt ${this.retryCount + 1}/${this.maxRetries})`);
77
+ console.warn(` Error: ${errorMsg}`);
78
+
79
+ // Attempt to recover by switching to JSON
80
+ console.log('šŸ”„ Switching to JSON storage as fallback...');
81
+ this.provider = new JSONProvider(this.dbPath.replace('.sqlite', '.json'));
82
+ this.dbType = 'json';
83
+ this.retryCount++;
84
+
85
+ // Retry initialization with JSON provider
86
+ await this.initialize();
87
+ } else {
88
+ throw error;
89
+ }
90
+ }
45
91
  }
46
92
 
47
93
  async store(key: string, value: any, namespace: string = 'default'): Promise<void> {