@rickgetz/codex 0.132.0-rick.1 → 0.133.0-rick.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/bin/codex.js +40 -32
- package/package.json +2 -2
package/bin/codex.js
CHANGED
|
@@ -13,12 +13,12 @@ const __dirname = path.dirname(__filename);
|
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
14
|
|
|
15
15
|
const PLATFORM_PACKAGE_SUFFIX_BY_TARGET = {
|
|
16
|
-
"x86_64-unknown-linux-musl": "
|
|
17
|
-
"aarch64-unknown-linux-musl": "
|
|
18
|
-
"x86_64-apple-darwin": "
|
|
19
|
-
"aarch64-apple-darwin": "
|
|
20
|
-
"x86_64-pc-windows-msvc": "
|
|
21
|
-
"aarch64-pc-windows-msvc": "
|
|
16
|
+
"x86_64-unknown-linux-musl": "linux-x64",
|
|
17
|
+
"aarch64-unknown-linux-musl": "linux-arm64",
|
|
18
|
+
"x86_64-apple-darwin": "darwin-x64",
|
|
19
|
+
"aarch64-apple-darwin": "darwin-arm64",
|
|
20
|
+
"x86_64-pc-windows-msvc": "win32-x64",
|
|
21
|
+
"aarch64-pc-windows-msvc": "win32-arm64",
|
|
22
22
|
};
|
|
23
23
|
const rootPackageJson = JSON.parse(
|
|
24
24
|
readFileSync(path.join(__dirname, "..", "package.json"), "utf8"),
|
|
@@ -28,9 +28,9 @@ const rootPackageName = rootPackageJson.name || "@rickgetz/codex";
|
|
|
28
28
|
function packageAliasName(basePackageName, suffix) {
|
|
29
29
|
if (basePackageName.startsWith("@")) {
|
|
30
30
|
const [scope, packageName] = basePackageName.split("/", 2);
|
|
31
|
-
return `${scope}/${packageName}-${suffix
|
|
31
|
+
return `${scope}/${packageName}-${suffix}`;
|
|
32
32
|
}
|
|
33
|
-
return `${basePackageName}-${suffix
|
|
33
|
+
return `${basePackageName}-${suffix}`;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const { platform, arch } = process;
|
|
@@ -90,33 +90,43 @@ const platformPackage = packageAliasName(rootPackageName, platformPackageSuffix)
|
|
|
90
90
|
|
|
91
91
|
const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
|
|
92
92
|
const localVendorRoot = path.join(__dirname, "..", "vendor");
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"codex",
|
|
97
|
-
|
|
98
|
-
)
|
|
93
|
+
const packageBinaryPath = (vendorRoot) =>
|
|
94
|
+
path.join(vendorRoot, targetTriple, "bin", codexBinaryName);
|
|
95
|
+
const legacyBinaryPath = (vendorRoot) =>
|
|
96
|
+
path.join(vendorRoot, targetTriple, "codex", codexBinaryName);
|
|
97
|
+
|
|
98
|
+
function resolveNativePackage(vendorRoot) {
|
|
99
|
+
const packageRoot = path.join(vendorRoot, targetTriple);
|
|
100
|
+
const binaryPath = packageBinaryPath(vendorRoot);
|
|
101
|
+
if (existsSync(binaryPath)) {
|
|
102
|
+
return {
|
|
103
|
+
binaryPath,
|
|
104
|
+
pathDir: path.join(packageRoot, "codex-path"),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const legacyPath = legacyBinaryPath(vendorRoot);
|
|
109
|
+
if (existsSync(legacyPath)) {
|
|
110
|
+
return {
|
|
111
|
+
binaryPath: legacyPath,
|
|
112
|
+
pathDir: path.join(packageRoot, "path"),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
99
115
|
|
|
100
|
-
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let nativePackage;
|
|
101
120
|
try {
|
|
102
121
|
const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
|
|
103
|
-
|
|
122
|
+
nativePackage = resolveNativePackage(
|
|
123
|
+
path.join(path.dirname(packageJsonPath), "vendor"),
|
|
124
|
+
);
|
|
104
125
|
} catch {
|
|
105
|
-
|
|
106
|
-
vendorRoot = localVendorRoot;
|
|
107
|
-
} else {
|
|
108
|
-
const packageManager = detectPackageManager();
|
|
109
|
-
const updateCommand =
|
|
110
|
-
packageManager === "bun"
|
|
111
|
-
? `bun install -g ${rootPackageName}@latest`
|
|
112
|
-
: `npm install -g ${rootPackageName}@latest`;
|
|
113
|
-
throw new Error(
|
|
114
|
-
`Missing optional dependency ${platformPackage}. Reinstall Codex: ${updateCommand}`,
|
|
115
|
-
);
|
|
116
|
-
}
|
|
126
|
+
nativePackage = resolveNativePackage(localVendorRoot);
|
|
117
127
|
}
|
|
118
128
|
|
|
119
|
-
if (!
|
|
129
|
+
if (!nativePackage) {
|
|
120
130
|
const packageManager = detectPackageManager();
|
|
121
131
|
const updateCommand =
|
|
122
132
|
packageManager === "bun"
|
|
@@ -127,8 +137,7 @@ if (!vendorRoot) {
|
|
|
127
137
|
);
|
|
128
138
|
}
|
|
129
139
|
|
|
130
|
-
const
|
|
131
|
-
const binaryPath = path.join(archRoot, "codex", codexBinaryName);
|
|
140
|
+
const { binaryPath, pathDir } = nativePackage;
|
|
132
141
|
|
|
133
142
|
// Use an asynchronous spawn instead of spawnSync so that Node is able to
|
|
134
143
|
// respond to signals (e.g. Ctrl-C / SIGINT) while the native binary is
|
|
@@ -172,7 +181,6 @@ function detectPackageManager() {
|
|
|
172
181
|
}
|
|
173
182
|
|
|
174
183
|
const additionalDirs = [];
|
|
175
|
-
const pathDir = path.join(archRoot, "path");
|
|
176
184
|
if (existsSync(pathDir)) {
|
|
177
185
|
additionalDirs.push(pathDir);
|
|
178
186
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rickgetz/codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.133.0-rick.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"codex-rick": "bin/codex.js"
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@rickgetz/codex-darwin-arm64": "npm:@rickgetz/codex@0.
|
|
22
|
+
"@rickgetz/codex-darwin-arm64": "npm:@rickgetz/codex@0.133.0-rick.1-darwin-arm64"
|
|
23
23
|
}
|
|
24
24
|
}
|