mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
feat: Release v2.0.0-alpha.80 - GitHub hooks separation
- Separated GitHub-specific features from standard init - Standard init uses local Git checkpoints only - GitHub init includes GitHub release creation - Added standard-checkpoint-hooks.sh for non-GitHub checkpoints - Updated template-copier.js to include all checkpoint scripts - Fixed backtick escaping in shell script templates - Updated help text to show alpha.80 version 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
b0e5a7fc2f
commit
059885679c
70 files changed
+3965
-117
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"startTime": 1753908780699,
|
||||
"totalTasks": 2,
|
||||
"successfulTasks": 2,
|
||||
"startTime": 1753971286175,
|
||||
"totalTasks": 1,
|
||||
"successfulTasks": 1,
|
||||
"failedTasks": 0,
|
||||
"totalAgents": 0,
|
||||
"activeAgents": 0,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[
|
||||
{
|
||||
"id": "cmd-init-1753908780792",
|
||||
"type": "init",
|
||||
"id": "cmd-hooks-1753971286276",
|
||||
"type": "hooks",
|
||||
"success": true,
|
||||
"duration": 1.8158789999999954,
|
||||
"timestamp": 1753908780794,
|
||||
"duration": 10.175964000000022,
|
||||
"timestamp": 1753971286287,
|
||||
"metadata": {}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,199 @@
|
||||
# Session Summary - 2025-07-30 22:27:33
|
||||
|
||||
## Checkpoints Created
|
||||
1753906298.json
|
||||
1753906353.json
|
||||
1753906370.json
|
||||
task-1753913133.json
|
||||
task-1753913281.json
|
||||
task-1753913468.json
|
||||
|
||||
## Files Modified
|
||||
.claude-flow/metrics/agent-metrics.json
|
||||
.claude-flow/metrics/performance.json
|
||||
.claude-flow/metrics/system-metrics.json
|
||||
.claude-flow/metrics/task-metrics.json
|
||||
.claude/checkpoints/1753906298.json
|
||||
.claude/checkpoints/1753906353.json
|
||||
.claude/checkpoints/1753906370.json
|
||||
.claude/checkpoints/summary-session-20250730-220658.md
|
||||
.claude/checkpoints/summary-session-20250730-220954.md
|
||||
.claude/checkpoints/task-1753913133.json
|
||||
.claude/checkpoints/task-1753913281.json
|
||||
.claude/helpers/checkpoint-hooks.sh
|
||||
.claude/helpers/checkpoint-manager.sh
|
||||
.claude/helpers/github-checkpoint-hooks.sh
|
||||
.claude/helpers/setup-checkpoints.sh
|
||||
.claude/helpers/standard-checkpoint-hooks.sh
|
||||
.claude/settings-checkpoint-example.json
|
||||
.claude/settings-checkpoint-simple.json
|
||||
.claude/settings-complete.json
|
||||
.claude/settings.json
|
||||
.gitignore
|
||||
.hive-mind/config.json
|
||||
CLAUDE.md
|
||||
README.md
|
||||
claude-flow
|
||||
claude-flow-wiki
|
||||
demo.txt
|
||||
docs/CHECKPOINT_IMPLEMENTATION_SUMMARY.md
|
||||
docs/CHECKPOINT_INTEGRATION_SUMMARY.md
|
||||
docs/GITHUB_INIT_DOCUMENTATION.md
|
||||
docs/GIT_CHECKPOINT_HOOKS.md
|
||||
docs/GIT_CHECKPOINT_VISUAL.md
|
||||
docs/INIT_COMMANDS_SUMMARY.md
|
||||
docs/examples/CHECKPOINT_SYSTEM_DEMO.md
|
||||
example-file.js
|
||||
examples/git-checkpoint-demo.md
|
||||
memory/agents/README.md
|
||||
memory/sessions/README.md
|
||||
src/cli/help-text.js
|
||||
src/cli/simple-commands/github.js
|
||||
src/cli/simple-commands/github/init.js
|
||||
src/cli/simple-commands/init/index.js
|
||||
src/cli/simple-commands/init/template-copier.js
|
||||
src/cli/simple-commands/init/templates/commands/helpers/standard-checkpoint-hooks.sh
|
||||
src/cli/simple-commands/init/templates/enhanced-templates.js
|
||||
src/cli/simple-commands/init/templates/settings.json
|
||||
test-checkpoint.txt
|
||||
test-monitoring/.claude-flow/env-setup.sh
|
||||
test-monitoring/.claude-flow/monitoring.config.json
|
||||
test-monitoring/.claude-flow/token-usage.json
|
||||
test-monitoring/.claude/agents/MIGRATION_SUMMARY.md
|
||||
test-monitoring/.claude/agents/README.md
|
||||
test-monitoring/.claude/agents/analysis/code-review/analyze-code-quality.md
|
||||
test-monitoring/.claude/agents/architecture/system-design/arch-system-design.md
|
||||
test-monitoring/.claude/agents/base-template-generator.md
|
||||
test-monitoring/.claude/agents/consensus/README.md
|
||||
test-monitoring/.claude/agents/consensus/byzantine-coordinator.md
|
||||
test-monitoring/.claude/agents/consensus/crdt-synchronizer.md
|
||||
test-monitoring/.claude/agents/consensus/gossip-coordinator.md
|
||||
test-monitoring/.claude/agents/consensus/performance-benchmarker.md
|
||||
test-monitoring/.claude/agents/consensus/quorum-manager.md
|
||||
test-monitoring/.claude/agents/consensus/raft-manager.md
|
||||
test-monitoring/.claude/agents/consensus/security-manager.md
|
||||
test-monitoring/.claude/agents/core/coder.md
|
||||
test-monitoring/.claude/agents/core/planner.md
|
||||
test-monitoring/.claude/agents/core/researcher.md
|
||||
test-monitoring/.claude/agents/core/reviewer.md
|
||||
test-monitoring/.claude/agents/core/tester.md
|
||||
test-monitoring/.claude/agents/data/ml/data-ml-model.md
|
||||
test-monitoring/.claude/agents/development/backend/dev-backend-api.md
|
||||
test-monitoring/.claude/agents/devops/ci-cd/ops-cicd-github.md
|
||||
test-monitoring/.claude/agents/documentation/api-docs/docs-api-openapi.md
|
||||
test-monitoring/.claude/agents/github/code-review-swarm.md
|
||||
test-monitoring/.claude/agents/github/github-modes.md
|
||||
test-monitoring/.claude/agents/github/issue-tracker.md
|
||||
test-monitoring/.claude/agents/github/multi-repo-swarm.md
|
||||
test-monitoring/.claude/agents/github/pr-manager.md
|
||||
test-monitoring/.claude/agents/github/project-board-sync.md
|
||||
test-monitoring/.claude/agents/github/release-manager.md
|
||||
test-monitoring/.claude/agents/github/release-swarm.md
|
||||
test-monitoring/.claude/agents/github/repo-architect.md
|
||||
test-monitoring/.claude/agents/github/swarm-issue.md
|
||||
test-monitoring/.claude/agents/github/swarm-pr.md
|
||||
test-monitoring/.claude/agents/github/sync-coordinator.md
|
||||
test-monitoring/.claude/agents/github/workflow-automation.md
|
||||
test-monitoring/.claude/agents/hive-mind/collective-intelligence-coordinator.md
|
||||
test-monitoring/.claude/agents/hive-mind/consensus-builder.md
|
||||
test-monitoring/.claude/agents/hive-mind/swarm-memory-manager.md
|
||||
test-monitoring/.claude/agents/optimization/README.md
|
||||
test-monitoring/.claude/agents/optimization/benchmark-suite.md
|
||||
test-monitoring/.claude/agents/optimization/load-balancer.md
|
||||
test-monitoring/.claude/agents/optimization/performance-monitor.md
|
||||
test-monitoring/.claude/agents/optimization/resource-allocator.md
|
||||
test-monitoring/.claude/agents/optimization/topology-optimizer.md
|
||||
test-monitoring/.claude/agents/sparc/architecture.md
|
||||
test-monitoring/.claude/agents/sparc/pseudocode.md
|
||||
test-monitoring/.claude/agents/sparc/refinement.md
|
||||
test-monitoring/.claude/agents/sparc/specification.md
|
||||
test-monitoring/.claude/agents/specialized/mobile/spec-mobile-react-native.md
|
||||
test-monitoring/.claude/agents/swarm/README.md
|
||||
test-monitoring/.claude/agents/swarm/adaptive-coordinator.md
|
||||
test-monitoring/.claude/agents/swarm/hierarchical-coordinator.md
|
||||
test-monitoring/.claude/agents/swarm/mesh-coordinator.md
|
||||
test-monitoring/.claude/agents/templates/automation-smart-agent.md
|
||||
test-monitoring/.claude/agents/templates/coordinator-swarm-init.md
|
||||
test-monitoring/.claude/agents/templates/github-pr-manager.md
|
||||
test-monitoring/.claude/agents/templates/implementer-sparc-coder.md
|
||||
test-monitoring/.claude/agents/templates/memory-coordinator.md
|
||||
test-monitoring/.claude/agents/templates/migration-plan.md
|
||||
test-monitoring/.claude/agents/templates/orchestrator-task.md
|
||||
test-monitoring/.claude/agents/templates/performance-analyzer.md
|
||||
test-monitoring/.claude/agents/templates/sparc-coordinator.md
|
||||
test-monitoring/.claude/agents/testing/unit/tdd-london-swarm.md
|
||||
test-monitoring/.claude/agents/testing/validation/production-validator.md
|
||||
test-monitoring/.claude/commands/analysis/README.md
|
||||
test-monitoring/.claude/commands/analysis/bottleneck-detect.md
|
||||
test-monitoring/.claude/commands/analysis/performance-report.md
|
||||
test-monitoring/.claude/commands/analysis/token-usage.md
|
||||
test-monitoring/.claude/commands/automation/README.md
|
||||
test-monitoring/.claude/commands/automation/auto-agent.md
|
||||
test-monitoring/.claude/commands/automation/smart-spawn.md
|
||||
test-monitoring/.claude/commands/automation/workflow-select.md
|
||||
test-monitoring/.claude/commands/coordination/README.md
|
||||
test-monitoring/.claude/commands/coordination/agent-spawn.md
|
||||
test-monitoring/.claude/commands/coordination/swarm-init.md
|
||||
test-monitoring/.claude/commands/coordination/task-orchestrate.md
|
||||
test-monitoring/.claude/commands/github/README.md
|
||||
test-monitoring/.claude/commands/github/code-review.md
|
||||
test-monitoring/.claude/commands/github/github-swarm.md
|
||||
test-monitoring/.claude/commands/github/issue-triage.md
|
||||
test-monitoring/.claude/commands/github/pr-enhance.md
|
||||
test-monitoring/.claude/commands/github/repo-analyze.md
|
||||
test-monitoring/.claude/commands/hooks/README.md
|
||||
test-monitoring/.claude/commands/hooks/post-edit.md
|
||||
test-monitoring/.claude/commands/hooks/post-task.md
|
||||
test-monitoring/.claude/commands/hooks/pre-edit.md
|
||||
test-monitoring/.claude/commands/hooks/pre-task.md
|
||||
test-monitoring/.claude/commands/hooks/session-end.md
|
||||
test-monitoring/.claude/commands/memory/README.md
|
||||
test-monitoring/.claude/commands/memory/memory-persist.md
|
||||
test-monitoring/.claude/commands/memory/memory-search.md
|
||||
test-monitoring/.claude/commands/memory/memory-usage.md
|
||||
test-monitoring/.claude/commands/monitoring/README.md
|
||||
test-monitoring/.claude/commands/monitoring/agent-metrics.md
|
||||
test-monitoring/.claude/commands/monitoring/real-time-view.md
|
||||
test-monitoring/.claude/commands/monitoring/swarm-monitor.md
|
||||
test-monitoring/.claude/commands/optimization/README.md
|
||||
test-monitoring/.claude/commands/optimization/cache-manage.md
|
||||
test-monitoring/.claude/commands/optimization/parallel-execute.md
|
||||
test-monitoring/.claude/commands/optimization/topology-optimize.md
|
||||
test-monitoring/.claude/commands/training/README.md
|
||||
test-monitoring/.claude/commands/training/model-update.md
|
||||
test-monitoring/.claude/commands/training/neural-train.md
|
||||
test-monitoring/.claude/commands/training/pattern-learn.md
|
||||
test-monitoring/.claude/commands/workflows/README.md
|
||||
test-monitoring/.claude/commands/workflows/workflow-create.md
|
||||
test-monitoring/.claude/commands/workflows/workflow-execute.md
|
||||
test-monitoring/.claude/commands/workflows/workflow-export.md
|
||||
test-monitoring/.claude/helpers/github-safe.js
|
||||
test-monitoring/.claude/helpers/github-setup.sh
|
||||
test-monitoring/.claude/helpers/quick-start.sh
|
||||
test-monitoring/.claude/helpers/setup-mcp.sh
|
||||
test-monitoring/.gitignore
|
||||
test-monitoring/CLAUDE.md
|
||||
test-monitoring/memory/agents/README.md
|
||||
test-monitoring/memory/sessions/README.md
|
||||
tests/test-checkpoint-system.sh
|
||||
|
||||
## Recent Commits
|
||||
48b228d 🔖 Checkpoint: Edit example-file.js
|
||||
48eb1e3 🔖 Checkpoint: Edit example-file.js
|
||||
e216f8e 🔖 Checkpoint: Edit demo.txt
|
||||
093611a 🔧 Fix SQLite preparation errors in hive-mind spawn
|
||||
|
||||
## GitHub Releases Created
|
||||
No GitHub releases
|
||||
|
||||
## Rollback Instructions
|
||||
To rollback to a specific checkpoint:
|
||||
checkpoint-20250730-201250
|
||||
checkpoint-20250730-201233
|
||||
checkpoint-20250730-201138
|
||||
Checkpoint: 2025-07-30 22:11 Pre-release task-20250730-221107 2025-07-30T22:11:08Z
|
||||
Session Summary: 2025-07-30 22:09 Pre-release session-session-20250730-220954 2025-07-30T22:09:57Z
|
||||
Checkpoint: 2025-07-30 22:08 Pre-release task-20250730-220800 2025-07-30T22:08:01Z
|
||||
Session Summary: 2025-07-30 22:07 Pre-release session-session-20250730-220658 2025-07-30T22:07:01Z
|
||||
Checkpoint: 2025-07-30 22:05 Pre-release task-20250730-220532 2025-07-30T22:05:33Z
|
||||
v2.0.0-alpha.65 - Database Schema Fix Pre-release v2.0.0-alpha.65 2025-07-20T15:48:04Z
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"checkpoint": "task-20250730-221107",
|
||||
"task": "{{user_prompt}} ",
|
||||
"timestamp": "2025-07-30T22:11:08Z",
|
||||
"commit": "b0e5a7fc2fbdb91fc131064ef373ee092982d940",
|
||||
"github_release": "true"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# Analysis Commands
|
||||
|
||||
Commands for analysis operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [bottleneck-detect](./bottleneck-detect.md)
|
||||
- [token-usage](./token-usage.md)
|
||||
- [performance-report](./performance-report.md)
|
||||
@@ -0,0 +1,162 @@
|
||||
# bottleneck detect
|
||||
|
||||
Analyze performance bottlenecks in swarm operations and suggest optimizations.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--swarm-id, -s <id>` - Analyze specific swarm (default: current)
|
||||
- `--time-range, -t <range>` - Analysis period: 1h, 24h, 7d, all (default: 1h)
|
||||
- `--threshold <percent>` - Bottleneck threshold percentage (default: 20)
|
||||
- `--export, -e <file>` - Export analysis to file
|
||||
- `--fix` - Apply automatic optimizations
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic bottleneck detection
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect
|
||||
```
|
||||
|
||||
### Analyze specific swarm
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect --swarm-id swarm-123
|
||||
```
|
||||
|
||||
### Last 24 hours with export
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect -t 24h -e bottlenecks.json
|
||||
```
|
||||
|
||||
### Auto-fix detected issues
|
||||
|
||||
```bash
|
||||
npx claude-flow bottleneck detect --fix --threshold 15
|
||||
```
|
||||
|
||||
## Metrics Analyzed
|
||||
|
||||
### Communication Bottlenecks
|
||||
|
||||
- Message queue delays
|
||||
- Agent response times
|
||||
- Coordination overhead
|
||||
- Memory access patterns
|
||||
|
||||
### Processing Bottlenecks
|
||||
|
||||
- Task completion times
|
||||
- Agent utilization rates
|
||||
- Parallel execution efficiency
|
||||
- Resource contention
|
||||
|
||||
### Memory Bottlenecks
|
||||
|
||||
- Cache hit rates
|
||||
- Memory access patterns
|
||||
- Storage I/O performance
|
||||
- Neural pattern loading
|
||||
|
||||
### Network Bottlenecks
|
||||
|
||||
- API call latency
|
||||
- MCP communication delays
|
||||
- External service timeouts
|
||||
- Concurrent request limits
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
🔍 Bottleneck Analysis Report
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
📊 Summary
|
||||
├── Time Range: Last 1 hour
|
||||
├── Agents Analyzed: 6
|
||||
├── Tasks Processed: 42
|
||||
└── Critical Issues: 2
|
||||
|
||||
🚨 Critical Bottlenecks
|
||||
1. Agent Communication (35% impact)
|
||||
└── coordinator → coder-1 messages delayed by 2.3s avg
|
||||
|
||||
2. Memory Access (28% impact)
|
||||
└── Neural pattern loading taking 1.8s per access
|
||||
|
||||
⚠️ Warning Bottlenecks
|
||||
1. Task Queue (18% impact)
|
||||
└── 5 tasks waiting > 10s for assignment
|
||||
|
||||
💡 Recommendations
|
||||
1. Switch to hierarchical topology (est. 40% improvement)
|
||||
2. Enable memory caching (est. 25% improvement)
|
||||
3. Increase agent concurrency to 8 (est. 20% improvement)
|
||||
|
||||
✅ Quick Fixes Available
|
||||
Run with --fix to apply:
|
||||
- Enable smart caching
|
||||
- Optimize message routing
|
||||
- Adjust agent priorities
|
||||
```
|
||||
|
||||
## Automatic Fixes
|
||||
|
||||
When using `--fix`, the following optimizations may be applied:
|
||||
|
||||
1. **Topology Optimization**
|
||||
|
||||
- Switch to more efficient topology
|
||||
- Adjust communication patterns
|
||||
- Reduce coordination overhead
|
||||
|
||||
2. **Caching Enhancement**
|
||||
|
||||
- Enable memory caching
|
||||
- Optimize cache strategies
|
||||
- Preload common patterns
|
||||
|
||||
3. **Concurrency Tuning**
|
||||
|
||||
- Adjust agent counts
|
||||
- Optimize parallel execution
|
||||
- Balance workload distribution
|
||||
|
||||
4. **Priority Adjustment**
|
||||
- Reorder task queues
|
||||
- Prioritize critical paths
|
||||
- Reduce wait times
|
||||
|
||||
## Performance Impact
|
||||
|
||||
Typical improvements after bottleneck resolution:
|
||||
|
||||
- **Communication**: 30-50% faster message delivery
|
||||
- **Processing**: 20-40% reduced task completion time
|
||||
- **Memory**: 40-60% fewer cache misses
|
||||
- **Overall**: 25-45% performance improvement
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
```javascript
|
||||
// Check for bottlenecks in Claude Code
|
||||
mcp__claude-flow__bottleneck_detect {
|
||||
timeRange: "1h",
|
||||
threshold: 20,
|
||||
autoFix: false
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `performance report` - Detailed performance analysis
|
||||
- `token usage` - Token optimization analysis
|
||||
- `swarm monitor` - Real-time monitoring
|
||||
- `cache manage` - Cache optimization
|
||||
@@ -0,0 +1,25 @@
|
||||
# performance-report
|
||||
|
||||
Generate comprehensive performance reports for swarm operations.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow analysis performance-report [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--format <type>` - Report format (json, html, markdown)
|
||||
- `--include-metrics` - Include detailed metrics
|
||||
- `--compare <id>` - Compare with previous swarm
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Generate HTML report
|
||||
npx claude-flow analysis performance-report --format html
|
||||
|
||||
# Compare swarms
|
||||
npx claude-flow analysis performance-report --compare swarm-123
|
||||
|
||||
# Full metrics report
|
||||
npx claude-flow analysis performance-report --include-metrics --format markdown
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# token-usage
|
||||
|
||||
Analyze token usage patterns and optimize for efficiency.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow analysis token-usage [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--period <time>` - Analysis period (1h, 24h, 7d, 30d)
|
||||
- `--by-agent` - Break down by agent
|
||||
- `--by-operation` - Break down by operation type
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Last 24 hours token usage
|
||||
npx claude-flow analysis token-usage --period 24h
|
||||
|
||||
# By agent breakdown
|
||||
npx claude-flow analysis token-usage --by-agent
|
||||
|
||||
# Export detailed report
|
||||
npx claude-flow analysis token-usage --period 7d --export tokens.csv
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# Automation Commands
|
||||
|
||||
Commands for automation operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [auto-agent](./auto-agent.md)
|
||||
- [smart-spawn](./smart-spawn.md)
|
||||
- [workflow-select](./workflow-select.md)
|
||||
@@ -0,0 +1,122 @@
|
||||
# auto agent
|
||||
|
||||
Automatically spawn and manage agents based on task requirements.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--task, -t <description>` - Task description for agent analysis
|
||||
- `--max-agents, -m <number>` - Maximum agents to spawn (default: auto)
|
||||
- `--min-agents <number>` - Minimum agents required (default: 1)
|
||||
- `--strategy, -s <type>` - Selection strategy: optimal, minimal, balanced
|
||||
- `--no-spawn` - Analyze only, don't spawn agents
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic auto-spawning
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent --task "Build a REST API with authentication"
|
||||
```
|
||||
|
||||
### Constrained spawning
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent -t "Debug performance issue" --max-agents 3
|
||||
```
|
||||
|
||||
### Analysis only
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent -t "Refactor codebase" --no-spawn
|
||||
```
|
||||
|
||||
### Minimal strategy
|
||||
|
||||
```bash
|
||||
npx claude-flow auto agent -t "Fix bug in login" -s minimal
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Task Analysis**
|
||||
|
||||
- Parses task description
|
||||
- Identifies required skills
|
||||
- Estimates complexity
|
||||
- Determines parallelization opportunities
|
||||
|
||||
2. **Agent Selection**
|
||||
|
||||
- Matches skills to agent types
|
||||
- Considers task dependencies
|
||||
- Optimizes for efficiency
|
||||
- Respects constraints
|
||||
|
||||
3. **Topology Selection**
|
||||
|
||||
- Chooses optimal swarm structure
|
||||
- Configures communication patterns
|
||||
- Sets up coordination rules
|
||||
- Enables monitoring
|
||||
|
||||
4. **Automatic Spawning**
|
||||
- Creates selected agents
|
||||
- Assigns specific roles
|
||||
- Distributes subtasks
|
||||
- Initiates coordination
|
||||
|
||||
## Agent Types Selected
|
||||
|
||||
- **Architect**: System design, architecture decisions
|
||||
- **Coder**: Implementation, code generation
|
||||
- **Tester**: Test creation, quality assurance
|
||||
- **Analyst**: Performance, optimization
|
||||
- **Researcher**: Documentation, best practices
|
||||
- **Coordinator**: Task management, progress tracking
|
||||
|
||||
## Strategies
|
||||
|
||||
### Optimal
|
||||
|
||||
- Maximum efficiency
|
||||
- May spawn more agents
|
||||
- Best for complex tasks
|
||||
- Highest resource usage
|
||||
|
||||
### Minimal
|
||||
|
||||
- Minimum viable agents
|
||||
- Conservative approach
|
||||
- Good for simple tasks
|
||||
- Lowest resource usage
|
||||
|
||||
### Balanced
|
||||
|
||||
- Middle ground
|
||||
- Adaptive to complexity
|
||||
- Default strategy
|
||||
- Good performance/resource ratio
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
```javascript
|
||||
// In Claude Code after auto-spawning
|
||||
mcp__claude-flow__auto_agent {
|
||||
task: "Build authentication system",
|
||||
strategy: "balanced",
|
||||
maxAgents: 6
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `agent spawn` - Manual agent creation
|
||||
- `swarm init` - Initialize swarm manually
|
||||
- `smart spawn` - Intelligent agent spawning
|
||||
- `workflow select` - Choose predefined workflows
|
||||
@@ -0,0 +1,25 @@
|
||||
# smart-spawn
|
||||
|
||||
Intelligently spawn agents based on workload analysis.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow automation smart-spawn [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--analyze` - Analyze before spawning
|
||||
- `--threshold <n>` - Spawn threshold
|
||||
- `--topology <type>` - Preferred topology
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Smart spawn with analysis
|
||||
npx claude-flow automation smart-spawn --analyze
|
||||
|
||||
# Set spawn threshold
|
||||
npx claude-flow automation smart-spawn --threshold 5
|
||||
|
||||
# Force topology
|
||||
npx claude-flow automation smart-spawn --topology hierarchical
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# workflow-select
|
||||
|
||||
Automatically select optimal workflow based on task type.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow automation workflow-select [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--task <description>` - Task description
|
||||
- `--constraints <list>` - Workflow constraints
|
||||
- `--preview` - Preview without executing
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Select workflow for task
|
||||
npx claude-flow automation workflow-select --task "Deploy to production"
|
||||
|
||||
# With constraints
|
||||
npx claude-flow automation workflow-select --constraints "no-downtime,rollback"
|
||||
|
||||
# Preview mode
|
||||
npx claude-flow automation workflow-select --task "Database migration" --preview
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# Coordination Commands
|
||||
|
||||
Commands for coordination operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [swarm-init](./swarm-init.md)
|
||||
- [agent-spawn](./agent-spawn.md)
|
||||
- [task-orchestrate](./task-orchestrate.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# agent-spawn
|
||||
|
||||
Spawn a new agent in the current swarm.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow agent spawn [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--type <type>` - Agent type (coder, researcher, analyst, tester, coordinator)
|
||||
- `--name <name>` - Custom agent name
|
||||
- `--skills <list>` - Specific skills (comma-separated)
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Spawn coder agent
|
||||
npx claude-flow agent spawn --type coder
|
||||
|
||||
# With custom name
|
||||
npx claude-flow agent spawn --type researcher --name "API Expert"
|
||||
|
||||
# With specific skills
|
||||
npx claude-flow agent spawn --type coder --skills "python,fastapi,testing"
|
||||
```
|
||||
@@ -0,0 +1,85 @@
|
||||
# swarm init
|
||||
|
||||
Initialize a Claude Flow swarm with specified topology and configuration.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow swarm init [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--topology, -t <type>` - Swarm topology: mesh, hierarchical, ring, star (default: hierarchical)
|
||||
- `--max-agents, -m <number>` - Maximum number of agents (default: 8)
|
||||
- `--strategy, -s <type>` - Execution strategy: balanced, parallel, sequential (default: parallel)
|
||||
- `--auto-spawn` - Automatically spawn agents based on task complexity
|
||||
- `--memory` - Enable cross-session memory persistence
|
||||
- `--github` - Enable GitHub integration features
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic initialization
|
||||
|
||||
```bash
|
||||
npx claude-flow swarm init
|
||||
```
|
||||
|
||||
### Mesh topology for research
|
||||
|
||||
```bash
|
||||
npx claude-flow swarm init --topology mesh --max-agents 5 --strategy balanced
|
||||
```
|
||||
|
||||
### Hierarchical for development
|
||||
|
||||
```bash
|
||||
npx claude-flow swarm init --topology hierarchical --max-agents 10 --strategy parallel --auto-spawn
|
||||
```
|
||||
|
||||
### GitHub-focused swarm
|
||||
|
||||
```bash
|
||||
npx claude-flow swarm init --topology star --github --memory
|
||||
```
|
||||
|
||||
## Topologies
|
||||
|
||||
### Mesh
|
||||
|
||||
- All agents connect to all others
|
||||
- Best for: Research, exploration, brainstorming
|
||||
- Communication: High overhead, maximum information sharing
|
||||
|
||||
### Hierarchical
|
||||
|
||||
- Tree structure with clear command chain
|
||||
- Best for: Development, structured tasks, large projects
|
||||
- Communication: Efficient, clear responsibilities
|
||||
|
||||
### Ring
|
||||
|
||||
- Agents connect in a circle
|
||||
- Best for: Pipeline processing, sequential workflows
|
||||
- Communication: Low overhead, ordered processing
|
||||
|
||||
### Star
|
||||
|
||||
- Central coordinator with satellite agents
|
||||
- Best for: Simple tasks, centralized control
|
||||
- Communication: Minimal overhead, clear coordination
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
Once initialized, use MCP tools in Claude Code:
|
||||
|
||||
```javascript
|
||||
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 8 }
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `agent spawn` - Create swarm agents
|
||||
- `task orchestrate` - Coordinate task execution
|
||||
- `swarm status` - Check swarm state
|
||||
- `swarm monitor` - Real-time monitoring
|
||||
@@ -0,0 +1,25 @@
|
||||
# task-orchestrate
|
||||
|
||||
Orchestrate complex tasks across the swarm.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow task orchestrate [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--task <description>` - Task description
|
||||
- `--strategy <type>` - Orchestration strategy
|
||||
- `--priority <level>` - Task priority (low, medium, high, critical)
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Orchestrate development task
|
||||
npx claude-flow task orchestrate --task "Implement user authentication"
|
||||
|
||||
# High priority task
|
||||
npx claude-flow task orchestrate --task "Fix production bug" --priority critical
|
||||
|
||||
# With specific strategy
|
||||
npx claude-flow task orchestrate --task "Refactor codebase" --strategy parallel
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
# Github Commands
|
||||
|
||||
Commands for github operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [github-swarm](./github-swarm.md)
|
||||
- [repo-analyze](./repo-analyze.md)
|
||||
- [pr-enhance](./pr-enhance.md)
|
||||
- [issue-triage](./issue-triage.md)
|
||||
- [code-review](./code-review.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# code-review
|
||||
|
||||
Automated code review with swarm intelligence.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow github code-review [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--pr-number <n>` - Pull request to review
|
||||
- `--focus <areas>` - Review focus (security, performance, style)
|
||||
- `--suggest-fixes` - Suggest code fixes
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Review PR
|
||||
npx claude-flow github code-review --pr-number 456
|
||||
|
||||
# Security focus
|
||||
npx claude-flow github code-review --pr-number 456 --focus security
|
||||
|
||||
# With fix suggestions
|
||||
npx claude-flow github code-review --pr-number 456 --suggest-fixes
|
||||
```
|
||||
@@ -0,0 +1,121 @@
|
||||
# github swarm
|
||||
|
||||
Create a specialized swarm for GitHub repository management.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow github swarm [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--repository, -r <owner/repo>` - Target GitHub repository
|
||||
- `--agents, -a <number>` - Number of specialized agents (default: 5)
|
||||
- `--focus, -f <type>` - Focus area: maintenance, development, review, triage
|
||||
- `--auto-pr` - Enable automatic pull request enhancements
|
||||
- `--issue-labels` - Auto-categorize and label issues
|
||||
- `--code-review` - Enable AI-powered code reviews
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic GitHub swarm
|
||||
|
||||
```bash
|
||||
npx claude-flow github swarm --repository owner/repo
|
||||
```
|
||||
|
||||
### Maintenance-focused swarm
|
||||
|
||||
```bash
|
||||
npx claude-flow github swarm -r owner/repo -f maintenance --issue-labels
|
||||
```
|
||||
|
||||
### Development swarm with PR automation
|
||||
|
||||
```bash
|
||||
npx claude-flow github swarm -r owner/repo -f development --auto-pr --code-review
|
||||
```
|
||||
|
||||
### Full-featured triage swarm
|
||||
|
||||
```bash
|
||||
npx claude-flow github swarm -r owner/repo -a 8 -f triage --issue-labels --auto-pr
|
||||
```
|
||||
|
||||
## Agent Types
|
||||
|
||||
### Issue Triager
|
||||
|
||||
- Analyzes and categorizes issues
|
||||
- Suggests labels and priorities
|
||||
- Identifies duplicates and related issues
|
||||
|
||||
### PR Reviewer
|
||||
|
||||
- Reviews code changes
|
||||
- Suggests improvements
|
||||
- Checks for best practices
|
||||
|
||||
### Documentation Agent
|
||||
|
||||
- Updates README files
|
||||
- Creates API documentation
|
||||
- Maintains changelog
|
||||
|
||||
### Test Agent
|
||||
|
||||
- Identifies missing tests
|
||||
- Suggests test cases
|
||||
- Validates test coverage
|
||||
|
||||
### Security Agent
|
||||
|
||||
- Scans for vulnerabilities
|
||||
- Reviews dependencies
|
||||
- Suggests security improvements
|
||||
|
||||
## Workflows
|
||||
|
||||
### Issue Triage Workflow
|
||||
|
||||
1. Scan all open issues
|
||||
2. Categorize by type and priority
|
||||
3. Apply appropriate labels
|
||||
4. Suggest assignees
|
||||
5. Link related issues
|
||||
|
||||
### PR Enhancement Workflow
|
||||
|
||||
1. Analyze PR changes
|
||||
2. Suggest missing tests
|
||||
3. Improve documentation
|
||||
4. Format code consistently
|
||||
5. Add helpful comments
|
||||
|
||||
### Repository Health Check
|
||||
|
||||
1. Analyze code quality metrics
|
||||
2. Review dependency status
|
||||
3. Check test coverage
|
||||
4. Assess documentation completeness
|
||||
5. Generate health report
|
||||
|
||||
## Integration with Claude Code
|
||||
|
||||
Use in Claude Code with MCP tools:
|
||||
|
||||
```javascript
|
||||
mcp__claude-flow__github_swarm {
|
||||
repository: "owner/repo",
|
||||
agents: 6,
|
||||
focus: "maintenance"
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `repo analyze` - Deep repository analysis
|
||||
- `pr enhance` - Enhance pull requests
|
||||
- `issue triage` - Intelligent issue management
|
||||
- `code review` - Automated reviews
|
||||
@@ -0,0 +1,25 @@
|
||||
# issue-triage
|
||||
|
||||
Intelligent issue classification and triage.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow github issue-triage [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--repository <owner/repo>` - Target repository
|
||||
- `--auto-label` - Automatically apply labels
|
||||
- `--assign` - Auto-assign to team members
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Triage issues
|
||||
npx claude-flow github issue-triage --repository myorg/myrepo
|
||||
|
||||
# With auto-labeling
|
||||
npx claude-flow github issue-triage --repository myorg/myrepo --auto-label
|
||||
|
||||
# Full automation
|
||||
npx claude-flow github issue-triage --repository myorg/myrepo --auto-label --assign
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
# pr-enhance
|
||||
|
||||
AI-powered pull request enhancements.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow github pr-enhance [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--pr-number <n>` - Pull request number
|
||||
- `--add-tests` - Add missing tests
|
||||
- `--improve-docs` - Improve documentation
|
||||
- `--check-security` - Security review
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Enhance PR
|
||||
npx claude-flow github pr-enhance --pr-number 123
|
||||
|
||||
# Add tests
|
||||
npx claude-flow github pr-enhance --pr-number 123 --add-tests
|
||||
|
||||
# Full enhancement
|
||||
npx claude-flow github pr-enhance --pr-number 123 --add-tests --improve-docs
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# repo-analyze
|
||||
|
||||
Deep analysis of GitHub repository with AI insights.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow github repo-analyze [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--repository <owner/repo>` - Repository to analyze
|
||||
- `--deep` - Enable deep analysis
|
||||
- `--include <areas>` - Include specific areas (issues, prs, code, commits)
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Basic analysis
|
||||
npx claude-flow github repo-analyze --repository myorg/myrepo
|
||||
|
||||
# Deep analysis
|
||||
npx claude-flow github repo-analyze --repository myorg/myrepo --deep
|
||||
|
||||
# Specific areas
|
||||
npx claude-flow github repo-analyze --repository myorg/myrepo --include issues,prs
|
||||
```
|
||||
@@ -0,0 +1,11 @@
|
||||
# Hooks Commands
|
||||
|
||||
Commands for hooks operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [pre-task](./pre-task.md)
|
||||
- [post-task](./post-task.md)
|
||||
- [pre-edit](./pre-edit.md)
|
||||
- [post-edit](./post-edit.md)
|
||||
- [session-end](./session-end.md)
|
||||
@@ -0,0 +1,117 @@
|
||||
# hook post-edit
|
||||
|
||||
Execute post-edit processing including formatting, validation, and memory updates.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-edit [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--file, -f <path>` - File path that was edited
|
||||
- `--auto-format` - Automatically format code (default: true)
|
||||
- `--memory-key, -m <key>` - Store edit context in memory
|
||||
- `--train-patterns` - Train neural patterns from edit
|
||||
- `--validate-output` - Validate edited file
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic post-edit hook
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-edit --file "src/components/Button.jsx"
|
||||
```
|
||||
|
||||
### With memory storage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-edit -f "api/auth.js" --memory-key "auth/login-implementation"
|
||||
```
|
||||
|
||||
### Format and validate
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-edit -f "config/webpack.js" --auto-format --validate-output
|
||||
```
|
||||
|
||||
### Neural training
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-edit -f "utils/helpers.ts" --train-patterns --memory-key "utils/refactor"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Auto Formatting
|
||||
|
||||
- Language-specific formatters
|
||||
- Prettier for JS/TS/JSON
|
||||
- Black for Python
|
||||
- gofmt for Go
|
||||
- Maintains consistency
|
||||
|
||||
### Memory Storage
|
||||
|
||||
- Saves edit context
|
||||
- Records decisions made
|
||||
- Tracks implementation details
|
||||
- Enables knowledge sharing
|
||||
|
||||
### Pattern Training
|
||||
|
||||
- Learns from successful edits
|
||||
- Improves future suggestions
|
||||
- Adapts to coding style
|
||||
- Enhances coordination
|
||||
|
||||
### Output Validation
|
||||
|
||||
- Checks syntax correctness
|
||||
- Runs linting rules
|
||||
- Validates formatting
|
||||
- Ensures quality
|
||||
|
||||
## Integration
|
||||
|
||||
This hook is automatically called by Claude Code when:
|
||||
|
||||
- After Edit tool completes
|
||||
- Following MultiEdit operations
|
||||
- During file saves
|
||||
- After code generation
|
||||
|
||||
Manual usage in agents:
|
||||
|
||||
```bash
|
||||
# After editing files
|
||||
npx claude-flow hook post-edit --file "path/to/edited.js" --memory-key "feature/step1"
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
Returns JSON with:
|
||||
|
||||
```json
|
||||
{
|
||||
"file": "src/components/Button.jsx",
|
||||
"formatted": true,
|
||||
"formatterUsed": "prettier",
|
||||
"lintPassed": true,
|
||||
"memorySaved": "component/button-refactor",
|
||||
"patternsTrained": 3,
|
||||
"warnings": [],
|
||||
"stats": {
|
||||
"linesChanged": 45,
|
||||
"charactersAdded": 234
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `hook pre-edit` - Pre-edit preparation
|
||||
- `Edit` - File editing tool
|
||||
- `memory usage` - Memory management
|
||||
- `neural train` - Pattern training
|
||||
@@ -0,0 +1,112 @@
|
||||
# hook post-task
|
||||
|
||||
Execute post-task cleanup, performance analysis, and memory storage.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-task [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--task-id, -t <id>` - Task identifier for tracking
|
||||
- `--analyze-performance` - Generate performance metrics (default: true)
|
||||
- `--store-decisions` - Save task decisions to memory
|
||||
- `--export-learnings` - Export neural pattern learnings
|
||||
- `--generate-report` - Create task completion report
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic post-task hook
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-task --task-id "auth-implementation"
|
||||
```
|
||||
|
||||
### With full analysis
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-task -t "api-refactor" --analyze-performance --generate-report
|
||||
```
|
||||
|
||||
### Memory storage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-task -t "bug-fix-123" --store-decisions --export-learnings
|
||||
```
|
||||
|
||||
### Quick cleanup
|
||||
|
||||
```bash
|
||||
npx claude-flow hook post-task -t "minor-update" --analyze-performance false
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Performance Analysis
|
||||
|
||||
- Measures execution time
|
||||
- Tracks token usage
|
||||
- Identifies bottlenecks
|
||||
- Suggests optimizations
|
||||
|
||||
### Decision Storage
|
||||
|
||||
- Saves key decisions made
|
||||
- Records implementation choices
|
||||
- Stores error resolutions
|
||||
- Maintains knowledge base
|
||||
|
||||
### Neural Learning
|
||||
|
||||
- Exports successful patterns
|
||||
- Updates coordination models
|
||||
- Improves future performance
|
||||
- Trains on task outcomes
|
||||
|
||||
### Report Generation
|
||||
|
||||
- Creates completion summary
|
||||
- Documents changes made
|
||||
- Lists files modified
|
||||
- Tracks metrics achieved
|
||||
|
||||
## Integration
|
||||
|
||||
This hook is automatically called by Claude Code when:
|
||||
|
||||
- Completing a task
|
||||
- Switching to a new task
|
||||
- Ending a work session
|
||||
- After major milestones
|
||||
|
||||
Manual usage in agents:
|
||||
|
||||
```bash
|
||||
# In agent coordination
|
||||
npx claude-flow hook post-task --task-id "your-task-id" --analyze-performance true
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
Returns JSON with:
|
||||
|
||||
```json
|
||||
{
|
||||
"taskId": "auth-implementation",
|
||||
"duration": 1800000,
|
||||
"tokensUsed": 45000,
|
||||
"filesModified": 12,
|
||||
"performanceScore": 0.92,
|
||||
"learningsExported": true,
|
||||
"reportPath": "/reports/task-auth-implementation.md"
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `hook pre-task` - Pre-task setup
|
||||
- `performance report` - Detailed metrics
|
||||
- `memory usage` - Memory management
|
||||
- `neural patterns` - Pattern analysis
|
||||
@@ -0,0 +1,113 @@
|
||||
# hook pre-edit
|
||||
|
||||
Execute pre-edit validations and agent assignment before file modifications.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-edit [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--file, -f <path>` - File path to be edited
|
||||
- `--auto-assign-agent` - Automatically assign best agent (default: true)
|
||||
- `--validate-syntax` - Pre-validate syntax before edit
|
||||
- `--check-conflicts` - Check for merge conflicts
|
||||
- `--backup-file` - Create backup before editing
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic pre-edit hook
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-edit --file "src/auth/login.js"
|
||||
```
|
||||
|
||||
### With validation
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-edit -f "config/database.js" --validate-syntax
|
||||
```
|
||||
|
||||
### Manual agent assignment
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-edit -f "api/users.ts" --auto-assign-agent false
|
||||
```
|
||||
|
||||
### Safe editing with backup
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-edit -f "production.env" --backup-file --check-conflicts
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Auto Agent Assignment
|
||||
|
||||
- Analyzes file type and content
|
||||
- Assigns specialist agents
|
||||
- TypeScript → TypeScript expert
|
||||
- Database → Data specialist
|
||||
- Tests → QA engineer
|
||||
|
||||
### Syntax Validation
|
||||
|
||||
- Pre-checks syntax validity
|
||||
- Identifies potential errors
|
||||
- Suggests corrections
|
||||
- Prevents broken code
|
||||
|
||||
### Conflict Detection
|
||||
|
||||
- Checks for git conflicts
|
||||
- Identifies concurrent edits
|
||||
- Warns about stale files
|
||||
- Suggests merge strategies
|
||||
|
||||
### File Backup
|
||||
|
||||
- Creates safety backups
|
||||
- Enables quick rollback
|
||||
- Tracks edit history
|
||||
- Preserves originals
|
||||
|
||||
## Integration
|
||||
|
||||
This hook is automatically called by Claude Code when:
|
||||
|
||||
- Using Edit or MultiEdit tools
|
||||
- Before file modifications
|
||||
- During refactoring operations
|
||||
- When updating critical files
|
||||
|
||||
Manual usage in agents:
|
||||
|
||||
```bash
|
||||
# Before editing files
|
||||
npx claude-flow hook pre-edit --file "path/to/file.js" --validate-syntax
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
Returns JSON with:
|
||||
|
||||
```json
|
||||
{
|
||||
"continue": true,
|
||||
"file": "src/auth/login.js",
|
||||
"assignedAgent": "auth-specialist",
|
||||
"syntaxValid": true,
|
||||
"conflicts": false,
|
||||
"backupPath": ".backups/login.js.bak",
|
||||
"warnings": []
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `hook post-edit` - Post-edit processing
|
||||
- `Edit` - File editing tool
|
||||
- `MultiEdit` - Multiple edits tool
|
||||
- `agent spawn` - Manual agent creation
|
||||
@@ -0,0 +1,111 @@
|
||||
# hook pre-task
|
||||
|
||||
Execute pre-task preparations and context loading.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-task [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--description, -d <text>` - Task description for context
|
||||
- `--auto-spawn-agents` - Automatically spawn required agents (default: true)
|
||||
- `--load-memory` - Load relevant memory from previous sessions
|
||||
- `--optimize-topology` - Select optimal swarm topology
|
||||
- `--estimate-complexity` - Analyze task complexity
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic pre-task hook
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-task --description "Implement user authentication"
|
||||
```
|
||||
|
||||
### With memory loading
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-task -d "Continue API development" --load-memory
|
||||
```
|
||||
|
||||
### Manual agent control
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-task -d "Debug issue #123" --auto-spawn-agents false
|
||||
```
|
||||
|
||||
### Full optimization
|
||||
|
||||
```bash
|
||||
npx claude-flow hook pre-task -d "Refactor codebase" --optimize-topology --estimate-complexity
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Auto Agent Assignment
|
||||
|
||||
- Analyzes task requirements
|
||||
- Determines needed agent types
|
||||
- Spawns agents automatically
|
||||
- Configures agent parameters
|
||||
|
||||
### Memory Loading
|
||||
|
||||
- Retrieves relevant past decisions
|
||||
- Loads previous task contexts
|
||||
- Restores agent configurations
|
||||
- Maintains continuity
|
||||
|
||||
### Topology Optimization
|
||||
|
||||
- Analyzes task structure
|
||||
- Selects best swarm topology
|
||||
- Configures communication patterns
|
||||
- Optimizes for performance
|
||||
|
||||
### Complexity Estimation
|
||||
|
||||
- Evaluates task difficulty
|
||||
- Estimates time requirements
|
||||
- Suggests agent count
|
||||
- Identifies dependencies
|
||||
|
||||
## Integration
|
||||
|
||||
This hook is automatically called by Claude Code when:
|
||||
|
||||
- Starting a new task
|
||||
- Resuming work after a break
|
||||
- Switching between projects
|
||||
- Beginning complex operations
|
||||
|
||||
Manual usage in agents:
|
||||
|
||||
```bash
|
||||
# In agent coordination
|
||||
npx claude-flow hook pre-task --description "Your task here"
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
Returns JSON with:
|
||||
|
||||
```json
|
||||
{
|
||||
"continue": true,
|
||||
"topology": "hierarchical",
|
||||
"agentsSpawned": 5,
|
||||
"complexity": "medium",
|
||||
"estimatedMinutes": 30,
|
||||
"memoryLoaded": true
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `hook post-task` - Post-task cleanup
|
||||
- `agent spawn` - Manual agent creation
|
||||
- `memory usage` - Memory management
|
||||
- `swarm init` - Swarm initialization
|
||||
@@ -0,0 +1,118 @@
|
||||
# hook session-end
|
||||
|
||||
Cleanup and persist session state before ending work.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npx claude-flow hook session-end [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--session-id, -s <id>` - Session identifier to end
|
||||
- `--save-state` - Save current session state (default: true)
|
||||
- `--export-metrics` - Export session metrics
|
||||
- `--generate-summary` - Create session summary
|
||||
- `--cleanup-temp` - Remove temporary files
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic session end
|
||||
|
||||
```bash
|
||||
npx claude-flow hook session-end --session-id "dev-session-2024"
|
||||
```
|
||||
|
||||
### With full export
|
||||
|
||||
```bash
|
||||
npx claude-flow hook session-end -s "feature-auth" --export-metrics --generate-summary
|
||||
```
|
||||
|
||||
### Quick close
|
||||
|
||||
```bash
|
||||
npx claude-flow hook session-end -s "quick-fix" --save-state false --cleanup-temp
|
||||
```
|
||||
|
||||
### Complete persistence
|
||||
|
||||
```bash
|
||||
npx claude-flow hook session-end -s "major-refactor" --save-state --export-metrics --generate-summary
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### State Persistence
|
||||
|
||||
- Saves current context
|
||||
- Stores open files
|
||||
- Preserves task progress
|
||||
- Maintains decisions
|
||||
|
||||
### Metric Export
|
||||
|
||||
- Session duration
|
||||
- Commands executed
|
||||
- Files modified
|
||||
- Tokens consumed
|
||||
- Performance data
|
||||
|
||||
### Summary Generation
|
||||
|
||||
- Work accomplished
|
||||
- Key decisions made
|
||||
- Problems solved
|
||||
- Next steps identified
|
||||
|
||||
### Cleanup Operations
|
||||
|
||||
- Removes temp files
|
||||
- Clears caches
|
||||
- Frees resources
|
||||
- Optimizes storage
|
||||
|
||||
## Integration
|
||||
|
||||
This hook is automatically called by Claude Code when:
|
||||
|
||||
- Ending a conversation
|
||||
- Closing work session
|
||||
- Before shutdown
|
||||
- Switching contexts
|
||||
|
||||
Manual usage in agents:
|
||||
|
||||
```bash
|
||||
# At session end
|
||||
npx claude-flow hook session-end --session-id "your-session" --generate-summary
|
||||
```
|
||||
|
||||
## Output
|
||||
|
||||
Returns JSON with:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionId": "dev-session-2024",
|
||||
"duration": 7200000,
|
||||
"saved": true,
|
||||
"metrics": {
|
||||
"commandsRun": 145,
|
||||
"filesModified": 23,
|
||||
"tokensUsed": 85000,
|
||||
"tasksCompleted": 8
|
||||
},
|
||||
"summaryPath": "/sessions/dev-session-2024-summary.md",
|
||||
"cleanedUp": true,
|
||||
"nextSession": "dev-session-2025"
|
||||
}
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `hook session-start` - Session initialization
|
||||
- `hook session-restore` - Session restoration
|
||||
- `performance report` - Detailed metrics
|
||||
- `memory backup` - State backup
|
||||
@@ -0,0 +1,9 @@
|
||||
# Memory Commands
|
||||
|
||||
Commands for memory operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [memory-usage](./memory-usage.md)
|
||||
- [memory-persist](./memory-persist.md)
|
||||
- [memory-search](./memory-search.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# memory-persist
|
||||
|
||||
Persist memory across sessions.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow memory persist [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--export <file>` - Export to file
|
||||
- `--import <file>` - Import from file
|
||||
- `--compress` - Compress memory data
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Export memory
|
||||
npx claude-flow memory persist --export memory-backup.json
|
||||
|
||||
# Import memory
|
||||
npx claude-flow memory persist --import memory-backup.json
|
||||
|
||||
# Compressed export
|
||||
npx claude-flow memory persist --export memory.gz --compress
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# memory-search
|
||||
|
||||
Search through stored memory.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow memory search [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--query <text>` - Search query
|
||||
- `--pattern <regex>` - Pattern matching
|
||||
- `--limit <n>` - Result limit
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Search memory
|
||||
npx claude-flow memory search --query "authentication"
|
||||
|
||||
# Pattern search
|
||||
npx claude-flow memory search --pattern "api-.*"
|
||||
|
||||
# Limited results
|
||||
npx claude-flow memory search --query "config" --limit 10
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# memory-usage
|
||||
|
||||
Manage persistent memory storage.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow memory usage [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--action <type>` - Action (store, retrieve, list, clear)
|
||||
- `--key <key>` - Memory key
|
||||
- `--value <data>` - Data to store (JSON)
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Store memory
|
||||
npx claude-flow memory usage --action store --key "project-config" --value '{"api": "v2"}'
|
||||
|
||||
# Retrieve memory
|
||||
npx claude-flow memory usage --action retrieve --key "project-config"
|
||||
|
||||
# List all keys
|
||||
npx claude-flow memory usage --action list
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# Monitoring Commands
|
||||
|
||||
Commands for monitoring operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [swarm-monitor](./swarm-monitor.md)
|
||||
- [agent-metrics](./agent-metrics.md)
|
||||
- [real-time-view](./real-time-view.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# agent-metrics
|
||||
|
||||
View agent performance metrics.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow agent metrics [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--agent-id <id>` - Specific agent
|
||||
- `--period <time>` - Time period
|
||||
- `--format <type>` - Output format
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# All agents metrics
|
||||
npx claude-flow agent metrics
|
||||
|
||||
# Specific agent
|
||||
npx claude-flow agent metrics --agent-id agent-001
|
||||
|
||||
# Last hour
|
||||
npx claude-flow agent metrics --period 1h
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# real-time-view
|
||||
|
||||
Real-time view of swarm activity.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow monitoring real-time-view [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--filter <type>` - Filter view
|
||||
- `--highlight <pattern>` - Highlight pattern
|
||||
- `--tail <n>` - Show last N events
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Start real-time view
|
||||
npx claude-flow monitoring real-time-view
|
||||
|
||||
# Filter errors
|
||||
npx claude-flow monitoring real-time-view --filter errors
|
||||
|
||||
# Highlight pattern
|
||||
npx claude-flow monitoring real-time-view --highlight "API"
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# swarm-monitor
|
||||
|
||||
Real-time swarm monitoring.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow swarm monitor [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--interval <ms>` - Update interval
|
||||
- `--metrics` - Show detailed metrics
|
||||
- `--export` - Export monitoring data
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Start monitoring
|
||||
npx claude-flow swarm monitor
|
||||
|
||||
# Custom interval
|
||||
npx claude-flow swarm monitor --interval 5000
|
||||
|
||||
# With metrics
|
||||
npx claude-flow swarm monitor --metrics
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# Optimization Commands
|
||||
|
||||
Commands for optimization operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [topology-optimize](./topology-optimize.md)
|
||||
- [parallel-execute](./parallel-execute.md)
|
||||
- [cache-manage](./cache-manage.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# cache-manage
|
||||
|
||||
Manage operation cache for performance.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow optimization cache-manage [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--action <type>` - Action (view, clear, optimize)
|
||||
- `--max-size <mb>` - Maximum cache size
|
||||
- `--ttl <seconds>` - Time to live
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# View cache stats
|
||||
npx claude-flow optimization cache-manage --action view
|
||||
|
||||
# Clear cache
|
||||
npx claude-flow optimization cache-manage --action clear
|
||||
|
||||
# Set limits
|
||||
npx claude-flow optimization cache-manage --max-size 100 --ttl 3600
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# parallel-execute
|
||||
|
||||
Execute tasks in parallel for maximum efficiency.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow optimization parallel-execute [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--tasks <file>` - Task list file
|
||||
- `--max-parallel <n>` - Maximum parallel tasks
|
||||
- `--strategy <type>` - Execution strategy
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Execute task list
|
||||
npx claude-flow optimization parallel-execute --tasks tasks.json
|
||||
|
||||
# Limit parallelism
|
||||
npx claude-flow optimization parallel-execute --tasks tasks.json --max-parallel 5
|
||||
|
||||
# Custom strategy
|
||||
npx claude-flow optimization parallel-execute --strategy adaptive
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# topology-optimize
|
||||
|
||||
Optimize swarm topology for current workload.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow optimization topology-optimize [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--analyze-first` - Analyze before optimizing
|
||||
- `--target <metric>` - Optimization target
|
||||
- `--apply` - Apply optimizations
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Analyze and suggest
|
||||
npx claude-flow optimization topology-optimize --analyze-first
|
||||
|
||||
# Optimize for speed
|
||||
npx claude-flow optimization topology-optimize --target speed
|
||||
|
||||
# Apply changes
|
||||
npx claude-flow optimization topology-optimize --target efficiency --apply
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# Training Commands
|
||||
|
||||
Commands for training operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [neural-train](./neural-train.md)
|
||||
- [pattern-learn](./pattern-learn.md)
|
||||
- [model-update](./model-update.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# model-update
|
||||
|
||||
Update neural models with new data.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow training model-update [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--model <name>` - Model to update
|
||||
- `--incremental` - Incremental update
|
||||
- `--validate` - Validate after update
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Update all models
|
||||
npx claude-flow training model-update
|
||||
|
||||
# Specific model
|
||||
npx claude-flow training model-update --model agent-selector
|
||||
|
||||
# Incremental with validation
|
||||
npx claude-flow training model-update --incremental --validate
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# neural-train
|
||||
|
||||
Train neural patterns from operations.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow training neural-train [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--data <source>` - Training data source
|
||||
- `--model <name>` - Target model
|
||||
- `--epochs <n>` - Training epochs
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Train from recent ops
|
||||
npx claude-flow training neural-train --data recent
|
||||
|
||||
# Specific model
|
||||
npx claude-flow training neural-train --model task-predictor
|
||||
|
||||
# Custom epochs
|
||||
npx claude-flow training neural-train --epochs 100
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# pattern-learn
|
||||
|
||||
Learn patterns from successful operations.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow training pattern-learn [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--source <type>` - Pattern source
|
||||
- `--threshold <score>` - Success threshold
|
||||
- `--save <name>` - Save pattern set
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Learn from all ops
|
||||
npx claude-flow training pattern-learn
|
||||
|
||||
# High success only
|
||||
npx claude-flow training pattern-learn --threshold 0.9
|
||||
|
||||
# Save patterns
|
||||
npx claude-flow training pattern-learn --save optimal-patterns
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# Workflows Commands
|
||||
|
||||
Commands for workflows operations in Claude Flow.
|
||||
|
||||
## Available Commands
|
||||
|
||||
- [workflow-create](./workflow-create.md)
|
||||
- [workflow-execute](./workflow-execute.md)
|
||||
- [workflow-export](./workflow-export.md)
|
||||
@@ -0,0 +1,25 @@
|
||||
# workflow-create
|
||||
|
||||
Create reusable workflow templates.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow workflow create [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--name <name>` - Workflow name
|
||||
- `--from-history` - Create from history
|
||||
- `--interactive` - Interactive creation
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Create workflow
|
||||
npx claude-flow workflow create --name "deploy-api"
|
||||
|
||||
# From history
|
||||
npx claude-flow workflow create --name "test-suite" --from-history
|
||||
|
||||
# Interactive mode
|
||||
npx claude-flow workflow create --interactive
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# workflow-execute
|
||||
|
||||
Execute saved workflows.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow workflow execute [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--name <name>` - Workflow name
|
||||
- `--params <json>` - Workflow parameters
|
||||
- `--dry-run` - Preview execution
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Execute workflow
|
||||
npx claude-flow workflow execute --name "deploy-api"
|
||||
|
||||
# With parameters
|
||||
npx claude-flow workflow execute --name "test-suite" --params '{"env": "staging"}'
|
||||
|
||||
# Dry run
|
||||
npx claude-flow workflow execute --name "deploy-api" --dry-run
|
||||
```
|
||||
@@ -0,0 +1,25 @@
|
||||
# workflow-export
|
||||
|
||||
Export workflows for sharing.
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
npx claude-flow workflow export [options]
|
||||
```
|
||||
|
||||
## Options
|
||||
- `--name <name>` - Workflow to export
|
||||
- `--format <type>` - Export format
|
||||
- `--include-history` - Include execution history
|
||||
|
||||
## Examples
|
||||
```bash
|
||||
# Export workflow
|
||||
npx claude-flow workflow export --name "deploy-api"
|
||||
|
||||
# As YAML
|
||||
npx claude-flow workflow export --name "test-suite" --format yaml
|
||||
|
||||
# With history
|
||||
npx claude-flow workflow export --name "deploy-api" --include-history
|
||||
```
|
||||
@@ -1,3 +1,251 @@
|
||||
#!/bin/bash
|
||||
# Checkpoint manager for Claude Flow
|
||||
# Use github-checkpoint-hooks.sh for checkpoint operations
|
||||
# Claude Checkpoint Manager
|
||||
# Provides easy rollback and management of Claude Code checkpoints
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
CHECKPOINT_DIR=".claude/checkpoints"
|
||||
BACKUP_DIR=".claude/backups"
|
||||
|
||||
# Help function
|
||||
show_help() {
|
||||
cat << EOF
|
||||
Claude Checkpoint Manager
|
||||
========================
|
||||
|
||||
Usage: $0 <command> [options]
|
||||
|
||||
Commands:
|
||||
list List all checkpoints
|
||||
show <id> Show details of a specific checkpoint
|
||||
rollback <id> Rollback to a specific checkpoint
|
||||
diff <id> Show diff since checkpoint
|
||||
clean Clean old checkpoints (older than 7 days)
|
||||
summary Show session summary
|
||||
|
||||
Options:
|
||||
--hard For rollback: use git reset --hard (destructive)
|
||||
--soft For rollback: use git reset --soft (default)
|
||||
--branch For rollback: create new branch from checkpoint
|
||||
|
||||
Examples:
|
||||
$0 list
|
||||
$0 show checkpoint-20240130-143022
|
||||
$0 rollback checkpoint-20240130-143022 --branch
|
||||
$0 diff session-end-session-20240130-150000
|
||||
EOF
|
||||
}
|
||||
|
||||
# List all checkpoints
|
||||
function list_checkpoints() {
|
||||
echo -e "${BLUE}📋 Available Checkpoints:${NC}"
|
||||
echo ""
|
||||
|
||||
# List checkpoint tags
|
||||
echo -e "${YELLOW}Git Tags:${NC}"
|
||||
local tags=$(git tag -l 'checkpoint-*' -l 'session-end-*' -l 'task-*' --sort=-creatordate | head -20)
|
||||
if [ -n "$tags" ]; then
|
||||
echo "$tags"
|
||||
else
|
||||
echo "No checkpoint tags found"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# List checkpoint branches
|
||||
echo -e "${YELLOW}Checkpoint Branches:${NC}"
|
||||
local branches=$(git branch -a | grep "checkpoint/" | sed 's/^[ *]*//')
|
||||
if [ -n "$branches" ]; then
|
||||
echo "$branches"
|
||||
else
|
||||
echo "No checkpoint branches found"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# List checkpoint files
|
||||
if [ -d "$CHECKPOINT_DIR" ]; then
|
||||
echo -e "${YELLOW}Recent Checkpoint Files:${NC}"
|
||||
find "$CHECKPOINT_DIR" -name "*.json" -type f -printf "%T@ %p\n" | \
|
||||
sort -rn | head -10 | cut -d' ' -f2- | xargs -I {} basename {}
|
||||
fi
|
||||
}
|
||||
|
||||
# Show checkpoint details
|
||||
function show_checkpoint() {
|
||||
local checkpoint_id="$1"
|
||||
|
||||
echo -e "${BLUE}📍 Checkpoint Details: $checkpoint_id${NC}"
|
||||
echo ""
|
||||
|
||||
# Check if it's a tag
|
||||
if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
|
||||
echo -e "${YELLOW}Type:${NC} Git Tag"
|
||||
echo -e "${YELLOW}Commit:${NC} $(git rev-list -n 1 "$checkpoint_id")"
|
||||
echo -e "${YELLOW}Date:${NC} $(git log -1 --format=%ai "$checkpoint_id")"
|
||||
echo -e "${YELLOW}Message:${NC}"
|
||||
git log -1 --format=%B "$checkpoint_id" | sed 's/^/ /'
|
||||
echo ""
|
||||
echo -e "${YELLOW}Files changed:${NC}"
|
||||
git diff-tree --no-commit-id --name-status -r "$checkpoint_id" | sed 's/^/ /'
|
||||
# Check if it's a branch
|
||||
elif git branch -a | grep -q "$checkpoint_id"; then
|
||||
echo -e "${YELLOW}Type:${NC} Git Branch"
|
||||
echo -e "${YELLOW}Latest commit:${NC}"
|
||||
git log -1 --oneline "$checkpoint_id"
|
||||
else
|
||||
echo -e "${RED}❌ Checkpoint not found: $checkpoint_id${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Rollback to checkpoint
|
||||
function rollback_checkpoint() {
|
||||
local checkpoint_id="$1"
|
||||
local mode="$2"
|
||||
|
||||
echo -e "${YELLOW}🔄 Rolling back to checkpoint: $checkpoint_id${NC}"
|
||||
echo ""
|
||||
|
||||
# Verify checkpoint exists
|
||||
if ! git tag -l "$checkpoint_id" | grep -q "$checkpoint_id" && \
|
||||
! git branch -a | grep -q "$checkpoint_id"; then
|
||||
echo -e "${RED}❌ Checkpoint not found: $checkpoint_id${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create backup before rollback
|
||||
local backup_name="backup-$(date +%Y%m%d-%H%M%S)"
|
||||
echo "Creating backup: $backup_name"
|
||||
git tag "$backup_name" -m "Backup before rollback to $checkpoint_id"
|
||||
|
||||
case "$mode" in
|
||||
"--hard")
|
||||
echo -e "${RED}⚠️ Performing hard reset (destructive)${NC}"
|
||||
git reset --hard "$checkpoint_id"
|
||||
echo -e "${GREEN}✅ Rolled back to $checkpoint_id (hard reset)${NC}"
|
||||
;;
|
||||
"--branch")
|
||||
local branch_name="rollback-$checkpoint_id-$(date +%Y%m%d-%H%M%S)"
|
||||
echo "Creating new branch: $branch_name"
|
||||
git checkout -b "$branch_name" "$checkpoint_id"
|
||||
echo -e "${GREEN}✅ Created branch $branch_name from $checkpoint_id${NC}"
|
||||
;;
|
||||
"--stash"|*)
|
||||
echo "Stashing current changes..."
|
||||
git stash push -m "Stash before rollback to $checkpoint_id"
|
||||
git reset --soft "$checkpoint_id"
|
||||
echo -e "${GREEN}✅ Rolled back to $checkpoint_id (soft reset)${NC}"
|
||||
echo "Your changes are stashed. Use 'git stash pop' to restore them."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Show diff since checkpoint
|
||||
function diff_checkpoint() {
|
||||
local checkpoint_id="$1"
|
||||
|
||||
echo -e "${BLUE}📊 Changes since checkpoint: $checkpoint_id${NC}"
|
||||
echo ""
|
||||
|
||||
if git tag -l "$checkpoint_id" | grep -q "$checkpoint_id"; then
|
||||
git diff "$checkpoint_id"
|
||||
elif git branch -a | grep -q "$checkpoint_id"; then
|
||||
git diff "$checkpoint_id"
|
||||
else
|
||||
echo -e "${RED}❌ Checkpoint not found: $checkpoint_id${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Clean old checkpoints
|
||||
function clean_checkpoints() {
|
||||
local days=${1:-7}
|
||||
|
||||
echo -e "${YELLOW}🧹 Cleaning checkpoints older than $days days...${NC}"
|
||||
echo ""
|
||||
|
||||
# Clean old checkpoint files
|
||||
if [ -d "$CHECKPOINT_DIR" ]; then
|
||||
find "$CHECKPOINT_DIR" -name "*.json" -type f -mtime +$days -delete
|
||||
echo "✅ Cleaned old checkpoint files"
|
||||
fi
|
||||
|
||||
# List old tags (but don't delete automatically)
|
||||
echo ""
|
||||
echo "Old checkpoint tags (manual deletion required):"
|
||||
git tag -l 'checkpoint-*' --sort=-creatordate | tail -n +50 || echo "No old tags found"
|
||||
}
|
||||
|
||||
# Show session summary
|
||||
function show_summary() {
|
||||
echo -e "${BLUE}📊 Session Summary${NC}"
|
||||
echo ""
|
||||
|
||||
# Find most recent session summary
|
||||
if [ -d "$CHECKPOINT_DIR" ]; then
|
||||
local latest_summary=$(find "$CHECKPOINT_DIR" -name "summary-*.md" -type f -printf "%T@ %p\n" | \
|
||||
sort -rn | head -1 | cut -d' ' -f2-)
|
||||
|
||||
if [ -n "$latest_summary" ]; then
|
||||
echo -e "${YELLOW}Latest session summary:${NC}"
|
||||
cat "$latest_summary"
|
||||
else
|
||||
echo "No session summaries found"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Main command handling
|
||||
case "$1" in
|
||||
list)
|
||||
list_checkpoints
|
||||
;;
|
||||
show)
|
||||
if [ -z "$2" ]; then
|
||||
echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
show_checkpoint "$2"
|
||||
;;
|
||||
rollback)
|
||||
if [ -z "$2" ]; then
|
||||
echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
rollback_checkpoint "$2" "$3"
|
||||
;;
|
||||
diff)
|
||||
if [ -z "$2" ]; then
|
||||
echo -e "${RED}Error: Please specify a checkpoint ID${NC}"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
diff_checkpoint "$2"
|
||||
;;
|
||||
clean)
|
||||
clean_checkpoints "$2"
|
||||
;;
|
||||
summary)
|
||||
show_summary
|
||||
;;
|
||||
help|--help|-h)
|
||||
show_help
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}Error: Unknown command: $1${NC}"
|
||||
echo ""
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Safe GitHub CLI Helper
|
||||
* Prevents timeout issues when using gh commands with special characters
|
||||
*
|
||||
* Usage:
|
||||
* ./github-safe.js issue comment 123 "Message with `backticks`"
|
||||
* ./github-safe.js pr create --title "Title" --body "Complex body"
|
||||
*/
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
import { writeFileSync, unlinkSync } from 'fs';
|
||||
import { tmpdir } from 'os';
|
||||
import { join } from 'path';
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.length < 2) {
|
||||
console.log(`
|
||||
Safe GitHub CLI Helper
|
||||
|
||||
Usage:
|
||||
./github-safe.js issue comment <number> <body>
|
||||
./github-safe.js pr comment <number> <body>
|
||||
./github-safe.js issue create --title <title> --body <body>
|
||||
./github-safe.js pr create --title <title> --body <body>
|
||||
|
||||
This helper prevents timeout issues with special characters like:
|
||||
- Backticks in code examples
|
||||
- Command substitution \$(...)
|
||||
- Directory paths
|
||||
- Special shell characters
|
||||
`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const [command, subcommand, ...restArgs] = args;
|
||||
|
||||
// Handle commands that need body content
|
||||
if ((command === 'issue' || command === 'pr') &&
|
||||
(subcommand === 'comment' || subcommand === 'create')) {
|
||||
|
||||
let bodyIndex = -1;
|
||||
let body = '';
|
||||
|
||||
if (subcommand === 'comment' && restArgs.length >= 2) {
|
||||
// Simple format: github-safe.js issue comment 123 "body"
|
||||
body = restArgs[1];
|
||||
bodyIndex = 1;
|
||||
} else {
|
||||
// Flag format: --body "content"
|
||||
bodyIndex = restArgs.indexOf('--body');
|
||||
if (bodyIndex !== -1 && bodyIndex < restArgs.length - 1) {
|
||||
body = restArgs[bodyIndex + 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (body) {
|
||||
// Use temporary file for body content
|
||||
const tmpFile = join(tmpdir(), `gh-body-${randomBytes(8).toString('hex')}.tmp`);
|
||||
|
||||
try {
|
||||
writeFileSync(tmpFile, body, 'utf8');
|
||||
|
||||
// Build new command with --body-file
|
||||
const newArgs = [...restArgs];
|
||||
if (subcommand === 'comment' && bodyIndex === 1) {
|
||||
// Replace body with --body-file
|
||||
newArgs[1] = '--body-file';
|
||||
newArgs.push(tmpFile);
|
||||
} else if (bodyIndex !== -1) {
|
||||
// Replace --body with --body-file
|
||||
newArgs[bodyIndex] = '--body-file';
|
||||
newArgs[bodyIndex + 1] = tmpFile;
|
||||
}
|
||||
|
||||
// Execute safely
|
||||
const ghCommand = `gh ${command} ${subcommand} ${newArgs.join(' ')}`;
|
||||
console.log(`Executing: ${ghCommand}`);
|
||||
|
||||
const result = execSync(ghCommand, {
|
||||
stdio: 'inherit',
|
||||
timeout: 30000 // 30 second timeout
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error.message);
|
||||
process.exit(1);
|
||||
} finally {
|
||||
// Clean up
|
||||
try {
|
||||
unlinkSync(tmpFile);
|
||||
} catch (e) {
|
||||
// Ignore cleanup errors
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// No body content, execute normally
|
||||
execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
|
||||
}
|
||||
} else {
|
||||
// Other commands, execute normally
|
||||
execSync(`gh ${args.join(' ')}`, { stdio: 'inherit' });
|
||||
}
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Setup GitHub integration for Claude Flow
|
||||
|
||||
echo "🔗 Setting up GitHub integration..."
|
||||
|
||||
# Check for gh CLI
|
||||
if ! command -v gh &> /dev/null; then
|
||||
echo "⚠️ GitHub CLI (gh) not found"
|
||||
echo "Install from: https://cli.github.com/"
|
||||
echo "Continuing without GitHub features..."
|
||||
else
|
||||
echo "✅ GitHub CLI found"
|
||||
|
||||
# Check auth status
|
||||
if gh auth status &> /dev/null; then
|
||||
echo "✅ GitHub authentication active"
|
||||
else
|
||||
echo "⚠️ Not authenticated with GitHub"
|
||||
echo "Run: gh auth login"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📦 GitHub swarm commands available:"
|
||||
echo " - npx claude-flow github swarm"
|
||||
echo " - npx claude-flow repo analyze"
|
||||
echo " - npx claude-flow pr enhance"
|
||||
echo " - npx claude-flow issue triage"
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Quick start guide for Claude Flow
|
||||
|
||||
echo "🚀 Claude Flow Quick Start"
|
||||
echo "=========================="
|
||||
echo ""
|
||||
echo "1. Initialize a swarm:"
|
||||
echo " npx claude-flow swarm init --topology hierarchical"
|
||||
echo ""
|
||||
echo "2. Spawn agents:"
|
||||
echo " npx claude-flow agent spawn --type coder --name "API Developer""
|
||||
echo ""
|
||||
echo "3. Orchestrate tasks:"
|
||||
echo " npx claude-flow task orchestrate --task "Build REST API""
|
||||
echo ""
|
||||
echo "4. Monitor progress:"
|
||||
echo " npx claude-flow swarm monitor"
|
||||
echo ""
|
||||
echo "📚 For more examples, see .claude/commands/"
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Setup MCP server for Claude Flow
|
||||
|
||||
echo "🚀 Setting up Claude Flow MCP server..."
|
||||
|
||||
# Check if claude command exists
|
||||
if ! command -v claude &> /dev/null; then
|
||||
echo "❌ Error: Claude Code CLI not found"
|
||||
echo "Please install Claude Code first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add MCP server
|
||||
echo "📦 Adding Claude Flow MCP server..."
|
||||
claude mcp add claude-flow npx claude-flow mcp start
|
||||
|
||||
echo "✅ MCP server setup complete!"
|
||||
echo "🎯 You can now use mcp__claude-flow__ tools in Claude Code"
|
||||
Regular → Executable
+2
-2
@@ -68,7 +68,7 @@ Automatic checkpoint created by Claude
|
||||
|
||||
# Store metadata
|
||||
mkdir -p .claude/checkpoints
|
||||
local diff_stats=$(git diff HEAD~1 --stat | tr '\n' ' ' | sed 's/"/\\"/g')
|
||||
local diff_stats=$(git diff HEAD~1 --stat | tr '\n' ' ' | sed 's/"/\"/g')
|
||||
cat > ".claude/checkpoints/$(date +%s).json" <<EOF
|
||||
{
|
||||
"tag": "$tag_name",
|
||||
@@ -176,4 +176,4 @@ case "$1" in
|
||||
echo "Usage: $0 {pre-edit|post-edit|task|session-end} [input]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
+15
-63
@@ -5,9 +5,7 @@
|
||||
"CLAUDE_FLOW_HOOKS_ENABLED": "true",
|
||||
"CLAUDE_FLOW_TELEMETRY_ENABLED": "true",
|
||||
"CLAUDE_FLOW_REMOTE_EXECUTION": "true",
|
||||
"CLAUDE_FLOW_GITHUB_INTEGRATION": "true",
|
||||
"CLAUDE_FLOW_CHECKPOINTS_ENABLED": "true",
|
||||
"CREATE_GH_RELEASE": "true"
|
||||
"CLAUDE_FLOW_GITHUB_INTEGRATION": "true"
|
||||
},
|
||||
"permissions": {
|
||||
"allow": [
|
||||
@@ -22,32 +20,11 @@
|
||||
"Bash(git commit *)",
|
||||
"Bash(git push)",
|
||||
"Bash(git config *)",
|
||||
"Bash(git tag *)",
|
||||
"Bash(git branch *)",
|
||||
"Bash(git checkout *)",
|
||||
"Bash(git stash *)",
|
||||
"Bash(git reset *)",
|
||||
"Bash(git rev-parse *)",
|
||||
"Bash(git ls-files *)",
|
||||
"Bash(gh *)",
|
||||
"Bash(node *)",
|
||||
"Bash(which *)",
|
||||
"Bash(pwd)",
|
||||
"Bash(ls *)",
|
||||
"Bash(jq *)",
|
||||
"Bash(test *)",
|
||||
"Bash(find *)",
|
||||
"Bash(grep *)",
|
||||
"Bash(sed *)",
|
||||
"Bash(awk *)",
|
||||
"Bash(curl *)",
|
||||
"Bash(mkdir *)",
|
||||
"Bash(cd *)",
|
||||
"Bash(cat *)",
|
||||
"Bash(echo *)",
|
||||
"Bash(npx claude-flow@alpha *)",
|
||||
"Bash(./claude-flow *)",
|
||||
"Bash(./.claude/helpers/*)"
|
||||
"Bash(ls *)"
|
||||
],
|
||||
"deny": [
|
||||
"Bash(rm -rf /)",
|
||||
@@ -73,10 +50,6 @@
|
||||
{
|
||||
"type": "command",
|
||||
"command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks pre-edit --file '{}' --auto-assign-agents true --load-context true"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"command": "./.claude/helpers/github-checkpoint-hooks.sh pre-edit \"{{tool_input}}\""
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -97,34 +70,6 @@
|
||||
{
|
||||
"type": "command",
|
||||
"command": "cat | jq -r '.tool_input.file_path // .tool_input.path // empty' | tr '\\n' '\\0' | xargs -0 -I {} npx claude-flow@alpha hooks post-edit --file '{}' --format true --update-memory true"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"command": "./.claude/helpers/github-checkpoint-hooks.sh post-edit \"{{tool_input}}\""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserPromptSubmit": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "./.claude/helpers/github-checkpoint-hooks.sh task \"{{user_prompt}}\""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true"
|
||||
},
|
||||
{
|
||||
"type": "command",
|
||||
"command": "./.claude/helpers/github-checkpoint-hooks.sh session-end"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -135,7 +80,7 @@
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \"\"\"); echo \"🔄 PreCompact Guidance:\"; echo \"📋 IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" • 54 available agents and concurrent usage patterns\"; echo \" • Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" • SPARC methodology workflows with batchtools optimization\"; echo \" • Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"✅ Ready for compact operation\"'"
|
||||
"command": "/bin/bash -c 'INPUT=$(cat); CUSTOM=$(echo \"$INPUT\" | jq -r \".custom_instructions // \\\"\\\"\"); echo \"🔄 PreCompact Guidance:\"; echo \"📋 IMPORTANT: Review CLAUDE.md in project root for:\"; echo \" • 54 available agents and concurrent usage patterns\"; echo \" • Swarm coordination strategies (hierarchical, mesh, adaptive)\"; echo \" • SPARC methodology workflows with batchtools optimization\"; echo \" • Critical concurrent execution rules (GOLDEN RULE: 1 MESSAGE = ALL OPERATIONS)\"; if [ -n \"$CUSTOM\" ]; then echo \"🎯 Custom compact instructions: $CUSTOM\"; fi; echo \"✅ Ready for compact operation\"'"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -148,11 +93,18 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "npx claude-flow@alpha hooks session-end --generate-summary true --persist-state true --export-metrics true"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeCoAuthoredBy": true,
|
||||
"enabledMcpjsonServers": [
|
||||
"claude-flow",
|
||||
"ruv-swarm"
|
||||
]
|
||||
}
|
||||
"enabledMcpjsonServers": ["claude-flow", "ruv-swarm"]
|
||||
}
|
||||
+2
-2
@@ -97,6 +97,8 @@ test-reports/
|
||||
.swarm/memory.db*
|
||||
.hive-mind/hive.db*
|
||||
|
||||
|
||||
|
||||
# Claude Flow generated files
|
||||
.claude/settings.local.json
|
||||
.mcp.json
|
||||
@@ -121,5 +123,3 @@ claude-flow
|
||||
claude-flow.bat
|
||||
claude-flow.ps1
|
||||
hive-mind-prompt-*.txt
|
||||
analysis-reports/
|
||||
checkpoints/*
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"initialized": "2025-07-17T03:49:28.570Z",
|
||||
"initialized": "2025-07-30T22:22:25.445Z",
|
||||
"defaults": {
|
||||
"queenType": "strategic",
|
||||
"maxWorkers": 8,
|
||||
|
||||
@@ -327,8 +327,859 @@ For more information about SPARC methodology and batchtools optimization, see:
|
||||
- Batchtools Documentation: https://github.com/ruvnet/claude-code-flow/docs/batchtools.md
|
||||
|
||||
# important-instruction-reminders
|
||||
Do what has been asked; nothing more, nothing less.
|
||||
NEVER create files unless they're absolutely necessary for achieving your goal.
|
||||
ALWAYS prefer editing an existing file to creating a new one.
|
||||
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
||||
NEVER create md or test files in root directories or system folders.
|
||||
Message 3: Task("Agent 2")
|
||||
Message 4: Read("file1.js")
|
||||
Message 5: Write("output1.js")
|
||||
Message 6: Bash("npm install")
|
||||
// This is 6x slower and breaks coordination!
|
||||
```
|
||||
|
||||
### 🎯 CONCURRENT EXECUTION CHECKLIST:
|
||||
|
||||
Before sending ANY message, ask yourself:
|
||||
|
||||
- ✅ Are ALL related TodoWrite operations batched together?
|
||||
- ✅ Are ALL Task spawning operations in ONE message?
|
||||
- ✅ Are ALL file operations (Read/Write/Edit) batched together?
|
||||
- ✅ Are ALL bash commands grouped in ONE message?
|
||||
- ✅ Are ALL memory operations concurrent?
|
||||
|
||||
If ANY answer is "No", you MUST combine operations into a single message!
|
||||
|
||||
## 🚀 CRITICAL: Claude Code Does ALL Real Work
|
||||
|
||||
### 🎯 CLAUDE CODE IS THE ONLY EXECUTOR
|
||||
|
||||
**ABSOLUTE RULE**: Claude Code performs ALL actual work:
|
||||
|
||||
### ✅ Claude Code ALWAYS Handles:
|
||||
|
||||
- 🔧 **ALL file operations** (Read, Write, Edit, MultiEdit, Glob, Grep)
|
||||
- 💻 **ALL code generation** and programming tasks
|
||||
- 🖥️ **ALL bash commands** and system operations
|
||||
- 🏗️ **ALL actual implementation** work
|
||||
- 🔍 **ALL project navigation** and code analysis
|
||||
- 📝 **ALL TodoWrite** and task management
|
||||
- 🔄 **ALL git operations** (commit, push, merge)
|
||||
- 📦 **ALL package management** (npm, pip, etc.)
|
||||
- 🧪 **ALL testing** and validation
|
||||
- 🔧 **ALL debugging** and troubleshooting
|
||||
|
||||
### 🧠 Claude Flow MCP Tools ONLY Handle:
|
||||
|
||||
- 🎯 **Coordination only** - Planning Claude Code's actions
|
||||
- 💾 **Memory management** - Storing decisions and context
|
||||
- 🤖 **Neural features** - Learning from Claude Code's work
|
||||
- 📊 **Performance tracking** - Monitoring Claude Code's efficiency
|
||||
- 🐝 **Swarm orchestration** - Coordinating multiple Claude Code instances
|
||||
- 🔗 **GitHub integration** - Advanced repository coordination
|
||||
|
||||
### 🚨 CRITICAL SEPARATION OF CONCERNS:
|
||||
|
||||
**❌ MCP Tools NEVER:**
|
||||
|
||||
- Write files or create content
|
||||
- Execute bash commands
|
||||
- Generate code
|
||||
- Perform file operations
|
||||
- Handle TodoWrite operations
|
||||
- Execute system commands
|
||||
- Do actual implementation work
|
||||
|
||||
**✅ MCP Tools ONLY:**
|
||||
|
||||
- Coordinate and plan
|
||||
- Store memory and context
|
||||
- Track performance
|
||||
- Orchestrate workflows
|
||||
- Provide intelligence insights
|
||||
|
||||
### ⚠️ Key Principle:
|
||||
|
||||
**MCP tools coordinate, Claude Code executes.** Think of MCP tools as the "brain" that plans and coordinates, while Claude Code is the "hands" that do all the actual work.
|
||||
|
||||
### 🔄 WORKFLOW EXECUTION PATTERN:
|
||||
|
||||
**✅ CORRECT Workflow:**
|
||||
|
||||
1. **MCP**: `mcp__claude-flow__swarm_init` (coordination setup)
|
||||
2. **MCP**: `mcp__claude-flow__agent_spawn` (planning agents)
|
||||
3. **MCP**: `mcp__claude-flow__task_orchestrate` (task coordination)
|
||||
4. **Claude Code**: `Task` tool to spawn agents with coordination instructions
|
||||
5. **Claude Code**: `TodoWrite` with ALL todos batched (5-10+ in ONE call)
|
||||
6. **Claude Code**: `Read`, `Write`, `Edit`, `Bash` (actual work)
|
||||
7. **MCP**: `mcp__claude-flow__memory_usage` (store results)
|
||||
|
||||
**❌ WRONG Workflow:**
|
||||
|
||||
1. **MCP**: `mcp__claude-flow__terminal_execute` (DON'T DO THIS)
|
||||
2. **MCP**: File creation via MCP (DON'T DO THIS)
|
||||
3. **MCP**: Code generation via MCP (DON'T DO THIS)
|
||||
4. **Claude Code**: Sequential Task calls (DON'T DO THIS)
|
||||
5. **Claude Code**: Individual TodoWrite calls (DON'T DO THIS)
|
||||
|
||||
### 🚨 REMEMBER:
|
||||
|
||||
- **MCP tools** = Coordination, planning, memory, intelligence
|
||||
- **Claude Code** = All actual execution, coding, file operations
|
||||
|
||||
## 🚀 CRITICAL: Parallel Execution & Batch Operations
|
||||
|
||||
### 🚨 MANDATORY RULE #1: BATCH EVERYTHING
|
||||
|
||||
**When using swarms, you MUST use BatchTool for ALL operations:**
|
||||
|
||||
1. **NEVER** send multiple messages for related operations
|
||||
2. **ALWAYS** combine multiple tool calls in ONE message
|
||||
3. **PARALLEL** execution is MANDATORY, not optional
|
||||
|
||||
### ⚡ THE GOLDEN RULE OF SWARMS
|
||||
|
||||
```
|
||||
If you need to do X operations, they should be in 1 message, not X messages
|
||||
```
|
||||
|
||||
### 🚨 MANDATORY TODO AND TASK BATCHING
|
||||
|
||||
**CRITICAL RULE FOR TODOS AND TASKS:**
|
||||
|
||||
1. **TodoWrite** MUST ALWAYS include ALL todos in ONE call (5-10+ todos)
|
||||
2. **Task** tool calls MUST be batched - spawn multiple agents in ONE message
|
||||
3. **NEVER** update todos one by one - this breaks parallel coordination
|
||||
4. **NEVER** spawn agents sequentially - ALL agents spawn together
|
||||
|
||||
### 📦 BATCH TOOL EXAMPLES
|
||||
|
||||
**✅ CORRECT - Everything in ONE Message:**
|
||||
|
||||
```javascript
|
||||
[Single Message with BatchTool]:
|
||||
// MCP coordination setup
|
||||
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 6 }
|
||||
mcp__claude-flow__agent_spawn { type: "researcher" }
|
||||
mcp__claude-flow__agent_spawn { type: "coder" }
|
||||
mcp__claude-flow__agent_spawn { type: "analyst" }
|
||||
mcp__claude-flow__agent_spawn { type: "tester" }
|
||||
mcp__claude-flow__agent_spawn { type: "coordinator" }
|
||||
|
||||
// Claude Code execution - ALL in parallel
|
||||
Task("You are researcher agent. MUST coordinate via hooks...")
|
||||
Task("You are coder agent. MUST coordinate via hooks...")
|
||||
Task("You are analyst agent. MUST coordinate via hooks...")
|
||||
Task("You are tester agent. MUST coordinate via hooks...")
|
||||
TodoWrite { todos: [5-10 todos with all priorities and statuses] }
|
||||
|
||||
// File operations in parallel
|
||||
Bash "mkdir -p app/{src,tests,docs}"
|
||||
Write "app/package.json"
|
||||
Write "app/README.md"
|
||||
Write "app/src/index.js"
|
||||
```
|
||||
|
||||
**❌ WRONG - Multiple Messages (NEVER DO THIS):**
|
||||
|
||||
```javascript
|
||||
Message 1: mcp__claude-flow__swarm_init
|
||||
Message 2: Task("researcher agent")
|
||||
Message 3: Task("coder agent")
|
||||
Message 4: TodoWrite({ todo: "single todo" })
|
||||
Message 5: Bash "mkdir src"
|
||||
Message 6: Write "package.json"
|
||||
// This is 6x slower and breaks parallel coordination!
|
||||
```
|
||||
|
||||
### 🎯 BATCH OPERATIONS BY TYPE
|
||||
|
||||
**Todo and Task Operations (Single Message):**
|
||||
|
||||
- **TodoWrite** → ALWAYS include 5-10+ todos in ONE call
|
||||
- **Task agents** → Spawn ALL agents with full instructions in ONE message
|
||||
- **Agent coordination** → ALL Task calls must include coordination hooks
|
||||
- **Status updates** → Update ALL todo statuses together
|
||||
- **NEVER** split todos or Task calls across messages!
|
||||
|
||||
**File Operations (Single Message):**
|
||||
|
||||
- Read 10 files? → One message with 10 Read calls
|
||||
- Write 5 files? → One message with 5 Write calls
|
||||
- Edit 1 file many times? → One MultiEdit call
|
||||
|
||||
**Swarm Operations (Single Message):**
|
||||
|
||||
- Need 8 agents? → One message with swarm_init + 8 agent_spawn calls
|
||||
- Multiple memories? → One message with all memory_usage calls
|
||||
- Task + monitoring? → One message with task_orchestrate + swarm_monitor
|
||||
|
||||
**Command Operations (Single Message):**
|
||||
|
||||
- Multiple directories? → One message with all mkdir commands
|
||||
- Install + test + lint? → One message with all npm commands
|
||||
- Git operations? → One message with all git commands
|
||||
|
||||
## 🚀 Quick Setup (Stdio MCP - Recommended)
|
||||
|
||||
### 1. Add MCP Server (Stdio - No Port Needed)
|
||||
|
||||
```bash
|
||||
# Add Claude Flow MCP server to Claude Code using stdio
|
||||
claude mcp add claude-flow npx claude-flow@alpha mcp start
|
||||
```
|
||||
|
||||
### 2. Use MCP Tools for Coordination in Claude Code
|
||||
|
||||
Once configured, Claude Flow MCP tools enhance Claude Code's coordination:
|
||||
|
||||
**Initialize a swarm:**
|
||||
|
||||
- Use the `mcp__claude-flow__swarm_init` tool to set up coordination topology
|
||||
- Choose: mesh, hierarchical, ring, or star
|
||||
- This creates a coordination framework for Claude Code's work
|
||||
|
||||
**Spawn agents:**
|
||||
|
||||
- Use `mcp__claude-flow__agent_spawn` tool to create specialized coordinators
|
||||
- Agent types represent different thinking patterns, not actual coders
|
||||
- They help Claude Code approach problems from different angles
|
||||
|
||||
**Orchestrate tasks:**
|
||||
|
||||
- Use `mcp__claude-flow__task_orchestrate` tool to coordinate complex workflows
|
||||
- This breaks down tasks for Claude Code to execute systematically
|
||||
- The agents don't write code - they coordinate Claude Code's actions
|
||||
|
||||
## Available MCP Tools for Coordination
|
||||
|
||||
### Coordination Tools:
|
||||
|
||||
- `mcp__claude-flow__swarm_init` - Set up coordination topology for Claude Code
|
||||
- `mcp__claude-flow__agent_spawn` - Create cognitive patterns to guide Claude Code
|
||||
- `mcp__claude-flow__task_orchestrate` - Break down and coordinate complex tasks
|
||||
|
||||
### Monitoring Tools:
|
||||
|
||||
- `mcp__claude-flow__swarm_status` - Monitor coordination effectiveness
|
||||
- `mcp__claude-flow__agent_list` - View active cognitive patterns
|
||||
- `mcp__claude-flow__agent_metrics` - Track coordination performance
|
||||
- `mcp__claude-flow__task_status` - Check workflow progress
|
||||
- `mcp__claude-flow__task_results` - Review coordination outcomes
|
||||
|
||||
### Memory & Neural Tools:
|
||||
|
||||
- `mcp__claude-flow__memory_usage` - Persistent memory across sessions
|
||||
- `mcp__claude-flow__neural_status` - Neural pattern effectiveness
|
||||
- `mcp__claude-flow__neural_train` - Improve coordination patterns
|
||||
- `mcp__claude-flow__neural_patterns` - Analyze thinking approaches
|
||||
|
||||
### GitHub Integration Tools (NEW!):
|
||||
|
||||
- `mcp__claude-flow__github_swarm` - Create specialized GitHub management swarms
|
||||
- `mcp__claude-flow__repo_analyze` - Deep repository analysis with AI
|
||||
- `mcp__claude-flow__pr_enhance` - AI-powered pull request improvements
|
||||
- `mcp__claude-flow__issue_triage` - Intelligent issue classification
|
||||
- `mcp__claude-flow__code_review` - Automated code review with swarms
|
||||
|
||||
### System Tools:
|
||||
|
||||
- `mcp__claude-flow__benchmark_run` - Measure coordination efficiency
|
||||
- `mcp__claude-flow__features_detect` - Available capabilities
|
||||
- `mcp__claude-flow__swarm_monitor` - Real-time coordination tracking
|
||||
|
||||
## Workflow Examples (Coordination-Focused)
|
||||
|
||||
### Research Coordination Example
|
||||
|
||||
**Context:** Claude Code needs to research a complex topic systematically
|
||||
|
||||
**Step 1:** Set up research coordination
|
||||
|
||||
- Tool: `mcp__claude-flow__swarm_init`
|
||||
- Parameters: `{"topology": "mesh", "maxAgents": 5, "strategy": "balanced"}`
|
||||
- Result: Creates a mesh topology for comprehensive exploration
|
||||
|
||||
**Step 2:** Define research perspectives
|
||||
|
||||
- Tool: `mcp__claude-flow__agent_spawn`
|
||||
- Parameters: `{"type": "researcher", "name": "Literature Review"}`
|
||||
- Tool: `mcp__claude-flow__agent_spawn`
|
||||
- Parameters: `{"type": "analyst", "name": "Data Analysis"}`
|
||||
- Result: Different cognitive patterns for Claude Code to use
|
||||
|
||||
**Step 3:** Coordinate research execution
|
||||
|
||||
- Tool: `mcp__claude-flow__task_orchestrate`
|
||||
- Parameters: `{"task": "Research neural architecture search papers", "strategy": "adaptive"}`
|
||||
- Result: Claude Code systematically searches, reads, and analyzes papers
|
||||
|
||||
**What Actually Happens:**
|
||||
|
||||
1. The swarm sets up a coordination framework
|
||||
2. Each agent MUST use Claude Flow hooks for coordination:
|
||||
- `npx claude-flow@alpha hooks pre-task` before starting
|
||||
- `npx claude-flow@alpha hooks post-edit` after each file operation
|
||||
- `npx claude-flow@alpha hooks notify` to share decisions
|
||||
3. Claude Code uses its native Read, WebSearch, and Task tools
|
||||
4. The swarm coordinates through shared memory and hooks
|
||||
5. Results are synthesized by Claude Code with full coordination history
|
||||
|
||||
### Development Coordination Example
|
||||
|
||||
**Context:** Claude Code needs to build a complex system with multiple components
|
||||
|
||||
**Step 1:** Set up development coordination
|
||||
|
||||
- Tool: `mcp__claude-flow__swarm_init`
|
||||
- Parameters: `{"topology": "hierarchical", "maxAgents": 8, "strategy": "specialized"}`
|
||||
- Result: Hierarchical structure for organized development
|
||||
|
||||
**Step 2:** Define development perspectives
|
||||
|
||||
- Tool: `mcp__claude-flow__agent_spawn`
|
||||
- Parameters: `{"type": "architect", "name": "System Design"}`
|
||||
- Result: Architectural thinking pattern for Claude Code
|
||||
|
||||
**Step 3:** Coordinate implementation
|
||||
|
||||
- Tool: `mcp__claude-flow__task_orchestrate`
|
||||
- Parameters: `{"task": "Implement user authentication with JWT", "strategy": "parallel"}`
|
||||
- Result: Claude Code implements features using its native tools
|
||||
|
||||
**What Actually Happens:**
|
||||
|
||||
1. The swarm creates a development coordination plan
|
||||
2. Each agent coordinates using mandatory hooks:
|
||||
- Pre-task hooks for context loading
|
||||
- Post-edit hooks for progress tracking
|
||||
- Memory storage for cross-agent coordination
|
||||
3. Claude Code uses Write, Edit, Bash tools for implementation
|
||||
4. Agents share progress through Claude Flow memory
|
||||
5. All code is written by Claude Code with full coordination
|
||||
|
||||
### GitHub Repository Management Example (NEW!)
|
||||
|
||||
**Context:** Claude Code needs to manage a complex GitHub repository
|
||||
|
||||
**Step 1:** Initialize GitHub swarm
|
||||
|
||||
- Tool: `mcp__claude-flow__github_swarm`
|
||||
- Parameters: `{"repository": "owner/repo", "agents": 5, "focus": "maintenance"}`
|
||||
- Result: Specialized swarm for repository management
|
||||
|
||||
**Step 2:** Analyze repository health
|
||||
|
||||
- Tool: `mcp__claude-flow__repo_analyze`
|
||||
- Parameters: `{"deep": true, "include": ["issues", "prs", "code"]}`
|
||||
- Result: Comprehensive repository analysis
|
||||
|
||||
**Step 3:** Enhance pull requests
|
||||
|
||||
- Tool: `mcp__claude-flow__pr_enhance`
|
||||
- Parameters: `{"pr_number": 123, "add_tests": true, "improve_docs": true}`
|
||||
- Result: AI-powered PR improvements
|
||||
|
||||
## Best Practices for Coordination
|
||||
|
||||
### ✅ DO:
|
||||
|
||||
- Use MCP tools to coordinate Claude Code's approach to complex tasks
|
||||
- Let the swarm break down problems into manageable pieces
|
||||
- Use memory tools to maintain context across sessions
|
||||
- Monitor coordination effectiveness with status tools
|
||||
- Train neural patterns for better coordination over time
|
||||
- Leverage GitHub tools for repository management
|
||||
|
||||
### ❌ DON'T:
|
||||
|
||||
- Expect agents to write code (Claude Code does all implementation)
|
||||
- Use MCP tools for file operations (use Claude Code's native tools)
|
||||
- Try to make agents execute bash commands (Claude Code handles this)
|
||||
- Confuse coordination with execution (MCP coordinates, Claude executes)
|
||||
|
||||
## Memory and Persistence
|
||||
|
||||
The swarm provides persistent memory that helps Claude Code:
|
||||
|
||||
- Remember project context across sessions
|
||||
- Track decisions and rationale
|
||||
- Maintain consistency in large projects
|
||||
- Learn from previous coordination patterns
|
||||
- Store GitHub workflow preferences
|
||||
|
||||
## Performance Benefits
|
||||
|
||||
When using Claude Flow coordination with Claude Code:
|
||||
|
||||
- **84.8% SWE-Bench solve rate** - Better problem-solving through coordination
|
||||
- **32.3% token reduction** - Efficient task breakdown reduces redundancy
|
||||
- **2.8-4.4x speed improvement** - Parallel coordination strategies
|
||||
- **27+ neural models** - Diverse cognitive approaches
|
||||
- **GitHub automation** - Streamlined repository management
|
||||
|
||||
## Claude Code Hooks Integration
|
||||
|
||||
Claude Flow includes powerful hooks that automate coordination:
|
||||
|
||||
### Pre-Operation Hooks
|
||||
|
||||
- **Auto-assign agents** before file edits based on file type
|
||||
- **Validate commands** before execution for safety
|
||||
- **Prepare resources** automatically for complex operations
|
||||
- **Optimize topology** based on task complexity analysis
|
||||
- **Cache searches** for improved performance
|
||||
- **GitHub context** loading for repository operations
|
||||
|
||||
### Post-Operation Hooks
|
||||
|
||||
- **Auto-format code** using language-specific formatters
|
||||
- **Train neural patterns** from successful operations
|
||||
- **Update memory** with operation context
|
||||
- **Analyze performance** and identify bottlenecks
|
||||
- **Track token usage** for efficiency metrics
|
||||
- **Sync GitHub** state for consistency
|
||||
|
||||
### Session Management
|
||||
|
||||
- **Generate summaries** at session end
|
||||
- **Persist state** across Claude Code sessions
|
||||
- **Track metrics** for continuous improvement
|
||||
- **Restore previous** session context automatically
|
||||
- **Export workflows** for reuse
|
||||
|
||||
### Advanced Features (v2.0.0!)
|
||||
|
||||
- **🚀 Automatic Topology Selection** - Optimal swarm structure for each task
|
||||
- **⚡ Parallel Execution** - 2.8-4.4x speed improvements
|
||||
- **🧠 Neural Training** - Continuous learning from operations
|
||||
- **📊 Bottleneck Analysis** - Real-time performance optimization
|
||||
- **🤖 Smart Auto-Spawning** - Zero manual agent management
|
||||
- **🛡️ Self-Healing Workflows** - Automatic error recovery
|
||||
- **💾 Cross-Session Memory** - Persistent learning & context
|
||||
- **🔗 GitHub Integration** - Repository-aware swarms
|
||||
|
||||
### Configuration
|
||||
|
||||
Hooks are pre-configured in `.claude/settings.json`. Key features:
|
||||
|
||||
- Automatic agent assignment for different file types
|
||||
- Code formatting on save
|
||||
- Neural pattern learning from edits
|
||||
- Session state persistence
|
||||
- Performance tracking and optimization
|
||||
- Intelligent caching and token reduction
|
||||
- GitHub workflow automation
|
||||
|
||||
See `.claude/commands/` for detailed documentation on all features.
|
||||
|
||||
## Integration Tips
|
||||
|
||||
1. **Start Simple**: Begin with basic swarm init and single agent
|
||||
2. **Scale Gradually**: Add more agents as task complexity increases
|
||||
3. **Use Memory**: Store important decisions and context
|
||||
4. **Monitor Progress**: Regular status checks ensure effective coordination
|
||||
5. **Train Patterns**: Let neural agents learn from successful coordinations
|
||||
6. **Enable Hooks**: Use the pre-configured hooks for automation
|
||||
7. **GitHub First**: Use GitHub tools for repository management
|
||||
|
||||
## 🧠 SWARM ORCHESTRATION PATTERN
|
||||
|
||||
### You are the SWARM ORCHESTRATOR. **IMMEDIATELY SPAWN AGENTS IN PARALLEL** to execute tasks
|
||||
|
||||
### 🚨 CRITICAL INSTRUCTION: You are the SWARM ORCHESTRATOR
|
||||
|
||||
**MANDATORY**: When using swarms, you MUST:
|
||||
|
||||
1. **SPAWN ALL AGENTS IN ONE BATCH** - Use multiple tool calls in a SINGLE message
|
||||
2. **EXECUTE TASKS IN PARALLEL** - Never wait for one task before starting another
|
||||
3. **USE BATCHTOOL FOR EVERYTHING** - Multiple operations = Single message with multiple tools
|
||||
4. **ALL AGENTS MUST USE COORDINATION TOOLS** - Every spawned agent MUST use claude-flow hooks and memory
|
||||
|
||||
### 🎯 AGENT COUNT CONFIGURATION
|
||||
|
||||
**CRITICAL: Dynamic Agent Count Rules**
|
||||
|
||||
1. **Check CLI Arguments First**: If user runs `npx claude-flow@alpha --agents 5`, use 5 agents
|
||||
2. **Auto-Decide if No Args**: Without CLI args, analyze task complexity:
|
||||
- Simple tasks (1-3 components): 3-4 agents
|
||||
- Medium tasks (4-6 components): 5-7 agents
|
||||
- Complex tasks (7+ components): 8-12 agents
|
||||
3. **Agent Type Distribution**: Balance agent types based on task:
|
||||
- Always include 1 coordinator
|
||||
- For code-heavy tasks: more coders
|
||||
- For design tasks: more architects/analysts
|
||||
- For quality tasks: more testers/reviewers
|
||||
|
||||
**Example Auto-Decision Logic:**
|
||||
|
||||
```javascript
|
||||
// If CLI args provided: npx claude-flow@alpha --agents 6
|
||||
maxAgents = CLI_ARGS.agents || determineAgentCount(task);
|
||||
|
||||
function determineAgentCount(task) {
|
||||
// Analyze task complexity
|
||||
if (task.includes(['API', 'database', 'auth', 'tests'])) return 8;
|
||||
if (task.includes(['frontend', 'backend'])) return 6;
|
||||
if (task.includes(['simple', 'script'])) return 3;
|
||||
return 5; // default
|
||||
}
|
||||
```
|
||||
|
||||
## 📋 MANDATORY AGENT COORDINATION PROTOCOL
|
||||
|
||||
### 🔴 CRITICAL: Every Agent MUST Follow This Protocol
|
||||
|
||||
When you spawn an agent using the Task tool, that agent MUST:
|
||||
|
||||
**1️⃣ BEFORE Starting Work:**
|
||||
|
||||
```bash
|
||||
# Check previous work and load context
|
||||
npx claude-flow@alpha hooks pre-task --description "[agent task]" --auto-spawn-agents false
|
||||
npx claude-flow@alpha hooks session-restore --session-id "swarm-[id]" --load-memory true
|
||||
```
|
||||
|
||||
**2️⃣ DURING Work (After EVERY Major Step):**
|
||||
|
||||
```bash
|
||||
# Store progress in memory after each file operation
|
||||
npx claude-flow@alpha hooks post-edit --file "[filepath]" --memory-key "swarm/[agent]/[step]"
|
||||
|
||||
# Store decisions and findings
|
||||
npx claude-flow@alpha hooks notify --message "[what was done]" --telemetry true
|
||||
|
||||
# Check coordination with other agents
|
||||
npx claude-flow@alpha hooks pre-search --query "[what to check]" --cache-results true
|
||||
```
|
||||
|
||||
**3️⃣ AFTER Completing Work:**
|
||||
|
||||
```bash
|
||||
# Save all results and learnings
|
||||
npx claude-flow@alpha hooks post-task --task-id "[task]" --analyze-performance true
|
||||
npx claude-flow@alpha hooks session-end --export-metrics true --generate-summary true
|
||||
```
|
||||
|
||||
### 🎯 AGENT PROMPT TEMPLATE
|
||||
|
||||
When spawning agents, ALWAYS include these coordination instructions:
|
||||
|
||||
```
|
||||
You are the [Agent Type] agent in a coordinated swarm.
|
||||
|
||||
MANDATORY COORDINATION:
|
||||
1. START: Run `npx claude-flow@alpha hooks pre-task --description "[your task]"`
|
||||
2. DURING: After EVERY file operation, run `npx claude-flow@alpha hooks post-edit --file "[file]" --memory-key "agent/[step]"`
|
||||
3. MEMORY: Store ALL decisions using `npx claude-flow@alpha hooks notify --message "[decision]"`
|
||||
4. END: Run `npx claude-flow@alpha hooks post-task --task-id "[task]" --analyze-performance true`
|
||||
|
||||
Your specific task: [detailed task description]
|
||||
|
||||
REMEMBER: Coordinate with other agents by checking memory BEFORE making decisions!
|
||||
```
|
||||
|
||||
### ⚡ PARALLEL EXECUTION IS MANDATORY
|
||||
|
||||
**THIS IS WRONG ❌ (Sequential - NEVER DO THIS):**
|
||||
|
||||
```
|
||||
Message 1: Initialize swarm
|
||||
Message 2: Spawn agent 1
|
||||
Message 3: Spawn agent 2
|
||||
Message 4: TodoWrite (single todo)
|
||||
Message 5: Create file 1
|
||||
Message 6: TodoWrite (another single todo)
|
||||
```
|
||||
|
||||
**THIS IS CORRECT ✅ (Parallel - ALWAYS DO THIS):**
|
||||
|
||||
```
|
||||
Message 1: [BatchTool]
|
||||
// MCP coordination setup
|
||||
- mcp__claude-flow__swarm_init
|
||||
- mcp__claude-flow__agent_spawn (researcher)
|
||||
- mcp__claude-flow__agent_spawn (coder)
|
||||
- mcp__claude-flow__agent_spawn (analyst)
|
||||
- mcp__claude-flow__agent_spawn (tester)
|
||||
- mcp__claude-flow__agent_spawn (coordinator)
|
||||
|
||||
Message 2: [BatchTool - Claude Code execution]
|
||||
// Task agents with full coordination instructions
|
||||
- Task("You are researcher agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Research API patterns")
|
||||
- Task("You are coder agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Implement REST endpoints")
|
||||
- Task("You are analyst agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Analyze performance")
|
||||
- Task("You are tester agent. MANDATORY: Run hooks pre-task, post-edit, post-task. Task: Write comprehensive tests")
|
||||
|
||||
// TodoWrite with ALL todos batched
|
||||
- TodoWrite { todos: [
|
||||
{id: "research", content: "Research API patterns", status: "in_progress", priority: "high"},
|
||||
{id: "design", content: "Design database schema", status: "pending", priority: "high"},
|
||||
{id: "implement", content: "Build REST endpoints", status: "pending", priority: "high"},
|
||||
{id: "test", content: "Write unit tests", status: "pending", priority: "medium"},
|
||||
{id: "docs", content: "Create API documentation", status: "pending", priority: "low"},
|
||||
{id: "deploy", content: "Setup deployment", status: "pending", priority: "medium"}
|
||||
]}
|
||||
|
||||
// File operations in parallel
|
||||
- Write "api/package.json"
|
||||
- Write "api/server.js"
|
||||
- Write "api/routes/users.js"
|
||||
- Bash "mkdir -p api/{routes,models,tests}"
|
||||
```
|
||||
|
||||
### 🎯 MANDATORY SWARM PATTERN
|
||||
|
||||
When given ANY complex task with swarms:
|
||||
|
||||
```
|
||||
STEP 1: IMMEDIATE PARALLEL SPAWN (Single Message!)
|
||||
[BatchTool]:
|
||||
// IMPORTANT: Check CLI args for agent count, otherwise auto-decide based on task complexity
|
||||
- mcp__claude-flow__swarm_init {
|
||||
topology: "hierarchical",
|
||||
maxAgents: CLI_ARGS.agents || AUTO_DECIDE(task_complexity), // Use CLI args or auto-decide
|
||||
strategy: "parallel"
|
||||
}
|
||||
|
||||
// Spawn agents based on maxAgents count and task requirements
|
||||
// If CLI specifies 3 agents, spawn 3. If no args, auto-decide optimal count (3-12)
|
||||
- mcp__claude-flow__agent_spawn { type: "architect", name: "System Designer" }
|
||||
- mcp__claude-flow__agent_spawn { type: "coder", name: "API Developer" }
|
||||
- mcp__claude-flow__agent_spawn { type: "coder", name: "Frontend Dev" }
|
||||
- mcp__claude-flow__agent_spawn { type: "analyst", name: "DB Designer" }
|
||||
- mcp__claude-flow__agent_spawn { type: "tester", name: "QA Engineer" }
|
||||
- mcp__claude-flow__agent_spawn { type: "researcher", name: "Tech Lead" }
|
||||
- mcp__claude-flow__agent_spawn { type: "coordinator", name: "PM" }
|
||||
- TodoWrite { todos: [multiple todos at once] }
|
||||
|
||||
STEP 2: PARALLEL TASK EXECUTION (Single Message!)
|
||||
[BatchTool]:
|
||||
- mcp__claude-flow__task_orchestrate { task: "main task", strategy: "parallel" }
|
||||
- mcp__claude-flow__memory_usage { action: "store", key: "init", value: {...} }
|
||||
- Multiple Read operations
|
||||
- Multiple Write operations
|
||||
- Multiple Bash commands
|
||||
|
||||
STEP 3: CONTINUE PARALLEL WORK (Never Sequential!)
|
||||
```
|
||||
|
||||
### 📊 VISUAL TASK TRACKING FORMAT
|
||||
|
||||
Use this format when displaying task progress:
|
||||
|
||||
```
|
||||
📊 Progress Overview
|
||||
├── Total Tasks: X
|
||||
├── ✅ Completed: X (X%)
|
||||
├── 🔄 In Progress: X (X%)
|
||||
├── ⭕ Todo: X (X%)
|
||||
└── ❌ Blocked: X (X%)
|
||||
|
||||
📋 Todo (X)
|
||||
└── 🔴 001: [Task description] [PRIORITY] ▶
|
||||
|
||||
🔄 In progress (X)
|
||||
├── 🟡 002: [Task description] ↳ X deps ▶
|
||||
└── 🔴 003: [Task description] [PRIORITY] ▶
|
||||
|
||||
✅ Completed (X)
|
||||
├── ✅ 004: [Task description]
|
||||
└── ... (more completed tasks)
|
||||
|
||||
Priority indicators: 🔴 HIGH/CRITICAL, 🟡 MEDIUM, 🟢 LOW
|
||||
Dependencies: ↳ X deps | Actionable: ▶
|
||||
```
|
||||
|
||||
### 🎯 REAL EXAMPLE: Full-Stack App Development
|
||||
|
||||
**Task**: "Build a complete REST API with authentication, database, and tests"
|
||||
|
||||
**🚨 MANDATORY APPROACH - Everything in Parallel:**
|
||||
|
||||
```javascript
|
||||
// ✅ CORRECT: SINGLE MESSAGE with ALL operations
|
||||
[BatchTool - Message 1]:
|
||||
// Initialize and spawn ALL agents at once
|
||||
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 8, strategy: "parallel" }
|
||||
mcp__claude-flow__agent_spawn { type: "architect", name: "System Designer" }
|
||||
mcp__claude-flow__agent_spawn { type: "coder", name: "API Developer" }
|
||||
mcp__claude-flow__agent_spawn { type: "coder", name: "Auth Expert" }
|
||||
mcp__claude-flow__agent_spawn { type: "analyst", name: "DB Designer" }
|
||||
mcp__claude-flow__agent_spawn { type: "tester", name: "Test Engineer" }
|
||||
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Lead" }
|
||||
|
||||
// Update ALL todos at once - NEVER split todos!
|
||||
TodoWrite { todos: [
|
||||
{ id: "design", content: "Design API architecture", status: "in_progress", priority: "high" },
|
||||
{ id: "auth", content: "Implement authentication", status: "pending", priority: "high" },
|
||||
{ id: "db", content: "Design database schema", status: "pending", priority: "high" },
|
||||
{ id: "api", content: "Build REST endpoints", status: "pending", priority: "high" },
|
||||
{ id: "tests", content: "Write comprehensive tests", status: "pending", priority: "medium" },
|
||||
{ id: "docs", content: "Document API endpoints", status: "pending", priority: "low" },
|
||||
{ id: "deploy", content: "Setup deployment pipeline", status: "pending", priority: "medium" },
|
||||
{ id: "monitor", content: "Add monitoring", status: "pending", priority: "medium" }
|
||||
]}
|
||||
|
||||
// Start orchestration
|
||||
mcp__claude-flow__task_orchestrate { task: "Build REST API", strategy: "parallel" }
|
||||
|
||||
// Store initial memory
|
||||
mcp__claude-flow__memory_usage { action: "store", key: "project/init", value: { started: Date.now() } }
|
||||
|
||||
[BatchTool - Message 2]:
|
||||
// Create ALL directories at once
|
||||
Bash("mkdir -p test-app/{src,tests,docs,config}")
|
||||
Bash("mkdir -p test-app/src/{models,routes,middleware,services}")
|
||||
Bash("mkdir -p test-app/tests/{unit,integration}")
|
||||
|
||||
// Write ALL base files at once
|
||||
Write("test-app/package.json", packageJsonContent)
|
||||
Write("test-app/.env.example", envContent)
|
||||
Write("test-app/README.md", readmeContent)
|
||||
Write("test-app/src/server.js", serverContent)
|
||||
Write("test-app/src/config/database.js", dbConfigContent)
|
||||
|
||||
[BatchTool - Message 3]:
|
||||
// Read multiple files for context
|
||||
Read("test-app/package.json")
|
||||
Read("test-app/src/server.js")
|
||||
Read("test-app/.env.example")
|
||||
|
||||
// Run multiple commands
|
||||
Bash("cd test-app && npm install")
|
||||
Bash("cd test-app && npm run lint")
|
||||
Bash("cd test-app && npm test")
|
||||
```
|
||||
|
||||
### 🚫 NEVER DO THIS (Sequential = WRONG):
|
||||
|
||||
```javascript
|
||||
// ❌ WRONG: Multiple messages, one operation each
|
||||
Message 1: mcp__claude-flow__swarm_init
|
||||
Message 2: mcp__claude-flow__agent_spawn (just one agent)
|
||||
Message 3: mcp__claude-flow__agent_spawn (another agent)
|
||||
Message 4: TodoWrite (single todo)
|
||||
Message 5: Write (single file)
|
||||
// This is 5x slower and wastes swarm coordination!
|
||||
```
|
||||
|
||||
### 🔄 MEMORY COORDINATION PATTERN
|
||||
|
||||
Every agent coordination step MUST use memory:
|
||||
|
||||
```
|
||||
// After each major decision or implementation
|
||||
mcp__claude-flow__memory_usage
|
||||
action: "store"
|
||||
key: "swarm-{id}/agent-{name}/{step}"
|
||||
value: {
|
||||
timestamp: Date.now(),
|
||||
decision: "what was decided",
|
||||
implementation: "what was built",
|
||||
nextSteps: ["step1", "step2"],
|
||||
dependencies: ["dep1", "dep2"]
|
||||
}
|
||||
|
||||
// To retrieve coordination data
|
||||
mcp__claude-flow__memory_usage
|
||||
action: "retrieve"
|
||||
key: "swarm-{id}/agent-{name}/{step}"
|
||||
|
||||
// To check all swarm progress
|
||||
mcp__claude-flow__memory_usage
|
||||
action: "list"
|
||||
pattern: "swarm-{id}/*"
|
||||
```
|
||||
|
||||
### ⚡ PERFORMANCE TIPS
|
||||
|
||||
1. **Batch Everything**: Never operate on single files when multiple are needed
|
||||
2. **Parallel First**: Always think "what can run simultaneously?"
|
||||
3. **Memory is Key**: Use memory for ALL cross-agent coordination
|
||||
4. **Monitor Progress**: Use mcp**claude-flow**swarm_monitor for real-time tracking
|
||||
5. **Auto-Optimize**: Let hooks handle topology and agent selection
|
||||
|
||||
### 🎨 VISUAL SWARM STATUS
|
||||
|
||||
When showing swarm status, use this format:
|
||||
|
||||
```
|
||||
🐝 Swarm Status: ACTIVE
|
||||
├── 🏗️ Topology: hierarchical
|
||||
├── 👥 Agents: 6/8 active
|
||||
├── ⚡ Mode: parallel execution
|
||||
├── 📊 Tasks: 12 total (4 complete, 6 in-progress, 2 pending)
|
||||
└── 🧠 Memory: 15 coordination points stored
|
||||
|
||||
Agent Activity:
|
||||
├── 🟢 architect: Designing database schema...
|
||||
├── 🟢 coder-1: Implementing auth endpoints...
|
||||
├── 🟢 coder-2: Building user CRUD operations...
|
||||
├── 🟢 analyst: Optimizing query performance...
|
||||
├── 🟡 tester: Waiting for auth completion...
|
||||
└── 🟢 coordinator: Monitoring progress...
|
||||
```
|
||||
|
||||
## 📝 CRITICAL: TODOWRITE AND TASK TOOL BATCHING
|
||||
|
||||
### 🚨 MANDATORY BATCHING RULES FOR TODOS AND TASKS
|
||||
|
||||
**TodoWrite Tool Requirements:**
|
||||
|
||||
1. **ALWAYS** include 5-10+ todos in a SINGLE TodoWrite call
|
||||
2. **NEVER** call TodoWrite multiple times in sequence
|
||||
3. **BATCH** all todo updates together - status changes, new todos, completions
|
||||
4. **INCLUDE** all priority levels (high, medium, low) in one call
|
||||
|
||||
**Task Tool Requirements:**
|
||||
|
||||
1. **SPAWN** all agents using Task tool in ONE message
|
||||
2. **NEVER** spawn agents one by one across multiple messages
|
||||
3. **INCLUDE** full task descriptions and coordination instructions
|
||||
4. **BATCH** related Task calls together for parallel execution
|
||||
|
||||
**Example of CORRECT TodoWrite usage:**
|
||||
|
||||
```javascript
|
||||
// ✅ CORRECT - All todos in ONE call
|
||||
TodoWrite { todos: [
|
||||
{ id: "1", content: "Initialize system", status: "completed", priority: "high" },
|
||||
{ id: "2", content: "Analyze requirements", status: "in_progress", priority: "high" },
|
||||
{ id: "3", content: "Design architecture", status: "pending", priority: "high" },
|
||||
{ id: "4", content: "Implement core", status: "pending", priority: "high" },
|
||||
{ id: "5", content: "Build features", status: "pending", priority: "medium" },
|
||||
{ id: "6", content: "Write tests", status: "pending", priority: "medium" },
|
||||
{ id: "7", content: "Add monitoring", status: "pending", priority: "medium" },
|
||||
{ id: "8", content: "Documentation", status: "pending", priority: "low" },
|
||||
{ id: "9", content: "Performance tuning", status: "pending", priority: "low" },
|
||||
{ id: "10", content: "Deploy to production", status: "pending", priority: "high" }
|
||||
]}
|
||||
```
|
||||
|
||||
**Example of WRONG TodoWrite usage:**
|
||||
|
||||
```javascript
|
||||
// ❌ WRONG - Multiple TodoWrite calls
|
||||
Message 1: TodoWrite { todos: [{ id: "1", content: "Task 1", ... }] }
|
||||
Message 2: TodoWrite { todos: [{ id: "2", content: "Task 2", ... }] }
|
||||
Message 3: TodoWrite { todos: [{ id: "3", content: "Task 3", ... }] }
|
||||
// This breaks parallel coordination!
|
||||
```
|
||||
|
||||
## Claude Flow v2.0.0 Features
|
||||
|
||||
Claude Flow extends the base coordination with:
|
||||
|
||||
- **🔗 GitHub Integration** - Deep repository management
|
||||
- **🎯 Project Templates** - Quick-start for common projects
|
||||
- **📊 Advanced Analytics** - Detailed performance insights
|
||||
- **🤖 Custom Agent Types** - Domain-specific coordinators
|
||||
- **🔄 Workflow Automation** - Reusable task sequences
|
||||
- **🛡️ Enhanced Security** - Safer command execution
|
||||
|
||||
## Support
|
||||
|
||||
- Documentation: https://github.com/ruvnet/claude-flow
|
||||
- Issues: https://github.com/ruvnet/claude-flow/issues
|
||||
- Examples: https://github.com/ruvnet/claude-flow/tree/main/examples
|
||||
|
||||
---
|
||||
|
||||
Remember: **Claude Flow coordinates, Claude Code creates!** Start with `mcp__claude-flow__swarm_init` to enhance your development workflow.
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"scope": "system",
|
||||
"target": "all",
|
||||
"bottlenecks": [
|
||||
{
|
||||
"severity": "good",
|
||||
"component": "Overall system",
|
||||
"metric": "No bottlenecks detected"
|
||||
}
|
||||
],
|
||||
"recommendations": [],
|
||||
"analysisDuration": 243.250749,
|
||||
"confidenceScore": 0.85,
|
||||
"issuesDetected": 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"scope": "system",
|
||||
"target": "all",
|
||||
"bottlenecks": [
|
||||
{
|
||||
"severity": "good",
|
||||
"component": "Overall system",
|
||||
"metric": "No bottlenecks detected"
|
||||
}
|
||||
],
|
||||
"recommendations": [],
|
||||
"analysisDuration": 247.021768,
|
||||
"confidenceScore": 0.85,
|
||||
"issuesDetected": 0
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Claude Flow Performance Report - 2025-07-30T16:43:38.554Z</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; background: #f5f5f5; }
|
||||
.container { max-width: 1200px; margin: 0 auto; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
||||
h1, h2 { color: #333; }
|
||||
.metric { display: inline-block; margin: 10px 20px 10px 0; }
|
||||
.metric-label { color: #666; font-size: 14px; }
|
||||
.metric-value { font-size: 24px; font-weight: bold; color: #2196F3; }
|
||||
.trend { font-size: 14px; margin-left: 10px; }
|
||||
.trend.positive { color: #4CAF50; }
|
||||
.trend.negative { color: #F44336; }
|
||||
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
|
||||
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
|
||||
th { background: #f5f5f5; font-weight: bold; }
|
||||
.chart { margin: 20px 0; height: 300px; background: #fafafa; border: 1px solid #ddd; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #999; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Claude Flow Performance Report</h1>
|
||||
<p>Generated: 2025-07-30T16:43:38.554Z | Timeframe: 24h</p>
|
||||
|
||||
<h2>Summary Metrics</h2>
|
||||
<div class="metrics">
|
||||
<div class="metric">
|
||||
<div class="metric-label">Total Tasks</div>
|
||||
<div class="metric-value">0</div>
|
||||
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Success Rate</div>
|
||||
<div class="metric-value">0.0%</div>
|
||||
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Avg Duration</div>
|
||||
<div class="metric-value">0.0s</div>
|
||||
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Memory Efficiency</div>
|
||||
<div class="metric-value">90%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Agent Performance</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Agent Type</th>
|
||||
<th>Total Actions</th>
|
||||
<th>Success Rate</th>
|
||||
<th>Avg Duration</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>researcher</td>
|
||||
<td>1</td>
|
||||
<td>100.0%</td>
|
||||
<td>0.0s</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Performance Trends</h2>
|
||||
<div class="chart">
|
||||
<p>Interactive charts would be displayed here</p>
|
||||
</div>
|
||||
|
||||
<h2>Recent Tasks</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Task ID</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>Duration</th>
|
||||
<th>Timestamp</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,109 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Claude Flow Performance Report - 2025-07-30T16:58:26.188Z</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; background: #f5f5f5; }
|
||||
.container { max-width: 1200px; margin: 0 auto; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
||||
h1, h2 { color: #333; }
|
||||
.metric { display: inline-block; margin: 10px 20px 10px 0; }
|
||||
.metric-label { color: #666; font-size: 14px; }
|
||||
.metric-value { font-size: 24px; font-weight: bold; color: #2196F3; }
|
||||
.trend { font-size: 14px; margin-left: 10px; }
|
||||
.trend.positive { color: #4CAF50; }
|
||||
.trend.negative { color: #F44336; }
|
||||
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
|
||||
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
|
||||
th { background: #f5f5f5; font-weight: bold; }
|
||||
.chart { margin: 20px 0; height: 300px; background: #fafafa; border: 1px solid #ddd; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #999; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Claude Flow Performance Report</h1>
|
||||
<p>Generated: 2025-07-30T16:58:26.188Z | Timeframe: 24h</p>
|
||||
|
||||
<h2>Summary Metrics</h2>
|
||||
<div class="metrics">
|
||||
<div class="metric">
|
||||
<div class="metric-label">Total Tasks</div>
|
||||
<div class="metric-value">2</div>
|
||||
<span class="trend positive">+2</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Success Rate</div>
|
||||
<div class="metric-value">100.0%</div>
|
||||
<span class="trend positive">+100.0%</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Avg Duration</div>
|
||||
<div class="metric-value">0.0s</div>
|
||||
<span class="trend negative">+0.0s</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Memory Efficiency</div>
|
||||
<div class="metric-value">90%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Agent Performance</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Agent Type</th>
|
||||
<th>Total Actions</th>
|
||||
<th>Success Rate</th>
|
||||
<th>Avg Duration</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>researcher</td>
|
||||
<td>1</td>
|
||||
<td>100.0%</td>
|
||||
<td>0.0s</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Performance Trends</h2>
|
||||
<div class="chart">
|
||||
<p>Interactive charts would be displayed here</p>
|
||||
</div>
|
||||
|
||||
<h2>Recent Tasks</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Task ID</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>Duration</th>
|
||||
<th>Timestamp</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>cmd-analysis-1753893960795</td>
|
||||
<td>analysis</td>
|
||||
<td>✅ Success</td>
|
||||
<td>0.01s</td>
|
||||
<td>7/30/2025, 4:46:00 PM</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>cmd-analysis-1753893818543</td>
|
||||
<td>analysis</td>
|
||||
<td>✅ Success</td>
|
||||
<td>0.01s</td>
|
||||
<td>7/30/2025, 4:43:38 PM</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,117 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Claude Flow Performance Report - 2025-07-30T17:01:43.268Z</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; background: #f5f5f5; }
|
||||
.container { max-width: 1200px; margin: 0 auto; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
||||
h1, h2 { color: #333; }
|
||||
.metric { display: inline-block; margin: 10px 20px 10px 0; }
|
||||
.metric-label { color: #666; font-size: 14px; }
|
||||
.metric-value { font-size: 24px; font-weight: bold; color: #2196F3; }
|
||||
.trend { font-size: 14px; margin-left: 10px; }
|
||||
.trend.positive { color: #4CAF50; }
|
||||
.trend.negative { color: #F44336; }
|
||||
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
|
||||
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }
|
||||
th { background: #f5f5f5; font-weight: bold; }
|
||||
.chart { margin: 20px 0; height: 300px; background: #fafafa; border: 1px solid #ddd; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #999; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Claude Flow Performance Report</h1>
|
||||
<p>Generated: 2025-07-30T17:01:43.268Z | Timeframe: 24h</p>
|
||||
|
||||
<h2>Summary Metrics</h2>
|
||||
<div class="metrics">
|
||||
<div class="metric">
|
||||
<div class="metric-label">Total Tasks</div>
|
||||
<div class="metric-value">3</div>
|
||||
<span class="trend positive">+3</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Success Rate</div>
|
||||
<div class="metric-value">100.0%</div>
|
||||
<span class="trend positive">+100.0%</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Avg Duration</div>
|
||||
<div class="metric-value">0.0s</div>
|
||||
<span class="trend negative">+0.0s</span>
|
||||
</div>
|
||||
<div class="metric">
|
||||
<div class="metric-label">Memory Efficiency</div>
|
||||
<div class="metric-value">89%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Agent Performance</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Agent Type</th>
|
||||
<th>Total Actions</th>
|
||||
<th>Success Rate</th>
|
||||
<th>Avg Duration</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>researcher</td>
|
||||
<td>1</td>
|
||||
<td>100.0%</td>
|
||||
<td>0.0s</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Performance Trends</h2>
|
||||
<div class="chart">
|
||||
<p>Interactive charts would be displayed here</p>
|
||||
</div>
|
||||
|
||||
<h2>Recent Tasks</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Task ID</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>Duration</th>
|
||||
<th>Timestamp</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>cmd-analysis-1753894706177</td>
|
||||
<td>analysis</td>
|
||||
<td>✅ Success</td>
|
||||
<td>0.03s</td>
|
||||
<td>7/30/2025, 4:58:26 PM</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>cmd-analysis-1753893960795</td>
|
||||
<td>analysis</td>
|
||||
<td>✅ Success</td>
|
||||
<td>0.01s</td>
|
||||
<td>7/30/2025, 4:46:00 PM</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>cmd-analysis-1753893818543</td>
|
||||
<td>analysis</td>
|
||||
<td>✅ Success</td>
|
||||
<td>0.01s</td>
|
||||
<td>7/30/2025, 4:43:38 PM</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
Timestamp,Agent,Input Tokens,Output Tokens,Total Tokens,Cost\n2025-07-30T16:29:03.804Z,coordinator,25458,16972,42430,$0.3310\n2025-07-30T16:29:03.804Z,developer,41379,27586,68965,$0.5379\n2025-07-30T16:29:03.804Z,researcher,17240,11494,28734,$0.2241\n2025-07-30T16:29:03.804Z,analyzer,9663,6442,16105,$0.1256\n
|
||||
|
+73
-32
@@ -1,40 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
# Claude-Flow local wrapper
|
||||
# This script ensures claude-flow runs from your project directory
|
||||
#!/usr/bin/env node
|
||||
|
||||
# Save the current directory
|
||||
PROJECT_DIR="${PWD}"
|
||||
/**
|
||||
* Claude Flow CLI - Universal Wrapper
|
||||
* Works in both CommonJS and ES Module projects
|
||||
*/
|
||||
|
||||
# Set environment to ensure correct working directory
|
||||
export PWD="${PROJECT_DIR}"
|
||||
export CLAUDE_WORKING_DIR="${PROJECT_DIR}"
|
||||
// Use dynamic import to work in both CommonJS and ES modules
|
||||
(async () => {
|
||||
const { spawn } = await import('child_process');
|
||||
const { resolve } = await import('path');
|
||||
const { fileURLToPath } = await import('url');
|
||||
|
||||
# Try to find claude-flow binary
|
||||
# Check common locations for npm/npx installations
|
||||
// Detect if we're running in ES module context
|
||||
let __dirname;
|
||||
try {
|
||||
// Check if import.meta is available (ES modules)
|
||||
if (typeof import.meta !== 'undefined' && import.meta.url) {
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
__dirname = resolve(__filename, '..');
|
||||
} else {
|
||||
// Fallback for CommonJS
|
||||
__dirname = process.cwd();
|
||||
}
|
||||
} catch {
|
||||
// Fallback for CommonJS
|
||||
__dirname = process.cwd();
|
||||
}
|
||||
|
||||
# Development mode - use local bin
|
||||
if [ -f "/workspaces/claude-code-flow/bin/claude-flow" ]; then
|
||||
cd "${PROJECT_DIR}"
|
||||
exec "/workspaces/claude-code-flow/bin/claude-flow" "$@"
|
||||
fi
|
||||
// Try multiple strategies to find claude-flow
|
||||
const strategies = [
|
||||
// 1. Local node_modules
|
||||
async () => {
|
||||
try {
|
||||
const localPath = resolve(process.cwd(), 'node_modules/.bin/claude-flow');
|
||||
const { existsSync } = await import('fs');
|
||||
if (existsSync(localPath)) {
|
||||
return spawn(localPath, process.argv.slice(2), { stdio: 'inherit' });
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
|
||||
# 1. Local node_modules (npm install claude-flow)
|
||||
if [ -f "${PROJECT_DIR}/node_modules/.bin/claude-flow" ]; then
|
||||
cd "${PROJECT_DIR}"
|
||||
exec "${PROJECT_DIR}/node_modules/.bin/claude-flow" "$@"
|
||||
// 2. Parent node_modules (monorepo)
|
||||
async () => {
|
||||
try {
|
||||
const parentPath = resolve(process.cwd(), '../node_modules/.bin/claude-flow');
|
||||
const { existsSync } = await import('fs');
|
||||
if (existsSync(parentPath)) {
|
||||
return spawn(parentPath, process.argv.slice(2), { stdio: 'inherit' });
|
||||
}
|
||||
} catch {}
|
||||
},
|
||||
|
||||
# 2. Parent directory node_modules (monorepo setup)
|
||||
elif [ -f "${PROJECT_DIR}/../node_modules/.bin/claude-flow" ]; then
|
||||
cd "${PROJECT_DIR}"
|
||||
exec "${PROJECT_DIR}/../node_modules/.bin/claude-flow" "$@"
|
||||
// 3. NPX with latest alpha version (prioritized over global)
|
||||
async () => {
|
||||
return spawn('npx', ['claude-flow@alpha', ...process.argv.slice(2)], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
},
|
||||
];
|
||||
|
||||
# 3. Global installation (npm install -g claude-flow)
|
||||
elif command -v claude-flow &> /dev/null; then
|
||||
cd "${PROJECT_DIR}"
|
||||
exec claude-flow "$@"
|
||||
// Try each strategy
|
||||
for (const strategy of strategies) {
|
||||
try {
|
||||
const child = await strategy();
|
||||
if (child) {
|
||||
child.on('exit', (code) => process.exit(code || 0));
|
||||
child.on('error', (err) => {
|
||||
if (err.code !== 'ENOENT') {
|
||||
console.error('Error:', err);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
# 4. Fallback to npx (will download if needed)
|
||||
else
|
||||
cd "${PROJECT_DIR}"
|
||||
exec npx claude-flow@latest "$@"
|
||||
fi
|
||||
console.error('Could not find claude-flow. Please install it with: npm install claude-flow');
|
||||
process.exit(1);
|
||||
})();
|
||||
@@ -28,4 +28,4 @@ memory/agents/
|
||||
5. **Cleanup**: Remove directories for terminated agents periodically
|
||||
|
||||
## Last Updated
|
||||
2025-07-17T14:37:54.520Z
|
||||
2025-07-30T22:22:25.440Z
|
||||
@@ -29,4 +29,4 @@ memory/sessions/
|
||||
5. **State Preservation**: Snapshot coordination state regularly
|
||||
|
||||
## Last Updated
|
||||
2025-07-17T14:37:54.521Z
|
||||
2025-07-30T22:22:25.441Z
|
||||
@@ -311,7 +311,7 @@ async function copyHelperScripts(templatesDir, targetDir, options, results) {
|
||||
await fs.mkdir(helpersDir, { recursive: true });
|
||||
}
|
||||
|
||||
const helpers = ['setup-mcp.sh', 'quick-start.sh', 'github-setup.sh', 'github-safe.js'];
|
||||
const helpers = ['setup-mcp.sh', 'quick-start.sh', 'github-setup.sh', 'github-safe.js', 'checkpoint-manager.sh', 'standard-checkpoint-hooks.sh'];
|
||||
const { createHelperScript } = await import('./templates/enhanced-templates.js');
|
||||
|
||||
for (const helper of helpers) {
|
||||
|
||||
@@ -1602,6 +1602,186 @@ case "$1" in
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
`,
|
||||
'standard-checkpoint-hooks.sh': `#!/bin/bash
|
||||
# Standard checkpoint hook functions for Claude settings.json (without GitHub features)
|
||||
|
||||
# Function to handle pre-edit checkpoints
|
||||
pre_edit_checkpoint() {
|
||||
local tool_input="$1"
|
||||
local file=$(echo "$tool_input" | jq -r '.file_path // empty')
|
||||
|
||||
if [ -n "$file" ]; then
|
||||
local checkpoint_branch="checkpoint/pre-edit-$(date +%Y%m%d-%H%M%S)"
|
||||
local current_branch=$(git branch --show-current)
|
||||
|
||||
# Create checkpoint
|
||||
git add -A
|
||||
git stash push -m "Pre-edit checkpoint for $file" >/dev/null 2>&1
|
||||
git branch "$checkpoint_branch"
|
||||
|
||||
# Store metadata
|
||||
mkdir -p .claude/checkpoints
|
||||
cat > ".claude/checkpoints/$(date +%s).json" <<EOF
|
||||
{
|
||||
"branch": "$checkpoint_branch",
|
||||
"file": "$file",
|
||||
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"type": "pre-edit",
|
||||
"original_branch": "$current_branch"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Restore working directory
|
||||
git stash pop --quiet >/dev/null 2>&1 || true
|
||||
|
||||
echo "✅ Created checkpoint: $checkpoint_branch for $file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to handle post-edit checkpoints
|
||||
post_edit_checkpoint() {
|
||||
local tool_input="$1"
|
||||
local file=$(echo "$tool_input" | jq -r '.file_path // empty')
|
||||
|
||||
if [ -n "$file" ] && [ -f "$file" ]; then
|
||||
# Check if file was modified - first check if file is tracked
|
||||
if ! git ls-files --error-unmatch "$file" >/dev/null 2>&1; then
|
||||
# File is not tracked, add it first
|
||||
git add "$file"
|
||||
fi
|
||||
|
||||
# Now check if there are changes
|
||||
if git diff --cached --quiet "$file" 2>/dev/null && git diff --quiet "$file" 2>/dev/null; then
|
||||
echo "ℹ️ No changes to checkpoint for $file"
|
||||
else
|
||||
local tag_name="checkpoint-$(date +%Y%m%d-%H%M%S)"
|
||||
local current_branch=$(git branch --show-current)
|
||||
|
||||
# Create commit
|
||||
git add "$file"
|
||||
if git commit -m "🔖 Checkpoint: Edit $file
|
||||
|
||||
Automatic checkpoint created by Claude
|
||||
- File: $file
|
||||
- Branch: $current_branch
|
||||
- Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
|
||||
[Auto-checkpoint]" --quiet; then
|
||||
# Create tag only if commit succeeded
|
||||
git tag -a "$tag_name" -m "Checkpoint after editing $file"
|
||||
|
||||
# Store metadata
|
||||
mkdir -p .claude/checkpoints
|
||||
local diff_stats=$(git diff HEAD~1 --stat | tr '\\n' ' ' | sed 's/"/\\"/g')
|
||||
cat > ".claude/checkpoints/$(date +%s).json" <<EOF
|
||||
{
|
||||
"tag": "$tag_name",
|
||||
"file": "$file",
|
||||
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"type": "post-edit",
|
||||
"branch": "$current_branch",
|
||||
"diff_summary": "$diff_stats"
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "✅ Created checkpoint: $tag_name for $file"
|
||||
else
|
||||
echo "ℹ️ No commit created (no changes or commit failed)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to handle task checkpoints
|
||||
task_checkpoint() {
|
||||
local user_prompt="$1"
|
||||
local task=$(echo "$user_prompt" | head -c 100 | tr '\\n' ' ')
|
||||
|
||||
if [ -n "$task" ]; then
|
||||
local checkpoint_name="task-$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
# Commit current state
|
||||
git add -A
|
||||
git commit -m "🔖 Task checkpoint: $task..." --quiet || true
|
||||
|
||||
# Store metadata
|
||||
mkdir -p .claude/checkpoints
|
||||
cat > ".claude/checkpoints/task-$(date +%s).json" <<EOF
|
||||
{
|
||||
"checkpoint": "$checkpoint_name",
|
||||
"task": "$task",
|
||||
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"commit": "$(git rev-parse HEAD)"
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "✅ Created task checkpoint: $checkpoint_name"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to handle session end
|
||||
session_end_checkpoint() {
|
||||
local session_id="session-$(date +%Y%m%d-%H%M%S)"
|
||||
local summary_file=".claude/checkpoints/summary-$session_id.md"
|
||||
|
||||
mkdir -p .claude/checkpoints
|
||||
|
||||
# Create summary
|
||||
cat > "$summary_file" <<EOF
|
||||
# Session Summary - $(date +'%Y-%m-%d %H:%M:%S')
|
||||
|
||||
## Checkpoints Created
|
||||
$(find .claude/checkpoints -name '*.json' -mtime -1 -exec basename {} \\; | sort)
|
||||
|
||||
## Files Modified
|
||||
$(git diff --name-only $(git log --format=%H -n 1 --before="1 hour ago" 2>/dev/null) 2>/dev/null || echo "No files tracked")
|
||||
|
||||
## Recent Commits
|
||||
$(git log --oneline -10 --grep="Checkpoint" || echo "No checkpoint commits")
|
||||
|
||||
## Rollback Instructions
|
||||
To rollback to a specific checkpoint:
|
||||
\\\`\\\`\\\`bash
|
||||
# List all checkpoints
|
||||
git tag -l 'checkpoint-*' | sort -r
|
||||
|
||||
# Rollback to a checkpoint
|
||||
git checkout checkpoint-YYYYMMDD-HHMMSS
|
||||
|
||||
# Or reset to a checkpoint (destructive)
|
||||
git reset --hard checkpoint-YYYYMMDD-HHMMSS
|
||||
\\\`\\\`\\\`
|
||||
EOF
|
||||
|
||||
# Create final checkpoint
|
||||
git add -A
|
||||
git commit -m "🏁 Session end checkpoint: $session_id" --quiet || true
|
||||
git tag -a "session-end-$session_id" -m "End of Claude session"
|
||||
|
||||
echo "✅ Session summary saved to: $summary_file"
|
||||
echo "📌 Final checkpoint: session-end-$session_id"
|
||||
}
|
||||
|
||||
# Main entry point
|
||||
case "$1" in
|
||||
pre-edit)
|
||||
pre_edit_checkpoint "$2"
|
||||
;;
|
||||
post-edit)
|
||||
post_edit_checkpoint "$2"
|
||||
;;
|
||||
task)
|
||||
task_checkpoint "$2"
|
||||
;;
|
||||
session-end)
|
||||
session_end_checkpoint
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {pre-edit|post-edit|task|session-end} [input]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
`,
|
||||
};
|
||||
|
||||
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Test script to verify npm distribution includes all files
|
||||
import { execSync } from 'child_process';
|
||||
import { existsSync, readFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { mkdirSync, rmSync } from 'fs';
|
||||
|
||||
// Create temporary directory
|
||||
const testDir = join(tmpdir(), `claude-flow-test-${Date.now()}`);
|
||||
mkdirSync(testDir, { recursive: true });
|
||||
|
||||
console.log(`🧪 Testing npm distribution in: ${testDir}`);
|
||||
|
||||
try {
|
||||
// Change to test directory
|
||||
process.chdir(testDir);
|
||||
|
||||
// Initialize npm project
|
||||
console.log('\n📦 Initializing test project...');
|
||||
execSync('npm init -y', { stdio: 'inherit' });
|
||||
|
||||
// Install claude-flow from npm
|
||||
console.log('\n📥 Installing claude-flow@alpha...');
|
||||
execSync('npm install claude-flow@alpha', { stdio: 'inherit' });
|
||||
|
||||
// Run init command
|
||||
console.log('\n🚀 Running claude-flow init...');
|
||||
execSync('npx claude-flow@alpha init --force', { stdio: 'inherit' });
|
||||
|
||||
// Verify files
|
||||
console.log('\n✅ Verifying files...');
|
||||
const filesToCheck = [
|
||||
'.claude/settings.json',
|
||||
'.claude/helpers/standard-checkpoint-hooks.sh',
|
||||
'.claude/helpers/github-checkpoint-hooks.sh',
|
||||
'.claude/helpers/checkpoint-manager.sh',
|
||||
'CLAUDE.md'
|
||||
];
|
||||
|
||||
let allFilesExist = true;
|
||||
for (const file of filesToCheck) {
|
||||
const exists = existsSync(file);
|
||||
console.log(` ${exists ? '✅' : '❌'} ${file}`);
|
||||
if (!exists) allFilesExist = false;
|
||||
}
|
||||
|
||||
// Check settings.json content
|
||||
if (existsSync('.claude/settings.json')) {
|
||||
const settings = JSON.parse(readFileSync('.claude/settings.json', 'utf8'));
|
||||
const hasStandardHooks = JSON.stringify(settings).includes('standard-checkpoint-hooks.sh');
|
||||
console.log(`\n ${hasStandardHooks ? '✅' : '❌'} settings.json references standard-checkpoint-hooks.sh`);
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
process.chdir('..');
|
||||
rmSync(testDir, { recursive: true, force: true });
|
||||
|
||||
console.log('\n🎉 Test complete!');
|
||||
process.exit(allFilesExist ? 0 : 1);
|
||||
|
||||
} catch (error) {
|
||||
console.error('\n❌ Test failed:', error.message);
|
||||
process.chdir('..');
|
||||
rmSync(testDir, { recursive: true, force: true });
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in new issue
Block a user