claude-flow 2.5.0-alpha.139 → 2.7.0-alpha

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 (171) hide show
  1. package/.claude/agents/reasoning/README.md +171 -0
  2. package/.claude/agents/reasoning/agent.md +816 -0
  3. package/.claude/agents/reasoning/example-reasoning-agent-template.md +362 -0
  4. package/.claude/agents/reasoning/goal-planner.md +73 -0
  5. package/.claude/settings.json +2 -1
  6. package/.claude/sparc-modes.json +108 -0
  7. package/README.md +45 -55
  8. package/bin/claude-flow +1 -1
  9. package/dist/src/cli/command-registry.js +70 -6
  10. package/dist/src/cli/command-registry.js.map +1 -1
  11. package/dist/src/cli/commands/hive-mind/pause.js +2 -9
  12. package/dist/src/cli/commands/hive-mind/pause.js.map +1 -1
  13. package/dist/src/cli/commands/index.js +1 -114
  14. package/dist/src/cli/commands/index.js.map +1 -1
  15. package/dist/src/cli/commands/swarm-spawn.js +5 -33
  16. package/dist/src/cli/commands/swarm-spawn.js.map +1 -1
  17. package/dist/src/cli/help-formatter.js +0 -3
  18. package/dist/src/cli/help-formatter.js.map +1 -1
  19. package/dist/src/cli/help-text.js +69 -7
  20. package/dist/src/cli/help-text.js.map +1 -1
  21. package/dist/src/cli/simple-cli.js +182 -172
  22. package/dist/src/cli/simple-cli.js.map +1 -1
  23. package/dist/src/cli/simple-commands/agent-booster.js +415 -0
  24. package/dist/src/cli/simple-commands/agent-booster.js.map +1 -0
  25. package/dist/src/cli/simple-commands/agent.js +856 -13
  26. package/dist/src/cli/simple-commands/agent.js.map +1 -1
  27. package/dist/src/cli/simple-commands/env-template.js +180 -0
  28. package/dist/src/cli/simple-commands/env-template.js.map +1 -0
  29. package/dist/src/cli/simple-commands/hooks.js +233 -0
  30. package/dist/src/cli/simple-commands/hooks.js.map +1 -1
  31. package/dist/src/cli/simple-commands/init/help.js +23 -0
  32. package/dist/src/cli/simple-commands/init/help.js.map +1 -1
  33. package/dist/src/cli/simple-commands/init/index.js +63 -0
  34. package/dist/src/cli/simple-commands/init/index.js.map +1 -1
  35. package/dist/src/cli/simple-commands/memory.js +307 -16
  36. package/dist/src/cli/simple-commands/memory.js.map +1 -1
  37. package/dist/src/cli/simple-commands/proxy.js +304 -0
  38. package/dist/src/cli/simple-commands/proxy.js.map +1 -0
  39. package/dist/src/cli/simple-commands/sparc.js +16 -19
  40. package/dist/src/cli/simple-commands/sparc.js.map +1 -1
  41. package/dist/src/cli/validation-helper.js.map +1 -1
  42. package/dist/src/execution/agent-executor.js +181 -0
  43. package/dist/src/execution/agent-executor.js.map +1 -0
  44. package/dist/src/execution/index.js +12 -0
  45. package/dist/src/execution/index.js.map +1 -0
  46. package/dist/src/execution/provider-manager.js +110 -0
  47. package/dist/src/execution/provider-manager.js.map +1 -0
  48. package/dist/src/hooks/index.js +0 -3
  49. package/dist/src/hooks/index.js.map +1 -1
  50. package/dist/src/hooks/redaction-hook.js +89 -0
  51. package/dist/src/hooks/redaction-hook.js.map +1 -0
  52. package/dist/src/mcp/claude-flow-tools.js +205 -150
  53. package/dist/src/mcp/claude-flow-tools.js.map +1 -1
  54. package/dist/src/mcp/mcp-server.js +125 -0
  55. package/dist/src/mcp/mcp-server.js.map +1 -1
  56. package/dist/src/sdk/query-control.js +293 -139
  57. package/dist/src/sdk/query-control.js.map +1 -1
  58. package/dist/src/sdk/session-forking.js +206 -129
  59. package/dist/src/sdk/session-forking.js.map +1 -1
  60. package/dist/src/utils/key-redactor.js +108 -0
  61. package/dist/src/utils/key-redactor.js.map +1 -0
  62. package/dist/src/utils/metrics-reader.js +37 -39
  63. package/dist/src/utils/metrics-reader.js.map +1 -1
  64. package/docs/AGENT-BOOSTER-INTEGRATION.md +407 -0
  65. package/docs/AGENTIC-FLOW-INTEGRATION-GUIDE.md +753 -0
  66. package/docs/AGENTIC_FLOW_EXECUTION_FIX_REPORT.md +474 -0
  67. package/docs/AGENTIC_FLOW_INTEGRATION_STATUS.md +143 -0
  68. package/docs/AGENTIC_FLOW_MVP_COMPLETE.md +367 -0
  69. package/docs/AGENTIC_FLOW_SECURITY_TEST_REPORT.md +369 -0
  70. package/docs/COMMAND-VERIFICATION-REPORT.md +441 -0
  71. package/docs/COMMIT_SUMMARY.md +247 -0
  72. package/docs/DEEP_REVIEW_COMPREHENSIVE_REPORT.md +922 -0
  73. package/docs/DOCKER-VALIDATION-REPORT.md +281 -0
  74. package/docs/ENV-SETUP-GUIDE.md +270 -0
  75. package/docs/FINAL_PRE_PUBLISH_VALIDATION.md +823 -0
  76. package/docs/FINAL_VALIDATION_REPORT.md +165 -0
  77. package/docs/HOOKS-V2-MODIFICATION.md +146 -0
  78. package/docs/INDEX.md +568 -0
  79. package/docs/INTEGRATION_COMPLETE.md +414 -0
  80. package/docs/MEMORY_REDACTION_TEST_REPORT.md +300 -0
  81. package/docs/PERFORMANCE-SYSTEMS-STATUS.md +340 -0
  82. package/docs/PRE_RELEASE_FIXES_REPORT.md +435 -0
  83. package/docs/README.md +35 -0
  84. package/docs/REASONING-AGENTS.md +482 -0
  85. package/docs/REASONINGBANK-AGENT-CREATION-GUIDE.md +813 -0
  86. package/docs/REASONINGBANK-ANALYSIS-COMPLETE.md +479 -0
  87. package/docs/REASONINGBANK-BENCHMARK-RESULTS.md +166 -0
  88. package/docs/REASONINGBANK-BENCHMARK.md +396 -0
  89. package/docs/REASONINGBANK-CLI-INTEGRATION.md +455 -0
  90. package/docs/REASONINGBANK-CORE-INTEGRATION.md +658 -0
  91. package/docs/REASONINGBANK-COST-OPTIMIZATION.md +329 -0
  92. package/docs/REASONINGBANK-DEMO.md +419 -0
  93. package/docs/REASONINGBANK-INTEGRATION-COMPLETE.md +249 -0
  94. package/docs/REASONINGBANK-VALIDATION.md +532 -0
  95. package/docs/REASONINGBANK_ARCHITECTURE.md +475 -0
  96. package/docs/REASONINGBANK_INTEGRATION_COMPLETE.md +558 -0
  97. package/docs/REASONINGBANK_INTEGRATION_PLAN.md +1188 -0
  98. package/docs/REGRESSION-ANALYSIS-REPORT.md +500 -0
  99. package/docs/RELEASE_v2.6.0-alpha.2.md +658 -0
  100. package/docs/api/API_DOCUMENTATION.md +721 -0
  101. package/docs/architecture/ARCHITECTURE.md +1690 -0
  102. package/docs/ci-cd/README.md +368 -0
  103. package/docs/development/DEPLOYMENT.md +2348 -0
  104. package/docs/development/DEVELOPMENT_WORKFLOW.md +1333 -0
  105. package/docs/development/build-analysis-report.md +252 -0
  106. package/docs/development/pair-optimization.md +156 -0
  107. package/docs/development/token-tracking-status.md +103 -0
  108. package/docs/development/training-pipeline-demo.md +163 -0
  109. package/docs/development/training-pipeline-real-only.md +196 -0
  110. package/docs/epic-sdk-integration.md +1269 -0
  111. package/docs/experimental/RIEMANN_HYPOTHESIS_PROOF.md +124 -0
  112. package/docs/experimental/computational_verification.py +436 -0
  113. package/docs/experimental/novel_approaches.md +560 -0
  114. package/docs/experimental/riemann_hypothesis_analysis.md +263 -0
  115. package/docs/experimental/riemann_proof_attempt.md +124 -0
  116. package/docs/experimental/riemann_synthesis.md +277 -0
  117. package/docs/experimental/verification_results.json +12 -0
  118. package/docs/experimental/visualization_insights.md +720 -0
  119. package/docs/guides/USER_GUIDE.md +1138 -0
  120. package/docs/guides/token-tracking-guide.md +291 -0
  121. package/docs/reference/AGENTS.md +1011 -0
  122. package/docs/reference/MCP_TOOLS.md +2188 -0
  123. package/docs/reference/SPARC.md +717 -0
  124. package/docs/reference/SWARM.md +2000 -0
  125. package/docs/sdk/CLAUDE-CODE-SDK-DEEP-ANALYSIS.md +649 -0
  126. package/docs/sdk/CLAUDE-FLOW-SDK-INTEGRATION-ANALYSIS.md +242 -0
  127. package/docs/sdk/INTEGRATION-ROADMAP.md +420 -0
  128. package/docs/sdk/MCP-TOOLS-UPDATE.md +270 -0
  129. package/docs/sdk/SDK-ADVANCED-FEATURES-INTEGRATION.md +723 -0
  130. package/docs/sdk/SDK-ALL-FEATURES-INTEGRATION-MATRIX.md +612 -0
  131. package/docs/sdk/SDK-INTEGRATION-COMPLETE.md +358 -0
  132. package/docs/sdk/SDK-INTEGRATION-PHASES-V2.5.md +750 -0
  133. package/docs/sdk/SDK-LEVERAGE-REAL-FEATURES.md +676 -0
  134. package/docs/sdk/SDK-VALIDATION-RESULTS.md +400 -0
  135. package/docs/sdk/epic-sdk-integration.md +1269 -0
  136. package/docs/setup/remote-setup.md +93 -0
  137. package/docs/validation/final-validation-summary.md +220 -0
  138. package/docs/validation/verification-integration.md +190 -0
  139. package/docs/validation/verification-validation.md +349 -0
  140. package/docs/wiki/background-commands.md +1213 -0
  141. package/docs/wiki/session-persistence.md +342 -0
  142. package/docs/wiki/stream-chain-command.md +537 -0
  143. package/package.json +4 -2
  144. package/src/cli/command-registry.js +70 -5
  145. package/src/cli/commands/hive-mind/pause.ts +2 -15
  146. package/src/cli/commands/index.ts +1 -84
  147. package/src/cli/commands/swarm-spawn.ts +3 -47
  148. package/src/cli/help-text.js +42 -7
  149. package/src/cli/simple-cli.ts +18 -8
  150. package/src/cli/simple-commands/agent-booster.js +515 -0
  151. package/src/cli/simple-commands/agent.js +1001 -12
  152. package/src/cli/simple-commands/agent.ts +137 -0
  153. package/src/cli/simple-commands/config.ts +127 -0
  154. package/src/cli/simple-commands/env-template.js +190 -0
  155. package/src/cli/simple-commands/hooks.js +310 -0
  156. package/src/cli/simple-commands/init/help.js +23 -0
  157. package/src/cli/simple-commands/init/index.js +84 -6
  158. package/src/cli/simple-commands/memory.js +363 -16
  159. package/src/cli/simple-commands/proxy.js +384 -0
  160. package/src/cli/simple-commands/sparc.js +16 -19
  161. package/src/execution/agent-executor.ts +306 -0
  162. package/src/execution/index.ts +19 -0
  163. package/src/execution/provider-manager.ts +187 -0
  164. package/src/hooks/index.ts +0 -5
  165. package/src/hooks/redaction-hook.ts +115 -0
  166. package/src/mcp/claude-flow-tools.ts +203 -120
  167. package/src/mcp/mcp-server.js +86 -0
  168. package/src/sdk/query-control.ts +377 -223
  169. package/src/sdk/session-forking.ts +312 -207
  170. package/src/utils/key-redactor.js +178 -0
  171. package/src/utils/key-redactor.ts +184 -0
