theclawbay 0.3.47 → 0.3.48

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.
@@ -473,6 +473,27 @@ async function cleanupShellFiles() {
473
473
  }
474
474
  return updated;
475
475
  }
476
+ function powerShellProfilePaths() {
477
+ if (node_os_1.default.platform() !== "win32")
478
+ return [];
479
+ const home = node_os_1.default.homedir();
480
+ return [
481
+ node_path_1.default.join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1"),
482
+ node_path_1.default.join(home, "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1"),
483
+ ];
484
+ }
485
+ async function cleanupPowerShellProfiles() {
486
+ const updated = [];
487
+ for (const profilePath of powerShellProfilePaths()) {
488
+ const existing = await readFileIfExists(profilePath);
489
+ if (existing === null)
490
+ continue;
491
+ const next = removeManagedBlock(existing, SHELL_START, SHELL_END);
492
+ if (await writeIfChanged(profilePath, next, existing))
493
+ updated.push(profilePath);
494
+ }
495
+ return updated;
496
+ }
476
497
  async function cleanupVsCodeHooks() {
477
498
  const updated = [];
478
499
  const homes = [".vscode-server", ".vscode-server-insiders"];
@@ -747,6 +768,7 @@ class LogoutCommand extends base_command_1.BaseCommand {
747
768
  let deletedManagedPaths = 0;
748
769
  let removedEnvFile = false;
749
770
  let updatedShellFiles = [];
771
+ let updatedPowerShellProfiles = [];
750
772
  let updatedVsCodeHooks = [];
751
773
  let updatedCodexConfig = false;
752
774
  let updatedContinueConfig = false;
@@ -794,6 +816,7 @@ class LogoutCommand extends base_command_1.BaseCommand {
794
816
  ])).filter(Boolean).length;
795
817
  removedEnvFile = await removeFileIfExists(ENV_FILE);
796
818
  updatedShellFiles = await cleanupShellFiles();
819
+ updatedPowerShellProfiles = await cleanupPowerShellProfiles();
797
820
  updatedVsCodeHooks = await cleanupVsCodeHooks();
798
821
  progress.update("Reverting Codex");
799
822
  updatedCodexConfig = await cleanupCodexConfig();
@@ -835,6 +858,8 @@ class LogoutCommand extends base_command_1.BaseCommand {
835
858
  throw error;
836
859
  }
837
860
  delete process.env[ENV_KEY_NAME];
861
+ delete process.env.ANTHROPIC_API_KEY;
862
+ delete process.env.ANTHROPIC_BASE_URL;
838
863
  if (!debugOutput && process.stdout.isTTY) {
839
864
  progress.succeed("Logout complete");
840
865
  }
@@ -885,7 +910,11 @@ class LogoutCommand extends base_command_1.BaseCommand {
885
910
  logLogoutCompactSummary({
886
911
  log: (message) => this.log(message),
887
912
  revertedTargets,
888
- sharedConfigChanged: deletedManagedPaths > 0 || removedEnvFile || updatedShellFiles.length > 0 || updatedVsCodeHooks.length > 0,
913
+ sharedConfigChanged: deletedManagedPaths > 0 ||
914
+ removedEnvFile ||
915
+ updatedShellFiles.length > 0 ||
916
+ updatedPowerShellProfiles.length > 0 ||
917
+ updatedVsCodeHooks.length > 0,
889
918
  notes: Array.from(summaryNotes),
890
919
  });
891
920
  return;
@@ -899,6 +928,7 @@ class LogoutCommand extends base_command_1.BaseCommand {
899
928
  this.log("- Remote device revoke: completed.");
900
929
  }
901
930
  this.log(`- Shell profiles updated: ${updatedShellFiles.length ? updatedShellFiles.join(", ") : "none"}`);
931
+ this.log(`- PowerShell profiles updated: ${updatedPowerShellProfiles.length ? updatedPowerShellProfiles.join(", ") : "none"}`);
902
932
  this.log(`- VS Code env hooks updated: ${updatedVsCodeHooks.length ? updatedVsCodeHooks.join(", ") : "none"}`);
903
933
  this.log(`- Codex config cleaned: ${updatedCodexConfig ? "yes" : "no"}`);
904
934
  if (sessionMigration.rewritten > 0) {
@@ -452,6 +452,9 @@ function upsertFirstKeyLine(source, key, tomlValue) {
452
452
  function shellQuote(value) {
453
453
  return `'${value.replace(/'/g, `'\\''`)}'`;
454
454
  }
455
+ function powerShellQuote(value) {
456
+ return `'${value.replace(/'/g, "''")}'`;
457
+ }
455
458
  function modelDisplayName(modelId) {
456
459
  return MODEL_DISPLAY_NAMES[modelId] ?? modelId;
457
460
  }
@@ -1440,6 +1443,35 @@ async function persistApiKeyEnv(params) {
1440
1443
  }
1441
1444
  return updated;
1442
1445
  }
