theclawbay 0.3.57 → 0.3.58
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/logout.js +65 -6
- package/dist/commands/setup.js +68 -22
- package/package.json +1 -1
package/dist/commands/logout.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
7
7
|
const node_os_1 = __importDefault(require("node:os"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
10
|
const core_1 = require("@oclif/core");
|
|
10
11
|
const yaml_1 = require("yaml");
|
|
11
12
|
const base_command_1 = require("../lib/base-command");
|
|
@@ -792,13 +793,71 @@ async function cleanupShellFiles() {
|
|
|
792
793
|
return updated;
|
|
793
794
|
}
|
|
794
795
|
function powerShellProfilePaths() {
|
|
795
|
-
|
|
796
|
+
const candidates = new Set();
|
|
797
|
+
const addDocumentsProfiles = (documentsDir) => {
|
|
798
|
+
if (!documentsDir)
|
|
799
|
+
return;
|
|
800
|
+
candidates.add(node_path_1.default.join(documentsDir, "PowerShell", "Microsoft.PowerShell_profile.ps1"));
|
|
801
|
+
candidates.add(node_path_1.default.join(documentsDir, "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1"));
|
|
802
|
+
};
|
|
803
|
+
if (node_os_1.default.platform() === "win32") {
|
|
804
|
+
addDocumentsProfiles(node_path_1.default.join(node_os_1.default.homedir(), "Documents"));
|
|
805
|
+
addDocumentsProfiles(resolveWindowsDocumentsDirForHost());
|
|
806
|
+
return [...candidates];
|
|
807
|
+
}
|
|
808
|
+
if (!isWslInteropRuntime())
|
|
796
809
|
return [];
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
810
|
+
addDocumentsProfiles(resolveWindowsDocumentsDirForHost());
|
|
811
|
+
addDocumentsProfiles(resolveWindowsPathForHost(node_path_1.default.join(resolveWindowsHomeDirForHost() ?? "", "Documents")));
|
|
812
|
+
return [...candidates];
|
|
813
|
+
}
|
|
814
|
+
function isWslInteropRuntime() {
|
|
815
|
+
return node_os_1.default.platform() === "linux" && Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP);
|
|
816
|
+
}
|
|
817
|
+
function readWindowsCommandStdout(command) {
|
|
818
|
+
const shell = node_os_1.default.platform() === "win32" ? "powershell.exe" : isWslInteropRuntime() ? "powershell.exe" : null;
|
|
819
|
+
if (!shell)
|
|
820
|
+
return null;
|
|
821
|
+
const result = (0, node_child_process_1.spawnSync)(shell, ["-NoProfile", "-Command", command], {
|
|
822
|
+
encoding: "utf8",
|
|
823
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
824
|
+
});
|
|
825
|
+
if (result.status !== 0)
|
|
826
|
+
return null;
|
|
827
|
+
const next = result.stdout.replace(/\r/g, "").trim();
|
|
828
|
+
return next ? next : null;
|
|
829
|
+
}
|
|
830
|
+
function resolveWindowsPathForHost(input) {
|
|
831
|
+
if (!input)
|
|
832
|
+
return null;
|
|
833
|
+
const trimmed = input.trim();
|
|
834
|
+
if (!trimmed)
|
|
835
|
+
return null;
|
|
836
|
+
if (node_os_1.default.platform() === "win32")
|
|
837
|
+
return trimmed;
|
|
838
|
+
const match = /^([A-Za-z]):\\(.*)$/.exec(trimmed);
|
|
839
|
+
if (!match)
|
|
840
|
+
return null;
|
|
841
|
+
const drive = match[1].toLowerCase();
|
|
842
|
+
const rest = match[2].replace(/\\/g, "/");
|
|
843
|
+
return node_path_1.default.posix.join("/mnt", drive, rest);
|
|
844
|
+
}
|
|
845
|
+
function resolveWindowsHomeDirForHost() {
|
|
846
|
+
const reported = readWindowsCommandStdout("$env:USERPROFILE");
|
|
847
|
+
if (reported)
|
|
848
|
+
return resolveWindowsPathForHost(reported);
|
|
849
|
+
if (node_os_1.default.platform() === "win32")
|
|
850
|
+
return node_os_1.default.homedir();
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
function resolveWindowsDocumentsDirForHost() {
|
|
854
|
+
const reported = readWindowsCommandStdout("[Environment]::GetFolderPath('MyDocuments')");
|
|
855
|
+
if (reported)
|
|
856
|
+
return resolveWindowsPathForHost(reported);
|
|
857
|
+
const home = resolveWindowsHomeDirForHost();
|
|
858
|
+
if (!home)
|
|
859
|
+
return null;
|
|
860
|
+
return node_path_1.default.join(home, "Documents");
|
|
802
861
|
}
|
|
803
862
|
async function cleanupPowerShellProfiles() {
|
|
804
863
|
const updated = [];
|
package/dist/commands/setup.js
CHANGED
|
@@ -1770,7 +1770,7 @@ async function persistApiKeyEnv(params) {
|
|
|
1770
1770
|
`export ${ENV_KEY_NAME}=${shellQuote(params.apiKey)}`,
|
|
1771
1771
|
];
|
|
1772
1772
|
if (params.claudeEnabled) {
|
|
1773
|
-
envLines.push("", "# Official Claude Code CLI", `export ${CLAUDE_ENV_API_KEY_NAME}=${shellQuote(params.apiKey)}`, `export ${CLAUDE_ENV_BASE_URL_NAME}=${shellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}
|
|
1773
|
+
envLines.push("", "# Official Claude Code CLI", `export ${CLAUDE_ENV_API_KEY_NAME}=${shellQuote(params.apiKey)}`, `export ${CLAUDE_ENV_BASE_URL_NAME}=${shellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
|
|
1774
1774
|
}
|
|
1775
1775
|
const envContents = `${envLines.join("\n")}\n`;
|
|
1776
1776
|
await promises_1.default.writeFile(ENV_FILE, envContents, "utf8");
|
|
@@ -1805,16 +1805,10 @@ async function persistApiKeyEnv(params) {
|
|
|
1805
1805
|
if (params.claudeEnabled) {
|
|
1806
1806
|
process.env[CLAUDE_ENV_API_KEY_NAME] = params.apiKey;
|
|
1807
1807
|
process.env[CLAUDE_ENV_BASE_URL_NAME] = anthropicCompatibleProxyUrl(params.backendUrl);
|
|
1808
|
-
process.env[CLAUDE_ENV_SIMPLE_MODE_NAME] = "1";
|
|
1809
|
-
process.env[CLAUDE_ENV_DISABLE_NONESSENTIAL_TRAFFIC_NAME] = "1";
|
|
1810
|
-
process.env[CLAUDE_ENV_ENABLE_TELEMETRY_NAME] = "0";
|
|
1811
1808
|
}
|
|
1812
1809
|
else {
|
|
1813
1810
|
delete process.env[CLAUDE_ENV_API_KEY_NAME];
|
|
1814
1811
|
delete process.env[CLAUDE_ENV_BASE_URL_NAME];
|
|
1815
|
-
delete process.env[CLAUDE_ENV_SIMPLE_MODE_NAME];
|
|
1816
|
-
delete process.env[CLAUDE_ENV_DISABLE_NONESSENTIAL_TRAFFIC_NAME];
|
|
1817
|
-
delete process.env[CLAUDE_ENV_ENABLE_TELEMETRY_NAME];
|
|
1818
1812
|
}
|
|
1819
1813
|
return updated;
|
|
1820
1814
|
}
|
|
@@ -1826,19 +1820,77 @@ async function persistFishEnv(params) {
|
|
|
1826
1820
|
`set -gx ${ENV_KEY_NAME} ${shellQuote(params.apiKey)}`,
|
|
1827
1821
|
];
|
|
1828
1822
|
if (params.claudeEnabled) {
|
|
1829
|
-
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))}
|
|
1823
|
+
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))}`);
|
|
1830
1824
|
}
|
|
1831
1825
|
await promises_1.default.writeFile(fishConfPath, `${lines.join("\n")}\n`, "utf8");
|
|
1832
1826
|
return [fishConfPath];
|
|
1833
1827
|
}
|
|
1834
1828
|
function powerShellProfilePaths() {
|
|
1835
|
-
|
|
1829
|
+
const candidates = new Set();
|
|
1830
|
+
const addDocumentsProfiles = (documentsDir) => {
|
|
1831
|
+
if (!documentsDir)
|
|
1832
|
+
return;
|
|
1833
|
+
candidates.add(node_path_1.default.join(documentsDir, "PowerShell", "Microsoft.PowerShell_profile.ps1"));
|
|
1834
|
+
candidates.add(node_path_1.default.join(documentsDir, "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1"));
|
|
1835
|
+
};
|
|
1836
|
+
if (node_os_1.default.platform() === "win32") {
|
|
1837
|
+
addDocumentsProfiles(node_path_1.default.join(node_os_1.default.homedir(), "Documents"));
|
|
1838
|
+
addDocumentsProfiles(resolveWindowsDocumentsDirForHost());
|
|
1839
|
+
return [...candidates];
|
|
1840
|
+
}
|
|
1841
|
+
if (!isWslInteropRuntime())
|
|
1836
1842
|
return [];
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1843
|
+
addDocumentsProfiles(resolveWindowsDocumentsDirForHost());
|
|
1844
|
+
addDocumentsProfiles(resolveWindowsPathForHost(node_path_1.default.join(resolveWindowsHomeDirForHost() ?? "", "Documents")));
|
|
1845
|
+
return [...candidates];
|
|
1846
|
+
}
|
|
1847
|
+
function isWslInteropRuntime() {
|
|
1848
|
+
return node_os_1.default.platform() === "linux" && Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP);
|
|
1849
|
+
}
|
|
1850
|
+
function readWindowsCommandStdout(command) {
|
|
1851
|
+
const shell = node_os_1.default.platform() === "win32" ? "powershell.exe" : isWslInteropRuntime() ? "powershell.exe" : null;
|
|
1852
|
+
if (!shell)
|
|
1853
|
+
return null;
|
|
1854
|
+
const result = (0, node_child_process_1.spawnSync)(shell, ["-NoProfile", "-Command", command], {
|
|
1855
|
+
encoding: "utf8",
|
|
1856
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
1857
|
+
});
|
|
1858
|
+
if (result.status !== 0)
|
|
1859
|
+
return null;
|
|
1860
|
+
const next = result.stdout.replace(/\r/g, "").trim();
|
|
1861
|
+
return next ? next : null;
|
|
1862
|
+
}
|
|
1863
|
+
function resolveWindowsPathForHost(input) {
|
|
1864
|
+
if (!input)
|
|
1865
|
+
return null;
|
|
1866
|
+
const trimmed = input.trim();
|
|
1867
|
+
if (!trimmed)
|
|
1868
|
+
return null;
|
|
1869
|
+
if (node_os_1.default.platform() === "win32")
|
|
1870
|
+
return trimmed;
|
|
1871
|
+
const match = /^([A-Za-z]):\\(.*)$/.exec(trimmed);
|
|
1872
|
+
if (!match)
|
|
1873
|
+
return null;
|
|
1874
|
+
const drive = match[1].toLowerCase();
|
|
1875
|
+
const rest = match[2].replace(/\\/g, "/");
|
|
1876
|
+
return node_path_1.default.posix.join("/mnt", drive, rest);
|
|
1877
|
+
}
|
|
1878
|
+
function resolveWindowsHomeDirForHost() {
|
|
1879
|
+
const reported = readWindowsCommandStdout("$env:USERPROFILE");
|
|
1880
|
+
if (reported)
|
|
1881
|
+
return resolveWindowsPathForHost(reported);
|
|
1882
|
+
if (node_os_1.default.platform() === "win32")
|
|
1883
|
+
return node_os_1.default.homedir();
|
|
1884
|
+
return null;
|
|
1885
|
+
}
|
|
1886
|
+
function resolveWindowsDocumentsDirForHost() {
|
|
1887
|
+
const reported = readWindowsCommandStdout("[Environment]::GetFolderPath('MyDocuments')");
|
|
1888
|
+
if (reported)
|
|
1889
|
+
return resolveWindowsPathForHost(reported);
|
|
1890
|
+
const home = resolveWindowsHomeDirForHost();
|
|
1891
|
+
if (!home)
|
|
1892
|
+
return null;
|
|
1893
|
+
return node_path_1.default.join(home, "Documents");
|
|
1842
1894
|
}
|
|
1843
1895
|
async function persistPowerShellEnv(params) {
|
|
1844
1896
|
const updated = [];
|
|
@@ -1851,7 +1903,7 @@ async function persistPowerShellEnv(params) {
|
|
|
1851
1903
|
`$env:${ENV_KEY_NAME} = ${powerShellQuote(params.apiKey)}`,
|
|
1852
1904
|
];
|
|
1853
1905
|
if (params.claudeEnabled) {
|
|
1854
|
-
lines.push(`$env:${CLAUDE_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`, `$env:${CLAUDE_ENV_BASE_URL_NAME} = ${powerShellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}
|
|
1906
|
+
lines.push(`$env:${CLAUDE_ENV_API_KEY_NAME} = ${powerShellQuote(params.apiKey)}`, `$env:${CLAUDE_ENV_BASE_URL_NAME} = ${powerShellQuote(anthropicCompatibleProxyUrl(params.backendUrl))}`);
|
|
1855
1907
|
}
|
|
1856
1908
|
lines.push(SHELL_END);
|
|
1857
1909
|
const next = appendManagedBlock(cleaned, lines);
|
|
@@ -1902,9 +1954,6 @@ function buildManagedEditorTerminalEnv(params) {
|
|
|
1902
1954
|
if (params.claudeEnabled) {
|
|
1903
1955
|
env[CLAUDE_ENV_API_KEY_NAME] = params.apiKey;
|
|
1904
1956
|
env[CLAUDE_ENV_BASE_URL_NAME] = anthropicCompatibleProxyUrl(params.backendUrl);
|
|
1905
|
-
env[CLAUDE_ENV_SIMPLE_MODE_NAME] = "1";
|
|
1906
|
-
env[CLAUDE_ENV_DISABLE_NONESSENTIAL_TRAFFIC_NAME] = "1";
|
|
1907
|
-
env[CLAUDE_ENV_ENABLE_TELEMETRY_NAME] = "0";
|
|
1908
1957
|
}
|
|
1909
1958
|
return env;
|
|
1910
1959
|
}
|
|
@@ -1912,9 +1961,6 @@ function buildManagedClaudeEditorEnv(params) {
|
|
|
1912
1961
|
return {
|
|
1913
1962
|
[CLAUDE_ENV_API_KEY_NAME]: params.apiKey,
|
|
1914
1963
|
[CLAUDE_ENV_BASE_URL_NAME]: anthropicCompatibleProxyUrl(params.backendUrl),
|
|
1915
|
-
[CLAUDE_ENV_SIMPLE_MODE_NAME]: "1",
|
|
1916
|
-
[CLAUDE_ENV_DISABLE_NONESSENTIAL_TRAFFIC_NAME]: "1",
|
|
1917
|
-
[CLAUDE_ENV_ENABLE_TELEMETRY_NAME]: "0",
|
|
1918
1964
|
};
|
|
1919
1965
|
}
|
|
1920
1966
|
async function persistEditorTerminalEnvSettings(params) {
|
|
@@ -3010,7 +3056,7 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
3010
3056
|
if (resolved?.note)
|
|
3011
3057
|
summaryNotes.add(resolved.note);
|
|
3012
3058
|
if (selectedSetupClients.has("claude") && claudeAccess?.enabled) {
|
|
3013
|
-
summaryNotes.add("Claude Code: exported ANTHROPIC_BASE_URL
|
|
3059
|
+
summaryNotes.add("Claude Code: exported ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY.");
|
|
3014
3060
|
if (claudeDesktop3pConfigPathManaged) {
|
|
3015
3061
|
summaryNotes.add("Claude Desktop: configured hidden Claude-3p gateway mode with the /anthropic base URL for The Claw Bay.");
|
|
3016
3062
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theclawbay",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.58",
|
|
4
4
|
"description": "CLI for connecting Codex, Continue, Cline, GSD, OpenClaw, OpenCode, Kilo, Roo Code, Aider, experimental Trae, and experimental Zo to The Claw Bay.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|