snow-flow 1.3.7 ā 1.3.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/cli.js +104 -46
- package/dist/version.js +13 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -153,6 +153,7 @@ program
|
|
|
153
153
|
(objective.toLowerCase().includes('flow') &&
|
|
154
154
|
!objective.toLowerCase().includes('workflow') &&
|
|
155
155
|
!objective.toLowerCase().includes('data flow'));
|
|
156
|
+
let xmlFlowResult = null;
|
|
156
157
|
if (isFlowDesignerTask) {
|
|
157
158
|
cliLogger.info('\nš§ Flow Designer Detected - Using XML-First Approach!');
|
|
158
159
|
cliLogger.info('š Creating production-ready ServiceNow flow XML...');
|
|
@@ -238,6 +239,7 @@ program
|
|
|
238
239
|
// Generate XML
|
|
239
240
|
cliLogger.info('šļø Generating production XML...');
|
|
240
241
|
const result = generateProductionFlowXML(flowDef);
|
|
242
|
+
xmlFlowResult = { ...result, flowDefinition: flowDef };
|
|
241
243
|
cliLogger.info(`\nā
XML Generated Successfully!`);
|
|
242
244
|
cliLogger.info(`š File saved to: ${result.filePath}`);
|
|
243
245
|
cliLogger.info(`š Flow structure:`);
|
|
@@ -267,8 +269,8 @@ program
|
|
|
267
269
|
else {
|
|
268
270
|
cliLogger.info('š Use the import instructions above to deploy to ServiceNow');
|
|
269
271
|
}
|
|
270
|
-
cliLogger.info('\nš”
|
|
271
|
-
|
|
272
|
+
cliLogger.info('\nš” XML template generated. Now launching Queen Agent for intelligent flow development...');
|
|
273
|
+
// DO NOT RETURN HERE - Continue to Queen Agent orchestration!
|
|
272
274
|
}
|
|
273
275
|
catch (error) {
|
|
274
276
|
cliLogger.error('ā XML flow generation failed:', error instanceof Error ? error.message : String(error));
|
|
@@ -278,7 +280,7 @@ program
|
|
|
278
280
|
// Start real Claude Code orchestration
|
|
279
281
|
try {
|
|
280
282
|
// Generate the Queen Agent orchestration prompt
|
|
281
|
-
const orchestrationPrompt = buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated, sessionId);
|
|
283
|
+
const orchestrationPrompt = buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated, sessionId, xmlFlowResult);
|
|
282
284
|
cliLogger.info('\nš Initializing Queen Agent orchestration...');
|
|
283
285
|
cliLogger.info('šÆ Queen Agent will coordinate the following:');
|
|
284
286
|
cliLogger.info(` - Analyze objective: "${objective}"`);
|
|
@@ -342,22 +344,31 @@ program
|
|
|
342
344
|
});
|
|
343
345
|
}
|
|
344
346
|
else {
|
|
345
|
-
cliLogger.info('\n
|
|
346
|
-
cliLogger.info('\
|
|
347
|
+
cliLogger.info('\nš SNOW-FLOW ORCHESTRATION COMPLETE!');
|
|
348
|
+
cliLogger.info('š¤ Now it\'s time for Claude Code agents to do the work...\n');
|
|
349
|
+
cliLogger.info('š QUEEN AGENT ORCHESTRATION PROMPT FOR CLAUDE CODE:');
|
|
347
350
|
cliLogger.info('='.repeat(80));
|
|
348
351
|
cliLogger.info(orchestrationPrompt);
|
|
349
352
|
cliLogger.info('='.repeat(80));
|
|
350
|
-
cliLogger.info('\nā
|
|
351
|
-
cliLogger.info('š
|
|
352
|
-
cliLogger.info(' 1. Copy the
|
|
353
|
-
cliLogger.info(' 2.
|
|
354
|
-
cliLogger.info(' 3.
|
|
355
|
-
cliLogger.info(' 4.
|
|
353
|
+
cliLogger.info('\nā
Snow-Flow has prepared the orchestration!');
|
|
354
|
+
cliLogger.info('š CRITICAL NEXT STEPS:');
|
|
355
|
+
cliLogger.info(' 1. Copy the ENTIRE prompt above');
|
|
356
|
+
cliLogger.info(' 2. Paste it into Claude Code (the AI assistant)');
|
|
357
|
+
cliLogger.info(' 3. Claude Code will spawn multiple specialized agents as workhorses');
|
|
358
|
+
cliLogger.info(' 4. These agents will implement your flow with all required logic');
|
|
359
|
+
cliLogger.info(' 5. Agents will enhance the basic XML template with real functionality');
|
|
360
|
+
cliLogger.info('\nšÆ Remember:');
|
|
361
|
+
cliLogger.info(' - Snow-Flow = Orchestrator (coordinates the work)');
|
|
362
|
+
cliLogger.info(' - Claude Code = Workhorses (implement the solution)');
|
|
363
|
+
if (xmlFlowResult) {
|
|
364
|
+
cliLogger.info(`\nš XML template saved at: ${xmlFlowResult.filePath}`);
|
|
365
|
+
cliLogger.info(' ā ļø This is just a BASIC template - agents must enhance it!');
|
|
366
|
+
}
|
|
356
367
|
if (isAuthenticated && options.autoDeploy) {
|
|
357
|
-
cliLogger.info('
|
|
368
|
+
cliLogger.info('\nš Deployment Mode: Agents will create REAL artifacts in ServiceNow');
|
|
358
369
|
}
|
|
359
370
|
else {
|
|
360
|
-
cliLogger.info('
|
|
371
|
+
cliLogger.info('\nš Planning Mode: Analysis and recommendations only');
|
|
361
372
|
}
|
|
362
373
|
cliLogger.info(`\nš¾ Session ID for monitoring: ${sessionId}`);
|
|
363
374
|
}
|
|
@@ -371,45 +382,75 @@ program
|
|
|
371
382
|
});
|
|
372
383
|
}
|
|
373
384
|
});
|
|
374
|
-
// Helper function to execute Claude Code directly
|
|
385
|
+
// Helper function to execute Claude Code directly
|
|
375
386
|
async function executeClaudeCode(prompt) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
//
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
387
|
+
cliLogger.info('š¤ Preparing Claude Code agent orchestration...');
|
|
388
|
+
try {
|
|
389
|
+
// Check if Claude CLI is available
|
|
390
|
+
const { execSync } = require('child_process');
|
|
391
|
+
try {
|
|
392
|
+
execSync('which claude', { stdio: 'ignore' });
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
cliLogger.warn('ā ļø Claude Code CLI not found in PATH');
|
|
396
|
+
cliLogger.info('š Please install Claude Desktop or copy the prompt manually');
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
// Check for MCP config
|
|
400
|
+
const mcpConfigPath = (0, path_1.join)(process.cwd(), '.mcp.json');
|
|
401
|
+
const hasMcpConfig = (0, fs_2.existsSync)(mcpConfigPath);
|
|
402
|
+
// Launch Claude Code with MCP config
|
|
403
|
+
const claudeArgs = hasMcpConfig
|
|
404
|
+
? ['--mcp-config', '.mcp.json', '.']
|
|
405
|
+
: ['.'];
|
|
406
|
+
cliLogger.info('š Launching Claude Code automatically...');
|
|
407
|
+
if (hasMcpConfig) {
|
|
408
|
+
cliLogger.info('š§ Starting Claude Code with ServiceNow MCP servers...');
|
|
409
|
+
}
|
|
410
|
+
// Start Claude Code process in interactive mode
|
|
411
|
+
const claudeProcess = (0, child_process_1.spawn)('claude', claudeArgs, {
|
|
412
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
413
|
+
shell: true,
|
|
414
|
+
env: { ...process.env }
|
|
415
|
+
});
|
|
416
|
+
// Send the prompt to Claude Code
|
|
417
|
+
cliLogger.info('š Sending orchestration prompt to Claude Code...');
|
|
418
|
+
cliLogger.info('š Claude Code interface opening...\n');
|
|
419
|
+
// Write prompt and close stdin to trigger execution
|
|
420
|
+
claudeProcess.stdin.write(prompt);
|
|
421
|
+
claudeProcess.stdin.end();
|
|
422
|
+
// Set up process monitoring
|
|
423
|
+
return new Promise((resolve) => {
|
|
424
|
+
claudeProcess.on('close', (code) => {
|
|
397
425
|
if (code === 0) {
|
|
398
|
-
cliLogger.info(
|
|
399
|
-
|
|
426
|
+
cliLogger.info('\nā
Claude Code session completed successfully!');
|
|
427
|
+
resolve(true);
|
|
400
428
|
}
|
|
401
429
|
else {
|
|
402
|
-
|
|
403
|
-
|
|
430
|
+
cliLogger.warn(`\nā ļø Claude Code session ended with code: ${code}`);
|
|
431
|
+
resolve(false);
|
|
404
432
|
}
|
|
405
433
|
});
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
434
|
+
claudeProcess.on('error', (error) => {
|
|
435
|
+
cliLogger.error(`ā Failed to start Claude Code: ${error.message}`);
|
|
436
|
+
resolve(false);
|
|
409
437
|
});
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
438
|
+
// Set timeout (configurable via environment variable)
|
|
439
|
+
const timeoutMinutes = parseInt(process.env.SNOW_FLOW_TIMEOUT_MINUTES || '0');
|
|
440
|
+
if (timeoutMinutes > 0) {
|
|
441
|
+
setTimeout(() => {
|
|
442
|
+
cliLogger.warn(`ā±ļø Claude Code session timeout (${timeoutMinutes} minutes), terminating...`);
|
|
443
|
+
claudeProcess.kill('SIGTERM');
|
|
444
|
+
resolve(false);
|
|
445
|
+
}, timeoutMinutes * 60 * 1000);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
cliLogger.error('ā Error launching Claude Code:', error instanceof Error ? error.message : String(error));
|
|
451
|
+
cliLogger.info('š Claude Code prompt generated - please copy and paste manually');
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
413
454
|
}
|
|
414
455
|
// Real-time monitoring dashboard for Claude Code process
|
|
415
456
|
function startMonitoringDashboard(claudeProcess) {
|
|
@@ -519,7 +560,7 @@ async function executeWithClaude(claudeCommand, prompt, resolve) {
|
|
|
519
560
|
});
|
|
520
561
|
}
|
|
521
562
|
// Helper function to build Queen Agent orchestration prompt
|
|
522
|
-
function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId) {
|
|
563
|
+
function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId, xmlFlowResult = null) {
|
|
523
564
|
// Check if intelligent features are enabled
|
|
524
565
|
const hasIntelligentFeatures = options.autoPermissions || options.smartDiscovery ||
|
|
525
566
|
options.liveTesting || options.autoDeploy || options.autoRollback ||
|
|
@@ -539,6 +580,23 @@ You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mis
|
|
|
539
580
|
- **Supporting Agents**: ${taskAnalysis.supportingAgents.join(', ')}
|
|
540
581
|
- **Estimated Total Agents**: ${taskAnalysis.estimatedAgentCount}
|
|
541
582
|
- **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
|
|
583
|
+
|
|
584
|
+
${xmlFlowResult ? `## š§ Flow Designer XML Template Generated
|
|
585
|
+
An initial XML template has been created as a starting point:
|
|
586
|
+
- **File Path**: ${xmlFlowResult.filePath}
|
|
587
|
+
- **Flow Name**: ${xmlFlowResult.flowDefinition.name}
|
|
588
|
+
- **Table**: ${xmlFlowResult.flowDefinition.table}
|
|
589
|
+
- **Activities**: ${xmlFlowResult.flowDefinition.activities.length}
|
|
590
|
+
|
|
591
|
+
**IMPORTANT**: This is just a basic template! You must spawn Claude Code agents to:
|
|
592
|
+
1. Analyze the detailed requirements from the objective
|
|
593
|
+
2. Design the complete flow logic with all activities
|
|
594
|
+
3. Add approval steps, notifications, conditions, etc.
|
|
595
|
+
4. Test the flow implementation
|
|
596
|
+
5. Deploy to ServiceNow
|
|
597
|
+
|
|
598
|
+
The XML template is saved but needs significant enhancement by your agents!
|
|
599
|
+
` : ''}
|
|
542
600
|
- **Recommended Team**: ${getTeamRecommendation(taskAnalysis.taskType)}
|
|
543
601
|
|
|
544
602
|
## š Table Discovery Intelligence
|
package/dist/version.js
CHANGED
|
@@ -7,12 +7,24 @@ exports.VERSION_INFO = exports.VERSION = void 0;
|
|
|
7
7
|
exports.getVersionString = getVersionString;
|
|
8
8
|
exports.getLatestFeatures = getLatestFeatures;
|
|
9
9
|
exports.isLatestVersion = isLatestVersion;
|
|
10
|
-
exports.VERSION = '1.3.
|
|
10
|
+
exports.VERSION = '1.3.9';
|
|
11
11
|
exports.VERSION_INFO = {
|
|
12
12
|
version: exports.VERSION,
|
|
13
13
|
name: 'Snow-Flow',
|
|
14
14
|
description: 'ServiceNow Queen Agent - Hive-Mind Intelligence for ServiceNow Development',
|
|
15
15
|
features: {
|
|
16
|
+
'1.3.9': [
|
|
17
|
+
'š CLAUDE CODE AUTO-LAUNCH: Restored automatic Claude Code launching',
|
|
18
|
+
'š¤ PROCESS SPAWNING: Claude CLI detection and proper process spawning',
|
|
19
|
+
'š PROMPT INJECTION: Automatic prompt sending to Claude Code via stdin',
|
|
20
|
+
'š§ MCP INTEGRATION: Auto-loads MCP servers when .mcp.json exists'
|
|
21
|
+
],
|
|
22
|
+
'1.3.8': [
|
|
23
|
+
'š¤ CLAUDE CODE FIX: Restored proper Claude Code agent spawning',
|
|
24
|
+
'š SWARM ORCHESTRATION: Snow-flow is orchestrator, Claude Code agents are workhorses',
|
|
25
|
+
'š§ NO EARLY EXIT: Flow Designer tasks now continue to full agent orchestration',
|
|
26
|
+
'š CLEAR INSTRUCTIONS: Better messaging about Snow-flow vs Claude Code roles'
|
|
27
|
+
],
|
|
16
28
|
'1.3.7': [
|
|
17
29
|
'š RELEASE VERSION: Combined all fixes from 1.3.2-1.3.6 into stable release',
|
|
18
30
|
'ā
ZOD VALIDATION: Completely fixed all configuration schema issues',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"description": "ServiceNow Queen Agent - Hive-Mind Intelligence for ServiceNow Development inspired by claude-flow. Transform complex workflows into elegant one-command orchestration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|