snow-flow 3.5.16 → 3.5.17

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.
@@ -109,6 +109,7 @@ export declare class ArtifactLocalSync {
109
109
  getSyncStatus(sys_id: string): string;
110
110
  /**
111
111
  * Pull any supported artifact type by detecting table from sys_id
112
+ * ENHANCED: Better error logging and more robust detection
112
113
  */
113
114
  pullArtifactBySysId(sys_id: string): Promise<LocalArtifact>;
114
115
  /**
@@ -703,26 +703,55 @@ snow-flow sync status ${widget.sys_id}
703
703
  }
704
704
  /**
705
705
  * Pull any supported artifact type by detecting table from sys_id
706
+ * ENHANCED: Better error logging and more robust detection
706
707
  */
707
708
  async pullArtifactBySysId(sys_id) {
708
- // Try to detect table by querying common tables
709
- const tables = Object.keys(artifact_registry_1.ARTIFACT_REGISTRY);
709
+ console.log(`\nšŸ” Auto-detecting artifact type for sys_id: ${sys_id}`);
710
+ console.log(`šŸ“‹ Checking ${Object.keys(artifact_registry_1.ARTIFACT_REGISTRY).length} supported tables...`);
711
+ // SMART ORDER: Check most common tables first for better performance
712
+ const allTables = Object.keys(artifact_registry_1.ARTIFACT_REGISTRY);
713
+ const commonTables = ['sp_widget', 'sys_script_include', 'sys_script', 'sys_ui_page'];
714
+ const otherTables = allTables.filter(t => !commonTables.includes(t));
715
+ const tables = [...commonTables, ...otherTables]; // Common tables first
710
716
  const timeoutConfig = (0, mcp_timeout_config_js_1.getMCPTimeoutConfig)();
717
+ const errors = [];
711
718
  for (const table of tables) {
712
719
  try {
713
- // Quick query with short timeout
714
- const response = await (0, mcp_timeout_config_js_1.withMCPTimeout)(this.client.searchRecords(table, `sys_id=${sys_id}`, 1), 3000, // 3 second timeout for detection
720
+ console.log(` šŸ”Ž Checking table: ${table}...`);
721
+ // Increased timeout for better reliability
722
+ const response = await (0, mcp_timeout_config_js_1.withMCPTimeout)(this.client.searchRecords(table, `sys_id=${sys_id}`, 1), 8000, // 8 second timeout per table (was 3s)
715
723
  `Detect table for ${sys_id}`);
716
724
  if (response.result?.[0]) {
717
- console.log(`šŸŽ† Found artifact in table: ${table}`);
725
+ console.log(` āœ… Found in table: ${table}`);
726
+ console.log(`šŸŽ† Auto-detection successful! Proceeding with pull...`);
718
727
  return this.pullArtifact(table, sys_id);
719
728
  }
729
+ else {
730
+ console.log(` āŒ Not found in: ${table}`);
731
+ }
720
732
  }
721
733
  catch (error) {
722
- // Table might not exist, continue searching
734
+ const errorMsg = error instanceof Error ? error.message : String(error);
735
+ console.log(` āš ļø Error checking ${table}: ${errorMsg}`);
736
+ errors.push({ table, error: errorMsg });
737
+ // Don't fail on permission errors, timeouts, etc. - keep trying other tables
723
738
  }
724
739
  }
725
- throw new Error(`Could not find artifact with sys_id ${sys_id} in any supported table`);
740
+ // Generate detailed error message
741
+ console.log(`\nāŒ Artifact detection failed!`);
742
+ console.log(`šŸ” Searched ${tables.length} tables for sys_id: ${sys_id}`);
743
+ if (errors.length > 0) {
744
+ console.log(`\nāš ļø Errors encountered:`);
745
+ errors.forEach(({ table, error }) => {
746
+ console.log(` ${table}: ${error}`);
747
+ });
748
+ }
749
+ console.log(`\nšŸ’” Troubleshooting tips:`);
750
+ console.log(` 1. Verify the sys_id exists in ServiceNow`);
751
+ console.log(` 2. Check your permissions for the target table`);
752
+ console.log(` 3. Try specifying the table explicitly: snow_pull_artifact({sys_id, table: 'sp_widget'})`);
753
+ console.log(` 4. Supported tables: ${tables.join(', ')}`);
754
+ throw new Error(`Could not find artifact with sys_id ${sys_id} in any supported table. See details above.`);
726
755
  }
727
756
  /**
728
757
  * Get supported artifact types
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.5.16",
4
- "description": "ServiceNow development framework with EMERGENCY FIX for wrapper multiplication bug. v3.5.16 FIXES the triple/quadruple wrapper problem in v3.5.15. Features ULTRA-CONSERVATIVE wrapper system that aggressively strips ALL wrapper variations and only adds wrappers for truly minimal content (<50 chars). No more duplicate HTML comments or function wrappers. Enhanced 'snow-flow init' creates optimized settings.json with 18 MCP servers, extensive development permissions, intelligent hooks, and ServiceNow-specific commands. Features intelligent timeout configuration and comprehensive ServiceNow development workflow.",
3
+ "version": "3.5.17",
4
+ "description": "ServiceNow development framework with ROBUST artifact detection fix. v3.5.17 FIXES the intermittent 'Could not find artifact' errors in snow_pull_artifact. Enhanced pullArtifactBySysId with detailed error logging, longer timeouts (8s per table), smart table ordering, and comprehensive troubleshooting guidance. ULTRA-CONSERVATIVE wrapper system prevents duplicate HTML comments. Enhanced 'snow-flow init' creates optimized settings.json with 18 MCP servers, extensive development permissions, intelligent hooks, and ServiceNow-specific commands. Features intelligent timeout configuration and comprehensive ServiceNow development workflow.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {