theclawbay 0.3.47 → 0.3.49

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) {
@@ -61,7 +61,7 @@ const SHELL_END = "# theclawbay-shell-managed:end";
61
61
  const OPENCLAW_PROVIDER_ID = DEFAULT_PROVIDER_ID;
62
62
  const HISTORY_PROVIDER_NEUTRALIZE_SOURCES = new Set(["openai", "theclawbay-wan", DEFAULT_PROVIDER_ID]);
63
63
  const HISTORY_PROVIDER_DB_MIGRATE_SOURCES = ["openai", "theclawbay-wan"];
64
- const SETUP_CLIENT_IDS = ["codex", "continue", "cline", "openclaw", "opencode", "kilo", "roo", "trae", "aider", "zo"];
64
+ const SETUP_CLIENT_IDS = ["codex", "claude", "continue", "cline", "openclaw", "opencode", "kilo", "roo", "trae", "aider", "zo"];
65
65
  const LEGACY_THECLAWBAY_OPENAI_PROXY_SUFFIX = "/api/codex-auth/v1/proxy/v1";
66
66
  const CANONICAL_THECLAWBAY_OPENAI_PROXY_SUFFIX = "/v1";
67
67
  const CANONICAL_CODEX_NATIVE_PROXY_SUFFIX = "/backend-api/codex";
@@ -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
  }
@@ -1113,6 +1116,20 @@ async function detectContinueClient() {
1113
1116
  }
1114
1117
  return (await detectExtensionHosts(["continue.continue-"])).length > 0;
1115
1118
  }
1119
+ async function detectClaudeCodeClient() {
1120
+ if (hasCommand("claude"))
1121
+ return true;
1122
+ const candidates = [
1123
+ node_path_1.default.join(node_os_1.default.homedir(), ".claude"),
1124
+ node_path_1.default.join(node_os_1.default.homedir(), ".claude.json"),
1125
+ node_path_1.default.join(node_os_1.default.homedir(), ".config", "claude"),
1126
+ ];
1127
+ for (const candidate of candidates) {
1128
+ if (await pathExists(candidate))
1129
+ return true;
1130
+ }
1131
+ return false;
1132
+ }
1116
1133
  async function detectClineClient() {
1117
1134
  if (hasCommand("cline"))
1118
1135
  return true;
@@ -1440,6 +1457,35 @@ async function persistApiKeyEnv(params) {
1440
1457
  }
1441
1458
  return updated;
1442
1459
  }
