snow-flow 1.3.17 → 1.3.18

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 validationauto tracking
702
+ # What happens: snow_create_flow({ deploy_immediately: true }) → live deploymentflow 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: ImportLoad → Preview → Commit (only if clean)
35
+ # ✅ Zero manual steps: GenerateImport → 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");
@@ -617,26 +618,39 @@ You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mis
617
618
  - **Estimated Total Agents**: ${taskAnalysis.estimatedAgentCount}
618
619
  - **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
619
620
 
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"\`
621
+ ${isFlowDesignerTask ? `## 🔧 Flow Designer Task Detected - Using XML-First Approach!
622
+ 🚀 **FULLY AUTOMATED FLOW DEPLOYMENT** - Zero manual steps required!
623
+
624
+ **MANDATORY: Use this exact approach for Flow Designer tasks:**
625
+
626
+ \`\`\`javascript
627
+ // CORRECT: Fully automated XML generation + deployment
628
+ await snow_create_flow({
629
+ instruction: "your natural language flow description",
630
+ deploy_immediately: true // 🔥 Automatically deploys to ServiceNow!
631
+ });
632
+ \`\`\`
633
+
634
+ 🎯 **What this does automatically:**
635
+ - Parses natural language to complete flow structure
636
+ - Generates production-ready Update Set XML (v2 format)
637
+ - Imports XML to ServiceNow as remote update set
638
+ - Previews for conflicts and validates structure
639
+ - Commits update set if preview is clean
640
+ - Reports deployment status and provides flow URL
641
+ - ✅ Handles all errors gracefully with fallback instructions
642
+
643
+ 🚫 **FORBIDDEN APPROACHES:**
644
+ - ❌ DO NOT use old API-only approach without XML generation
645
+ - ❌ DO NOT use manual \`snow-flow deploy-xml\` commands
646
+ - ❌ DO NOT generate XML without auto-deployment
647
+
648
+ 💡 **Why XML-First?**
649
+ - Works with complex flows that break API methods
650
+ - Production-ready Flow Designer format with all required fields
651
+ - Complete automation from instruction to live ServiceNow flow
652
+ - Zero chance of "too small to work" or import failures
653
+
640
654
  ` : ''}
641
655
  - **Recommended Team**: ${getTeamRecommendation(taskAnalysis.taskType)}
642
656
 
