xyne-code 1.2.32 → 1.2.34
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/xyne +6 -1
- package/install.js +67 -15
- package/package.json +2 -2
package/bin/xyne
CHANGED
|
@@ -14,9 +14,14 @@ const PLATFORM_PACKAGES = {
|
|
|
14
14
|
|
|
15
15
|
function getBinaryPath() {
|
|
16
16
|
// Check if postinstall already placed the binary next to this script
|
|
17
|
-
const
|
|
17
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
18
|
+
const local = path.join(__dirname, "xyne-binary" + ext);
|
|
18
19
|
if (fs.existsSync(local)) return local;
|
|
19
20
|
|
|
21
|
+
// Also check without extension (backwards compat)
|
|
22
|
+
const localNoExt = path.join(__dirname, "xyne-binary");
|
|
23
|
+
if (fs.existsSync(localNoExt)) return localNoExt;
|
|
24
|
+
|
|
20
25
|
// Resolve from platform-specific optional dependency
|
|
21
26
|
const key = `${process.platform}-${process.arch}`;
|
|
22
27
|
const pkg = PLATFORM_PACKAGES[key];
|
package/install.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// Postinstall: try to copy the platform binary next to the wrapper for faster startup.
|
|
4
|
-
// If this fails, the wrapper script falls back to resolving at runtime.
|
|
5
|
-
|
|
6
3
|
const path = require("path");
|
|
7
4
|
const fs = require("fs");
|
|
5
|
+
const { execSync } = require("child_process");
|
|
8
6
|
|
|
9
7
|
const PLATFORM_PACKAGES = {
|
|
10
8
|
"darwin-arm64": "xyne-code-darwin-arm64",
|
|
@@ -25,27 +23,81 @@ function tryMusl() {
|
|
|
25
23
|
return null;
|
|
26
24
|
}
|
|
27
25
|
|
|
26
|
+
function findBinaryFromOptionalDep(pkg) {
|
|
27
|
+
try {
|
|
28
|
+
const dir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
29
|
+
const bin = path.join(dir, "bin", process.platform === "win32" ? "xyne.exe" : "xyne");
|
|
30
|
+
if (fs.existsSync(bin)) return bin;
|
|
31
|
+
} catch {}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function installPlatformPackage(pkg) {
|
|
36
|
+
const binDir = path.join(__dirname, "bin");
|
|
37
|
+
const destName = process.platform === "win32" ? "xyne-binary.exe" : "xyne-binary";
|
|
38
|
+
const dest = path.join(binDir, destName);
|
|
39
|
+
|
|
40
|
+
// Try to install the platform package into a temp dir and copy the binary
|
|
41
|
+
const tmpDir = path.join(__dirname, ".platform-tmp");
|
|
42
|
+
try {
|
|
43
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
44
|
+
execSync(`npm install --no-save --prefix "${tmpDir}" ${pkg}@${getVersion()}`, {
|
|
45
|
+
stdio: "ignore",
|
|
46
|
+
timeout: 60000,
|
|
47
|
+
});
|
|
48
|
+
const binSrc = path.join(
|
|
49
|
+
tmpDir, "node_modules", pkg, "bin",
|
|
50
|
+
process.platform === "win32" ? "xyne.exe" : "xyne"
|
|
51
|
+
);
|
|
52
|
+
if (fs.existsSync(binSrc)) {
|
|
53
|
+
fs.copyFileSync(binSrc, dest);
|
|
54
|
+
try { fs.chmodSync(dest, 0o755); } catch {}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// Silent fail — will error at runtime
|
|
59
|
+
} finally {
|
|
60
|
+
// Cleanup temp dir
|
|
61
|
+
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch {}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getVersion() {
|
|
67
|
+
try {
|
|
68
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf-8"));
|
|
69
|
+
return pkg.version || "latest";
|
|
70
|
+
} catch {
|
|
71
|
+
return "latest";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
28
75
|
function install() {
|
|
29
76
|
const key = `${process.platform}-${process.arch}`;
|
|
30
77
|
const pkg = PLATFORM_PACKAGES[key];
|
|
31
|
-
|
|
78
|
+
const binDir = path.join(__dirname, "bin");
|
|
79
|
+
const destName = process.platform === "win32" ? "xyne-binary.exe" : "xyne-binary";
|
|
80
|
+
const dest = path.join(binDir, destName);
|
|
32
81
|
|
|
33
|
-
|
|
82
|
+
// 1. Try from optional dependency (already installed)
|
|
83
|
+
let src = pkg ? findBinaryFromOptionalDep(pkg) : null;
|
|
84
|
+
if (!src) src = tryMusl();
|
|
85
|
+
|
|
86
|
+
if (src) {
|
|
34
87
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
88
|
+
fs.copyFileSync(src, dest);
|
|
89
|
+
try { fs.chmodSync(dest, 0o755); } catch {}
|
|
90
|
+
return;
|
|
38
91
|
} catch {}
|
|
39
92
|
}
|
|
40
93
|
|
|
41
|
-
|
|
42
|
-
if (
|
|
94
|
+
// 2. Optional dep not found — install it explicitly (common with npm global installs)
|
|
95
|
+
if (pkg) {
|
|
96
|
+
console.log(`Installing platform binary (${key})...`);
|
|
97
|
+
if (installPlatformPackage(pkg)) return;
|
|
98
|
+
}
|
|
43
99
|
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
fs.copyFileSync(src, dest);
|
|
47
|
-
fs.chmodSync(dest, 0o755);
|
|
48
|
-
} catch {}
|
|
100
|
+
// Will fall back to runtime resolution in the wrapper
|
|
49
101
|
}
|
|
50
102
|
|
|
51
103
|
install();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xyne-code",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.34",
|
|
4
4
|
"description": "Xyne — AI coding agent for your terminal",
|
|
5
5
|
"bin": {
|
|
6
6
|
"xyne": "bin/xyne"
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
"xyne-code-darwin-arm64": "1.2.32",
|
|
28
28
|
"xyne-code-windows-x64": "1.2.32"
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|