pennyrouter 0.1.10 → 0.1.11

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/package.json +1 -1
  2. package/src/cli.js +54 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pennyrouter",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Install and manage PennyRouter local coding-agent integrations.",
5
5
  "homepage": "https://pennyrouter.com",
6
6
  "bugs": {
package/src/cli.js CHANGED
@@ -120,6 +120,8 @@ function parseArgs(argv) {
120
120
  // `--local=<url>` overrides the port/host.
121
121
  else if (arg === "--local") flags.gatewayBaseUrl = "http://localhost:8400";
122
122
  else if (arg.startsWith("--local=")) flags.gatewayBaseUrl = arg.slice("--local=".length);
123
+ else if (arg === "--forget") flags.forget = true;
124
+ else if (arg === "--forget-token") flags.forgetToken = true;
123
125
  else if (!arg.startsWith("-")) flags.args.push(arg);
124
126
  else throw new Error(`Unknown option "${arg}". Run "pennyrouter help".`);
125
127
  }
@@ -133,6 +135,39 @@ async function authProvider(flags) {
133
135
  throw new Error(`Unknown auth provider "${provider}". Try "pennyrouter auth anthropic".`);
134
136
  }
135
137
 
138
+ if (flags.forget) {
139
+ const pennyKey = flags.pennyKey || await readClaudeCodePennyRouterKey();
140
+ if (!pennyKey) {
141
+ throw new Error(
142
+ "No PennyRouter key found in Claude Code settings. Pass `--penny-key pr-...`.",
143
+ );
144
+ }
145
+ const gatewayBaseUrl = flags.gatewayBaseUrl || process.env.PENNYROUTER_GATEWAY_BASE_URL || "https://api.pennyrouter.com";
146
+ if (flags.dryRun) {
147
+ console.log(`Will delete stored Anthropic token from gateway: ${gatewayBaseUrl}`);
148
+ return;
149
+ }
150
+ const ok = await forgetAnthropicToken({ gatewayBaseUrl, apiKey: pennyKey });
151
+ if (ok) {
152
+ console.log("Successfully forgot stored Anthropic token on server.");
153
+ } else {
154
+ console.log("Failed to forget stored Anthropic token on server.");
155
+ }
156
+ const manifest = await loadManifest();
157
+ let updated = false;
158
+ for (const record of (manifest.installations || [])) {
159
+ if (record.harness === "claude-code" && record.anthropic_token_stored) {
160
+ record.anthropic_token_stored = false;
161
+ record.anthropic_oauth = false;
162
+ updated = true;
163
+ }
164
+ }
165
+ if (updated) {
166
+ await saveManifest(manifest);
167
+ }
168
+ return;
169
+ }
170
+
136
171
  if (flags.dryRun) {
137
172
  console.log("Will configure Claude Code for PennyRouter + Anthropic OAuth dual auth.");
138
173
  console.log("Dry run only. No files changed.");
@@ -493,6 +528,7 @@ async function uninstall(flags) {
493
528
 
494
529
  const kept = [];
495
530
  const failures = [];
531
+ let anthropicTokenNotice = false;
496
532
  for (const record of records) {
497
533
  if (!selectedIds.includes(record.harness)) {
498
534
  kept.push(record);
@@ -507,7 +543,11 @@ async function uninstall(flags) {
507
543
  }
508
544
 
509
545
  const ok = await runHarnessJob(failures, record.harness, "uninstall", async () => {
510
- await forgetStoredAnthropicToken(record);
546
+ if (flags.forgetToken) {
547
+ await forgetStoredAnthropicToken(record);
548
+ } else if (record.anthropic_token_stored) {
549
+ anthropicTokenNotice = true;
550
+ }
511
551
  await harness.uninstall(record);
512
552
  console.log(`Removed ${record.harness}.`);
513
553
  });
@@ -522,12 +562,22 @@ async function uninstall(flags) {
522
562
  continue;
523
563
  }
524
564
  await runHarnessJob(failures, record.harness, "uninstall", async () => {
525
- await forgetStoredAnthropicToken(record);
565
+ if (flags.forgetToken) {
566
+ await forgetStoredAnthropicToken(record);
567
+ } else if (record.anthropic_token_stored) {
568
+ anthropicTokenNotice = true;
569
+ }
526
570
  await harness.uninstall(record);
527
571
  console.log(`Removed ${record.harness}.`);
528
572
  });
529
573
  }
530
574
 
575
+ if (anthropicTokenNotice) {
576
+ console.log("");
577
+ console.log("Note: Your stored Anthropic token remains on the server for other machines.");
578
+ console.log("To delete it from the server, run: pennyrouter auth anthropic --forget");
579
+ }
580
+
531
581
  manifest.installations = kept;
532
582
  await saveManifest(manifest);
533
583
  reportFailures(failures);
@@ -929,10 +979,10 @@ function printHelp() {
929
979
 
930
980
  Usage:
931
981
  pennyrouter install [--harness ${SUPPORTED_HARNESS_IDS}] [--all] [--yes] [--dry-run] [--existing-account] [--anthropic-auth|--no-anthropic-auth] [--local[=URL]]
932
- pennyrouter auth anthropic [--penny-key pr-...] [--token oauth-token] [--token-command CMD] [--gateway-base-url URL]
982
+ pennyrouter auth anthropic [--penny-key pr-...] [--token oauth-token] [--token-command CMD] [--gateway-base-url URL] [--forget]
933
983
  pennyrouter disable [--harness ${SUPPORTED_HARNESS_IDS}] [--all] [--yes]
934
984
  pennyrouter enable [--harness ${SUPPORTED_HARNESS_IDS}] [--all] [--yes]
935
- pennyrouter uninstall [--harness ${SUPPORTED_HARNESS_IDS}] [--all] [--yes]
985
+ pennyrouter uninstall [--harness ${SUPPORTED_HARNESS_IDS}] [--all] [--yes] [--forget-token]
936
986
  pennyrouter status
937
987
 
938
988
  Examples: