snow-flow 1.3.1 → 1.3.2

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 (40) hide show
  1. package/.claude-flow/queen/queen-memory.db +0 -0
  2. package/.env.example +249 -14
  3. package/CLAUDE.md +185 -24
  4. package/README.md +55 -5
  5. package/dist/api/error-handling.js +898 -4
  6. package/dist/api/performance-optimizer.js +3 -2
  7. package/dist/cli.js +590 -200
  8. package/dist/config/snow-flow-config.js +320 -8
  9. package/dist/health/system-health.js +288 -21
  10. package/dist/mcp/http-transport-wrapper.js +65 -4
  11. package/dist/mcp/servicenow-automation-mcp-refactored.js +90 -9
  12. package/dist/mcp/servicenow-deployment-mcp-refactored.js +151 -2
  13. package/dist/mcp/servicenow-deployment-mcp.js +828 -15
  14. package/dist/mcp/servicenow-integration-mcp-refactored.js +100 -9
  15. package/dist/mcp/servicenow-intelligent-mcp.js +198 -7
  16. package/dist/mcp/servicenow-memory-mcp.js +2 -1
  17. package/dist/mcp/servicenow-operations-mcp-refactored.js +3 -2
  18. package/dist/mcp/servicenow-xml-flow-mcp.js +671 -0
  19. package/dist/mcp/shared/base-mcp-server.js +1356 -8
  20. package/dist/mcp/shared/mcp-resource-manager.js +304 -0
  21. package/dist/queen/parallel-agent-engine.js +26 -8
  22. package/dist/queen/servicenow-queen.js +47 -44
  23. package/dist/sparc/sparc-help.js +37 -26
  24. package/dist/sparc/team-sparc.js +60 -16
  25. package/dist/utils/action-type-cache.js +2 -1
  26. package/dist/utils/mcp-config-manager.js +7 -3
  27. package/dist/utils/mcp-server-manager.js +7 -3
  28. package/dist/utils/servicenow-client.js +134 -107
  29. package/dist/utils/servicenow-id-generator.js +171 -0
  30. package/dist/utils/snow-oauth.js +13 -8
  31. package/dist/utils/widget-template-generator.js +1690 -0
  32. package/dist/utils/xml-first-flow-generator.js +473 -0
  33. package/flow-update-sets/flow_build_automated_approval_flow_with_notifications_flow.xml +203 -0
  34. package/flow-update-sets/flow_create_approval_flow_for_equipment_requests_flow.xml +206 -0
  35. package/flow-update-sets/flow_create_equipment_approval_flow_with_manager_approv_flow.xml +254 -0
  36. package/flow-update-sets/iphone_15_pro_approval_flow.xml +203 -0
  37. package/flow-update-sets/test_iphone_approval_flow_flow.xml +303 -0
  38. package/package.json +2 -1
  39. package/test-config.js +55 -0
  40. package/test-real-monitoring.js +184 -0
@@ -1,40 +1,51 @@
1
1
  "use strict";
