snow-flow 1.3.12 โ†’ 1.3.15

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 CHANGED
@@ -197,60 +197,88 @@ program
197
197
  .option('--no-progress-monitoring', 'Disable progress monitoring')
198
198
  .option('--xml-first', 'Use XML-first approach for flow creation (MOST RELIABLE!)')
199
199
  .option('--xml-output <path>', 'Save generated XML to specific path (with --xml-first)')
200
+ .option('--verbose', 'Show detailed execution information')
200
201
  .action(async (objective, options) => {
201
- cliLogger.info(`\n๐Ÿš€ Starting ServiceNow Multi-Agent Swarm v${version_js_1.VERSION} - รฉรฉn command voor alles!`);
202
+ // Always show essential info
203
+ cliLogger.info(`\n๐Ÿš€ Snow-Flow v${version_js_1.VERSION}`);
202
204
  cliLogger.info(`๐Ÿ“‹ Objective: ${objective}`);
203
- cliLogger.info(`โš™๏ธ Strategy: ${options.strategy} | Mode: ${options.mode} | Max Agents: ${options.maxAgents}`);
204
- cliLogger.info(`๐Ÿ”„ Parallel: ${options.parallel ? 'Yes' : 'No'} | Monitor: ${options.monitor ? 'Yes' : 'No'}`);
205
- // Show new intelligent features
206
- cliLogger.info(`\n๐Ÿง  Intelligent Features:`);
207
- cliLogger.info(` ๐Ÿ” Auto Permissions: ${options.autoPermissions ? 'โœ… Yes' : 'โŒ No'}`);
208
- cliLogger.info(` ๐Ÿ” Smart Discovery: ${options.smartDiscovery ? 'โœ… Yes' : 'โŒ No'}`);
209
- cliLogger.info(` ๐Ÿงช Live Testing: ${options.liveTesting ? 'โœ… Yes' : 'โŒ No'}`);
210
- cliLogger.info(` ๐Ÿš€ Auto Deploy: ${options.autoDeploy ? 'โœ… DEPLOYMENT MODE - WILL CREATE REAL ARTIFACTS' : 'โŒ PLANNING MODE - ANALYSIS ONLY'}`);
211
- cliLogger.info(` ๐Ÿ”„ Auto Rollback: ${options.autoRollback ? 'โœ… Yes' : 'โŒ No'}`);
212
- cliLogger.info(` ๐Ÿ’พ Shared Memory: ${options.sharedMemory ? 'โœ… Yes' : 'โŒ No'}`);
213
- cliLogger.info(` ๐Ÿ“Š Progress Monitoring: ${options.progressMonitoring ? 'โœ… Yes' : 'โŒ No'}\n`);
205
+ // Only show detailed config in verbose mode
206
+ if (options.verbose) {
207
+ cliLogger.info(`โš™๏ธ Strategy: ${options.strategy} | Mode: ${options.mode} | Max Agents: ${options.maxAgents}`);
208
+ cliLogger.info(`๐Ÿ”„ Parallel: ${options.parallel ? 'Yes' : 'No'} | Monitor: ${options.monitor ? 'Yes' : 'No'}`);
209
+ // Show new intelligent features
210
+ cliLogger.info(`\n๐Ÿง  Intelligent Features:`);
211
+ cliLogger.info(` ๐Ÿ” Auto Permissions: ${options.autoPermissions ? 'โœ… Yes' : 'โŒ No'}`);
212
+ cliLogger.info(` ๐Ÿ” Smart Discovery: ${options.smartDiscovery ? 'โœ… Yes' : 'โŒ No'}`);
213
+ cliLogger.info(` ๐Ÿงช Live Testing: ${options.liveTesting ? 'โœ… Yes' : 'โŒ No'}`);
214
+ cliLogger.info(` ๐Ÿš€ Auto Deploy: ${options.autoDeploy ? 'โœ… DEPLOYMENT MODE - WILL CREATE REAL ARTIFACTS' : 'โŒ PLANNING MODE - ANALYSIS ONLY'}`);
215
+ cliLogger.info(` ๐Ÿ”„ Auto Rollback: ${options.autoRollback ? 'โœ… Yes' : 'โŒ No'}`);
216
+ cliLogger.info(` ๐Ÿ’พ Shared Memory: ${options.sharedMemory ? 'โœ… Yes' : 'โŒ No'}`);
217
+ cliLogger.info(` ๐Ÿ“Š Progress Monitoring: ${options.progressMonitoring ? 'โœ… Yes' : 'โŒ No'}\n`);
218
+ }
219
+ else if (options.autoDeploy) {
220
+ // In non-verbose mode, only show critical deployment warning
221
+ cliLogger.info(`๐Ÿš€ Auto-Deploy: ENABLED - Will create real artifacts in ServiceNow`);
222
+ }
214
223
  // Analyze the objective using intelligent agent detection
215
224
  const taskAnalysis = analyzeObjective(objective, parseInt(options.maxAgents));
216
- cliLogger.info(`๐ŸŽฏ Task Type: ${taskAnalysis.taskType}`);
217
- cliLogger.info(`๐Ÿง  Primary Agent: ${taskAnalysis.primaryAgent}`);
218
- cliLogger.info(`๐Ÿ‘ฅ Supporting Agents: ${taskAnalysis.supportingAgents.join(', ')}`);
219
- cliLogger.info(`๐Ÿ“Š Complexity: ${taskAnalysis.complexity} | Estimated Agents: ${taskAnalysis.estimatedAgentCount}`);
220
- cliLogger.info(`๐Ÿ”ง ServiceNow Artifacts: ${taskAnalysis.serviceNowArtifacts.join(', ')}`);
221
- cliLogger.info(`๐Ÿ“ฆ Auto Update Set: ${taskAnalysis.requiresUpdateSet ? 'โœ… Yes' : 'โŒ No'}`);
222
- cliLogger.info(`๐Ÿ—๏ธ Auto Application: ${taskAnalysis.requiresApplication ? 'โœ… Yes' : 'โŒ No'}`);
223
- // Show timeout configuration
224
- const timeoutMinutes = process.env.SNOW_FLOW_TIMEOUT_MINUTES ? parseInt(process.env.SNOW_FLOW_TIMEOUT_MINUTES) : 60;
225
- if (timeoutMinutes > 0) {
226
- cliLogger.info(`โฑ๏ธ Timeout: ${timeoutMinutes} minutes`);
225
+ // Debug logging to understand task type detection
226
+ if (process.env.DEBUG || options.verbose) {
227
+ if (process.env.DEBUG) {
228
+ cliLogger.info(`๐Ÿ” DEBUG - Detected artifacts: [${taskAnalysis.serviceNowArtifacts.join(', ')}]`);
229
+ cliLogger.info(`๐Ÿ” DEBUG - Flow keywords in objective: ${objective.toLowerCase().includes('flow')}`);
230
+ cliLogger.info(`๐Ÿ” DEBUG - Widget keywords in objective: ${objective.toLowerCase().includes('widget')}`);
231
+ }
232
+ cliLogger.info(`\n๐Ÿ“Š Task Analysis:`);
233
+ cliLogger.info(` ๐ŸŽฏ Task Type: ${taskAnalysis.taskType}`);
234
+ cliLogger.info(` ๐Ÿง  Primary Agent: ${taskAnalysis.primaryAgent}`);
235
+ cliLogger.info(` ๐Ÿ‘ฅ Supporting Agents: ${taskAnalysis.supportingAgents.join(', ')}`);
236
+ cliLogger.info(` ๐Ÿ“Š Complexity: ${taskAnalysis.complexity} | Estimated Agents: ${taskAnalysis.estimatedAgentCount}`);
237
+ cliLogger.info(` ๐Ÿ”ง ServiceNow Artifacts: ${taskAnalysis.serviceNowArtifacts.join(', ')}`);
238
+ cliLogger.info(` ๐Ÿ“ฆ Auto Update Set: ${taskAnalysis.requiresUpdateSet ? 'โœ… Yes' : 'โŒ No'}`);
239
+ cliLogger.info(` ๐Ÿ—๏ธ Auto Application: ${taskAnalysis.requiresApplication ? 'โœ… Yes' : 'โŒ No'}`);
227
240
  }
228
- else {
229
- cliLogger.info('โฑ๏ธ Timeout: Disabled (infinite execution time)');
241
+ // Show timeout configuration only in verbose mode
242
+ const timeoutMinutes = process.env.SNOW_FLOW_TIMEOUT_MINUTES ? parseInt(process.env.SNOW_FLOW_TIMEOUT_MINUTES) : 60;
243
+ if (options.verbose) {
244
+ if (timeoutMinutes > 0) {
245
+ cliLogger.info(`โฑ๏ธ Timeout: ${timeoutMinutes} minutes`);
246
+ }
247
+ else {
248
+ cliLogger.info('โฑ๏ธ Timeout: Disabled (infinite execution time)');
249
+ }
230
250
  }
231
251
  // Check ServiceNow authentication
232
252
  const oauth = new snow_oauth_js_1.ServiceNowOAuth();
233
253
  const isAuthenticated = await oauth.isAuthenticated();
234
- if (isAuthenticated) {
235
- cliLogger.info('๐Ÿ”— ServiceNow connection: โœ… Authenticated');
236
- // Test ServiceNow connection
237
- const client = new servicenow_client_js_1.ServiceNowClient();
238
- const testResult = await client.testConnection();
239
- if (testResult.success) {
240
- cliLogger.info(`๐Ÿ‘ค Connected as: ${testResult.data.name} (${testResult.data.user_name})`);
254
+ if (options.verbose) {
255
+ if (isAuthenticated) {
256
+ cliLogger.info('๐Ÿ”— ServiceNow connection: โœ… Authenticated');
257
+ // Test ServiceNow connection
258
+ const client = new servicenow_client_js_1.ServiceNowClient();
259
+ const testResult = await client.testConnection();
260
+ if (testResult.success) {
261
+ cliLogger.info(`๐Ÿ‘ค Connected as: ${testResult.data.name} (${testResult.data.user_name})`);
262
+ }
263
+ }
264
+ else {
265
+ cliLogger.warn('๐Ÿ”— ServiceNow connection: โŒ Not authenticated');
266
+ cliLogger.info('๐Ÿ’ก Run "snow-flow auth login" to enable live ServiceNow integration');
241
267
  }
242
268
  }
243
- else {
244
- cliLogger.warn('๐Ÿ”— ServiceNow connection: โŒ Not authenticated');
245
- cliLogger.info('๐Ÿ’ก Run "snow-flow auth login" to enable live ServiceNow integration');
269
+ else if (!isAuthenticated) {
270
+ // In non-verbose mode, only warn if not authenticated
271
+ cliLogger.warn('โš ๏ธ Not authenticated. Run "snow-flow auth login" for ServiceNow integration');
246
272
  }
247
273
  // Initialize Queen Agent memory system
248
- cliLogger.info('\n๐Ÿ’พ Initializing swarm memory system...');
274
+ if (options.verbose) {
275
+ cliLogger.info('\n๐Ÿ’พ Initializing swarm memory system...');
276
+ }
249
277
  const { QueenMemorySystem } = await Promise.resolve().then(() => __importStar(require('./queen/queen-memory.js')));
250
278
  const memorySystem = new QueenMemorySystem();
251
279
  // Generate swarm session ID
252
280
  const sessionId = `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
253
- cliLogger.info(`๐Ÿ“‹ Swarm Session ID: ${sessionId}`);
281
+ cliLogger.info(`\n๐Ÿ”– Session: ${sessionId}`);
254
282
  // Store swarm session in memory
255
283
  memorySystem.storeLearning(`session_${sessionId}`, {
256
284
  objective,
@@ -259,182 +287,33 @@ program
259
287
  started_at: new Date().toISOString(),
260
288
  is_authenticated: isAuthenticated
261
289
  });
262
- // Check if this is a Flow Designer flow request - ALWAYS use XML-first for flows!
290
+ // Check if this is a Flow Designer flow request
263
291
  const isFlowDesignerTask = taskAnalysis.taskType === 'flow_development' ||
264
292
  taskAnalysis.primaryAgent === 'flow-builder' ||
265
293
  (objective.toLowerCase().includes('flow') &&
266
294
  !objective.toLowerCase().includes('workflow') &&
267
295
  !objective.toLowerCase().includes('data flow'));
268
296
  let xmlFlowResult = null;
269
- if (isFlowDesignerTask) {
270
- cliLogger.info('\n๐Ÿ”ง Flow Designer Detected - Using XML-First Approach!');
271
- cliLogger.info('๐Ÿ“‹ Creating production-ready ServiceNow flow XML...');
272
- cliLogger.info('๐Ÿ’ก Reason: Flow Designer flows are most reliable with XML-first approach\n');
273
- try {
274
- // Import IMPROVED XML flow generator (fixes "too small to work" issue!)
275
- const { generateImprovedFlowXML } = await Promise.resolve().then(() => __importStar(require('./utils/improved-flow-xml-generator.js')));
276
- // Parse instruction to determine activities
277
- const activities = [];
278
- const objectiveLower = objective.toLowerCase();
279
- // Auto-detect activities from objective
280
- if (objectiveLower.includes('approval') || objectiveLower.includes('approve')) {
281
- activities.push({
282
- name: 'Request Approval',
283
- type: 'approval',
284
- order: 100,
285
- inputs: {
286
- table: taskAnalysis.serviceNowArtifacts.includes('sc_request') ? 'sc_request' : 'incident',
287
- record: '{{trigger.current.sys_id}}',
288
- approver: '{{trigger.current.requested_for.manager}}',
289
- approval_field: 'approval',
290
- message: `Please approve: {{trigger.current.number}}`
291
- },
292
- outputs: {
293
- state: 'string',
294
- approver_sys_id: 'string',
295
- comments: 'string'
296
- }
297
- });
298
- }
299
- if (objectiveLower.includes('notification') || objectiveLower.includes('email') || objectiveLower.includes('notify')) {
300
- activities.push({
301
- name: 'Send Notification',
302
- type: 'notification',
303
- order: activities.length > 0 ? 200 : 100,
304
- inputs: {
305
- notification_id: (0, servicenow_id_generator_js_1.getNotificationTemplateSysId)('generic_notification'),
306
- recipients: '{{trigger.current.requested_for}}',
307
- values: {
308
- request_number: '{{trigger.current.number}}',
309
- status: 'Notification sent'
310
- }
311
- }
312
- });
313
- }
314
- if (objectiveLower.includes('create') || objectiveLower.includes('task')) {
315
- activities.push({
316
- name: 'Create Task',
317
- type: 'create_record',
318
- order: activities.length > 0 ? (activities.length + 1) * 100 : 100,
319
- inputs: {
320
- table: 'task',
321
- field_values: {
322
- short_description: '{{trigger.current.short_description}} - Follow-up',
323
- assigned_to: '{{trigger.current.assigned_to}}',
324
- priority: '{{trigger.current.priority}}'
325
- }
326
- },
327
- outputs: {
328
- record_id: 'string',
329
- number: 'string'
330
- }
331
- });
332
- }
333
- // Build flow definition
334
- const flowName = objective.substring(0, 50).replace(/[^a-zA-Z0-9]/g, '_');
335
- const flowDef = {
336
- name: `Flow_${flowName}`,
337
- description: objective,
338
- table: taskAnalysis.serviceNowArtifacts.find(a => ['incident', 'sc_request', 'change_request', 'problem'].includes(a)) || 'incident',
339
- trigger_type: 'record_created',
340
- trigger_condition: '',
341
- activities: activities.length > 0 ? activities : [{
342
- name: 'Log Flow Start',
343
- type: 'script',
344
- order: 100,
345
- inputs: {
346
- script: `gs.info('Flow started for: ' + current.number, 'XMLFlow');\\nreturn { started: true };`
347
- },
348
- outputs: { started: 'boolean' }
349
- }]
350
- };
351
- // Generate IMPROVED XML with enhanced structure
352
- cliLogger.info('๐Ÿ—๏ธ Generating IMPROVED production XML...');
353
- // Convert to improved flow definition
354
- const improvedFlowDef = {
355
- ...flowDef,
356
- run_as: 'user',
357
- accessible_from: 'package_private',
358
- category: 'custom',
359
- tags: ['auto-generated'],
360
- activities: flowDef.activities.map((act) => ({
361
- ...act,
362
- description: act.description || act.name
363
- }))
364
- };
365
- const result = generateImprovedFlowXML(improvedFlowDef);
366
- xmlFlowResult = { ...result, flowDefinition: flowDef };
367
- cliLogger.info(`\nโœ… IMPROVED XML Generated Successfully!`);
368
- cliLogger.info(`๐Ÿ“ File saved to: ${result.filePath}`);
369
- cliLogger.info(`๐Ÿ”ฅ IMPROVEMENTS: Uses v2 tables, Base64+gzip encoding, complete label_cache!`);
370
- cliLogger.info(`๐Ÿ“Š Flow structure:`);
371
- cliLogger.info(` - Name: ${flowDef.name}`);
372
- cliLogger.info(` - Table: ${flowDef.table}`);
373
- cliLogger.info(` - Trigger: ${flowDef.trigger_type}`);
374
- cliLogger.info(` - Activities: ${flowDef.activities.length}`);
375
- // Show import instructions
376
- cliLogger.info('\n' + '='.repeat(60));
377
- cliLogger.info(result.instructions);
378
- cliLogger.info('='.repeat(60));
379
- // Store result in memory
380
- memorySystem.storeLearning(`xml_flow_${sessionId}`, {
381
- objective,
382
- flow_definition: flowDef,
383
- xml_file: result.filePath,
384
- generated_at: new Date().toISOString()
385
- });
386
- cliLogger.info('\n๐ŸŽฏ XML Flow generated successfully!');
387
- // Check if auto-deploy is enabled
388
- if (options.autoDeploy !== false) { // Default is true from swarm command
389
- cliLogger.info('\n๐Ÿš€ Auto-Deploy enabled - importing XML to ServiceNow...');
390
- // Automatically deploy the XML file
391
- const deploySuccess = await deployXMLToServiceNow(result.filePath, {
392
- preview: true,
393
- commit: true
394
- });
395
- if (deploySuccess) {
396
- cliLogger.info('\nโœ… Flow automatically deployed to ServiceNow!');
397
- cliLogger.info('๐ŸŽฏ The flow is now available in Flow Designer');
398
- // Store deployment success in memory
399
- memorySystem.storeLearning(`deployment_${sessionId}`, {
400
- success: true,
401
- xml_file: result.filePath,
402
- deployed_at: new Date().toISOString(),
403
- flow_name: flowDef.name
404
- });
405
- }
406
- else {
407
- cliLogger.warn('\nโš ๏ธ Automatic deployment encountered issues');
408
- cliLogger.info('๐Ÿ’ก You can manually deploy later with:');
409
- cliLogger.info(` snow-flow deploy-xml "${result.filePath}"`);
410
- }
411
- }
412
- else {
413
- cliLogger.info('๐Ÿ“‹ Use the import instructions above to deploy to ServiceNow');
414
- }
415
- cliLogger.info('\n๐Ÿ’ก XML template generated. Now launching Queen Agent for intelligent flow development...');
416
- // DO NOT RETURN HERE - Continue to Queen Agent orchestration!
417
- }
418
- catch (error) {
419
- cliLogger.error('โŒ XML flow generation failed:', error instanceof Error ? error.message : String(error));
420
- cliLogger.info('๐Ÿ’ก Falling back to regular swarm orchestration...\n');
421
- }
422
- }
423
297
  // Start real Claude Code orchestration
424
298
  try {
425
299
  // Generate the Queen Agent orchestration prompt
426
- const orchestrationPrompt = buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated, sessionId, xmlFlowResult);
427
- cliLogger.info('\n๐Ÿ‘‘ Initializing Queen Agent orchestration...');
428
- cliLogger.info('๐ŸŽฏ Queen Agent will coordinate the following:');
429
- cliLogger.info(` - Analyze objective: "${objective}"`);
430
- cliLogger.info(` - Spawn ${taskAnalysis.estimatedAgentCount} specialized agents`);
431
- cliLogger.info(` - Coordinate through shared memory (session: ${sessionId})`);
432
- cliLogger.info(` - Monitor progress and adapt strategy`);
300
+ const orchestrationPrompt = buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated, sessionId, isFlowDesignerTask);
301
+ if (options.verbose) {
302
+ cliLogger.info('\n๐Ÿ‘‘ Initializing Queen Agent orchestration...');
303
+ cliLogger.info('๐ŸŽฏ Queen Agent will coordinate the following:');
304
+ cliLogger.info(` - Analyze objective: "${objective}"`);
305
+ cliLogger.info(` - Spawn ${taskAnalysis.estimatedAgentCount} specialized agents`);
306
+ cliLogger.info(` - Coordinate through shared memory (session: ${sessionId})`);
307
+ cliLogger.info(` - Monitor progress and adapt strategy`);
308
+ }
309
+ else {
310
+ cliLogger.info('\n๐Ÿ‘‘ Launching Queen Agent...');
311
+ }
433
312
  // Check if intelligent features are enabled
434
313
  const hasIntelligentFeatures = options.autoPermissions || options.smartDiscovery ||
435
314
  options.liveTesting || options.autoDeploy || options.autoRollback ||
436
315
  options.sharedMemory || options.progressMonitoring;
437
- if (hasIntelligentFeatures && isAuthenticated) {
316
+ if (options.verbose && hasIntelligentFeatures && isAuthenticated) {
438
317
  cliLogger.info('\n๐Ÿง  INTELLIGENT ORCHESTRATION MODE ENABLED!');
439
318
  cliLogger.info('โœจ Queen Agent will use advanced features:');
440
319
  if (options.autoPermissions) {
@@ -459,26 +338,30 @@ program
459
338
  cliLogger.info(' ๐Ÿ“Š Real-time progress monitoring');
460
339
  }
461
340
  }
462
- if (isAuthenticated) {
463
- cliLogger.info('\n๐Ÿ”— Live ServiceNow integration: โœ… Enabled');
464
- cliLogger.info('๐Ÿ“ Artifacts will be created directly in ServiceNow');
465
- }
466
- else {
467
- cliLogger.info('\n๐Ÿ”— Live ServiceNow integration: โŒ Disabled');
468
- cliLogger.info('๐Ÿ“ Artifacts will be saved to servicenow/ directory');
341
+ if (options.verbose) {
342
+ if (isAuthenticated) {
343
+ cliLogger.info('\n๐Ÿ”— Live ServiceNow integration: โœ… Enabled');
344
+ cliLogger.info('๐Ÿ“ Artifacts will be created directly in ServiceNow');
345
+ }
346
+ else {
347
+ cliLogger.info('\n๐Ÿ”— Live ServiceNow integration: โŒ Disabled');
348
+ cliLogger.info('๐Ÿ“ Artifacts will be saved to servicenow/ directory');
349
+ }
469
350
  }
470
- cliLogger.info('\n๐Ÿš€ Launching Claude Code with Queen Agent...');
351
+ cliLogger.info('๐Ÿš€ Launching Claude Code...');
471
352
  // Try to execute Claude Code directly with the prompt
472
353
  const success = await executeClaudeCode(orchestrationPrompt);
473
354
  if (success) {
474
- cliLogger.info('\nโœ… Queen Agent orchestration launched successfully!');
475
- cliLogger.info('๐Ÿ‘‘ Queen Agent is now coordinating your swarm');
476
- cliLogger.info(`๐Ÿ’พ Monitor progress with session ID: ${sessionId}`);
477
- if (isAuthenticated && options.autoDeploy) {
478
- cliLogger.info('๐Ÿš€ Real artifacts will be created in ServiceNow');
479
- }
480
- else {
481
- cliLogger.info('๐Ÿ“‹ Planning mode - analysis and recommendations only');
355
+ cliLogger.info('โœ… Claude Code launched successfully!');
356
+ if (options.verbose) {
357
+ cliLogger.info('๐Ÿ‘‘ Queen Agent is now coordinating your swarm');
358
+ cliLogger.info(`๐Ÿ’พ Monitor progress with session ID: ${sessionId}`);
359
+ if (isAuthenticated && options.autoDeploy) {
360
+ cliLogger.info('๐Ÿš€ Real artifacts will be created in ServiceNow');
361
+ }
362
+ else {
363
+ cliLogger.info('๐Ÿ“‹ Planning mode - analysis and recommendations only');
364
+ }
482
365
  }
483
366
  // Store successful launch in memory
484
367
  memorySystem.storeLearning(`launch_${sessionId}`, {
@@ -487,33 +370,43 @@ program
487
370
  });
488
371
  }
489
372
  else {
490
- cliLogger.info('\n๐Ÿš€ SNOW-FLOW ORCHESTRATION COMPLETE!');
491
- cliLogger.info('๐Ÿค– Now it\'s time for Claude Code agents to do the work...\n');
492
- cliLogger.info('๐Ÿ‘‘ QUEEN AGENT ORCHESTRATION PROMPT FOR CLAUDE CODE:');
493
- cliLogger.info('='.repeat(80));
494
- cliLogger.info(orchestrationPrompt);
495
- cliLogger.info('='.repeat(80));
496
- cliLogger.info('\nโœ… Snow-Flow has prepared the orchestration!');
497
- cliLogger.info('๐Ÿ“Š CRITICAL NEXT STEPS:');
498
- cliLogger.info(' 1. Copy the ENTIRE prompt above');
499
- cliLogger.info(' 2. Paste it into Claude Code (the AI assistant)');
500
- cliLogger.info(' 3. Claude Code will spawn multiple specialized agents as workhorses');
501
- cliLogger.info(' 4. These agents will implement your flow with all required logic');
502
- cliLogger.info(' 5. Agents will enhance the basic XML template with real functionality');
503
- cliLogger.info('\n๐ŸŽฏ Remember:');
504
- cliLogger.info(' - Snow-Flow = Orchestrator (coordinates the work)');
505
- cliLogger.info(' - Claude Code = Workhorses (implement the solution)');
506
- if (xmlFlowResult) {
507
- cliLogger.info(`\n๐Ÿ“ XML template saved at: ${xmlFlowResult.filePath}`);
508
- cliLogger.info(' โš ๏ธ This is just a BASIC template - agents must enhance it!');
509
- }
510
- if (isAuthenticated && options.autoDeploy) {
511
- cliLogger.info('\n๐Ÿš€ Deployment Mode: Agents will create REAL artifacts in ServiceNow');
373
+ if (options.verbose) {
374
+ cliLogger.info('\n๐Ÿš€ SNOW-FLOW ORCHESTRATION COMPLETE!');
375
+ cliLogger.info('๐Ÿค– Now it\'s time for Claude Code agents to do the work...\n');
376
+ cliLogger.info('๐Ÿ‘‘ QUEEN AGENT ORCHESTRATION PROMPT FOR CLAUDE CODE:');
377
+ cliLogger.info('='.repeat(80));
378
+ cliLogger.info(orchestrationPrompt);
379
+ cliLogger.info('='.repeat(80));
380
+ cliLogger.info('\nโœ… Snow-Flow has prepared the orchestration!');
381
+ cliLogger.info('๐Ÿ“Š CRITICAL NEXT STEPS:');
382
+ cliLogger.info(' 1. Copy the ENTIRE prompt above');
383
+ cliLogger.info(' 2. Paste it into Claude Code (the AI assistant)');
384
+ cliLogger.info(' 3. Claude Code will spawn multiple specialized agents as workhorses');
385
+ cliLogger.info(' 4. These agents will implement your flow with all required logic');
386
+ cliLogger.info(' 5. Agents will enhance the basic XML template with real functionality');
387
+ cliLogger.info('\n๐ŸŽฏ Remember:');
388
+ cliLogger.info(' - Snow-Flow = Orchestrator (coordinates the work)');
389
+ cliLogger.info(' - Claude Code = Workhorses (implement the solution)');
390
+ if (xmlFlowResult) {
391
+ cliLogger.info(`\n๐Ÿ“ XML template saved at: ${xmlFlowResult.filePath}`);
392
+ cliLogger.info(' โš ๏ธ This is just a BASIC template - agents must enhance it!');
393
+ }
394
+ if (isAuthenticated && options.autoDeploy) {
395
+ cliLogger.info('\n๐Ÿš€ Deployment Mode: Agents will create REAL artifacts in ServiceNow');
396
+ }
397
+ else {
398
+ cliLogger.info('\n๐Ÿ“‹ Planning Mode: Analysis and recommendations only');
399
+ }
400
+ cliLogger.info(`\n๐Ÿ’พ Session ID for monitoring: ${sessionId}`);
512
401
  }
513
402
  else {
514
- cliLogger.info('\n๐Ÿ“‹ Planning Mode: Analysis and recommendations only');
403
+ // Non-verbose mode - just show the essential info
404
+ cliLogger.info('\n๐Ÿ“‹ Manual Claude Code execution required');
405
+ cliLogger.info('๐Ÿ’ก Run with --verbose to see the full orchestration prompt');
406
+ if (xmlFlowResult) {
407
+ cliLogger.info(`๐Ÿ“ XML generated: ${xmlFlowResult.filePath}`);
408
+ }
515
409
  }
516
- cliLogger.info(`\n๐Ÿ’พ Session ID for monitoring: ${sessionId}`);
517
410
  }
518
411
  }
519
412
  catch (error) {
@@ -703,7 +596,7 @@ async function executeWithClaude(claudeCommand, prompt, resolve) {
703
596
  });
704
597
  }
705
598
  // Helper function to build Queen Agent orchestration prompt
706
- function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId, xmlFlowResult = null) {
599
+ function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId, isFlowDesignerTask = false) {
707
600
  // Check if intelligent features are enabled
708
601
  const hasIntelligentFeatures = options.autoPermissions || options.smartDiscovery ||
709
602
  options.liveTesting || options.autoDeploy || options.autoRollback ||
@@ -724,21 +617,26 @@ You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mis
724
617
  - **Estimated Total Agents**: ${taskAnalysis.estimatedAgentCount}
725
618
  - **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
726
619
 
727
- ${xmlFlowResult ? `## ๐Ÿ”ง Flow Designer XML Template Generated
728
- An initial XML template has been created as a starting point:
729
- - **File Path**: ${xmlFlowResult.filePath}
730
- - **Flow Name**: ${xmlFlowResult.flowDefinition.name}
731
- - **Table**: ${xmlFlowResult.flowDefinition.table}
732
- - **Activities**: ${xmlFlowResult.flowDefinition.activities.length}
733
-
734
- **IMPORTANT**: This is just a basic template! You must spawn Claude Code agents to:
735
- 1. Analyze the detailed requirements from the objective
736
- 2. Design the complete flow logic with all activities
737
- 3. Add approval steps, notifications, conditions, etc.
738
- 4. Test the flow implementation
739
- 5. Deploy to ServiceNow
740
-
741
- The XML template is saved but needs significant enhancement by your agents!
620
+ ${isFlowDesignerTask ? `## ๐Ÿ”ง Flow Designer Task Detected
621
+ You need to create a ServiceNow Flow Designer flow. Follow these steps:
622
+
623
+ 1. **Analyze Requirements**: Parse the objective to understand all required activities
624
+ 2. **Design Flow Structure**: Plan the flow with triggers, activities, and logic
625
+ 3. **Generate XML**: Use the improved flow XML generator to create production-ready XML
626
+ 4. **Deploy to ServiceNow**: Use snow-flow deploy-xml or MCP tools to deploy
627
+
628
+ **Important Flow Development Instructions**:
629
+ - Use \`generateImprovedFlowXML\` from './utils/improved-flow-xml-generator.js'
630
+ - This generator follows EXACT patterns extracted from real ServiceNow Flow Designer XML examples
631
+ - CRITICAL: Use v2 tables (sys_hub_action_instance_v2), Base64+gzip encoding, complete label_cache
632
+ - The generator creates production-ready XML that ServiceNow can actually import (not "too small to work")
633
+ - Include appropriate activities based on the objective:
634
+ - Approval activities for approval workflows
635
+ - Notification activities for email/messaging
636
+ - Create record activities for task creation
637
+ - Script activities for custom logic
638
+ - Save generated XML to flow-update-sets directory
639
+ - Deploy using: \`snow-flow deploy-xml "path/to/flow.xml"\`
742
640
  ` : ''}
743
641
  - **Recommended Team**: ${getTeamRecommendation(taskAnalysis.taskType)}
744
642
 
@@ -266,10 +266,11 @@ class AgentDetector {
266
266
  }
267
267
  static determineTaskType(objective, artifacts) {
268
268
  // Determine based on detected artifacts and keywords
269
- if (artifacts.includes('widget'))
270
- return 'widget_development';
269
+ // Check flow FIRST as it's often confused with widget when both are present
271
270
  if (artifacts.includes('flow') || artifacts.includes('workflow'))
272
271
  return 'flow_development';
272
+ if (artifacts.includes('widget'))
273
+ return 'widget_development';
273
274
  if (artifacts.includes('application'))
274
275
  return 'application_development';
275
276
  if (artifacts.includes('script') || artifacts.includes('business_rule'))
package/dist/version.js CHANGED
@@ -7,12 +7,36 @@ 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.12';
10
+ exports.VERSION = '1.3.15';
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.15': [
17
+ '๐ŸŽฏ SWARM SIMPLIFIED: Removed XML generation from swarm command',
18
+ 'โœจ ORCHESTRATION ONLY: Swarm now only launches Claude Code',
19
+ '๐Ÿค– AGENT RESPONSIBILITY: XML generation moved to Claude Code agents',
20
+ '๐Ÿš€ CLEANER ARCHITECTURE: Better separation of orchestration vs implementation',
21
+ '๐Ÿ“‹ FLOW INSTRUCTIONS: Claude Code gets clear instructions for flow tasks',
22
+ '๐Ÿ”ง NO PREMATURE WORK: No more generating/deploying before agents start'
23
+ ],
24
+ '1.3.14': [
25
+ '๐ŸŽฏ CLEANER OUTPUT: Dramatically reduced verbose logging in swarm command',
26
+ '๐Ÿš€ FOCUSED UI: Only essential information shown by default',
27
+ '๐Ÿ“Š --verbose FLAG: Added flag to see detailed execution information',
28
+ 'โœจ STREAMLINED: No more walls of text before anything happens',
29
+ '๐Ÿ’ก SMART DEFAULTS: Shows objective, session ID, and actual progress only',
30
+ '๐Ÿ”ง BETTER UX: Clean, professional output focused on what matters'
31
+ ],
32
+ '1.3.13': [
33
+ '๐Ÿ› FIX ERROR MESSAGES: Separated XML generation and deployment error handling',
34
+ 'โœ… CORRECT ERRORS: "XML flow generation failed" no longer shows for deployment issues',
35
+ '๐ŸŽฏ FLOW DETECTION FIX: Flow tasks now correctly detected instead of widget_development',
36
+ '๐Ÿ”ง BETTER ERROR HANDLING: Deployment errors show specific failure reasons',
37
+ '๐Ÿ“Š DEBUG LOGGING: Added artifact detection debugging with DEBUG env var',
38
+ 'โšก IMPROVED RELIABILITY: Better error recovery and clearer user feedback'
39
+ ],
16
40
  '1.3.12': [
17
41
  '๐Ÿš€ AUTO-DEPLOY XML: Swarm command now automatically deploys flow XML to ServiceNow',
18
42
  'โœจ ZERO MANUAL STEPS: Generate โ†’ Import โ†’ Preview โ†’ Commit all automatic',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "1.3.12",
3
+ "version": "1.3.15",
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",