claude-flow-novice 1.1.7 → 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 +14 -14
- 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,216 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CLI Integration for Slash Commands
|
|
5
|
+
*
|
|
6
|
+
* Integrates slash commands with the main CLI system
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { globalRegistry, executeSlashCommand } from './register-all-commands.js';
|
|
10
|
+
import { SlashCommand } from '../core/slash-command.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CLI Slash Command Handler
|
|
14
|
+
*/
|
|
15
|
+
export class CliSlashHandler {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.registry = globalRegistry;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Handle CLI input and execute slash commands
|
|
22
|
+
* @param {string[]} args - CLI arguments
|
|
23
|
+
*/
|
|
24
|
+
async handleCliInput(args) {
|
|
25
|
+
if (args.length === 0) {
|
|
26
|
+
this.showHelp();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const command = args[0];
|
|
31
|
+
|
|
32
|
+
// Handle help commands
|
|
33
|
+
if (command === 'help' || command === '--help' || command === '-h') {
|
|
34
|
+
if (args.length > 1) {
|
|
35
|
+
this.showCommandHelp(args[1]);
|
|
36
|
+
} else {
|
|
37
|
+
this.showHelp();
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Handle list commands
|
|
43
|
+
if (command === 'list' || command === 'ls') {
|
|
44
|
+
this.listCommands();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Execute slash command
|
|
49
|
+
const slashCommand = `/${command}`;
|
|
50
|
+
const slashArgs = args.slice(1);
|
|
51
|
+
const input = `${slashCommand} ${slashArgs.join(' ')}`.trim();
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const result = await executeSlashCommand(input);
|
|
55
|
+
|
|
56
|
+
if (result.success) {
|
|
57
|
+
if (result.result && result.result.prompt) {
|
|
58
|
+
console.log(result.result.prompt);
|
|
59
|
+
} else {
|
|
60
|
+
console.log('✅ Command executed successfully');
|
|
61
|
+
if (result.result) {
|
|
62
|
+
console.log(JSON.stringify(result.result, null, 2));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
console.error(`❌ ${result.error}`);
|
|
67
|
+
if (result.suggestions && result.suggestions.length > 0) {
|
|
68
|
+
console.log(`Did you mean: ${result.suggestions.join(', ')}?`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error(`❌ CLI Error: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Show general help
|
|
78
|
+
*/
|
|
79
|
+
showHelp() {
|
|
80
|
+
console.log(this.registry.generateHelpText());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Show help for specific command
|
|
85
|
+
* @param {string} commandName - Command name
|
|
86
|
+
*/
|
|
87
|
+
showCommandHelp(commandName) {
|
|
88
|
+
const helpResult = this.registry.getHelp(commandName);
|
|
89
|
+
|
|
90
|
+
if (helpResult.success) {
|
|
91
|
+
const help = helpResult.help;
|
|
92
|
+
console.log(`
|
|
93
|
+
🚀 **${help.name.toUpperCase()} COMMAND**
|
|
94
|
+
`);
|
|
95
|
+
console.log(`**Description:** ${help.description}`);
|
|
96
|
+
console.log(`**Usage:** ${help.usage}`);
|
|
97
|
+
|
|
98
|
+
if (help.examples && help.examples.length > 0) {
|
|
99
|
+
console.log(`
|
|
100
|
+
**Examples:**`);
|
|
101
|
+
help.examples.forEach(example => {
|
|
102
|
+
console.log(` ${example}`);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
console.error(`❌ ${helpResult.error}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* List all available commands
|
|
112
|
+
*/
|
|
113
|
+
listCommands() {
|
|
114
|
+
const commands = this.registry.listCommands();
|
|
115
|
+
|
|
116
|
+
console.log('
|
|
117
|
+
🚀 **AVAILABLE SLASH COMMANDS**
|
|
118
|
+
');
|
|
119
|
+
|
|
120
|
+
commands.forEach(cmd => {
|
|
121
|
+
console.log(`/${cmd.name} - ${cmd.description}`);
|
|
122
|
+
if (cmd.aliases.length > 0) {
|
|
123
|
+
console.log(` Aliases: ${cmd.aliases.map(a => `/${a}`).join(', ')}`);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
console.log(`
|
|
128
|
+
Total: ${commands.length} commands available`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Interactive CLI mode
|
|
134
|
+
*/
|
|
135
|
+
export class InteractiveCliMode {
|
|
136
|
+
constructor() {
|
|
137
|
+
this.handler = new CliSlashHandler();
|
|
138
|
+
this.running = false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Start interactive mode
|
|
143
|
+
*/
|
|
144
|
+
async start() {
|
|
145
|
+
this.running = true;
|
|
146
|
+
|
|
147
|
+
console.log('🚀 Claude-Flow Interactive Slash Command Mode');
|
|
148
|
+
console.log('Type commands without the leading "/" or "help" for assistance');
|
|
149
|
+
console.log('Type "exit" to quit\n');
|
|
150
|
+
|
|
151
|
+
// Note: In a real implementation, you would use readline or similar
|
|
152
|
+
// This is a simplified version for demonstration
|
|
153
|
+
process.stdin.setEncoding('utf8');
|
|
154
|
+
|
|
155
|
+
process.stdin.on('readable', async () => {
|
|
156
|
+
const chunk = process.stdin.read();
|
|
157
|
+
if (chunk !== null) {
|
|
158
|
+
const input = chunk.trim();
|
|
159
|
+
|
|
160
|
+
if (input === 'exit' || input === 'quit') {
|
|
161
|
+
this.stop();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (input) {
|
|
166
|
+
const args = input.split(' ');
|
|
167
|
+
await this.handler.handleCliInput(args);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (this.running) {
|
|
171
|
+
process.stdout.write('claude-flow> ');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
process.stdout.write('claude-flow> ');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Stop interactive mode
|
|
181
|
+
*/
|
|
182
|
+
stop() {
|
|
183
|
+
this.running = false;
|
|
184
|
+
console.log('\n👋 Goodbye!');
|
|
185
|
+
process.exit(0);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Main CLI entry point
|
|
191
|
+
* @param {string[]} args - Command line arguments
|
|
192
|
+
*/
|
|
193
|
+
export async function runCliSlashCommands(args = process.argv.slice(2)) {
|
|
194
|
+
const handler = new CliSlashHandler();
|
|
195
|
+
|
|
196
|
+
// Check for interactive mode
|
|
197
|
+
if (args.includes('--interactive') || args.includes('-i')) {
|
|
198
|
+
const interactive = new InteractiveCliMode();
|
|
199
|
+
await interactive.start();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Handle standard CLI input
|
|
204
|
+
await handler.handleCliInput(args);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Auto-run if this script is executed directly
|
|
208
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
209
|
+
runCliSlashCommands();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export default {
|
|
213
|
+
CliSlashHandler,
|
|
214
|
+
InteractiveCliMode,
|
|
215
|
+
runCliSlashCommands
|
|
216
|
+
};
|