@just-every/code 0.2.123 → 0.2.125

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/coder.js +20 -8
  2. package/package.json +7 -7
package/bin/coder.js CHANGED
@@ -132,6 +132,8 @@ const getCachedBinaryPath = (version) => {
132
132
  return path.join(cacheDir, `code-${targetTriple}${ext}`);
133
133
  };
134
134
 
135
+ let lastBootstrapError = null;
136
+
135
137
  const httpsDownload = (url, dest) => new Promise((resolve, reject) => {
136
138
  const req = httpsGet(url, (res) => {
137
139
  const status = res.statusCode || 0;
@@ -223,9 +225,17 @@ const tryBootstrapBinary = async () => {
223
225
  return httpsDownload(url, tmp)
224
226
  .then(() => {
225
227
  if (isWin) {
228
+ // Extract zip with robust fallbacks and use a safe temp dir, then move to cache
226
229
  try {
227
- const ps = `powershell -NoProfile -NonInteractive -Command "Expand-Archive -Path '${tmp}' -DestinationPath '${binDir}' -Force"`;
228
- execSync(ps, { stdio: "ignore" });
230
+ const sysRoot = process.env.SystemRoot || process.env.windir || 'C:\\\Windows';
231
+ const psFull = path.join(sysRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe');
232
+ const unzipDest = getCacheDir(version); // extract directly to cache location
233
+ const psCmd = `Expand-Archive -Path '${tmp}' -DestinationPath '${unzipDest}' -Force`;
234
+ let ok = false;
235
+ try { execSync(`"${psFull}" -NoProfile -NonInteractive -Command "${psCmd}"`, { stdio: 'ignore' }); ok = true; } catch {}
236
+ if (!ok) { try { execSync(`powershell -NoProfile -NonInteractive -Command "${psCmd}"`, { stdio: 'ignore' }); ok = true; } catch {} }
237
+ if (!ok) { try { execSync(`pwsh -NoProfile -NonInteractive -Command "${psCmd}"`, { stdio: 'ignore' }); ok = true; } catch {} }
238
+ if (!ok) { execSync(`tar -xf "${tmp}" -C "${unzipDest}"`, { stdio: 'ignore', shell: true }); }
229
239
  } catch (e) {
230
240
  throw new Error(`failed to unzip: ${e.message}`);
231
241
  } finally { try { unlinkSync(tmp); } catch {} }
@@ -240,12 +250,10 @@ const tryBootstrapBinary = async () => {
240
250
  try { unlinkSync(tmp); } catch {}
241
251
  }
242
252
  }
243
- // On Windows, prefer cache and avoid leaving the executable in node_modules
253
+ // On Windows, the file was extracted directly into the cache dir
244
254
  if (platform === "win32") {
245
- try {
246
- copyFileSync(binaryPath, cachePath);
247
- } catch {}
248
- try { unlinkSync(binaryPath); } catch {}
255
+ // Ensure the expected filename exists in cache; Expand-Archive extracts exact name
256
+ // No action required here; validation occurs below against cachePath
249
257
  } else {
250
258
  try { copyFileSync(binaryPath, cachePath); } catch {}
251
259
  }
@@ -255,7 +263,7 @@ const tryBootstrapBinary = async () => {
255
263
  if (platform !== "win32") try { chmodSync(binaryPath, 0o755); } catch {}
256
264
  return true;
257
265
  })
258
- .catch((_e) => false);
266
+ .catch((e) => { lastBootstrapError = e; return false; });
259
267
  } catch {
260
268
  return false;
261
269
  }
@@ -301,6 +309,10 @@ if (existsSync(binaryPath)) {
301
309
  }
302
310
  } else {
303
311
  console.error(`Binary not found: ${binaryPath}`);
312
+ if (lastBootstrapError) {
313
+ const msg = (lastBootstrapError && (lastBootstrapError.message || String(lastBootstrapError))) || 'unknown bootstrap error';
314
+ console.error(`Bootstrap error: ${msg}`);
315
+ }
304
316
  console.error(`Please try reinstalling the package:`);
305
317
  console.error(` npm uninstall -g @just-every/code`);
306
318
  console.error(` npm install -g @just-every/code`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-every/code",
3
- "version": "0.2.123",
3
+ "version": "0.2.125",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lightweight coding agent that runs in your terminal - fork of OpenAI Codex",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "scripts": {
22
22
  "preinstall": "node scripts/preinstall.js",
23
23
  "postinstall": "node postinstall.js",
24
- "prepublishOnly": "node -e \"const fs=require('fs'),path=require('path'); const repoGit=path.join(__dirname,'..','.git'); const inCi=process.env.GITHUB_ACTIONS==='true'||process.env.CI==='true'; if(fs.existsSync(repoGit) && !inCi){ console.error('Refusing to publish from codex-cli. Use codex-cli/scripts/stage_release.sh to stage a release.'); process.exit(1);} else { console.log(inCi ? 'CI publish detected.' : 'Publishing staged package...'); }\""
24
+ "prepublishOnly": "node -e \"const fs=require('fs'),path=require('path'); const repoGit=path.join(__dirname,'..','.git'); const inCi=process.env.GITHUB_ACTIONS==='true'||process.env.CI==='true'; if(fs.existsSync(repoGit) && !inCi){ console.error('Refusing to publish from codex-cli. Publishing happens via release.yml.'); process.exit(1);} else { console.log(inCi ? 'CI publish detected.' : 'Publishing staged package...'); }\""
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
@@ -35,10 +35,10 @@
35
35
  "prettier": "^3.3.3"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@just-every/code-darwin-arm64": "0.2.123",
39
- "@just-every/code-darwin-x64": "0.2.123",
40
- "@just-every/code-linux-x64-musl": "0.2.123",
41
- "@just-every/code-linux-arm64-musl": "0.2.123",
42
- "@just-every/code-win32-x64": "0.2.123"
38
+ "@just-every/code-darwin-arm64": "0.2.125",
39
+ "@just-every/code-darwin-x64": "0.2.125",
40
+ "@just-every/code-linux-x64-musl": "0.2.125",
41
+ "@just-every/code-linux-arm64-musl": "0.2.125",
42
+ "@just-every/code-win32-x64": "0.2.125"
43
43
  }
44
44
  }