claude-flow-novice 1.5.12 → 1.5.14

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 (53) hide show
  1. package/.claude/agents/analysis/code-review/analyze-code-quality.md +160 -177
  2. package/.claude/agents/architecture/system-design/arch-system-design.md +118 -153
  3. package/.claude-flow-novice/dist/mcp/auth.js +347 -0
  4. package/.claude-flow-novice/dist/mcp/claude-code-wrapper.js +717 -0
  5. package/.claude-flow-novice/dist/mcp/claude-flow-tools.js +1365 -0
  6. package/.claude-flow-novice/dist/mcp/client.js +201 -0
  7. package/.claude-flow-novice/dist/mcp/index.js +192 -0
  8. package/.claude-flow-novice/dist/mcp/integrate-wrapper.js +85 -0
  9. package/.claude-flow-novice/dist/mcp/lifecycle-manager.js +348 -0
  10. package/.claude-flow-novice/dist/mcp/load-balancer.js +386 -0
  11. package/.claude-flow-novice/dist/mcp/mcp-config-manager.js +1362 -0
  12. package/.claude-flow-novice/dist/mcp/mcp-server-novice-simplified.js +583 -0
  13. package/.claude-flow-novice/dist/mcp/mcp-server-novice.js +723 -0
  14. package/.claude-flow-novice/dist/mcp/mcp-server-sdk.js +649 -0
  15. package/.claude-flow-novice/dist/mcp/mcp-server.js +2256 -0
  16. package/.claude-flow-novice/dist/mcp/orchestration-integration.js +800 -0
  17. package/.claude-flow-novice/dist/mcp/performance-monitor.js +489 -0
  18. package/.claude-flow-novice/dist/mcp/protocol-manager.js +376 -0
  19. package/.claude-flow-novice/dist/mcp/router.js +220 -0
  20. package/.claude-flow-novice/dist/mcp/ruv-swarm-tools.js +671 -0
  21. package/.claude-flow-novice/dist/mcp/ruv-swarm-wrapper.js +254 -0
  22. package/.claude-flow-novice/dist/mcp/server-with-wrapper.js +32 -0
  23. package/.claude-flow-novice/dist/mcp/server-wrapper-mode.js +26 -0
  24. package/.claude-flow-novice/dist/mcp/server.js +539 -0
  25. package/.claude-flow-novice/dist/mcp/session-manager.js +338 -0
  26. package/.claude-flow-novice/dist/mcp/sparc-modes.js +455 -0
  27. package/.claude-flow-novice/dist/mcp/swarm-tools.js +903 -0
  28. package/.claude-flow-novice/dist/mcp/tools.js +426 -0
  29. package/.claude-flow-novice/dist/src/cli/commands/swarm.js +23 -1
  30. package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
  31. package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +42 -102
  32. package/.claude-flow-novice/dist/src/config/web-portal-config.js +2 -1
  33. package/.claude-flow-novice/dist/src/config/web-portal-config.js.map +1 -1
  34. package/.claude-flow-novice/dist/src/coordination/swarm-coordinator-factory.js +36 -0
  35. package/.claude-flow-novice/dist/src/coordination/swarm-coordinator-factory.js.map +1 -0
  36. package/.claude-flow-novice/dist/src/preferences/user-preference-manager.js +371 -0
  37. package/.claude-flow-novice/dist/src/preferences/user-preference-manager.js.map +1 -0
  38. package/.claude-flow-novice/dist/src/validators/index.js +12 -0
  39. package/.claude-flow-novice/dist/src/validators/index.js.map +1 -0
  40. package/.claude-flow-novice/dist/src/validators/swarm-init-validator.js +261 -0
  41. package/.claude-flow-novice/dist/src/validators/swarm-init-validator.js.map +1 -0
  42. package/.claude-flow-novice/dist/src/validators/todowrite-batching-validator.js +204 -0
  43. package/.claude-flow-novice/dist/src/validators/todowrite-batching-validator.js.map +1 -0
  44. package/.claude-flow-novice/dist/src/validators/todowrite-integration.js +189 -0
  45. package/.claude-flow-novice/dist/src/validators/todowrite-integration.js.map +1 -0
  46. package/.claude-flow-novice/dist/src/web/portal-server.js +12 -5
  47. package/.claude-flow-novice/dist/src/web/portal-server.js.map +1 -1
  48. package/config/hooks/post-edit-pipeline.js +231 -10
  49. package/package.json +4 -2
  50. package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
  51. package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
  52. package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
  53. package/src/cli/simple-commands/init/templates/CLAUDE.md +4 -1
