theclawbay 0.3.48 → 0.3.50
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/commands/setup.js +72 -6
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -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";
|
|
@@ -1116,6 +1116,20 @@ async function detectContinueClient() {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
return (await detectExtensionHosts(["continue.continue-"])).length > 0;
|
|
1118
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
|
+
}
|
|
1119
1133
|
async function detectClineClient() {
|
|
1120
1134
|
if (hasCommand("cline"))
|
|
1121
1135
|
return true;
|
|
@@ -1415,7 +1429,15 @@ async function persistApiKeyEnv(params) {
|
|
|
1415
1429
|
await promises_1.default.writeFile(ENV_FILE, envContents, "utf8");
|
|
1416
1430
|
await promises_1.default.chmod(ENV_FILE, 0o600);
|
|
1417
1431
|
const sourceLine = `[ -f "$HOME/.config/theclawbay/env" ] && . "$HOME/.config/theclawbay/env"`;
|
|
1418
|
-
const shellRcPaths = [
|
|
1432
|
+
const shellRcPaths = [
|
|
1433
|
+
".bashrc",
|
|
1434
|
+
".bash_profile",
|
|
1435
|
+
".bash_login",
|
|
1436
|
+
".zshrc",
|
|
1437
|
+
".zprofile",
|
|
1438
|
+
".zlogin",
|
|
1439
|
+
".profile",
|
|
1440
|
+
].map((name) => node_path_1.default.join(node_os_1.default.homedir(), name));
|
|
1419
1441
|
const updated = [];
|
|
1420
1442
|
for (const rcPath of shellRcPaths) {
|
|
1421
1443
|
let existing = "";
|
|
@@ -1443,6 +1465,19 @@ async function persistApiKeyEnv(params) {
|
|
|
1443
1465
|
}
|
|
1444
1466
|
return updated;
|
|
1445
1467
|
}
|
|
1468
|
+
async function persistFishEnv(params) {
|
|
1469
|
+
const fishConfPath = node_path_1.default.join(node_os_1.default.homedir(), ".config", "fish", "conf.d", "theclawbay.fish");
|
|
1470
|
+
await promises_1.default.mkdir(node_path_1.default.dirname(fishConfPath), { recursive: true });
|
|
1471
|
+
const lines = [
|
|
1472
|
+
"# Generated by theclawbay setup",
|
|
1473
|
+
`set -gx ${ENV_KEY_NAME} ${shellQuote(params.apiKey)}`,
|
|
1474
|
+
];
|
|
1475
|
+
if (params.claudeEnabled) {
|
|
1476
|
+
lines.push("", "# Official Claude Code CLI", `set -gx ${CLAUDE_ENV_API_KEY_NAME} ${shellQuote(params.apiKey)}`, `set -gx ${CLAUDE_ENV_BASE_URL_NAME} ${shellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
|
|
1477
|
+
}
|
|
1478
|
+
await promises_1.default.writeFile(fishConfPath, `${lines.join("\n")}\n`, "utf8");
|
|
1479
|
+
return [fishConfPath];
|
|
1480
|
+
}
|
|
1446
1481
|
function powerShellProfilePaths() {
|
|
1447
1482
|
if (node_os_1.default.platform() !== "win32")
|
|
1448
1483
|
return [];
|
|
@@ -1952,8 +1987,9 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
1952
1987
|
managed?.backendUrl ??
|
|
1953
1988
|
DEFAULT_BACKEND_URL;
|
|
1954
1989
|
const backendUrl = normalizeUrl(backendRaw, "--backend");
|
|
1955
|
-
const [codexDetected, continueDetected, clineDetected, kiloDetected, rooDetected, traeDetected, aiderDetected, zoDetected] = await Promise.all([
|
|
1990
|
+
const [codexDetected, claudeDetected, continueDetected, clineDetected, kiloDetected, rooDetected, traeDetected, aiderDetected, zoDetected] = await Promise.all([
|
|
1956
1991
|
detectCodexClient(),
|
|
1992
|
+
detectClaudeCodeClient(),
|
|
1957
1993
|
detectContinueClient(),
|
|
1958
1994
|
detectClineClient(),
|
|
1959
1995
|
detectKiloClient(),
|
|
@@ -1972,6 +2008,15 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
1972
2008
|
icon: "◎",
|
|
1973
2009
|
siteUrl: "https://openai.com/codex",
|
|
1974
2010
|
},
|
|
2011
|
+
{
|
|
2012
|
+
id: "claude",
|
|
2013
|
+
label: "Claude Code CLI",
|
|
2014
|
+
summaryLabel: "Claude Code",
|
|
2015
|
+
detected: claudeDetected,
|
|
2016
|
+
recommended: true,
|
|
2017
|
+
icon: "✳",
|
|
2018
|
+
siteUrl: "https://code.claude.com",
|
|
2019
|
+
},
|
|
1975
2020
|
{
|
|
1976
2021
|
id: "continue",
|
|
1977
2022
|
label: "Continue",
|
|
@@ -2088,6 +2133,7 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2088
2133
|
let resolved = null;
|
|
2089
2134
|
let claudeAccess = null;
|
|
2090
2135
|
let updatedShellFiles = [];
|
|
2136
|
+
let updatedFishFiles = [];
|
|
2091
2137
|
let updatedPowerShellProfiles = [];
|
|
2092
2138
|
let codexConfigPath = null;
|
|
2093
2139
|
let updatedVsCodeEnvFiles = [];
|
|
@@ -2126,11 +2172,19 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2126
2172
|
backendUrl,
|
|
2127
2173
|
claudeEnabled: claudeAccess.enabled,
|
|
2128
2174
|
});
|
|
2175
|
+
updatedFishFiles = await persistFishEnv({
|
|
2176
|
+
apiKey: authCredential,
|
|
2177
|
+
backendUrl,
|
|
2178
|
+
claudeEnabled: claudeAccess.enabled,
|
|
2179
|
+
});
|
|
2129
2180
|
updatedPowerShellProfiles = await persistPowerShellEnv({
|
|
2130
2181
|
apiKey: authCredential,
|
|
2131
2182
|
backendUrl,
|
|
2132
2183
|
claudeEnabled: claudeAccess.enabled,
|
|
2133
2184
|
});
|
|
2185
|
+
if (selectedSetupClients.has("codex") || selectedSetupClients.has("claude")) {
|
|
2186
|
+
updatedVsCodeEnvFiles = await persistVsCodeServerEnvSource();
|
|
2187
|
+
}
|
|
2134
2188
|
if (selectedSetupClients.has("codex")) {
|
|
2135
2189
|
progress.update("Configuring Codex");
|
|
2136
2190
|
codexConfigPath = await writeCodexConfig({
|
|
@@ -2138,7 +2192,6 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2138
2192
|
model: resolved?.model ?? DEFAULT_CODEX_MODEL,
|
|
2139
2193
|
apiKey: authCredential,
|
|
2140
2194
|
});
|
|
2141
|
-
updatedVsCodeEnvFiles = await persistVsCodeServerEnvSource();
|
|
2142
2195
|
if (migrateCodexConversations) {
|
|
2143
2196
|
sessionMigration = await (0, codex_history_migration_1.migrateSessionProviders)({
|
|
2144
2197
|
codexHome: paths_1.codexDir,
|
|
@@ -2314,12 +2367,16 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2314
2367
|
this.log(resolved.note);
|
|
2315
2368
|
if (claudeAccess?.enabled) {
|
|
2316
2369
|
this.log(`- Claude Code base URL: ${anthropicCompatibleProxyUrl(backendUrl)}`);
|
|
2370
|
+
this.log(`- Claude Code selected: ${selectedSetupClients.has("claude") ? "yes" : "no"}`);
|
|
2317
2371
|
}
|
|
2318
2372
|
else if (claudeAccess?.note) {
|
|
2319
2373
|
this.log(`- Claude Code: ${claudeAccess.note}`);
|
|
2320
2374
|
}
|
|
2321
2375
|
this.log(`- Local credential env: ${ENV_FILE}`);
|
|
2322
2376
|
this.log(`- Shell profiles updated: ${updatedShellFiles.join(", ")}`);
|
|
2377
|
+
if (updatedFishFiles.length > 0) {
|
|
2378
|
+
this.log(`- Fish profiles updated: ${updatedFishFiles.join(", ")}`);
|
|
2379
|
+
}
|
|
2323
2380
|
if (updatedPowerShellProfiles.length > 0) {
|
|
2324
2381
|
this.log(`- PowerShell profiles updated: ${updatedPowerShellProfiles.join(", ")}`);
|
|
2325
2382
|
}
|
|
@@ -2479,6 +2536,15 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2479
2536
|
else {
|
|
2480
2537
|
this.log("- Zo: not detected (skipped)");
|
|
2481
2538
|
}
|
|
2539
|
+
if (selectedSetupClients.has("claude")) {
|
|
2540
|
+
this.log(`- Claude Code: ${claudeAccess?.enabled ? "configured via shared env" : "selected, but no Claude access was detected for this credential"}`);
|
|
2541
|
+
}
|
|
2542
|
+
else if (claudeDetected) {
|
|
2543
|
+
this.log("- Claude Code: detected but skipped");
|
|
2544
|
+
}
|
|
2545
|
+
else {
|
|
2546
|
+
this.log("- Claude Code: not detected (skipped)");
|
|
2547
|
+
}
|
|
2482
2548
|
if (authSeed?.action === "seeded" && authSeed.mode === "chatgpt-auth-tokens") {
|
|
2483
2549
|
this.log("- Codex login state: seeded local Codex auth so remaining usage can be shown.");
|
|
2484
2550
|
}
|
|
@@ -2513,7 +2579,7 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
2513
2579
|
});
|
|
2514
2580
|
}
|
|
2515
2581
|
}
|
|
2516
|
-
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";
|
|
2582
|
+
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";
|
|
2517
2583
|
SetupCommand.flags = {
|
|
2518
2584
|
backend: core_1.Flags.string({
|
|
2519
2585
|
required: false,
|
|
@@ -2531,7 +2597,7 @@ SetupCommand.flags = {
|
|
|
2531
2597
|
}),
|
|
2532
2598
|
clients: core_1.Flags.string({
|
|
2533
2599
|
required: false,
|
|
2534
|
-
description: "Detected local clients to configure: codex, continue, cline, openclaw, opencode, kilo, roo, trae, aider, zo",
|
|
2600
|
+
description: "Detected local clients to configure: codex, claude, continue, cline, openclaw, opencode, kilo, roo, trae, aider, zo",
|
|
2535
2601
|
}),
|
|
2536
2602
|
yes: core_1.Flags.boolean({
|
|
2537
2603
|
required: false,
|
package/package.json
CHANGED