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 +154 -256
- package/dist/utils/agent-detector.js +3 -2
- package/dist/version.js +25 -1
- package/package.json +1 -1
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
|
-
|
|
202
|
+
// Always show essential info
|
|
203
|
+
cliLogger.info(`\n๐ Snow-Flow v${version_js_1.VERSION}`);
|
|
202
204
|
cliLogger.info(`๐ Objective: ${objective}`);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
cliLogger.info(
|
|
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
|
-
|
|
229
|
-
|
|
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 (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
245
|
-
cliLogger.
|
|
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
|
-
|
|
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(
|
|
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
|
|
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,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
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 (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
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('
|
|
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('
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
${
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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",
|