claude-flow-novice 1.1.9 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/.claude/SLASH-COMMANDS-READY.md +53 -0
  2. package/.claude/WORKING-SETUP.md +67 -0
  3. package/.claude/commands/README.md +157 -0
  4. package/.claude/commands/claude-md.js +237 -0
  5. package/.claude/commands/claude-md.md +64 -0
  6. package/.claude/commands/claude-soul.js +562 -0
  7. package/.claude/commands/claude-soul.md +22 -0
  8. package/.claude/commands/cli-integration.js +216 -0
  9. package/.claude/commands/dependency-recommendations.md +171 -0
  10. package/.claude/commands/github.js +638 -0
  11. package/.claude/commands/github.md +221 -0
  12. package/.claude/commands/hooks.js +648 -0
  13. package/.claude/commands/hooks.md +38 -0
  14. package/.claude/commands/index.js +115 -0
  15. package/.claude/commands/neural.js +572 -0
  16. package/.claude/commands/neural.md +39 -0
  17. package/.claude/commands/performance.js +582 -0
  18. package/.claude/commands/performance.md +41 -0
  19. package/.claude/commands/register-all-commands.js +314 -0
  20. package/.claude/commands/register-claude-md.js +82 -0
  21. package/.claude/commands/register-claude-soul.js +80 -0
  22. package/.claude/commands/sparc.js +110 -0
  23. package/.claude/commands/sparc.md +46 -0
  24. package/.claude/commands/suggest-improvements.md +95 -0
  25. package/.claude/commands/suggest-templates.md +147 -0
  26. package/.claude/commands/swarm.js +423 -0
  27. package/.claude/commands/swarm.md +24 -0
  28. package/.claude/commands/validate-commands.js +223 -0
  29. package/.claude/commands/workflow.js +606 -0
  30. package/.claude/commands/workflow.md +295 -0
  31. package/.claude/core/agent-manager.js +80 -0
  32. package/.claude/core/agent-manager.js.map +1 -0
  33. package/.claude/core/config.js +1221 -0
  34. package/.claude/core/config.js.map +1 -0
  35. package/.claude/core/event-bus.js +136 -0
  36. package/.claude/core/event-bus.js.map +1 -0
  37. package/.claude/core/index.js +6 -0
  38. package/.claude/core/index.js.map +1 -0
  39. package/.claude/core/json-persistence.js +112 -0
  40. package/.claude/core/json-persistence.js.map +1 -0
  41. package/.claude/core/logger.js +245 -0
  42. package/.claude/core/logger.js.map +1 -0
  43. package/.claude/core/orchestrator-fixed.js +236 -0
  44. package/.claude/core/orchestrator-fixed.js.map +1 -0
  45. package/.claude/core/orchestrator.js +1136 -0
  46. package/.claude/core/orchestrator.js.map +1 -0
  47. package/.claude/core/persistence.js +185 -0
  48. package/.claude/core/persistence.js.map +1 -0
  49. package/.claude/core/project-manager.js +80 -0
  50. package/.claude/core/project-manager.js.map +1 -0
  51. package/.claude/core/slash-command.js +24 -0
  52. package/.claude/core/version.js +35 -0
  53. package/.claude/core/version.js.map +1 -0
  54. package/.claude/slash-commands.json +92 -0
  55. package/dist/mcp/mcp-server-novice.js +14 -2
  56. package/dist/mcp/mcp-server-sdk.js +649 -0
  57. package/dist/mcp/mcp-server-with-slash-commands.js +776 -0
  58. package/dist/src/slash-commands/mcp-slash-integration.js +146 -0
  59. package/package.json +18 -6
  60. package/src/slash-commands/mcp-slash-integration.js +146 -0
