@just-every/code 0.4.8 → 0.4.10
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/coder.js +21 -6
- package/package.json +6 -6
- package/postinstall.js +27 -7
package/bin/coder.js
CHANGED
|
@@ -6,6 +6,7 @@ import { fileURLToPath } from "url";
|
|
|
6
6
|
import { platform as nodePlatform, arch as nodeArch } from "os";
|
|
7
7
|
import { execSync } from "child_process";
|
|
8
8
|
import { get as httpsGet } from "https";
|
|
9
|
+
import { runPostinstall } from "../postinstall.js";
|
|
9
10
|
|
|
10
11
|
// __dirname equivalent in ESM
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -270,12 +271,26 @@ const tryBootstrapBinary = async () => {
|
|
|
270
271
|
};
|
|
271
272
|
|
|
272
273
|
// If missing, attempt to bootstrap into place (helps when Bun blocks postinstall)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
let binaryReady = existsSync(binaryPath) || existsSync(legacyBinaryPath);
|
|
275
|
+
if (!binaryReady) {
|
|
276
|
+
let runtimePostinstallError = null;
|
|
277
|
+
try {
|
|
278
|
+
await runPostinstall({ invokedByRuntime: true, skipGlobalAlias: true });
|
|
279
|
+
} catch (err) {
|
|
280
|
+
runtimePostinstallError = err;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
binaryReady = existsSync(binaryPath) || existsSync(legacyBinaryPath);
|
|
284
|
+
if (!binaryReady) {
|
|
285
|
+
const ok = await tryBootstrapBinary();
|
|
286
|
+
if (!ok) {
|
|
287
|
+
if (runtimePostinstallError && !lastBootstrapError) {
|
|
288
|
+
lastBootstrapError = runtimePostinstallError;
|
|
289
|
+
}
|
|
290
|
+
// retry legacy name in case archive provided coder-*
|
|
291
|
+
if (existsSync(legacyBinaryPath) && !existsSync(binaryPath)) {
|
|
292
|
+
binaryPath = legacyBinaryPath;
|
|
293
|
+
}
|
|
279
294
|
}
|
|
280
295
|
}
|
|
281
296
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@just-every/code",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
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.4.
|
|
39
|
-
"@just-every/code-darwin-x64": "0.4.
|
|
40
|
-
"@just-every/code-linux-x64-musl": "0.4.
|
|
41
|
-
"@just-every/code-linux-arm64-musl": "0.4.
|
|
42
|
-
"@just-every/code-win32-x64": "0.4.
|
|
38
|
+
"@just-every/code-darwin-arm64": "0.4.10",
|
|
39
|
+
"@just-every/code-darwin-x64": "0.4.10",
|
|
40
|
+
"@just-every/code-linux-x64-musl": "0.4.10",
|
|
41
|
+
"@just-every/code-linux-arm64-musl": "0.4.10",
|
|
42
|
+
"@just-every/code-win32-x64": "0.4.10"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/postinstall.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Non-functional change to trigger release workflow
|
|
3
3
|
|
|
4
4
|
import { existsSync, mkdirSync, createWriteStream, chmodSync, readFileSync, readSync, writeFileSync, unlinkSync, statSync, openSync, closeSync, copyFileSync, fsyncSync, renameSync, realpathSync } from 'fs';
|
|
5
|
-
import { join, dirname } from 'path';
|
|
5
|
+
import { join, dirname, resolve } from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
7
|
import { get } from 'https';
|
|
8
8
|
import { platform, arch, tmpdir } from 'os';
|
|
@@ -288,13 +288,21 @@ function validateDownloadedBinary(p) {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
async function
|
|
291
|
+
export async function runPostinstall(options = {}) {
|
|
292
|
+
const { skipGlobalAlias = false, invokedByRuntime = false } = options;
|
|
293
|
+
if (process.env.CODE_POSTINSTALL_DRY_RUN === '1') {
|
|
294
|
+
return { skipped: true };
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (invokedByRuntime) {
|
|
298
|
+
process.env.CODE_RUNTIME_POSTINSTALL = process.env.CODE_RUNTIME_POSTINSTALL || '1';
|
|
299
|
+
}
|
|
292
300
|
// Detect potential PATH conflict with an existing `code` command (e.g., VS Code)
|
|
293
301
|
// Only relevant for global installs; skip for npx/local installs to keep postinstall fast.
|
|
294
302
|
const ua = process.env.npm_config_user_agent || '';
|
|
295
303
|
const isNpx = ua.includes('npx');
|
|
296
304
|
const isGlobal = process.env.npm_config_global === 'true';
|
|
297
|
-
if (isGlobal && !isNpx) {
|
|
305
|
+
if (!skipGlobalAlias && isGlobal && !isNpx) {
|
|
298
306
|
try {
|
|
299
307
|
const whichCmd = process.platform === 'win32' ? 'where code' : 'command -v code || which code || true';
|
|
300
308
|
const resolved = execSync(whichCmd, { stdio: ['ignore', 'pipe', 'ignore'], shell: process.platform !== 'win32' }).toString().split(/\r?\n/).filter(Boolean)[0];
|
|
@@ -760,7 +768,19 @@ async function main() {
|
|
|
760
768
|
}
|
|
761
769
|
}
|
|
762
770
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
771
|
+
function isExecutedDirectly() {
|
|
772
|
+
const entry = process.argv[1];
|
|
773
|
+
if (!entry) return false;
|
|
774
|
+
try {
|
|
775
|
+
return resolve(entry) === fileURLToPath(import.meta.url);
|
|
776
|
+
} catch {
|
|
777
|
+
return false;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
if (isExecutedDirectly()) {
|
|
782
|
+
runPostinstall().catch(error => {
|
|
783
|
+
console.error('Installation failed:', error);
|
|
784
|
+
process.exit(1);
|
|
785
|
+
});
|
|
786
|
+
}
|