xyne-code 1.0.0
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 +58 -0
- package/install.js +51 -0
- package/package.json +29 -0
package/bin/xyne
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
const PLATFORM_PACKAGES = {
|
|
8
|
+
"darwin-arm64": "@xyne-code/darwin-arm64",
|
|
9
|
+
"darwin-x64": "@xyne-code/darwin-x64",
|
|
10
|
+
"linux-arm64": "@xyne-code/linux-arm64",
|
|
11
|
+
"linux-x64": "@xyne-code/linux-x64",
|
|
12
|
+
"win32-x64": "@xyne-code/windows-x64",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function getBinaryPath() {
|
|
16
|
+
// Check if postinstall already placed the binary next to this script
|
|
17
|
+
const local = path.join(__dirname, "xyne-binary");
|
|
18
|
+
if (fs.existsSync(local)) return local;
|
|
19
|
+
|
|
20
|
+
// Resolve from platform-specific optional dependency
|
|
21
|
+
const key = `${process.platform}-${process.arch}`;
|
|
22
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
23
|
+
|
|
24
|
+
if (!pkg) {
|
|
25
|
+
// Try musl for linux
|
|
26
|
+
if (process.platform === "linux") {
|
|
27
|
+
const musl = `@xyne-code/linux-${process.arch}-musl`;
|
|
28
|
+
try {
|
|
29
|
+
const dir = path.dirname(require.resolve(`${musl}/package.json`));
|
|
30
|
+
const bin = path.join(dir, "bin", "xyne");
|
|
31
|
+
if (fs.existsSync(bin)) return bin;
|
|
32
|
+
} catch {}
|
|
33
|
+
}
|
|
34
|
+
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const dir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
40
|
+
const bin = path.join(dir, "bin", process.platform === "win32" ? "xyne.exe" : "xyne");
|
|
41
|
+
if (fs.existsSync(bin)) return bin;
|
|
42
|
+
} catch {}
|
|
43
|
+
|
|
44
|
+
console.error(
|
|
45
|
+
`Could not find the xyne binary for ${process.platform}-${process.arch}.\n` +
|
|
46
|
+
`Try reinstalling: npm install -g xyne-code`
|
|
47
|
+
);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const binary = getBinaryPath();
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
55
|
+
} catch (e) {
|
|
56
|
+
if (e.status !== undefined) process.exit(e.status);
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
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
|
+
const path = require("path");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
|
|
9
|
+
const PLATFORM_PACKAGES = {
|
|
10
|
+
"darwin-arm64": "@xyne-code/darwin-arm64",
|
|
11
|
+
"darwin-x64": "@xyne-code/darwin-x64",
|
|
12
|
+
"linux-arm64": "@xyne-code/linux-arm64",
|
|
13
|
+
"linux-x64": "@xyne-code/linux-x64",
|
|
14
|
+
"win32-x64": "@xyne-code/windows-x64",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function tryMusl() {
|
|
18
|
+
if (process.platform !== "linux") return null;
|
|
19
|
+
const musl = `@xyne-code/linux-${process.arch}-musl`;
|
|
20
|
+
try {
|
|
21
|
+
const dir = path.dirname(require.resolve(`${musl}/package.json`));
|
|
22
|
+
const bin = path.join(dir, "bin", "xyne");
|
|
23
|
+
if (fs.existsSync(bin)) return bin;
|
|
24
|
+
} catch {}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function install() {
|
|
29
|
+
const key = `${process.platform}-${process.arch}`;
|
|
30
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
31
|
+
let src = null;
|
|
32
|
+
|
|
33
|
+
if (pkg) {
|
|
34
|
+
try {
|
|
35
|
+
const dir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
36
|
+
const bin = path.join(dir, "bin", process.platform === "win32" ? "xyne.exe" : "xyne");
|
|
37
|
+
if (fs.existsSync(bin)) src = bin;
|
|
38
|
+
} catch {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!src) src = tryMusl();
|
|
42
|
+
if (!src) return; // Will fall back to runtime resolution
|
|
43
|
+
|
|
44
|
+
const dest = path.join(__dirname, "bin", "xyne-binary");
|
|
45
|
+
try {
|
|
46
|
+
fs.copyFileSync(src, dest);
|
|
47
|
+
fs.chmodSync(dest, 0o755);
|
|
48
|
+
} catch {}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
install();
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xyne-code",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Xyne — AI coding agent for your terminal",
|
|
5
|
+
"bin": {
|
|
6
|
+
"xyne": "bin/xyne"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"install.js"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"xyne",
|
|
17
|
+
"ai",
|
|
18
|
+
"coding",
|
|
19
|
+
"agent",
|
|
20
|
+
"terminal",
|
|
21
|
+
"tui",
|
|
22
|
+
"cli"
|
|
23
|
+
],
|
|
24
|
+
"author": "Utkarsh Pandey",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@xyne-code/darwin-arm64": "1.0.0"
|
|
28
|
+
}
|
|
29
|
+
}
|