@just-every/code 0.2.124 → 0.2.126

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 +17 -11
  2. package/package.json +6 -6
package/bin/coder.js CHANGED
@@ -126,10 +126,10 @@ const getCacheDir = (version) => {
126
126
  };
127
127
 
128
128
  const getCachedBinaryPath = (version) => {
129
- const isWin = nodePlatform() === "win32";
130
- const ext = isWin ? ".exe" : "";
129
+ // targetTriple already includes the proper extension on Windows ("...msvc.exe").
130
+ // Do not append another suffix; just use the exact targetTriple-derived name.
131
131
  const cacheDir = getCacheDir(version);
132
- return path.join(cacheDir, `code-${targetTriple}${ext}`);
132
+ return path.join(cacheDir, `code-${targetTriple}`);
133
133
  };
134
134
 
135
135
  let lastBootstrapError = null;
@@ -201,7 +201,7 @@ const tryBootstrapBinary = async () => {
201
201
  try {
202
202
  const pkgJson = req.resolve(`${name}/package.json`);
203
203
  const pkgDir = path.dirname(pkgJson);
204
- const src = path.join(pkgDir, "bin", `code-${targetTriple}${platform === "win32" ? ".exe" : ""}`);
204
+ const src = path.join(pkgDir, "bin", `code-${targetTriple}`);
205
205
  if (existsSync(src)) {
206
206
  // Always ensure cache has the binary; on Unix mirror into node_modules
207
207
  copyFileSync(src, cachePath);
@@ -225,9 +225,17 @@ const tryBootstrapBinary = async () => {
225
225
  return httpsDownload(url, tmp)
226
226
  .then(() => {
227
227
  if (isWin) {
228
+ // Extract zip with robust fallbacks and use a safe temp dir, then move to cache
228
229
  try {
229
- const ps = `powershell -NoProfile -NonInteractive -Command "Expand-Archive -Path '${tmp}' -DestinationPath '${binDir}' -Force"`;
230
- 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 }); }
231
239
  } catch (e) {
232
240
  throw new Error(`failed to unzip: ${e.message}`);
233
241
  } finally { try { unlinkSync(tmp); } catch {} }
@@ -242,12 +250,10 @@ const tryBootstrapBinary = async () => {
242
250
  try { unlinkSync(tmp); } catch {}
243
251
  }
244
252
  }
245
- // On Windows, prefer cache and avoid leaving the executable in node_modules
253
+ // On Windows, the file was extracted directly into the cache dir
246
254
  if (platform === "win32") {
247
- try {
248
- copyFileSync(binaryPath, cachePath);
249
- } catch {}
250
- 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
251
257
  } else {
252
258
  try { copyFileSync(binaryPath, cachePath); } catch {}
253
259
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-every/code",
3
- "version": "0.2.124",
3
+ "version": "0.2.126",
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.2.124",
39
- "@just-every/code-darwin-x64": "0.2.124",
40
- "@just-every/code-linux-x64-musl": "0.2.124",
41
- "@just-every/code-linux-arm64-musl": "0.2.124",
42
- "@just-every/code-win32-x64": "0.2.124"
38
+ "@just-every/code-darwin-arm64": "0.2.126",
39
+ "@just-every/code-darwin-x64": "0.2.126",
40
+ "@just-every/code-linux-x64-musl": "0.2.126",
41
+ "@just-every/code-linux-arm64-musl": "0.2.126",
42
+ "@just-every/code-win32-x64": "0.2.126"
43
43
  }
44
44
  }