@newdefs/haltr 4.0.1
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/hal +18 -0
- package/install.js +81 -0
- package/package.json +22 -0
package/bin/hal
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const isWindows = process.platform === "win32";
|
|
7
|
+
const binName = isWindows ? "hal.exe" : "hal";
|
|
8
|
+
const binPath = path.join(__dirname, binName);
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
12
|
+
} catch (e) {
|
|
13
|
+
if (e.status !== undefined) {
|
|
14
|
+
process.exit(e.status);
|
|
15
|
+
}
|
|
16
|
+
console.error("hal binary not found. Try reinstalling: npm install -g @newdefs/haltr");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const { execSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const VERSION = require("./package.json").version;
|
|
9
|
+
const REPO = "shunyooo/haltr";
|
|
10
|
+
|
|
11
|
+
function getPlatformArtifact() {
|
|
12
|
+
const platform = process.platform;
|
|
13
|
+
const arch = process.arch;
|
|
14
|
+
|
|
15
|
+
const map = {
|
|
16
|
+
"linux-x64": "hal-linux-x64",
|
|
17
|
+
"linux-arm64": "hal-linux-arm64",
|
|
18
|
+
"darwin-x64": "hal-darwin-x64",
|
|
19
|
+
"darwin-arm64": "hal-darwin-arm64",
|
|
20
|
+
"win32-x64": "hal-win-x64.exe",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const key = `${platform}-${arch}`;
|
|
24
|
+
const artifact = map[key];
|
|
25
|
+
|
|
26
|
+
if (!artifact) {
|
|
27
|
+
console.error(`Unsupported platform: ${key}`);
|
|
28
|
+
console.error(`Supported: ${Object.keys(map).join(", ")}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return artifact;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function download(url) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
https.get(url, { headers: { "User-Agent": "haltr-installer" } }, (res) => {
|
|
38
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
39
|
+
return download(res.headers.location).then(resolve).catch(reject);
|
|
40
|
+
}
|
|
41
|
+
if (res.statusCode !== 200) {
|
|
42
|
+
return reject(new Error(`HTTP ${res.statusCode}: ${url}`));
|
|
43
|
+
}
|
|
44
|
+
const chunks = [];
|
|
45
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
46
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
47
|
+
res.on("error", reject);
|
|
48
|
+
}).on("error", reject);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function main() {
|
|
53
|
+
const artifact = getPlatformArtifact();
|
|
54
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${artifact}`;
|
|
55
|
+
const binDir = path.join(__dirname, "bin");
|
|
56
|
+
const isWindows = process.platform === "win32";
|
|
57
|
+
const binPath = path.join(binDir, isWindows ? "hal.exe" : "hal");
|
|
58
|
+
|
|
59
|
+
// Skip if binary already exists
|
|
60
|
+
if (fs.existsSync(binPath)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log(`Downloading hal v${VERSION} for ${process.platform}-${process.arch}...`);
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const data = await download(url);
|
|
68
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
69
|
+
fs.writeFileSync(binPath, data);
|
|
70
|
+
if (!isWindows) {
|
|
71
|
+
fs.chmodSync(binPath, 0o755);
|
|
72
|
+
}
|
|
73
|
+
console.log("Done.");
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error(`Failed to download hal binary: ${err.message}`);
|
|
76
|
+
console.error(`URL: ${url}`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@newdefs/haltr",
|
|
3
|
+
"version": "4.0.1",
|
|
4
|
+
"description": "Quality assurance tool for coding agent outputs",
|
|
5
|
+
"bin": {
|
|
6
|
+
"hal": "bin/hal"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"install.js"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"coding-agent",
|
|
18
|
+
"quality-assurance",
|
|
19
|
+
"task-management",
|
|
20
|
+
"cli"
|
|
21
|
+
]
|
|
22
|
+
}
|