codexuse-cli 3.9.0 → 3.9.1
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.js +1 -1
- package/dist/server/index.mjs +28 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10610,7 +10610,7 @@ async function ensureCliStorageReady() {
|
|
|
10610
10610
|
}
|
|
10611
10611
|
|
|
10612
10612
|
// src/app/main.ts
|
|
10613
|
-
var VERSION = true ? "3.9.
|
|
10613
|
+
var VERSION = true ? "3.9.1" : "0.0.0";
|
|
10614
10614
|
async function runCli() {
|
|
10615
10615
|
const args = process.argv.slice(2);
|
|
10616
10616
|
if (args.length === 0) {
|
package/dist/server/index.mjs
CHANGED
|
@@ -79315,10 +79315,22 @@ function buildCodexCommand(binaryPath, args) {
|
|
|
79315
79315
|
};
|
|
79316
79316
|
}
|
|
79317
79317
|
function buildRuntimeEnv(codexHomePath) {
|
|
79318
|
-
|
|
79318
|
+
const env = {
|
|
79319
79319
|
...process.env,
|
|
79320
79320
|
...codexHomePath?.trim() ? { CODEX_HOME: codexHomePath.trim() } : {}
|
|
79321
79321
|
};
|
|
79322
|
+
const homeDir = env.HOME ?? env.USERPROFILE ?? os.homedir();
|
|
79323
|
+
const extraPaths = [
|
|
79324
|
+
"/opt/homebrew/bin",
|
|
79325
|
+
"/usr/local/bin",
|
|
79326
|
+
path.join(homeDir, ".local", "bin"),
|
|
79327
|
+
path.join(homeDir, ".fnm", "aliases", "default", "bin"),
|
|
79328
|
+
path.join(homeDir, ".fnm", "current", "bin"),
|
|
79329
|
+
path.join(homeDir, ".volta", "bin"),
|
|
79330
|
+
path.join(homeDir, ".asdf", "shims")
|
|
79331
|
+
];
|
|
79332
|
+
env.PATH = Array.from(new Set([...(env.PATH ?? "").split(path.delimiter), ...extraPaths].filter(Boolean))).join(path.delimiter);
|
|
79333
|
+
return env;
|
|
79322
79334
|
}
|
|
79323
79335
|
function createTimeoutError(command, args) {
|
|
79324
79336
|
return /* @__PURE__ */ new Error(`Command timed out: ${command} ${args.join(" ")}`);
|
|
@@ -79579,7 +79591,9 @@ async function inspectAppServer(input) {
|
|
|
79579
79591
|
}
|
|
79580
79592
|
}
|
|
79581
79593
|
async function inspectCodexRuntime(input) {
|
|
79582
|
-
const
|
|
79594
|
+
const requestedBinaryPath = input.binaryPath?.trim() || null;
|
|
79595
|
+
const binaryPath = requestedBinaryPath || "codex";
|
|
79596
|
+
const usesDefaultBinaryPath = !requestedBinaryPath || requestedBinaryPath === "codex";
|
|
79583
79597
|
const args = tokenizeArgs(input.args);
|
|
79584
79598
|
const env = buildRuntimeEnv(input.codexHomePath);
|
|
79585
79599
|
let version = null;
|
|
@@ -79588,7 +79602,8 @@ async function inspectCodexRuntime(input) {
|
|
|
79588
79602
|
let authMessage = null;
|
|
79589
79603
|
let nodeVersion = null;
|
|
79590
79604
|
let nodeDetails = null;
|
|
79591
|
-
let nodeOk
|
|
79605
|
+
let nodeOk;
|
|
79606
|
+
let codexCommandMissing = false;
|
|
79592
79607
|
try {
|
|
79593
79608
|
const versionCommand = buildCodexCommand(binaryPath, [...args, "--version"]);
|
|
79594
79609
|
const versionResult = await runCommand$1(versionCommand.command, versionCommand.args, {
|
|
@@ -79600,9 +79615,13 @@ async function inspectCodexRuntime(input) {
|
|
|
79600
79615
|
if (versionResult.code !== 0) details = describeCommandFailure(versionResult, "Codex CLI failed to run `--version`.");
|
|
79601
79616
|
else if (parsedVersion && !isCodexCliVersionSupported(parsedVersion)) details = formatCodexCliUpgradeMessage(parsedVersion);
|
|
79602
79617
|
} catch (error) {
|
|
79603
|
-
|
|
79618
|
+
if (usesDefaultBinaryPath && error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
79619
|
+
codexCommandMissing = true;
|
|
79620
|
+
details = null;
|
|
79621
|
+
} else if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") details = `Configured Codex CLI path was not found: ${binaryPath}`;
|
|
79622
|
+
else details = error instanceof Error ? error.message : "Unable to run Codex CLI.";
|
|
79604
79623
|
}
|
|
79605
|
-
if (!details) try {
|
|
79624
|
+
if (!details && !codexCommandMissing) try {
|
|
79606
79625
|
const authCommand = buildCodexCommand(binaryPath, [
|
|
79607
79626
|
...args,
|
|
79608
79627
|
"login",
|
|
@@ -79634,7 +79653,7 @@ async function inspectCodexRuntime(input) {
|
|
|
79634
79653
|
nodeOk = false;
|
|
79635
79654
|
nodeDetails = error instanceof Error ? error.message : "Unable to run Node.";
|
|
79636
79655
|
}
|
|
79637
|
-
const appServerInspection = details === null ? await inspectAppServer({
|
|
79656
|
+
const appServerInspection = details === null && !codexCommandMissing ? await inspectAppServer({
|
|
79638
79657
|
binaryPath,
|
|
79639
79658
|
args,
|
|
79640
79659
|
codexHomePath: input.codexHomePath
|
|
@@ -79654,7 +79673,7 @@ async function inspectCodexRuntime(input) {
|
|
|
79654
79673
|
authStatus,
|
|
79655
79674
|
authMessage,
|
|
79656
79675
|
accountLabel: appServerInspection.accountLabel,
|
|
79657
|
-
details: details ?? appServerInspection.details,
|
|
79676
|
+
details: codexCommandMissing ? null : details ?? appServerInspection.details,
|
|
79658
79677
|
path: binaryPath,
|
|
79659
79678
|
nodeOk,
|
|
79660
79679
|
nodeVersion,
|
|
@@ -79670,6 +79689,7 @@ function compactCommandOutput(output) {
|
|
|
79670
79689
|
return trimmed.length > 4e3 ? `${trimmed.slice(-4e3)}` : trimmed;
|
|
79671
79690
|
}
|
|
79672
79691
|
async function updateCodexRuntime() {
|
|
79692
|
+
const env = buildRuntimeEnv();
|
|
79673
79693
|
const beforeVersion = (await inspectCodexRuntime({}).catch(() => null))?.doctor.version ?? null;
|
|
79674
79694
|
const result = await runCommand$1("npm", [
|
|
79675
79695
|
"install",
|
|
@@ -79677,7 +79697,7 @@ async function updateCodexRuntime() {
|
|
|
79677
79697
|
CODEX_NPM_PACKAGE
|
|
79678
79698
|
], {
|
|
79679
79699
|
timeoutMs: CODEX_INSTALL_TIMEOUT_MS,
|
|
79680
|
-
env
|
|
79700
|
+
env
|
|
79681
79701
|
}).catch((error) => ({
|
|
79682
79702
|
stdout: "",
|
|
79683
79703
|
stderr: error instanceof Error ? error.message : String(error),
|