snow-flow 4.5.21 → 4.5.22

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
@@ -524,20 +524,25 @@ Snow-Flow includes 18 specialized MCP servers, each providing comprehensive Serv
524
524
  - Property validation
525
525
 
526
526
  ### 7. ServiceNow Update Set Server
527
- **Purpose:** Change management and deployment
527
+ **Purpose:** Change management and deployment with automatic user synchronization
528
528
 
529
529
  **Key Tools:**
530
530
  - `snow_create_update_set` - Create new update sets
531
- - `snow_switch_update_set` - Switch active update set
531
+ - `snow_ensure_active_update_set` - Ensure active Update Set (auto-syncs current)
532
+ - `snow_sync_current_update_set` - **NEW:** Sync user's current Update Set with Snow-Flow
532
533
  - `snow_complete_update_set` - Mark as complete
533
534
  - `snow_preview_update_set` - Preview changes
534
535
  - `snow_export_update_set` - Export as XML
535
536
 
537
+ **🆕 AUTO-SYNC FEATURE:**
538
+ Snow-Flow now automatically sets its Update Set as the user's current Update Set in ServiceNow. This prevents confusion where Snow-Flow works in one Update Set while the user sees a different current Update Set.
539
+
536
540
  **Features:**
537
- - Full update set lifecycle
538
- - Change tracking
539
- - XML export/import
540
- - Conflict detection
541
+ - **Automatic current Update Set synchronization** - user and Snow-Flow always in same Update Set
542
+ - Full update set lifecycle management
543
+ - Change tracking and artifact management
544
+ - XML export/import capabilities
545
+ - Conflict detection and resolution
541
546
 
542
547
  ### 8. ServiceNow Development Assistant Server
543
548
  **Purpose:** Code generation and best practices
@@ -263,6 +263,9 @@ class ServiceNowUpdateSetMCP {
263
263
  case 'snow_ensure_active_update_set':
264
264
  result = await this.ensureActiveUpdateSet(args);
265
265
  break;
266
+ case 'snow_sync_current_update_set':
267
+ result = await this.syncCurrentUpdateSet(args);
268
+ break;
266
269
  default:
267
270
  throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
268
271
  }
@@ -663,20 +666,19 @@ ${changes.length > 20 ? `\n... and ${changes.length - 20} more changes` : ''}
663
666
  this.logger.info('Ensuring active Update Set session', args);
664
667
  // Check if we already have an active session
665
668
  if (this.currentSession?.state === 'in_progress') {
669
+ // Also sync current Update Set if requested
670
+ if (args.set_as_current !== false) {
671
+ await this.syncCurrentUpdateSet({ force_switch: true });
672
+ }
666
673
  return {
667
- content: [{
668
- type: 'text',
669
- text: `✅ **Active Update Set Session Found**
670
-
671
- 📋 **Current Session:**
672
- - **Name**: ${this.currentSession.name}
673
- - **ID**: ${this.currentSession.update_set_id}
674
- - **Created**: ${new Date(this.currentSession.created_at).toLocaleString()}
675
- - **Artifacts**: ${this.currentSession.artifacts?.length || 0} tracked
676
-
677
- ⚡ **Ready for Deployment**
678
- All subsequent changes will be tracked in this Update Set.`
679
- }]
674
+ success: true,
675
+ message: 'Active Update Set session found and synchronized',
676
+ update_set: {
677
+ name: this.currentSession.name,
678
+ sys_id: this.currentSession.update_set_id,
679
+ artifacts_count: this.currentSession.artifacts?.length || 0
680
+ },
681
+ synchronized: args.set_as_current !== false
680
682
  };
681
683
  }
682
684
  // Auto-create if requested (default: true)
@@ -737,6 +739,86 @@ snow_update_set_create({
737
739
  .map(([type, count]) => `- ${type}: ${count}`)
738
740
  .join('\n');
739
741
  }
742
+ /**
743
+ * NEW: Synchronize user's current Update Set with Snow-Flow's active Update Set
744
+ */
745
+ async syncCurrentUpdateSet(args) {
746
+ try {
747
+ this.logger.info('Synchronizing user current Update Set with Snow-Flow session...');
748
+ if (!this.currentSession) {
749
+ return {
750
+ success: false,
751
+ error: 'No active Snow-Flow Update Set session found.',
752
+ suggestion: 'Run snow_ensure_active_update_set first to create or activate an Update Set.'
753
+ };
754
+ }
755
+ // Set Snow-Flow Update Set as current for user via script
756
+ const syncScript = `
757
+ // Synchronize user's current Update Set with Snow-Flow session
758
+ var updateSetId = '${this.currentSession.update_set_id}';
759
+ var currentUser = gs.getUserID();
760
+
761
+ // Get current Update Set info
762
+ var updateSet = new GlideRecord('sys_update_set');
763
+ if (updateSet.get(updateSetId)) {
764
+ gs.info('Snow-Flow Update Set found: ' + updateSet.name);
765
+
766
+ // Set as current for user via session variable
767
+ gs.getSession().putProperty('update_set', updateSetId);
768
+ gs.info('Set as current Update Set for user: ' + updateSet.name);
769
+
770
+ // Also try to set via user preference
771
+ var pref = new GlideRecord('sys_user_preference');
772
+ pref.addQuery('user', currentUser);
773
+ pref.addQuery('name', 'update_set.current');
774
+ pref.query();
775
+
776
+ if (pref.next()) {
777
+ pref.value = updateSetId;
778
+ pref.update();
779
+ gs.info('Updated user preference for current Update Set');
780
+ } else {
781
+ var newPref = new GlideRecord('sys_user_preference');
782
+ newPref.initialize();
783
+ newPref.user = currentUser;
784
+ newPref.name = 'update_set.current';
785
+ newPref.value = updateSetId;
786
+ newPref.insert();
787
+ gs.info('Created user preference for current Update Set');
788
+ }
789
+
790
+ gs.info('SYNC COMPLETE: User current Update Set = Snow-Flow session Update Set');
791
+ } else {
792
+ gs.error('Snow-Flow Update Set not found: ' + updateSetId);
793
+ }
794
+ `;
795
+ const scriptResponse = await this.client.executeScript(syncScript);
796
+ if (!scriptResponse.success) {
797
+ return {
798
+ success: false,
799
+ error: 'Failed to synchronize current Update Set',
800
+ suggestion: 'Check ServiceNow connection and Update Set permissions',
801
+ update_set_id: this.currentSession.update_set_id
802
+ };
803
+ }
804
+ return {
805
+ success: true,
806
+ message: `Current Update Set synchronized with Snow-Flow session`,
807
+ update_set_name: this.currentSession.name,
808
+ update_set_id: this.currentSession.update_set_id,
809
+ sync_method: 'session_variable_and_user_preference',
810
+ sync_status: 'completed'
811
+ };
812
+ }
813
+ catch (error) {
814
+ this.logger.error('Failed to sync current Update Set:', error);
815
+ return {
816
+ success: false,
817
+ error: error instanceof Error ? error.message : String(error),
818
+ suggestion: 'Check ServiceNow connection and permissions'
819
+ };
820
+ }
821
+ }
740
822
  async run() {
741
823
  const transport = new stdio_js_1.StdioServerTransport();
742
824
  await this.server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "4.5.21",
3
+ "version": "4.5.22",
4
4
  "description": "Conversational ServiceNow development platform using Claude Code. Multi-agent orchestration with 20+ MCP servers providing 200+ ServiceNow tools for comprehensive platform development.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",