mcp-prompt-optimizer 1.3.2 โ 1.3.3
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/CHANGELOG.md +85 -0
- package/README.md +286 -130
- package/index.js +1092 -724
- package/lib/api-key-manager.js +538 -46
- package/lib/check-status.js +356 -111
- package/lib/clear-cache.js +113 -79
- package/lib/diagnose.js +252 -0
- package/lib/diagnose.js file.txt +252 -0
- package/lib/test-integration.js +250 -0
- package/lib/validate-key.js +171 -54
- package/package.json +224 -28
package/lib/check-status.js
CHANGED
|
@@ -1,141 +1,386 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Check Status
|
|
5
|
-
*
|
|
4
|
+
* Check Status Command for MCP Prompt Optimizer
|
|
5
|
+
* Enhanced with comprehensive status reporting and development mode support
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const CloudApiKeyManager = require('./api-key-manager');
|
|
9
|
+
const packageJson = require('../package.json');
|
|
9
10
|
|
|
10
11
|
async function checkStatus() {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const developmentMode = process.env.NODE_ENV === 'development' || process.env.OPTIMIZER_DEV_MODE === 'true';
|
|
13
|
+
const modeText = developmentMode ? ' (Development Mode)' : '';
|
|
14
|
+
|
|
15
|
+
console.log(`๐ MCP Prompt Optimizer v${packageJson.version} - Status Check${modeText}\n`);
|
|
16
|
+
|
|
13
17
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
console.
|
|
20
|
-
console.log('
|
|
21
|
-
console.log('
|
|
22
|
-
console.log('
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
console.log(' }');
|
|
32
|
-
console.log(' }');
|
|
33
|
-
console.log(' }');
|
|
34
|
-
console.log(' }');
|
|
35
|
-
console.log('\n๐ฐ Pricing:');
|
|
36
|
-
console.log(' - Explorer ($2.99/mo): 5,000 optimizations');
|
|
37
|
-
console.log(' - Creator ($25.99/mo): 18,000 optimizations + team features');
|
|
38
|
-
console.log(' - Innovator ($69.99/mo): 75,000 optimizations + enterprise features');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Create manager and validate key
|
|
43
|
-
const manager = new CloudApiKeyManager(apiKey);
|
|
44
|
-
console.log(`๐ API Key: ${manager.formatKeyForDisplay()}`);
|
|
45
|
-
console.log(`๐ก Backend: ${manager.backendUrl}\n`);
|
|
46
|
-
|
|
47
|
-
console.log('โณ Validating API key...');
|
|
48
|
-
const keyInfo = await manager.getApiKeyInfo();
|
|
49
|
-
|
|
50
|
-
if (!keyInfo.isValid) {
|
|
51
|
-
console.error(`โ API Key Invalid: ${keyInfo.error}\n`);
|
|
52
|
-
console.log('๐ง Troubleshooting:');
|
|
53
|
-
console.log(' 1. Check your API key format (should start with sk-opt- or sk-team-)');
|
|
54
|
-
console.log(' 2. Verify your subscription is active at: https://promptoptimizer-blog.vercel.app/dashboard');
|
|
55
|
-
console.log(' 3. Get a new API key at: https://promptoptimizer-blog.vercel.app/pricing');
|
|
56
|
-
console.log(' 4. Contact support: support@promptoptimizer.help');
|
|
18
|
+
const apiKey = process.env.OPTIMIZER_API_KEY;
|
|
19
|
+
|
|
20
|
+
if (!apiKey) {
|
|
21
|
+
console.error('โ No API key found');
|
|
22
|
+
console.log('\n๐ Set your API key to check status:');
|
|
23
|
+
console.log(' export OPTIMIZER_API_KEY=sk-opt-your-key-here');
|
|
24
|
+
console.log('\n๐ Get your API key:');
|
|
25
|
+
console.log(' https://promptoptimizer-blog.vercel.app/pricing');
|
|
26
|
+
console.log('\n๐ฐ Free trial: 5 optimizations with full feature access');
|
|
27
|
+
|
|
28
|
+
if (developmentMode) {
|
|
29
|
+
console.log('\n๐งช Development Mode Options:');
|
|
30
|
+
console.log(' export OPTIMIZER_API_KEY=sk-dev-test-key');
|
|
31
|
+
console.log(' export OPTIMIZER_API_KEY=sk-local-test-key');
|
|
32
|
+
console.log(' Features: Mock status, offline operation');
|
|
33
|
+
}
|
|
34
|
+
|
|
57
35
|
process.exit(1);
|
|
58
36
|
}
|
|
59
37
|
|
|
60
|
-
|
|
61
|
-
console.log('โ
API Key Status: VALID\n');
|
|
38
|
+
console.log(`๐ Checking status for API key: ${apiKey.substring(0, 16)}...`);
|
|
62
39
|
|
|
63
|
-
|
|
64
|
-
console.log(` Tier: ${keyInfo.tier.charAt(0).toUpperCase() + keyInfo.tier.slice(1)}`);
|
|
65
|
-
console.log(` Type: ${keyInfo.keyType.charAt(0).toUpperCase() + keyInfo.keyType.slice(1)}`);
|
|
40
|
+
const manager = new CloudApiKeyManager(apiKey, { developmentMode });
|
|
66
41
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
42
|
+
// Get comprehensive API key information
|
|
43
|
+
console.log('โณ Fetching account information...\n');
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const apiKeyInfo = await manager.getApiKeyInfo();
|
|
47
|
+
|
|
48
|
+
// Header
|
|
49
|
+
console.log('๐ Account Status:');
|
|
50
|
+
console.log('=' .repeat(50));
|
|
51
|
+
|
|
52
|
+
// Basic account information
|
|
53
|
+
console.log(`๐ฏ Subscription Tier: ${apiKeyInfo.tier.charAt(0).toUpperCase() + apiKeyInfo.tier.slice(1)}`);
|
|
54
|
+
console.log(`๐ API Key Type: ${apiKeyInfo.keyType}`);
|
|
55
|
+
console.log(`โ
Key Status: ${apiKeyInfo.isValid ? 'Valid' : 'Invalid'}`);
|
|
56
|
+
|
|
57
|
+
// Mode indicators
|
|
58
|
+
if (apiKeyInfo.mode) {
|
|
59
|
+
const modes = [];
|
|
60
|
+
if (apiKeyInfo.mode.development) modes.push('Development');
|
|
61
|
+
if (apiKeyInfo.mode.mock) modes.push('Mock');
|
|
62
|
+
if (apiKeyInfo.mode.fallback) modes.push('Fallback');
|
|
63
|
+
if (apiKeyInfo.mode.offline) modes.push('Offline');
|
|
64
|
+
|
|
65
|
+
if (modes.length > 0) {
|
|
66
|
+
console.log(`๐ง Current Mode: ${modes.join(', ')}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Quota information
|
|
71
|
+
console.log('\n๐ Usage & Quota:');
|
|
72
|
+
if (apiKeyInfo.quota) {
|
|
73
|
+
if (apiKeyInfo.quota.unlimited) {
|
|
74
|
+
console.log(' ๐ Quota: โจ Unlimited optimizations');
|
|
75
|
+
} else if (apiKeyInfo.quota.allowed) {
|
|
76
|
+
const used = apiKeyInfo.quota.used || 0;
|
|
77
|
+
const limit = apiKeyInfo.quota.limit || 0;
|
|
78
|
+
const remaining = apiKeyInfo.quota.remaining || 0;
|
|
79
|
+
const percentage = limit > 0 ? ((used / limit) * 100).toFixed(1) : 0;
|
|
80
|
+
|
|
81
|
+
console.log(` ๐ Usage: ${used.toLocaleString()}/${limit.toLocaleString()} (${percentage}% used)`);
|
|
82
|
+
console.log(` ๐ Remaining: ${remaining.toLocaleString()} optimizations`);
|
|
83
|
+
|
|
84
|
+
// Usage warnings
|
|
85
|
+
if (percentage > 90) {
|
|
86
|
+
console.log(' โ ๏ธ Critical: Quota nearly exhausted');
|
|
87
|
+
} else if (percentage > 75) {
|
|
88
|
+
console.log(' โ ๏ธ Warning: Quota usage high');
|
|
89
|
+
} else if (percentage > 50) {
|
|
90
|
+
console.log(' โน๏ธ Info: Quota halfway used');
|
|
91
|
+
} else {
|
|
92
|
+
console.log(' โ
Quota usage healthy');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (apiKeyInfo.quota.usage_percentage) {
|
|
96
|
+
console.log(` ๐ Usage Trend: ${apiKeyInfo.quota.usage_percentage.toFixed(1)}%`);
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
console.log(' โ Quota check failed');
|
|
100
|
+
if (apiKeyInfo.error) {
|
|
101
|
+
console.log(` Error: ${apiKeyInfo.error}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Features section
|
|
107
|
+
console.log('\nโจ Available Features:');
|
|
108
|
+
if (apiKeyInfo.features) {
|
|
109
|
+
const featureMap = {
|
|
110
|
+
ai_context_detection: '๐ง AI Context Detection',
|
|
111
|
+
template_management: '๐ Template Management',
|
|
112
|
+
team_collaboration: '๐ฅ Team Collaboration',
|
|
113
|
+
optimization_insights: '๐ Optimization Insights',
|
|
114
|
+
priority_processing: 'โก Priority Processing',
|
|
115
|
+
analytics_dashboard: '๐ Analytics Dashboard',
|
|
116
|
+
development_mode: '๐งช Development Mode',
|
|
117
|
+
testing_mode: '๐ฌ Testing Mode',
|
|
118
|
+
network_resilience: '๐ Network Resilience',
|
|
119
|
+
offline_caching: '๐ด Offline Caching'
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
let featureCount = 0;
|
|
123
|
+
Object.entries(apiKeyInfo.features).forEach(([feature, enabled]) => {
|
|
124
|
+
if (enabled && featureMap[feature]) {
|
|
125
|
+
console.log(` ${featureMap[feature]}`);
|
|
126
|
+
featureCount++;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (featureCount === 0) {
|
|
131
|
+
console.log(' ๐ Basic optimization features');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Plan-specific information
|
|
136
|
+
if (apiKeyInfo.tier === 'explorer') {
|
|
137
|
+
console.log('\n๐ก Explorer Plan Benefits:');
|
|
138
|
+
console.log(' โ
5,000 monthly optimizations');
|
|
139
|
+
console.log(' โ
AI context detection');
|
|
140
|
+
console.log(' โ
Template auto-save');
|
|
141
|
+
console.log(' โ
Community support');
|
|
142
|
+
} else if (apiKeyInfo.tier === 'creator') {
|
|
143
|
+
console.log('\n๐ Creator Plan Benefits:');
|
|
144
|
+
console.log(' โ
18,000 monthly optimizations');
|
|
145
|
+
console.log(' โ
Team collaboration (2 members)');
|
|
146
|
+
console.log(' โ
Priority processing');
|
|
147
|
+
console.log(' โ
Analytics dashboard');
|
|
148
|
+
console.log(' โ
Email support');
|
|
149
|
+
} else if (apiKeyInfo.tier === 'innovator') {
|
|
150
|
+
console.log('\n๐ Innovator Plan Benefits:');
|
|
151
|
+
console.log(' โ
75,000 monthly optimizations');
|
|
152
|
+
console.log(' โ
Team collaboration (5 members)');
|
|
153
|
+
console.log(' โ
Advanced analytics');
|
|
154
|
+
console.log(' โ
Priority support');
|
|
155
|
+
console.log(' โ
Dedicated support channel');
|
|
156
|
+
} else if (apiKeyInfo.tier === 'development' || apiKeyInfo.tier === 'testing') {
|
|
157
|
+
console.log('\n๐งช Development/Testing Features:');
|
|
158
|
+
console.log(' โ
Mock optimization responses');
|
|
159
|
+
console.log(' โ
Offline operation');
|
|
160
|
+
console.log(' โ
No backend dependency');
|
|
161
|
+
console.log(' โ
Enhanced debugging');
|
|
162
|
+
console.log(' โ
Safe testing environment');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Network health section
|
|
166
|
+
console.log('\n๐ Network Health:');
|
|
167
|
+
try {
|
|
168
|
+
const diagnostic = await manager.getDiagnosticInfo();
|
|
169
|
+
const health = diagnostic.networkHealth;
|
|
170
|
+
|
|
171
|
+
console.log(` ๐ Consecutive Failures: ${health.consecutiveFailures}`);
|
|
172
|
+
console.log(` โ
Last Successful: ${health.lastSuccessful ? new Date(health.lastSuccessful).toLocaleString() : 'Never'}`);
|
|
173
|
+
console.log(` โก Avg Response Time: ${health.avgResponseTime ? health.avgResponseTime + 'ms' : 'Unknown'}`);
|
|
174
|
+
|
|
175
|
+
// Network quality assessment
|
|
176
|
+
if (health.avgResponseTime) {
|
|
177
|
+
const quality = health.avgResponseTime < 1000 ? 'Excellent โจ' :
|
|
178
|
+
health.avgResponseTime < 3000 ? 'Good โ
' :
|
|
179
|
+
health.avgResponseTime < 5000 ? 'Fair โ ๏ธ' : 'Poor โ';
|
|
180
|
+
console.log(` ๐ถ Connection Quality: ${quality}`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (health.consecutiveFailures === 0) {
|
|
184
|
+
console.log(' ๐ Network connection stable');
|
|
185
|
+
} else if (health.consecutiveFailures < 3) {
|
|
186
|
+
console.log(' โ ๏ธ Minor network issues detected');
|
|
187
|
+
} else {
|
|
188
|
+
console.log(' โ Network instability detected');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Backend connectivity
|
|
192
|
+
if (diagnostic.backendConnectivity.status === 'success') {
|
|
193
|
+
console.log(' โ
Backend connectivity: Operational');
|
|
194
|
+
} else {
|
|
195
|
+
console.log(' โ Backend connectivity: Issues detected');
|
|
196
|
+
|
|
197
|
+
if (apiKeyInfo.mode && (apiKeyInfo.mode.fallback || apiKeyInfo.mode.offline)) {
|
|
198
|
+
console.log(' ๐ Fallback mode active');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
} catch (healthError) {
|
|
203
|
+
console.log(' โ ๏ธ Network health check unavailable');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Cache status
|
|
207
|
+
console.log('\n๐พ Cache Status:');
|
|
208
|
+
try {
|
|
209
|
+
const diagnostic = await manager.getDiagnosticInfo();
|
|
210
|
+
|
|
211
|
+
if (diagnostic.cache.exists) {
|
|
212
|
+
console.log(` ๐ Validation cache: Active (${diagnostic.cache.age} minutes old)`);
|
|
213
|
+
console.log(` โณ Normal expiry: ${diagnostic.cache.expired ? 'Expired' : 'Valid'}`);
|
|
214
|
+
console.log(` ๐ Fallback expiry: ${diagnostic.cache.fallbackExpired ? 'Expired' : 'Valid'}`);
|
|
215
|
+
} else {
|
|
216
|
+
console.log(' ๐ No cached data found');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
console.log(` ๐ Cache location: ${diagnostic.cacheFile}`);
|
|
220
|
+
|
|
221
|
+
} catch (cacheError) {
|
|
222
|
+
console.log(' โ ๏ธ Cache status check unavailable');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// System information
|
|
226
|
+
console.log('\n๐ง System Information:');
|
|
227
|
+
console.log(` ๐ฆ Package Version: ${packageJson.version}`);
|
|
228
|
+
console.log(` ๐ Backend URL: ${manager.backendUrl}`);
|
|
229
|
+
console.log(` ๐งช Development Mode: ${developmentMode ? 'Enabled' : 'Disabled'}`);
|
|
230
|
+
console.log(` โฑ๏ธ Request Timeout: ${manager.requestTimeout}ms`);
|
|
231
|
+
console.log(` ๐ Max Retries: ${manager.maxRetries}`);
|
|
232
|
+
|
|
233
|
+
// Recommendations
|
|
234
|
+
console.log('\n๐ก Recommendations:');
|
|
235
|
+
|
|
236
|
+
if (apiKeyInfo.quota && !apiKeyInfo.quota.unlimited) {
|
|
237
|
+
const remaining = apiKeyInfo.quota.remaining || 0;
|
|
238
|
+
const limit = apiKeyInfo.quota.limit || 0;
|
|
239
|
+
const percentage = limit > 0 ? ((limit - remaining) / limit) * 100 : 0;
|
|
240
|
+
|
|
241
|
+
if (percentage > 90) {
|
|
242
|
+
console.log(' ๐ Consider upgrading plan - quota nearly exhausted');
|
|
243
|
+
console.log(' ๐ Upgrade: https://promptoptimizer-blog.vercel.app/pricing');
|
|
244
|
+
} else if (percentage > 75) {
|
|
245
|
+
console.log(' ๐ Monitor usage closely - quota running low');
|
|
246
|
+
} else {
|
|
247
|
+
console.log(' โ
Quota usage healthy');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (apiKeyInfo.mode && apiKeyInfo.mode.fallback) {
|
|
252
|
+
console.log(' ๐ Network issues detected - check connectivity');
|
|
253
|
+
console.log(' ๐ Run diagnostic: mcp-prompt-optimizer diagnose');
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (apiKeyInfo.mode && (apiKeyInfo.mode.development || apiKeyInfo.mode.mock)) {
|
|
257
|
+
console.log(' ๐งช Running in development mode');
|
|
258
|
+
console.log(' ๐ Switch to production: unset OPTIMIZER_DEV_MODE');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Quick actions
|
|
262
|
+
console.log('\n๐ฏ Quick Actions:');
|
|
263
|
+
console.log(' ๐ Dashboard: https://promptoptimizer-blog.vercel.app/dashboard');
|
|
264
|
+
console.log(' ๐ Usage Analytics: View detailed usage statistics');
|
|
265
|
+
console.log(' ๐ API Keys: Manage and generate new keys');
|
|
266
|
+
console.log(' โ๏ธ Settings: Configure models and preferences');
|
|
267
|
+
console.log(' ๐ Support: Get help and contact support');
|
|
268
|
+
|
|
269
|
+
console.log('\n๐ ๏ธ CLI Commands:');
|
|
270
|
+
console.log(' ๐ Validate key: mcp-prompt-optimizer validate-key');
|
|
271
|
+
console.log(' ๐งช Test integration: mcp-prompt-optimizer test');
|
|
272
|
+
console.log(' ๐ฌ Run diagnostic: mcp-prompt-optimizer diagnose');
|
|
273
|
+
console.log(' ๐งน Clear cache: mcp-prompt-optimizer clear-cache');
|
|
274
|
+
|
|
275
|
+
// Final status summary
|
|
276
|
+
console.log('\n' + '='.repeat(50));
|
|
277
|
+
console.log('๐ STATUS SUMMARY:');
|
|
278
|
+
|
|
279
|
+
const statusItems = [];
|
|
280
|
+
|
|
281
|
+
if (apiKeyInfo.isValid) {
|
|
282
|
+
statusItems.push('โ
API Key Valid');
|
|
78
283
|
} else {
|
|
79
|
-
|
|
284
|
+
statusItems.push('โ API Key Invalid');
|
|
80
285
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
console.log('\nโจ Available Features:');
|
|
84
|
-
const features = keyInfo.features;
|
|
85
|
-
if (features.professional_optimization) console.log(' โ
Professional AI optimization');
|
|
86
|
-
if (features.auto_save_templates) console.log(' โ
Template auto-save');
|
|
87
|
-
if (features.template_search) console.log(' โ
Template search');
|
|
88
|
-
if (features.optimization_insights) console.log(' โ
Optimization insights');
|
|
89
|
-
|
|
90
|
-
// Get additional quota details
|
|
91
|
-
try {
|
|
92
|
-
console.log('\nโณ Getting detailed quota status...');
|
|
93
|
-
const quotaDetails = await manager.getQuotaStatus();
|
|
94
286
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
console.log(' Monthly Usage: Unlimited');
|
|
287
|
+
if (apiKeyInfo.quota && apiKeyInfo.quota.allowed) {
|
|
288
|
+
statusItems.push('โ
Quota Available');
|
|
98
289
|
} else {
|
|
99
|
-
|
|
100
|
-
console.log(` Reset Type: ${quotaDetails.quota.reset_type}`);
|
|
290
|
+
statusItems.push('โ ๏ธ Quota Issues');
|
|
101
291
|
}
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
292
|
+
|
|
293
|
+
if (apiKeyInfo.mode && !apiKeyInfo.mode.fallback) {
|
|
294
|
+
statusItems.push('โ
Network Healthy');
|
|
295
|
+
} else {
|
|
296
|
+
statusItems.push('โ ๏ธ Network Issues');
|
|
107
297
|
}
|
|
108
|
-
|
|
298
|
+
|
|
299
|
+
console.log(statusItems.join(' | '));
|
|
300
|
+
|
|
301
|
+
const overallStatus = apiKeyInfo.isValid &&
|
|
302
|
+
(!apiKeyInfo.quota || apiKeyInfo.quota.allowed) &&
|
|
303
|
+
(!apiKeyInfo.mode || !apiKeyInfo.mode.fallback) ?
|
|
304
|
+
'OPERATIONAL' : 'DEGRADED';
|
|
305
|
+
|
|
306
|
+
console.log(`๐ฏ Overall Status: ${overallStatus}`);
|
|
307
|
+
|
|
308
|
+
if (overallStatus === 'OPERATIONAL') {
|
|
309
|
+
console.log('๐ System ready for optimal performance!');
|
|
310
|
+
} else {
|
|
311
|
+
console.log('โ ๏ธ Some issues detected - see recommendations above');
|
|
312
|
+
}
|
|
313
|
+
|
|
109
314
|
} catch (error) {
|
|
110
|
-
console.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
315
|
+
console.error(`โ Status check failed: ${error.message}\n`);
|
|
316
|
+
|
|
317
|
+
if (error.message.includes('Network error') || error.message.includes('timeout') || error.message.includes('DNS')) {
|
|
318
|
+
console.log('๐ Connection Issue:');
|
|
319
|
+
console.log(' - Check your internet connection');
|
|
320
|
+
console.log(' - Verify firewall/proxy settings');
|
|
321
|
+
console.log(' - Backend may be temporarily unavailable');
|
|
322
|
+
console.log(' - Try again in a moment');
|
|
323
|
+
|
|
324
|
+
if (!developmentMode) {
|
|
325
|
+
console.log('\n๐งช Try Development Mode:');
|
|
326
|
+
console.log(' export OPTIMIZER_DEV_MODE=true');
|
|
327
|
+
console.log(' export OPTIMIZER_API_KEY=sk-dev-test-key');
|
|
328
|
+
console.log(' mcp-prompt-optimizer check-status');
|
|
329
|
+
}
|
|
330
|
+
} else if (error.message.includes('401') || error.message.includes('Invalid') || error.message.includes('unauthorized')) {
|
|
331
|
+
console.log('๐ API Key Issue:');
|
|
332
|
+
console.log(' - Verify your subscription is active');
|
|
333
|
+
console.log(' - Check key format (sk-opt-*, sk-team-*, sk-dev-*, or sk-local-)');
|
|
334
|
+
console.log(' - Key may be expired or deactivated');
|
|
335
|
+
console.log(' - Get a new key: https://promptoptimizer-blog.vercel.app/pricing');
|
|
336
|
+
} else if (error.message.includes('quota') || error.message.includes('429')) {
|
|
337
|
+
console.log('๐ Quota Issue:');
|
|
338
|
+
console.log(' - Your monthly quota is exhausted');
|
|
339
|
+
console.log(' - Upgrade: https://promptoptimizer-blog.vercel.app/pricing');
|
|
340
|
+
console.log(' - Usage resets monthly');
|
|
341
|
+
} else {
|
|
342
|
+
console.log('๐ง General Troubleshooting:');
|
|
343
|
+
console.log(' 1. Clear cache: mcp-prompt-optimizer clear-cache');
|
|
344
|
+
console.log(' 2. Run diagnostic: mcp-prompt-optimizer diagnose');
|
|
345
|
+
console.log(' 3. Validate key: mcp-prompt-optimizer validate-key');
|
|
346
|
+
console.log(' 4. Test integration: mcp-prompt-optimizer test');
|
|
347
|
+
|
|
348
|
+
if (!developmentMode) {
|
|
349
|
+
console.log(' 5. Try development mode: export OPTIMIZER_DEV_MODE=true');
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
console.log(' 6. Contact support: support@promptoptimizer.help');
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Show fallback options
|
|
356
|
+
console.log('\n๐พ Fallback Options:');
|
|
357
|
+
console.log(' ๐งช Development mode: Full offline functionality');
|
|
358
|
+
console.log(' ๐พ Cached data: May be available for limited operation');
|
|
359
|
+
console.log(' ๐ Diagnostic: Get detailed troubleshooting info');
|
|
360
|
+
|
|
361
|
+
process.exit(1);
|
|
125
362
|
}
|
|
126
|
-
|
|
363
|
+
|
|
127
364
|
} catch (error) {
|
|
128
|
-
console.error(`โ
|
|
129
|
-
console.log('\n
|
|
130
|
-
console.log(' 1.
|
|
131
|
-
console.log(' 2.
|
|
132
|
-
console.log(' 3.
|
|
133
|
-
console.log(' 4.
|
|
365
|
+
console.error(`โ Unexpected error: ${error.message}`);
|
|
366
|
+
console.log('\n๐ ๏ธ Emergency Troubleshooting:');
|
|
367
|
+
console.log(' 1. Ensure Node.js version >= 16.0.0');
|
|
368
|
+
console.log(' 2. Reinstall dependencies: npm install');
|
|
369
|
+
console.log(' 3. Clear all caches: mcp-prompt-optimizer clear-cache');
|
|
370
|
+
console.log(' 4. Run diagnostics: mcp-prompt-optimizer diagnose');
|
|
371
|
+
console.log(' 5. Contact support: support@promptoptimizer.help');
|
|
372
|
+
|
|
373
|
+
if (!developmentMode) {
|
|
374
|
+
console.log('\n๐งช Try Development Mode for Offline Testing:');
|
|
375
|
+
console.log(' export OPTIMIZER_DEV_MODE=true');
|
|
376
|
+
console.log(' export OPTIMIZER_API_KEY=sk-dev-test-key');
|
|
377
|
+
console.log(' mcp-prompt-optimizer check-status');
|
|
378
|
+
}
|
|
379
|
+
|
|
134
380
|
process.exit(1);
|
|
135
381
|
}
|
|
136
382
|
}
|
|
137
383
|
|
|
138
|
-
// Run if called directly
|
|
139
384
|
if (require.main === module) {
|
|
140
385
|
checkStatus();
|
|
141
386
|
}
|