flockbay 0.10.54 → 0.10.56
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/{index-CxyC4PJB.cjs → index-BvAn9mzP.cjs} +99 -26
- package/dist/{index-aFSp_NUn.mjs → index-DuZhXr8l.mjs} +98 -25
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{migratePlugin-DVa0g5iF.mjs → migratePlugin-BWa_MICW.mjs} +1 -1
- package/dist/{migratePlugin-CGB4hkAj.cjs → migratePlugin-Dhw_USQr.cjs} +1 -1
- package/dist/{runCodex-DXwprKfq.cjs → runCodex-CEoR7aAy.cjs} +2 -2
- package/dist/{runCodex-4at1Is_k.mjs → runCodex-CW8p6MqM.mjs} +2 -2
- package/dist/{runGemini-BkhvFx7H.cjs → runGemini-Bp4xUrIJ.cjs} +2 -2
- package/dist/{runGemini-Dh9mhKIn.mjs → runGemini-CutURnfo.mjs} +2 -2
- package/dist/{types-BnxGx3wT.mjs → types-D2z7I_Ei.mjs} +1 -1
- package/dist/{types-DubGc3bU.cjs → types-mdNlgF2l.cjs} +2 -2
- package/package.json +1 -1
- package/scripts/claude_version_utils.cjs +32 -12
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
4
|
var os = require('node:os');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var types = require('./types-
|
|
6
|
+
var types = require('./types-mdNlgF2l.cjs');
|
|
7
7
|
var node_child_process = require('node:child_process');
|
|
8
8
|
var path = require('node:path');
|
|
9
9
|
var node_readline = require('node:readline');
|
|
@@ -527,7 +527,8 @@ async function claudeLocal(opts) {
|
|
|
527
527
|
stdio: ["inherit", "inherit", "inherit", "pipe"],
|
|
528
528
|
signal: opts.abort,
|
|
529
529
|
cwd: opts.path,
|
|
530
|
-
env
|
|
530
|
+
env,
|
|
531
|
+
windowsHide: process$1.platform === "win32"
|
|
531
532
|
});
|
|
532
533
|
if (child.stdio[3]) {
|
|
533
534
|
const rl = node_readline.createInterface({
|
|
@@ -1323,21 +1324,28 @@ function buildDaemonSafeEnv(baseEnv, binPath) {
|
|
|
1323
1324
|
env[pathKey] = [...prepend, ...existingParts].join(pathSep);
|
|
1324
1325
|
return env;
|
|
1325
1326
|
}
|
|
1326
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
1327
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BvAn9mzP.cjs', document.baseURI).href)));
|
|
1327
1328
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
1328
1329
|
function getGlobalClaudeVersion(claudeExecutable) {
|
|
1329
1330
|
try {
|
|
1330
1331
|
const cleanEnv = buildDaemonSafeEnv(getCleanEnv(), claudeExecutable);
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1332
|
+
const isPathLike = (claudeExecutable.includes("/") || claudeExecutable.includes("\\")) && !claudeExecutable.startsWith("\\\\");
|
|
1333
|
+
const output = isPathLike ? node_child_process.execFileSync(
|
|
1334
|
+
/\.(?:c|m)?js$/i.test(claudeExecutable) ? process$1.execPath : claudeExecutable,
|
|
1335
|
+
/\.(?:c|m)?js$/i.test(claudeExecutable) ? [claudeExecutable, "--version"] : ["--version"],
|
|
1336
|
+
{
|
|
1337
|
+
encoding: "utf8",
|
|
1338
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1339
|
+
cwd: os.homedir(),
|
|
1340
|
+
env: cleanEnv,
|
|
1341
|
+
windowsHide: process$1.platform === "win32"
|
|
1342
|
+
}
|
|
1343
|
+
).trim() : node_child_process.execSync("claude --version", {
|
|
1337
1344
|
encoding: "utf8",
|
|
1338
1345
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1339
1346
|
cwd: os.homedir(),
|
|
1340
|
-
env: cleanEnv
|
|
1347
|
+
env: cleanEnv,
|
|
1348
|
+
windowsHide: process$1.platform === "win32"
|
|
1341
1349
|
}).trim();
|
|
1342
1350
|
const match = output.match(/(\d+\.\d+\.\d+)/);
|
|
1343
1351
|
types.logger.debug(`[Claude SDK] Global claude --version output: ${output}`);
|
|
@@ -1394,6 +1402,7 @@ function getCleanEnv() {
|
|
|
1394
1402
|
}
|
|
1395
1403
|
function resolveClaudeBin() {
|
|
1396
1404
|
const existsExecutable = (p) => {
|
|
1405
|
+
if (process$1.platform === "win32") return fs.existsSync(p);
|
|
1397
1406
|
try {
|
|
1398
1407
|
fs.accessSync(p, fs.constants.X_OK);
|
|
1399
1408
|
return true;
|
|
@@ -1401,6 +1410,31 @@ function resolveClaudeBin() {
|
|
|
1401
1410
|
return false;
|
|
1402
1411
|
}
|
|
1403
1412
|
};
|
|
1413
|
+
if (process$1.platform === "win32") {
|
|
1414
|
+
const windowsCandidates = [
|
|
1415
|
+
path.join(os.homedir(), "AppData", "Roaming", "npm", "node_modules", "@anthropic-ai", "claude-code", "cli.js"),
|
|
1416
|
+
path.join(String(process$1.env.APPDATA || ""), "npm", "node_modules", "@anthropic-ai", "claude-code", "cli.js")
|
|
1417
|
+
].filter(Boolean);
|
|
1418
|
+
for (const candidate of windowsCandidates) {
|
|
1419
|
+
if (candidate && fs.existsSync(candidate)) return candidate;
|
|
1420
|
+
}
|
|
1421
|
+
try {
|
|
1422
|
+
const result = node_child_process.execFileSync("where.exe", ["claude.cmd"], {
|
|
1423
|
+
encoding: "utf8",
|
|
1424
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1425
|
+
cwd: os.homedir(),
|
|
1426
|
+
env: buildDaemonSafeEnv(getCleanEnv()),
|
|
1427
|
+
windowsHide: true
|
|
1428
|
+
}).trim();
|
|
1429
|
+
const first = result.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
1430
|
+
if (first) {
|
|
1431
|
+
const npmDir = path.dirname(first);
|
|
1432
|
+
const cliJs = path.join(npmDir, "node_modules", "@anthropic-ai", "claude-code", "cli.js");
|
|
1433
|
+
if (fs.existsSync(cliJs)) return cliJs;
|
|
1434
|
+
}
|
|
1435
|
+
} catch {
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1404
1438
|
const candidates = [
|
|
1405
1439
|
path.join(os.homedir(), ".local", "bin", "claude"),
|
|
1406
1440
|
"/opt/homebrew/bin/claude",
|
|
@@ -1455,7 +1489,8 @@ function findGlobalClaudePath() {
|
|
|
1455
1489
|
encoding: "utf8",
|
|
1456
1490
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1457
1491
|
cwd: homeDir,
|
|
1458
|
-
env: cleanEnv
|
|
1492
|
+
env: cleanEnv,
|
|
1493
|
+
windowsHide: process$1.platform === "win32"
|
|
1459
1494
|
});
|
|
1460
1495
|
types.logger.debug("[Claude SDK] Global claude command available (checked with clean PATH)");
|
|
1461
1496
|
return "claude";
|
|
@@ -1526,8 +1561,11 @@ async function streamToStdin(stream, stdin, abort) {
|
|
|
1526
1561
|
stdin.end();
|
|
1527
1562
|
}
|
|
1528
1563
|
|
|
1564
|
+
function stripAnsi(text) {
|
|
1565
|
+
return String(text || "").replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "");
|
|
1566
|
+
}
|
|
1529
1567
|
function trimProcessDiagnostic(text) {
|
|
1530
|
-
const lines =
|
|
1568
|
+
const lines = stripAnsi(text).split(/\r?\n/).map((line) => line.trim()).filter(Boolean).filter((line) => !/^Using Claude Code v[\d.]+ from /i.test(line));
|
|
1531
1569
|
if (lines.length === 0) return "";
|
|
1532
1570
|
return lines.slice(-8).join("\n");
|
|
1533
1571
|
}
|
|
@@ -1818,6 +1856,7 @@ function query(config) {
|
|
|
1818
1856
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1819
1857
|
signal: config.options?.abort,
|
|
1820
1858
|
env: spawnEnv,
|
|
1859
|
+
windowsHide: process$1.platform === "win32",
|
|
1821
1860
|
// Only use a shell on Windows when spawning a bare command (e.g. "claude").
|
|
1822
1861
|
// Passing large `--allowedTools` lists through cmd.exe can hit the ~8k command line limit.
|
|
1823
1862
|
shell: isCommandOnly && process$1.platform === "win32"
|
|
@@ -7818,7 +7857,12 @@ async function writeFastPreviewState(statePath, state) {
|
|
|
7818
7857
|
}
|
|
7819
7858
|
async function runUnrealAndCapture(args) {
|
|
7820
7859
|
return await new Promise((resolve, reject) => {
|
|
7821
|
-
const child = node_child_process.spawn(args.cmd, args.unrealArgs, {
|
|
7860
|
+
const child = node_child_process.spawn(args.cmd, args.unrealArgs, {
|
|
7861
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7862
|
+
cwd: args.cwd,
|
|
7863
|
+
env: args.env,
|
|
7864
|
+
windowsHide: process.platform === "win32"
|
|
7865
|
+
});
|
|
7822
7866
|
const timeout = setTimeout(() => {
|
|
7823
7867
|
child.kill("SIGKILL");
|
|
7824
7868
|
reject(new Error(`Timed out after ${args.timeoutMs}ms`));
|
|
@@ -7845,7 +7889,12 @@ async function runUnrealAndCapture(args) {
|
|
|
7845
7889
|
}
|
|
7846
7890
|
async function runCmdAndCapture(args) {
|
|
7847
7891
|
return await new Promise((resolvePromise, rejectPromise) => {
|
|
7848
|
-
const child = node_child_process.spawn(args.cmd, args.cmdArgs, {
|
|
7892
|
+
const child = node_child_process.spawn(args.cmd, args.cmdArgs, {
|
|
7893
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7894
|
+
cwd: args.cwd,
|
|
7895
|
+
env: args.env,
|
|
7896
|
+
windowsHide: process.platform === "win32"
|
|
7897
|
+
});
|
|
7849
7898
|
const timeout = setTimeout(() => {
|
|
7850
7899
|
child.kill("SIGKILL");
|
|
7851
7900
|
rejectPromise(new Error(`Timed out after ${args.timeoutMs}ms`));
|
|
@@ -8256,7 +8305,11 @@ async function startFlockbayServer(client, options) {
|
|
|
8256
8305
|
};
|
|
8257
8306
|
const runCommandCapture = async (cmd, args) => {
|
|
8258
8307
|
return new Promise((resolve) => {
|
|
8259
|
-
const child = node_child_process.spawn(cmd, args, {
|
|
8308
|
+
const child = node_child_process.spawn(cmd, args, {
|
|
8309
|
+
shell: false,
|
|
8310
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
8311
|
+
windowsHide: process.platform === "win32"
|
|
8312
|
+
});
|
|
8260
8313
|
let stdout = "";
|
|
8261
8314
|
let stderr = "";
|
|
8262
8315
|
child.stdout?.on("data", (c) => stdout += c.toString("utf8"));
|
|
@@ -8319,7 +8372,11 @@ ${res.stderr}`;
|
|
|
8319
8372
|
const exe = getUnrealEditorExe(engineRoot);
|
|
8320
8373
|
if (!exe) throw new Error(`Unsupported platform for Unreal Editor launch: ${process.platform}`);
|
|
8321
8374
|
if (!fs.existsSync(exe)) throw new Error(`Unreal Editor binary not found: ${exe}`);
|
|
8322
|
-
const child = node_child_process.spawn(exe, [uprojectPath, ...extraArgs], {
|
|
8375
|
+
const child = node_child_process.spawn(exe, [uprojectPath, ...extraArgs], {
|
|
8376
|
+
detached: true,
|
|
8377
|
+
stdio: "ignore",
|
|
8378
|
+
windowsHide: process.platform === "win32"
|
|
8379
|
+
});
|
|
8323
8380
|
child.unref();
|
|
8324
8381
|
const pid = typeof child.pid === "number" ? child.pid : 0;
|
|
8325
8382
|
state.launched = {
|
|
@@ -10280,7 +10337,11 @@ ${chunk}` }],
|
|
|
10280
10337
|
async function isUnrealEditorProcessRunningBestEffortGlobal() {
|
|
10281
10338
|
const runCommandCapture = async (cmd, args) => {
|
|
10282
10339
|
return new Promise((resolve) => {
|
|
10283
|
-
const child = node_child_process.spawn(cmd, args, {
|
|
10340
|
+
const child = node_child_process.spawn(cmd, args, {
|
|
10341
|
+
shell: false,
|
|
10342
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
10343
|
+
windowsHide: process.platform === "win32"
|
|
10344
|
+
});
|
|
10284
10345
|
let stdout = "";
|
|
10285
10346
|
let stderr = "";
|
|
10286
10347
|
child.stdout?.on("data", (c) => stdout += c.toString("utf8"));
|
|
@@ -12907,14 +12968,22 @@ Fix: ${res.hint}` : "";
|
|
|
12907
12968
|
isError: false
|
|
12908
12969
|
};
|
|
12909
12970
|
}));
|
|
12910
|
-
const
|
|
12911
|
-
// NOTE: Returning session id here will result in claude
|
|
12912
|
-
// sdk spawn to fail with `Invalid Request: Server already initialized`
|
|
12913
|
-
sessionIdGenerator: void 0
|
|
12914
|
-
});
|
|
12915
|
-
await mcp.connect(transport);
|
|
12971
|
+
const activeHttpTransports = /* @__PURE__ */ new Set();
|
|
12916
12972
|
const server = node_http.createServer(async (req, res) => {
|
|
12973
|
+
const transport = new streamableHttp_js.StreamableHTTPServerTransport({
|
|
12974
|
+
// Keep the local MCP endpoint stateless. The SDK recommends creating a
|
|
12975
|
+
// fresh transport per request for streamable HTTP when session management
|
|
12976
|
+
// is disabled; this avoids shared request/stream state across tool calls.
|
|
12977
|
+
sessionIdGenerator: void 0,
|
|
12978
|
+
enableJsonResponse: true
|
|
12979
|
+
});
|
|
12980
|
+
activeHttpTransports.add(transport);
|
|
12981
|
+
res.on("close", () => {
|
|
12982
|
+
activeHttpTransports.delete(transport);
|
|
12983
|
+
void transport.close().catch(() => void 0);
|
|
12984
|
+
});
|
|
12917
12985
|
try {
|
|
12986
|
+
await mcp.connect(transport);
|
|
12918
12987
|
await transport.handleRequest(req, res);
|
|
12919
12988
|
} catch (error) {
|
|
12920
12989
|
types.logger.debug("Error handling request:", error);
|
|
@@ -13005,6 +13074,10 @@ Fix: ${res.hint}` : "";
|
|
|
13005
13074
|
stop: () => {
|
|
13006
13075
|
types.logger.debug("[flockbayMCP] Stopping server");
|
|
13007
13076
|
unrealEditorSupervisor.stop();
|
|
13077
|
+
for (const transport of activeHttpTransports) {
|
|
13078
|
+
void transport.close().catch(() => void 0);
|
|
13079
|
+
}
|
|
13080
|
+
activeHttpTransports.clear();
|
|
13008
13081
|
mcp.close();
|
|
13009
13082
|
server.close();
|
|
13010
13083
|
}
|
|
@@ -15269,7 +15342,7 @@ async function authAndSetupMachineIfNeeded() {
|
|
|
15269
15342
|
process.exit(1);
|
|
15270
15343
|
}
|
|
15271
15344
|
try {
|
|
15272
|
-
const { migrateUnrealMcpToFlockbayMcp } = await Promise.resolve().then(function () { return require('./migratePlugin-
|
|
15345
|
+
const { migrateUnrealMcpToFlockbayMcp } = await Promise.resolve().then(function () { return require('./migratePlugin-Dhw_USQr.cjs'); });
|
|
15273
15346
|
const result = migrateUnrealMcpToFlockbayMcp({
|
|
15274
15347
|
engineRoot,
|
|
15275
15348
|
projectUprojectPath: project || void 0,
|
|
@@ -15425,7 +15498,7 @@ ${engineRoot}`;
|
|
|
15425
15498
|
} else if (subcommand === "codex") {
|
|
15426
15499
|
try {
|
|
15427
15500
|
await chdirToNearestUprojectRootIfPresent();
|
|
15428
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
15501
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CEoR7aAy.cjs'); });
|
|
15429
15502
|
let startedBy = void 0;
|
|
15430
15503
|
let sessionId = void 0;
|
|
15431
15504
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -15527,7 +15600,7 @@ ${engineRoot}`;
|
|
|
15527
15600
|
}
|
|
15528
15601
|
try {
|
|
15529
15602
|
await chdirToNearestUprojectRootIfPresent();
|
|
15530
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
15603
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-Bp4xUrIJ.cjs'); });
|
|
15531
15604
|
let startedBy = void 0;
|
|
15532
15605
|
let sessionId = void 0;
|
|
15533
15606
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -2,7 +2,7 @@ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(im
|
|
|
2
2
|
import * as os from 'node:os';
|
|
3
3
|
import os__default, { homedir } from 'node:os';
|
|
4
4
|
import { randomUUID, createCipheriv, randomBytes, createHash as createHash$1 } from 'node:crypto';
|
|
5
|
-
import { l as logger, e as projectPath, f as backoff, g as delay, R as RawJSONLinesSchema, c as configuration, h as readDaemonState, j as clearDaemonState, p as packageJson, r as readSettings, k as readCredentials, u as updateSettings, o as openBrowser, w as writeCredentials, m as unrealMcpPythonDir, n as acquireDaemonLock, s as writeDaemonState, t as ApiMachineClient, v as releaseDaemonLock, x as sendUnrealMcpTcpCommand, A as ApiClient, y as validatePath, z as run, B as run$1, C as buildShellInvocation, D as clearCredentials, E as clearMachineId, F as authenticateCodex, G as syncCodexCliAuth, H as authenticateClaude, I as authenticateGemini, d as installUnrealMcpPluginToEngine, J as buildAndInstallUnrealMcpPlugin, i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, K as getLatestDaemonLog, L as normalizeServerUrlForNode } from './types-
|
|
5
|
+
import { l as logger, e as projectPath, f as backoff, g as delay, R as RawJSONLinesSchema, c as configuration, h as readDaemonState, j as clearDaemonState, p as packageJson, r as readSettings, k as readCredentials, u as updateSettings, o as openBrowser, w as writeCredentials, m as unrealMcpPythonDir, n as acquireDaemonLock, s as writeDaemonState, t as ApiMachineClient, v as releaseDaemonLock, x as sendUnrealMcpTcpCommand, A as ApiClient, y as validatePath, z as run, B as run$1, C as buildShellInvocation, D as clearCredentials, E as clearMachineId, F as authenticateCodex, G as syncCodexCliAuth, H as authenticateClaude, I as authenticateGemini, d as installUnrealMcpPluginToEngine, J as buildAndInstallUnrealMcpPlugin, i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, K as getLatestDaemonLog, L as normalizeServerUrlForNode } from './types-D2z7I_Ei.mjs';
|
|
6
6
|
import { spawn, execFileSync, execSync } from 'node:child_process';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import path__default, { resolve, join, dirname } from 'node:path';
|
|
@@ -505,7 +505,8 @@ async function claudeLocal(opts) {
|
|
|
505
505
|
stdio: ["inherit", "inherit", "inherit", "pipe"],
|
|
506
506
|
signal: opts.abort,
|
|
507
507
|
cwd: opts.path,
|
|
508
|
-
env
|
|
508
|
+
env,
|
|
509
|
+
windowsHide: process$1.platform === "win32"
|
|
509
510
|
});
|
|
510
511
|
if (child.stdio[3]) {
|
|
511
512
|
const rl = createInterface({
|
|
@@ -1306,16 +1307,23 @@ const __dirname$1 = join(__filename$1, "..");
|
|
|
1306
1307
|
function getGlobalClaudeVersion(claudeExecutable) {
|
|
1307
1308
|
try {
|
|
1308
1309
|
const cleanEnv = buildDaemonSafeEnv(getCleanEnv(), claudeExecutable);
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1310
|
+
const isPathLike = (claudeExecutable.includes("/") || claudeExecutable.includes("\\")) && !claudeExecutable.startsWith("\\\\");
|
|
1311
|
+
const output = isPathLike ? execFileSync(
|
|
1312
|
+
/\.(?:c|m)?js$/i.test(claudeExecutable) ? process$1.execPath : claudeExecutable,
|
|
1313
|
+
/\.(?:c|m)?js$/i.test(claudeExecutable) ? [claudeExecutable, "--version"] : ["--version"],
|
|
1314
|
+
{
|
|
1315
|
+
encoding: "utf8",
|
|
1316
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1317
|
+
cwd: homedir(),
|
|
1318
|
+
env: cleanEnv,
|
|
1319
|
+
windowsHide: process$1.platform === "win32"
|
|
1320
|
+
}
|
|
1321
|
+
).trim() : execSync("claude --version", {
|
|
1315
1322
|
encoding: "utf8",
|
|
1316
1323
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1317
1324
|
cwd: homedir(),
|
|
1318
|
-
env: cleanEnv
|
|
1325
|
+
env: cleanEnv,
|
|
1326
|
+
windowsHide: process$1.platform === "win32"
|
|
1319
1327
|
}).trim();
|
|
1320
1328
|
const match = output.match(/(\d+\.\d+\.\d+)/);
|
|
1321
1329
|
logger.debug(`[Claude SDK] Global claude --version output: ${output}`);
|
|
@@ -1372,6 +1380,7 @@ function getCleanEnv() {
|
|
|
1372
1380
|
}
|
|
1373
1381
|
function resolveClaudeBin() {
|
|
1374
1382
|
const existsExecutable = (p) => {
|
|
1383
|
+
if (process$1.platform === "win32") return existsSync(p);
|
|
1375
1384
|
try {
|
|
1376
1385
|
accessSync(p, constants.X_OK);
|
|
1377
1386
|
return true;
|
|
@@ -1379,6 +1388,31 @@ function resolveClaudeBin() {
|
|
|
1379
1388
|
return false;
|
|
1380
1389
|
}
|
|
1381
1390
|
};
|
|
1391
|
+
if (process$1.platform === "win32") {
|
|
1392
|
+
const windowsCandidates = [
|
|
1393
|
+
join(homedir(), "AppData", "Roaming", "npm", "node_modules", "@anthropic-ai", "claude-code", "cli.js"),
|
|
1394
|
+
join(String(process$1.env.APPDATA || ""), "npm", "node_modules", "@anthropic-ai", "claude-code", "cli.js")
|
|
1395
|
+
].filter(Boolean);
|
|
1396
|
+
for (const candidate of windowsCandidates) {
|
|
1397
|
+
if (candidate && existsSync(candidate)) return candidate;
|
|
1398
|
+
}
|
|
1399
|
+
try {
|
|
1400
|
+
const result = execFileSync("where.exe", ["claude.cmd"], {
|
|
1401
|
+
encoding: "utf8",
|
|
1402
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
1403
|
+
cwd: homedir(),
|
|
1404
|
+
env: buildDaemonSafeEnv(getCleanEnv()),
|
|
1405
|
+
windowsHide: true
|
|
1406
|
+
}).trim();
|
|
1407
|
+
const first = result.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
1408
|
+
if (first) {
|
|
1409
|
+
const npmDir = dirname(first);
|
|
1410
|
+
const cliJs = join(npmDir, "node_modules", "@anthropic-ai", "claude-code", "cli.js");
|
|
1411
|
+
if (existsSync(cliJs)) return cliJs;
|
|
1412
|
+
}
|
|
1413
|
+
} catch {
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1382
1416
|
const candidates = [
|
|
1383
1417
|
join(homedir(), ".local", "bin", "claude"),
|
|
1384
1418
|
"/opt/homebrew/bin/claude",
|
|
@@ -1433,7 +1467,8 @@ function findGlobalClaudePath() {
|
|
|
1433
1467
|
encoding: "utf8",
|
|
1434
1468
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1435
1469
|
cwd: homeDir,
|
|
1436
|
-
env: cleanEnv
|
|
1470
|
+
env: cleanEnv,
|
|
1471
|
+
windowsHide: process$1.platform === "win32"
|
|
1437
1472
|
});
|
|
1438
1473
|
logger.debug("[Claude SDK] Global claude command available (checked with clean PATH)");
|
|
1439
1474
|
return "claude";
|
|
@@ -1504,8 +1539,11 @@ async function streamToStdin(stream, stdin, abort) {
|
|
|
1504
1539
|
stdin.end();
|
|
1505
1540
|
}
|
|
1506
1541
|
|
|
1542
|
+
function stripAnsi(text) {
|
|
1543
|
+
return String(text || "").replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, "");
|
|
1544
|
+
}
|
|
1507
1545
|
function trimProcessDiagnostic(text) {
|
|
1508
|
-
const lines =
|
|
1546
|
+
const lines = stripAnsi(text).split(/\r?\n/).map((line) => line.trim()).filter(Boolean).filter((line) => !/^Using Claude Code v[\d.]+ from /i.test(line));
|
|
1509
1547
|
if (lines.length === 0) return "";
|
|
1510
1548
|
return lines.slice(-8).join("\n");
|
|
1511
1549
|
}
|
|
@@ -1796,6 +1834,7 @@ function query(config) {
|
|
|
1796
1834
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1797
1835
|
signal: config.options?.abort,
|
|
1798
1836
|
env: spawnEnv,
|
|
1837
|
+
windowsHide: process$1.platform === "win32",
|
|
1799
1838
|
// Only use a shell on Windows when spawning a bare command (e.g. "claude").
|
|
1800
1839
|
// Passing large `--allowedTools` lists through cmd.exe can hit the ~8k command line limit.
|
|
1801
1840
|
shell: isCommandOnly && process$1.platform === "win32"
|
|
@@ -7796,7 +7835,12 @@ async function writeFastPreviewState(statePath, state) {
|
|
|
7796
7835
|
}
|
|
7797
7836
|
async function runUnrealAndCapture(args) {
|
|
7798
7837
|
return await new Promise((resolve, reject) => {
|
|
7799
|
-
const child = spawn(args.cmd, args.unrealArgs, {
|
|
7838
|
+
const child = spawn(args.cmd, args.unrealArgs, {
|
|
7839
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7840
|
+
cwd: args.cwd,
|
|
7841
|
+
env: args.env,
|
|
7842
|
+
windowsHide: process.platform === "win32"
|
|
7843
|
+
});
|
|
7800
7844
|
const timeout = setTimeout(() => {
|
|
7801
7845
|
child.kill("SIGKILL");
|
|
7802
7846
|
reject(new Error(`Timed out after ${args.timeoutMs}ms`));
|
|
@@ -7823,7 +7867,12 @@ async function runUnrealAndCapture(args) {
|
|
|
7823
7867
|
}
|
|
7824
7868
|
async function runCmdAndCapture(args) {
|
|
7825
7869
|
return await new Promise((resolvePromise, rejectPromise) => {
|
|
7826
|
-
const child = spawn(args.cmd, args.cmdArgs, {
|
|
7870
|
+
const child = spawn(args.cmd, args.cmdArgs, {
|
|
7871
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
7872
|
+
cwd: args.cwd,
|
|
7873
|
+
env: args.env,
|
|
7874
|
+
windowsHide: process.platform === "win32"
|
|
7875
|
+
});
|
|
7827
7876
|
const timeout = setTimeout(() => {
|
|
7828
7877
|
child.kill("SIGKILL");
|
|
7829
7878
|
rejectPromise(new Error(`Timed out after ${args.timeoutMs}ms`));
|
|
@@ -8234,7 +8283,11 @@ async function startFlockbayServer(client, options) {
|
|
|
8234
8283
|
};
|
|
8235
8284
|
const runCommandCapture = async (cmd, args) => {
|
|
8236
8285
|
return new Promise((resolve) => {
|
|
8237
|
-
const child = spawn(cmd, args, {
|
|
8286
|
+
const child = spawn(cmd, args, {
|
|
8287
|
+
shell: false,
|
|
8288
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
8289
|
+
windowsHide: process.platform === "win32"
|
|
8290
|
+
});
|
|
8238
8291
|
let stdout = "";
|
|
8239
8292
|
let stderr = "";
|
|
8240
8293
|
child.stdout?.on("data", (c) => stdout += c.toString("utf8"));
|
|
@@ -8297,7 +8350,11 @@ ${res.stderr}`;
|
|
|
8297
8350
|
const exe = getUnrealEditorExe(engineRoot);
|
|
8298
8351
|
if (!exe) throw new Error(`Unsupported platform for Unreal Editor launch: ${process.platform}`);
|
|
8299
8352
|
if (!existsSync(exe)) throw new Error(`Unreal Editor binary not found: ${exe}`);
|
|
8300
|
-
const child = spawn(exe, [uprojectPath, ...extraArgs], {
|
|
8353
|
+
const child = spawn(exe, [uprojectPath, ...extraArgs], {
|
|
8354
|
+
detached: true,
|
|
8355
|
+
stdio: "ignore",
|
|
8356
|
+
windowsHide: process.platform === "win32"
|
|
8357
|
+
});
|
|
8301
8358
|
child.unref();
|
|
8302
8359
|
const pid = typeof child.pid === "number" ? child.pid : 0;
|
|
8303
8360
|
state.launched = {
|
|
@@ -10258,7 +10315,11 @@ ${chunk}` }],
|
|
|
10258
10315
|
async function isUnrealEditorProcessRunningBestEffortGlobal() {
|
|
10259
10316
|
const runCommandCapture = async (cmd, args) => {
|
|
10260
10317
|
return new Promise((resolve) => {
|
|
10261
|
-
const child = spawn(cmd, args, {
|
|
10318
|
+
const child = spawn(cmd, args, {
|
|
10319
|
+
shell: false,
|
|
10320
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
10321
|
+
windowsHide: process.platform === "win32"
|
|
10322
|
+
});
|
|
10262
10323
|
let stdout = "";
|
|
10263
10324
|
let stderr = "";
|
|
10264
10325
|
child.stdout?.on("data", (c) => stdout += c.toString("utf8"));
|
|
@@ -12885,14 +12946,22 @@ Fix: ${res.hint}` : "";
|
|
|
12885
12946
|
isError: false
|
|
12886
12947
|
};
|
|
12887
12948
|
}));
|
|
12888
|
-
const
|
|
12889
|
-
// NOTE: Returning session id here will result in claude
|
|
12890
|
-
// sdk spawn to fail with `Invalid Request: Server already initialized`
|
|
12891
|
-
sessionIdGenerator: void 0
|
|
12892
|
-
});
|
|
12893
|
-
await mcp.connect(transport);
|
|
12949
|
+
const activeHttpTransports = /* @__PURE__ */ new Set();
|
|
12894
12950
|
const server = createServer(async (req, res) => {
|
|
12951
|
+
const transport = new StreamableHTTPServerTransport({
|
|
12952
|
+
// Keep the local MCP endpoint stateless. The SDK recommends creating a
|
|
12953
|
+
// fresh transport per request for streamable HTTP when session management
|
|
12954
|
+
// is disabled; this avoids shared request/stream state across tool calls.
|
|
12955
|
+
sessionIdGenerator: void 0,
|
|
12956
|
+
enableJsonResponse: true
|
|
12957
|
+
});
|
|
12958
|
+
activeHttpTransports.add(transport);
|
|
12959
|
+
res.on("close", () => {
|
|
12960
|
+
activeHttpTransports.delete(transport);
|
|
12961
|
+
void transport.close().catch(() => void 0);
|
|
12962
|
+
});
|
|
12895
12963
|
try {
|
|
12964
|
+
await mcp.connect(transport);
|
|
12896
12965
|
await transport.handleRequest(req, res);
|
|
12897
12966
|
} catch (error) {
|
|
12898
12967
|
logger.debug("Error handling request:", error);
|
|
@@ -12983,6 +13052,10 @@ Fix: ${res.hint}` : "";
|
|
|
12983
13052
|
stop: () => {
|
|
12984
13053
|
logger.debug("[flockbayMCP] Stopping server");
|
|
12985
13054
|
unrealEditorSupervisor.stop();
|
|
13055
|
+
for (const transport of activeHttpTransports) {
|
|
13056
|
+
void transport.close().catch(() => void 0);
|
|
13057
|
+
}
|
|
13058
|
+
activeHttpTransports.clear();
|
|
12986
13059
|
mcp.close();
|
|
12987
13060
|
server.close();
|
|
12988
13061
|
}
|
|
@@ -15247,7 +15320,7 @@ async function authAndSetupMachineIfNeeded() {
|
|
|
15247
15320
|
process.exit(1);
|
|
15248
15321
|
}
|
|
15249
15322
|
try {
|
|
15250
|
-
const { migrateUnrealMcpToFlockbayMcp } = await import('./migratePlugin-
|
|
15323
|
+
const { migrateUnrealMcpToFlockbayMcp } = await import('./migratePlugin-BWa_MICW.mjs');
|
|
15251
15324
|
const result = migrateUnrealMcpToFlockbayMcp({
|
|
15252
15325
|
engineRoot,
|
|
15253
15326
|
projectUprojectPath: project || void 0,
|
|
@@ -15403,7 +15476,7 @@ ${engineRoot}`;
|
|
|
15403
15476
|
} else if (subcommand === "codex") {
|
|
15404
15477
|
try {
|
|
15405
15478
|
await chdirToNearestUprojectRootIfPresent();
|
|
15406
|
-
const { runCodex } = await import('./runCodex-
|
|
15479
|
+
const { runCodex } = await import('./runCodex-CW8p6MqM.mjs');
|
|
15407
15480
|
let startedBy = void 0;
|
|
15408
15481
|
let sessionId = void 0;
|
|
15409
15482
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -15505,7 +15578,7 @@ ${engineRoot}`;
|
|
|
15505
15578
|
}
|
|
15506
15579
|
try {
|
|
15507
15580
|
await chdirToNearestUprojectRootIfPresent();
|
|
15508
|
-
const { runGemini } = await import('./runGemini-
|
|
15581
|
+
const { runGemini } = await import('./runGemini-CutURnfo.mjs');
|
|
15509
15582
|
let startedBy = void 0;
|
|
15510
15583
|
let sessionId = void 0;
|
|
15511
15584
|
for (let i = 1; i < args.length; i++) {
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/lib.cjs
CHANGED
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-D2z7I_Ei.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:os';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs__default from 'node:fs';
|
|
2
2
|
import path__default from 'node:path';
|
|
3
|
-
import { i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, q as quarantineLegacyEnginePlugins, d as installUnrealMcpPluginToEngine } from './types-
|
|
3
|
+
import { i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, q as quarantineLegacyEnginePlugins, d as installUnrealMcpPluginToEngine } from './types-D2z7I_Ei.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'node:os';
|
|
6
6
|
import 'node:events';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var types = require('./types-
|
|
5
|
+
var types = require('./types-mdNlgF2l.cjs');
|
|
6
6
|
var index_js = require('@modelcontextprotocol/sdk/client/index.js');
|
|
7
7
|
var z = require('zod');
|
|
8
8
|
var types_js = require('@modelcontextprotocol/sdk/types.js');
|
|
@@ -16,7 +16,7 @@ var process$1 = require('node:process');
|
|
|
16
16
|
var node_stream = require('node:stream');
|
|
17
17
|
var stdio_js$1 = require('@modelcontextprotocol/sdk/client/stdio.js');
|
|
18
18
|
var stdio_js = require('@modelcontextprotocol/sdk/shared/stdio.js');
|
|
19
|
-
var index = require('./index-
|
|
19
|
+
var index = require('./index-BvAn9mzP.cjs');
|
|
20
20
|
require('axios');
|
|
21
21
|
require('node:events');
|
|
22
22
|
require('socket.io-client');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
-
import { l as logger, A as ApiClient, p as packageJson, c as configuration, r as readSettings, e as projectPath } from './types-
|
|
3
|
+
import { l as logger, A as ApiClient, p as packageJson, c as configuration, r as readSettings, e as projectPath } from './types-D2z7I_Ei.mjs';
|
|
4
4
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ElicitRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -14,7 +14,7 @@ import process$1 from 'node:process';
|
|
|
14
14
|
import { PassThrough } from 'node:stream';
|
|
15
15
|
import { getDefaultEnvironment } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
16
16
|
import { ReadBuffer, serializeMessage } from '@modelcontextprotocol/sdk/shared/stdio.js';
|
|
17
|
-
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, E as ElicitationHub, n as notifyDaemonSessionStarted, M as MessageQueue2, P as PLATFORM_SYSTEM_PROMPT, a as setLatestUserImages, w as withUserImagesMarker, r as registerKillSessionHandler, b as MessageBuffer, d as startFlockbayServer, g as buildProjectCapsule, t as trimIdent, j as autoFinalizeCoordinationWorkItem, k as detectScreenshotsForGate, l as applyCoordinationSideEffectsFromMcpToolResult, m as stopCaffeinate } from './index-
|
|
17
|
+
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, E as ElicitationHub, n as notifyDaemonSessionStarted, M as MessageQueue2, P as PLATFORM_SYSTEM_PROMPT, a as setLatestUserImages, w as withUserImagesMarker, r as registerKillSessionHandler, b as MessageBuffer, d as startFlockbayServer, g as buildProjectCapsule, t as trimIdent, j as autoFinalizeCoordinationWorkItem, k as detectScreenshotsForGate, l as applyCoordinationSideEffectsFromMcpToolResult, m as stopCaffeinate } from './index-DuZhXr8l.mjs';
|
|
18
18
|
import 'axios';
|
|
19
19
|
import 'node:events';
|
|
20
20
|
import 'socket.io-client';
|
|
@@ -6,8 +6,8 @@ var node_crypto = require('node:crypto');
|
|
|
6
6
|
var os = require('node:os');
|
|
7
7
|
var path = require('node:path');
|
|
8
8
|
var fs$2 = require('node:fs/promises');
|
|
9
|
-
var types = require('./types-
|
|
10
|
-
var index = require('./index-
|
|
9
|
+
var types = require('./types-mdNlgF2l.cjs');
|
|
10
|
+
var index = require('./index-BvAn9mzP.cjs');
|
|
11
11
|
var node_child_process = require('node:child_process');
|
|
12
12
|
var sdk = require('@agentclientprotocol/sdk');
|
|
13
13
|
var fs = require('fs');
|
|
@@ -4,8 +4,8 @@ import { randomUUID, createHash } from 'node:crypto';
|
|
|
4
4
|
import os__default from 'node:os';
|
|
5
5
|
import path__default, { resolve, join as join$1, basename } from 'node:path';
|
|
6
6
|
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
7
|
-
import { l as logger, p as packageJson, A as ApiClient, c as configuration, r as readSettings, e as projectPath } from './types-
|
|
8
|
-
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, g as buildProjectCapsule, a as setLatestUserImages, b as MessageBuffer, w as withUserImagesMarker, r as registerKillSessionHandler, d as startFlockbayServer, o as extractUserImagesMarker, p as getLatestUserImages, P as PLATFORM_SYSTEM_PROMPT, j as autoFinalizeCoordinationWorkItem, E as ElicitationHub, k as detectScreenshotsForGate, m as stopCaffeinate } from './index-
|
|
7
|
+
import { l as logger, p as packageJson, A as ApiClient, c as configuration, r as readSettings, e as projectPath } from './types-D2z7I_Ei.mjs';
|
|
8
|
+
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, g as buildProjectCapsule, a as setLatestUserImages, b as MessageBuffer, w as withUserImagesMarker, r as registerKillSessionHandler, d as startFlockbayServer, o as extractUserImagesMarker, p as getLatestUserImages, P as PLATFORM_SYSTEM_PROMPT, j as autoFinalizeCoordinationWorkItem, E as ElicitationHub, k as detectScreenshotsForGate, m as stopCaffeinate } from './index-DuZhXr8l.mjs';
|
|
9
9
|
import { spawn, spawnSync } from 'node:child_process';
|
|
10
10
|
import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
|
|
11
11
|
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
@@ -23,7 +23,7 @@ import { createServer } from 'http';
|
|
|
23
23
|
import open$2 from 'open';
|
|
24
24
|
|
|
25
25
|
var name = "flockbay";
|
|
26
|
-
var version = "0.10.
|
|
26
|
+
var version = "0.10.56";
|
|
27
27
|
var description = "Flockbay CLI (local agent + daemon)";
|
|
28
28
|
var author = "Eduardo Orellana";
|
|
29
29
|
var license = "UNLICENSED";
|
|
@@ -44,7 +44,7 @@ function _interopNamespaceDefault(e) {
|
|
|
44
44
|
var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
|
|
45
45
|
|
|
46
46
|
var name = "flockbay";
|
|
47
|
-
var version = "0.10.
|
|
47
|
+
var version = "0.10.56";
|
|
48
48
|
var description = "Flockbay CLI (local agent + daemon)";
|
|
49
49
|
var author = "Eduardo Orellana";
|
|
50
50
|
var license = "UNLICENSED";
|
|
@@ -832,7 +832,7 @@ class RpcHandlerManager {
|
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-
|
|
835
|
+
const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-mdNlgF2l.cjs', document.baseURI).href))));
|
|
836
836
|
function projectPath() {
|
|
837
837
|
const path = path$1.resolve(__dirname$1, "..");
|
|
838
838
|
return path;
|
package/package.json
CHANGED
|
@@ -35,13 +35,28 @@ function resolvePathSafe(filePath) {
|
|
|
35
35
|
* Find path to npm globally installed Claude Code CLI
|
|
36
36
|
* @returns {string|null} Path to cli.js or null if not found
|
|
37
37
|
*/
|
|
38
|
-
function findNpmGlobalCliPath() {
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
function findNpmGlobalCliPath() {
|
|
39
|
+
if (process.platform === 'win32') {
|
|
40
|
+
const npmRoots = [
|
|
41
|
+
path.join(process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming'), 'npm', 'node_modules'),
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
for (const root of npmRoots) {
|
|
45
|
+
const globalCliPath = path.join(root, '@anthropic-ai', 'claude-code', 'cli.js');
|
|
46
|
+
if (fs.existsSync(globalCliPath)) {
|
|
47
|
+
return globalCliPath;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const globalRoot = process.platform === 'win32'
|
|
54
|
+
? execFileSync('cmd.exe', ['/d', '/s', '/c', 'npm root -g'], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true }).trim()
|
|
55
|
+
: execFileSync('npm', ['root', '-g'], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
56
|
+
const globalCliPath = path.join(globalRoot, '@anthropic-ai', 'claude-code', 'cli.js');
|
|
57
|
+
if (fs.existsSync(globalCliPath)) {
|
|
58
|
+
return globalCliPath;
|
|
59
|
+
}
|
|
45
60
|
} catch (e) {
|
|
46
61
|
// npm root -g failed
|
|
47
62
|
}
|
|
@@ -325,7 +340,11 @@ function getVersion(cliPath) {
|
|
|
325
340
|
}
|
|
326
341
|
|
|
327
342
|
// Binary install: try to ask it.
|
|
328
|
-
const out = execFileSync(cliPath, ['--version'], {
|
|
343
|
+
const out = execFileSync(cliPath, ['--version'], {
|
|
344
|
+
encoding: 'utf8',
|
|
345
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
346
|
+
windowsHide: process.platform === 'win32',
|
|
347
|
+
}).trim();
|
|
329
348
|
const m = out.match(/(\d+\.\d+\.\d+)/);
|
|
330
349
|
return m ? m[1] : null;
|
|
331
350
|
} catch (e) {}
|
|
@@ -423,10 +442,11 @@ function runClaudeCli(cliPath) {
|
|
|
423
442
|
// Note: Interceptors won't work with binary files, but that's acceptable
|
|
424
443
|
// as binary files are self-contained and don't need interception
|
|
425
444
|
const args = process.argv.slice(2);
|
|
426
|
-
const child = spawn(cliPath, args, {
|
|
427
|
-
stdio: 'inherit',
|
|
428
|
-
env: process.env
|
|
429
|
-
|
|
445
|
+
const child = spawn(cliPath, args, {
|
|
446
|
+
stdio: 'inherit',
|
|
447
|
+
env: process.env,
|
|
448
|
+
windowsHide: process.platform === 'win32',
|
|
449
|
+
});
|
|
430
450
|
child.on('exit', (code) => {
|
|
431
451
|
process.exit(code || 0);
|
|
432
452
|
});
|