2
2
  /**
3
- * SPARC Help System - Placeholder Implementation
4
- * TODO: Implement comprehensive help system for SPARC teams
3
+ * SPARC Help System - Provides guidance to working functionality
5
4
  */
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  exports.displayTeamHelp = displayTeamHelp;
8
7
  function displayTeamHelp() {
9
8
  console.log(`
10
- 🚧 SPARC Team Help - Under Development
9
+ šŸŽÆ SPARC Team Development - Available Now!
11
10
 
12
- This functionality is not yet implemented.
11
+ The SPARC team functionality you're looking for is available through the SWARM system:
13
12
 
14
- Planned SPARC Teams:
15
- - Widget Development Team (Frontend + Backend + UI/UX + Platform + QA)
16
- - Flow Development Team (Process + Trigger + Data + Integration + Security)
17
- - Application Development Team (Database + Business Logic + Interface + Security + Performance)
18
- - Adaptive Team (Dynamic assembly based on requirements)
13
+ šŸ’” INSTEAD OF SPARC COMMANDS, USE:
14
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
15
+ │ āœ… WORKING ALTERNATIVES (Use These!) │
16
+ ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
17
+ │ snow-flow swarm "create incident dashboard widget" │
18
+ │ snow-flow swarm "build approval workflow for equipment" │
19
+ │ snow-flow swarm "develop mobile app with authentication" │
20
+ │ snow-flow queen "create ServiceNow integration" │
21
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
19
22
 
20
- Planned Individual Specialists:
21
- - Frontend Developer
22
- - Backend Developer
23
- - Security Engineer
24
- - Data Specialist
25
- - Integration Expert
23
+ šŸš€ SWARM FEATURES (What you get automatically):
24
+ • 🧠 Multi-Agent Coordination: Automatic spawning of specialized agents
25
+ • šŸŽÆ Smart Discovery: Finds existing artifacts to prevent duplication
26
+ • šŸ”„ Live Testing: Real-time testing on your ServiceNow instance
27
+ • šŸ“‹ Update Set Management: Automatic change tracking
28
+ • šŸš€ Auto-Deployment: Direct deployment to ServiceNow when ready
29
+ • šŸ›”ļø Error Recovery: Automatic rollback on failures
26
30
 
27
- TODO: Implement comprehensive SPARC team system with:
28
- - Team coordination
29
- - Specialist roles
30
- - Quality gates
31
- - Shared memory
32
- - Progress monitoring
31
+ šŸ”§ SWARM OPTIONS:
32
+ • --strategy: research, development, analysis, testing, optimization
33
+ • --mode: centralized, distributed, hierarchical, mesh, hybrid
34
+ • --max-agents: Control team size (default: 5)
35
+ • --parallel: Enable parallel execution
36
+ • --monitor: Real-time progress monitoring
33
37
 
34
- For now, use the core snow-flow commands:
35
- - snow-flow swarm "<objective>"
36
- - snow-flow queen "<objective>"
37
- - snow-flow auth login
38
- - snow-flow status
38
+ šŸ“š EXAMPLES:
39
+ • Widget Team: snow-flow swarm "create dashboard with charts" --strategy development
40
+ • Flow Team: snow-flow swarm "approval workflow with notifications" --mode hierarchical
41
+ • Full App: snow-flow swarm "mobile ITSM solution" --max-agents 8 --monitor
42
+
43
+ šŸŽÆ GET STARTED:
44
+ 1. snow-flow auth login # Authenticate with ServiceNow
45
+ 2. snow-flow swarm "your objective" # Everything else is automatic!
46
+ 3. snow-flow status # Check system health
47
+
48
+ The swarm system provides all the team coordination, specialist roles, and
49
+ quality gates that SPARC was designed to deliver - and it's working now!
39
50
  `);
40
51
  }
@@ -1,37 +1,81 @@
1
1
  "use strict";
