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.
@@ -1,141 +1,386 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Check Status Utility for MCP Prompt Optimizer
5
- * Provides detailed status information about API key and service
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
- console.log('๐Ÿ” MCP Prompt Optimizer - API Key Status Check\n');
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
- // Get API key from environment
15
- let apiKey;
16
- try {
17
- apiKey = CloudApiKeyManager.getApiKey();
18
- } catch (error) {
19
- console.error('โŒ No API key found\n');
20
- console.log('๐Ÿ“ Setup Instructions:');
21
- console.log(' 1. Get your API key from: https://promptoptimizer-blog.vercel.app/pricing');
22
- console.log(' 2. Set environment variable: export OPTIMIZER_API_KEY=sk-opt-your-key-here');
23
- console.log(' 3. Add to Claude Desktop config:');
24
- console.log(' {');
25
- console.log(' "mcpServers": {');
26
- console.log(' "prompt-optimizer": {');
27
- console.log(' "command": "npx",');
28
- console.log(' "args": ["mcp-prompt-optimizer"],');
29
- console.log(' "env": {');
30
- console.log(' "OPTIMIZER_API_KEY": "sk-opt-your-key-here"');
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
- // Display status information
61
- console.log('โœ… API Key Status: VALID\n');
38
+ console.log(`๐Ÿ” Checking status for API key: ${apiKey.substring(0, 16)}...`);
62
39
 
63
- console.log('๐Ÿ“Š Subscription Details:');
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
- if (keyInfo.quota.unlimited) {
68
- console.log(' Quota: Unlimited optimizations');
69
- } else {
70
- console.log(` Quota: ${keyInfo.quota.used.toLocaleString()} / ${keyInfo.quota.limit.toLocaleString()} used`);
71
- console.log(` Remaining: ${keyInfo.quota.remaining.toLocaleString()} optimizations`);
72
-
73
- const usagePercent = (keyInfo.quota.used / keyInfo.quota.limit) * 100;
74
- if (usagePercent >= 90) {
75
- console.log(' Status: ๐Ÿ”ด Critical - Quota nearly exhausted');
76
- } else if (usagePercent >= 75) {
77
- console.log(' Status: โš ๏ธ Warning - High usage');
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
- console.log(' Status: โœ… Healthy');
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
- console.log('\n๐Ÿ“ˆ Detailed Usage:');
96
- if (quotaDetails.quota.unlimited) {
97
- console.log(' Monthly Usage: Unlimited');
287
+ if (apiKeyInfo.quota && apiKeyInfo.quota.allowed) {
288
+ statusItems.push('โœ… Quota Available');
98
289
  } else {
99
- console.log(` Monthly Usage: ${quotaDetails.quota.usage_percentage}%`);
100
- console.log(` Reset Type: ${quotaDetails.quota.reset_type}`);
290
+ statusItems.push('โš ๏ธ Quota Issues');
101
291
  }
102
-
103
- if (quotaDetails.api_key_type === 'team' && quotaDetails.team_info) {
104
- console.log('\n๐Ÿ‘ฅ Team Information:');
105
- console.log(` Team: ${quotaDetails.team_info.team_name || 'Unknown'}`);
106
- console.log(` Team ID: ${quotaDetails.team_info.team_id}`);
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.warn(`\nโš ๏ธ Could not get detailed quota status: ${error.message}`);
111
- }
112
-
113
- console.log('\n๐Ÿš€ Quick Actions:');
114
- console.log(' ๐Ÿ“Š Check quota: mcp-prompt-optimizer check-status');
115
- console.log(' ๐Ÿ”‘ Validate key: mcp-prompt-optimizer validate-key');
116
- console.log(' ๐Ÿ—‘๏ธ Clear cache: mcp-prompt-optimizer clear-cache');
117
- console.log(' ๐Ÿ“ Dashboard: https://promptoptimizer-blog.vercel.app/dashboard');
118
-
119
- if (!keyInfo.quota.unlimited && keyInfo.quota.remaining < keyInfo.quota.limit * 0.1) {
120
- console.log('\n๐Ÿ’ก Upgrade Suggestion:');
121
- console.log(' Your quota is running low. Consider upgrading:');
122
- console.log(' - Creator ($25.99/mo): 18,000 optimizations + team features');
123
- console.log(' - Innovator ($69.99/mo): 75,000 optimizations + enterprise features');
124
- console.log(' Upgrade at: https://promptoptimizer-blog.vercel.app/pricing');
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(`โŒ Status check failed: ${error.message}`);
129
- console.log('\n๐Ÿ”ง Troubleshooting:');
130
- console.log(' 1. Check your internet connection');
131
- console.log(' 2. Verify backend URL is accessible');
132
- console.log(' 3. Try clearing cache: mcp-prompt-optimizer clear-cache');
133
- console.log(' 4. Contact support: support@promptoptimizer.help');
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
  }