@@ -0,0 +1,648 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Hooks Automation Slash Command
5
+ * Usage: /hooks <action> [options]
6
+ */
7
+
8
+ import { SlashCommand } from '../core/slash-command.js';
9
+
10
+ export class HooksCommand extends SlashCommand {
11
+ constructor() {
12
+ super('hooks', 'Manage automation hooks for agents and coordination');
13
+ }
14
+
15
+ getUsage() {
16
+ return '/hooks <action> [options]';
17
+ }
18
+
19
+ getExamples() {
20
+ return [
21
+ '/hooks enable - Enable all automation hooks',
22
+ '/hooks pre-task "Implement API" - Execute pre-task hook',
23
+ '/hooks post-edit "src/api.js" - Execute post-edit hook',
24
+ '/hooks session-start - Start coordination session',
25
+ '/hooks session-restore swarm-123 - Restore session state',
26
+ '/hooks notify "Task completed" - Send coordination notification',
27
+ '/hooks status - Check hook status',
28
+ '/hooks configure - Configure hook settings'
29
+ ];
30
+ }
31
+
32
+ async execute(args, context) {
33
+ const [action, ...params] = args;
34
+
35
+ if (!action) {
36
+ return this.formatResponse({
37
+ success: false,
38
+ error: 'Action required',
39
+ usage: this.getUsage(),
40
+ availableActions: [
41
+ 'enable', 'disable', 'status', 'configure',
42
+ 'pre-task', 'post-task', 'post-edit',
43
+ 'session-start', 'session-restore', 'session-end',
44
+ 'notify', 'validate', 'format'
45
+ ]
46
+ });
47
+ }
48
+
49
+ try {
50
+ let result;
51
+
52
+ switch (action.toLowerCase()) {
53
+ case 'enable':
54
+ result = await this.enableHooks(params);
55
+ break;
56
+
57
+ case 'disable':
58
+ result = await this.disableHooks(params);
59
+ break;
60
+
61
+ case 'status':
62
+ result = await this.getHookStatus(params);
63
+ break;
64
+
65
+ case 'configure':
66
+ result = await this.configureHooks(params);
67
+ break;
68
+
69
+ case 'pre-task':
70
+ result = await this.preTaskHook(params);
71
+ break;
72
+
73
+ case 'post-task':
74
+ result = await this.postTaskHook(params);
75
+ break;
76
+
77
+ case 'post-edit':
78
+ result = await this.postEditHook(params);
79
+ break;
80
+
81
+ case 'session-start':
82
+ result = await this.sessionStart(params);
83
+ break;
84
+
85
+ case 'session-restore':
86
+ result = await this.sessionRestore(params);
87
+ break;
88
+
89
+ case 'session-end':
90
+ result = await this.sessionEnd(params);
91
+ break;
92
+
93
+ case 'notify':
94
+ result = await this.sendNotification(params);
95
+ break;
96
+
97
+ case 'validate':
98
+ result = await this.validateCommand(params);
99
+ break;
100
+
101
+ case 'format':
102
+ result = await this.formatCode(params);
103
+ break;
104
+
105
+ default:
106
+ result = {
107
+ success: false,
108
+ error: `Unknown action: ${action}`,
109
+ availableActions: [
110
+ 'enable', 'disable', 'status', 'configure',
111
+ 'pre-task', 'post-task', 'post-edit',
112
+ 'session-start', 'session-restore', 'session-end',
113
+ 'notify', 'validate', 'format'
114
+ ]
115
+ };
116
+ }
117
+
118
+ return this.formatResponse(result);
119
+ } catch (error) {
120
+ return this.formatResponse({
121
+ success: false,
122
+ error: error.message,
123
+ action: action
124
+ });
125
+ }
126
+ }
127
+
128
+ async enableHooks(params) {
129
+ const [scope = 'all'] = params;
130
+
131
+ console.log(`⚙️ Enabling hooks for scope: ${scope}`);
132
+
133
+ const prompt = `
134
+ ⚙️ **ENABLE AUTOMATION HOOKS**
135
+
136
+ **Scope:** ${scope}
137
+
138
+ **Execute the following bash commands to enable hooks:**
139
+
140
+ \`\`\`bash
141
+ # Enable hooks automation
142
+ npx claude-flow@alpha hooks enable --scope ${scope}
143
+
144
+ # Configure auto-assignment
145
+ npx claude-flow@alpha hooks configure --auto-assign true
146
+
147
+ # Enable code formatting
148
+ npx claude-flow@alpha hooks configure --auto-format true
149
+
150
+ # Enable neural training
151
+ npx claude-flow@alpha hooks configure --neural-training true
152
+ \`\`\`
153
+
154
+ **Hook Types Enabled:**
155
+ - ✅ Pre-task validation and preparation
156
+ - ✅ Post-edit formatting and analysis
157
+ - ✅ Session management and state persistence
158
+ - ✅ Automatic agent assignment
159
+ - ✅ Neural pattern training
160
+ - ✅ Performance monitoring
161
+
162
+ **Execute these hook enablement commands now**:
163
+ `;
164
+
165
+ return {
166
+ success: true,
167
+ prompt: prompt,
168
+ scope: scope,
169
+ hooksEnabled: true
170
+ };
171
+ }
172
+
173
+ async disableHooks(params) {
174
+ const [scope = 'all'] = params;
175
+
176
+ console.log(`❌ Disabling hooks for scope: ${scope}`);
177
+
178
+ const prompt = `
179
+ ❌ **DISABLE AUTOMATION HOOKS**
180
+
181
+ **Scope:** ${scope}
182
+
183
+ **Execute the following bash commands to disable hooks:**
184
+
185
+ \`\`\`bash
186
+ # Disable hooks automation
187
+ npx claude-flow@alpha hooks disable --scope ${scope}
188
+
189
+ # Save current state before disabling
190
+ npx claude-flow@alpha hooks session-end --export-metrics true
191
+ \`\`\`
192
+
193
+ **Execute these hook disabling commands now**:
194
+ `;
195
+
196
+ return {
197
+ success: true,
198
+ prompt: prompt,
199
+ scope: scope,
200
+ hooksEnabled: false
201
+ };
202
+ }
203
+
204
+ async getHookStatus(params) {
205
+ console.log('📊 Checking hook status...');
206
+
207
+ const prompt = `
208
+ 📊 **HOOK STATUS CHECK**
209
+
210
+ **Check current hook configuration and status:**
211
+
212
+ \`\`\`bash
213
+ # Get hook status
214
+ npx claude-flow@alpha hooks status
215
+
216
+ # Check active sessions
217
+ npx claude-flow@alpha hooks sessions --list
218
+
219
+ # Get performance metrics
220
+ npx claude-flow@alpha hooks metrics --summary
221
+ \`\`\`
222
+
223
+ **Execute these status checks now**:
224
+ `;
225
+
226
+ return {
227
+ success: true,
228
+ prompt: prompt
229
+ };
230
+ }
231
+
232
+ async configureHooks(params) {
233
+ console.log('⚙️ Configuring hooks...');
234
+
235
+ const prompt = `
236
+ ⚙️ **CONFIGURE AUTOMATION HOOKS**
237
+
238
+ **Set up hook configuration:**
239
+
240
+ \`\`\`bash
241
+ # Configure hooks interactively
242
+ npx claude-flow@alpha hooks configure
243
+
244
+ # Or set specific options:
245
+ npx claude-flow@alpha hooks configure --auto-assign true
246
+ npx claude-flow@alpha hooks configure --auto-format true
247
+ npx claude-flow@alpha hooks configure --neural-training true
248
+ npx claude-flow@alpha hooks configure --session-persistence true
249
+ \`\`\`
250
+
251
+ **Configuration Options:**
252
+ - Auto-assignment by file type
253
+ - Code formatting and validation
254
+ - Neural pattern training
255
+ - Session state persistence
256
+ - Performance monitoring
257
+ - Error handling and recovery
258
+
259
+ **Execute hook configuration now**:
260
+ `;
261
+
262
+ return {
263
+ success: true,
264
+ prompt: prompt
265
+ };
266
+ }
267
+
268
+ async preTaskHook(params) {
269
+ const task = params.join(' ');
270
+
271
+ if (!task) {
272
+ return {
273
+ success: false,
274
+ error: 'Task description required for pre-task hook'
275
+ };
276
+ }
277
+
278
+ console.log(`🚀 Executing pre-task hook for: ${task}`);
279
+
280
+ const prompt = `
281
+ 🚀 **PRE-TASK HOOK**
282
+
283
+ **Task:** ${task}
284
+
285
+ **Execute pre-task preparation:**
286
+
287
+ \`\`\`bash
288
+ # Execute pre-task hook
289
+ npx claude-flow@alpha hooks pre-task --description "${task}"
290
+
291
+ # Auto-assign agents based on task type
292
+ npx claude-flow@alpha hooks auto-assign --task "${task}"
293
+
294
+ # Prepare resources and validate environment
295
+ npx claude-flow@alpha hooks validate --command "${task}"
296
+ \`\`\`
297
+
298
+ **Pre-Task Actions:**
299
+ - ✅ Agent assignment optimization
300
+ - ✅ Resource preparation
301
+ - ✅ Environment validation
302
+ - ✅ Dependency checking
303
+ - ✅ Context setup
304
+
305
+ **Execute these pre-task hooks now**:
306
+ `;
307
+
308
+ return {
309
+ success: true,
310
+ prompt: prompt,
311
+ task: task,
312
+ hookType: 'pre-task'
313
+ };
314
+ }
315
+
316
+ async postTaskHook(params) {
317
+ const [taskId] = params;
318
+
319
+ if (!taskId) {
320
+ return {
321
+ success: false,
322
+ error: 'Task ID required for post-task hook'
323
+ };
324
+ }
325
+
326
+ console.log(`✅ Executing post-task hook for: ${taskId}`);
327
+
328
+ const prompt = `
329
+ ✅ **POST-TASK HOOK**
330
+
331
+ **Task ID:** ${taskId}
332
+
333
+ **Execute post-task cleanup and analysis:**
334
+
335
+ \`\`\`bash
336
+ # Execute post-task hook
337
+ npx claude-flow@alpha hooks post-task --task-id "${taskId}"
338
+
339
+ # Train neural patterns from task completion
340
+ npx claude-flow@alpha hooks neural-train --task "${taskId}"
341
+
342
+ # Update performance metrics
343
+ npx claude-flow@alpha hooks metrics --update "${taskId}"
344
+ \`\`\`
345
+
346
+ **Post-Task Actions:**
347
+ - ✅ Performance analysis
348
+ - ✅ Neural pattern training
349
+ - ✅ Metrics collection
350
+ - ✅ Resource cleanup
351
+ - ✅ State persistence
352
+
353
+ **Execute these post-task hooks now**:
354
+ `;
355
+
356
+ return {
357
+ success: true,
358
+ prompt: prompt,
359
+ taskId: taskId,
360
+ hookType: 'post-task'
361
+ };
362
+ }
363
+
364
+ async postEditHook(params) {
365
+ const [file, memoryKey] = params;
366
+
367
+ if (!file) {
368
+ return {
369
+ success: false,
370
+ error: 'File path required for post-edit hook'
371
+ };
372
+ }
373
+
374
+ console.log(`📝 Executing post-edit hook for: ${file}`);
375
+
376
+ const prompt = `
377
+ 📝 **POST-EDIT HOOK**
378
+
379
+ **File:** ${file}
380
+ **Memory Key:** ${memoryKey || 'auto-generated'}
381
+
382
+ **Execute post-edit processing:**
383
+
384
+ \`\`\`bash
385
+ # Execute post-edit hook
386
+ npx claude-flow@alpha hooks post-edit --file "${file}"${memoryKey ? ` --memory-key "${memoryKey}"` : ''}
387
+
388
+ # Auto-format code
389
+ npx claude-flow@alpha hooks format --file "${file}"
390
+
391
+ # Store in coordination memory
392
+ npx claude-flow@alpha hooks memory-store --file "${file}" --context "edit"
393
+ \`\`\`
394
+
395
+ **Post-Edit Actions:**
396
+ - ✅ Code formatting and validation
397
+ - ✅ Memory storage for coordination
398
+ - ✅ Syntax checking
399
+ - ✅ Style consistency
400
+ - ✅ Documentation updates
401
+
402
+ **Execute these post-edit hooks now**:
403
+ `;
404
+
405
+ return {
406
+ success: true,
407
+ prompt: prompt,
408
+ file: file,
409
+ memoryKey: memoryKey,
410
+ hookType: 'post-edit'
411
+ };
412
+ }
413
+
414
+ async sessionStart(params) {
415
+ const [sessionType = 'coordination'] = params;
416
+
417
+ console.log(`🚀 Starting ${sessionType} session...`);
418
+
419
+ const prompt = `
420
+ 🚀 **START COORDINATION SESSION**
421
+
422
+ **Session Type:** ${sessionType}
423
+
424
+ **Initialize session:**
425
+
426
+ \`\`\`bash
427
+ # Start coordination session
428
+ npx claude-flow@alpha hooks session-start --type "${sessionType}"
429
+
430
+ # Initialize memory context
431
+ npx claude-flow@alpha hooks memory-init --session "${sessionType}-${Date.now()}"
432
+
433
+ # Set up monitoring
434
+ npx claude-flow@alpha hooks monitor-start
435
+ \`\`\`
436
+
437
+ **Session Features:**
438
+ - ✅ Cross-agent memory sharing
439
+ - ✅ State persistence
440
+ - ✅ Performance tracking
441
+ - ✅ Coordination protocols
442
+ - ✅ Error recovery
443
+
444
+ **Execute session initialization now**:
445
+ `;
446
+
447
+ return {
448
+ success: true,
449
+ prompt: prompt,
450
+ sessionType: sessionType,
451
+ sessionId: `${sessionType}-${Date.now()}`
452
+ };
453
+ }
454
+
455
+ async sessionRestore(params) {
456
+ const [sessionId] = params;
457
+
458
+ if (!sessionId) {
459
+ return {
460
+ success: false,
461
+ error: 'Session ID required for restoration'
462
+ };
463
+ }
464
+
465
+ console.log(`🔄 Restoring session: ${sessionId}`);
466
+
467
+ const prompt = `
468
+ 🔄 **RESTORE COORDINATION SESSION**
469
+
470
+ **Session ID:** ${sessionId}
471
+
472
+ **Restore session state:**
473
+
474
+ \`\`\`bash
475
+ # Restore session
476
+ npx claude-flow@alpha hooks session-restore --session-id "${sessionId}"
477
+
478
+ # Load memory context
479
+ npx claude-flow@alpha hooks memory-restore --session "${sessionId}"
480
+
481
+ # Resume monitoring
482
+ npx claude-flow@alpha hooks monitor-resume --session "${sessionId}"
483
+ \`\`\`
484
+
485
+ **Restoration Process:**
486
+ - ✅ Load previous state
487
+ - ✅ Restore memory context
488
+ - ✅ Resume agent coordination
489
+ - ✅ Continue task tracking
490
+ - ✅ Maintain continuity
491
+
492
+ **Execute session restoration now**:
493
+ `;
494
+
495
+ return {
496
+ success: true,
497
+ prompt: prompt,
498
+ sessionId: sessionId
499
+ };
500
+ }
501
+
502
+ async sessionEnd(params) {
503
+ const [exportMetrics = 'true'] = params;
504
+
505
+ console.log('💾 Ending coordination session...');
506
+
507
+ const prompt = `
508
+ 💾 **END COORDINATION SESSION**
509
+
510
+ **Export Metrics:** ${exportMetrics}
511
+
512
+ **Gracefully end session:**
513
+
514
+ \`\`\`bash
515
+ # End session with metrics export
516
+ npx claude-flow@alpha hooks session-end --export-metrics ${exportMetrics}
517
+
518
+ # Generate session summary
519
+ npx claude-flow@alpha hooks session-summary
520
+
521
+ # Clean up resources
522
+ npx claude-flow@alpha hooks cleanup
523
+ \`\`\`
524
+
525
+ **Session Cleanup:**
526
+ - ✅ Export performance metrics
527
+ - ✅ Generate session summary
528
+ - ✅ Persist important state
529
+ - ✅ Clean up temporary resources
530
+ - ✅ Archive session data
531
+
532
+ **Execute session termination now**:
533
+ `;
534
+
535
+ return {
536
+ success: true,
537
+ prompt: prompt,
538
+ exportMetrics: exportMetrics === 'true'
539
+ };
540
+ }
541
+
542
+ async sendNotification(params) {
543
+ const message = params.join(' ');
544
+
545
+ if (!message) {
546
+ return {
547
+ success: false,
548
+ error: 'Message required for notification'
549
+ };
550
+ }
551
+
552
+ console.log(`📢 Sending notification: ${message}`);
553
+
554
+ const prompt = `
555
+ 📢 **SEND COORDINATION NOTIFICATION**
556
+
557
+ **Message:** ${message}
558
+
559
+ **Send notification to swarm:**
560
+
561
+ \`\`\`bash
562
+ # Send notification
563
+ npx claude-flow@alpha hooks notify --message "${message}"
564
+
565
+ # Update coordination status
566
+ npx claude-flow@alpha hooks status-update --message "${message}"
567
+ \`\`\`
568
+
569
+ **Execute notification now**:
570
+ `;
571
+
572
+ return {
573
+ success: true,
574
+ prompt: prompt,
575
+ message: message
576
+ };
577
+ }
578
+
579
+ async validateCommand(params) {
580
+ const command = params.join(' ');
581
+
582
+ if (!command) {
583
+ return {
584
+ success: false,
585
+ error: 'Command required for validation'
586
+ };
587
+ }
588
+
589
+ console.log(`✅ Validating command: ${command}`);
590
+
591
+ const prompt = `
592
+ ✅ **VALIDATE COMMAND**
593
+
594
+ **Command:** ${command}
595
+
596
+ **Validate command safety and requirements:**
597
+
598
+ \`\`\`bash
599
+ # Validate command
600
+ npx claude-flow@alpha hooks validate --command "${command}"
601
+ \`\`\`
602
+
603
+ **Execute validation now**:
604
+ `;
605
+
606
+ return {
607
+ success: true,
608
+ prompt: prompt,
609
+ command: command
610
+ };
611
+ }
612
+
613
+ async formatCode(params) {
614
+ const [file] = params;
615
+
616
+ if (!file) {
617
+ return {
618
+ success: false,
619
+ error: 'File path required for formatting'
620
+ };
621
+ }
622
+
623
+ console.log(`🎨 Formatting code: ${file}`);
624
+
625
+ const prompt = `
626
+ 🎨 **FORMAT CODE**
627
+
628
+ **File:** ${file}
629
+
630
+ **Auto-format and validate code:**
631
+
632
+ \`\`\`bash
633
+ # Format code
634
+ npx claude-flow@alpha hooks format --file "${file}"
635
+ \`\`\`
636
+
637
+ **Execute code formatting now**:
638
+ `;
639
+
640
+ return {
641
+ success: true,
642
+ prompt: prompt,
643
+ file: file
644
+ };
645
+ }
646
+ }
647
+
648
+ export default HooksCommand;
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: "Automation hooks management"
3
+ argument-hint: "<action> [parameters]"
4
+ allowed-tools: ["Bash", "mcp__claude-flow-novice__memory_usage"]
5
+ ---
6
+
7
+ # Automation Hooks Management
8
+
9
+ Manage automation hooks for pre/post operations and session coordination.
10
+
11
+ **Action**: $ARGUMENTS
12
+
13
+ **Available Hook Actions**:
14
+ - `enable` - Enable all automation hooks
15
+ - `disable` - Disable automation hooks
16
+ - `pre-task "<description>"` - Execute pre-task hook
17
+ - `post-task "<task-id>"` - Execute post-task hook
18
+ - `session-start` - Start coordination session
19
+ - `session-end` - End session with summary
20
+ - `notify "<message>"` - Send notification to swarm
21
+
22
+ **Hook Types**:
23
+
24
+ ## Pre-Operation Hooks
25
+ - **Pre-Command**: Validate commands for safety
26
+ - **Pre-Edit**: Auto-assign agents by file type
27
+ - **Pre-Task**: Prepare resources and context
28
+
29
+ ## Post-Operation Hooks
30
+ - **Post-Command**: Track metrics and results
31
+ - **Post-Edit**: Auto-format code and update memory
32
+ - **Post-Task**: Store completion data
33
+
34
+ ## Session Hooks
35
+ - **Session Start**: Initialize coordination context
36
+ - **Session End**: Generate summaries and persist state
37
+
38
+ Execute the specified hook action and coordinate with the claude-flow system for automation.