@openai/codex 0.46.0 → 0.47.0-alpha.2
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/bin/codex.js +34 -1
- package/package.json +1 -1
- package/vendor/aarch64-apple-darwin/codex/codex +0 -0
- package/vendor/aarch64-pc-windows-msvc/codex/codex.exe +0 -0
- package/vendor/aarch64-unknown-linux-musl/codex/codex +0 -0
- package/vendor/x86_64-apple-darwin/codex/codex +0 -0
- package/vendor/x86_64-pc-windows-msvc/codex/codex.exe +0 -0
- package/vendor/x86_64-unknown-linux-musl/codex/codex +0 -0
package/bin/codex.js
CHANGED
|
@@ -80,6 +80,32 @@ function getUpdatedPath(newDirs) {
|
|
|
80
80
|
return updatedPath;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Use heuristics to detect the package manager that was used to install Codex
|
|
85
|
+
* in order to give the user a hint about how to update it.
|
|
86
|
+
*/
|
|
87
|
+
function detectPackageManager() {
|
|
88
|
+
const userAgent = process.env.npm_config_user_agent || "";
|
|
89
|
+
if (/\bbun\//.test(userAgent)) {
|
|
90
|
+
return "bun";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const execPath = process.env.npm_execpath || "";
|
|
94
|
+
if (execPath.includes("bun")) {
|
|
95
|
+
return "bun";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
process.env.BUN_INSTALL ||
|
|
100
|
+
process.env.BUN_INSTALL_GLOBAL_DIR ||
|
|
101
|
+
process.env.BUN_INSTALL_BIN_DIR
|
|
102
|
+
) {
|
|
103
|
+
return "bun";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return userAgent ? "npm" : null;
|
|
107
|
+
}
|
|
108
|
+
|
|
83
109
|
const additionalDirs = [];
|
|
84
110
|
const pathDir = path.join(archRoot, "path");
|
|
85
111
|
if (existsSync(pathDir)) {
|
|
@@ -87,9 +113,16 @@ if (existsSync(pathDir)) {
|
|
|
87
113
|
}
|
|
88
114
|
const updatedPath = getUpdatedPath(additionalDirs);
|
|
89
115
|
|
|
116
|
+
const env = { ...process.env, PATH: updatedPath };
|
|
117
|
+
const packageManagerEnvVar =
|
|
118
|
+
detectPackageManager() === "bun"
|
|
119
|
+
? "CODEX_MANAGED_BY_BUN"
|
|
120
|
+
: "CODEX_MANAGED_BY_NPM";
|
|
121
|
+
env[packageManagerEnvVar] = "1";
|
|
122
|
+
|
|
90
123
|
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
91
124
|
stdio: "inherit",
|
|
92
|
-
env
|
|
125
|
+
env,
|
|
93
126
|
});
|
|
94
127
|
|
|
95
128
|
child.on("error", (err) => {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|