snow-flow 1.4.19 → 1.4.20
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/assets/logo.txt +8 -0
- package/assets/snow-flow-logo.svg +51 -0
- package/dist/mcp/servicenow-deployment-mcp.js +144 -14
- package/dist/mcp/servicenow-deployment-mcp.js.map +1 -1
- package/dist/utils/oauth-html-templates.d.ts +11 -0
- package/dist/utils/oauth-html-templates.d.ts.map +1 -0
- package/dist/utils/oauth-html-templates.js +185 -0
- package/dist/utils/oauth-html-templates.js.map +1 -0
- package/dist/utils/snow-oauth.d.ts.map +1 -1
- package/dist/utils/snow-oauth.js +6 -45
- package/dist/utils/snow-oauth.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/assets/logo.txt
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<!-- Mountain -->
|
|
4
|
+
<path d="M 50 150 L 100 50 L 150 150 Z" fill="#4A90E2" stroke="#2E5C8A" stroke-width="2"/>
|
|
5
|
+
|
|
6
|
+
<!-- Snow cap on mountain -->
|
|
7
|
+
<path d="M 100 50 L 80 90 L 120 90 Z" fill="#FFFFFF" stroke="#E0E0E0" stroke-width="1"/>
|
|
8
|
+
|
|
9
|
+
<!-- Mountain base -->
|
|
10
|
+
<rect x="40" y="150" width="120" height="10" fill="#2E5C8A"/>
|
|
11
|
+
|
|
12
|
+
<!-- Snowflakes falling from top -->
|
|
13
|
+
<!-- Motion trail from top -->
|
|
14
|
+
<circle cx="100" cy="20" r="1" fill="#4A90E2" opacity="0.1"/>
|
|
15
|
+
<circle cx="105" cy="30" r="1.2" fill="#4A90E2" opacity="0.2"/>
|
|
16
|
+
<circle cx="95" cy="40" r="1.5" fill="#4A90E2" opacity="0.3"/>
|
|
17
|
+
|
|
18
|
+
<!-- Main snowflake -->
|
|
19
|
+
<g transform="translate(100, 55)">
|
|
20
|
+
<!-- Snowflake center -->
|
|
21
|
+
<circle cx="0" cy="0" r="3" fill="#FFFFFF" stroke="#4A90E2" stroke-width="1"/>
|
|
22
|
+
|
|
23
|
+
<!-- Snowflake arms -->
|
|
24
|
+
<line x1="-12" y1="0" x2="12" y2="0" stroke="#4A90E2" stroke-width="2"/>
|
|
25
|
+
<line x1="0" y1="-12" x2="0" y2="12" stroke="#4A90E2" stroke-width="2"/>
|
|
26
|
+
<line x1="-8" y1="-8" x2="8" y2="8" stroke="#4A90E2" stroke-width="2"/>
|
|
27
|
+
<line x1="-8" y1="8" x2="8" y2="-8" stroke="#4A90E2" stroke-width="2"/>
|
|
28
|
+
|
|
29
|
+
<!-- Snowflake decorations -->
|
|
30
|
+
<circle cx="-8" cy="0" r="2" fill="#FFFFFF"/>
|
|
31
|
+
<circle cx="8" cy="0" r="2" fill="#FFFFFF"/>
|
|
32
|
+
<circle cx="0" cy="-8" r="2" fill="#FFFFFF"/>
|
|
33
|
+
<circle cx="0" cy="8" r="2" fill="#FFFFFF"/>
|
|
34
|
+
</g>
|
|
35
|
+
|
|
36
|
+
<!-- Additional smaller snowflakes -->
|
|
37
|
+
<g transform="translate(80, 70) scale(0.7)">
|
|
38
|
+
<circle cx="0" cy="0" r="2" fill="#FFFFFF" stroke="#4A90E2" stroke-width="1"/>
|
|
39
|
+
<line x1="-8" y1="0" x2="8" y2="0" stroke="#4A90E2" stroke-width="1.5"/>
|
|
40
|
+
<line x1="0" y1="-8" x2="0" y2="8" stroke="#4A90E2" stroke-width="1.5"/>
|
|
41
|
+
</g>
|
|
42
|
+
|
|
43
|
+
<g transform="translate(120, 65) scale(0.5)">
|
|
44
|
+
<circle cx="0" cy="0" r="2" fill="#FFFFFF" stroke="#4A90E2" stroke-width="1"/>
|
|
45
|
+
<line x1="-8" y1="0" x2="8" y2="0" stroke="#4A90E2" stroke-width="1.5"/>
|
|
46
|
+
<line x1="0" y1="-8" x2="0" y2="8" stroke="#4A90E2" stroke-width="1.5"/>
|
|
47
|
+
</g>
|
|
48
|
+
|
|
49
|
+
<!-- Text -->
|
|
50
|
+
<text x="100" y="180" font-family="Arial, sans-serif" font-size="20" font-weight="bold" text-anchor="middle" fill="#2E5C8A">Snow-Flow</text>
|
|
51
|
+
</svg>
|
|
@@ -2663,31 +2663,78 @@ ${sessionSummary.statusCounts.pending > 0 ? '- 📋 Complete pending deployments
|
|
|
2663
2663
|
async runAuthDiagnostics(args) {
|
|
2664
2664
|
try {
|
|
2665
2665
|
this.logger.info('Running authentication diagnostics...');
|
|
2666
|
-
//
|
|
2666
|
+
// 🔧 ENHANCED: Try to load credentials from multiple sources
|
|
2667
|
+
let credentials = null;
|
|
2668
|
+
let credentialSource = 'none';
|
|
2669
|
+
let authStatus = 'Not Authenticated';
|
|
2670
|
+
// First, check OAuth tokens
|
|
2667
2671
|
const isAuth = await this.oauth.isAuthenticated();
|
|
2668
|
-
if (
|
|
2672
|
+
if (isAuth) {
|
|
2673
|
+
try {
|
|
2674
|
+
credentials = await this.oauth.loadTokens();
|
|
2675
|
+
credentialSource = 'OAuth tokens';
|
|
2676
|
+
authStatus = 'OAuth Authenticated';
|
|
2677
|
+
}
|
|
2678
|
+
catch (error) {
|
|
2679
|
+
this.logger.warn('Failed to load OAuth tokens despite isAuthenticated=true:', error);
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
// If no OAuth tokens, try loadCredentials which checks .env fallbacks
|
|
2683
|
+
if (!credentials) {
|
|
2684
|
+
try {
|
|
2685
|
+
credentials = await this.oauth.loadCredentials();
|
|
2686
|
+
if (credentials) {
|
|
2687
|
+
if (credentials.accessToken) {
|
|
2688
|
+
credentialSource = 'OAuth tokens (loaded)';
|
|
2689
|
+
authStatus = 'OAuth Authenticated';
|
|
2690
|
+
}
|
|
2691
|
+
else {
|
|
2692
|
+
credentialSource = '.env file (OAuth setup required)';
|
|
2693
|
+
authStatus = 'Credentials Found - OAuth Setup Needed';
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
catch (error) {
|
|
2698
|
+
this.logger.warn('Failed to load credentials from any source:', error);
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
// If still no credentials, provide comprehensive error with detection
|
|
2702
|
+
if (!credentials) {
|
|
2669
2703
|
return {
|
|
2670
2704
|
content: [
|
|
2671
2705
|
{
|
|
2672
2706
|
type: 'text',
|
|
2673
|
-
text: `❌ **Authentication Status:
|
|
2707
|
+
text: `❌ **Authentication Status: ${authStatus}**
|
|
2674
2708
|
|
|
2675
|
-
**Issue:** No credentials available
|
|
2709
|
+
**Issue:** No credentials available from any source.
|
|
2676
2710
|
|
|
2677
|
-
**
|
|
2678
|
-
|
|
2711
|
+
**Credential Detection Results:**
|
|
2712
|
+
- OAuth tokens: ❌ Not found
|
|
2713
|
+
- .env file: ❌ Not configured
|
|
2714
|
+
- Unified auth store: ❌ No valid tokens
|
|
2715
|
+
|
|
2716
|
+
**Solutions:**
|
|
2717
|
+
|
|
2718
|
+
1. **Quick Setup with OAuth (Recommended):**
|
|
2679
2719
|
\`\`\`bash
|
|
2680
2720
|
snow-flow auth login
|
|
2681
2721
|
\`\`\`
|
|
2682
2722
|
|
|
2683
|
-
2. Or configure
|
|
2684
|
-
\`\`\`
|
|
2723
|
+
2. **Or configure .env file first:**
|
|
2724
|
+
\`\`\`env
|
|
2685
2725
|
SNOW_INSTANCE=dev123456.service-now.com
|
|
2686
2726
|
SNOW_CLIENT_ID=your_oauth_client_id
|
|
2687
2727
|
SNOW_CLIENT_SECRET=your_oauth_client_secret
|
|
2688
2728
|
\`\`\`
|
|
2729
|
+
Then run: \`snow-flow auth login\`
|
|
2689
2730
|
|
|
2690
|
-
3.
|
|
2731
|
+
3. **Get OAuth credentials from ServiceNow:**
|
|
2732
|
+
- Navigate to: System OAuth > Application Registry
|
|
2733
|
+
- Create new OAuth application
|
|
2734
|
+
- Redirect URI: http://localhost:3005/callback
|
|
2735
|
+
- Scopes: useraccount write admin
|
|
2736
|
+
|
|
2737
|
+
4. **After setup, run diagnostics again:**
|
|
2691
2738
|
\`\`\`
|
|
2692
2739
|
snow_auth_diagnostics
|
|
2693
2740
|
\`\`\``,
|
|
@@ -2695,7 +2742,81 @@ ${sessionSummary.statusCounts.pending > 0 ? '- 📋 Complete pending deployments
|
|
|
2695
2742
|
],
|
|
2696
2743
|
};
|
|
2697
2744
|
}
|
|
2698
|
-
|
|
2745
|
+
// If we have credentials but no access token, provide specific guidance
|
|
2746
|
+
if (credentials && !credentials.accessToken) {
|
|
2747
|
+
return {
|
|
2748
|
+
content: [
|
|
2749
|
+
{
|
|
2750
|
+
type: 'text',
|
|
2751
|
+
text: `⚠️ **Authentication Status: ${authStatus}**
|
|
2752
|
+
|
|
2753
|
+
**Issue:** Credentials found in ${credentialSource} but no active OAuth session.
|
|
2754
|
+
|
|
2755
|
+
**Credential Details:**
|
|
2756
|
+
- Instance: ${credentials.instance || 'Not specified'}
|
|
2757
|
+
- Client ID: ${credentials.clientId ? '✅ Present' : '❌ Missing'}
|
|
2758
|
+
- Client Secret: ${credentials.clientSecret ? '✅ Present' : '❌ Missing'}
|
|
2759
|
+
- Access Token: ❌ Missing (OAuth login required)
|
|
2760
|
+
|
|
2761
|
+
**Solution:**
|
|
2762
|
+
Your .env file is configured but you need to complete OAuth authentication:
|
|
2763
|
+
|
|
2764
|
+
\`\`\`bash
|
|
2765
|
+
snow-flow auth login
|
|
2766
|
+
\`\`\`
|
|
2767
|
+
|
|
2768
|
+
This will use your .env credentials to start the OAuth flow and generate access tokens.`,
|
|
2769
|
+
},
|
|
2770
|
+
],
|
|
2771
|
+
};
|
|
2772
|
+
}
|
|
2773
|
+
// 🔧 ENHANCED: Try to run diagnostics with better error handling
|
|
2774
|
+
let diagnostics;
|
|
2775
|
+
try {
|
|
2776
|
+
diagnostics = await this.client.validateDeploymentPermissions();
|
|
2777
|
+
}
|
|
2778
|
+
catch (apiError) {
|
|
2779
|
+
this.logger.error('Failed to run deployment permission validation:', apiError);
|
|
2780
|
+
// Return specific error for API failures even with valid credentials
|
|
2781
|
+
return {
|
|
2782
|
+
content: [
|
|
2783
|
+
{
|
|
2784
|
+
type: 'text',
|
|
2785
|
+
text: `⚠️ **Authentication Status:** ${authStatus}
|
|
2786
|
+
**📍 Credential Source:** ${credentialSource}
|
|
2787
|
+
|
|
2788
|
+
**❌ Diagnostic API Call Failed**
|
|
2789
|
+
|
|
2790
|
+
**Credential Details:**
|
|
2791
|
+
- Instance: ${credentials?.instance || 'Unknown'} ${credentials?.instance ? '✅' : '❌'}
|
|
2792
|
+
- Client ID: ${credentials?.clientId ? '✅ Present' : '❌ Missing'}
|
|
2793
|
+
- Access Token: ${credentials?.accessToken ? '✅ Present' : '❌ Missing'}
|
|
2794
|
+
|
|
2795
|
+
**Error Details:**
|
|
2796
|
+
${apiError instanceof Error ? apiError.message : String(apiError)}
|
|
2797
|
+
|
|
2798
|
+
**Possible Causes:**
|
|
2799
|
+
1. **ServiceNow instance is down or unreachable**
|
|
2800
|
+
2. **OAuth token has expired** - Run: \`snow-flow auth login\`
|
|
2801
|
+
3. **Network/firewall issues** blocking API calls
|
|
2802
|
+
4. **Invalid instance URL** in credentials
|
|
2803
|
+
5. **Insufficient API permissions** for your OAuth application
|
|
2804
|
+
|
|
2805
|
+
**🔧 Troubleshooting Steps:**
|
|
2806
|
+
1. Verify instance URL: https://${credentials?.instance || 'your-instance'}/
|
|
2807
|
+
2. Check if you can access ServiceNow web interface
|
|
2808
|
+
3. Re-authenticate: \`snow-flow auth login\`
|
|
2809
|
+
4. Test with simple API call
|
|
2810
|
+
5. Check OAuth application permissions in ServiceNow
|
|
2811
|
+
|
|
2812
|
+
**💡 Alternative Approaches:**
|
|
2813
|
+
- Test deployment with: \`snow_validate_deployment\`
|
|
2814
|
+
- Check Update Set status: \`snow_update_set_current\`
|
|
2815
|
+
- Try manual deployment in ServiceNow web interface`,
|
|
2816
|
+
},
|
|
2817
|
+
],
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2699
2820
|
if (!diagnostics.success) {
|
|
2700
2821
|
this.logger.warn('Authentication diagnostics found issues:', diagnostics.data);
|
|
2701
2822
|
}
|
|
@@ -2753,10 +2874,18 @@ ${sessionSummary.statusCounts.pending > 0 ? '- 📋 Complete pending deployments
|
|
|
2753
2874
|
type: 'text',
|
|
2754
2875
|
text: `🔐 **Authentication & Deployment Diagnostics**
|
|
2755
2876
|
|
|
2756
|
-
|
|
2757
|
-
|
|
2877
|
+
**✅ Authentication Status:** ${authStatus}
|
|
2878
|
+
**📍 Credential Source:** ${credentialSource}
|
|
2879
|
+
**🌐 Instance:** ${data.instance_url || credentials?.instance || 'Unknown'}
|
|
2880
|
+
**⏰ Timestamp:** ${data.timestamp || new Date().toISOString()}
|
|
2881
|
+
|
|
2882
|
+
**🔑 Credential Details:**
|
|
2883
|
+
- Instance: ${credentials?.instance || 'Unknown'} ${credentials?.instance ? '✅' : '❌'}
|
|
2884
|
+
- Client ID: ${credentials?.clientId ? '✅ Present' : '❌ Missing'}
|
|
2885
|
+
- Access Token: ${credentials?.accessToken ? '✅ Valid' : '❌ Missing'}
|
|
2886
|
+
- Token Expires: ${credentials?.expiresAt ? new Date(credentials.expiresAt).toLocaleString() : 'Unknown'}
|
|
2758
2887
|
|
|
2759
|
-
**📊 Summary:**
|
|
2888
|
+
**📊 Permission Test Summary:**
|
|
2760
2889
|
- Total Tests: ${summary.total_tests || 0}
|
|
2761
2890
|
- Passed: ${summary.passed || 0} ✅
|
|
2762
2891
|
- Failed: ${summary.failed || 0} ${(summary.failed || 0) > 0 ? '❌' : ''}
|
|
@@ -2775,7 +2904,8 @@ ${(summary.failed || 0) === 0 && summary.total_tests > 0
|
|
|
2775
2904
|
1. If 403 errors persist: Check OAuth scopes in ServiceNow (System OAuth > Application Registry)
|
|
2776
2905
|
2. If URL issues: Remove trailing slash from SNOW_INSTANCE in .env file
|
|
2777
2906
|
3. If role issues: Contact ServiceNow admin to assign sp_portal_manager or admin role
|
|
2778
|
-
4.
|
|
2907
|
+
4. If token expired: Run \`snow-flow auth login\` to refresh tokens
|
|
2908
|
+
5. Re-test: Run this diagnostic again after making changes`
|
|
2779
2909
|
}
|
|
2780
2910
|
]
|
|
2781
2911
|
};
|