1446
+ function powerShellProfilePaths() {
1447
+ if (node_os_1.default.platform() !== "win32")
1448
+ return [];
1449
+ const home = node_os_1.default.homedir();
1450
+ return [
1451
+ node_path_1.default.join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1"),
1452
+ node_path_1.default.join(home, "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1"),
1453
+ ];
1454
+ }
1455
+ async function persistPowerShellEnv(params) {
1456
+ const updated = [];
1457
+ for (const profilePath of powerShellProfilePaths()) {
1458
+ await promises_1.default.mkdir(node_path_1.default.dirname(profilePath), { recursive: true });
1459
+ const existing = (await readFileIfExists(profilePath)) ?? "";
1460
+ const cleaned = removeManagedBlock(existing, SHELL_START, SHELL_END);
1461
+ const lines = [
1462
+ SHELL_START,
1463
+ `$env:${ENV_KEY_NAME} = ${powerShellQuote(params.apiKey)}`,
1464
+ ];
1465
+ if (params.claudeEnabled) {
1466
+ lines.push(`$env:${CLAUDE_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`, `$env:${CLAUDE_ENV_BASE_URL_NAME} = ${powerShellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
1467
+ }
1468
+ lines.push(SHELL_END);
1469
+ const next = appendManagedBlock(cleaned, lines);
1470
+ await promises_1.default.writeFile(profilePath, next, "utf8");
1471
+ updated.push(profilePath);
1472
+ }
1473
+ return updated;
1474
+ }
1443
1475
  async function persistVsCodeServerEnvSource() {
1444
1476
  const homes = [".vscode-server", ".vscode-server-insiders"];
1445
1477
  const sourceLine = `[ -f "$HOME/.config/theclawbay/env" ] && . "$HOME/.config/theclawbay/env"`;
@@ -2056,6 +2088,7 @@ class SetupCommand extends base_command_1.BaseCommand {
2056
2088
  let resolved = null;
2057
2089
  let claudeAccess = null;
2058
2090
  let updatedShellFiles = [];
2091
+ let updatedPowerShellProfiles = [];
2059
2092
  let codexConfigPath = null;
2060
2093
  let updatedVsCodeEnvFiles = [];
2061
2094
  let sessionMigration = null;
@@ -2093,6 +2126,11 @@ class SetupCommand extends base_command_1.BaseCommand {
2093
2126
  backendUrl,
2094
2127
  claudeEnabled: claudeAccess.enabled,
2095
2128
  });
2129
+ updatedPowerShellProfiles = await persistPowerShellEnv({
2130
+ apiKey: authCredential,
2131
+ backendUrl,
2132
+ claudeEnabled: claudeAccess.enabled,
2133
+ });
2096
2134
  if (selectedSetupClients.has("codex")) {
2097
2135
  progress.update("Configuring Codex");
2098
2136
  codexConfigPath = await writeCodexConfig({
@@ -2220,6 +2258,7 @@ class SetupCommand extends base_command_1.BaseCommand {
2220
2258
  summaryNotes.add(resolved.note);
2221
2259
  if (claudeAccess?.enabled) {
2222
2260
  summaryNotes.add("Claude Code: exported ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY for the official client.");
2261
+ summaryNotes.add("Claude Code may still show your claude.ai login in `claude auth status`. Restart Claude Code and approve `Use custom API key` if prompted, or enable it in `/config`.");
2223
2262
  }
2224
2263
  else if (claudeAccess?.note) {
2225
2264
  summaryNotes.add(claudeAccess.note);
@@ -2281,6 +2320,9 @@ class SetupCommand extends base_command_1.BaseCommand {
2281
2320
  }
2282
2321
  this.log(`- Local credential env: ${ENV_FILE}`);
2283
2322
  this.log(`- Shell profiles updated: ${updatedShellFiles.join(", ")}`);
2323
+ if (updatedPowerShellProfiles.length > 0) {
2324
+ this.log(`- PowerShell profiles updated: ${updatedPowerShellProfiles.join(", ")}`);
2325
+ }
2284
2326
  if (selectedSetupClients.has("codex")) {
2285
2327
  this.log(`- Codex: configured (${codexConfigPath})`);
2286
2328
  if (resolved)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theclawbay",
3
- "version": "0.3.47",
3
+ "version": "0.3.48",
4
4
  "description": "CLI for connecting Codex, Continue, Cline, OpenClaw, OpenCode, Kilo, Roo Code, Aider, experimental Trae, and experimental Zo to The Claw Bay.",
5
5
  "license": "MIT",
6
6
  "bin": {