@@ -1061,7 +1075,7 @@ Your agents MUST use these MCP tools IN THIS ORDER:
1061
1075
  - \`snow_get_by_sysid\` - Direct sys_id lookup
1062
1076
 
1063
1077
  3. **Flow Tools** (servicenow-flow-composer-mcp)
1064
- - \`snow_create_flow\` - Create flows from natural language
1078
+ - \`snow_create_flow\` - Create flows using XML-first approach with auto-deployment (RECOMMENDED)
1065
1079
  - \`snow_test_flow_with_mock\` - Test flows with mock data
1066
1080
  - \`snow_link_catalog_to_flow\` - Link catalog items to flows
1067
1081
 
@@ -1316,11 +1330,14 @@ if (flows.error?.includes("OAuth")) {
1316
1330
  trigger: "When record created on [table]",
1317
1331
  steps: ["Step 1: Validate data", "Step 2: Process", "Step 3: Notify"],
1318
1332
  natural_language: "Complete flow instruction for snow_create_flow",
1319
- deployment_command: "snow_create_flow with instruction from Memory"
1333
+ deployment_command: "snow_create_flow with deploy_immediately: true"
1320
1334
  });
1321
1335
  } else {
1322
- // Create flow directly
1323
- await snow_create_flow({ instruction: "natural language description" });
1336
+ // Create flow directly using XML-first approach
1337
+ await snow_create_flow({
1338
+ instruction: "natural language description",
1339
+ deploy_immediately: true
1340
+ });
1324
1341
  }
1325
1342
  \`\`\`
1326
1343
 
@@ -2890,7 +2907,7 @@ await snow_update_set_add_artifact({
2890
2907
  steps: [
2891
2908
  "snow_validate_live_connection",
2892
2909
  "snow_discover_existing_flows",
2893
- "snow_create_flow",
2910
+ "snow_create_flow (with deploy_immediately: true)",
2894
2911
  "snow_test_flow_with_mock",
2895
2912
  "snow_link_catalog_to_flow (if needed)",
2896
2913
  "snow_comprehensive_flow_test (if authenticated)"
@@ -2903,7 +2920,7 @@ await snow_update_set_add_artifact({
2903
2920
  "snow_analyze_requirements",
2904
2921
  "snow_update_set_create",
2905
2922
  "snow_deploy (multiple artifacts)",
2906
- "snow_create_flow (for workflows)",
2923
+ "snow_create_flow (for flows)",
2907
2924
  "snow_deploy (for widgets)",
2908
2925
  "snow_update_set_complete"
2909
2926
  ]
@@ -3196,8 +3213,7 @@ snow_get_by_sysid({
3196
3213
  // Create flows from natural language
3197
3214
  snow_create_flow({
3198
3215
  instruction: "create a flow that sends email when incident priority is high",
3199
- deploy_immediately: true,
3200
- enable_intelligent_analysis: true
3216
+ deploy_immediately: true // Automatically deploys XML to ServiceNow
3201
3217
  });
3202
3218
 
3203
3219
  // Test flows with mock data
@@ -3571,12 +3587,16 @@ SNOW_FLOW_TIMEOUT_MINUTES=0
3571
3587
  // Check if .env already exists
3572
3588
  try {
3573
3589
  await fs_1.promises.access(envFilePath);
3574
- console.log('⚠️ .env file already exists, creating .env.example instead...');
3590
+ console.log('⚠️ .env file already exists, creating .env.example template instead');
3591
+ console.log('📝 To recreate .env: delete existing .env file and run init again');
3575
3592
  await fs_1.promises.writeFile((0, path_1.join)(targetDir, '.env.example'), envContent);
3593
+ console.log('✅ .env.example template created');
3576
3594
  }
3577
3595
  catch {
3578
3596
  // .env doesn't exist, create it
3597
+ console.log('📄 Creating new .env file...');
3579
3598
  await fs_1.promises.writeFile(envFilePath, envContent);
3599
+ console.log('✅ .env file created successfully');
3580
3600
  }
3581
3601
  }
3582
3602
  async function appendToEnvFile(targetDir, content) {
@@ -5149,7 +5169,7 @@ program
5149
5169
  console.log(`\n👑 ServiceNow Queen Agent v${version_js_1.VERSION} - Hive-Mind Intelligence`);
5150
5170
  console.log('🐝 Elegant orchestration replacing complex team coordination\n');
5151
5171
  try {
5152
- const { QueenIntegration } = await Promise.resolve().then(() => __importStar(require('../examples/queen/integration-example.js')));
5172
+ const { QueenIntegration } = await Promise.resolve().then(() => __importStar(require('./examples/queen/integration-example.js')));
5153
5173
  const queenIntegration = new QueenIntegration({
5154
5174
  debugMode: options.debug || false
5155
5175
  });
@@ -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
  }
@@ -5231,10 +5231,145 @@ Use individual deployment tools like \`snow_deploy_${args.type}\` with manual co
5231
5231
  return await this.deployFlow(scopedConfig);
5232
5232
  case 'application':
5233
5233
  return await this.deployApplication(scopedConfig);
5234
+ case 'xml_update_set':
5235
+ return await this.deployXMLUpdateSet(scopedConfig);
5234
5236
  default:
5235
5237
  throw new Error(`Unsupported artifact type for unified deployment: ${type}`);
5236
5238
  }
5237
5239
  }
5240
+ /**
5241
+ * Deploy XML Update Set to ServiceNow
5242
+ */
5243
+ async deployXMLUpdateSet(config) {
5244
+ const { xml_file_path, auto_preview = true, auto_commit = true } = config;
5245
+ if (!xml_file_path) {
5246
+ throw new Error('XML file path is required for xml_update_set deployment');
5247
+ }
5248
+ this.logger.info('🚀 Deploying XML Update Set', {
5249
+ file: xml_file_path,
5250
+ auto_preview,
5251
+ auto_commit
5252
+ });
5253
+ try {
5254
+ // Read XML file
5255
+ const fs = require('fs').promises;
5256
+ const xmlContent = await fs.readFile(xml_file_path, 'utf-8');
5257
+ // Import XML as remote update set
5258
+ const importResponse = await this.client.makeRequest({
5259
+ method: 'POST',
5260
+ url: '/api/now/table/sys_remote_update_set',
5261
+ headers: {
5262
+ 'Content-Type': 'application/xml',
5263
+ 'Accept': 'application/json'
5264
+ },
5265
+ data: xmlContent
5266
+ });
5267
+ if (!importResponse.result || !importResponse.result.sys_id) {
5268
+ throw new Error('Failed to import XML update set');
5269
+ }
5270
+ const remoteUpdateSetId = importResponse.result.sys_id;
5271
+ this.logger.info('✅ XML imported successfully', { sys_id: remoteUpdateSetId });
5272
+ // Load the update set
5273
+ await this.client.makeRequest({
5274
+ method: 'PUT',
5275
+ url: `/api/now/table/sys_remote_update_set/${remoteUpdateSetId}`,
5276
+ data: {
5277
+ state: 'loaded'
5278
+ }
5279
+ });
5280
+ // Find the loaded update set
5281
+ const loadedResponse = await this.client.makeRequest({
5282
+ method: 'GET',
5283
+ url: '/api/now/table/sys_update_set',
5284
+ params: {
5285
+ sysparm_query: `remote_sys_id=${remoteUpdateSetId}`,
5286
+ sysparm_limit: 1
5287
+ }
5288
+ });
5289
+ if (!loadedResponse.result || loadedResponse.result.length === 0) {
5290
+ throw new Error('Failed to find loaded update set');
5291
+ }
5292
+ const updateSetId = loadedResponse.result[0].sys_id;
5293
+ const updateSetName = loadedResponse.result[0].name;
5294
+ // Preview if requested
5295
+ if (auto_preview) {
5296
+ const previewResponse = await this.client.makeRequest({
5297
+ method: 'POST',
5298
+ url: `/api/now/table/sys_update_set/${updateSetId}/preview`
5299
+ });
5300
+ // Check preview results
5301
+ const previewProblems = await this.client.makeRequest({
5302
+ method: 'GET',
5303
+ url: '/api/now/table/sys_update_preview_problem',
5304
+ params: {
5305
+ sysparm_query: `update_set=${updateSetId}`,
5306
+ sysparm_limit: 100
5307
+ }
5308
+ });
5309
+ if (previewProblems.result && previewProblems.result.length > 0) {
5310
+ const problems = previewProblems.result.map((p) => `- ${p.type}: ${p.description}`).join('\n');
5311
+ if (auto_commit) {
5312
+ this.logger.warn('Preview found problems, skipping auto-commit', { problems });
5313
+ }
5314
+ return {
5315
+ success: true,
5316
+ message: 'XML imported and previewed with problems',
5317
+ update_set_id: updateSetId,
5318
+ update_set_name: updateSetName,
5319
+ preview_status: 'problems_found',
5320
+ problems: previewProblems.result,
5321
+ next_steps: [
5322
+ '1. Review preview problems in ServiceNow',
5323
+ '2. Resolve any issues',
5324
+ '3. Commit manually when ready'
5325
+ ]
5326
+ };
5327
+ }
5328
+ // Commit if clean and requested
5329
+ if (auto_commit) {
5330
+ await this.client.makeRequest({
5331
+ method: 'POST',
5332
+ url: `/api/now/table/sys_update_set/${updateSetId}/commit`
5333
+ });
5334
+ return {
5335
+ success: true,
5336
+ message: '✅ XML Update Set imported, previewed, and committed successfully!',
5337
+ update_set_id: updateSetId,
5338
+ update_set_name: updateSetName,
5339
+ status: 'committed',
5340
+ flow_location: 'Flow Designer > Designer',
5341
+ next_steps: [
5342
+ '1. Navigate to Flow Designer',
5343
+ '2. Your flow should be visible in the list',
5344
+ '3. Open the flow to verify all components'
5345
+ ]
5346
+ };
5347
+ }
5348
+ }
5349
+ // Return success without preview/commit
5350
+ return {
5351
+ success: true,
5352
+ message: 'XML Update Set imported successfully',
5353
+ update_set_id: updateSetId,
5354
+ update_set_name: updateSetName,
5355
+ status: 'imported',
5356
+ next_steps: [
5357
+ '1. Navigate to System Update Sets > Local Update Sets',
5358
+ '2. Find your update set: ' + updateSetName,
5359
+ '3. Click Preview Update Set',
5360
+ '4. Review and commit when ready'
5361
+ ]
5362
+ };
5363
+ }
5364
+ catch (error) {
5365
+ const errorMsg = error instanceof Error ? error.message : String(error);
5366
+ this.logger.error('XML deployment failed', { error: errorMsg, file: xml_file_path });
5367
+ if (errorMsg.includes('ENOENT') || errorMsg.includes('no such file')) {
5368
+ throw new Error(`XML file not found: ${xml_file_path}`);
5369
+ }
5370
+ throw new Error(`XML deployment failed: ${errorMsg}`);
5371
+ }
5372
+ }
5238
5373
  /**
5239
5374
  * Check if error is permission-related
5240
5375
  */