zero-doc 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/dist/cli.js +35 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -63,6 +63,14 @@ function displayUrl(url) {
63
63
  const underline = '\x1b[4m';
64
64
  process.stdout.write(`${red}➜${reset} ${bold}Local:${reset} ${blue}${underline}${url}${reset}\n`);
65
65
  }
66
+ function displayPlansLink() {
67
+ const reset = '\x1b[0m';
68
+ const red = '\x1b[31m';
69
+ const blue = '\x1b[34m';
70
+ const bold = '\x1b[1m';
71
+ const underline = '\x1b[4m';
72
+ process.stdout.write(`${red}➜${reset} ${bold}Access plans:${reset} ${blue}${underline}https://zero-doc.com/plans${reset}\n`);
73
+ }
66
74
  commander_1.program
67
75
  .name('zero-doc')
68
76
  .description('Zero-Config API Documentation Generator')
@@ -439,8 +447,33 @@ commander_1.program
439
447
  catch (error) {
440
448
  clearProgress();
441
449
  process.stdout.write('\n');
442
- console.error('❌ Error:', error instanceof Error ? error.message : error);
443
- process.exit(1);
450
+ const errorMessage = error instanceof Error ? error.message : String(error);
451
+ // Check if it's a 403 error
452
+ if (errorMessage.includes('403')) {
453
+ // Extract the actual error message from the API response
454
+ let apiErrorMessage = errorMessage;
455
+ try {
456
+ // Try to parse the JSON error from the message
457
+ // Format: "Proxy API error (403): Forbidden. {"success":false,"error":"Insufficient credits"}"
458
+ const jsonMatch = errorMessage.match(/\{[\s\S]*\}/);
459
+ if (jsonMatch) {
460
+ const errorJson = JSON.parse(jsonMatch[0]);
461
+ if (errorJson.error) {
462
+ apiErrorMessage = errorJson.error;
463
+ }
464
+ }
465
+ }
466
+ catch {
467
+ // If parsing fails, use the original message
468
+ }
469
+ console.error('❌ Error:', apiErrorMessage);
470
+ displayPlansLink();
471
+ // Don't exit - keep the session open
472
+ }
473
+ else {
474
+ console.error('❌ Error:', errorMessage);
475
+ process.exit(1);
476
+ }
444
477
  }
445
478
  });
446
479
  commander_1.program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zero-doc",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Zero-Config API Documentation Generator - Generate beautiful API docs from your code automatically",
5
5
  "main": "dist/index.js",
6
6
  "bin": {