moflo 4.8.9 → 4.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/core/coder.md +265 -265
- package/.claude/agents/core/planner.md +167 -167
- package/.claude/agents/core/researcher.md +189 -189
- package/.claude/agents/core/reviewer.md +325 -325
- package/.claude/agents/core/tester.md +318 -318
- package/.claude/agents/dual-mode/codex-coordinator.md +224 -224
- package/.claude/agents/dual-mode/codex-worker.md +211 -211
- package/.claude/agents/dual-mode/dual-orchestrator.md +291 -291
- package/.claude/agents/github/code-review-swarm.md +537 -537
- package/.claude/agents/github/github-modes.md +172 -172
- package/.claude/agents/github/issue-tracker.md +318 -318
- package/.claude/agents/github/multi-repo-swarm.md +552 -552
- package/.claude/agents/github/pr-manager.md +190 -190
- package/.claude/agents/github/project-board-sync.md +508 -508
- package/.claude/agents/github/release-manager.md +366 -366
- package/.claude/agents/github/release-swarm.md +582 -582
- package/.claude/agents/github/repo-architect.md +397 -397
- package/.claude/agents/github/swarm-issue.md +572 -572
- package/.claude/agents/github/swarm-pr.md +427 -427
- package/.claude/agents/github/sync-coordinator.md +451 -451
- package/.claude/agents/github/workflow-automation.md +634 -634
- package/.claude/agents/goal/code-goal-planner.md +445 -445
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +129 -129
- package/.claude/agents/hive-mind/queen-coordinator.md +202 -202
- package/.claude/agents/hive-mind/scout-explorer.md +241 -241
- package/.claude/agents/hive-mind/swarm-memory-manager.md +192 -192
- package/.claude/agents/hive-mind/worker-specialist.md +216 -216
- package/.claude/agents/neural/safla-neural.md +73 -73
- package/.claude/agents/reasoning/goal-planner.md +72 -72
- package/.claude/agents/swarm/adaptive-coordinator.md +395 -395
- package/.claude/agents/swarm/hierarchical-coordinator.md +326 -326
- package/.claude/agents/swarm/mesh-coordinator.md +391 -391
- package/.claude/agents/templates/migration-plan.md +745 -745
- package/.claude/commands/agents/agent-spawning.md +28 -28
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +53 -53
- package/.claude/commands/analysis/bottleneck-detect.md +162 -162
- package/.claude/commands/analysis/performance-bottlenecks.md +58 -58
- package/.claude/commands/analysis/token-efficiency.md +44 -44
- package/.claude/commands/automation/auto-agent.md +122 -122
- package/.claude/commands/automation/self-healing.md +105 -105
- package/.claude/commands/automation/session-memory.md +89 -89
- package/.claude/commands/automation/smart-agents.md +72 -72
- package/.claude/commands/coordination/init.md +44 -44
- package/.claude/commands/coordination/orchestrate.md +43 -43
- package/.claude/commands/coordination/spawn.md +45 -45
- package/.claude/commands/coordination/swarm-init.md +85 -85
- package/.claude/commands/github/github-modes.md +146 -146
- package/.claude/commands/github/github-swarm.md +121 -121
- package/.claude/commands/github/issue-tracker.md +291 -291
- package/.claude/commands/github/pr-manager.md +169 -169
- package/.claude/commands/github/release-manager.md +337 -337
- package/.claude/commands/github/repo-architect.md +366 -366
- package/.claude/commands/github/sync-coordinator.md +300 -300
- package/.claude/commands/memory/neural.md +47 -47
- package/.claude/commands/monitoring/agents.md +44 -44
- package/.claude/commands/monitoring/status.md +46 -46
- package/.claude/commands/optimization/auto-topology.md +61 -61
- package/.claude/commands/optimization/parallel-execution.md +49 -49
- package/.claude/commands/sparc/analyzer.md +51 -51
- package/.claude/commands/sparc/architect.md +53 -53
- package/.claude/commands/sparc/ask.md +97 -97
- package/.claude/commands/sparc/batch-executor.md +54 -54
- package/.claude/commands/sparc/code.md +89 -89
- package/.claude/commands/sparc/coder.md +54 -54
- package/.claude/commands/sparc/debug.md +83 -83
- package/.claude/commands/sparc/debugger.md +54 -54
- package/.claude/commands/sparc/designer.md +53 -53
- package/.claude/commands/sparc/devops.md +109 -109
- package/.claude/commands/sparc/docs-writer.md +80 -80
- package/.claude/commands/sparc/documenter.md +54 -54
- package/.claude/commands/sparc/innovator.md +54 -54
- package/.claude/commands/sparc/integration.md +83 -83
- package/.claude/commands/sparc/mcp.md +117 -117
- package/.claude/commands/sparc/memory-manager.md +54 -54
- package/.claude/commands/sparc/optimizer.md +54 -54
- package/.claude/commands/sparc/orchestrator.md +131 -131
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -83
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -83
- package/.claude/commands/sparc/researcher.md +54 -54
- package/.claude/commands/sparc/reviewer.md +54 -54
- package/.claude/commands/sparc/security-review.md +80 -80
- package/.claude/commands/sparc/sparc-modes.md +174 -174
- package/.claude/commands/sparc/sparc.md +111 -111
- package/.claude/commands/sparc/spec-pseudocode.md +80 -80
- package/.claude/commands/sparc/supabase-admin.md +348 -348
- package/.claude/commands/sparc/swarm-coordinator.md +54 -54
- package/.claude/commands/sparc/tdd.md +54 -54
- package/.claude/commands/sparc/tester.md +54 -54
- package/.claude/commands/sparc/tutorial.md +79 -79
- package/.claude/commands/sparc/workflow-manager.md +54 -54
- package/.claude/commands/sparc.md +166 -166
- package/.claude/commands/swarm/analysis.md +95 -95
- package/.claude/commands/swarm/development.md +96 -96
- package/.claude/commands/swarm/examples.md +168 -168
- package/.claude/commands/swarm/maintenance.md +102 -102
- package/.claude/commands/swarm/optimization.md +117 -117
- package/.claude/commands/swarm/research.md +136 -136
- package/.claude/commands/swarm/testing.md +131 -131
- package/.claude/commands/training/neural-patterns.md +73 -73
- package/.claude/commands/training/specialization.md +62 -62
- package/.claude/commands/workflows/development.md +77 -77
- package/.claude/commands/workflows/research.md +62 -62
- package/.claude/guidance/{agent-bootstrap.md → shipped/agent-bootstrap.md} +126 -126
- package/.claude/guidance/{guidance-memory-strategy.md → shipped/guidance-memory-strategy.md} +262 -262
- package/.claude/guidance/{memory-strategy.md → shipped/memory-strategy.md} +204 -204
- package/.claude/guidance/{moflo.md → shipped/moflo.md} +45 -31
- package/.claude/guidance/{task-swarm-integration.md → shipped/task-swarm-integration.md} +441 -348
- package/.claude/helpers/gate.cjs +236 -236
- package/.claude/helpers/hook-handler.cjs +42 -46
- package/.claude/settings.json +2 -2
- package/.claude/settings.local.json +3 -3
- package/.claude/skills/fl/SKILL.md +29 -23
- package/.claude/skills/flo/SKILL.md +29 -23
- package/.claude/skills/github-code-review/SKILL.md +4 -4
- package/.claude/skills/github-multi-repo/SKILL.md +8 -8
- package/.claude/skills/github-project-management/SKILL.md +6 -6
- package/.claude/skills/github-release-management/SKILL.md +12 -12
- package/.claude/skills/github-workflow-automation/SKILL.md +6 -6
- package/.claude/skills/hooks-automation/SKILL.md +1201 -1201
- package/.claude/skills/performance-analysis/SKILL.md +563 -563
- package/.claude/skills/sparc-methodology/SKILL.md +64 -64
- package/.claude/skills/swarm-advanced/SKILL.md +77 -77
- package/.claude-plugin/README.md +3 -3
- package/.claude-plugin/docs/PLUGIN_SUMMARY.md +3 -3
- package/.claude-plugin/docs/QUICKSTART.md +4 -4
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +3 -3
- package/.claude-plugin/scripts/install.sh +9 -9
- package/.claude-plugin/scripts/verify.sh +7 -7
- package/README.md +311 -116
- package/bin/gate-hook.mjs +50 -0
- package/bin/gate.cjs +138 -0
- package/bin/hook-handler.cjs +83 -0
- package/bin/hooks.mjs +72 -12
- package/bin/index-guidance.mjs +28 -34
- package/bin/index-tests.mjs +710 -0
- package/bin/lib/process-manager.mjs +243 -0
- package/bin/lib/registry-cleanup.cjs +41 -0
- package/bin/prompt-hook.mjs +72 -0
- package/bin/semantic-search.mjs +473 -441
- package/bin/session-start-launcher.mjs +81 -31
- package/bin/setup-project.mjs +13 -10
- package/package.json +4 -2
- package/src/@claude-flow/cli/README.md +1 -1
- package/src/@claude-flow/cli/bin/cli.js +175 -175
- package/src/@claude-flow/cli/dist/src/commands/doctor.js +1091 -736
- package/src/@claude-flow/cli/dist/src/commands/github.d.ts +12 -0
- package/src/@claude-flow/cli/dist/src/commands/github.js +505 -0
- package/src/@claude-flow/cli/dist/src/commands/hive-mind.js +90 -90
- package/src/@claude-flow/cli/dist/src/commands/index.d.ts +1 -0
- package/src/@claude-flow/cli/dist/src/commands/index.js +7 -0
- package/src/@claude-flow/cli/dist/src/config-adapter.js +1 -1
- package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +1 -1
- package/src/@claude-flow/cli/dist/src/init/executor.js +109 -5
- package/src/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +14 -0
- package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +156 -24
- package/src/@claude-flow/cli/dist/src/init/mcp-generator.js +20 -20
- package/src/@claude-flow/cli/dist/src/init/moflo-init.d.ts +7 -0
- package/src/@claude-flow/cli/dist/src/init/moflo-init.js +72 -10
- package/src/@claude-flow/cli/dist/src/init/settings-generator.js +23 -14
- package/src/@claude-flow/cli/dist/src/mcp-server.js +3 -3
- package/src/@claude-flow/cli/dist/src/plugins/manager.js +9 -8
- package/src/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +1 -0
- package/src/@claude-flow/cli/dist/src/services/worker-daemon.js +3 -1
- package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +10 -10
- package/src/@claude-flow/cli/package.json +1 -1
|
@@ -50,96 +50,96 @@ function generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGr
|
|
|
50
50
|
const queenType = flags.queenType || 'strategic';
|
|
51
51
|
const consensusAlgorithm = flags.consensus || 'byzantine';
|
|
52
52
|
const topology = flags.topology || 'hierarchical-mesh';
|
|
53
|
-
return `🧠 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM
|
|
54
|
-
═══════════════════════════════════════════════
|
|
55
|
-
|
|
56
|
-
You are the Queen coordinator of a Hive Mind swarm with collective intelligence capabilities.
|
|
57
|
-
|
|
58
|
-
HIVE MIND CONFIGURATION:
|
|
59
|
-
📌 Swarm ID: ${swarmId}
|
|
60
|
-
📌 Swarm Name: ${swarmName}
|
|
61
|
-
🎯 Objective: ${objective}
|
|
62
|
-
👑 Queen Type: ${queenType}
|
|
63
|
-
🐝 Worker Count: ${workers.length}
|
|
64
|
-
🔗 Topology: ${topology}
|
|
65
|
-
🤝 Consensus Algorithm: ${consensusAlgorithm}
|
|
66
|
-
⏰ Initialized: ${currentTime}
|
|
67
|
-
|
|
68
|
-
WORKER DISTRIBUTION:
|
|
69
|
-
${workerTypes.map(type => `• ${type}: ${workerGroups[type].length} agents`).join('\n')}
|
|
70
|
-
|
|
71
|
-
🔧 AVAILABLE MCP TOOLS FOR HIVE MIND COORDINATION:
|
|
72
|
-
|
|
73
|
-
1️⃣ **COLLECTIVE INTELLIGENCE**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
2️⃣ **QUEEN COORDINATION**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
3️⃣ **WORKER MANAGEMENT**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
4️⃣ **TASK ORCHESTRATION**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
5️⃣ **MEMORY & LEARNING**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
📋 HIVE MIND EXECUTION PROTOCOL:
|
|
106
|
-
|
|
107
|
-
1. **INITIALIZATION PHASE**
|
|
108
|
-
- Verify all workers are online and responsive
|
|
109
|
-
- Establish communication channels
|
|
110
|
-
- Load previous session state if available
|
|
111
|
-
- Initialize shared memory space
|
|
112
|
-
|
|
113
|
-
2. **TASK DISTRIBUTION PHASE**
|
|
114
|
-
- Analyze the objective and decompose into subtasks
|
|
115
|
-
- Assign tasks based on worker specializations
|
|
116
|
-
- Set up task dependencies and ordering
|
|
117
|
-
- Monitor parallel execution
|
|
118
|
-
|
|
119
|
-
3. **COORDINATION PHASE**
|
|
120
|
-
- Use consensus for critical decisions
|
|
121
|
-
- Aggregate results from workers
|
|
122
|
-
- Resolve conflicts using ${consensusAlgorithm} consensus
|
|
123
|
-
- Share learnings across the hive
|
|
124
|
-
|
|
125
|
-
4. **COMPLETION PHASE**
|
|
126
|
-
- Verify all subtasks are complete
|
|
127
|
-
- Consolidate results
|
|
128
|
-
- Store learnings in collective memory
|
|
129
|
-
- Report final status
|
|
130
|
-
|
|
131
|
-
🎯 YOUR OBJECTIVE:
|
|
132
|
-
${objective}
|
|
133
|
-
|
|
134
|
-
💡 COORDINATION TIPS:
|
|
135
|
-
• Use
|
|
136
|
-
• Check worker status regularly with
|
|
137
|
-
• Store important decisions in shared memory for persistence
|
|
138
|
-
• Use consensus for any decisions affecting multiple workers
|
|
139
|
-
• Monitor task progress and reassign if workers are blocked
|
|
140
|
-
|
|
141
|
-
🚀 BEGIN HIVE MIND COORDINATION NOW!
|
|
142
|
-
Start by checking the current hive status and then proceed with the objective.
|
|
53
|
+
return `🧠 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM
|
|
54
|
+
═══════════════════════════════════════════════
|
|
55
|
+
|
|
56
|
+
You are the Queen coordinator of a Hive Mind swarm with collective intelligence capabilities.
|
|
57
|
+
|
|
58
|
+
HIVE MIND CONFIGURATION:
|
|
59
|
+
📌 Swarm ID: ${swarmId}
|
|
60
|
+
📌 Swarm Name: ${swarmName}
|
|
61
|
+
🎯 Objective: ${objective}
|
|
62
|
+
👑 Queen Type: ${queenType}
|
|
63
|
+
🐝 Worker Count: ${workers.length}
|
|
64
|
+
🔗 Topology: ${topology}
|
|
65
|
+
🤝 Consensus Algorithm: ${consensusAlgorithm}
|
|
66
|
+
⏰ Initialized: ${currentTime}
|
|
67
|
+
|
|
68
|
+
WORKER DISTRIBUTION:
|
|
69
|
+
${workerTypes.map(type => `• ${type}: ${workerGroups[type].length} agents`).join('\n')}
|
|
70
|
+
|
|
71
|
+
🔧 AVAILABLE MCP TOOLS FOR HIVE MIND COORDINATION:
|
|
72
|
+
|
|
73
|
+
1️⃣ **COLLECTIVE INTELLIGENCE**
|
|
74
|
+
mcp__moflo__hive-mind_consensus - Democratic decision making
|
|
75
|
+
mcp__moflo__hive-mind_memory - Share knowledge across the hive
|
|
76
|
+
mcp__moflo__hive-mind_broadcast - Broadcast to all workers
|
|
77
|
+
mcp__moflo__neural_patterns - Neural pattern recognition
|
|
78
|
+
|
|
79
|
+
2️⃣ **QUEEN COORDINATION**
|
|
80
|
+
mcp__moflo__hive-mind_status - Monitor swarm health
|
|
81
|
+
mcp__moflo__task_create - Create and delegate tasks
|
|
82
|
+
mcp__moflo__task_orchestrate - Orchestrate task distribution
|
|
83
|
+
mcp__moflo__agent_spawn - Spawn additional workers
|
|
84
|
+
|
|
85
|
+
3️⃣ **WORKER MANAGEMENT**
|
|
86
|
+
mcp__moflo__agent_list - List all active agents
|
|
87
|
+
mcp__moflo__agent_status - Check agent status
|
|
88
|
+
mcp__moflo__agent_metrics - Track worker performance
|
|
89
|
+
mcp__moflo__hive-mind_join - Add agent to hive
|
|
90
|
+
mcp__moflo__hive-mind_leave - Remove agent from hive
|
|
91
|
+
|
|
92
|
+
4️⃣ **TASK ORCHESTRATION**
|
|
93
|
+
mcp__moflo__task_create - Create hierarchical tasks
|
|
94
|
+
mcp__moflo__task_status - Track task progress
|
|
95
|
+
mcp__moflo__task_complete - Mark tasks complete
|
|
96
|
+
mcp__moflo__workflow_create - Create workflows
|
|
97
|
+
|
|
98
|
+
5️⃣ **MEMORY & LEARNING**
|
|
99
|
+
mcp__moflo__memory_store - Store collective knowledge
|
|
100
|
+
mcp__moflo__memory_retrieve - Access shared memory
|
|
101
|
+
mcp__moflo__memory_search - Search memory patterns
|
|
102
|
+
mcp__moflo__neural_train - Learn from experiences
|
|
103
|
+
mcp__moflo__hooks_intelligence_pattern-store - Store patterns
|
|
104
|
+
|
|
105
|
+
📋 HIVE MIND EXECUTION PROTOCOL:
|
|
106
|
+
|
|
107
|
+
1. **INITIALIZATION PHASE**
|
|
108
|
+
- Verify all workers are online and responsive
|
|
109
|
+
- Establish communication channels
|
|
110
|
+
- Load previous session state if available
|
|
111
|
+
- Initialize shared memory space
|
|
112
|
+
|
|
113
|
+
2. **TASK DISTRIBUTION PHASE**
|
|
114
|
+
- Analyze the objective and decompose into subtasks
|
|
115
|
+
- Assign tasks based on worker specializations
|
|
116
|
+
- Set up task dependencies and ordering
|
|
117
|
+
- Monitor parallel execution
|
|
118
|
+
|
|
119
|
+
3. **COORDINATION PHASE**
|
|
120
|
+
- Use consensus for critical decisions
|
|
121
|
+
- Aggregate results from workers
|
|
122
|
+
- Resolve conflicts using ${consensusAlgorithm} consensus
|
|
123
|
+
- Share learnings across the hive
|
|
124
|
+
|
|
125
|
+
4. **COMPLETION PHASE**
|
|
126
|
+
- Verify all subtasks are complete
|
|
127
|
+
- Consolidate results
|
|
128
|
+
- Store learnings in collective memory
|
|
129
|
+
- Report final status
|
|
130
|
+
|
|
131
|
+
🎯 YOUR OBJECTIVE:
|
|
132
|
+
${objective}
|
|
133
|
+
|
|
134
|
+
💡 COORDINATION TIPS:
|
|
135
|
+
• Use mcp__moflo__hive-mind_broadcast for swarm-wide announcements
|
|
136
|
+
• Check worker status regularly with mcp__moflo__hive-mind_status
|
|
137
|
+
• Store important decisions in shared memory for persistence
|
|
138
|
+
• Use consensus for any decisions affecting multiple workers
|
|
139
|
+
• Monitor task progress and reassign if workers are blocked
|
|
140
|
+
|
|
141
|
+
🚀 BEGIN HIVE MIND COORDINATION NOW!
|
|
142
|
+
Start by checking the current hive status and then proceed with the objective.
|
|
143
143
|
`;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
@@ -30,6 +30,7 @@ export { hiveMindCommand } from './hive-mind.js';
|
|
|
30
30
|
export { guidanceCommand } from './guidance.js';
|
|
31
31
|
export { applianceCommand } from './appliance.js';
|
|
32
32
|
export { diagnoseCommand } from './diagnose.js';
|
|
33
|
+
export { githubCommand } from './github.js';
|
|
33
34
|
export declare function getConfigCommand(): Promise<Command | undefined>;
|
|
34
35
|
export declare function getMigrateCommand(): Promise<Command | undefined>;
|
|
35
36
|
export declare function getWorkflowCommand(): Promise<Command | undefined>;
|
|
@@ -67,6 +67,8 @@ const commandLoaders = {
|
|
|
67
67
|
gate: () => import('./gate.js'),
|
|
68
68
|
// Feature Orchestrator
|
|
69
69
|
orc: () => import('./orc.js'),
|
|
70
|
+
// GitHub Repository Setup
|
|
71
|
+
github: () => import('./github.js'),
|
|
70
72
|
};
|
|
71
73
|
// Cache for loaded commands
|
|
72
74
|
const loadedCommands = new Map();
|
|
@@ -137,6 +139,7 @@ import { processCommand } from './process.js';
|
|
|
137
139
|
import { guidanceCommand } from './guidance.js';
|
|
138
140
|
import { applianceCommand } from './appliance.js';
|
|
139
141
|
import { diagnoseCommand } from './diagnose.js';
|
|
142
|
+
import { githubCommand } from './github.js';
|
|
140
143
|
// Pre-populate cache with core commands
|
|
141
144
|
loadedCommands.set('init', initCommand);
|
|
142
145
|
loadedCommands.set('start', startCommand);
|
|
@@ -158,6 +161,7 @@ loadedCommands.set('ruvector', ruvectorCommand);
|
|
|
158
161
|
loadedCommands.set('hive-mind', hiveMindCommand);
|
|
159
162
|
loadedCommands.set('guidance', guidanceCommand);
|
|
160
163
|
loadedCommands.set('diagnose', diagnoseCommand);
|
|
164
|
+
loadedCommands.set('github', githubCommand);
|
|
161
165
|
// =============================================================================
|
|
162
166
|
// Exports (maintain backwards compatibility)
|
|
163
167
|
// =============================================================================
|
|
@@ -183,6 +187,7 @@ export { hiveMindCommand } from './hive-mind.js';
|
|
|
183
187
|
export { guidanceCommand } from './guidance.js';
|
|
184
188
|
export { applianceCommand } from './appliance.js';
|
|
185
189
|
export { diagnoseCommand } from './diagnose.js';
|
|
190
|
+
export { githubCommand } from './github.js';
|
|
186
191
|
// Lazy-loaded command re-exports (for backwards compatibility, but async-only)
|
|
187
192
|
export async function getConfigCommand() { return loadCommand('config'); }
|
|
188
193
|
export async function getMigrateCommand() { return loadCommand('migrate'); }
|
|
@@ -233,6 +238,7 @@ export const commands = [
|
|
|
233
238
|
hiveMindCommand,
|
|
234
239
|
guidanceCommand,
|
|
235
240
|
diagnoseCommand,
|
|
241
|
+
githubCommand,
|
|
236
242
|
];
|
|
237
243
|
/**
|
|
238
244
|
* Commands organized by category for help display
|
|
@@ -282,6 +288,7 @@ export const commandsByCategory = {
|
|
|
282
288
|
updateCommand,
|
|
283
289
|
processCommand,
|
|
284
290
|
applianceCommand,
|
|
291
|
+
githubCommand,
|
|
285
292
|
],
|
|
286
293
|
};
|
|
287
294
|
/**
|
|
@@ -14,7 +14,7 @@ import { detectPlatform, DEFAULT_INIT_OPTIONS } from './types.js';
|
|
|
14
14
|
import { generateSettingsJson, generateSettings } from './settings-generator.js';
|
|
15
15
|
import { generateMCPJson } from './mcp-generator.js';
|
|
16
16
|
import { generateStatuslineScript } from './statusline-generator.js';
|
|
17
|
-
import { generatePreCommitHook, generatePostCommitHook, generateAutoMemoryHook, generateGateScript, generateHookHandlerScript, } from './helpers-generator.js';
|
|
17
|
+
import { generatePreCommitHook, generatePostCommitHook, generateAutoMemoryHook, generateGateScript, generateGateHookScript, generatePromptHookScript, generateHookHandlerScript, } from './helpers-generator.js';
|
|
18
18
|
import { generateClaudeMd } from './claudemd-generator.js';
|
|
19
19
|
/**
|
|
20
20
|
* Skills to copy based on configuration
|
|
@@ -377,6 +377,8 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
|
377
377
|
const generatedCritical = {
|
|
378
378
|
'auto-memory-hook.mjs': generateAutoMemoryHook(),
|
|
379
379
|
'gate.cjs': generateGateScript(),
|
|
380
|
+
'gate-hook.mjs': generateGateHookScript(),
|
|
381
|
+
'prompt-hook.mjs': generatePromptHookScript(),
|
|
380
382
|
'hook-handler.cjs': generateHookHandlerScript(),
|
|
381
383
|
};
|
|
382
384
|
for (const [helperName, content] of Object.entries(generatedCritical)) {
|
|
@@ -463,6 +465,22 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
|
463
465
|
}
|
|
464
466
|
}
|
|
465
467
|
}
|
|
468
|
+
// 1c. Build manifest of files we're installing, clean up stale ones
|
|
469
|
+
const manifestPath = path.join(targetDir, '.claude-flow', 'installed-files.json');
|
|
470
|
+
let previousManifest = [];
|
|
471
|
+
try {
|
|
472
|
+
previousManifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
473
|
+
}
|
|
474
|
+
catch { /* ok */ }
|
|
475
|
+
const currentManifest = [];
|
|
476
|
+
// Collect everything we just synced into the manifest
|
|
477
|
+
for (const entry of [...result.created, ...result.updated]) {
|
|
478
|
+
// Strip annotations like " (removed, obsolete)" — keep only clean paths
|
|
479
|
+
const clean = entry.replace(/\s*\(.*\)$/, '');
|
|
480
|
+
if (clean.startsWith('.claude/') || clean.startsWith('.claude-flow/')) {
|
|
481
|
+
currentManifest.push(clean);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
466
484
|
// 2. Create MISSING metrics files only (preserve existing data)
|
|
467
485
|
const metricsDir = path.join(targetDir, '.claude-flow', 'metrics');
|
|
468
486
|
const securityDir = path.join(targetDir, '.claude-flow', 'security');
|
|
@@ -579,6 +597,39 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
|
579
597
|
result.settingsUpdated = ['Created new settings.json with Agent Teams'];
|
|
580
598
|
}
|
|
581
599
|
}
|
|
600
|
+
// ── Final: collect any additional generated files into manifest, then clean up stale ──
|
|
601
|
+
// Re-scan result arrays since metrics/security files were added after initial collection
|
|
602
|
+
for (const entry of [...result.created, ...result.updated]) {
|
|
603
|
+
const clean = entry.replace(/\s*\(.*\)$/, '');
|
|
604
|
+
if ((clean.startsWith('.claude/') || clean.startsWith('.claude-flow/')) && !currentManifest.includes(clean)) {
|
|
605
|
+
currentManifest.push(clean);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
// Remove files that were in the OLD manifest but NOT in the new one.
|
|
609
|
+
// This only deletes files moflo previously installed — never user or runtime files.
|
|
610
|
+
if (previousManifest.length > 0) {
|
|
611
|
+
const currentSet = new Set(currentManifest);
|
|
612
|
+
for (const rel of previousManifest) {
|
|
613
|
+
if (!currentSet.has(rel)) {
|
|
614
|
+
const abs = path.join(targetDir, rel);
|
|
615
|
+
try {
|
|
616
|
+
if (fs.existsSync(abs)) {
|
|
617
|
+
fs.unlinkSync(abs);
|
|
618
|
+
result.updated.push(`${rel} (removed, no longer shipped)`);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
catch { /* non-fatal */ }
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
// Write manifest for next upgrade
|
|
626
|
+
try {
|
|
627
|
+
const cfDir = path.join(targetDir, '.claude-flow');
|
|
628
|
+
if (!fs.existsSync(cfDir))
|
|
629
|
+
fs.mkdirSync(cfDir, { recursive: true });
|
|
630
|
+
fs.writeFileSync(manifestPath, JSON.stringify(currentManifest, null, 2), 'utf-8');
|
|
631
|
+
}
|
|
632
|
+
catch { /* non-fatal */ }
|
|
582
633
|
}
|
|
583
634
|
catch (error) {
|
|
584
635
|
result.success = false;
|
|
@@ -713,12 +764,63 @@ async function writeSettings(targetDir, options, result) {
|
|
|
713
764
|
}
|
|
714
765
|
/**
|
|
715
766
|
* Write .mcp.json
|
|
767
|
+
*
|
|
768
|
+
* If an existing config contains the legacy 'claude-flow' server key, prompt
|
|
769
|
+
* the user to migrate it to 'moflo', keep both side-by-side, or leave as-is.
|
|
716
770
|
*/
|
|
717
771
|
async function writeMCPConfig(targetDir, options, result) {
|
|
718
772
|
const mcpPath = path.join(targetDir, '.mcp.json');
|
|
719
|
-
if (fs.existsSync(mcpPath)
|
|
720
|
-
|
|
721
|
-
|
|
773
|
+
if (fs.existsSync(mcpPath)) {
|
|
774
|
+
const existing = JSON.parse(fs.readFileSync(mcpPath, 'utf-8'));
|
|
775
|
+
const servers = existing?.mcpServers ?? {};
|
|
776
|
+
const hasLegacy = 'claude-flow' in servers;
|
|
777
|
+
const hasMoflo = 'moflo' in servers;
|
|
778
|
+
if (hasLegacy && !hasMoflo) {
|
|
779
|
+
// Interactive mode: prompt the user
|
|
780
|
+
if (process.stdin.isTTY && !options.force) {
|
|
781
|
+
const { select } = await import('../prompt.js');
|
|
782
|
+
const action = await select({
|
|
783
|
+
message: "Found existing 'claude-flow' MCP server. How should we handle it?",
|
|
784
|
+
options: [
|
|
785
|
+
{ value: 'migrate', label: 'Migrate to moflo', hint: 'Rename claude-flow → moflo (recommended)' },
|
|
786
|
+
{ value: 'side-by-side', label: 'Keep both', hint: 'Add moflo alongside existing claude-flow' },
|
|
787
|
+
{ value: 'skip', label: 'Skip', hint: 'Leave .mcp.json unchanged' },
|
|
788
|
+
],
|
|
789
|
+
default: 'migrate',
|
|
790
|
+
});
|
|
791
|
+
if (action === 'skip') {
|
|
792
|
+
result.skipped.push('.mcp.json');
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
if (action === 'migrate') {
|
|
796
|
+
servers['moflo'] = servers['claude-flow'];
|
|
797
|
+
delete servers['claude-flow'];
|
|
798
|
+
existing.mcpServers = servers;
|
|
799
|
+
fs.writeFileSync(mcpPath, JSON.stringify(existing, null, 2), 'utf-8');
|
|
800
|
+
result.created.files.push('.mcp.json (migrated claude-flow → moflo)');
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
// side-by-side: fall through to generate new config and merge
|
|
804
|
+
const newConfig = JSON.parse(generateMCPJson(options));
|
|
805
|
+
Object.assign(servers, newConfig.mcpServers ?? {});
|
|
806
|
+
existing.mcpServers = servers;
|
|
807
|
+
fs.writeFileSync(mcpPath, JSON.stringify(existing, null, 2), 'utf-8');
|
|
808
|
+
result.created.files.push('.mcp.json (added moflo alongside claude-flow)');
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
// Non-interactive (CI/pipe): auto-migrate silently
|
|
812
|
+
servers['moflo'] = servers['claude-flow'];
|
|
813
|
+
delete servers['claude-flow'];
|
|
814
|
+
existing.mcpServers = servers;
|
|
815
|
+
fs.writeFileSync(mcpPath, JSON.stringify(existing, null, 2), 'utf-8');
|
|
816
|
+
result.created.files.push('.mcp.json (auto-migrated claude-flow → moflo)');
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
// Already has moflo or no legacy key — skip unless forced
|
|
820
|
+
if (!options.force) {
|
|
821
|
+
result.skipped.push('.mcp.json');
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
722
824
|
}
|
|
723
825
|
const content = generateMCPJson(options);
|
|
724
826
|
fs.writeFileSync(mcpPath, content, 'utf-8');
|
|
@@ -1012,6 +1114,8 @@ async function writeHelpers(targetDir, options, result) {
|
|
|
1012
1114
|
'post-commit': generatePostCommitHook(),
|
|
1013
1115
|
'auto-memory-hook.mjs': generateAutoMemoryHook(),
|
|
1014
1116
|
'gate.cjs': generateGateScript(),
|
|
1117
|
+
'gate-hook.mjs': generateGateHookScript(),
|
|
1118
|
+
'prompt-hook.mjs': generatePromptHookScript(),
|
|
1015
1119
|
'hook-handler.cjs': generateHookHandlerScript(),
|
|
1016
1120
|
};
|
|
1017
1121
|
for (const [name, content] of Object.entries(helpers)) {
|
|
@@ -1653,7 +1757,7 @@ npx moflo hive-mind consensus --propose "task"
|
|
|
1653
1757
|
### MCP Server Setup
|
|
1654
1758
|
\`\`\`bash
|
|
1655
1759
|
# Add Claude Flow MCP
|
|
1656
|
-
claude mcp add
|
|
1760
|
+
claude mcp add moflo -- npx -y moflo
|
|
1657
1761
|
|
|
1658
1762
|
# Optional servers
|
|
1659
1763
|
claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start
|
|
@@ -28,6 +28,20 @@ export declare function generateHelpers(options: InitOptions): Record<string, st
|
|
|
28
28
|
* on every tool call (~500ms npx overhead → ~20ms direct node).
|
|
29
29
|
*/
|
|
30
30
|
export declare function generateGateScript(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Generate gate-hook.mjs — ESM wrapper that reads Claude Code stdin JSON
|
|
33
|
+
* and passes tool_name + tool_input to gate.cjs via environment variables.
|
|
34
|
+
*
|
|
35
|
+
* Claude Code hooks receive context as JSON on stdin but don't set env vars
|
|
36
|
+
* for tool input. This script bridges that gap. It also translates exit code 1
|
|
37
|
+
* from gate.cjs into exit code 2 (which Claude Code requires to block tools).
|
|
38
|
+
*/
|
|
39
|
+
export declare function generateGateHookScript(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Generate prompt-hook.mjs — reads user prompt from Claude Code stdin JSON,
|
|
42
|
+
* runs prompt classification via gate.cjs, and appends namespace hints.
|
|
43
|
+
*/
|
|
44
|
+
export declare function generatePromptHookScript(): string;
|
|
31
45
|
/**
|
|
32
46
|
* Generate lightweight hook-handler.cjs — hook dispatch without CLI bootstrap.
|
|
33
47
|
* Handles routing, edit/task tracking, session lifecycle, and notifications.
|