2
2
  /**
3
- * SPARC Team Executor - Placeholder Implementation
4
- * TODO: Implement full team-based SPARC functionality
3
+ * SPARC Team Executor - Redirects to Working Functionality
4
+ * Provides helpful guidance to users who try SPARC commands
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.TeamSparcExecutor = void 0;
8
8
  class TeamSparcExecutor {
9
9
  static async execute(teamType, task, options = {}) {
10
- console.log(`🚧 SPARC Team execution not yet implemented`);
11
- console.log(`Team Type: ${teamType}`);
12
- console.log(`Task: ${task}`);
13
- console.log(`Options:`, options);
10
+ console.log(`\nšŸŽÆ SPARC Team: ${teamType.toUpperCase()}`);
11
+ console.log(`šŸ“‹ Task: ${task}\n`);
12
+ // Determine the best swarm strategy based on team type
13
+ const strategyMap = {
14
+ 'widget': 'development',
15
+ 'flow': 'development',
16
+ 'app': 'development',
17
+ 'application': 'development',
18
+ 'adaptive': 'analysis'
19
+ };
20
+ const strategy = strategyMap[teamType.toLowerCase()] || 'development';
21
+ const swarmCommand = `snow-flow swarm "${task}"${strategy !== 'development' ? ` --strategy ${strategy}` : ''}${options.parallel ? ' --parallel' : ''}${options.monitor ? ' --monitor' : ''}`;
22
+ console.log(`āœ… SPARC Team functionality is available through the SWARM system!\n`);
23
+ console.log(`šŸš€ Run this command instead:\n`);
24
+ console.log(` ${swarmCommand}\n`);
25
+ console.log(`šŸ’” The SWARM system provides:`);
26
+ console.log(` • Multi-agent team coordination (what SPARC was designed for)`);
27
+ console.log(` • Specialist role assignment automatically`);
28
+ console.log(` • Real-time progress monitoring`);
29
+ console.log(` • Direct ServiceNow integration\n`);
30
+ console.log(`šŸ“š For more options: snow-flow swarm --help`);
31
+ console.log(`šŸ†˜ For detailed help: snow-flow sparc-help\n`);
14
32
  return {
15
- success: false,
16
- message: 'SPARC Team functionality is not yet implemented. This is a placeholder.',
33
+ success: true,
34
+ message: 'SPARC functionality redirected to working SWARM system',
17
35
  teamType,
18
36
  task,
19
37
  options,
20
- todo: 'Implement full SPARC team coordination system'
38
+ recommendedCommand: swarmCommand,
39
+ redirectedTo: 'swarm'
21
40
  };
22
41
  }
23
42
  static async executeSpecialist(specialistType, task, options = {}) {
24
- console.log(`🚧 SPARC Specialist execution not yet implemented`);
25
- console.log(`Specialist Type: ${specialistType}`);
26
- console.log(`Task: ${task}`);
27
- console.log(`Options:`, options);
43
+ console.log(`\nšŸ‘Øā€šŸ’» SPARC ${specialistType.toUpperCase()} Specialist`);
44
+ console.log(`šŸ“‹ Task: ${task}\n`);
45
+ // Map specialist types to swarm strategies
46
+ const specialistStrategyMap = {
47
+ 'frontend': 'development',
48
+ 'backend': 'development',
49
+ 'security': 'analysis',
50
+ 'database': 'development',
51
+ 'process': 'development',
52
+ 'trigger': 'development',
53
+ 'data': 'analysis',
54
+ 'logic': 'development',
55
+ 'interface': 'development',
56
+ 'uiux': 'development',
57
+ 'platform': 'development'
58
+ };
59
+ const strategy = specialistStrategyMap[specialistType.toLowerCase()] || 'development';
60
+ const swarmCommand = `snow-flow swarm "${task}" --strategy ${strategy}${options.monitor ? ' --monitor' : ''}${options.dryRun ? ' --dry-run' : ''}`;
61
+ console.log(`āœ… SPARC Specialist functionality is available through the SWARM system!\n`);
62
+ console.log(`šŸš€ Run this command instead:\n`);
63
+ console.log(` ${swarmCommand}\n`);
64
+ console.log(`šŸ’” The SWARM system automatically:`);
65
+ console.log(` • Spawns ${specialistType} specialists when needed`);
66
+ console.log(` • Coordinates with other specialists automatically`);
67
+ console.log(` • Provides real-time progress monitoring`);
68
+ console.log(` • Integrates directly with ServiceNow\n`);
69
+ console.log(`šŸ“š For more options: snow-flow swarm --help`);
70
+ console.log(`šŸ†˜ For detailed help: snow-flow sparc-help\n`);
28
71
  return {
29
- success: false,
30
- message: 'SPARC Specialist functionality is not yet implemented. This is a placeholder.',
72
+ success: true,
73
+ message: 'SPARC specialist functionality redirected to working SWARM system',
31
74
  specialistType,
32
75
  task,
33
76
  options,
34
- todo: 'Implement individual specialist execution system'
77
+ recommendedCommand: swarmCommand,
78
+ redirectedTo: 'swarm'
35
79
  };
36
80
  }
37
81
  }
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ActionTypeCache = void 0;
11
11
  const fs_1 = __importDefault(require("fs"));
12
12
  const path_1 = __importDefault(require("path"));
13
+ const os_1 = __importDefault(require("os"));
13
14
  const logger_js_1 = require("./logger.js");
14
15
  class ActionTypeCache {
15
16
  constructor(client) {
@@ -18,7 +19,7 @@ class ActionTypeCache {
18
19
  this.cacheLoaded = false;
19
20
  this.logger = new logger_js_1.Logger('ActionTypeCache');
20
21
  this.client = client;
21
- this.cacheDir = path_1.default.join(process.cwd(), '.snow-flow', 'cache');
22
+ this.cacheDir = path_1.default.join(process.env.SNOW_FLOW_HOME || path_1.default.join(os_1.default.homedir(), '.snow-flow'), 'cache');
22
23
  this.ensureCacheDir();
23
24
  }
24
25
  ensureCacheDir() {
@@ -3,11 +3,15 @@
3
3
  * Centralized MCP Configuration Manager
4
4
  * Handles dynamic configuration loading for all MCP servers
5
5
  */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
