ai-rulez 5.12.2 → 5.13.2
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 +5 -3
- package/ai-rulez.js +51 -21
- package/install.js +57 -0
- package/package.json +45 -38
package/README.md
CHANGED
|
@@ -25,9 +25,11 @@ Or run it without installing:
|
|
|
25
25
|
npx ai-rulez@latest init acme
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
The package is a thin launcher for the `ai-rulez` Go binary.
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
The package is a thin launcher for the `ai-rulez` Go binary. The binary for your platform (Linux and macOS on amd64
|
|
29
|
+
and arm64, Windows on amd64) arrives from the npm registry as an optional `@ai-rulez/<os>-<cpu>` dependency, so
|
|
30
|
+
installing needs no access beyond the registry. If that dependency is missing, for example after `--omit=optional`, the
|
|
31
|
+
launcher downloads the binary from the matching GitHub release on the first run and verifies its SHA-256 checksum.
|
|
32
|
+
Linux binaries need glibc; Alpine (musl) is not supported.
|
|
31
33
|
|
|
32
34
|
## Quickstart
|
|
33
35
|
|
package/ai-rulez.js
CHANGED
|
@@ -3,36 +3,66 @@
|
|
|
3
3
|
const { spawn } = require("node:child_process");
|
|
4
4
|
const path = require("node:path");
|
|
5
5
|
const fs = require("node:fs");
|
|
6
|
-
const { getPlatform, getBinaryName } = require("./install");
|
|
6
|
+
const { getPlatform, getBinaryName, resolveBundledBinary, isMusl } = require("./install");
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
const
|
|
8
|
+
function runBinary(binaryPath, args) {
|
|
9
|
+
const child = spawn(binaryPath, args, { stdio: "inherit" });
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
child.on("error", (error) => {
|
|
12
|
+
console.error(`Failed to run ai-rulez: ${error.message}`);
|
|
13
|
+
process.exit(1);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
child.on("close", (code) => {
|
|
17
|
-
|
|
16
|
+
child.on("close", (code, signal) => {
|
|
17
|
+
if (signal) {
|
|
18
|
+
const num = require("node:os").constants.signals[signal];
|
|
19
|
+
process.exit(num ? 128 + num : 1);
|
|
20
|
+
}
|
|
21
|
+
process.exit(code ?? 1);
|
|
18
22
|
});
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
async function main() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
console.
|
|
26
|
-
"
|
|
26
|
+
const args = process.argv.slice(2);
|
|
27
|
+
|
|
28
|
+
if (isMusl()) {
|
|
29
|
+
console.error(
|
|
30
|
+
"ai-rulez ships glibc-only Linux binaries; no musl (Alpine) build exists. " +
|
|
31
|
+
"Use a glibc-based image or build from source: https://github.com/Goldziher/ai-rulez",
|
|
27
32
|
);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const bundled = resolveBundledBinary();
|
|
37
|
+
if (bundled) {
|
|
38
|
+
runBinary(bundled, args);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let platform;
|
|
43
|
+
try {
|
|
44
|
+
platform = getPlatform();
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error(error.message);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const binaryPath = path.join(__dirname, "bin", getBinaryName(platform.os));
|
|
51
|
+
if (fs.existsSync(binaryPath)) {
|
|
52
|
+
runBinary(binaryPath, args);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log(
|
|
57
|
+
"First run detected - downloading ai-rulez binary...\n This will only happen once and takes a few seconds.\n",
|
|
58
|
+
);
|
|
59
|
+
const { install } = require("./install");
|
|
60
|
+
try {
|
|
61
|
+
await install(true);
|
|
62
|
+
runBinary(binaryPath, args);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error("Failed to install or run ai-rulez:", error);
|
|
65
|
+
process.exit(1);
|
|
36
66
|
}
|
|
37
67
|
}
|
|
38
68
|
|
package/install.js
CHANGED
|
@@ -99,6 +99,60 @@ function getPlatform() {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
const BUNDLED_PACKAGES = {
|
|
103
|
+
"linux-x64": "@ai-rulez/linux-x64",
|
|
104
|
+
"linux-arm64": "@ai-rulez/linux-arm64",
|
|
105
|
+
"darwin-x64": "@ai-rulez/darwin-x64",
|
|
106
|
+
"darwin-arm64": "@ai-rulez/darwin-arm64",
|
|
107
|
+
"win32-x64": "@ai-rulez/win32-x64",
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function bundledPackageName(platform, arch) {
|
|
111
|
+
return BUNDLED_PACKAGES[`${platform}-${arch}`] || null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function resolveBundledBinary({
|
|
115
|
+
platform = process.platform,
|
|
116
|
+
arch = process.arch,
|
|
117
|
+
resolve = require.resolve,
|
|
118
|
+
} = {}) {
|
|
119
|
+
const pkg = bundledPackageName(platform, arch);
|
|
120
|
+
if (!pkg) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
let pkgJson;
|
|
124
|
+
try {
|
|
125
|
+
pkgJson = resolve(`${pkg}/package.json`);
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const binary = path.join(
|
|
130
|
+
path.dirname(pkgJson),
|
|
131
|
+
"bin",
|
|
132
|
+
platform === "win32" ? "ai-rulez.exe" : "ai-rulez",
|
|
133
|
+
);
|
|
134
|
+
return fs.existsSync(binary) ? binary : null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function isMusl({
|
|
138
|
+
platform = process.platform,
|
|
139
|
+
report = () => process.report?.getReport?.(),
|
|
140
|
+
exists = fs.existsSync,
|
|
141
|
+
} = {}) {
|
|
142
|
+
if (platform !== "linux") {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const r = report();
|
|
147
|
+
if (r?.header) {
|
|
148
|
+
return r.header.glibcVersionRuntime === undefined;
|
|
149
|
+
}
|
|
150
|
+
} catch {
|
|
151
|
+
// fall through to the Alpine marker
|
|
152
|
+
}
|
|
153
|
+
return exists("/etc/alpine-release");
|
|
154
|
+
}
|
|
155
|
+
|
|
102
156
|
function getBinaryName(platform) {
|
|
103
157
|
return platform === "windows" ? "ai-rulez-bin.exe" : "ai-rulez-bin";
|
|
104
158
|
}
|
|
@@ -521,6 +575,9 @@ if (typeof module !== "undefined" && module.exports) {
|
|
|
521
575
|
module.exports = {
|
|
522
576
|
getPlatform,
|
|
523
577
|
getBinaryName,
|
|
578
|
+
bundledPackageName,
|
|
579
|
+
resolveBundledBinary,
|
|
580
|
+
isMusl,
|
|
524
581
|
getPackagedBinaryCandidates,
|
|
525
582
|
usePackagedBinaryIfAvailable,
|
|
526
583
|
downloadBinary,
|
package/package.json
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
2
|
+
"author": {
|
|
3
|
+
"email": "nhirschfeld@gmail.com",
|
|
4
|
+
"name": "Na'aman Hirschfeld",
|
|
5
|
+
"url": "https://github.com/Goldziher"
|
|
6
|
+
},
|
|
7
|
+
"bin": {
|
|
8
|
+
"ai-rulez": "./ai-rulez.js"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/Goldziher/ai-rulez/issues"
|
|
12
|
+
},
|
|
13
|
+
"cpu": [
|
|
14
|
+
"x64",
|
|
15
|
+
"arm64"
|
|
16
|
+
],
|
|
4
17
|
"description": "Author, generate, validate and govern rules, skills, plugins and MCP configuration for 52 AI coding assistants from one .ai-rulez/ source. Lock, sign and SBOM your agent configuration, review it with verified model evidence, and publish plugin bundles. CLI, MCP server and Go API.",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.0.0"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"ai-rulez.js",
|
|
23
|
+
"install.js",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"THIRD_PARTY_NOTICES.md",
|
|
27
|
+
"LICENSES",
|
|
28
|
+
"bin/ai-rulez-*",
|
|
29
|
+
"bin/liter_llm_ffi.dll"
|
|
30
|
+
],
|
|
31
|
+
"funding": {
|
|
32
|
+
"type": "github",
|
|
33
|
+
"url": "https://github.com/sponsors/Goldziher"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://goldziher.github.io/ai-rulez/",
|
|
5
36
|
"keywords": [
|
|
6
37
|
"ai-rules",
|
|
7
38
|
"agents-md",
|
|
@@ -19,55 +50,31 @@
|
|
|
19
50
|
"llms-txt",
|
|
20
51
|
"cli"
|
|
21
52
|
],
|
|
22
|
-
"homepage": "https://goldziher.github.io/ai-rulez/",
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/Goldziher/ai-rulez/issues"
|
|
25
|
-
},
|
|
26
53
|
"license": "MIT AND Apache-2.0 AND Unicode-3.0",
|
|
27
|
-
"author": {
|
|
28
|
-
"name": "Na'aman Hirschfeld",
|
|
29
|
-
"email": "nhirschfeld@gmail.com",
|
|
30
|
-
"url": "https://github.com/Goldziher"
|
|
31
|
-
},
|
|
32
54
|
"maintainers": [
|
|
33
55
|
{
|
|
34
|
-
"name": "Na'aman Hirschfeld",
|
|
35
56
|
"email": "nhirschfeld@gmail.com",
|
|
57
|
+
"name": "Na'aman Hirschfeld",
|
|
36
58
|
"url": "https://github.com/Goldziher"
|
|
37
59
|
}
|
|
38
60
|
],
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
},
|
|
47
|
-
"bin": {
|
|
48
|
-
"ai-rulez": "./ai-rulez.js"
|
|
61
|
+
"name": "ai-rulez",
|
|
62
|
+
"optionalDependencies": {
|
|
63
|
+
"@ai-rulez/darwin-arm64": "5.13.2",
|
|
64
|
+
"@ai-rulez/darwin-x64": "5.13.2",
|
|
65
|
+
"@ai-rulez/linux-arm64": "5.13.2",
|
|
66
|
+
"@ai-rulez/linux-x64": "5.13.2",
|
|
67
|
+
"@ai-rulez/win32-x64": "5.13.2"
|
|
49
68
|
},
|
|
50
|
-
"files": [
|
|
51
|
-
"ai-rulez.js",
|
|
52
|
-
"install.js",
|
|
53
|
-
"README.md",
|
|
54
|
-
"LICENSE",
|
|
55
|
-
"THIRD_PARTY_NOTICES.md",
|
|
56
|
-
"LICENSES",
|
|
57
|
-
"bin/ai-rulez-*",
|
|
58
|
-
"bin/liter_llm_ffi.dll"
|
|
59
|
-
],
|
|
60
69
|
"os": [
|
|
61
70
|
"darwin",
|
|
62
71
|
"linux",
|
|
63
72
|
"win32"
|
|
64
73
|
],
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
],
|
|
69
|
-
"engines": {
|
|
70
|
-
"node": ">=22.0.0"
|
|
74
|
+
"repository": {
|
|
75
|
+
"type": "git",
|
|
76
|
+
"url": "https://github.com/Goldziher/ai-rulez.git"
|
|
71
77
|
},
|
|
78
|
+
"version": "5.13.2",
|
|
72
79
|
"scripts": {}
|
|
73
80
|
}
|