ai-rulez 5.13.2 → 5.13.3
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/ai-rulez.js +8 -1
- package/install.js +12 -12
- package/package.json +6 -6
package/ai-rulez.js
CHANGED
|
@@ -8,6 +8,13 @@ const { getPlatform, getBinaryName, resolveBundledBinary, isMusl } = require("./
|
|
|
8
8
|
function runBinary(binaryPath, args) {
|
|
9
9
|
const child = spawn(binaryPath, args, { stdio: "inherit" });
|
|
10
10
|
|
|
11
|
+
// Windows process termination bypasses JavaScript signal handlers.
|
|
12
|
+
if (process.platform !== "win32") {
|
|
13
|
+
for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {
|
|
14
|
+
process.on(signal, () => child.kill(signal));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
child.on("error", (error) => {
|
|
12
19
|
console.error(`Failed to run ai-rulez: ${error.message}`);
|
|
13
20
|
process.exit(1);
|
|
@@ -53,7 +60,7 @@ async function main() {
|
|
|
53
60
|
return;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
|
-
console.
|
|
63
|
+
console.error(
|
|
57
64
|
"First run detected - downloading ai-rulez binary...\n This will only happen once and takes a few seconds.\n",
|
|
58
65
|
);
|
|
59
66
|
const { install } = require("./install");
|
package/install.js
CHANGED
|
@@ -183,7 +183,7 @@ function usePackagedBinaryIfAvailable(os, arch, binaryName, binDir) {
|
|
|
183
183
|
fs.chmodSync(binaryPath, 0o755);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
console.
|
|
186
|
+
console.error(`Using packaged binary for ${os}/${arch} (${candidateName})`);
|
|
187
187
|
return true;
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -270,7 +270,7 @@ async function downloadBinary(url, dest, retryCount = 0) {
|
|
|
270
270
|
const error = new Error(`HTTP ${response.statusCode}: ${response.statusMessage}`);
|
|
271
271
|
|
|
272
272
|
if (retryCount < MAX_RETRIES) {
|
|
273
|
-
console.
|
|
273
|
+
console.error(
|
|
274
274
|
`Download failed, retrying in ${RETRY_DELAY / 1000}s... (${retryCount + 1}/${MAX_RETRIES})`,
|
|
275
275
|
);
|
|
276
276
|
setTimeout(() => {
|
|
@@ -301,7 +301,7 @@ async function downloadBinary(url, dest, retryCount = 0) {
|
|
|
301
301
|
reject(new Error("Downloaded file is empty"));
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
console.
|
|
304
|
+
console.error(`Downloaded ${downloadedBytes} bytes`);
|
|
305
305
|
resolve();
|
|
306
306
|
});
|
|
307
307
|
|
|
@@ -322,7 +322,7 @@ async function downloadBinary(url, dest, retryCount = 0) {
|
|
|
322
322
|
} catch {}
|
|
323
323
|
|
|
324
324
|
if (retryCount < MAX_RETRIES) {
|
|
325
|
-
console.
|
|
325
|
+
console.error(
|
|
326
326
|
`Download timeout, retrying in ${RETRY_DELAY / 1000}s... (${retryCount + 1}/${MAX_RETRIES})`,
|
|
327
327
|
);
|
|
328
328
|
setTimeout(() => {
|
|
@@ -343,7 +343,7 @@ async function downloadBinary(url, dest, retryCount = 0) {
|
|
|
343
343
|
} catch {}
|
|
344
344
|
|
|
345
345
|
if (retryCount < MAX_RETRIES) {
|
|
346
|
-
console.
|
|
346
|
+
console.error(
|
|
347
347
|
`Download error, retrying in ${RETRY_DELAY / 1000}s... (${retryCount + 1}/${MAX_RETRIES})`,
|
|
348
348
|
);
|
|
349
349
|
setTimeout(() => {
|
|
@@ -459,11 +459,11 @@ async function install(isPostInstall = false) {
|
|
|
459
459
|
const downloadUrl = `https://github.com/${REPO_NAME}/releases/download/v${version}/${archiveName}`;
|
|
460
460
|
const checksumUrl = `https://github.com/${REPO_NAME}/releases/download/v${version}/checksums.txt`;
|
|
461
461
|
|
|
462
|
-
console.
|
|
463
|
-
console.
|
|
462
|
+
console.error(`Downloading ai-rulez ${version} for ${os}/${arch}...`);
|
|
463
|
+
console.error(`URL: ${downloadUrl}`);
|
|
464
464
|
const archivePath = path.join(__dirname, archiveName);
|
|
465
465
|
|
|
466
|
-
console.
|
|
466
|
+
console.error("Downloading checksums...");
|
|
467
467
|
const checksumPath = path.join(__dirname, "checksums.txt");
|
|
468
468
|
try {
|
|
469
469
|
await downloadBinary(checksumUrl, checksumPath);
|
|
@@ -473,15 +473,15 @@ async function install(isPostInstall = false) {
|
|
|
473
473
|
|
|
474
474
|
await downloadBinary(downloadUrl, archivePath);
|
|
475
475
|
|
|
476
|
-
console.
|
|
476
|
+
console.error("Verifying checksum...");
|
|
477
477
|
try {
|
|
478
478
|
await verifyArchiveChecksum(archivePath, checksumPath, archiveName);
|
|
479
479
|
} finally {
|
|
480
480
|
fs.rmSync(checksumPath, { force: true });
|
|
481
481
|
}
|
|
482
|
-
console.
|
|
482
|
+
console.error("✓ Checksum verified");
|
|
483
483
|
|
|
484
|
-
console.
|
|
484
|
+
console.error("Extracting binary...");
|
|
485
485
|
|
|
486
486
|
const tempExtractDir = path.join(__dirname, ".extract-temp");
|
|
487
487
|
if (fs.existsSync(tempExtractDir)) {
|
|
@@ -547,7 +547,7 @@ async function install(isPostInstall = false) {
|
|
|
547
547
|
|
|
548
548
|
fs.unlinkSync(archivePath);
|
|
549
549
|
|
|
550
|
-
console.
|
|
550
|
+
console.error(`✅ ai-rulez ${version} installed successfully for ${os}/${arch}!`);
|
|
551
551
|
|
|
552
552
|
if (DEBUG) {
|
|
553
553
|
console.error(`[install.js] Installation complete`);
|
package/package.json
CHANGED
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
],
|
|
61
61
|
"name": "ai-rulez",
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"@ai-rulez/darwin-arm64": "5.13.
|
|
64
|
-
"@ai-rulez/darwin-x64": "5.13.
|
|
65
|
-
"@ai-rulez/linux-arm64": "5.13.
|
|
66
|
-
"@ai-rulez/linux-x64": "5.13.
|
|
67
|
-
"@ai-rulez/win32-x64": "5.13.
|
|
63
|
+
"@ai-rulez/darwin-arm64": "5.13.3",
|
|
64
|
+
"@ai-rulez/darwin-x64": "5.13.3",
|
|
65
|
+
"@ai-rulez/linux-arm64": "5.13.3",
|
|
66
|
+
"@ai-rulez/linux-x64": "5.13.3",
|
|
67
|
+
"@ai-rulez/win32-x64": "5.13.3"
|
|
68
68
|
},
|
|
69
69
|
"os": [
|
|
70
70
|
"darwin",
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
"type": "git",
|
|
76
76
|
"url": "https://github.com/Goldziher/ai-rulez.git"
|
|
77
77
|
},
|
|
78
|
-
"version": "5.13.
|
|
78
|
+
"version": "5.13.3",
|
|
79
79
|
"scripts": {}
|
|
80
80
|
}
|