snow-flow 1.3.0 → 1.3.2
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-flow/queen/queen-memory.db +0 -0
- package/.env.example +249 -14
- package/CLAUDE.md +185 -24
- package/README.md +55 -5
- package/dist/api/error-handling.js +898 -4
- package/dist/api/performance-optimizer.js +3 -2
- package/dist/cli.js +590 -200
- package/dist/config/snow-flow-config.js +320 -8
- package/dist/health/system-health.js +288 -21
- package/dist/mcp/base-mcp-server.js +2 -0
- package/dist/mcp/http-transport-wrapper.js +65 -4
- package/dist/mcp/servicenow-automation-mcp-refactored.js +90 -9
- package/dist/mcp/servicenow-deployment-mcp-refactored.js +151 -2
- package/dist/mcp/servicenow-deployment-mcp.js +828 -15
- package/dist/mcp/servicenow-integration-mcp-refactored.js +100 -9
- package/dist/mcp/servicenow-intelligent-mcp.js +198 -7
- package/dist/mcp/servicenow-memory-mcp.js +2 -1
- package/dist/mcp/servicenow-operations-mcp-refactored.js +3 -2
- package/dist/mcp/servicenow-xml-flow-mcp.js +671 -0
- package/dist/mcp/shared/base-mcp-server.js +1356 -8
- package/dist/mcp/shared/mcp-resource-manager.js +304 -0
- package/dist/queen/parallel-agent-engine.js +26 -8
- package/dist/queen/servicenow-queen.js +47 -44
- package/dist/sparc/sparc-help.js +37 -26
- package/dist/sparc/team-sparc.js +60 -16
- package/dist/utils/action-type-cache.js +2 -1
- package/dist/utils/mcp-config-manager.js +7 -3
- package/dist/utils/mcp-server-manager.js +7 -3
- package/dist/utils/servicenow-client.js +134 -107
- package/dist/utils/servicenow-id-generator.js +171 -0
- package/dist/utils/snow-oauth.js +13 -8
- package/dist/utils/widget-template-generator.js +1690 -0
- package/dist/utils/xml-first-flow-generator.js +473 -0
- package/dist/version.js +7 -1
- package/flow-update-sets/flow_build_automated_approval_flow_with_notifications_flow.xml +203 -0
- package/flow-update-sets/flow_create_approval_flow_for_equipment_requests_flow.xml +206 -0
- package/flow-update-sets/flow_create_equipment_approval_flow_with_manager_approv_flow.xml +254 -0
- package/flow-update-sets/iphone_15_pro_approval_flow.xml +203 -0
- package/flow-update-sets/test_iphone_approval_flow_flow.xml +303 -0
- package/package.json +2 -1
- package/test-config.js +55 -0
- package/test-real-monitoring.js +184 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* ServiceNow Deployment MCP Server - Agent-Integrated Version
|
|
5
5
|
* Provides specialized deployment tools with full agent coordination
|
|
6
|
+
* NEW v1.3.1: Complete XML Update Set auto-import with preview and commit controls
|
|
6
7
|
*/
|
|
7
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
9
|
exports.ServiceNowDeploymentMCP = void 0;
|
|
@@ -11,6 +12,7 @@ const base_mcp_server_js_1 = require("./shared/base-mcp-server.js");
|
|
|
11
12
|
const scope_manager_js_1 = require("../managers/scope-manager.js");
|
|
12
13
|
const global_scope_strategy_js_1 = require("../strategies/global-scope-strategy.js");
|
|
13
14
|
const artifact_tracker_js_1 = require("../utils/artifact-tracker.js");
|
|
15
|
+
const fs_1 = require("fs");
|
|
14
16
|
class ServiceNowDeploymentMCP extends base_mcp_server_js_1.BaseMCPServer {
|
|
15
17
|
constructor() {
|
|
16
18
|
super('servicenow-deployment', '2.0.0');
|
|
@@ -38,8 +40,22 @@ class ServiceNowDeploymentMCP extends base_mcp_server_js_1.BaseMCPServer {
|
|
|
38
40
|
properties: {
|
|
39
41
|
type: {
|
|
40
42
|
type: 'string',
|
|
41
|
-
enum: ['widget', 'flow', 'application', 'script', 'business_rule', 'table', 'batch'],
|
|
42
|
-
description: 'Type of artifact to deploy'
|
|
43
|
+
enum: ['widget', 'flow', 'application', 'script', 'business_rule', 'table', 'batch', 'xml_update_set'],
|
|
44
|
+
description: 'Type of artifact to deploy (use xml_update_set for XML import)'
|
|
45
|
+
},
|
|
46
|
+
xml_file_path: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'Path to XML update set file (for xml_update_set type)'
|
|
49
|
+
},
|
|
50
|
+
auto_preview: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
description: 'Automatically preview the update set after import (default: true)',
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
auto_commit: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
description: 'Automatically commit the update set if preview is clean (default: true)',
|
|
58
|
+
default: true
|
|
43
59
|
},
|
|
44
60
|
instruction: {
|
|
45
61
|
type: 'string',
|
|
@@ -233,6 +249,9 @@ class ServiceNowDeploymentMCP extends base_mcp_server_js_1.BaseMCPServer {
|
|
|
233
249
|
if (args.type === 'batch') {
|
|
234
250
|
result = await this.deployBatch(args, context, updateSetId);
|
|
235
251
|
}
|
|
252
|
+
else if (args.type === 'xml_update_set') {
|
|
253
|
+
result = await this.deployXMLUpdateSet(args, context);
|
|
254
|
+
}
|
|
236
255
|
else {
|
|
237
256
|
result = await this.deploySingleArtifact(args, context, updateSetId);
|
|
238
257
|
}
|
|
@@ -438,6 +457,136 @@ class ServiceNowDeploymentMCP extends base_mcp_server_js_1.BaseMCPServer {
|
|
|
438
457
|
throw error;
|
|
439
458
|
}
|
|
440
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* Deploy XML Update Set to ServiceNow
|
|
462
|
+
*/
|
|
463
|
+
async deployXMLUpdateSet(args, context) {
|
|
464
|
+
const { xml_file_path, auto_preview = true, auto_commit = true } = args;
|
|
465
|
+
if (!xml_file_path) {
|
|
466
|
+
throw new Error('XML file path is required for xml_update_set deployment');
|
|
467
|
+
}
|
|
468
|
+
this.logger.info('🚀 Deploying XML Update Set', {
|
|
469
|
+
file: xml_file_path,
|
|
470
|
+
auto_preview,
|
|
471
|
+
auto_commit
|
|
472
|
+
});
|
|
473
|
+
try {
|
|
474
|
+
// Read XML file
|
|
475
|
+
await this.reportProgress(context, 20, 'Reading XML file');
|
|
476
|
+
const xmlContent = await fs_1.promises.readFile(xml_file_path, 'utf-8');
|
|
477
|
+
// Import XML as remote update set
|
|
478
|
+
await this.reportProgress(context, 40, 'Importing XML to ServiceNow');
|
|
479
|
+
const importResponse = await this.client.makeRequest({
|
|
480
|
+
method: 'POST',
|
|
481
|
+
url: '/api/now/table/sys_remote_update_set',
|
|
482
|
+
headers: {
|
|
483
|
+
'Content-Type': 'application/xml',
|
|
484
|
+
'Accept': 'application/json'
|
|
485
|
+
},
|
|
486
|
+
data: xmlContent
|
|
487
|
+
});
|
|
488
|
+
if (!importResponse.result || !importResponse.result.sys_id) {
|
|
489
|
+
throw new Error('Failed to import XML update set');
|
|
490
|
+
}
|
|
491
|
+
const remoteUpdateSetId = importResponse.result.sys_id;
|
|
492
|
+
this.logger.info('✅ XML imported successfully', { sys_id: remoteUpdateSetId });
|
|
493
|
+
// Load the update set
|
|
494
|
+
await this.reportProgress(context, 60, 'Loading update set');
|
|
495
|
+
await this.client.makeRequest({
|
|
496
|
+
method: 'PUT',
|
|
497
|
+
url: `/api/now/table/sys_remote_update_set/${remoteUpdateSetId}`,
|
|
498
|
+
data: {
|
|
499
|
+
state: 'loaded'
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
// Find the loaded update set
|
|
503
|
+
const loadedResponse = await this.client.makeRequest({
|
|
504
|
+
method: 'GET',
|
|
505
|
+
url: '/api/now/table/sys_update_set',
|
|
506
|
+
params: {
|
|
507
|
+
sysparm_query: `remote_sys_id=${remoteUpdateSetId}`,
|
|
508
|
+
sysparm_limit: 1
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
if (!loadedResponse.result || loadedResponse.result.length === 0) {
|
|
512
|
+
throw new Error('Failed to find loaded update set');
|
|
513
|
+
}
|
|
514
|
+
const updateSetId = loadedResponse.result[0].sys_id;
|
|
515
|
+
const updateSetName = loadedResponse.result[0].name;
|
|
516
|
+
// Preview if requested
|
|
517
|
+
if (auto_preview) {
|
|
518
|
+
await this.reportProgress(context, 80, 'Previewing update set');
|
|
519
|
+
const previewResponse = await this.client.makeRequest({
|
|
520
|
+
method: 'POST',
|
|
521
|
+
url: `/api/now/table/sys_update_set/${updateSetId}/preview`
|
|
522
|
+
});
|
|
523
|
+
// Check preview results
|
|
524
|
+
const previewProblems = await this.client.makeRequest({
|
|
525
|
+
method: 'GET',
|
|
526
|
+
url: '/api/now/table/sys_update_preview_problem',
|
|
527
|
+
params: {
|
|
528
|
+
sysparm_query: `update_set=${updateSetId}`,
|
|
529
|
+
sysparm_limit: 100
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
if (previewProblems.result && previewProblems.result.length > 0) {
|
|
533
|
+
const problems = previewProblems.result.map((p) => `- ${p.type}: ${p.description}`).join('\n');
|
|
534
|
+
if (auto_commit) {
|
|
535
|
+
this.logger.warn('Preview found problems, skipping auto-commit', { problems });
|
|
536
|
+
}
|
|
537
|
+
return this.createSuccessResponse('XML imported and previewed with problems', {
|
|
538
|
+
update_set_id: updateSetId,
|
|
539
|
+
update_set_name: updateSetName,
|
|
540
|
+
preview_status: 'problems_found',
|
|
541
|
+
problems: previewProblems.result,
|
|
542
|
+
next_steps: [
|
|
543
|
+
'1. Review preview problems in ServiceNow',
|
|
544
|
+
'2. Resolve any issues',
|
|
545
|
+
'3. Commit manually when ready'
|
|
546
|
+
]
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
// Commit if clean and requested
|
|
550
|
+
if (auto_commit) {
|
|
551
|
+
await this.reportProgress(context, 95, 'Committing update set');
|
|
552
|
+
await this.client.makeRequest({
|
|
553
|
+
method: 'POST',
|
|
554
|
+
url: `/api/now/table/sys_update_set/${updateSetId}/commit`
|
|
555
|
+
});
|
|
556
|
+
return this.createSuccessResponse('✅ XML Update Set imported, previewed, and committed successfully!', {
|
|
557
|
+
update_set_id: updateSetId,
|
|
558
|
+
update_set_name: updateSetName,
|
|
559
|
+
status: 'committed',
|
|
560
|
+
flow_location: 'Flow Designer > Designer',
|
|
561
|
+
next_steps: [
|
|
562
|
+
'1. Navigate to Flow Designer',
|
|
563
|
+
'2. Your flow should be visible in the list',
|
|
564
|
+
'3. Open the flow to verify all components'
|
|
565
|
+
]
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
// Return success without preview/commit
|
|
570
|
+
return this.createSuccessResponse('XML Update Set imported successfully', {
|
|
571
|
+
update_set_id: updateSetId,
|
|
572
|
+
update_set_name: updateSetName,
|
|
573
|
+
status: 'imported',
|
|
574
|
+
next_steps: [
|
|
575
|
+
'1. Navigate to System Update Sets > Local Update Sets',
|
|
576
|
+
'2. Find your update set: ' + updateSetName,
|
|
577
|
+
'3. Click Preview Update Set',
|
|
578
|
+
'4. Review and commit when ready'
|
|
579
|
+
]
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
catch (error) {
|
|
583
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
584
|
+
if (errorMsg.includes('ENOENT')) {
|
|
585
|
+
throw new Error(`XML file not found: ${xml_file_path}`);
|
|
586
|
+
}
|
|
587
|
+
throw new Error(`Failed to deploy XML update set: ${errorMsg}`);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
441
590
|
/**
|
|
442
591
|
* Deploy widget with agent tracking and intelligent error handling
|
|
443
592
|
*/
|