1460
+ function powerShellProfilePaths() {
1461
+ if (node_os_1.default.platform() !== "win32")
1462
+ return [];
1463
+ const home = node_os_1.default.homedir();
1464
+ return [
1465
+ node_path_1.default.join(home, "Documents", "PowerShell", "Microsoft.PowerShell_profile.ps1"),
1466
+ node_path_1.default.join(home, "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1"),
1467
+ ];
1468
+ }
1469
+ async function persistPowerShellEnv(params) {
1470
+ const updated = [];
1471
+ for (const profilePath of powerShellProfilePaths()) {
1472
+ await promises_1.default.mkdir(node_path_1.default.dirname(profilePath), { recursive: true });
1473
+ const existing = (await readFileIfExists(profilePath)) ?? "";
1474
+ const cleaned = removeManagedBlock(existing, SHELL_START, SHELL_END);
1475
+ const lines = [
1476
+ SHELL_START,
1477
+ `$env:${ENV_KEY_NAME} = ${powerShellQuote(params.apiKey)}`,
1478
+ ];
1479
+ if (params.claudeEnabled) {
1480
+ lines.push(`$env:${CLAUDE_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`, `$env:${CLAUDE_ENV_BASE_URL_NAME} = ${powerShellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
1481
+ }
1482
+ lines.push(SHELL_END);
1483
+ const next = appendManagedBlock(cleaned, lines);
1484
+ await promises_1.default.writeFile(profilePath, next, "utf8");
1485
+ updated.push(profilePath);
1486
+ }
1487
+ return updated;
1488
+ }
1443
1489
  async function persistVsCodeServerEnvSource() {
1444
1490
  const homes = [".vscode-server", ".vscode-server-insiders"];
1445
1491
  const sourceLine = `[ -f "$HOME/.config/theclawbay/env" ] && . "$HOME/.config/theclawbay/env"`;
@@ -1920,8 +1966,9 @@ class SetupCommand extends base_command_1.BaseCommand {
1920
1966
  managed?.backendUrl ??
1921
1967
  DEFAULT_BACKEND_URL;
1922
1968
  const backendUrl = normalizeUrl(backendRaw, "--backend");
1923
- const [codexDetected, continueDetected, clineDetected, kiloDetected, rooDetected, traeDetected, aiderDetected, zoDetected] = await Promise.all([
1969
+ const [codexDetected, claudeDetected, continueDetected, clineDetected, kiloDetected, rooDetected, traeDetected, aiderDetected, zoDetected] = await Promise.all([
1924
1970
  detectCodexClient(),
1971
+ detectClaudeCodeClient(),
1925
1972
  detectContinueClient(),
1926
1973
  detectClineClient(),
1927
1974
  detectKiloClient(),
@@ -1940,6 +1987,15 @@ class SetupCommand extends base_command_1.BaseCommand {
1940
1987
  icon: "◎",
1941
1988
  siteUrl: "https://openai.com/codex",
1942
1989
  },
1990
+ {
1991
+ id: "claude",
1992
+ label: "Claude Code CLI",
1993
+ summaryLabel: "Claude Code",
1994
+ detected: claudeDetected,
1995
+ recommended: true,
1996
+ icon: "✳",
1997
+ siteUrl: "https://code.claude.com",
1998
+ },
1943
1999
  {
1944
2000
  id: "continue",
1945
2001
  label: "Continue",
@@ -2056,6 +2112,7 @@ class SetupCommand extends base_command_1.BaseCommand {
2056
2112
  let resolved = null;
2057
2113
  let claudeAccess = null;
2058
2114
  let updatedShellFiles = [];
2115
+ let updatedPowerShellProfiles = [];
2059
2116
  let codexConfigPath = null;
2060
2117
  let updatedVsCodeEnvFiles = [];
2061
2118
  let sessionMigration = null;
@@ -2093,6 +2150,11 @@ class SetupCommand extends base_command_1.BaseCommand {
2093
2150
  backendUrl,
2094
2151
  claudeEnabled: claudeAccess.enabled,
2095
2152
  });
2153
+ updatedPowerShellProfiles = await persistPowerShellEnv({
2154
+ apiKey: authCredential,
2155
+ backendUrl,
2156
+ claudeEnabled: claudeAccess.enabled,
2157
+ });
2096
2158
  if (selectedSetupClients.has("codex")) {
2097
2159
  progress.update("Configuring Codex");
2098
2160
  codexConfigPath = await writeCodexConfig({
@@ -2220,6 +2282,7 @@ class SetupCommand extends base_command_1.BaseCommand {
2220
2282
  summaryNotes.add(resolved.note);
2221
2283
  if (claudeAccess?.enabled) {
2222
2284
  summaryNotes.add("Claude Code: exported ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY for the official client.");
2285
+ 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
2286
  }
2224
2287
  else if (claudeAccess?.note) {
2225
2288
  summaryNotes.add(claudeAccess.note);
@@ -2275,12 +2338,16 @@ class SetupCommand extends base_command_1.BaseCommand {
2275
2338
  this.log(resolved.note);
2276
2339
  if (claudeAccess?.enabled) {
2277
2340
  this.log(`- Claude Code base URL: ${anthropicCompatibleProxyUrl(backendUrl)}`);
2341
+ this.log(`- Claude Code selected: ${selectedSetupClients.has("claude") ? "yes" : "no"}`);
2278
2342
  }
2279
2343
  else if (claudeAccess?.note) {
2280
2344
  this.log(`- Claude Code: ${claudeAccess.note}`);
2281
2345
  }
2282
2346
  this.log(`- Local credential env: ${ENV_FILE}`);
2283
2347
  this.log(`- Shell profiles updated: ${updatedShellFiles.join(", ")}`);
2348
+ if (updatedPowerShellProfiles.length > 0) {
2349
+ this.log(`- PowerShell profiles updated: ${updatedPowerShellProfiles.join(", ")}`);
2350
+ }
2284
2351
  if (selectedSetupClients.has("codex")) {
2285
2352
  this.log(`- Codex: configured (${codexConfigPath})`);
2286
2353
  if (resolved)
@@ -2437,6 +2504,15 @@ class SetupCommand extends base_command_1.BaseCommand {
2437
2504
  else {
2438
2505
  this.log("- Zo: not detected (skipped)");
2439
2506
  }
2507
+ if (selectedSetupClients.has("claude")) {
2508
+ this.log(`- Claude Code: ${claudeAccess?.enabled ? "configured via shared env" : "selected, but no Claude access was detected for this credential"}`);
2509
+ }
2510
+ else if (claudeDetected) {
2511
+ this.log("- Claude Code: detected but skipped");
2512
+ }
2513
+ else {
2514
+ this.log("- Claude Code: not detected (skipped)");
2515
+ }
2440
2516
  if (authSeed?.action === "seeded" && authSeed.mode === "chatgpt-auth-tokens") {
2441
2517
  this.log("- Codex login state: seeded local Codex auth so remaining usage can be shown.");
2442
2518
  }
@@ -2471,7 +2547,7 @@ class SetupCommand extends base_command_1.BaseCommand {
2471
2547
  });
2472
2548
  }
2473
2549
  }
2474
- SetupCommand.description = "One-time setup: configure Codex plus any detected Continue, Cline, OpenClaw, OpenCode, Kilo, Roo Code, Trae, Aider, or Zo installs to use The Claw Bay";
2550
+ SetupCommand.description = "One-time setup: configure Codex, Claude Code, plus any detected Continue, Cline, OpenClaw, OpenCode, Kilo, Roo Code, Trae, Aider, or Zo installs to use The Claw Bay";
2475
2551
  SetupCommand.flags = {
2476
2552
  backend: core_1.Flags.string({
2477
2553
  required: false,
@@ -2489,7 +2565,7 @@ SetupCommand.flags = {
2489
2565
  }),
2490
2566
  clients: core_1.Flags.string({
2491
2567
  required: false,
2492
- description: "Detected local clients to configure: codex, continue, cline, openclaw, opencode, kilo, roo, trae, aider, zo",
2568
+ description: "Detected local clients to configure: codex, claude, continue, cline, openclaw, opencode, kilo, roo, trae, aider, zo",
2493
2569
  }),
2494
2570
  yes: core_1.Flags.boolean({
2495
2571
  required: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theclawbay",
3
- "version": "0.3.47",
3
+ "version": "0.3.49",
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": {