6
9
  Object.defineProperty(exports, "__esModule", { value: true });
7
10
  exports.mcpConfig = exports.MCPConfigManager = void 0;
8
11
  const dotenv_1 = require("dotenv");
9
12
  const fs_1 = require("fs");
10
13
  const path_1 = require("path");
14
+ const os_1 = __importDefault(require("os"));
11
15
  const logger_js_1 = require("./logger.js");
12
16
  // Load environment variables
13
17
  (0, dotenv_1.config)();
@@ -43,7 +47,7 @@ class MCPConfigManager {
43
47
  },
44
48
  memory: {
45
49
  provider: process.env.MEMORY_PROVIDER || 'file',
46
- path: process.env.MEMORY_PATH || (0, path_1.join)(process.cwd(), '.snow-flow', 'memory'),
50
+ path: process.env.MEMORY_PATH || (0, path_1.join)(process.env.SNOW_FLOW_HOME || (0, path_1.join)(os_1.default.homedir(), '.snow-flow'), 'memory'),
47
51
  connectionString: process.env.MEMORY_CONNECTION_STRING,
48
52
  maxSize: parseInt(process.env.MEMORY_MAX_SIZE || '1000'),
49
53
  ttl: parseInt(process.env.MEMORY_TTL || '86400') // 24 hours
@@ -58,11 +62,11 @@ class MCPConfigManager {
58
62
  logging: {
59
63
  level: process.env.LOG_LEVEL || 'info',
60
64
  enableFileLogging: process.env.ENABLE_FILE_LOGGING === 'true',
61
- logPath: process.env.LOG_PATH || (0, path_1.join)(process.cwd(), '.snow-flow', 'logs')
65
+ logPath: process.env.LOG_PATH || (0, path_1.join)(process.env.SNOW_FLOW_HOME || (0, path_1.join)(os_1.default.homedir(), '.snow-flow'), 'logs')
62
66
  }
63
67
  };
64
68
  // Try to load from config file if it exists
65
- const configPath = (0, path_1.join)(process.cwd(), '.snow-flow', 'config.json');
69
+ const configPath = (0, path_1.join)(process.env.SNOW_FLOW_HOME || (0, path_1.join)(os_1.default.homedir(), '.snow-flow'), 'config.json');
66
70
  if ((0, fs_1.existsSync)(configPath)) {
67
71
  try {
68
72
  const fileConfig = JSON.parse((0, fs_1.readFileSync)(configPath, 'utf8'));
@@ -2,25 +2,29 @@
2
2
  /**
3
3
  * MCP Server Manager - Manages background MCP servers for Claude Code integration
4
4
  */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
5
8
  Object.defineProperty(exports, "__esModule", { value: true });
6
9
  exports.MCPServerManager = void 0;
7
10
  const child_process_1 = require("child_process");
8
11
  const fs_1 = require("fs");
9
12
  const path_1 = require("path");
10
13
  const events_1 = require("events");
14
+ const os_1 = __importDefault(require("os"));
11
15
  class MCPServerManager extends events_1.EventEmitter {
12
16
  constructor(configPath) {
13
17
  super();
14
18
  this.servers = new Map();
15
- this.configPath = configPath || (0, path_1.join)(process.cwd(), '.snow-flow', 'mcp-servers.json');
16
- this.logPath = (0, path_1.join)(process.cwd(), '.snow-flow', 'logs');
19
+ this.configPath = configPath || (0, path_1.join)(process.env.SNOW_FLOW_HOME || (0, path_1.join)(os_1.default.homedir(), '.snow-flow'), 'mcp-servers.json');
20
+ this.logPath = (0, path_1.join)(process.env.SNOW_FLOW_HOME || (0, path_1.join)(os_1.default.homedir(), '.snow-flow'), 'logs');
17
21
  }
18
22
  /**
19
23
  * Initialize MCP server manager
20
24
  */
21
25
  async initialize() {
22
26
  // Ensure directories exist
23
- await fs_1.promises.mkdir((0, path_1.join)(process.cwd(), '.snow-flow'), { recursive: true });
27
+ await fs_1.promises.mkdir(process.env.SNOW_FLOW_HOME || (0, path_1.join)(os_1.default.homedir(), '.snow-flow'), { recursive: true });
24
28
  await fs_1.promises.mkdir(this.logPath, { recursive: true });
25
29
  // Load existing configuration
26
30
  await this.loadConfiguration();