@just-every/code 0.6.61 → 0.6.63

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.
Files changed (2) hide show
  1. package/bin/codex.js +55 -2
  2. package/package.json +6 -6
package/bin/codex.js CHANGED
@@ -3,12 +3,23 @@
3
3
 
4
4
  import { spawn } from "node:child_process";
5
5
  import { existsSync } from "fs";
6
+ import { createRequire } from "node:module";
6
7
  import path from "path";
7
8
  import { fileURLToPath } from "url";
8
9
 
9
10
  // __dirname equivalent in ESM
10
11
  const __filename = fileURLToPath(import.meta.url);
11
12
  const __dirname = path.dirname(__filename);
13
+ const require = createRequire(import.meta.url);
14
+
15
+ const PLATFORM_PACKAGE_BY_TARGET = {
16
+ "x86_64-unknown-linux-musl": "@openai/codex-linux-x64",
17
+ "aarch64-unknown-linux-musl": "@openai/codex-linux-arm64",
18
+ "x86_64-apple-darwin": "@openai/codex-darwin-x64",
19
+ "aarch64-apple-darwin": "@openai/codex-darwin-arm64",
20
+ "x86_64-pc-windows-msvc": "@openai/codex-win32-x64",
21
+ "aarch64-pc-windows-msvc": "@openai/codex-win32-arm64",
22
+ };
12
23
 
13
24
  const { platform, arch } = process;
14
25
 
@@ -59,9 +70,51 @@ if (!targetTriple) {
59
70
  throw new Error(`Unsupported platform: ${platform} (${arch})`);
60
71
  }
61
72
 
62
- const vendorRoot = path.join(__dirname, "..", "vendor");
63
- const archRoot = path.join(vendorRoot, targetTriple);
73
+ const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
74
+ if (!platformPackage) {
75
+ throw new Error(`Unsupported target triple: ${targetTriple}`);
76
+ }
77
+
64
78
  const codexBinaryName = process.platform === "win32" ? "codex.exe" : "codex";
79
+ const localVendorRoot = path.join(__dirname, "..", "vendor");
80
+ const localBinaryPath = path.join(
81
+ localVendorRoot,
82
+ targetTriple,
83
+ "codex",
84
+ codexBinaryName,
85
+ );
86
+
87
+ let vendorRoot;
88
+ try {
89
+ const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
90
+ vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
91
+ } catch {
92
+ if (existsSync(localBinaryPath)) {
93
+ vendorRoot = localVendorRoot;
94
+ } else {
95
+ const packageManager = detectPackageManager();
96
+ const updateCommand =
97
+ packageManager === "bun"
98
+ ? "bun install -g @openai/codex@latest"
99
+ : "npm install -g @openai/codex@latest";
100
+ throw new Error(
101
+ `Missing optional dependency ${platformPackage}. Reinstall Codex: ${updateCommand}`,
102
+ );
103
+ }
104
+ }
105
+
106
+ if (!vendorRoot) {
107
+ const packageManager = detectPackageManager();
108
+ const updateCommand =
109
+ packageManager === "bun"
110
+ ? "bun install -g @openai/codex@latest"
111
+ : "npm install -g @openai/codex@latest";
112
+ throw new Error(
113
+ `Missing optional dependency ${platformPackage}. Reinstall Codex: ${updateCommand}`,
114
+ );
115
+ }
116
+
117
+ const archRoot = path.join(vendorRoot, targetTriple);
65
118
  const binaryPath = path.join(archRoot, "codex", codexBinaryName);
66
119
 
67
120
  // Use an asynchronous spawn instead of spawnSync so that Node is able to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-every/code",
3
- "version": "0.6.61",
3
+ "version": "0.6.63",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lightweight coding agent that runs in your terminal - fork of OpenAI Codex",
6
6
  "bin": {
@@ -35,10 +35,10 @@
35
35
  "prettier": "^3.3.3"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@just-every/code-darwin-arm64": "0.6.61",
39
- "@just-every/code-darwin-x64": "0.6.61",
40
- "@just-every/code-linux-x64-musl": "0.6.61",
41
- "@just-every/code-linux-arm64-musl": "0.6.61",
42
- "@just-every/code-win32-x64": "0.6.61"
38
+ "@just-every/code-darwin-arm64": "0.6.63",
39
+ "@just-every/code-darwin-x64": "0.6.63",
40
+ "@just-every/code-linux-x64-musl": "0.6.63",
41
+ "@just-every/code-linux-arm64-musl": "0.6.63",
42
+ "@just-every/code-win32-x64": "0.6.63"
43
43
  }
44
44
  }