@grentu/grentu 0.1.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/grentu.js +41 -0
- package/package.json +25 -0
package/bin/grentu.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
function findBinary() {
|
|
7
|
+
const isWin = process.platform === "win32";
|
|
8
|
+
const exe = isWin ? "grentu.exe" : "grentu";
|
|
9
|
+
const triplePkg = `@grentu/grentu-${process.platform}-${process.arch}`;
|
|
10
|
+
const candidates = [];
|
|
11
|
+
try {
|
|
12
|
+
candidates.push(require.resolve(`${triplePkg}/${exe}`));
|
|
13
|
+
} catch {}
|
|
14
|
+
const pkgDir = path.resolve(__dirname, "..");
|
|
15
|
+
candidates.push(path.join(pkgDir, "binaries", exe));
|
|
16
|
+
candidates.push(path.join(pkgDir, "..", "..", "target", "release", exe));
|
|
17
|
+
candidates.push(path.join(pkgDir, "..", "..", "target", "debug", exe));
|
|
18
|
+
for (const c of candidates) {
|
|
19
|
+
try {
|
|
20
|
+
if (fs.existsSync(c)) return c;
|
|
21
|
+
} catch {}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const bin = findBinary();
|
|
27
|
+
if (!bin) {
|
|
28
|
+
process.stderr.write(
|
|
29
|
+
"grentu: CLI binary not found for " +
|
|
30
|
+
process.platform + "-" + process.arch + ".\n" +
|
|
31
|
+
"Install the matching per-platform package or build from source:\n" +
|
|
32
|
+
" cargo build --release -p grentu-cli\n"
|
|
33
|
+
);
|
|
34
|
+
process.exit(127);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
38
|
+
child.on("exit", (code, signal) => {
|
|
39
|
+
if (signal) process.kill(process.pid, signal);
|
|
40
|
+
else process.exit(code ?? 1);
|
|
41
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grentu/grentu",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Grentu Code — terminal AI coding agent (Rust).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/grentu/GrentuCode.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"grentu": "bin/grentu.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/"
|
|
15
|
+
],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@grentu/grentu-win32-x64": "0.1.0"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
}
|
|
25
|
+
}
|