@@ -5,11 +5,12 @@
5
5
  * Comprehensive validation, formatting, and quality checks after file edits
6
6
  */
7
7
 
8
- const path = require('path');
9
- const fs = require('fs');
10
- const { exec, spawn } = require('child_process');
11
- const util = require('util');
12
- const execAsync = util.promisify(exec);
8
+ import path from 'path';
9
+ import fs from 'fs';
10
+ import { exec, spawn } from 'child_process';
11
+ import { promisify } from 'util';
12
+
13
+ const execAsync = promisify(exec);
13
14
 
14
15
  class PostEditPipeline {
15
16
  constructor() {
@@ -386,12 +387,13 @@ class PostEditPipeline {
386
387
  }
387
388
  }
388
389
 
389
- async run(filePath) {
390
+ async run(filePath, options = {}) {
390
391
  const language = this.detectLanguage(filePath);
391
392
  const results = {
392
393
  file: filePath,
393
394
  language,
394
395
  timestamp: new Date().toISOString(),
396
+ agentContext: this.extractAgentContext(options),
395
397
  steps: {},
396
398
  summary: {
397
399
  success: true,
@@ -464,6 +466,9 @@ class PostEditPipeline {
464
466
  // Generate summary
465
467
  this.printSummary(results);
466
468
 
469
+ // Log to root file
470
+ await this.logToRootFile(results);
471
+
467
472
  return results;
468
473
  }
469
474
 
@@ -478,6 +483,195 @@ class PostEditPipeline {
478
483
  }
479
484
  }
480
485
 
486
+ extractAgentContext(options = {}) {
487
+ // Extract agent information from various sources
488
+ const context = {
489
+ memoryKey: options.memoryKey || process.env.MEMORY_KEY || null,
490
+ agentType: options.agentType || process.env.AGENT_TYPE || null,
491
+ agentName: options.agentName || process.env.AGENT_NAME || null,
492
+ swarmId: options.swarmId || process.env.SWARM_ID || null,
493
+ taskId: options.taskId || process.env.TASK_ID || null,
494
+ sessionId: options.sessionId || process.env.SESSION_ID || null
495
+ };
496
+
497
+ // Parse agent info from memory key (format: "swarm/[agent]/[step]")
498
+ if (context.memoryKey && !context.agentType) {
499
+ const keyParts = context.memoryKey.split('/');
500
+ if (keyParts.length >= 2) {
501
+ context.agentType = keyParts[1];
502
+ }
503
+ if (keyParts.length >= 3) {
504
+ context.taskStep = keyParts[2];
505
+ }
506
+ }
507
+
508
+ return context;
509
+ }
510
+
511
+ formatTimestamp(isoTimestamp) {
512
+ const date = new Date(isoTimestamp);
513
+ const month = String(date.getMonth() + 1).padStart(2, '0');
514
+ const day = String(date.getDate()).padStart(2, '0');
515
+ const year = date.getFullYear();
516
+ const hours = String(date.getHours()).padStart(2, '0');
517
+ const minutes = String(date.getMinutes()).padStart(2, '0');
518
+
519
+ return `${month}/${day}/${year} ${hours}:${minutes}`;
520
+ }
521
+
522
+ async logToRootFile(results) {
523
+ const logPath = path.join(process.cwd(), 'post-edit-pipeline.log');
524
+ const MAX_ENTRIES = 500;
525
+
526
+ // Create log entry
527
+ const logEntry = {
528
+ timestamp: results.timestamp,
529
+ displayTimestamp: this.formatTimestamp(results.timestamp),
530
+ file: results.file,
531
+ language: results.language,
532
+ agent: results.agentContext,
533
+ status: results.summary.success ? 'PASSED' : 'FAILED',
534
+ errors: results.summary.errors.length,
535
+ warnings: results.summary.warnings.length,
536
+ suggestions: results.summary.suggestions.length,
537
+ steps: {
538
+ formatting: results.steps.formatting?.success || false,
539
+ linting: results.steps.linting?.success || false,
540
+ typeCheck: results.steps.typeCheck?.success || false,
541
+ dependencies: results.steps.dependencies?.success || false,
542
+ security: results.steps.security?.success || false,
543
+ tests: results.steps.tests?.success || false
544
+ },
545
+ details: {
546
+ errors: results.summary.errors,
547
+ warnings: results.summary.warnings,
548
+ suggestions: results.summary.suggestions
549
+ }
550
+ };
551
+
552
+ // Format log entry with separator
553
+ const logText = [
554
+ '═'.repeat(80),
555
+ `TIMESTAMP: ${logEntry.displayTimestamp}`,
556
+ `FILE: ${logEntry.file}`,
557
+ `LANGUAGE: ${logEntry.language}`,
558
+ `STATUS: ${logEntry.status}`,
559
+ '',
560
+ 'AGENT CONTEXT:',
561
+ ` Memory Key: ${logEntry.agent.memoryKey || 'N/A'}`,
562
+ ` Agent Type: ${logEntry.agent.agentType || 'N/A'}`,
563
+ ` Agent Name: ${logEntry.agent.agentName || 'N/A'}`,
564
+ ` Swarm ID: ${logEntry.agent.swarmId || 'N/A'}`,
565
+ ` Task ID: ${logEntry.agent.taskId || 'N/A'}`,
566
+ ` Session ID: ${logEntry.agent.sessionId || 'N/A'}`,
567
+ '',
568
+ 'VALIDATION STEPS:',
569
+ ` āœ“ Formatting: ${logEntry.steps.formatting ? 'āœ…' : 'āŒ'}`,
570
+ ` āœ“ Linting: ${logEntry.steps.linting ? 'āœ…' : 'āŒ'}`,
571
+ ` āœ“ Type Check: ${logEntry.steps.typeCheck ? 'āœ…' : 'āŒ'}`,
572
+ ` āœ“ Dependencies: ${logEntry.steps.dependencies ? 'āœ…' : 'āŒ'}`,
573
+ ` āœ“ Security: ${logEntry.steps.security ? 'āœ…' : 'āŒ'}`,
574
+ ` āœ“ Tests: ${logEntry.steps.tests ? 'āœ…' : 'āŒ'}`,
575
+ '',
576
+ `ERRORS (${logEntry.errors}):`,
577
+ ...logEntry.details.errors.map(e => ` • ${e}`),
578
+ '',
579
+ `WARNINGS (${logEntry.warnings}):`,
580
+ ...logEntry.details.warnings.map(w => ` • ${w}`),
581
+ '',
582
+ `SUGGESTIONS (${logEntry.suggestions}):`,
583
+ ...logEntry.details.suggestions.map(s => ` • ${s}`),
584
+ '',
585
+ 'JSON:',
586
+ JSON.stringify(logEntry, null, 2),
587
+ '═'.repeat(80),
588
+ '',
589
+ ''
590
+ ].join('\n');
591
+
592
+ try {
593
+ // Read existing log and parse entries
594
+ let existingEntries = [];
595
+ if (fs.existsSync(logPath)) {
596
+ const existingLog = fs.readFileSync(logPath, 'utf8');
597
+
598
+ // Split by separator and parse JSON from each entry
599
+ const entrySections = existingLog.split('═'.repeat(80)).filter(s => s.trim());
600
+
601
+ for (const section of entrySections) {
602
+ const jsonMatch = section.match(/JSON:\s*(\{[\s\S]*?\})\s*$/m);
603
+ if (jsonMatch) {
604
+ try {
605
+ const entry = JSON.parse(jsonMatch[1]);
606
+ existingEntries.push(entry);
607
+ } catch (e) {
608
+ // Skip malformed entries
609
+ }
610
+ }
611
+ }
612
+ }
613
+
614
+ // Add new entry at the beginning
615
+ existingEntries.unshift(logEntry);
616
+
617
+ // Enforce 500 entry limit - keep newest 500
618
+ if (existingEntries.length > MAX_ENTRIES) {
619
+ existingEntries = existingEntries.slice(0, MAX_ENTRIES);
620
+ console.log(`\nšŸ—‘ļø Trimmed log to ${MAX_ENTRIES} most recent entries`);
621
+ }
622
+
623
+ // Rebuild log file with all entries
624
+ const rebuiltLog = existingEntries.map(entry => {
625
+ const formattedEntry = [
626
+ '═'.repeat(80),
627
+ `TIMESTAMP: ${entry.displayTimestamp}`,
628
+ `FILE: ${entry.file}`,
629
+ `LANGUAGE: ${entry.language}`,
630
+ `STATUS: ${entry.status}`,
631
+ '',
632
+ 'AGENT CONTEXT:',
633
+ ` Memory Key: ${entry.agent.memoryKey || 'N/A'}`,
634
+ ` Agent Type: ${entry.agent.agentType || 'N/A'}`,
635
+ ` Agent Name: ${entry.agent.agentName || 'N/A'}`,
636
+ ` Swarm ID: ${entry.agent.swarmId || 'N/A'}`,
637
+ ` Task ID: ${entry.agent.taskId || 'N/A'}`,
638
+ ` Session ID: ${entry.agent.sessionId || 'N/A'}`,
639
+ '',
640
+ 'VALIDATION STEPS:',
641
+ ` āœ“ Formatting: ${entry.steps.formatting ? 'āœ…' : 'āŒ'}`,
642
+ ` āœ“ Linting: ${entry.steps.linting ? 'āœ…' : 'āŒ'}`,
643
+ ` āœ“ Type Check: ${entry.steps.typeCheck ? 'āœ…' : 'āŒ'}`,
644
+ ` āœ“ Dependencies: ${entry.steps.dependencies ? 'āœ…' : 'āŒ'}`,
645
+ ` āœ“ Security: ${entry.steps.security ? 'āœ…' : 'āŒ'}`,
646
+ ` āœ“ Tests: ${entry.steps.tests ? 'āœ…' : 'āŒ'}`,
647
+ '',
648
+ `ERRORS (${entry.errors}):`,
649
+ ...(entry.details.errors || []).map(e => ` • ${e}`),
650
+ '',
651
+ `WARNINGS (${entry.warnings}):`,
652
+ ...(entry.details.warnings || []).map(w => ` • ${w}`),
653
+ '',
654
+ `SUGGESTIONS (${entry.suggestions}):`,
655
+ ...(entry.details.suggestions || []).map(s => ` • ${s}`),
656
+ '',
657
+ 'JSON:',
658
+ JSON.stringify(entry, null, 2),
659
+ '═'.repeat(80),
660
+ '',
661
+ ''
662
+ ].join('\n');
663
+
664
+ return formattedEntry;
665
+ }).join('');
666
+
667
+ fs.writeFileSync(logPath, rebuiltLog, 'utf8');
668
+
669
+ console.log(`\nšŸ“ Logged to: ${logPath} (${existingEntries.length}/${MAX_ENTRIES} entries)`);
670
+ } catch (error) {
671
+ console.error(`āš ļø Failed to write log: ${error.message}`);
672
+ }
673
+ }
674
+
481
675
  printSummary(results) {
482
676
  console.log('\n' + '='.repeat(60));
483
677
  console.log('šŸ“Š VALIDATION SUMMARY');
@@ -513,7 +707,7 @@ async function main() {
513
707
  const filePath = process.argv[2];
514
708
 
515
709
  if (!filePath) {
516
- console.error('Usage: post-edit-pipeline.js <file-path>');
710
+ console.error('Usage: post-edit-pipeline.js <file-path> [--memory-key <key>] [--agent-type <type>] [--agent-name <name>]');
517
711
  process.exit(1);
518
712
  }
519
713
 
@@ -522,18 +716,45 @@ async function main() {
522
716
  process.exit(1);
523
717
  }
524
718
 
719
+ // Parse command-line options for agent context
720
+ const options = {};
721
+ const args = process.argv.slice(3);
722
+
723
+ for (let i = 0; i < args.length; i++) {
724
+ if (args[i] === '--memory-key' && args[i + 1]) {
725
+ options.memoryKey = args[i + 1];
726
+ i++;
727
+ } else if (args[i] === '--agent-type' && args[i + 1]) {
728
+ options.agentType = args[i + 1];
729
+ i++;
730
+ } else if (args[i] === '--agent-name' && args[i + 1]) {
731
+ options.agentName = args[i + 1];
732
+ i++;
733
+ } else if (args[i] === '--swarm-id' && args[i + 1]) {
734
+ options.swarmId = args[i + 1];
735
+ i++;
736
+ } else if (args[i] === '--task-id' && args[i + 1]) {
737
+ options.taskId = args[i + 1];
738
+ i++;
739
+ } else if (args[i] === '--session-id' && args[i + 1]) {
740
+ options.sessionId = args[i + 1];
741
+ i++;
742
+ }
743
+ }
744
+
525
745
  const pipeline = new PostEditPipeline();
526
- const results = await pipeline.run(filePath);
746
+ const results = await pipeline.run(filePath, options);
527
747
 
528
748
  // Exit with error code if validation failed
529
749
  process.exit(results.summary.success ? 0 : 1);
530
750
  }
531
751
 
532
- if (require.main === module) {
752
+ // Run if called directly
753
+ if (import.meta.url === `file://${process.argv[1]}`) {
533
754
  main().catch(error => {
534
755
  console.error('Pipeline error:', error);
535
756
  process.exit(1);
536
757
  });
537
758
  }
538
759
 
539
- module.exports = PostEditPipeline;
760
+ export default PostEditPipeline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "1.5.12",
3
+ "version": "1.5.14",
4
4
  "description": "Standalone Claude Flow for beginners - AI agent orchestration made easy with enhanced TDD testing pipeline. Enhanced init command creates complete agent system, MCP configuration with 30 essential tools, and automated hooks with single-file testing, real-time coverage analysis, and advanced validation. Fully standalone with zero external dependencies, complete project setup in one command.",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": ".claude-flow-novice/dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "optimize:validate:hardware": "node scripts/optimization/config-validator.js validate hardware",
40
40
  "optimize:validate:monitoring": "node scripts/optimization/config-validator.js validate monitoring",
41
41
  "build": "scripts/build/unified-builder.sh safe",
42
- "build:swc": "swc src -d .claude-flow-novice/dist --only='**/*.ts' --config-file .swcrc && cp -r src/slash-commands .claude-flow-novice/dist/src/ && cp -r src/cli/simple-commands/hooks .claude-flow-novice/dist/src/cli/simple-commands/ && cp -r src/cli/simple-commands/init/templates .claude-flow-novice/dist/src/cli/simple-commands/init/ && cp src/cli/simple-commands/init/index.js .claude-flow-novice/dist/src/cli/simple-commands/init/ && cp src/cli/simple-commands/init.js .claude-flow-novice/dist/src/cli/simple-commands/ && cp src/cli/simple-commands/mcp.js .claude-flow-novice/dist/src/cli/simple-commands/ && cp src/mcp/*.js .claude-flow-novice/dist/src/mcp/ && cp -r .claude/agents .claude-flow-novice/.claude/",
42
+ "build:swc": "swc src -d .claude-flow-novice/dist --only='**/*.ts' --config-file .swcrc && cp -r src/slash-commands .claude-flow-novice/dist/src/ && cp -r src/cli/simple-commands/hooks .claude-flow-novice/dist/src/cli/simple-commands/ && cp -r src/cli/simple-commands/init/templates .claude-flow-novice/dist/src/cli/simple-commands/init/ && cp src/cli/simple-commands/init/index.js .claude-flow-novice/dist/src/cli/simple-commands/init/ && cp src/cli/simple-commands/init.js .claude-flow-novice/dist/src/cli/simple-commands/ && cp src/cli/simple-commands/mcp.js .claude-flow-novice/dist/src/cli/simple-commands/ && cp src/mcp/*.js .claude-flow-novice/dist/src/mcp/ && mkdir -p .claude-flow-novice/dist/mcp && cp .claude-flow-novice/dist/src/mcp/*.js .claude-flow-novice/dist/mcp/ && cp -r .claude/agents .claude-flow-novice/.claude/",
43
43
  "build:types": "tsc --project config/typescript/tsconfig.json --emitDeclarationOnly --outDir .claude-flow-novice/dist --skipLibCheck",
44
44
  "build:watch": "swc src -d .claude-flow-novice/dist --watch --config-file .swcrc && cp -r src/slash-commands .claude-flow-novice/dist/src/ && cp -r src/cli/simple-commands/hooks .claude-flow-novice/dist/src/cli/simple-commands/ && cp -r src/cli/simple-commands/init/templates .claude-flow-novice/dist/src/cli/simple-commands/init/ && npm run copy:agents",
45
45
  "build:legacy": "scripts/build/unified-builder.sh migration",
@@ -278,8 +278,10 @@
278
278
  "eslint-plugin-react": "^7.37.5",
279
279
  "express": "^5.1.0",
280
280
  "jest": "^29.7.0",
281
+ "node-fetch": "^3.3.2",
281
282
  "playwright": "^1.55.1",
282
283
  "prettier": "^3.1.1",
284
+ "socket.io-client": "^4.8.1",
283
285
  "ts-jest": "^29.4.0",
284
286
  "tsx": "^4.6.2",
285
287
  "typescript": "^5.6.3"
@@ -0,0 +1,9 @@
1
+ {
2
+ "startTime": 1759273280996,
3
+ "totalTasks": 1,
4
+ "successfulTasks": 1,
5
+ "failedTasks": 0,
6
+ "totalAgents": 0,
7
+ "activeAgents": 0,
8
+ "neuralEvents": 0
9
+ }
@@ -0,0 +1,10 @@
1
+ [
2
+ {
3
+ "id": "cmd-hooks-1759273281054",
4
+ "type": "hooks",
5
+ "success": true,
6
+ "duration": 38.100503,
7
+ "timestamp": 1759273281092,
8
+ "metadata": {}
9
+ }
10
+ ]
@@ -14,6 +14,9 @@
14
14
  5. **NEVER WORK SOLO** - Spawn multiple agents in parallel for ALL significant tasks
15
15
  6. **NEVER SAVE TO ROOT** - Organize files in appropriate subdirectories
16
16
  7. **USE CLAUDE CODE'S TASK TOOL** - For spawning agents concurrently, not just MCP
17
+ 8. **USE THE CFN LOOP** - For a self correcting dev loop that saves time and resources
18
+ 9. **DO NOT CREATE GUIDES NOR REPORT FILES** - unless specifically asked.
19
+ 10. **Use spartan language** - no fluff encouraged
17
20
 
18
21
  ### 🚫 WHEN YOU MUST USE AGENTS (MANDATORY)
19
22
 
@@ -321,7 +324,7 @@ claude mcp add claude-flow-novice npx claude-flow-novice mcp start
321
324
  - `/fullstack "goal"` - Launch full-stack development team with consensus validation
322
325
  - `/swarm`, `/sparc`, `/hooks` - Other slash commands (auto-discovered)
323
326
 
324
- ## šŸ”„ MANDATORY DEVELOPMENT FLOW LOOP
327
+ ## šŸ”„ MANDATORY CFN LOOP
325
328
 
326
329
  **YOU MUST FOLLOW THIS LOOP FOR ALL NON-TRIVIAL WORK:**
327
330