@just-every/code 0.2.36 → 0.2.37

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/package.json +8 -1
  2. package/postinstall.js +41 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-every/code",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lightweight coding agent that runs in your terminal - fork of OpenAI Codex",
6
6
  "bin": {
@@ -33,5 +33,12 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "prettier": "^3.3.3"
36
+ },
37
+ "optionalDependencies": {
38
+ "@just-every/code-darwin-arm64": "0.2.37",
39
+ "@just-every/code-darwin-x64": "0.2.37",
40
+ "@just-every/code-linux-x64-musl": "0.2.37",
41
+ "@just-every/code-linux-arm64-musl": "0.2.37",
42
+ "@just-every/code-win32-x64": "0.2.37"
36
43
  }
37
44
  }
package/postinstall.js CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  // Non-functional change to trigger release workflow
3
3
 
4
- import { existsSync, mkdirSync, createWriteStream, chmodSync, readFileSync, readSync, writeFileSync, unlinkSync, statSync, openSync, closeSync } from 'fs';
4
+ import { existsSync, mkdirSync, createWriteStream, chmodSync, readFileSync, readSync, writeFileSync, unlinkSync, statSync, openSync, closeSync, copyFileSync } from 'fs';
5
5
  import { join, dirname } from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
  import { get } from 'https';
8
8
  import { platform, arch } from 'os';
9
9
  import { execSync } from 'child_process';
10
+ import { createRequire } from 'module';
10
11
 
11
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
13
 
@@ -211,6 +212,45 @@ async function main() {
211
212
  continue;
212
213
  }
213
214
 
215
+ // First try platform package via npm optionalDependencies (fast path on npm CDN).
216
+ const require = createRequire(import.meta.url);
217
+ const platformPkg = (() => {
218
+ const name = (() => {
219
+ if (isWindows) return '@just-every/code-win32-x64';
220
+ const plt = platform();
221
+ const cpu = arch();
222
+ if (plt === 'darwin' && cpu === 'arm64') return '@just-every/code-darwin-arm64';
223
+ if (plt === 'darwin' && cpu === 'x64') return '@just-every/code-darwin-x64';
224
+ if (plt === 'linux' && cpu === 'x64') return '@just-every/code-linux-x64-musl';
225
+ if (plt === 'linux' && cpu === 'arm64') return '@just-every/code-linux-arm64-musl';
226
+ return null;
227
+ })();
228
+ if (!name) return null;
229
+ try {
230
+ const pkgJsonPath = require.resolve(`${name}/package.json`);
231
+ const pkgDir = dirname(pkgJsonPath);
232
+ return { name, dir: pkgDir };
233
+ } catch {
234
+ return null;
235
+ }
236
+ })();
237
+
238
+ if (platformPkg) {
239
+ try {
240
+ // Expect binary inside platform package bin directory
241
+ const src = join(platformPkg.dir, 'bin', binaryName);
242
+ if (!existsSync(src)) {
243
+ throw new Error(`platform package missing binary: ${platformPkg.name}`);
244
+ }
245
+ copyFileSync(src, localPath);
246
+ if (!isWindows) chmodSync(localPath, 0o755);
247
+ console.log(`✓ Installed ${binaryName} from ${platformPkg.name}`);
248
+ continue; // next binary
249
+ } catch (e) {
250
+ console.warn(`⚠ Failed platform package install (${e.message}), falling back to GitHub download`);
251
+ }
252
+ }
253
+
214
254
  // Decide archive format per OS with fallback on macOS/Linux:
215
255
  // - Windows: .zip
216
256
  // - macOS/Linux: prefer .zst if `zstd` CLI is available; otherwise use .tar.gz