claude-flow-novice 1.1.8 → 1.1.9
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/dist/mcp/mcp-server-novice.js +10 -2
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +271 -0
- package/dist/src/slash-commands/README.md +157 -0
- package/dist/src/slash-commands/claude-md.js +237 -0
- package/dist/src/slash-commands/claude-soul.js +562 -0
- package/dist/src/slash-commands/cli-integration.js +216 -0
- package/dist/src/slash-commands/github.js +638 -0
- package/dist/src/slash-commands/hooks.js +648 -0
- package/dist/src/slash-commands/index.js +115 -0
- package/dist/src/slash-commands/neural.js +572 -0
- package/dist/src/slash-commands/performance.js +582 -0
- package/dist/src/slash-commands/register-all-commands.js +314 -0
- package/dist/src/slash-commands/register-claude-md.js +82 -0
- package/dist/src/slash-commands/register-claude-soul.js +80 -0
- package/dist/src/slash-commands/sparc.js +110 -0
- package/dist/src/slash-commands/swarm.js +423 -0
- package/dist/src/slash-commands/validate-commands.js +223 -0
- package/dist/src/slash-commands/workflow.js +606 -0
- package/package.json +8 -7
- package/src/slash-commands/cli-integration.js +216 -0
- package/src/slash-commands/github.js +638 -0
- package/src/slash-commands/hooks.js +648 -0
- package/src/slash-commands/index.js +115 -0
- package/src/slash-commands/neural.js +572 -0
- package/src/slash-commands/performance.js +582 -0
- package/src/slash-commands/register-all-commands.js +314 -0
- package/src/slash-commands/sparc.js +110 -0
- package/src/slash-commands/swarm.js +423 -0
- package/src/slash-commands/validate-commands.js +223 -0
- package/src/slash-commands/workflow.js +606 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Register All Slash Commands
|
|
5
|
+
*
|
|
6
|
+
* Central registry for all claude-flow slash commands
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ClaudeMdSlashCommand } from './claude-md.js';
|
|
10
|
+
import { SparcCommand } from './sparc.js';
|
|
11
|
+
import { SwarmCommand } from './swarm.js';
|
|
12
|
+
import { HooksCommand } from './hooks.js';
|
|
13
|
+
import { NeuralCommand } from './neural.js';
|
|
14
|
+
import { PerformanceCommand } from './performance.js';
|
|
15
|
+
import { GitHubCommand } from './github.js';
|
|
16
|
+
import { WorkflowCommand } from './workflow.js';
|
|
17
|
+
import { executeClaudeSoulCommand } from './claude-soul.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Command Registry Class
|
|
21
|
+
*/
|
|
22
|
+
export class SlashCommandRegistry {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.commands = new Map();
|
|
25
|
+
this.aliases = new Map();
|
|
26
|
+
this.initializeCommands();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Initialize all available commands
|
|
31
|
+
*/
|
|
32
|
+
initializeCommands() {
|
|
33
|
+
// Core SPARC methodology command
|
|
34
|
+
this.register(new SparcCommand());
|
|
35
|
+
|
|
36
|
+
// Swarm management commands
|
|
37
|
+
this.register(new SwarmCommand());
|
|
38
|
+
this.addAlias('swarm', 's');
|
|
39
|
+
|
|
40
|
+
// Hooks automation commands
|
|
41
|
+
this.register(new HooksCommand());
|
|
42
|
+
this.addAlias('hooks', 'h');
|
|
43
|
+
|
|
44
|
+
// Neural network commands
|
|
45
|
+
this.register(new NeuralCommand());
|
|
46
|
+
this.addAlias('neural', 'n');
|
|
47
|
+
|
|
48
|
+
// Performance monitoring commands
|
|
49
|
+
this.register(new PerformanceCommand());
|
|
50
|
+
this.addAlias('performance', 'perf');
|
|
51
|
+
this.addAlias('performance', 'p');
|
|
52
|
+
|
|
53
|
+
// GitHub integration commands
|
|
54
|
+
this.register(new GitHubCommand());
|
|
55
|
+
this.addAlias('github', 'gh');
|
|
56
|
+
this.addAlias('github', 'git');
|
|
57
|
+
|
|
58
|
+
// Workflow automation commands
|
|
59
|
+
this.register(new WorkflowCommand());
|
|
60
|
+
this.addAlias('workflow', 'wf');
|
|
61
|
+
this.addAlias('workflow', 'w');
|
|
62
|
+
|
|
63
|
+
// Legacy function-based commands
|
|
64
|
+
this.registerLegacyCommand('claude-md', {
|
|
65
|
+
description: 'Generate CLAUDE.md configuration file',
|
|
66
|
+
usage: '/claude-md [--preview] [--force] [--no-backup]',
|
|
67
|
+
execute: async (args, context) => {
|
|
68
|
+
const command = new ClaudeMdSlashCommand();
|
|
69
|
+
const options = {
|
|
70
|
+
preview: args.includes('--preview'),
|
|
71
|
+
force: args.includes('--force'),
|
|
72
|
+
backup: !args.includes('--no-backup')
|
|
73
|
+
};
|
|
74
|
+
return await command.execute(options);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
this.registerLegacyCommand('claude-soul', {
|
|
79
|
+
description: 'Generate claude-soul.md project essence document',
|
|
80
|
+
usage: '/claude-soul [--preview] [--force] [--no-backup]',
|
|
81
|
+
execute: async (args, context) => {
|
|
82
|
+
const options = {
|
|
83
|
+
preview: args.includes('--preview'),
|
|
84
|
+
force: args.includes('--force'),
|
|
85
|
+
backup: !args.includes('--no-backup')
|
|
86
|
+
};
|
|
87
|
+
return await executeClaudeSoulCommand(options);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Register a command
|
|
94
|
+
* @param {SlashCommand} command - Command instance
|
|
95
|
+
*/
|
|
96
|
+
register(command) {
|
|
97
|
+
this.commands.set(command.name, command);
|
|
98
|
+
console.log(`✅ Registered /${command.name} command`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Register legacy function-based command
|
|
103
|
+
* @param {string} name - Command name
|
|
104
|
+
* @param {Object} config - Command configuration
|
|
105
|
+
*/
|
|
106
|
+
registerLegacyCommand(name, config) {
|
|
107
|
+
this.commands.set(name, {
|
|
108
|
+
name: name,
|
|
109
|
+
description: config.description,
|
|
110
|
+
usage: config.usage,
|
|
111
|
+
execute: config.execute,
|
|
112
|
+
getHelp: () => ({
|
|
113
|
+
name: name,
|
|
114
|
+
description: config.description,
|
|
115
|
+
usage: config.usage,
|
|
116
|
+
examples: config.examples || []
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
console.log(`✅ Registered /${name} legacy command`);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Add alias for a command
|
|
124
|
+
* @param {string} commandName - Original command name
|
|
125
|
+
* @param {string} alias - Alias name
|
|
126
|
+
*/
|
|
127
|
+
addAlias(commandName, alias) {
|
|
128
|
+
this.aliases.set(alias, commandName);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Execute a slash command
|
|
133
|
+
* @param {string} input - Full command input (e.g., "/swarm init mesh")
|
|
134
|
+
* @param {Object} context - Execution context
|
|
135
|
+
*/
|
|
136
|
+
async execute(input, context = {}) {
|
|
137
|
+
if (!input.startsWith('/')) {
|
|
138
|
+
return {
|
|
139
|
+
success: false,
|
|
140
|
+
error: 'Commands must start with /'
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const parts = input.slice(1).split(' ');
|
|
145
|
+
const commandName = parts[0];
|
|
146
|
+
const args = parts.slice(1);
|
|
147
|
+
|
|
148
|
+
// Resolve aliases
|
|
149
|
+
const resolvedName = this.aliases.get(commandName) || commandName;
|
|
150
|
+
const command = this.commands.get(resolvedName);
|
|
151
|
+
|
|
152
|
+
if (!command) {
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
error: `Unknown command: ${commandName}`,
|
|
156
|
+
suggestions: this.getSuggestions(commandName)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
const result = await command.execute(args, context);
|
|
162
|
+
return {
|
|
163
|
+
success: true,
|
|
164
|
+
command: resolvedName,
|
|
165
|
+
result: result
|
|
166
|
+
};
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return {
|
|
169
|
+
success: false,
|
|
170
|
+
error: `Command execution failed: ${error.message}`,
|
|
171
|
+
command: resolvedName
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get command suggestions for unknown commands
|
|
178
|
+
* @param {string} input - Input command
|
|
179
|
+
*/
|
|
180
|
+
getSuggestions(input) {
|
|
181
|
+
const commands = Array.from(this.commands.keys());
|
|
182
|
+
const aliases = Array.from(this.aliases.keys());
|
|
183
|
+
const allCommands = [...commands, ...aliases];
|
|
184
|
+
|
|
185
|
+
return allCommands
|
|
186
|
+
.filter(cmd => cmd.includes(input) || input.includes(cmd))
|
|
187
|
+
.slice(0, 5);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* List all available commands
|
|
192
|
+
*/
|
|
193
|
+
listCommands() {
|
|
194
|
+
const commands = [];
|
|
195
|
+
|
|
196
|
+
for (const [name, command] of this.commands) {
|
|
197
|
+
commands.push({
|
|
198
|
+
name: name,
|
|
199
|
+
description: command.description,
|
|
200
|
+
usage: command.usage || command.getUsage?.() || `/${name} [options]`,
|
|
201
|
+
aliases: Array.from(this.aliases.entries())
|
|
202
|
+
.filter(([alias, target]) => target === name)
|
|
203
|
+
.map(([alias]) => alias)
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get help for a specific command
|
|
212
|
+
* @param {string} commandName - Command name
|
|
213
|
+
*/
|
|
214
|
+
getHelp(commandName) {
|
|
215
|
+
const resolvedName = this.aliases.get(commandName) || commandName;
|
|
216
|
+
const command = this.commands.get(resolvedName);
|
|
217
|
+
|
|
218
|
+
if (!command) {
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
error: `Unknown command: ${commandName}`
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
success: true,
|
|
227
|
+
help: command.getHelp ? command.getHelp() : {
|
|
228
|
+
name: command.name,
|
|
229
|
+
description: command.description,
|
|
230
|
+
usage: command.usage
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Generate help text for all commands
|
|
237
|
+
*/
|
|
238
|
+
generateHelpText() {
|
|
239
|
+
const commands = this.listCommands();
|
|
240
|
+
|
|
241
|
+
let helpText = `
|
|
242
|
+
🚀 **CLAUDE-FLOW SLASH COMMANDS**
|
|
243
|
+
|
|
244
|
+
`;
|
|
245
|
+
|
|
246
|
+
helpText += `**Available Commands:**
|
|
247
|
+
|
|
248
|
+
`;
|
|
249
|
+
|
|
250
|
+
for (const cmd of commands) {
|
|
251
|
+
helpText += `**/${cmd.name}** - ${cmd.description}\n`;
|
|
252
|
+
helpText += ` Usage: ${cmd.usage}\n`;
|
|
253
|
+
if (cmd.aliases.length > 0) {
|
|
254
|
+
helpText += ` Aliases: ${cmd.aliases.map(a => `/${a}`).join(', ')}\n`;
|
|
255
|
+
}
|
|
256
|
+
helpText += `\n`;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
helpText += `
|
|
260
|
+
**Examples:**
|
|
261
|
+
`;
|
|
262
|
+
helpText += `- \`/swarm init mesh 8\` - Initialize mesh swarm with 8 agents\n`;
|
|
263
|
+
helpText += `- \`/hooks enable\` - Enable automation hooks\n`;
|
|
264
|
+
helpText += `- \`/neural train coordination 50\` - Train neural coordination patterns\n`;
|
|
265
|
+
helpText += `- \`/performance report\` - Generate performance report\n`;
|
|
266
|
+
helpText += `- \`/github analyze owner/repo\` - Analyze GitHub repository\n`;
|
|
267
|
+
helpText += `- \`/workflow create "Build Pipeline"\` - Create automated workflow\n`;
|
|
268
|
+
helpText += `- \`/sparc spec "Build API"\` - Run SPARC specification phase\n`;
|
|
269
|
+
|
|
270
|
+
helpText += `
|
|
271
|
+
**For detailed help on any command:** \`/help <command>\`\n`;
|
|
272
|
+
|
|
273
|
+
return helpText;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Global registry instance
|
|
279
|
+
*/
|
|
280
|
+
export const globalRegistry = new SlashCommandRegistry();
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Execute slash command with global registry
|
|
284
|
+
* @param {string} input - Command input
|
|
285
|
+
* @param {Object} context - Execution context
|
|
286
|
+
*/
|
|
287
|
+
export async function executeSlashCommand(input, context = {}) {
|
|
288
|
+
return await globalRegistry.execute(input, context);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Get all available commands
|
|
293
|
+
*/
|
|
294
|
+
export function getAllCommands() {
|
|
295
|
+
return globalRegistry.listCommands();
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Get help for specific command
|
|
300
|
+
* @param {string} commandName - Command name
|
|
301
|
+
*/
|
|
302
|
+
export function getCommandHelp(commandName) {
|
|
303
|
+
return globalRegistry.getHelp(commandName);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Register additional command
|
|
308
|
+
* @param {SlashCommand} command - Command to register
|
|
309
|
+
*/
|
|
310
|
+
export function registerCommand(command) {
|
|
311
|
+
return globalRegistry.register(command);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export default SlashCommandRegistry;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SPARC Methodology Slash Command
|
|
5
|
+
* Usage: /sparc <mode> <task>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { SlashCommand } from '../core/slash-command.js';
|
|
9
|
+
|
|
10
|
+
export class SparcCommand extends SlashCommand {
|
|
11
|
+
constructor() {
|
|
12
|
+
super('sparc', 'Execute SPARC methodology phases');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async execute(args, context) {
|
|
16
|
+
const [mode, ...taskArgs] = args;
|
|
17
|
+
const task = taskArgs.join(' ');
|
|
18
|
+
|
|
19
|
+
const modes = {
|
|
20
|
+
'spec': 'Specification - Requirements analysis and user story definition',
|
|
21
|
+
'pseudo': 'Pseudocode - Algorithm design and logic flow',
|
|
22
|
+
'arch': 'Architecture - System design and component structure',
|
|
23
|
+
'refine': 'Refinement - Iterative improvement and optimization',
|
|
24
|
+
'complete': 'Completion - Final implementation and testing'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (!mode || !modes[mode]) {
|
|
28
|
+
return {
|
|
29
|
+
success: false,
|
|
30
|
+
error: `Invalid mode. Available modes: ${Object.keys(modes).join(', ')}`,
|
|
31
|
+
usage: '/sparc <mode> <task_description>'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!task) {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
error: 'Task description required',
|
|
39
|
+
usage: `/sparc ${mode} <task_description>`
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log(`🎯 SPARC ${mode.toUpperCase()}: ${task}`);
|
|
44
|
+
|
|
45
|
+
const sparcPrompt = `
|
|
46
|
+
🎯 **SPARC Methodology - ${modes[mode]}**
|
|
47
|
+
|
|
48
|
+
**Task**: ${task}
|
|
49
|
+
|
|
50
|
+
**Phase**: ${mode.toUpperCase()}
|
|
51
|
+
**Description**: ${modes[mode]}
|
|
52
|
+
|
|
53
|
+
**Instructions for ${mode.toUpperCase()} phase**:
|
|
54
|
+
${this.getPhaseInstructions(mode)}
|
|
55
|
+
|
|
56
|
+
**Execute this SPARC phase now**:
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
prompt: sparcPrompt,
|
|
62
|
+
mode: `sparc-${mode}`,
|
|
63
|
+
task: task,
|
|
64
|
+
timestamp: new Date().toISOString()
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getPhaseInstructions(mode) {
|
|
69
|
+
const instructions = {
|
|
70
|
+
'spec': `
|
|
71
|
+
- Define clear requirements and acceptance criteria
|
|
72
|
+
- Create user stories and use cases
|
|
73
|
+
- Identify constraints and assumptions
|
|
74
|
+
- Specify input/output requirements
|
|
75
|
+
- Document functional and non-functional requirements`,
|
|
76
|
+
|
|
77
|
+
'pseudo': `
|
|
78
|
+
- Break down the problem into logical steps
|
|
79
|
+
- Write high-level algorithm pseudocode
|
|
80
|
+
- Define data structures and flow
|
|
81
|
+
- Identify key functions and modules
|
|
82
|
+
- Plan error handling and edge cases`,
|
|
83
|
+
|
|
84
|
+
'arch': `
|
|
85
|
+
- Design system architecture and components
|
|
86
|
+
- Define interfaces and APIs
|
|
87
|
+
- Choose appropriate patterns and technologies
|
|
88
|
+
- Plan data flow and storage
|
|
89
|
+
- Consider scalability and maintainability`,
|
|
90
|
+
|
|
91
|
+
'refine': `
|
|
92
|
+
- Review and improve the design
|
|
93
|
+
- Optimize algorithms and data structures
|
|
94
|
+
- Refactor for clarity and efficiency
|
|
95
|
+
- Add comprehensive error handling
|
|
96
|
+
- Enhance documentation and comments`,
|
|
97
|
+
|
|
98
|
+
'complete': `
|
|
99
|
+
- Implement the final solution
|
|
100
|
+
- Write comprehensive tests
|
|
101
|
+
- Perform integration testing
|
|
102
|
+
- Document usage and deployment
|
|
103
|
+
- Prepare for production deployment`
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return instructions[mode] || 'Execute the specified SPARC phase';
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default SparcCommand;
|