periderm-cli 0.1.72 → 0.1.73

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/dist/index.js CHANGED
@@ -82,7 +82,10 @@ program
82
82
  if (v.plan !== "unlimited" &&
83
83
  (v.scans_remaining === undefined || v.scans_remaining <= 0)) {
84
84
  verifySpinner.fail(`No scans left on your ${v.plan} plan.`);
85
- console.info(chalk.yellow(`\nRenew or upgrade at ${cfg.apiUrl}/dashboard/billing\n`));
85
+ console.info(chalk.yellow(`\nRenew or upgrade at ${cfg.apiUrl}/dashboard/billing`));
86
+ console.info(chalk.dim("If you just subscribed, wait a moment then run ") +
87
+ chalk.bold.cyan("$ periderm whoami") +
88
+ chalk.dim(" to re-check your quota.\n"));
86
89
  process.exit(1);
87
90
  }
88
91
  verifySpinner.stop();
@@ -344,11 +347,19 @@ program
344
347
  </body>
345
348
  </html>`;
346
349
  res.end(html);
347
- const v = await verifyToken(token);
350
+ let v = await verifyToken(token);
348
351
  if (!v.valid) {
349
352
  console.info(chalk.red(`\nInvalid token: ${v.error}`));
350
353
  process.exit(1);
351
354
  }
355
+ // If quota shows 0 on a paid plan, the subscription webhook may not have
356
+ // propagated yet. Wait briefly and re-fetch once before displaying.
357
+ if (v.scans_remaining === 0 && v.plan !== "starter") {
358
+ await new Promise((r) => setTimeout(r, 2500));
359
+ const refreshed = await verifyToken(token);
360
+ if (refreshed.valid)
361
+ v = refreshed;
362
+ }
352
363
  writeConfig({ apiUrl, token });
353
364
  console.clear();
354
365
  const username = os.userInfo().username;
@@ -356,7 +367,8 @@ program
356
367
  const header = `${username}@${hostname}`;
357
368
  const formatEmail = v.email || v.user_id || "Unknown";
358
369
  const formatPlan = v.plan || "starter";
359
- const formatQuota = `${v.scans_remaining ?? "?"}`;
370
+ const scansLeft = v.scans_remaining ?? 0;
371
+ const formatQuota = v.plan === "unlimited" ? "Unlimited" : `${scansLeft} scan${scansLeft !== 1 ? "s" : ""}`;
360
372
  const actualLogoLines = PERIDERM_ASCII.split("\n");
361
373
  // Print logo
362
374
  console.info("");
@@ -371,8 +383,18 @@ program
371
383
  console.info("");
372
384
  console.info(chalk.bold.white("Account : ") + chalk.white(formatEmail));
373
385
  console.info(chalk.bold.white("Plan : ") + chalk.magenta(formatPlan));
374
- console.info(chalk.bold.white("Quota : ") + chalk.yellow(`${formatQuota} scans`));
386
+ console.info(chalk.bold.white("Quota : ") +
387
+ (scansLeft === 0 && v.plan !== "unlimited"
388
+ ? chalk.red(formatQuota)
389
+ : chalk.yellow(formatQuota)));
375
390
  console.info("");
391
+ // Hint when quota still shows 0 after a recent subscription — webhook
392
+ // delivery can lag by a few seconds. Running `whoami` re-fetches live.
393
+ if (scansLeft === 0 && v.plan !== "starter" && v.plan !== "unlimited") {
394
+ console.info(chalk.yellow("⚠ Quota shows 0. If you just subscribed, wait a moment then run:"));
395
+ console.info(chalk.bold.cyan(" $ periderm whoami") + chalk.dim(" (re-checks live)"));
396
+ console.info("");
397
+ }
376
398
  console.info(chalk.bold.white("[Next Steps]"));
377
399
  console.info(chalk.white(" 1. Scan + upload ") + chalk.hex("#FF4D00")("$ periderm scan"));
378
400
  console.info(chalk.white(" 2. Log out ") + chalk.hex("#FF4D00")("$ periderm logout"));
@@ -427,11 +449,23 @@ program
427
449
  console.info("");
428
450
  const formatEmail = r.email || r.user_id || "Unknown";
429
451
  const formatPlan = r.plan || "starter";
430
- const formatQuota = `${r.scans_remaining ?? "?"}`;
452
+ const scansLeft = r.scans_remaining ?? 0;
453
+ const formatQuota = r.plan === "unlimited" ? "Unlimited" : `${scansLeft} scan${scansLeft !== 1 ? "s" : ""}`;
431
454
  console.info(chalk.bold.white("Account : ") + chalk.white(formatEmail));
432
455
  console.info(chalk.bold.white("Plan : ") + chalk.magenta(formatPlan));
433
- console.info(chalk.bold.white("Quota : ") + chalk.yellow(`${formatQuota} scans`));
456
+ console.info(chalk.bold.white("Quota : ") +
457
+ (scansLeft === 0 && r.plan !== "unlimited"
458
+ ? chalk.red(formatQuota)
459
+ : chalk.yellow(formatQuota)));
434
460
  console.info(chalk.bold.white("API : ") + chalk.cyan(cfg.apiUrl));
461
+ if (scansLeft === 0 && r.plan !== "starter" && r.plan !== "unlimited") {
462
+ console.info("");
463
+ console.info(chalk.yellow("⚠ Quota shows 0. If you recently subscribed, the webhook may still be"));
464
+ console.info(chalk.yellow(" propagating. Run ") +
465
+ chalk.bold.cyan("$ periderm whoami") +
466
+ chalk.yellow(" again in a few seconds, or visit:"));
467
+ console.info(chalk.underline.cyan(` ${cfg.apiUrl}/dashboard/billing`));
468
+ }
435
469
  });
436
470
  program
437
471
  .command("logout")
@@ -24,8 +24,8 @@ export async function initPredictor() {
24
24
  if (session)
25
25
  return;
26
26
  try {
27
- ort = await import("onnxruntime-web");
28
- debugMl("runtime: onnxruntime-web");
27
+ ort = await import("onnxruntime-node");
28
+ debugMl("runtime: onnxruntime-node");
29
29
  }
30
30
  catch {
31
31
  debugMl("no ONNX runtime available");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Periderm CLI: A pre-launch checklist to catch user-losing bugs, legal liabilities, revenue leaks, runaway cloud bills and so many more before you ship.",
5
5
  "type": "module",
6
6
  "preferGlobal": true,
@@ -54,7 +54,7 @@
54
54
  "chalk": "^5.3.0",
55
55
  "commander": "^12.1.0",
56
56
  "fast-glob": "^3.3.2",
57
- "onnxruntime-web": "^1.29.0",
57
+ "onnxruntime-node": "^1.29.0",
58
58
  "open": "^10.1.0",
59
59
  "ora": "^9.4.1"
60
60
  },