snow-flow 1.3.17 → 1.3.19

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/CLAUDE.md CHANGED
@@ -38,21 +38,15 @@ const gapAnalysis = await analyzeGaps("your objective", mcpTools, logger, {
38
38
  console.log('🧠 Queen Agent spawning 6+ parallel agents for 2.8x faster development...');
39
39
 
40
40
  // 5. MANDATORY: Real ServiceNow deployment
41
- // For flows: Use XML-first approach (automatic detection)
41
+ // For flows: Use XML-first approach with full automation (NEW v1.3.17!)
42
42
  if (isFlowDesignerTask) {
43
- // XML generation and deployment
44
- const xmlResult = generateProductionFlowXML(flowDefinition);
45
-
46
- // Option 1: Auto-deploy XML (recommended)
47
- const deployment = await snow_deploy({
48
- type: "xml_update_set",
49
- xml_file_path: xmlResult.filePath,
50
- auto_preview: true,
51
- auto_commit: true
43
+ // āœ… SINGLE COMMAND: XML generation + automatic deployment
44
+ const deployment = await snow_create_flow({
45
+ instruction: "your natural language flow description",
46
+ deploy_immediately: true // šŸš€ Fully automated: Generate → Import → Preview → Commit
52
47
  });
53
48
 
54
- // Option 2: Manual deployment command
55
- console.log(`Deploy with: snow-flow deploy-xml "${xmlResult.filePath}"`);
49
+ // That's it! Flow is now live in ServiceNow Flow Designer
56
50
  } else {
57
51
  // For widgets, applications, scripts: Use standard MCP deployment
58
52
  const deployment = await snow_deploy({
@@ -226,52 +220,42 @@ When you run any flow-related swarm command, Snow-flow automatically:
226
220
  - `sys_hub_action_instance` - All flow activities (approval, notification, etc.)
227
221
  - `sys_hub_flow_logic` - Activity connections and flow paths
228
222
 
229
- 4. **šŸš€ Provides Auto-Deploy Command**:
223
+ 4. **šŸš€ Fully Automated Deployment** (NEW v1.3.17!):
230
224
  ```bash
231
- šŸš€ Auto-Deploy enabled - importing XML to ServiceNow...
232
- šŸ’” To deploy, use the following command:
233
- snow-flow deploy-xml "flow-update-sets/your_flow.xml"
225
+ šŸš€ Auto-Deploy enabled - deploying directly to ServiceNow...
226
+ āœ… XML imported successfully (sys_id: abc123...)
227
+ āœ… Update set loaded: Flow_Import_2025
228
+ šŸ” Preview completed with no problems
229
+ āœ… Update set committed successfully!
230
+ šŸŽ‰ Flow is ready in Flow Designer!
234
231
  ```
235
232
 
236
- ### šŸš€ One-Command Deployment
233
+ ### šŸš€ Zero-Manual-Steps Deployment
237
234
 
238
- ```bash
239
- # Deploy any generated XML flow directly to ServiceNow
240
- snow-flow deploy-xml flow-update-sets/my_flow.xml
235
+ **No commands needed!** Everything happens automatically in one swarm call:
241
236
 
242
- # With options:
243
- snow-flow deploy-xml my_flow.xml --no-preview # Skip preview step
244
- snow-flow deploy-xml my_flow.xml --no-commit # Preview only, manual commit
245
- ```
246
-
247
- **What the deploy-xml command does:**
248
- 1. āœ… **Import**: Uploads XML to ServiceNow as remote update set
249
- 2. āœ… **Load**: Loads the update set into local update sets
250
- 3. āœ… **Preview**: Checks for problems and conflicts
251
- 4. āœ… **Commit**: Auto-commits if preview is clean
252
- 5. āœ… **Verify**: Confirms flow is available in Flow Designer
237
+ **What happens automatically:**
238
+ 1. āœ… **Generate**: Creates production-ready Update Set XML
239
+ 2. āœ… **Import**: Uploads XML to ServiceNow as remote update set
240
+ 3. āœ… **Load**: Loads the update set into local update sets
241
+ 4. āœ… **Preview**: Checks for problems and conflicts
242
+ 5. āœ… **Commit**: Auto-commits if preview is clean
243
+ 6. āœ… **Verify**: Confirms flow is available in Flow Designer
253
244
 
254
245
  ### šŸŽÆ Complete Flow Development Workflow
255
246
 
256
- **End-to-End Flow Creation (Zero Manual Steps):**
247
+ **End-to-End Flow Creation (Truly Zero Manual Steps):**
257
248
 
258
249
  ```bash
259
- # 1. Create flow with automatic XML generation
250
+ # Single command creates AND deploys flow automatically!
260
251
  snow-flow swarm "create incident escalation flow with email notifications"
261
252
 
262
- # Output:
253
+ # Complete Output:
263
254
  # šŸ”§ Flow Designer Detected - Using XML-First Approach!
255
+ # šŸ“‹ Creating production-ready ServiceNow flow XML...
264
256
  # āœ… XML Generated Successfully!
265
257
  # šŸ“ File saved to: flow-update-sets/incident_escalation_flow.xml
266
- # šŸš€ Auto-Deploy enabled - importing XML to ServiceNow...
267
- # šŸ’” To deploy, use the following command:
268
- # snow-flow deploy-xml "flow-update-sets/incident_escalation_flow.xml"
269
-
270
- # 2. Deploy to ServiceNow (one command!)
271
- snow-flow deploy-xml flow-update-sets/incident_escalation_flow.xml
272
-
273
- # Output:
274
- # šŸ“¦ Deploying XML Update Set: flow-update-sets/incident_escalation_flow.xml
258
+ # šŸš€ Auto-Deploy enabled - deploying directly to ServiceNow...
275
259
  # āœ… XML imported successfully (sys_id: abc123...)
276
260
  # āœ… Update set loaded: Incident_Escalation_Flow_Import
277
261
  # šŸ” Previewing update set...
@@ -279,37 +263,41 @@ snow-flow deploy-xml flow-update-sets/incident_escalation_flow.xml
279
263
  # šŸš€ Committing update set...
280
264
  # āœ… Update Set committed successfully!
281
265
  # šŸ“ Navigate to Flow Designer > Designer to see your flow
282
- # šŸŽ‰ Deployment complete!
266
+ # šŸŽ‰ Flow deployed and ready to use!
283
267
  ```
284
268
 
285
- ### šŸ”§ Advanced XML Deployment Features
269
+ **That's it! One command, zero manual steps.** šŸš€
286
270
 
287
- **Error Handling & Safety**:
271
+ ### šŸ”§ Advanced Auto-Deployment Features
272
+
273
+ **Built-in Safety & Intelligence**:
288
274
  - **Preview Problems Detection**: Automatically detects and reports conflicts
289
- - **Safe Auto-Commit**: Only commits if preview is completely clean
290
- - **Graceful Fallbacks**: Provides manual steps if auto-deployment fails
275
+ - **Safe Auto-Commit**: Only commits if preview is completely clean
276
+ - **Graceful Fallbacks**: Provides manual instructions if auto-deployment fails
291
277
  - **Authentication Validation**: Ensures valid ServiceNow connection before deployment
278
+ - **Error Recovery**: Intelligent retry and fallback strategies
292
279
 
293
- **Manual Control Options**:
294
- ```bash
295
- # Preview only (no commit) - for review and testing
296
- snow-flow deploy-xml my_flow.xml --no-commit
297
-
298
- # Direct commit (skip preview) - for trusted environments
299
- snow-flow deploy-xml my_flow.xml --no-preview
280
+ **What Happens Behind the Scenes**:
281
+ ```javascript
282
+ // When you run: snow-flow swarm "create approval flow"
283
+ await snow_create_flow({
284
+ instruction: "create approval flow",
285
+ deploy_immediately: true // This triggers all safety checks:
286
+ });
300
287
 
301
- # Check authentication first
302
- snow-flow auth status
288
+ // 1. āœ… Authentication check
289
+ // 2. āœ… XML generation with validation
290
+ // 3. āœ… Import to ServiceNow as remote update set
291
+ // 4. āœ… Preview for conflicts
292
+ // 5. āœ… Auto-commit only if clean
293
+ // 6. āœ… Error handling with manual fallback instructions
303
294
  ```
304
295
 
305
- **Troubleshooting**:
306
- ```bash
307
- # If deployment fails, check:
308
- 1. snow-flow auth status # Verify authentication
309
- 2. Check XML file exists and is valid
310
- 3. Ensure admin permissions in ServiceNow
311
- 4. Review any preview problems reported
312
- ```
296
+ **Troubleshooting (if auto-deployment fails)**:
297
+ - Error messages include specific troubleshooting steps
298
+ - Authentication issues: `snow-flow auth status`
299
+ - Manual fallback: `snow-flow deploy-xml filename.xml`
300
+ - Permission issues: Check admin roles in ServiceNow
313
301
 
314
302
  ## šŸ”’ MANDATORY ServiceNow Development Workflow
315
303
 
@@ -711,7 +699,7 @@ snow-flow swarm "create incident dashboard widget"
711
699
  # Swarm handles all MCP orchestration with multiple agents
712
700
  snow-flow swarm "create approval workflow for equipment requests"
713
701
 
714
- # What happens: snow_create_flow() → snow_test_flow_with_mock() → multi-agent validation → auto tracking
702
+ # What happens: snow_create_flow({ deploy_immediately: true }) → live deployment → flow ready in ServiceNow
715
703
  ```
716
704
 
717
705
  ### šŸŽÆ Smart Discovery Before Creation
@@ -783,9 +771,9 @@ snow-flow swarm "deploy mobile-responsive widget with accessibility features"
783
771
  ### šŸš€ Complete Commands Reference
784
772
 
785
773
  ```bash
786
- # Flow Designer workflows (auto-XML generation + deployment)
774
+ # Flow Designer workflows (fully automated generation + deployment)
787
775
  snow-flow swarm "create approval flow for equipment requests"
788
- snow-flow deploy-xml flow-update-sets/approval_flow.xml
776
+ # āœ… Above command automatically deploys! No manual steps needed.
789
777
 
790
778
  # Widget development (standard MCP deployment)
791
779
  snow-flow swarm "create incident dashboard widget"
package/README.md CHANGED
@@ -17,21 +17,22 @@
17
17
  ### šŸš€ BREAKTHROUGH: Complete XML Update Set Auto-Import!
18
18
  - **āœ… ZERO MANUAL STEPS**: One command imports, previews, and commits XML update sets automatically
19
19
  - **āœ… FLOW DESIGNER INTEGRATION**: Automatic detection of Flow Designer artifacts in swarm commands
20
- - **āœ… XML GENERATION & DEPLOYMENT**: Complete workflow from swarm creation to XML deployment
21
- - **āœ… SAFETY CONTROLS**: Auto-preview with problem detection, only commits if clean
22
- - **āœ… NEW CLI COMMAND**: `snow-flow deploy-xml <file>` for standalone XML deployment
23
- - **āœ… MCP INTEGRATION**: Extended deployment MCP to support xml_update_set type
20
+ - **āœ… FULLY AUTOMATED FLOW DEPLOYMENT**: Complete workflow from natural language to live ServiceNow flow in one command
21
+ - **āœ… ZERO MANUAL STEPS**: XML generation, import, preview, and commit all happen automatically
22
+ - **āœ… INTELLIGENT SAFETY**: Auto-preview with problem detection, only commits if clean
23
+ - **āœ… GRACEFUL FALLBACKS**: Provides manual instructions if auto-deployment fails
24
24
 
25
- ### šŸ”„ Flow Designer XML Workflow
25
+ ### šŸ”„ Fully Automated Flow Workflow (NEW v1.3.17!)
26
26
  ```bash
27
- # 1. Create flow with swarm
27
+ # Single command creates AND deploys flow automatically!
28
28
  snow-flow swarm "create approval workflow for equipment requests"
29
29
 
30
- # 2. Export XML automatically generated in flow-update-sets/
31
- # 3. Deploy XML with single command - no manual import!
32
- snow-flow deploy-xml flow-update-sets/flow_approval_workflow.xml
30
+ # Complete output shows:
31
+ # šŸ”§ Flow Designer Detected - Using XML-First Approach!
32
+ # āœ… XML Generated & Auto-Deployed to ServiceNow!
33
+ # šŸŽ‰ Flow ready in Flow Designer!
33
34
 
34
- # āœ… Complete automation: Import → Load → Preview → Commit (only if clean)
35
+ # āœ… Zero manual steps: Generate → Import → Preview → Commit (only if clean)
35
36
  ```
36
37
 
37
38
  ### šŸš€ Previous Release: v1.1.93 - Revolutionary Parallel Agent Spawning WORKING!
@@ -114,7 +115,7 @@ snow-flow deploy-xml flow-update-sets/flow_approval_workflow.xml
114
115
  - **Flow Design**: Creates Flow Designer workflows with intelligent structure
115
116
  - **Trigger Configuration**: Sets up optimal triggers (record events, scheduled, manual)
116
117
  - **Approval Processes**: Implements complex approval hierarchies with escalation
117
- - **Integration**: Uses `snow_create_flow` MCP tools with comprehensive testing
118
+ - **Integration**: Uses `snow_xml_flow_from_instruction` with auto-deployment for maximum reliability
118
119
 
119
120
  ### šŸ“ Script Writer Agent
120
121
  - **Business Rules**: Creates optimized business logic with performance considerations
@@ -194,9 +195,9 @@ snow-flow swarm "Create incident management dashboard with real-time charts"
194
195
  # 🧠 NEW: Advanced example showing Gap Analysis Engine
195
196
  snow-flow queen "create ITSM solution with LDAP authentication and custom approval workflows"
196
197
 
197
- # šŸš€ NEW: Complete Flow Designer XML deployment workflow
198
+ # šŸš€ NEW: Fully automated Flow Designer deployment (v1.3.17!)
198
199
  snow-flow swarm "create approval workflow for equipment requests"
199
- snow-flow deploy-xml flow-update-sets/flow_approval_workflow.xml
200
+ # āœ… Above command automatically deploys flow to ServiceNow! Zero manual steps.
200
201
  ```
201
202
 
202
203
  ### 🧠 What You'll See with Gap Analysis Engine
@@ -259,17 +260,20 @@ snow-flow memory stats
259
260
  snow-flow memory export <file>
260
261
  ```
261
262
 
262
- ### šŸš€ NEW: XML Update Set Deployment
263
+ ### šŸš€ NEW: Fully Automated Flow Deployment (v1.3.17!)
263
264
  ```bash
264
- # Deploy XML update sets automatically (Import → Preview → Commit)
265
- snow-flow deploy-xml <xmlFile>
265
+ # Single command creates AND deploys flows automatically!
266
+ snow-flow swarm "create approval workflow for equipment requests"
266
267
 
267
- # Deploy with custom options
268
- snow-flow deploy-xml flow.xml --no-preview # Skip preview step
269
- snow-flow deploy-xml flow.xml --no-commit # Preview only, don't commit
268
+ # What happens automatically:
269
+ # 1. āœ… Detects Flow Designer task
270
+ # 2. āœ… Generates production-ready XML
271
+ # 3. āœ… Imports to ServiceNow as remote update set
272
+ # 4. āœ… Previews for conflicts
273
+ # 5. āœ… Auto-commits if clean
274
+ # 6. āœ… Reports deployment status
270
275
 
271
- # Example: Deploy generated flow XML
272
- snow-flow deploy-xml flow-update-sets/flow_approval_workflow.xml
276
+ # Manual deployment (fallback only): snow-flow deploy-xml filename.xml
273
277
  ```
274
278
 
275
279
  ### šŸš€ Intelligent Features (Enabled by Default)
@@ -343,11 +347,10 @@ snow-flow swarm "Build approval flow for equipment requests with manager and fin
343
347
  # 1. Spawn Flow Builder + Security Agent
344
348
  # 2. Flow Builder designs multi-step approval process
345
349
  # 3. Security Agent validates permissions and compliance
346
- # 4. Automatic XML generation in flow-update-sets/ directory
347
- # 5. Display deploy-xml command for seamless deployment
350
+ # 4. Automatic XML generation AND deployment to ServiceNow
351
+ # 5. Flow ready in Flow Designer - zero manual steps!
348
352
 
349
- # šŸš€ NEW: Complete XML deployment workflow
350
- snow-flow deploy-xml flow-update-sets/flow_equipment_approval.xml
353
+ # šŸš€ NEW: Fully automated - no separate deployment command needed!
351
354
 
352
355
  # āœ… Automatic process:
353
356
  # • Import XML to ServiceNow
@@ -37,7 +37,7 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  };
38
38
  })();
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.AGENT_CLASS_MAP = exports.SecurityAgent = exports.TestAgent = exports.ScriptWriterAgent = exports.FlowBuilderAgent = exports.WidgetCreatorAgent = exports.BaseAgent = void 0;
40
+ exports.AGENT_CLASS_MAP = exports.SecurityAgent = exports.ScriptWriterAgent = exports.FlowBuilderAgent = exports.WidgetCreatorAgent = exports.BaseAgent = void 0;
41
41
  var base_agent_1 = require("./base-agent");
42
42
  Object.defineProperty(exports, "BaseAgent", { enumerable: true, get: function () { return base_agent_1.BaseAgent; } });
43
43
  var widget_creator_agent_1 = require("./widget-creator-agent");
@@ -46,8 +46,6 @@ var flow_builder_agent_1 = require("./flow-builder-agent");
46
46
  Object.defineProperty(exports, "FlowBuilderAgent", { enumerable: true, get: function () { return flow_builder_agent_1.FlowBuilderAgent; } });
47
47
  var script_writer_agent_1 = require("./script-writer-agent");
48
48
  Object.defineProperty(exports, "ScriptWriterAgent", { enumerable: true, get: function () { return script_writer_agent_1.ScriptWriterAgent; } });
49
- var test_agent_1 = require("./test-agent");
50
- Object.defineProperty(exports, "TestAgent", { enumerable: true, get: function () { return test_agent_1.TestAgent; } });
51
49
  var security_agent_1 = require("./security-agent");
52
50
  Object.defineProperty(exports, "SecurityAgent", { enumerable: true, get: function () { return security_agent_1.SecurityAgent; } });
53
51
  // Agent type mapping for factory
@@ -55,6 +53,5 @@ exports.AGENT_CLASS_MAP = {
55
53
  'widget-creator': () => Promise.resolve().then(() => __importStar(require('./widget-creator-agent'))).then(m => m.WidgetCreatorAgent),
56
54
  'flow-builder': () => Promise.resolve().then(() => __importStar(require('./flow-builder-agent'))).then(m => m.FlowBuilderAgent),
57
55
  'script-writer': () => Promise.resolve().then(() => __importStar(require('./script-writer-agent'))).then(m => m.ScriptWriterAgent),
58
- 'tester': () => Promise.resolve().then(() => __importStar(require('./test-agent'))).then(m => m.TestAgent),
59
56
  'security': () => Promise.resolve().then(() => __importStar(require('./security-agent'))).then(m => m.SecurityAgent)
60
57
  };
@@ -260,7 +260,9 @@ class QueenAgent extends eventemitter3_1.EventEmitter {
260
260
  status: 'active',
261
261
  objectiveId,
262
262
  specialization,
263
- startTime: Date.now()
263
+ startTime: Date.now(),
264
+ capabilities: [],
265
+ mcpTools: []
264
266
  };
265
267
  this.activeAgents.set(agentId, agent);
266
268
  // Store agent info in memory for coordination
package/dist/cli.js CHANGED
@@ -45,6 +45,7 @@ const dotenv_1 = __importDefault(require("dotenv"));
45
45
  const fs_1 = require("fs");
46
46
  const path_1 = require("path");
47
47
  const child_process_1 = require("child_process");
48
+ const os = __importStar(require("os"));
48
49
  const fs_2 = require("fs");
49
50
  const snow_oauth_js_1 = require("./utils/snow-oauth.js");
50
51
  const servicenow_client_js_1 = require("./utils/servicenow-client.js");
@@ -64,8 +65,16 @@ program
64
65
  // Helper function to deploy XML to ServiceNow
65
66
  async function deployXMLToServiceNow(xmlFile, options = {}) {
66
67
  const oauth = new snow_oauth_js_1.ServiceNowOAuth();
67
- const isAuthenticated = await oauth.getStoredTokens() !== null;
68
- if (!isAuthenticated) {
68
+ let tokens;
69
+ try {
70
+ tokens = await oauth.getStoredTokens();
71
+ }
72
+ catch (error) {
73
+ cliLogger.error('āŒ Failed to get authentication tokens:', error);
74
+ cliLogger.error('Please run: snow-flow auth login');
75
+ return false;
76
+ }
77
+ if (!tokens || !tokens.accessToken) {
69
78
  cliLogger.error('āŒ Not authenticated. Please run: snow-flow auth login');
70
79
  return false;
71
80
  }
@@ -165,11 +174,43 @@ async function deployXMLToServiceNow(xmlFile, options = {}) {
165
174
  return true;
166
175
  }
167
176
  catch (error) {
168
- cliLogger.error('\nāŒ Deployment failed:', error instanceof Error ? error.message : String(error));
177
+ cliLogger.error('\nāŒ Deployment failed:');
178
+ // Detailed error handling for 400 errors
179
+ if (error.response?.status === 400) {
180
+ cliLogger.error(` Status: ${error.response.status} Bad Request`);
181
+ if (error.response.data) {
182
+ cliLogger.error(` Message: ${error.response.data.error?.message || error.response.data.message || 'Unknown error'}`);
183
+ if (error.response.data.error?.detail) {
184
+ cliLogger.error(` Detail: ${error.response.data.error.detail}`);
185
+ }
186
+ if (error.response.data.error?.fields) {
187
+ cliLogger.error(' Missing or invalid fields:');
188
+ Object.entries(error.response.data.error.fields).forEach(([field, msg]) => {
189
+ cliLogger.error(` - ${field}: ${msg}`);
190
+ });
191
+ }
192
+ }
193
+ }
194
+ else if (error.response?.status === 401) {
195
+ cliLogger.error(' Status: 401 Unauthorized - Authentication failed');
196
+ cliLogger.error(' Your OAuth token may be expired. Please run: snow-flow auth login');
197
+ }
198
+ else if (error.response?.status === 403) {
199
+ cliLogger.error(' Status: 403 Forbidden - Insufficient permissions');
200
+ cliLogger.error(' You need admin or update_set_admin role to import update sets');
201
+ }
202
+ else if (error.response) {
203
+ cliLogger.error(` Status: ${error.response.status}`);
204
+ cliLogger.error(` Message: ${error.response.data?.error?.message || error.response.statusText}`);
205
+ }
206
+ else {
207
+ cliLogger.error(` ${error instanceof Error ? error.message : String(error)}`);
208
+ }
169
209
  cliLogger.info('\nšŸ’” Troubleshooting tips:');
170
210
  cliLogger.info(' 1. Check your authentication: snow-flow auth status');
171
211
  cliLogger.info(' 2. Verify XML file format is correct');
172
212
  cliLogger.info(' 3. Ensure you have required permissions in ServiceNow');
213
+ cliLogger.info(' 4. Check ServiceNow system logs for more details');
173
214
  return false;
174
215
  }
175
216
  }
@@ -617,26 +658,39 @@ You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mis
617
658
  - **Estimated Total Agents**: ${taskAnalysis.estimatedAgentCount}
618
659
  - **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
619
660
 
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"\`
661
+ ${isFlowDesignerTask ? `## šŸ”§ Flow Designer Task Detected - Using XML-First Approach!
662
+ šŸš€ **FULLY AUTOMATED FLOW DEPLOYMENT** - Zero manual steps required!
663
+
664
+ **MANDATORY: Use this exact approach for Flow Designer tasks:**
665
+
666
+ \`\`\`javascript
667
+ // āœ… CORRECT: Fully automated XML generation + deployment
668
+ await snow_create_flow({
669
+ instruction: "your natural language flow description",
670
+ deploy_immediately: true // šŸ”„ Automatically deploys to ServiceNow!
671
+ });
672
+ \`\`\`
673
+
674
+ šŸŽÆ **What this does automatically:**
675
+ - āœ… Parses natural language to complete flow structure
676
+ - āœ… Generates production-ready Update Set XML (v2 format)
677
+ - āœ… Imports XML to ServiceNow as remote update set
678
+ - āœ… Previews for conflicts and validates structure
679
+ - āœ… Commits update set if preview is clean
680
+ - āœ… Reports deployment status and provides flow URL
681
+ - āœ… Handles all errors gracefully with fallback instructions
682
+
683
+ 🚫 **FORBIDDEN APPROACHES:**
684
+ - āŒ DO NOT use old API-only approach without XML generation
685
+ - āŒ DO NOT use manual \`snow-flow deploy-xml\` commands
686
+ - āŒ DO NOT generate XML without auto-deployment
687
+
688
+ šŸ’” **Why XML-First?**
689
+ - Works with complex flows that break API methods
690
+ - Production-ready Flow Designer format with all required fields
691
+ - Complete automation from instruction to live ServiceNow flow
692
+ - Zero chance of "too small to work" or import failures
693
+
640
694
  ` : ''}
641
695
  - **Recommended Team**: ${getTeamRecommendation(taskAnalysis.taskType)}
642
696
 
@@ -1061,7 +1115,7 @@ Your agents MUST use these MCP tools IN THIS ORDER:
1061
1115
  - \`snow_get_by_sysid\` - Direct sys_id lookup
1062
1116
 
1063
1117
  3. **Flow Tools** (servicenow-flow-composer-mcp)
1064
- - \`snow_create_flow\` - Create flows from natural language
1118
+ - \`snow_create_flow\` - Create flows using XML-first approach with auto-deployment (RECOMMENDED)
1065
1119
  - \`snow_test_flow_with_mock\` - Test flows with mock data
1066
1120
  - \`snow_link_catalog_to_flow\` - Link catalog items to flows
1067
1121
 
@@ -1316,11 +1370,14 @@ if (flows.error?.includes("OAuth")) {
1316
1370
  trigger: "When record created on [table]",
1317
1371
  steps: ["Step 1: Validate data", "Step 2: Process", "Step 3: Notify"],
1318
1372
  natural_language: "Complete flow instruction for snow_create_flow",
1319
- deployment_command: "snow_create_flow with instruction from Memory"
1373
+ deployment_command: "snow_create_flow with deploy_immediately: true"
1320
1374
  });
1321
1375
  } else {
1322
- // Create flow directly
1323
- await snow_create_flow({ instruction: "natural language description" });
1376
+ // Create flow directly using XML-first approach
1377
+ await snow_create_flow({
1378
+ instruction: "natural language description",
1379
+ deploy_immediately: true
1380
+ });
1324
1381
  }
1325
1382
  \`\`\`
1326
1383
 
@@ -2890,7 +2947,7 @@ await snow_update_set_add_artifact({
2890
2947
  steps: [
2891
2948
  "snow_validate_live_connection",
2892
2949
  "snow_discover_existing_flows",
2893
- "snow_create_flow",
2950
+ "snow_create_flow (with deploy_immediately: true)",
2894
2951
  "snow_test_flow_with_mock",
2895
2952
  "snow_link_catalog_to_flow (if needed)",
2896
2953
  "snow_comprehensive_flow_test (if authenticated)"
@@ -2903,7 +2960,7 @@ await snow_update_set_add_artifact({
2903
2960
  "snow_analyze_requirements",
2904
2961
  "snow_update_set_create",
2905
2962
  "snow_deploy (multiple artifacts)",
2906
- "snow_create_flow (for workflows)",
2963
+ "snow_create_flow (for flows)",
2907
2964
  "snow_deploy (for widgets)",
2908
2965
  "snow_update_set_complete"
2909
2966
  ]
@@ -3196,8 +3253,7 @@ snow_get_by_sysid({
3196
3253
  // Create flows from natural language
3197
3254
  snow_create_flow({
3198
3255
  instruction: "create a flow that sends email when incident priority is high",
3199
- deploy_immediately: true,
3200
- enable_intelligent_analysis: true
3256
+ deploy_immediately: true // Automatically deploys XML to ServiceNow
3201
3257
  });
3202
3258
 
3203
3259
  // Test flows with mock data
@@ -3571,12 +3627,16 @@ SNOW_FLOW_TIMEOUT_MINUTES=0
3571
3627
  // Check if .env already exists
3572
3628
  try {
3573
3629
  await fs_1.promises.access(envFilePath);
3574
- console.log('āš ļø .env file already exists, creating .env.example instead...');
3630
+ console.log('āš ļø .env file already exists, creating .env.example template instead');
3631
+ console.log('šŸ“ To recreate .env: delete existing .env file and run init again');
3575
3632
  await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.env.example'), envContent);
3633
+ console.log('āœ… .env.example template created');
3576
3634
  }
3577
3635
  catch {
3578
3636
  // .env doesn't exist, create it
3637
+ console.log('šŸ“„ Creating new .env file...');
3579
3638
  await fs_1.promises.writeFile(envFilePath, envContent);
3639
+ console.log('āœ… .env file created successfully');
3580
3640
  }
3581
3641
  }
3582
3642
  async function appendToEnvFile(targetDir, content) {
@@ -5149,7 +5209,7 @@ program
5149
5209
  console.log(`\nšŸ‘‘ ServiceNow Queen Agent v${version_js_1.VERSION} - Hive-Mind Intelligence`);
5150
5210
  console.log('šŸ Elegant orchestration replacing complex team coordination\n');
5151
5211
  try {
5152
- const { QueenIntegration } = await Promise.resolve().then(() => __importStar(require('../examples/queen/integration-example.js')));
5212
+ const { QueenIntegration } = await Promise.resolve().then(() => __importStar(require('./examples/queen/integration-example.js')));
5153
5213
  const queenIntegration = new QueenIntegration({
5154
5214
  debugMode: options.debug || false
5155
5215
  });
@@ -355,6 +355,9 @@ class ServiceNowDeploymentMCP extends base_mcp_server_js_1.BaseMCPServer {
355
355
  case 'business_rule':
356
356
  result = await this.deployScript(type, config, context, finalUpdateSetId);
357
357
  break;
358
+ case 'xml_update_set':
359
+ result = await this.deployXMLUpdateSet(config, context);
360
+ break;
358
361
  default:
359
362
  throw new Error(`Unsupported deployment type: ${type}`);
360
363
  }