@holin-work/holin-cli 1.3.1 → 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.
Files changed (2) hide show
  1. package/bin/holin-cli.js +19 -10
  2. package/package.json +1 -1
package/bin/holin-cli.js CHANGED
@@ -511,6 +511,7 @@ function cmdProxyStart() {
511
511
  });
512
512
 
513
513
  // Health check: idle timeout + credentials file monitoring
514
+ let credsMissingSince = null;
514
515
  const healthCheck = setInterval(() => {
515
516
  const idleMs = Date.now() - lastRequestTime;
516
517
  if (idleMs > IDLE_TIMEOUT_MS) {
@@ -519,16 +520,24 @@ function cmdProxyStart() {
519
520
  return;
520
521
  }
521
522
  // Check if credentials file still exists (user may have logged out / uninstalled)
522
- if (!existsSync(CREDENTIALS_FILE)) {
523
- log("[proxy] Credentials file removed, auto-exiting.");
524
- cleanupAndExit();
525
- return;
526
- }
527
- const creds = readCredentials();
528
- if (!creds?.api_key) {
529
- log("[proxy] Credentials cleared, auto-exiting.");
530
- cleanupAndExit();
531
- return;
523
+ // Use a 30s grace period to avoid false positives during re-auth (old creds cleared, new ones not yet written)
524
+ const credsExist = existsSync(CREDENTIALS_FILE);
525
+ const creds = credsExist ? readCredentials() : null;
526
+ const hasValidKey = !!(creds?.api_key);
527
+ if (!hasValidKey) {
528
+ if (!credsMissingSince) {
529
+ credsMissingSince = Date.now();
530
+ log("[proxy] Credentials missing, starting 30s grace period...");
531
+ } else if (Date.now() - credsMissingSince > 30000) {
532
+ log("[proxy] Credentials missing for 30s, auto-exiting.");
533
+ cleanupAndExit();
534
+ return;
535
+ }
536
+ } else {
537
+ if (credsMissingSince) {
538
+ log("[proxy] Credentials restored, canceling grace period.");
539
+ credsMissingSince = null;
540
+ }
532
541
  }
533
542
  }, HEALTH_CHECK_INTERVAL_MS);
534
543
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holin-work/holin-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Holin CLI — Accio plugin authorization tool for ICBU batch listing",
5
5
  "type": "module",
6
6
  "bin": {