@@ -0,0 +1,1333 @@
1
+ # 🛠️ Claude-Flow Development Workflow Guide
2
+
3
+ ## Table of Contents
4
+
5
+ - [Getting Started](#getting-started)
6
+ - [Development Environment](#development-environment)
7
+ - [Project Structure](#project-structure)
8
+ - [Development Workflow](#development-workflow)
9
+ - [SPARC Development](#sparc-development)
10
+ - [Swarm Development](#swarm-development)
11
+ - [Testing Strategy](#testing-strategy)
12
+ - [Code Standards](#code-standards)
13
+ - [CI/CD Pipeline](#cicd-pipeline)
14
+ - [Contributing](#contributing)
15
+ - [Release Process](#release-process)
16
+ - [Best Practices](#best-practices)
17
+
18
+ ---
19
+
20
+ ## Getting Started
21
+
22
+ ### Prerequisites for Development
23
+
24
+ ```bash
25
+ # Required tools (as per package.json engines)
26
+ node --version # v20.0.0 or higher
27
+ npm --version # v9.0.0 or higher
28
+ git --version # v2.30.0 or higher
29
+
30
+ # Recommended tools
31
+ pnpm --version # Preferred package manager (especially on Windows)
32
+ docker --version # For containerized development
33
+ code --version # VS Code for development
34
+ ```
35
+
36
+ ### Setting Up Development Environment
37
+
38
+ ```bash
39
+ # Clone the repository
40
+ git clone https://github.com/ruvnet/claude-flow.git
41
+ cd claude-flow
42
+
43
+ # Install dependencies (use pnpm on Windows)
44
+ npm install
45
+ # OR on Windows:
46
+ # pnpm install
47
+
48
+ # Start development mode
49
+ npm run dev
50
+
51
+ # Build TypeScript
52
+ npm run build:ts
53
+
54
+ # Test the CLI binary
55
+ chmod +x ./bin/claude-flow
56
+ ./bin/claude-flow --version
57
+ ```
58
+
59
+ ### Current Development Scripts (v2.0.0-alpha.88)
60
+
61
+ ```json
62
+ {
63
+ "scripts": {
64
+ "dev": "tsx src/cli/main.ts",
65
+ "build": "npm run clean && npm run update-version && npm run build:esm && npm run build:cjs && npm run build:binary",
66
+ "build:esm": "tsc",
67
+ "build:cjs": "tsc -p tsconfig.cjs.json",
68
+ "build:ts": "npm run build:esm && npm run build:cjs",
69
+ "build:binary": "pkg dist/cli/main.js --targets node20-linux-x64,node20-macos-x64,node20-win-x64 --output bin/claude-flow",
70
+ "clean": "rm -rf dist dist-cjs",
71
+ "test": "NODE_OPTIONS='--experimental-vm-modules' jest --bail --maxWorkers=1 --forceExit",
72
+ "test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
73
+ "test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
74
+ "test:ci": "NODE_OPTIONS='--experimental-vm-modules' jest --ci --coverage --maxWorkers=2",
75
+ "test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/unit",
76
+ "test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/integration",
77
+ "test:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/e2e",
78
+ "test:performance": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/performance",
79
+ "test:comprehensive": "node scripts/test-comprehensive.js",
80
+ "lint": "eslint src --ext .ts --max-warnings 0",
81
+ "format": "prettier --write 'src/**/*.{ts,js,json}'",
82
+ "typecheck": "tsc --noEmit",
83
+ "typecheck:watch": "tsc --noEmit --watch",
84
+ "diagnostics": "node -e \"import('./dist/monitoring/diagnostics.js').then(m => m.DiagnosticManager.quickDiagnostic().then(console.log))\"",
85
+ "health-check": "node -e \"import('./dist/monitoring/health-check.js').then(m => new m.HealthCheckManager().performHealthCheck().then(console.log))\""
86
+ }
87
+ }
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Development Environment
93
+
94
+ ### VS Code Configuration
95
+
96
+ ```json
97
+ // .vscode/settings.json
98
+ {
99
+ "editor.formatOnSave": true,
100
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
101
+ "editor.codeActionsOnSave": {
102
+ "source.fixAll.eslint": true
103
+ },
104
+ "typescript.tsdk": "node_modules/typescript/lib",
105
+ "jest.autoRun": {
106
+ "watch": true,
107
+ "onSave": "test-src-file"
108
+ },
109
+ "files.exclude": {
110
+ "**/dist": true,
111
+ "**/node_modules": true,
112
+ "**/.swarm": true
113
+ }
114
+ }
115
+ ```
116
+
117
+ ### VS Code Extensions
118
+
119
+ ```json
120
+ // .vscode/extensions.json
121
+ {
122
+ "recommendations": [
123
+ "dbaeumer.vscode-eslint",
124
+ "esbenp.prettier-vscode",
125
+ "ms-vscode.vscode-typescript-next",
126
+ "orta.vscode-jest",
127
+ "streetsidesoftware.code-spell-checker",
128
+ "wayou.vscode-todo-highlight",
129
+ "gruntfuggly.todo-tree",
130
+ "eamodio.gitlens"
131
+ ]
132
+ }
133
+ ```
134
+
135
+ ### Debug Configuration
136
+
137
+ ```json
138
+ // .vscode/launch.json
139
+ {
140
+ "version": "0.2.0",
141
+ "configurations": [
142
+ {
143
+ "type": "node",
144
+ "request": "launch",
145
+ "name": "Debug CLI",
146
+ "program": "${workspaceFolder}/src/cli/main.ts",
147
+ "args": ["swarm", "test task"],
148
+ "runtimeArgs": ["-r", "ts-node/register"],
149
+ "sourceMaps": true,
150
+ "env": {
151
+ "NODE_ENV": "development",
152
+ "CLAUDE_FLOW_DEBUG": "true"
153
+ }
154
+ },
155
+ {
156
+ "type": "node",
157
+ "request": "launch",
158
+ "name": "Debug Tests",
159
+ "program": "${workspaceFolder}/node_modules/.bin/jest",
160
+ "args": ["--runInBand", "--no-cache"],
161
+ "console": "integratedTerminal",
162
+ "internalConsoleOptions": "neverOpen"
163
+ }
164
+ ]
165
+ }
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Project Structure
171
+
172
+ ### Directory Structure
173
+
174
+ ```
175
+ claude-flow/
176
+ ├── src/ # Source code
177
+ │ ├── cli/ # CLI commands and entry points
178
+ │ ├── core/ # Core orchestration logic
179
+ │ ├── agents/ # Agent implementations
180
+ │ ├── swarm/ # Swarm coordination
181
+ │ ├── task/ # Task management
182
+ │ ├── memory/ # Memory system
183
+ │ ├── providers/ # LLM provider integrations
184
+ │ ├── api/ # REST API implementation
185
+ │ ├── mcp/ # MCP protocol implementation
186
+ │ ├── hooks/ # Hook system
187
+ │ ├── monitoring/ # Health check and diagnostics
188
+ │ ├── utils/ # Utility functions
189
+ │ └── types/ # TypeScript type definitions
190
+ ├── tests/ # Test suites
191
+ │ ├── unit/ # Unit tests
192
+ │ ├── integration/ # Integration tests
193
+ │ ├── e2e/ # End-to-end tests
194
+ │ └── performance/ # Performance tests
195
+ ├── docs/ # Documentation
196
+ │ ├── API_DOCUMENTATION.md
197
+ │ ├── ARCHITECTURE.md
198
+ │ ├── DEPLOYMENT.md
199
+ │ └── INDEX.md
200
+ ├── examples/ # Example code and tutorials
201
+ │ ├── 01-basic-usage/
202
+ │ ├── 02-advanced-patterns/
203
+ │ ├── 03-swarm-orchestration/
204
+ │ ├── 04-mcp-integration/
205
+ │ ├── 05-swarm-apps/
206
+ │ └── 06-tutorials/
207
+ ├── scripts/ # Build and utility scripts
208
+ ├── .claude/ # Claude-specific configurations
209
+ │ ├── agents/ # Agent definitions
210
+ │ ├── checkpoints/ # Session checkpoints
211
+ │ └── metrics/ # Performance metrics
212
+ ├── bin/ # Binary executables
213
+ │ ├── claude-flow # Main CLI binary
214
+ │ ├── claude-flow-swarm # Swarm-specific binary
215
+ │ └── claude-flow-ui # UI binary
216
+ └── .github/ # GitHub workflows and templates
217
+ ```
218
+
219
+ ### Module Organization
220
+
221
+ ```typescript
222
+ // src/core/orchestrator.ts
223
+ export class Orchestrator {
224
+ // Main orchestration logic
225
+ }
226
+
227
+ // src/agents/base.ts
228
+ export abstract class BaseAgent {
229
+ // Base agent implementation
230
+ }
231
+
232
+ // src/agents/specialized/coder.ts
233
+ export class CoderAgent extends BaseAgent {
234
+ // Specialized coder agent
235
+ }
236
+
237
+ // src/swarm/coordinator.ts
238
+ export class SwarmCoordinator {
239
+ // Swarm coordination logic
240
+ }
241
+
242
+ // src/memory/manager.ts
243
+ export class MemoryManager {
244
+ // Memory management system
245
+ }
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Development Workflow
251
+
252
+ ### Git Workflow
253
+
254
+ #### Branch Strategy
255
+
256
+ ```bash
257
+ main # Production-ready code
258
+ ├── develop # Integration branch
259
+ │ ├── feature/* # Feature branches
260
+ │ ├── fix/* # Bug fix branches
261
+ │ └── refactor/* # Refactoring branches
262
+ ├── release/* # Release preparation
263
+ └── hotfix/* # Emergency fixes
264
+ ```
265
+
266
+ #### Creating a Feature with SPARC
267
+
268
+ ```bash
269
+ # Create feature branch
270
+ git checkout -b feature/agent-improvements
271
+
272
+ # Use SPARC for architecture
273
+ npx claude-flow@alpha sparc run architect "Agent selection improvements"
274
+
275
+ # Implement with TDD
276
+ npx claude-flow@alpha sparc run tdd "Better agent selection algorithm"
277
+
278
+ # Start development mode
279
+ npm run dev
280
+
281
+ # Run comprehensive tests
282
+ npm run test:comprehensive
283
+ npm run test:coverage
284
+
285
+ # Security review
286
+ npx claude-flow@alpha sparc run security-review "Review agent selection"
287
+
288
+ # Commit changes
289
+ git add .
290
+ git commit -m "feat: improve agent selection algorithm"
291
+
292
+ # Push to remote
293
+ git push origin feature/agent-improvements
294
+
295
+ # Create pull request with swarm review
296
+ npx claude-flow@alpha swarm spawn code-review-swarm
297
+ gh pr create --title "Improve agent selection" --body "..."
298
+ ```
299
+
300
+ ### Commit Convention
301
+
302
+ We follow [Conventional Commits](https://www.conventionalcommits.org/):
303
+
304
+ ```bash
305
+ # Format
306
+ <type>(<scope>): <subject>
307
+
308
+ # Types
309
+ feat: # New feature
310
+ fix: # Bug fix
311
+ docs: # Documentation
312
+ style: # Code style
313
+ refactor: # Refactoring
314
+ test: # Tests
315
+ chore: # Maintenance
316
+ perf: # Performance
317
+
318
+ # Examples
319
+ feat(agents): add new ml-developer agent type
320
+ fix(swarm): resolve coordination deadlock issue
321
+ docs(api): update REST API documentation
322
+ test(memory): add unit tests for memory manager
323
+ ```
324
+
325
+ ### Code Review Process
326
+
327
+ ```markdown
328
+ ## Pull Request Template
329
+
330
+ ### Description
331
+ Brief description of changes
332
+
333
+ ### Type of Change
334
+ - [ ] Bug fix
335
+ - [ ] New feature
336
+ - [ ] Breaking change
337
+ - [ ] Documentation update
338
+
339
+ ### Testing
340
+ - [ ] Unit tests pass
341
+ - [ ] Integration tests pass
342
+ - [ ] Manual testing completed
343
+
344
+ ### Checklist
345
+ - [ ] Code follows style guidelines
346
+ - [ ] Self-review completed
347
+ - [ ] Comments added for complex code
348
+ - [ ] Documentation updated
349
+ - [ ] No new warnings
350
+ ```
351
+
352
+ ---
353
+
354
+ ## SPARC Development
355
+
356
+ ### Available SPARC Modes (16 Total)
357
+
358
+ ```bash
359
+ # List all available modes
360
+ npx claude-flow@alpha sparc modes
361
+
362
+ # Available modes:
363
+ # 🏗️ architect - System architecture design
364
+ # 🧠 code - Auto-coding and implementation
365
+ # 🧪 tdd - Test-driven development
366
+ # 🪲 debug - Debugging and troubleshooting
367
+ # 🛡️ security-review - Security analysis
368
+ # 📚 docs-writer - Documentation generation
369
+ # 🔗 integration - System integration
370
+ # 📈 post-deployment-monitoring-mode - Deployment monitoring
371
+ # 🧹 refinement-optimization-mode - Code optimization
372
+ # ❓ ask - Interactive Q&A
373
+ # 🚀 devops - DevOps and deployment
374
+ # 📘 tutorial - SPARC tutorial mode
375
+ # 🔐 supabase-admin - Supabase administration
376
+ # 📋 spec-pseudocode - Specification writing
377
+ # ♾️ mcp - MCP integration
378
+ # ⚡️ sparc - SPARC orchestration
379
+ ```
380
+
381
+ ### Using SPARC Modes
382
+
383
+ ```bash
384
+ # Single mode execution
385
+ npx claude-flow@alpha sparc run architect "Design user authentication system"
386
+ npx claude-flow@alpha sparc run tdd "Implement user login functionality"
387
+ npx claude-flow@alpha sparc run security-review "Review API endpoints"
388
+
389
+ # Batch mode execution (multiple modes)
390
+ npx claude-flow@alpha sparc batch architect,tdd,security-review "Build secure API"
391
+
392
+ # Full pipeline execution
393
+ npx claude-flow@alpha sparc pipeline "Complete user management system"
394
+
395
+ # TDD workflow
396
+ npx claude-flow@alpha sparc tdd "User registration feature"
397
+ ```
398
+
399
+ ### SPARC Development Workflow
400
+
401
+ ```mermaid
402
+ graph TD
403
+ A[Requirements] --> B[architect]
404
+ B --> C[spec-pseudocode]
405
+ C --> D[tdd]
406
+ D --> E[code]
407
+ E --> F[debug]
408
+ F --> G[security-review]
409
+ G --> H[integration]
410
+ H --> I[devops]
411
+ I --> J[post-deployment-monitoring-mode]
412
+ J --> K[docs-writer]
413
+ ```
414
+
415
+ ---
416
+
417
+ ## Swarm Development
418
+
419
+ ### Swarm Architecture
420
+
421
+ ```bash
422
+ # Initialize swarm with different topologies
423
+ npx claude-flow@alpha swarm init --topology mesh --max-agents 10
424
+ npx claude-flow@alpha swarm init --topology hierarchical --max-agents 15
425
+ npx claude-flow@alpha swarm init --topology adaptive --max-agents 8
426
+
427
+ # Spawn specialized agents
428
+ npx claude-flow@alpha swarm spawn coder
429
+ npx claude-flow@alpha swarm spawn reviewer
430
+ npx claude-flow@alpha swarm spawn tester
431
+ npx claude-flow@alpha swarm spawn system-architect
432
+
433
+ # Coordinate multi-agent tasks
434
+ npx claude-flow@alpha swarm coordinate "Build full-stack application"
435
+ ```
436
+
437
+ ### Available Agent Types (54 Total)
438
+
439
+ #### Core Development Agents
440
+ ```bash
441
+ - coder # Implementation specialist
442
+ - reviewer # Code quality reviewer
443
+ - tester # Test creation and validation
444
+ - planner # Strategic planning
445
+ - researcher # Information gathering
446
+ - backend-dev # API development
447
+ - mobile-dev # React Native/mobile
448
+ - ml-developer # Machine learning
449
+ - system-architect # High-level design
450
+ - sparc-coder # TDD implementation
451
+ - production-validator # Real environment validation
452
+ ```
453
+
454
+ #### Swarm Coordination Agents
455
+ ```bash
456
+ - hierarchical-coordinator # Queen-led coordination
457
+ - mesh-coordinator # Peer-to-peer coordination
458
+ - adaptive-coordinator # Dynamic topology
459
+ - collective-intelligence-coordinator # Hive-mind
460
+ - swarm-memory-manager # Distributed memory
461
+ - byzantine-coordinator # Fault tolerance
462
+ - raft-manager # Leader election
463
+ - consensus-builder # Decision-making
464
+ ```
465
+
466
+ #### GitHub Integration Agents
467
+ ```bash
468
+ - github-modes # Comprehensive integration
469
+ - pr-manager # Pull requests
470
+ - code-review-swarm # Multi-agent review
471
+ - issue-tracker # Issue management
472
+ - release-manager # Release coordination
473
+ ```
474
+
475
+ ### Swarm Patterns
476
+
477
+ #### Full-Stack Development Swarm
478
+ ```javascript
479
+ // Spawn 8-agent full-stack swarm
480
+ const swarm = {
481
+ architecture: "system-architect",
482
+ backend: "backend-dev",
483
+ frontend: "mobile-dev",
484
+ database: "coder",
485
+ api_docs: "api-docs",
486
+ cicd: "cicd-engineer",
487
+ testing: "performance-benchmarker",
488
+ validation: "production-validator"
489
+ };
490
+ ```
491
+
492
+ #### Code Review Swarm
493
+ ```javascript
494
+ // Multi-agent code review
495
+ const reviewSwarm = {
496
+ security: "security-review",
497
+ performance: "perf-analyzer",
498
+ quality: "reviewer",
499
+ testing: "tester",
500
+ documentation: "docs-writer"
501
+ };
502
+ ```
503
+
504
+ ---
505
+
506
+ ## Testing Strategy
507
+
508
+ ### Current Test Configuration (Jest with ESM)
509
+
510
+ ```javascript
511
+ // jest.config.js
512
+ export default {
513
+ preset: 'ts-jest/presets/default-esm',
514
+ extensionsToTreatAsEsm: ['.ts'],
515
+ testEnvironment: 'node',
516
+ roots: ['<rootDir>/src', '<rootDir>/tests'],
517
+ testMatch: [
518
+ '<rootDir>/tests/**/*.test.ts',
519
+ '<rootDir>/src/**/*.test.ts'
520
+ ],
521
+ transform: {
522
+ '^.+\\.ts$': ['ts-jest', {
523
+ useESM: true,
524
+ tsconfig: {
525
+ module: 'es2022',
526
+ target: 'es2022'
527
+ }
528
+ }]
529
+ },
530
+ coverageDirectory: 'coverage',
531
+ coverageReporters: ['text', 'lcov', 'html'],
532
+ testTimeout: 30000
533
+ };
534
+ ```
535
+
536
+ ### Test Structure
537
+
538
+ ```typescript
539
+ // tests/unit/agents/coder.test.ts
540
+ import { CoderAgent } from '../../../src/agents/specialized/coder.js';
541
+
542
+ describe('CoderAgent', () => {
543
+ let agent: CoderAgent;
544
+
545
+ beforeEach(() => {
546
+ agent = new CoderAgent();
547
+ });
548
+
549
+ describe('execute', () => {
550
+ it('should generate code for given task', async () => {
551
+ const task = {
552
+ type: 'code_generation',
553
+ description: 'Create hello world function'
554
+ };
555
+
556
+ const result = await agent.execute(task);
557
+
558
+ expect(result.success).toBe(true);
559
+ expect(result.output).toContain('function');
560
+ });
561
+
562
+ it('should handle errors gracefully', async () => {
563
+ const task = { type: 'invalid' };
564
+
565
+ await expect(agent.execute(task)).rejects.toThrow();
566
+ });
567
+ });
568
+ });
569
+ ```
570
+
571
+ ### Current Test Commands
572
+
573
+ ```bash
574
+ # All tests with ESM support
575
+ npm test # NODE_OPTIONS='--experimental-vm-modules' jest --bail --maxWorkers=1 --forceExit
576
+
577
+ # Specific test suites
578
+ npm run test:unit # Unit tests only
579
+ npm run test:integration # Integration tests
580
+ npm run test:e2e # End-to-end tests
581
+ npm run test:performance # Performance tests
582
+ npm run test:cli # CLI tests
583
+
584
+ # Coverage reports
585
+ npm run test:coverage # Generate coverage report
586
+ npm run test:coverage:unit # Unit test coverage
587
+ npm run test:ci # CI-optimized tests
588
+
589
+ # Advanced testing
590
+ npm run test:comprehensive # Comprehensive test suite
591
+ npm run test:debug # Debug mode with inspect
592
+ npm run test:watch # Watch mode
593
+
594
+ # Health and diagnostics
595
+ npm run test:health # System health tests
596
+ npm run test:swarm # Swarm coordination tests
597
+ npm run test:benchmark # Performance benchmarks
598
+ ```
599
+
600
+ #### Test Coverage Requirements
601
+
602
+ Current coverage target: **80%** (as configured in CI/CD)
603
+
604
+ ```bash
605
+ # Generate detailed coverage report
606
+ npm run test:coverage
607
+
608
+ # Coverage by test type
609
+ npm run test:coverage:unit # Unit test coverage
610
+ npm run test:coverage:integration # Integration coverage
611
+ npm run test:coverage:e2e # E2E coverage
612
+
613
+ # View coverage report
614
+ open coverage/lcov-report/index.html
615
+ ```
616
+
617
+ ### Current Dependencies (v2.0.0-alpha.88)
618
+
619
+ #### Core Dependencies
620
+ ```json
621
+ {
622
+ "@modelcontextprotocol/sdk": "^1.0.4",
623
+ "blessed": "^0.1.81",
624
+ "chalk": "^4.1.2",
625
+ "cli-table3": "^0.6.3",
626
+ "commander": "^11.1.0",
627
+ "cors": "^2.8.5",
628
+ "figlet": "^1.8.1",
629
+ "fs-extra": "^11.2.0",
630
+ "glob": "^11.0.3",
631
+ "inquirer": "^9.2.12",
632
+ "nanoid": "^5.0.4",
633
+ "ora": "^7.0.1",
634
+ "ruv-swarm": "^1.0.14",
635
+ "ws": "^8.18.3",
636
+ "yaml": "^2.8.0"
637
+ }
638
+ ```
639
+
640
+ #### Development Dependencies
641
+ ```json
642
+ {
643
+ "@types/node": "^20.19.7",
644
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
645
+ "@typescript-eslint/parser": "^6.21.0",
646
+ "eslint": "^8.57.1",
647
+ "jest": "^29.7.0",
648
+ "prettier": "^3.1.1",
649
+ "ts-jest": "^29.4.0",
650
+ "tsx": "^4.6.2",
651
+ "typescript": "^5.3.3"
652
+ }
653
+ ```
654
+
655
+ ---
656
+
657
+ ## Code Standards
658
+
659
+ ### TypeScript Configuration
660
+
661
+ ```json
662
+ // tsconfig.json
663
+ {
664
+ "compilerOptions": {
665
+ "target": "ES2022",
666
+ "module": "ES2022",
667
+ "lib": ["ES2022"],
668
+ "outDir": "./dist",
669
+ "rootDir": "./src",
670
+ "strict": true,
671
+ "esModuleInterop": true,
672
+ "skipLibCheck": true,
673
+ "forceConsistentCasingInFileNames": true,
674
+ "resolveJsonModule": true,
675
+ "declaration": true,
676
+ "declarationMap": true,
677
+ "sourceMap": true,
678
+ "noUnusedLocals": true,
679
+ "noUnusedParameters": true,
680
+ "noImplicitReturns": true,
681
+ "noFallthroughCasesInSwitch": true
682
+ },
683
+ "include": ["src/**/*"],
684
+ "exclude": ["node_modules", "dist", "tests"]
685
+ }
686
+ ```
687
+
688
+ ### ESLint Configuration
689
+
690
+ ```json
691
+ // .eslintrc.json
692
+ {
693
+ "parser": "@typescript-eslint/parser",
694
+ "extends": [
695
+ "eslint:recommended",
696
+ "plugin:@typescript-eslint/recommended",
697
+ "plugin:jest/recommended",
698
+ "prettier"
699
+ ],
700
+ "plugins": ["@typescript-eslint", "jest"],
701
+ "env": {
702
+ "node": true,
703
+ "jest": true
704
+ },
705
+ "rules": {
706
+ "@typescript-eslint/explicit-function-return-type": "warn",
707
+ "@typescript-eslint/no-explicit-any": "error",
708
+ "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
709
+ "no-console": ["warn", { "allow": ["warn", "error"] }],
710
+ "prefer-const": "error",
711
+ "no-var": "error"
712
+ }
713
+ }
714
+ ```
715
+
716
+ ### Prettier Configuration
717
+
718
+ ```json
719
+ // .prettierrc.json
720
+ {
721
+ "semi": true,
722
+ "trailingComma": "es5",
723
+ "singleQuote": true,
724
+ "printWidth": 100,
725
+ "tabWidth": 2,
726
+ "useTabs": false,
727
+ "bracketSpacing": true,
728
+ "arrowParens": "always",
729
+ "endOfLine": "lf"
730
+ }
731
+ ```
732
+
733
+ ---
734
+
735
+ ## CI/CD Pipeline
736
+
737
+ ### Current GitHub Actions Workflows
738
+
739
+ #### Main CI/CD Pipeline (.github/workflows/ci.yml)
740
+
741
+ ```yaml
742
+ name: CI/CD Pipeline
743
+
744
+ on:
745
+ push:
746
+ branches: [ main, develop ]
747
+ pull_request:
748
+ branches: [ main ]
749
+ schedule:
750
+ - cron: '0 2 * * *' # Daily at 2 AM UTC
751
+
752
+ env:
753
+ NODE_VERSION: '20'
754
+
755
+ jobs:
756
+ security:
757
+ name: Security & Code Quality
758
+ runs-on: ubuntu-latest
759
+ steps:
760
+ - name: Checkout code
761
+ uses: actions/checkout@v4
762
+ - name: Setup Node.js
763
+ uses: actions/setup-node@v4
764
+ with:
765
+ node-version: ${{ env.NODE_VERSION }}
766
+ cache: 'npm'
767
+ - name: Install dependencies
768
+ run: npm ci
769
+ - name: Run security audit
770
+ run: |
771
+ npm audit --audit-level=high
772
+ npm audit --production --audit-level=moderate
773
+ - name: Lint code
774
+ run: npm run lint
775
+ - name: Type check
776
+ run: npm run typecheck
777
+
778
+ test:
779
+ name: Test Suite
780
+ runs-on: ubuntu-latest
781
+ steps:
782
+ - name: Checkout code
783
+ uses: actions/checkout@v4
784
+ - name: Setup Node.js
785
+ uses: actions/setup-node@v4
786
+ with:
787
+ node-version: ${{ env.NODE_VERSION }}
788
+ cache: 'npm'
789
+ - name: Install dependencies
790
+ run: npm ci
791
+ - name: Run all tests
792
+ run: npm test
793
+ - name: Generate coverage report
794
+ run: npm run test:coverage
795
+ - name: Upload test results
796
+ uses: actions/upload-artifact@v4
797
+ with:
798
+ name: test-results
799
+ path: coverage/
800
+
801
+ build:
802
+ name: Build & Package
803
+ runs-on: ubuntu-latest
804
+ needs: [security, test]
805
+ steps:
806
+ - name: Checkout code
807
+ uses: actions/checkout@v4
808
+ - name: Setup Node.js
809
+ uses: actions/setup-node@v4
810
+ with:
811
+ node-version: ${{ env.NODE_VERSION }}
812
+ cache: 'npm'
813
+ - name: Install dependencies
814
+ run: npm ci
815
+ - name: Build project
816
+ run: npm run build:ts
817
+ - name: Test CLI binary
818
+ run: |
819
+ chmod +x ./bin/claude-flow
820
+ ./bin/claude-flow --version
821
+ ```
822
+
823
+ #### Test Workflow (.github/workflows/test.yml)
824
+
825
+ ```yaml
826
+ name: Test Suite
827
+
828
+ on:
829
+ push:
830
+ branches: [ main, develop, claude-flow-v2.0.0 ]
831
+ pull_request:
832
+ branches: [ main, develop ]
833
+
834
+ jobs:
835
+ test:
836
+ runs-on: ubuntu-latest
837
+ strategy:
838
+ matrix:
839
+ node-version: [18.x, 20.x]
840
+ steps:
841
+ - name: Checkout code
842
+ uses: actions/checkout@v4
843
+ - name: Setup Node.js ${{ matrix.node-version }}
844
+ uses: actions/setup-node@v4
845
+ with:
846
+ node-version: ${{ matrix.node-version }}
847
+ cache: 'npm'
848
+ - name: Install dependencies
849
+ run: npm ci
850
+ - name: Run linting
851
+ run: npm run lint
852
+ - name: Run all tests
853
+ run: npm test
854
+ - name: Generate coverage report
855
+ run: npm run test:coverage
856
+
857
+ code-quality:
858
+ runs-on: ubuntu-latest
859
+ steps:
860
+ - name: Checkout code
861
+ uses: actions/checkout@v4
862
+ - name: Setup Node.js
863
+ uses: actions/setup-node@v4
864
+ with:
865
+ node-version: '20.x'
866
+ cache: 'npm'
867
+ - name: Install dependencies
868
+ run: npm ci
869
+ - name: Check code formatting
870
+ run: |
871
+ npm run format
872
+ git diff --exit-code
873
+ - name: Run linting
874
+ run: npm run lint
875
+ ```
876
+
877
+ ### Release Process (Alpha)
878
+
879
+ ```bash
880
+ # Current alpha release process
881
+ npm run update-version
882
+ npm run build
883
+ npm test
884
+ npm publish --tag alpha
885
+
886
+ # Version management
887
+ npm version prerelease --preid=alpha # 2.0.0-alpha.88 -> 2.0.0-alpha.89
888
+ ```
889
+
890
+ ---
891
+
892
+ ## Contributing
893
+
894
+ ### Setting Up for Contribution
895
+
896
+ ```bash
897
+ # Fork the repository on GitHub
898
+
899
+ # Clone your fork
900
+ git clone https://github.com/YOUR_USERNAME/claude-flow.git
901
+ cd claude-flow
902
+
903
+ # Add upstream remote
904
+ git remote add upstream https://github.com/ruvnet/claude-flow.git
905
+
906
+ # Keep your fork updated
907
+ git fetch upstream
908
+ git checkout main
909
+ git merge upstream/main
910
+ ```
911
+
912
+ ### Development Process with SPARC and Swarm
913
+
914
+ ```bash
915
+ # 1. Create feature branch
916
+ git checkout -b feature/your-feature
917
+
918
+ # 2. Plan with SPARC architect
919
+ npx claude-flow@alpha sparc run architect "Your feature description"
920
+
921
+ # 3. Implement with TDD
922
+ npx claude-flow@alpha sparc run tdd "Feature implementation"
923
+
924
+ # 4. Make changes and test
925
+ npm run dev
926
+ npm run test:comprehensive
927
+ npm run lint
928
+
929
+ # 5. Security review
930
+ npx claude-flow@alpha sparc run security-review "Review changes"
931
+
932
+ # 6. Commit changes
933
+ git add .
934
+ git commit -m "feat: add amazing feature"
935
+
936
+ # 7. Push to your fork
937
+ git push origin feature/your-feature
938
+
939
+ # 8. Create pull request with swarm review
940
+ npx claude-flow@alpha swarm spawn code-review-swarm
941
+ gh pr create --repo ruvnet/claude-flow
942
+ ```
943
+
944
+ ### Code Review Guidelines
945
+
946
+ #### For Contributors
947
+
948
+ 1. **Write clear PR descriptions**
949
+ 2. **Include tests for new features**
950
+ 3. **Update documentation**
951
+ 4. **Follow code style guidelines**
952
+ 5. **Respond to review feedback**
953
+
954
+ #### For Reviewers
955
+
956
+ 1. **Test the changes locally**
957
+ 2. **Check code quality and style**
958
+ 3. **Verify test coverage**
959
+ 4. **Provide constructive feedback**
960
+ 5. **Approve when ready**
961
+
962
+ ---
963
+
964
+ ## Release Process
965
+
966
+ ### Current Version Management (Alpha Release)
967
+
968
+ ```bash
969
+ # Current version: 2.0.0-alpha.88
970
+
971
+ # Alpha releases (current workflow)
972
+ npm version prerelease --preid=alpha # 2.0.0-alpha.88 -> 2.0.0-alpha.89
973
+ npm run publish:alpha
974
+
975
+ # Future stable releases
976
+ npm run publish:patch # Bug fixes
977
+ npm run publish:minor # New features
978
+ npm run publish:major # Breaking changes
979
+
980
+ # Available publish scripts
981
+ npm run publish:alpha # Alpha release
982
+ npm run publish:major # Major version bump
983
+ npm run publish:minor # Minor version bump
984
+ npm run publish:patch # Patch version bump
985
+ ```
986
+
987
+ ### Release Checklist
988
+
989
+ ```markdown
990
+ ## Release Checklist
991
+
992
+ ### Pre-release
993
+ - [ ] All tests passing
994
+ - [ ] Documentation updated
995
+ - [ ] CHANGELOG.md updated
996
+ - [ ] Version bumped
997
+ - [ ] Dependencies updated
998
+
999
+ ### Release
1000
+ - [ ] Tag created
1001
+ - [ ] GitHub release created
1002
+ - [ ] NPM package published
1003
+ - [ ] Docker image pushed
1004
+ - [ ] Announcement prepared
1005
+
1006
+ ### Post-release
1007
+ - [ ] Documentation site updated
1008
+ - [ ] Community notified
1009
+ - [ ] Issues triaged
1010
+ - [ ] Next version planned
1011
+ ```
1012
+
1013
+ ### Changelog Generation
1014
+
1015
+ ```bash
1016
+ # Install conventional-changelog
1017
+ npm install -g conventional-changelog-cli
1018
+
1019
+ # Generate changelog
1020
+ conventional-changelog -p angular -i CHANGELOG.md -s
1021
+
1022
+ # Or use npm script
1023
+ npm run changelog
1024
+ ```
1025
+
1026
+ ---
1027
+
1028
+ ## Best Practices
1029
+
1030
+ ### Code Organization
1031
+
1032
+ ```typescript
1033
+ // ✅ Good: Single responsibility
1034
+ export class TaskQueue {
1035
+ private queue: Task[] = [];
1036
+
1037
+ enqueue(task: Task): void {
1038
+ this.queue.push(task);
1039
+ }
1040
+
1041
+ dequeue(): Task | undefined {
1042
+ return this.queue.shift();
1043
+ }
1044
+ }
1045
+
1046
+ // ❌ Bad: Multiple responsibilities
1047
+ export class TaskManager {
1048
+ private queue: Task[] = [];
1049
+ private agents: Agent[] = [];
1050
+ private memory: Memory;
1051
+
1052
+ // Too many responsibilities in one class
1053
+ enqueueTask() { /* ... */ }
1054
+ assignAgent() { /* ... */ }
1055
+ saveMemory() { /* ... */ }
1056
+ }
1057
+ ```
1058
+
1059
+ ### Error Handling
1060
+
1061
+ ```typescript
1062
+ // ✅ Good: Specific error types
1063
+ export class AgentNotFoundError extends Error {
1064
+ constructor(agentId: string) {
1065
+ super(`Agent not found: ${agentId}`);
1066
+ this.name = 'AgentNotFoundError';
1067
+ }
1068
+ }
1069
+
1070
+ // ✅ Good: Proper error handling
1071
+ async function executeTask(task: Task): Promise<TaskResult> {
1072
+ try {
1073
+ const agent = await selectAgent(task);
1074
+ return await agent.execute(task);
1075
+ } catch (error) {
1076
+ if (error instanceof AgentNotFoundError) {
1077
+ // Handle specific error
1078
+ return createFailureResult('No suitable agent');
1079
+ }
1080
+ // Re-throw unexpected errors
1081
+ throw error;
1082
+ }
1083
+ }
1084
+ ```
1085
+
1086
+ ### Testing Best Practices
1087
+
1088
+ ```typescript
1089
+ // ✅ Good: Descriptive test names
1090
+ describe('SwarmCoordinator', () => {
1091
+ describe('when coordinating agents', () => {
1092
+ it('should distribute tasks evenly among available agents', () => {
1093
+ // Test implementation
1094
+ });
1095
+
1096
+ it('should handle agent failures gracefully', () => {
1097
+ // Test implementation
1098
+ });
1099
+ });
1100
+ });
1101
+
1102
+ // ✅ Good: Use test fixtures
1103
+ const createTestAgent = (overrides?: Partial<Agent>): Agent => {
1104
+ return {
1105
+ id: 'test-agent',
1106
+ type: 'coder',
1107
+ status: 'active',
1108
+ ...overrides
1109
+ };
1110
+ };
1111
+ ```
1112
+
1113
+ ### Performance Optimization
1114
+
1115
+ ```typescript
1116
+ // ✅ Good: Efficient data structures
1117
+ class AgentPool {
1118
+ private availableAgents = new Set<Agent>();
1119
+ private busyAgents = new Map<string, Agent>();
1120
+
1121
+ getAvailable(): Agent | undefined {
1122
+ const agent = this.availableAgents.values().next().value;
1123
+ if (agent) {
1124
+ this.availableAgents.delete(agent);
1125
+ this.busyAgents.set(agent.id, agent);
1126
+ }
1127
+ return agent;
1128
+ }
1129
+ }
1130
+
1131
+ // ✅ Good: Avoid unnecessary operations
1132
+ async function processTask(tasks: Task[]): Promise<void> {
1133
+ // Process in parallel when possible
1134
+ await Promise.all(
1135
+ tasks.map(task => processIndividualTask(task))
1136
+ );
1137
+ }
1138
+ ```
1139
+
1140
+ ### Documentation
1141
+
1142
+ ```typescript
1143
+ /**
1144
+ * Coordinates multiple agents to achieve a complex objective
1145
+ * @param objective - The high-level goal to achieve
1146
+ * @param options - Configuration options for coordination
1147
+ * @returns Promise resolving to the coordination result
1148
+ * @example
1149
+ * ```typescript
1150
+ * const result = await coordinator.coordinate(
1151
+ * 'Build REST API',
1152
+ * { topology: 'mesh', maxAgents: 10 }
1153
+ * );
1154
+ * ```
1155
+ */
1156
+ export async function coordinate(
1157
+ objective: string,
1158
+ options?: CoordinationOptions
1159
+ ): Promise<CoordinationResult> {
1160
+ // Implementation
1161
+ }
1162
+ ```
1163
+
1164
+ ---
1165
+
1166
+ ## Development Tools
1167
+
1168
+ ### Current Build System
1169
+
1170
+ ```bash
1171
+ # Multi-target build system
1172
+ npm run build # Full build pipeline
1173
+ npm run build:esm # ESM build
1174
+ npm run build:cjs # CommonJS build
1175
+ npm run build:binary # Binary executables
1176
+
1177
+ # Binary targets (pkg)
1178
+ # - node20-linux-x64
1179
+ # - node20-macos-x64
1180
+ # - node20-win-x64
1181
+
1182
+ # Available binaries
1183
+ ./bin/claude-flow # Main CLI
1184
+ ./bin/claude-flow-swarm # Swarm coordination
1185
+ ./bin/claude-flow-ui # UI interface
1186
+ ./bin/claude-flow-dev # Development mode
1187
+ ```
1188
+
1189
+ ### Health Monitoring and Diagnostics
1190
+
1191
+ ```bash
1192
+ # System diagnostics
1193
+ npm run diagnostics
1194
+
1195
+ # Health check
1196
+ npm run health-check
1197
+
1198
+ # Performance monitoring
1199
+ npm run test:performance
1200
+ npm run test:benchmark
1201
+
1202
+ # Load testing
1203
+ npm run test:load
1204
+
1205
+ # Docker testing
1206
+ npm run test:docker
1207
+
1208
+ # NPX testing
1209
+ npm run test:npx
1210
+ ```
1211
+
1212
+ ### Debug Utilities
1213
+
1214
+ ```typescript
1215
+ // src/utils/debug.ts
1216
+ export const debug = {
1217
+ log: (message: string, data?: any) => {
1218
+ if (process.env.CLAUDE_FLOW_DEBUG === 'true') {
1219
+ console.log(`[DEBUG] ${message}`, data || '');
1220
+ }
1221
+ },
1222
+
1223
+ time: (label: string) => {
1224
+ if (process.env.CLAUDE_FLOW_DEBUG === 'true') {
1225
+ console.time(label);
1226
+ }
1227
+ },
1228
+
1229
+ timeEnd: (label: string) => {
1230
+ if (process.env.CLAUDE_FLOW_DEBUG === 'true') {
1231
+ console.timeEnd(label);
1232
+ }
1233
+ }
1234
+ };
1235
+ ```
1236
+
1237
+ ### Performance Profiling
1238
+
1239
+ ```bash
1240
+ # Profile CPU usage
1241
+ node --prof dist/cli/main.js swarm "complex task"
1242
+ node --prof-process isolate-*.log > profile.txt
1243
+
1244
+ # Memory profiling
1245
+ node --trace-gc dist/cli/main.js swarm "memory intensive"
1246
+ node --expose-gc --inspect dist/cli/main.js
1247
+
1248
+ # Heap snapshot
1249
+ node --heapsnapshot-signal=SIGUSR2 dist/cli/main.js
1250
+ ```
1251
+
1252
+ ---
1253
+
1254
+ ## Troubleshooting Development Issues
1255
+
1256
+ ### Common Development Problems
1257
+
1258
+ #### TypeScript Compilation Errors
1259
+
1260
+ ```bash
1261
+ # Clear TypeScript cache
1262
+ rm -rf dist tsconfig.tsbuildinfo
1263
+
1264
+ # Rebuild
1265
+ npm run clean && npm run build
1266
+
1267
+ # Check for type errors
1268
+ npm run typecheck
1269
+ ```
1270
+
1271
+ #### Test Failures
1272
+
1273
+ ```bash
1274
+ # Clear Jest cache
1275
+ npx jest --clearCache
1276
+
1277
+ # Run tests in band (sequential)
1278
+ npm test -- --runInBand
1279
+
1280
+ # Debug specific test
1281
+ npm test -- --verbose path/to/test.ts
1282
+ ```
1283
+
1284
+ #### Dependency Issues
1285
+
1286
+ ```bash
1287
+ # Clear all caches
1288
+ npm cache clean --force
1289
+ rm -rf node_modules package-lock.json
1290
+
1291
+ # Reinstall
1292
+ npm install
1293
+
1294
+ # Check for outdated packages
1295
+ npm outdated
1296
+
1297
+ # Update dependencies
1298
+ npm update
1299
+ ```
1300
+
1301
+ ---
1302
+
1303
+ ## Resources
1304
+
1305
+ ### Documentation
1306
+
1307
+ - [TypeScript Handbook](https://www.typescriptlang.org/docs/)
1308
+ - [Jest Documentation](https://jestjs.io/docs/getting-started)
1309
+ - [Node.js Best Practices](https://github.com/goldbergyoni/nodebestpractices)
1310
+ - [Conventional Commits](https://www.conventionalcommits.org/)
1311
+
1312
+ ### Tools
1313
+
1314
+ - [VS Code](https://code.visualstudio.com/)
1315
+ - [Postman](https://www.postman.com/) - API testing
1316
+ - [Docker Desktop](https://www.docker.com/products/docker-desktop)
1317
+ - [GitHub CLI](https://cli.github.com/)
1318
+
1319
+ ### Community
1320
+
1321
+ - [Discord Server](https://discord.gg/claude-flow)
1322
+ - [GitHub Discussions](https://github.com/ruvnet/claude-flow/discussions)
1323
+ - [Stack Overflow](https://stackoverflow.com/questions/tagged/claude-flow)
1324
+
1325
+ ---
1326
+
1327
+ <div align="center">
1328
+
1329
+ **Claude-Flow Development Workflow v2.0.0-alpha.88**
1330
+
1331
+ [Back to README](../README.md) | [Contributing](../CONTRIBUTING.md) | [Code of Conduct](../CODE_OF_CONDUCT.md)
1332
+
1333
+ </div>