gadriel 0.10.11 → 0.10.13
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/README.md +17 -0
- package/bin/gadriel.cjs +171 -0
- package/package.json +11 -10
- package/bin/gadriel.js +0 -91
package/README.md
CHANGED
|
@@ -12,6 +12,23 @@ and an MCP server.
|
|
|
12
12
|
> **Platform support:** Linux x64 (glibc). macOS and Windows platform packages
|
|
13
13
|
> will follow in the next release.
|
|
14
14
|
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
**Node.js >= 18.** Do not use the `apt` `nodejs` package on Ubuntu/Debian — it ships Node 12 and is too old. Use [nvm](https://github.com/nvm-sh/nvm):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# On a bare VM you may need curl first: sudo apt install -y curl
|
|
21
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
|
22
|
+
# Restart your shell, then:
|
|
23
|
+
nvm install --lts
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Linux glibc >= 2.35.** The prebuilt binary requires Ubuntu 22.04+, Debian 12+, RHEL 9+, or Amazon Linux 2023+. Older distros (Ubuntu 20.04, Debian 11, CentOS 7) are not supported.
|
|
27
|
+
|
|
28
|
+
**Troubleshooting install failures:**
|
|
29
|
+
- `EACCES` on `npm install -g` — you're on a system Node with a root-owned prefix. Do not use `sudo`. Switch to nvm (above) and reinstall.
|
|
30
|
+
- `GLIBC_2.x not found` — your OS is too old; see glibc requirement above.
|
|
31
|
+
|
|
15
32
|
## Install
|
|
16
33
|
|
|
17
34
|
```bash
|
package/bin/gadriel.cjs
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Gadriel CLI launcher.
|
|
3
|
+
//
|
|
4
|
+
// At install time, npm picks exactly one of the five
|
|
5
|
+
// `@gadriel/cli-<platform>-<arch>` packages declared as
|
|
6
|
+
// optionalDependencies — the one whose `os` + `cpu` fields in its
|
|
7
|
+
// package.json match the host. This shim resolves that package, finds
|
|
8
|
+
// its bundled binary, and execs it with stdio inherited.
|
|
9
|
+
//
|
|
10
|
+
// This file is intentionally CommonJS (.cjs) and uses only ES5-safe
|
|
11
|
+
// syntax (no ??, no ?., no import) so that it PARSES correctly on any
|
|
12
|
+
// Node version and can always print a friendly prerequisite error.
|
|
13
|
+
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
var spawnSync = require("child_process").spawnSync;
|
|
17
|
+
var existsSync = require("fs").existsSync;
|
|
18
|
+
var path = require("path");
|
|
19
|
+
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// 1. NODE VERSION CHECK — must be first; must use only ES5 syntax so it
|
|
22
|
+
// runs even on Node 12 where ?? / ?. / ESM cause parse failures.
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
var rawNodeVersion = process.versions.node; // e.g. "12.22.1"
|
|
25
|
+
var nodeMajor = parseInt(rawNodeVersion.split(".")[0], 10);
|
|
26
|
+
if (nodeMajor < 18) {
|
|
27
|
+
process.stderr.write(
|
|
28
|
+
"gadriel: Node.js >= 18 is required (you have v" + rawNodeVersion + ").\n" +
|
|
29
|
+
" Your Node is too old. Install a current version with nvm:\n" +
|
|
30
|
+
" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash\n" +
|
|
31
|
+
" nvm install --lts\n" +
|
|
32
|
+
" Then re-run: npm install -g gadriel\n"
|
|
33
|
+
);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// 2. PLATFORM / ARCH CHECK
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
var SUPPORTED = {
|
|
41
|
+
"linux-x64": { pkg: "@gadriel/cli-linux-x64", ext: "" },
|
|
42
|
+
"linux-arm64": { pkg: "@gadriel/cli-linux-arm64", ext: "" },
|
|
43
|
+
"darwin-x64": { pkg: "@gadriel/cli-darwin-x64", ext: "" },
|
|
44
|
+
"darwin-arm64": { pkg: "@gadriel/cli-darwin-arm64", ext: "" },
|
|
45
|
+
"win32-x64": { pkg: "@gadriel/cli-win32-x64", ext: ".exe" },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var key = process.platform + "-" + process.arch;
|
|
49
|
+
var target = SUPPORTED[key];
|
|
50
|
+
|
|
51
|
+
if (!target) {
|
|
52
|
+
process.stderr.write(
|
|
53
|
+
"gadriel: unsupported platform \"" + key + "\". Supported: " +
|
|
54
|
+
Object.keys(SUPPORTED).join(", ") + ".\n" +
|
|
55
|
+
"If you need this platform, please open an issue:\n" +
|
|
56
|
+
" https://github.com/Gadriel-ai/preflight/issues\n"
|
|
57
|
+
);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// 3. PLATFORM PACKAGE RESOLUTION
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
var pkgRoot;
|
|
65
|
+
try {
|
|
66
|
+
var pkgJson = require.resolve(target.pkg + "/package.json");
|
|
67
|
+
pkgRoot = path.dirname(pkgJson);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
process.stderr.write(
|
|
70
|
+
"gadriel: platform package \"" + target.pkg + "\" was not installed.\n" +
|
|
71
|
+
"\n" +
|
|
72
|
+
"This usually means npm skipped optionalDependencies. Re-install with:\n" +
|
|
73
|
+
" npm install gadriel --include=optional\n" +
|
|
74
|
+
"\n" +
|
|
75
|
+
"Or install the platform package directly:\n" +
|
|
76
|
+
" npm install -g " + target.pkg + "\n"
|
|
77
|
+
);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// 4. BINARY EXISTS CHECK
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
var binPath = path.join(pkgRoot, "bin", "gadriel" + target.ext);
|
|
85
|
+
if (!existsSync(binPath)) {
|
|
86
|
+
process.stderr.write(
|
|
87
|
+
"gadriel: binary missing at " + binPath + ".\n" +
|
|
88
|
+
"Reinstall: npm install -g gadriel --force --include=optional\n"
|
|
89
|
+
);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// 5. GLIBC VERSION CHECK (Linux only)
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
var GLIBC_REQUIRED_MAJOR = 2;
|
|
97
|
+
var GLIBC_REQUIRED_MINOR = 35;
|
|
98
|
+
|
|
99
|
+
function glibcTooOld(versionStr) {
|
|
100
|
+
// versionStr is e.g. "2.17" or "2.35"
|
|
101
|
+
var parts = versionStr.split(".");
|
|
102
|
+
var major = parseInt(parts[0], 10);
|
|
103
|
+
var minor = parseInt(parts[1] || "0", 10);
|
|
104
|
+
if (major !== GLIBC_REQUIRED_MAJOR) {
|
|
105
|
+
return major < GLIBC_REQUIRED_MAJOR;
|
|
106
|
+
}
|
|
107
|
+
return minor < GLIBC_REQUIRED_MINOR;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function glibcErrorMessage(detected) {
|
|
111
|
+
return (
|
|
112
|
+
"gadriel: glibc >= 2.35 is required, but this system has glibc " + detected + ".\n" +
|
|
113
|
+
" Gadriel's Linux binary needs Ubuntu 22.04+ / Debian 12+ / RHEL 9+ (or a newer container).\n" +
|
|
114
|
+
" Please upgrade your OS, or run Gadriel inside a newer base image.\n"
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (process.platform === "linux") {
|
|
119
|
+
var glibc = null;
|
|
120
|
+
try {
|
|
121
|
+
var report = process.report.getReport();
|
|
122
|
+
var glibcRaw = report && report.header && report.header.glibcVersionRuntime;
|
|
123
|
+
if (typeof glibcRaw === "string" && glibcRaw.length > 0) {
|
|
124
|
+
glibc = glibcRaw;
|
|
125
|
+
}
|
|
126
|
+
} catch (e) {
|
|
127
|
+
// process.report not available or failed — skip check
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (glibc !== null && glibcTooOld(glibc)) {
|
|
131
|
+
process.stderr.write(glibcErrorMessage(glibc));
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// 6. SPAWN
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
var result = spawnSync(binPath, process.argv.slice(2), {
|
|
140
|
+
stdio: "inherit",
|
|
141
|
+
env: process.env,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (result.error) {
|
|
145
|
+
if (result.error.code === "EACCES") {
|
|
146
|
+
process.stderr.write(
|
|
147
|
+
"gadriel: binary at " + binPath + " is not executable.\n" +
|
|
148
|
+
"Try: chmod +x \"" + binPath + "\"\n" +
|
|
149
|
+
"Or reinstall: npm install -g gadriel --force --include=optional\n"
|
|
150
|
+
);
|
|
151
|
+
} else if (
|
|
152
|
+
result.error.code === "ENOEXEC" ||
|
|
153
|
+
(result.error.message && result.error.message.indexOf("GLIBC") !== -1)
|
|
154
|
+
) {
|
|
155
|
+
// Best-effort: linker refused the binary — likely a glibc mismatch.
|
|
156
|
+
var detected = "unknown";
|
|
157
|
+
try {
|
|
158
|
+
var r2 = process.report.getReport();
|
|
159
|
+
var raw2 = r2 && r2.header && r2.header.glibcVersionRuntime;
|
|
160
|
+
if (typeof raw2 === "string" && raw2.length > 0) {
|
|
161
|
+
detected = raw2;
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {}
|
|
164
|
+
process.stderr.write(glibcErrorMessage(detected));
|
|
165
|
+
} else {
|
|
166
|
+
process.stderr.write("gadriel: failed to spawn binary: " + result.error.message + "\n");
|
|
167
|
+
}
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
process.exit(result.status != null ? result.status : 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gadriel",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.13",
|
|
4
4
|
"description": "Gadriel - Code-security CLI for AI-assisted development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"security",
|
|
@@ -21,24 +21,25 @@
|
|
|
21
21
|
"author": "Gadriel team",
|
|
22
22
|
"type": "module",
|
|
23
23
|
"bin": {
|
|
24
|
-
"gadriel": "bin/gadriel.
|
|
24
|
+
"gadriel": "bin/gadriel.cjs"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
|
-
"bin/gadriel.
|
|
27
|
+
"bin/gadriel.cjs",
|
|
28
28
|
"scripts/postinstall.js",
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"postinstall": "node scripts/postinstall.js || true"
|
|
32
|
+
"postinstall": "node scripts/postinstall.js || true",
|
|
33
|
+
"test": "node --test test/shim.test.cjs"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
36
|
+
"node": ">=18"
|
|
36
37
|
},
|
|
37
38
|
"optionalDependencies": {
|
|
38
|
-
"@gadriel/cli-linux-x64": "0.10.
|
|
39
|
-
"@gadriel/cli-linux-arm64": "0.10.
|
|
40
|
-
"@gadriel/cli-darwin-x64": "0.10.
|
|
41
|
-
"@gadriel/cli-darwin-arm64": "0.10.
|
|
42
|
-
"@gadriel/cli-win32-x64": "0.10.
|
|
39
|
+
"@gadriel/cli-linux-x64": "0.10.13",
|
|
40
|
+
"@gadriel/cli-linux-arm64": "0.10.13",
|
|
41
|
+
"@gadriel/cli-darwin-x64": "0.10.13",
|
|
42
|
+
"@gadriel/cli-darwin-arm64": "0.10.13",
|
|
43
|
+
"@gadriel/cli-win32-x64": "0.10.13"
|
|
43
44
|
}
|
|
44
45
|
}
|
package/bin/gadriel.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Gadriel CLI launcher.
|
|
3
|
-
//
|
|
4
|
-
// At install time, npm picks exactly one of the five
|
|
5
|
-
// `@gadriel/cli-<platform>-<arch>` packages declared as
|
|
6
|
-
// optionalDependencies — the one whose `os` + `cpu` fields in its
|
|
7
|
-
// package.json match the host. This shim resolves that package, finds
|
|
8
|
-
// its bundled binary, and execs it with stdio inherited.
|
|
9
|
-
|
|
10
|
-
import { spawnSync } from "node:child_process";
|
|
11
|
-
import { createRequire } from "node:module";
|
|
12
|
-
import { existsSync } from "node:fs";
|
|
13
|
-
import { fileURLToPath } from "node:url";
|
|
14
|
-
import { dirname, join } from "node:path";
|
|
15
|
-
import { platform, arch, exit, argv, env } from "node:process";
|
|
16
|
-
|
|
17
|
-
const require = createRequire(import.meta.url);
|
|
18
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
|
|
20
|
-
// Map Node's platform/arch to our npm-package suffix. Anything outside
|
|
21
|
-
// the matrix here is genuinely unsupported (e.g. linux-mips, freebsd).
|
|
22
|
-
const SUPPORTED = {
|
|
23
|
-
"linux-x64": { pkg: "@gadriel/cli-linux-x64", ext: "" },
|
|
24
|
-
"linux-arm64": { pkg: "@gadriel/cli-linux-arm64", ext: "" },
|
|
25
|
-
"darwin-x64": { pkg: "@gadriel/cli-darwin-x64", ext: "" },
|
|
26
|
-
"darwin-arm64": { pkg: "@gadriel/cli-darwin-arm64", ext: "" },
|
|
27
|
-
"win32-x64": { pkg: "@gadriel/cli-win32-x64", ext: ".exe" },
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const key = `${platform}-${arch}`;
|
|
31
|
-
const target = SUPPORTED[key];
|
|
32
|
-
|
|
33
|
-
if (!target) {
|
|
34
|
-
console.error(
|
|
35
|
-
`gadriel: unsupported platform "${key}". Supported: ${Object.keys(SUPPORTED).join(", ")}.\n` +
|
|
36
|
-
`If you need this platform, please open an issue:\n` +
|
|
37
|
-
` https://github.com/Gadriel-ai/preflight/issues`
|
|
38
|
-
);
|
|
39
|
-
exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Resolve the platform package's directory by asking Node for its
|
|
43
|
-
// package.json — works whether npm hoisted it or kept it nested.
|
|
44
|
-
let pkgRoot;
|
|
45
|
-
try {
|
|
46
|
-
const pkgJson = require.resolve(`${target.pkg}/package.json`);
|
|
47
|
-
pkgRoot = dirname(pkgJson);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.error(
|
|
50
|
-
`gadriel: platform package "${target.pkg}" was not installed.\n` +
|
|
51
|
-
`\n` +
|
|
52
|
-
`This usually means npm skipped optionalDependencies. Re-install with:\n` +
|
|
53
|
-
` npm install gadriel --include=optional\n` +
|
|
54
|
-
`\n` +
|
|
55
|
-
`Or install the platform package directly:\n` +
|
|
56
|
-
` npm install -g ${target.pkg}\n`
|
|
57
|
-
);
|
|
58
|
-
exit(1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const binPath = join(pkgRoot, "bin", `gadriel${target.ext}`);
|
|
62
|
-
if (!existsSync(binPath)) {
|
|
63
|
-
console.error(
|
|
64
|
-
`gadriel: binary missing at ${binPath}.\n` +
|
|
65
|
-
`Reinstall: npm install -g gadriel --force --include=optional`
|
|
66
|
-
);
|
|
67
|
-
exit(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Exec the binary with the user's args. stdio inherited so prompts /
|
|
71
|
-
// progress bars / colors work normally. spawnSync returns control with
|
|
72
|
-
// the child's exit code, which we propagate.
|
|
73
|
-
const result = spawnSync(binPath, argv.slice(2), {
|
|
74
|
-
stdio: "inherit",
|
|
75
|
-
env,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (result.error) {
|
|
79
|
-
if (result.error.code === "EACCES") {
|
|
80
|
-
console.error(
|
|
81
|
-
`gadriel: binary at ${binPath} is not executable.\n` +
|
|
82
|
-
`Try: chmod +x "${binPath}"\n` +
|
|
83
|
-
`Or reinstall: npm install -g gadriel --force --include=optional`
|
|
84
|
-
);
|
|
85
|
-
} else {
|
|
86
|
-
console.error(`gadriel: failed to spawn binary: ${result.error.message}`);
|
|
87
|
-
}
|
|
88
|
-
exit(1);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
exit(result.status ?? 1);
|