snow-flow 3.6.5 → 3.6.7

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.
@@ -199,7 +199,7 @@
199
199
  "args": [
200
200
  "{{PROJECT_ROOT}}/dist/mcp/servicenow-local-development-mcp.js"
201
201
  ],
202
- "description": "Local development bridge for Claude Code - pull any ServiceNow artifact to local files with native tool integration (snow_pull_artifact, snow_push_artifact, snow_validate_artifact_coherence), smart field chunking for large artifacts, ES5 validation, coherence checking, 12+ artifact types support",
202
+ "description": "UNIVERSAL ARTIFACT DETECTION v3.6.6 - finds ANY ServiceNow record by sys_id using sys_metadata! Pull any artifact (even custom tables) to local files with Claude Code native tools. Supports all tables, generic artifact creation for unknown types, smart chunking, ES5 validation, coherence checking. Tools: snow_pull_artifact, snow_push_artifact, snow_validate_artifact_coherence",
203
203
  "env": {
204
204
  "SNOW_INSTANCE": "{{SNOW_INSTANCE}}",
205
205
  "SNOW_CLIENT_ID": "{{SNOW_CLIENT_ID}}",
package/dist/cli.js CHANGED
@@ -2646,6 +2646,125 @@ async function createMCPConfig(targetDir, force = false) {
2646
2646
  const claudeSettingsPath = (0, path_1.join)(targetDir, '.claude/settings.json');
2647
2647
  await fs_1.promises.writeFile(claudeSettingsPath, JSON.stringify(claudeSettings, null, 2));
2648
2648
  }
2649
+ // Setup MCP configuration function
2650
+ async function setupMCPConfig(targetDir, instanceUrl, clientId, clientSecret, force = false) {
2651
+ // Find the Snow-Flow installation root
2652
+ let snowFlowRoot = '';
2653
+ // Try different locations to find the Snow-Flow root
2654
+ const possiblePaths = [
2655
+ (0, path_1.join)(targetDir, 'node_modules/snow-flow'),
2656
+ (0, path_1.join)(targetDir, '../snow-flow-dev/snow-flow'),
2657
+ (0, path_1.join)(process.env.HOME || '', 'Projects/snow-flow-dev/snow-flow'),
2658
+ __dirname.includes('dist') ? (0, path_1.resolve)(__dirname, '..') : __dirname
2659
+ ];
2660
+ for (const testPath of possiblePaths) {
2661
+ try {
2662
+ await fs_1.promises.access((0, path_1.join)(testPath, '.mcp.json.template'));
2663
+ snowFlowRoot = testPath;
2664
+ break;
2665
+ }
2666
+ catch {
2667
+ // Keep trying
2668
+ }
2669
+ }
2670
+ if (!snowFlowRoot) {
2671
+ // Last resort: assume we're running from the installed package
2672
+ snowFlowRoot = (0, path_1.resolve)(__dirname, '..');
2673
+ // Verify we can find the template
2674
+ try {
2675
+ await fs_1.promises.access((0, path_1.join)(snowFlowRoot, '.mcp.json.template'));
2676
+ }
2677
+ catch {
2678
+ throw new Error('Could not find snow-flow project root');
2679
+ }
2680
+ }
2681
+ // Read the template file
2682
+ const templatePath = (0, path_1.join)(snowFlowRoot, '.mcp.json.template');
2683
+ let templateContent;
2684
+ try {
2685
+ templateContent = await fs_1.promises.readFile(templatePath, 'utf-8');
2686
+ }
2687
+ catch (error) {
2688
+ console.error('❌ Could not find .mcp.json.template file');
2689
+ throw error;
2690
+ }
2691
+ // Replace placeholders in template
2692
+ const mcpConfigContent = templateContent
2693
+ .replace(/{{PROJECT_ROOT}}/g, snowFlowRoot)
2694
+ .replace(/{{SNOW_INSTANCE}}/g, '${SNOW_INSTANCE}')
2695
+ .replace(/{{SNOW_CLIENT_ID}}/g, '${SNOW_CLIENT_ID}')
2696
+ .replace(/{{SNOW_CLIENT_SECRET}}/g, '${SNOW_CLIENT_SECRET}')
2697
+ .replace(/{{SNOW_DEPLOYMENT_TIMEOUT}}/g, '${SNOW_DEPLOYMENT_TIMEOUT}')
2698
+ .replace(/{{MCP_DEPLOYMENT_TIMEOUT}}/g, '${MCP_DEPLOYMENT_TIMEOUT}')
2699
+ .replace(/{{NEO4J_URI}}/g, '${NEO4J_URI}')
2700
+ .replace(/{{NEO4J_USER}}/g, '${NEO4J_USER}')
2701
+ .replace(/{{NEO4J_PASSWORD}}/g, '${NEO4J_PASSWORD}')
2702
+ .replace(/{{SNOW_FLOW_ENV}}/g, '${SNOW_FLOW_ENV}');
2703
+ // Parse to ensure it's valid JSON
2704
+ const mcpConfig = JSON.parse(mcpConfigContent);
2705
+ // Keep the standard MCP structure that Claude Code expects
2706
+ const finalConfig = {
2707
+ "mcpServers": mcpConfig.servers
2708
+ };
2709
+ // Create .mcp.json in project root for Claude Code discovery
2710
+ const mcpConfigPath = (0, path_1.join)(targetDir, '.mcp.json');
2711
+ try {
2712
+ await fs_1.promises.access(mcpConfigPath);
2713
+ if (force) {
2714
+ console.log('⚠️ .mcp.json already exists, overwriting with --force flag');
2715
+ await fs_1.promises.writeFile(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
2716
+ }
2717
+ else {
2718
+ console.log('⚠️ .mcp.json already exists, skipping (use --force to overwrite)');
2719
+ }
2720
+ }
2721
+ catch {
2722
+ await fs_1.promises.writeFile(mcpConfigPath, JSON.stringify(finalConfig, null, 2));
2723
+ }
2724
+ // Also create legacy config in .claude for backward compatibility
2725
+ const legacyConfigPath = (0, path_1.join)(targetDir, '.claude/mcp-config.json');
2726
+ await fs_1.promises.writeFile(legacyConfigPath, JSON.stringify(finalConfig, null, 2));
2727
+ }
2728
+ // Refresh MCP configuration command
2729
+ program
2730
+ .command('refresh-mcp')
2731
+ .description('Refresh MCP server configuration to latest version')
2732
+ .option('--force', 'Force overwrite existing configuration')
2733
+ .action(async (options) => {
2734
+ console.log(chalk_1.default.blue.bold(`\n🔄 Refreshing MCP Configuration to v${version_js_1.VERSION}...`));
2735
+ console.log('='.repeat(60));
2736
+ try {
2737
+ // Check if project is initialized
2738
+ const envPath = (0, path_1.join)(process.cwd(), '.env');
2739
+ if (!(0, fs_2.existsSync)(envPath)) {
2740
+ console.error(chalk_1.default.red('\n❌ No .env file found. Please run "snow-flow init" first.'));
2741
+ process.exit(1);
2742
+ }
2743
+ // Load env vars
2744
+ dotenv_1.default.config({ path: envPath });
2745
+ const instanceUrl = process.env.SNOW_INSTANCE;
2746
+ const clientId = process.env.SNOW_CLIENT_ID;
2747
+ const clientSecret = process.env.SNOW_CLIENT_SECRET;
2748
+ if (!instanceUrl || !clientId || !clientSecret) {
2749
+ console.error(chalk_1.default.red('\n❌ Missing ServiceNow credentials in .env file.'));
2750
+ process.exit(1);
2751
+ }
2752
+ console.log('\n📝 Updating MCP configuration...');
2753
+ await setupMCPConfig(process.cwd(), instanceUrl, clientId, clientSecret, options.force || false);
2754
+ console.log(chalk_1.default.green('\n✅ MCP configuration refreshed successfully!'));
2755
+ console.log('\n📢 IMPORTANT: Restart Claude Code to use the new configuration:');
2756
+ console.log(chalk_1.default.cyan(' claude --mcp-config .mcp.json'));
2757
+ console.log('\n💡 The Local Development server now includes:');
2758
+ console.log(' • Universal artifact detection via sys_metadata');
2759
+ console.log(' • Support for ANY ServiceNow table (even custom)');
2760
+ console.log(' • Generic artifact handling for unknown types');
2761
+ console.log(' • Automatic file structure creation');
2762
+ }
2763
+ catch (error) {
2764
+ console.error(chalk_1.default.red('\n❌ Failed to refresh MCP configuration:'), error);
2765
+ process.exit(1);
2766
+ }
2767
+ });
2649
2768
  // Direct widget creation command
2650
2769
  program
2651
2770
  .command('create-widget [type]')
@@ -1,3 +1,3 @@
1
- export declare const CLAUDE_MD_TEMPLATE = "# Snow-Flow ServiceNow Development Framework\n\n## \uD83D\uDEA8 ABSOLUTE RULES - NO EXCEPTIONS\n\n### Rule #1: NO MOCK DATA - EVERYTHING REAL & COMPLETE\n**FORBIDDEN:** Mock data, placeholders, TODOs, stub implementations, test values, simulations, \"this would normally...\", partial implementations.\n**REQUIRED:** Complete, production-ready, fully functional code. Take time to implement EVERYTHING properly. Real integrations, comprehensive error handling, full validation.\n\n### Rule #2: ES5 ONLY - ServiceNow Rhino Engine\n**NEVER USE:** const/let, arrow functions =>, template literals `${}`, destructuring, for...of, default parameters, classes\n**ALWAYS USE:** var, function(){}, string concatenation +, traditional for loops, typeof checks\n\n### Rule #3: VERIFY FIRST - Never Assume\nTest before claiming broken. Check resources exist. Validate configurations. Evidence-based fixes only.\n\n## \uD83D\uDCCB MCP SERVERS & TOOLS (18 Servers, 200+ Tools)\n\n### 1. **servicenow-local-development** \uD83D\uDD27 Widget/Artifact Sync\n```\nsnow_pull_artifact - Pull ANY artifact to local files for native editing\nsnow_push_artifact - Push local changes back to ServiceNow \nsnow_cleanup_artifacts - Clean local artifact cache\nsnow_get_sync_status - Check artifact sync status\nsnow_list_local_artifacts - List all pulled artifacts\n```\n\n### 2. **servicenow-deployment** \uD83D\uDE80 Complete Deployment System\n```\nsnow_deploy - Create NEW artifacts (widgets, flows, scripts, pages)\nsnow_update - UPDATE existing artifacts directly\nsnow_validate_deployment - Validate before deploy\nsnow_rollback_deployment - Rollback failed deployments\nsnow_preview_widget - Preview widget rendering\nsnow_widget_test - Test widget functionality\nsnow_deployment_history - View deployment history\nsnow_check_widget_coherence - Validate HTML/Client/Server communication\n```\n\n### 3. **servicenow-operations** \uD83D\uDCCA Core Operations\n```\nsnow_query_table - Universal table query with pagination\nsnow_query_incidents - Query and analyze incidents\nsnow_analyze_incident - AI-powered incident analysis\nsnow_auto_resolve_incident - Automated resolution\nsnow_cmdb_search - Configuration database search\nsnow_user_lookup - Find users and groups\nsnow_operational_metrics - Performance metrics\nsnow_knowledge_search - Search knowledge base\nsnow_catalog_item_manager - Manage service catalog\n```\n\n### 4. **servicenow-automation** \u2699\uFE0F Scripts & Automation\n```\nsnow_execute_background_script - Run ES5 scripts (autoConfirm available)\nsnow_execute_script_with_output - Execute with output capture\nsnow_execute_script_sync - Synchronous execution\nsnow_get_script_output - Retrieve script results\nsnow_schedule_job - Create scheduled jobs\nsnow_create_event - Trigger system events\nsnow_get_logs - Access system logs\nsnow_test_rest_connection - Test REST endpoints\nsnow_trace_execution - Performance tracing\n```\n\n### 5. **servicenow-platform-development** \uD83C\uDFD7\uFE0F Development Artifacts\n```\nsnow_create_ui_page - Create UI pages\nsnow_create_script_include - Reusable scripts\nsnow_create_business_rule - Business rules\nsnow_create_client_script - Client-side scripts\nsnow_create_ui_policy - UI policies\nsnow_create_ui_action - UI actions\nsnow_create_acl - Access controls\nsnow_create_ui_macro - UI macros\n```\n\n### 6. **servicenow-integration** \uD83D\uDD0C Integrations\n```\nsnow_create_rest_message - REST integrations\nsnow_create_soap_message - SOAP integrations\nsnow_create_transform_map - Data transformation\nsnow_create_import_set - Import management\nsnow_test_web_service - Test services\nsnow_configure_email - Email configuration\nsnow_create_data_source - Data sources\n```\n\n### 7. **servicenow-system-properties** \u2699\uFE0F Properties\n```\nsnow_property_get - Get property value\nsnow_property_set - Set property value\nsnow_property_list - List by pattern\nsnow_property_bulk_update - Bulk operations\nsnow_property_export/import - Export/Import JSON\nsnow_property_validate - Validate properties\n```\n\n### 8. **servicenow-update-set** \uD83D\uDCE6 Change Management\n```\nsnow_update_set_create - Create update set\nsnow_update_set_switch - Switch active set\nsnow_update_set_complete - Mark complete\nsnow_update_set_export - Export as XML\nsnow_update_set_preview - Preview changes\nsnow_ensure_active_update_set - Auto-create if needed\n```\n\n### 9. **servicenow-development-assistant** \uD83E\uDD16 AI Assistant\n```\nsnow_find_artifact - Find any artifact by name/type\nsnow_edit_artifact - Edit existing artifacts\nsnow_analyze_artifact - Analyze dependencies\nsnow_comprehensive_search - Deep search all tables\nsnow_analyze_requirements - Requirement analysis\nsnow_generate_code - Pattern-based generation\nsnow_optimize_script - Performance optimization\n```\n\n### 10. **servicenow-security-compliance** \uD83D\uDEE1\uFE0F Security\n```\nsnow_create_security_policy - Security policies\nsnow_audit_compliance - SOX/GDPR/HIPAA audit\nsnow_scan_vulnerabilities - Vulnerability scan\nsnow_assess_risk - Risk assessment\nsnow_review_access_control - ACL review\nsnow_encrypt_field - Field encryption\nsnow_audit_trail_analysis - Audit analysis\n```\n\n### 11. **servicenow-reporting-analytics** \uD83D\uDCC8 Reporting\n```\nsnow_create_report - Create reports\nsnow_create_dashboard - Build dashboards\nsnow_define_kpi - Define KPIs\nsnow_schedule_report - Schedule delivery\nsnow_analyze_data_quality - Data quality\nsnow_create_pa_widget - Performance analytics\n```\n\n### 12. **servicenow-machine-learning** \uD83E\uDDE0 AI/ML\n```\nml_train_incident_classifier - Train LSTM classifier\nml_predict_change_risk - Risk prediction\nml_detect_anomalies - Anomaly detection\nml_forecast_incidents - Time series forecast\nml_cluster_similar - Similarity clustering\nml_performance_analytics - Native PA ML\n```\n\n### 13. **servicenow-change-virtualagent-pa** \uD83D\uDD04 Change & Virtual Agent\n```\nsnow_create_change_request - Change requests\nsnow_assess_change_risk - Risk assessment\nsnow_create_nlu_model - NLU models\nsnow_train_virtual_agent - Train VA\nsnow_configure_conversation - VA conversations\nsnow_analyze_pa_trends - Performance trends\n```\n\n### 14. **servicenow-cmdb-event-hr-csm-devops** \uD83C\uDFE2 Enterprise\n```\nsnow_manage_ci - Configuration items\nsnow_correlate_events - Event correlation\nsnow_manage_hr_case - HR cases\nsnow_csm_project - Customer projects\nsnow_devops_pipeline - CI/CD pipelines\nsnow_manage_cmdb_relationships - CI relationships\n```\n\n### 15. **servicenow-knowledge-catalog** \uD83D\uDCDA Knowledge & Catalog\n```\nsnow_create_knowledge_article - KB articles\nsnow_manage_catalog_item - Catalog items\nsnow_configure_variables - Variable sets\nsnow_create_catalog_policy - Catalog policies\nsnow_manage_categories - Categories\n```\n\n### 16. **servicenow-flow-workspace-mobile** \uD83D\uDCF1 Modern UX\n```\nsnow_create_flow - Flow Designer flows\nsnow_add_flow_action - Flow actions\nsnow_create_workspace - Workspace config\nsnow_configure_mobile_app - Mobile apps\nsnow_configure_offline_sync - Offline mode\n```\n\n### 17. **servicenow-advanced-features** \uD83C\uDFAF Advanced\n```\nsnow_performance_optimization - Optimize instance\nsnow_batch_operations - Bulk processing\nsnow_instance_scan - Health check\nsnow_dependency_analysis - Dependencies\nsnow_code_search - Search all code\n```\n\n### 18. **snow-flow** \uD83C\uDF9B\uFE0F Orchestration\n```\nswarm_init - Initialize agent swarms\nagent_spawn - Create specialized agents\ntask_orchestrate - Complex task coordination\nmemory_search - Search persistent memory\nneural_train - Train neural networks\n```\n\n## \uD83D\uDD04 Critical Workflows\n\n### Widget Debugging (ALWAYS use Local Sync!)\n```javascript\n// \u2705 CORRECT - Local sync for debugging\nawait snow_pull_artifact({ sys_id: 'widget_sys_id' });\n// Edit with native tools (search, multi-file, etc.)\nawait snow_push_artifact({ sys_id: 'widget_sys_id' });\n\n// \u274C WRONG - Token limit explosion\nawait snow_query_table({ table: 'sp_widget', query: 'sys_id=...' });\n```\n\n### Verification Pattern\n```javascript\n// Always verify with REAL data, not placeholders\nawait snow_execute_script_with_output({\n script: `\n var gr = new GlideRecord('incident');\n gr.addQuery('active', true);\n gr.query();\n gs.info('Found: ' + gr.getRowCount() + ' active incidents');\n \n // Test actual property\n var prop = gs.getProperty('instance_name');\n gs.info('Instance: ' + prop);\n `\n});\n```\n\n### Complete Widget Creation (NO PLACEHOLDERS)\n```javascript\nawait snow_deploy({\n type: 'widget',\n config: {\n name: 'my_widget',\n title: 'Production Widget',\n template: '<div ng-repeat=\"item in data.items\">{{item.name}}</div>',\n script: `\n (function() {\n data.items = [];\n var gr = new GlideRecord('incident');\n gr.addQuery('active', true);\n gr.setLimit(10);\n gr.query();\n while (gr.next()) {\n data.items.push({\n name: gr.getDisplayValue('number'),\n description: gr.getDisplayValue('short_description')\n });\n }\n })();\n `,\n client_script: `\n function($scope) {\n var c = this;\n c.refresh = function() {\n c.server.get().then(function(r) {\n console.log('Refreshed');\n });\n };\n }\n `\n }\n});\n```\n\n## \u26A1 Command Reference\n\n### Core Commands\n- `snow-flow init` - Initialize project with this CLAUDE.md\n- `snow-flow auth login` - Authenticate with ServiceNow\n- `snow-flow status` - System status\n- `snow-flow swarm \"<task>\"` - Multi-agent coordination\n\n### Development Flow\n1. **Pull artifact**: `snow_pull_artifact` for local editing\n2. **Edit locally**: Use Claude's native search/edit tools\n3. **Push changes**: `snow_push_artifact` to ServiceNow\n4. **Test**: `snow_execute_script_with_output` with REAL code\n5. **Deploy**: `snow_update_set_complete` when ready\n\n## \uD83C\uDFAF Golden Rules\n\n1. **NO MOCK DATA** - Everything real, complete, production-ready\n2. **ES5 ONLY** - var, function(){}, no modern JS\n3. **VERIFY FIRST** - Test before assuming\n4. **LOCAL SYNC** - Use snow_pull_artifact for widgets\n5. **COMPLETE CODE** - No TODOs, no placeholders\n6. **TOKEN AWARE** - Use batch operations\n7. **UPDATE SETS** - Track all changes\n\n## \uD83D\uDCCA Quick Reference\n\n| Issue | Solution |\n|-------|----------|\n| Widget doesn't work | `snow_pull_artifact` \u2192 debug locally |\n| Script syntax error | ES5 only! var, function(){} |\n| Can't find table | `snow_discover_table_fields` |\n| Property missing | `snow_property_manager` |\n| Need to test | `snow_execute_script_with_output` |\n| Deployment failed | `snow_rollback_deployment` |\n\nRemember: TAKE THE TIME. DO IT RIGHT. NO MOCK DATA. NO EXCEPTIONS.";
1
+ export declare const CLAUDE_MD_TEMPLATE = "# Snow-Flow ServiceNow Development Framework\n\n## \uD83D\uDEA8 ABSOLUTE RULES - NO EXCEPTIONS\n\n### \uD83D\uDD34 CRITICAL: Widget Debugging MUST Use Local Sync!\n\n**When user reports ANY widget issue, ALWAYS use:**\n```\nsnow_pull_artifact({ sys_id: 'widget_sys_id' })\n```\n\n**NEVER use snow_query_table for widgets!** It will hit token limits and you can't use native tools.\n\n**Common scenarios requiring snow_pull_artifact:**\n- \"Widget skips questions\" \u2192 snow_pull_artifact\n- \"Form doesn't submit\" \u2192 snow_pull_artifact \n- \"Data not displaying\" \u2192 snow_pull_artifact\n- \"Button doesn't work\" \u2192 snow_pull_artifact\n- \"Debug this widget\" \u2192 snow_pull_artifact\n- \"Fix widget issue\" \u2192 snow_pull_artifact\n- Widget script > 1000 chars \u2192 snow_pull_artifact\n\n### Rule #1: NO MOCK DATA - EVERYTHING REAL & COMPLETE\n**FORBIDDEN:** Mock data, placeholders, TODOs, stub implementations, test values, simulations, \"this would normally...\", partial implementations.\n**REQUIRED:** Complete, production-ready, fully functional code. Take time to implement EVERYTHING properly. Real integrations, comprehensive error handling, full validation.\n\n### Rule #2: ES5 ONLY - ServiceNow Rhino Engine\n**NEVER USE:** const/let, arrow functions =>, template literals `${}`, destructuring, for...of, default parameters, classes\n**ALWAYS USE:** var, function(){}, string concatenation +, traditional for loops, typeof checks\n\n### Rule #3: VERIFY FIRST - Never Assume\nTest before claiming broken. Check resources exist. Validate configurations. Evidence-based fixes only.\n\n## \uD83D\uDCCB MCP SERVERS & TOOLS (18 Servers, 200+ Tools)\n\n### 1. **servicenow-local-development** \uD83D\uDD27 Widget/Artifact Sync [USE THIS FOR WIDGETS!]\n```\nsnow_pull_artifact - Pull ANY artifact to local files (ALWAYS use for widgets!)\nsnow_push_artifact - Push local changes back to ServiceNow \nsnow_cleanup_artifacts - Clean local artifact cache\nsnow_get_sync_status - Check artifact sync status\nsnow_list_local_artifacts - List all pulled artifacts\n```\n**\u26A0\uFE0F CRITICAL: For ANY widget work, use snow_pull_artifact FIRST, not snow_query_table!**\n\n### 2. **servicenow-deployment** \uD83D\uDE80 Complete Deployment System\n```\nsnow_deploy - Create NEW artifacts (widgets, flows, scripts, pages)\nsnow_update - UPDATE existing artifacts directly\nsnow_validate_deployment - Validate before deploy\nsnow_rollback_deployment - Rollback failed deployments\nsnow_preview_widget - Preview widget rendering\nsnow_widget_test - Test widget functionality\nsnow_deployment_history - View deployment history\nsnow_check_widget_coherence - Validate HTML/Client/Server communication\n```\n\n### 3. **servicenow-operations** \uD83D\uDCCA Core Operations\n```\nsnow_query_table - Universal table query (NOT for widgets - use snow_pull_artifact!)\nsnow_query_incidents - Query and analyze incidents\nsnow_analyze_incident - AI-powered incident analysis\nsnow_auto_resolve_incident - Automated resolution\nsnow_cmdb_search - Configuration database search\nsnow_user_lookup - Find users and groups\nsnow_operational_metrics - Performance metrics\nsnow_knowledge_search - Search knowledge base\nsnow_catalog_item_manager - Manage service catalog\n```\n\n### 4. **servicenow-automation** \u2699\uFE0F Scripts & Automation\n```\nsnow_execute_background_script - Run ES5 scripts (autoConfirm available)\nsnow_execute_script_with_output - Execute with output capture\nsnow_execute_script_sync - Synchronous execution\nsnow_get_script_output - Retrieve script results\nsnow_schedule_job - Create scheduled jobs\nsnow_create_event - Trigger system events\nsnow_get_logs - Access system logs\nsnow_test_rest_connection - Test REST endpoints\nsnow_trace_execution - Performance tracing\n```\n\n### 5. **servicenow-platform-development** \uD83C\uDFD7\uFE0F Development Artifacts\n```\nsnow_create_ui_page - Create UI pages\nsnow_create_script_include - Reusable scripts\nsnow_create_business_rule - Business rules\nsnow_create_client_script - Client-side scripts\nsnow_create_ui_policy - UI policies\nsnow_create_ui_action - UI actions\nsnow_create_acl - Access controls\nsnow_create_ui_macro - UI macros\n```\n\n### 6. **servicenow-integration** \uD83D\uDD0C Integrations\n```\nsnow_create_rest_message - REST integrations\nsnow_create_soap_message - SOAP integrations\nsnow_create_transform_map - Data transformation\nsnow_create_import_set - Import management\nsnow_test_web_service - Test services\nsnow_configure_email - Email configuration\nsnow_create_data_source - Data sources\n```\n\n### 7. **servicenow-system-properties** \u2699\uFE0F Properties\n```\nsnow_property_get - Get property value\nsnow_property_set - Set property value\nsnow_property_list - List by pattern\nsnow_property_bulk_update - Bulk operations\nsnow_property_export/import - Export/Import JSON\nsnow_property_validate - Validate properties\n```\n\n### 8. **servicenow-update-set** \uD83D\uDCE6 Change Management\n```\nsnow_update_set_create - Create update set\nsnow_update_set_switch - Switch active set\nsnow_update_set_complete - Mark complete\nsnow_update_set_export - Export as XML\nsnow_update_set_preview - Preview changes\nsnow_ensure_active_update_set - Auto-create if needed\n```\n\n### 9. **servicenow-development-assistant** \uD83E\uDD16 AI Assistant\n```\nsnow_find_artifact - Find any artifact by name/type\nsnow_edit_artifact - Edit existing artifacts\nsnow_analyze_artifact - Analyze dependencies\nsnow_comprehensive_search - Deep search all tables\nsnow_analyze_requirements - Requirement analysis\nsnow_generate_code - Pattern-based generation\nsnow_optimize_script - Performance optimization\n```\n\n### 10. **servicenow-security-compliance** \uD83D\uDEE1\uFE0F Security\n```\nsnow_create_security_policy - Security policies\nsnow_audit_compliance - SOX/GDPR/HIPAA audit\nsnow_scan_vulnerabilities - Vulnerability scan\nsnow_assess_risk - Risk assessment\nsnow_review_access_control - ACL review\nsnow_encrypt_field - Field encryption\nsnow_audit_trail_analysis - Audit analysis\n```\n\n### 11. **servicenow-reporting-analytics** \uD83D\uDCC8 Reporting\n```\nsnow_create_report - Create reports\nsnow_create_dashboard - Build dashboards\nsnow_define_kpi - Define KPIs\nsnow_schedule_report - Schedule delivery\nsnow_analyze_data_quality - Data quality\nsnow_create_pa_widget - Performance analytics\n```\n\n### 12. **servicenow-machine-learning** \uD83E\uDDE0 AI/ML\n```\nml_train_incident_classifier - Train LSTM classifier\nml_predict_change_risk - Risk prediction\nml_detect_anomalies - Anomaly detection\nml_forecast_incidents - Time series forecast\nml_cluster_similar - Similarity clustering\nml_performance_analytics - Native PA ML\n```\n\n### 13. **servicenow-change-virtualagent-pa** \uD83D\uDD04 Change & Virtual Agent\n```\nsnow_create_change_request - Change requests\nsnow_assess_change_risk - Risk assessment\nsnow_create_nlu_model - NLU models\nsnow_train_virtual_agent - Train VA\nsnow_configure_conversation - VA conversations\nsnow_analyze_pa_trends - Performance trends\n```\n\n### 14. **servicenow-cmdb-event-hr-csm-devops** \uD83C\uDFE2 Enterprise\n```\nsnow_manage_ci - Configuration items\nsnow_correlate_events - Event correlation\nsnow_manage_hr_case - HR cases\nsnow_csm_project - Customer projects\nsnow_devops_pipeline - CI/CD pipelines\nsnow_manage_cmdb_relationships - CI relationships\n```\n\n### 15. **servicenow-knowledge-catalog** \uD83D\uDCDA Knowledge & Catalog\n```\nsnow_create_knowledge_article - KB articles\nsnow_manage_catalog_item - Catalog items\nsnow_configure_variables - Variable sets\nsnow_create_catalog_policy - Catalog policies\nsnow_manage_categories - Categories\n```\n\n### 16. **servicenow-flow-workspace-mobile** \uD83D\uDCF1 Modern UX\n```\nsnow_create_flow - Flow Designer flows\nsnow_add_flow_action - Flow actions\nsnow_create_workspace - Workspace config\nsnow_configure_mobile_app - Mobile apps\nsnow_configure_offline_sync - Offline mode\n```\n\n### 17. **servicenow-advanced-features** \uD83C\uDFAF Advanced\n```\nsnow_performance_optimization - Optimize instance\nsnow_batch_operations - Bulk processing\nsnow_instance_scan - Health check\nsnow_dependency_analysis - Dependencies\nsnow_code_search - Search all code\n```\n\n### 18. **snow-flow** \uD83C\uDF9B\uFE0F Orchestration\n```\nswarm_init - Initialize agent swarms\nagent_spawn - Create specialized agents\ntask_orchestrate - Complex task coordination\nmemory_search - Search persistent memory\nneural_train - Train neural networks\n```\n\n## \uD83D\uDD04 Critical Workflows\n\n### Widget Debugging (ALWAYS use Local Sync!)\n```javascript\n// \u2705 CORRECT - Local sync for debugging\nawait snow_pull_artifact({ sys_id: 'widget_sys_id' });\n// Edit with native tools (search, multi-file, etc.)\nawait snow_push_artifact({ sys_id: 'widget_sys_id' });\n\n// \u274C WRONG - Token limit explosion\nawait snow_query_table({ table: 'sp_widget', query: 'sys_id=...' });\n```\n\n### Verification Pattern\n```javascript\n// Always verify with REAL data, not placeholders\nawait snow_execute_script_with_output({\n script: `\n var gr = new GlideRecord('incident');\n gr.addQuery('active', true);\n gr.query();\n gs.info('Found: ' + gr.getRowCount() + ' active incidents');\n \n // Test actual property\n var prop = gs.getProperty('instance_name');\n gs.info('Instance: ' + prop);\n `\n});\n```\n\n### Complete Widget Creation (NO PLACEHOLDERS)\n```javascript\nawait snow_deploy({\n type: 'widget',\n config: {\n name: 'my_widget',\n title: 'Production Widget',\n template: '<div ng-repeat=\"item in data.items\">{{item.name}}</div>',\n script: `\n (function() {\n data.items = [];\n var gr = new GlideRecord('incident');\n gr.addQuery('active', true);\n gr.setLimit(10);\n gr.query();\n while (gr.next()) {\n data.items.push({\n name: gr.getDisplayValue('number'),\n description: gr.getDisplayValue('short_description')\n });\n }\n })();\n `,\n client_script: `\n function($scope) {\n var c = this;\n c.refresh = function() {\n c.server.get().then(function(r) {\n console.log('Refreshed');\n });\n };\n }\n `\n }\n});\n```\n\n## \u26A1 Command Reference\n\n### Core Commands\n- `snow-flow init` - Initialize project with this CLAUDE.md\n- `snow-flow auth login` - Authenticate with ServiceNow\n- `snow-flow status` - System status\n- `snow-flow swarm \"<task>\"` - Multi-agent coordination\n\n### Development Flow\n1. **Pull artifact**: `snow_pull_artifact` for local editing\n2. **Edit locally**: Use Claude's native search/edit tools\n3. **Push changes**: `snow_push_artifact` to ServiceNow\n4. **Test**: `snow_execute_script_with_output` with REAL code\n5. **Deploy**: `snow_update_set_complete` when ready\n\n## \uD83C\uDFAF Golden Rules\n\n1. **NO MOCK DATA** - Everything real, complete, production-ready\n2. **ES5 ONLY** - var, function(){}, no modern JS\n3. **VERIFY FIRST** - Test before assuming\n4. **LOCAL SYNC** - Use snow_pull_artifact for widgets\n5. **COMPLETE CODE** - No TODOs, no placeholders\n6. **TOKEN AWARE** - Use batch operations\n7. **UPDATE SETS** - Track all changes\n\n## \uD83D\uDCCA Quick Reference\n\n| Issue | Solution |\n|-------|----------|\n| Widget doesn't work | `snow_pull_artifact` \u2192 debug locally |\n| Script syntax error | ES5 only! var, function(){} |\n| Can't find table | `snow_discover_table_fields` |\n| Property missing | `snow_property_manager` |\n| Need to test | `snow_execute_script_with_output` |\n| Deployment failed | `snow_rollback_deployment` |\n\nRemember: TAKE THE TIME. DO IT RIGHT. NO MOCK DATA. NO EXCEPTIONS.";
2
2
  export declare const CLAUDE_MD_TEMPLATE_VERSION = "3.6.2-CONSOLIDATED";
3
3
  //# sourceMappingURL=claude-md-template.d.ts.map
@@ -5,6 +5,24 @@ exports.CLAUDE_MD_TEMPLATE = `# Snow-Flow ServiceNow Development Framework
5
5
 
6
6
  ## 🚨 ABSOLUTE RULES - NO EXCEPTIONS
7
7
 
8
+ ### 🔴 CRITICAL: Widget Debugging MUST Use Local Sync!
9
+
10
+ **When user reports ANY widget issue, ALWAYS use:**
11
+ \`\`\`
12
+ snow_pull_artifact({ sys_id: 'widget_sys_id' })
13
+ \`\`\`
14
+
15
+ **NEVER use snow_query_table for widgets!** It will hit token limits and you can't use native tools.
16
+
17
+ **Common scenarios requiring snow_pull_artifact:**
18
+ - "Widget skips questions" → snow_pull_artifact
19
+ - "Form doesn't submit" → snow_pull_artifact
20
+ - "Data not displaying" → snow_pull_artifact
21
+ - "Button doesn't work" → snow_pull_artifact
22
+ - "Debug this widget" → snow_pull_artifact
23
+ - "Fix widget issue" → snow_pull_artifact
24
+ - Widget script > 1000 chars → snow_pull_artifact
25
+
8
26
  ### Rule #1: NO MOCK DATA - EVERYTHING REAL & COMPLETE
9
27
  **FORBIDDEN:** Mock data, placeholders, TODOs, stub implementations, test values, simulations, "this would normally...", partial implementations.
10
28
  **REQUIRED:** Complete, production-ready, fully functional code. Take time to implement EVERYTHING properly. Real integrations, comprehensive error handling, full validation.
@@ -18,14 +36,15 @@ Test before claiming broken. Check resources exist. Validate configurations. Evi
18
36
 
19
37
  ## 📋 MCP SERVERS & TOOLS (18 Servers, 200+ Tools)
20
38
 
21
- ### 1. **servicenow-local-development** 🔧 Widget/Artifact Sync
39
+ ### 1. **servicenow-local-development** 🔧 Widget/Artifact Sync [USE THIS FOR WIDGETS!]
22
40
  \`\`\`
23
- snow_pull_artifact - Pull ANY artifact to local files for native editing
41
+ snow_pull_artifact - Pull ANY artifact to local files (ALWAYS use for widgets!)
24
42
  snow_push_artifact - Push local changes back to ServiceNow
25
43
  snow_cleanup_artifacts - Clean local artifact cache
26
44
  snow_get_sync_status - Check artifact sync status
27
45
  snow_list_local_artifacts - List all pulled artifacts
28
46
  \`\`\`
47
+ **⚠️ CRITICAL: For ANY widget work, use snow_pull_artifact FIRST, not snow_query_table!**
29
48
 
30
49
  ### 2. **servicenow-deployment** 🚀 Complete Deployment System
31
50
  \`\`\`
@@ -41,7 +60,7 @@ snow_check_widget_coherence - Validate HTML/Client/Server communication
41
60
 
42
61
  ### 3. **servicenow-operations** 📊 Core Operations
43
62
  \`\`\`
44
- snow_query_table - Universal table query with pagination
63
+ snow_query_table - Universal table query (NOT for widgets - use snow_pull_artifact!)
45
64
  snow_query_incidents - Query and analyze incidents
46
65
  snow_analyze_incident - AI-powered incident analysis
47
66
  snow_auto_resolve_incident - Automated resolution
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.6.5",
4
- "description": "UNIVERSAL ARTIFACT DETECTION via sys_metadata! v3.6.5 can now find ANY ServiceNow record by sys_id alone - even custom tables. Generic artifact support for unknown tables. Smarter pullArtifactBySysId that queries sys_metadata first. Auto-creates editable file structure for ANY table type. Includes early auto-compact at 65%, audit logging, and consolidated CLAUDE.md.",
3
+ "version": "3.6.7",
4
+ "description": "CLAUDE.MD WIDGET RULE FIX - v3.6.7 adds CRITICAL rule to ALWAYS use snow_pull_artifact for widget debugging, NEVER snow_query_table! Fixes token limit errors. Universal artifact detection via sys_metadata finds ANY ServiceNow record. Generic artifact support, early auto-compact, audit logging. snow-flow refresh-mcp command included.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {