ai-rulez 2.0.0 → 2.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/README.md +166 -0
- package/bin/ai-rulez-bin +0 -0
- package/bin/ai-rulez.js +27 -54
- package/install.js +10 -4
- package/package.json +84 -84
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# ai-rulez ⚡
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/Goldziher/ai-rulez/main/docs/assets/logo.png" alt="ai-rulez logo" width="200" style="border-radius: 15%; overflow: hidden;">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
**One config to rule them all.**
|
|
8
|
+
|
|
9
|
+
Tired of manually managing rule files, subagents, and custom commands across different AI tools? `ai-rulez` gives you one `ai-rulez.yml` file to generate them all. Keep your AI context in sync, and even launch MCP servers for direct integration.
|
|
10
|
+
|
|
11
|
+
[](https://go.dev)
|
|
12
|
+
[](https://www.npmjs.com/package/ai-rulez)
|
|
13
|
+
[](https://pypi.org/project/ai-rulez/)
|
|
14
|
+
[](https://github.com/Goldziher/homebrew-tap)
|
|
15
|
+
|
|
16
|
+
### 📖 **[Read the Full Documentation](https://goldziher.github.io/ai-rulez/)**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Feature Highlights
|
|
21
|
+
|
|
22
|
+
`ai-rulez` is a progressive tool-box, designed to offer a centralized way to manage AI tooling for a repository.
|
|
23
|
+
|
|
24
|
+
### Centralized Configuration
|
|
25
|
+
- **Centralized Definitions:** Use a single `ai-rulez.yml` as the source of truth to define rules, file structures, and documentation for all your AI tools.
|
|
26
|
+
- **Nested Configs & Monorepo Support:** Scale your configurations with `extends` and `includes`. Manage complex projects and monorepos with ease by using the `--recursive` flag to combine configurations from multiple files.
|
|
27
|
+
```bash
|
|
28
|
+
# Generate rules for all projects in a monorepo
|
|
29
|
+
ai-rulez generate --recursive
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Powerful Tooling
|
|
33
|
+
- **Custom Commands:** Define custom commands that your AI assistant can execute, enabling powerful, interactive workflows.
|
|
34
|
+
- **Specialized AI Agents:** Create specialized "sub-agents" with their own system prompts and tools, perfect for complex tasks like code reviews or database queries.
|
|
35
|
+
- **MCP Servers:** Launch a Model Context Protocol (MCP) server to allow AI assistants to programmatically interact with your configuration.
|
|
36
|
+
- **Full-Featured CLI:** Manage your entire configuration from the command line. Add rules, update agents, and generate files without ever opening a YAML file.
|
|
37
|
+
|
|
38
|
+
### Flexible Integrations
|
|
39
|
+
- **Multi-Tool Support:** Use presets to instantly generate configurations for popular AI tools like Claude, Cursor, Copilot, Gemini, and more.
|
|
40
|
+
- **Custom Tool Integration:** Don't see your favorite tool on the list? Use the `outputs` key to generate a configuration file for any tool, in any format.
|
|
41
|
+
|
|
42
|
+
## How It Works
|
|
43
|
+
|
|
44
|
+
`ai-rulez` takes your `ai-rulez.yml` file and uses it as a single source of truth to generate native configuration files for all your AI tools. Think of it as a build system for AI context—you write the source once, and it compiles to whatever format each tool needs.
|
|
45
|
+
|
|
46
|
+
## Example: `ai-rulez.yml`
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
$schema: https://github.com/Goldziher/ai-rulez/schema/ai-rules-v2.schema.json
|
|
50
|
+
|
|
51
|
+
metadata:
|
|
52
|
+
name: "My SaaS Platform"
|
|
53
|
+
version: "2.0.0"
|
|
54
|
+
|
|
55
|
+
# Use presets for common configurations
|
|
56
|
+
presets:
|
|
57
|
+
- "popular" # Includes Claude, Cursor, Windsurf, and Copilot
|
|
58
|
+
|
|
59
|
+
rules:
|
|
60
|
+
- name: "Go Code Standards"
|
|
61
|
+
priority: high
|
|
62
|
+
content: "Follow standard Go project layout (cmd/, internal/, pkg/). Use meaningful package names and export only what is necessary."
|
|
63
|
+
|
|
64
|
+
sections:
|
|
65
|
+
- name: "Project Structure"
|
|
66
|
+
priority: critical
|
|
67
|
+
content: |
|
|
68
|
+
- `cmd/`: Main application entry point
|
|
69
|
+
- `internal/`: Private application code (business logic, data access)
|
|
70
|
+
- `pkg/`: Public-facing libraries
|
|
71
|
+
|
|
72
|
+
agents:
|
|
73
|
+
- name: "go-developer"
|
|
74
|
+
description: "Go language expert for core development"
|
|
75
|
+
system_prompt: "You are an expert Go developer. Your key responsibilities include writing idiomatic Go, using proper error handling, and creating comprehensive tests."
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Run `ai-rulez generate` → get all your configuration files, perfectly synchronized.
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 1. Initialize your project with a preset (recommended)
|
|
84
|
+
ai-rulez init "My Project" --preset popular
|
|
85
|
+
|
|
86
|
+
# 2. Add your project-specific context
|
|
87
|
+
ai-rulez add rule "Tech Stack" --priority critical --content "This project uses Go and PostgreSQL."
|
|
88
|
+
|
|
89
|
+
# 3. Generate all AI instruction files
|
|
90
|
+
ai-rulez generate
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Installation
|
|
94
|
+
|
|
95
|
+
### Run without installing
|
|
96
|
+
|
|
97
|
+
For one-off executions, you can run `ai-rulez` directly without a system-wide installation.
|
|
98
|
+
|
|
99
|
+
**Go**
|
|
100
|
+
```bash
|
|
101
|
+
go run github.com/Goldziher/ai-rulez/cmd@latest --help
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Node.js (via npx)**
|
|
105
|
+
```bash
|
|
106
|
+
# Installs and runs the latest version
|
|
107
|
+
npx ai-rulez@latest init
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Python (via uvx)**
|
|
111
|
+
```bash
|
|
112
|
+
# Runs ai-rulez in a temporary virtual environment
|
|
113
|
+
uvx ai-rulez init
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Install globally
|
|
117
|
+
|
|
118
|
+
For frequent use, a global installation is recommended.
|
|
119
|
+
|
|
120
|
+
**Go**
|
|
121
|
+
```bash
|
|
122
|
+
go install github.com/Goldziher/ai-rulez/cmd@latest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Homebrew (macOS/Linux)**
|
|
126
|
+
```bash
|
|
127
|
+
brew install goldziher/tap/ai-rulez
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**npm**
|
|
131
|
+
```bash
|
|
132
|
+
npm install -g ai-rulez
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**pip**
|
|
136
|
+
```bash
|
|
137
|
+
pip install ai-rulez
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Pre-commit Hooks
|
|
141
|
+
|
|
142
|
+
You can use `ai-rulez` with `pre-commit` to automatically validate and generate your AI configuration files.
|
|
143
|
+
|
|
144
|
+
Add the following to your `.pre-commit-config.yaml`:
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
repos:
|
|
148
|
+
- repo: https://github.com/Goldziher/ai-rulez
|
|
149
|
+
rev: v2.0.0
|
|
150
|
+
hooks:
|
|
151
|
+
- id: ai-rulez-validate
|
|
152
|
+
- id: ai-rulez-generate
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Documentation
|
|
158
|
+
|
|
159
|
+
- **[Quick Start Guide](https://goldziher.github.io/ai-rulez/quick-start/)**
|
|
160
|
+
- **[Full CLI Reference](https://goldziher.github.io/ai-rulez/cli/)**
|
|
161
|
+
- **[Configuration Guide](https://goldziher.github.io/ai-rulez/configuration/)**
|
|
162
|
+
- **[Migration Guide](https://goldziher.github.io/ai-rulez/migration-guide/)** - Upgrading from v1.x to v2.0
|
|
163
|
+
|
|
164
|
+
## Contributing
|
|
165
|
+
|
|
166
|
+
Contributions are welcome! Please see the [Contributing Guide](CONTRIBUTING.md) to get started.
|
package/bin/ai-rulez-bin
ADDED
|
Binary file
|
package/bin/ai-rulez.js
CHANGED
|
@@ -1,66 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const fs = require("node:fs");
|
|
4
|
-
const path = require("node:path");
|
|
5
3
|
const { spawn } = require("node:child_process");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const fs = require("node:fs");
|
|
6
|
+
const { getPlatform, getBinaryName } = require("../install");
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const installer = require(installPath);
|
|
10
|
-
|
|
11
|
-
const BINARY_NAME = installer.getBinaryName();
|
|
12
|
-
const BINARY_PATH = path.join(__dirname, BINARY_NAME);
|
|
13
|
-
|
|
14
|
-
async function ensureBinary() {
|
|
15
|
-
if (fs.existsSync(BINARY_PATH)) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.log("🚀 First run detected - downloading ai-rulez binary...");
|
|
20
|
-
console.log(" This will only happen once and takes a few seconds.");
|
|
21
|
-
console.log("");
|
|
22
|
-
try {
|
|
23
|
-
await installer.install();
|
|
24
|
-
if (fs.existsSync(BINARY_PATH)) {
|
|
25
|
-
console.log("✅ Download complete! Running ai-rulez...");
|
|
26
|
-
console.log("");
|
|
27
|
-
return true;
|
|
28
|
-
} else {
|
|
29
|
-
throw new Error("Binary not found after installation");
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error("❌ Failed to download ai-rulez binary:", error.message);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function main() {
|
|
38
|
-
const hasBinary = await ensureBinary();
|
|
39
|
-
|
|
40
|
-
if (!hasBinary) {
|
|
41
|
-
console.error("Could not find or download ai-rulez binary");
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
8
|
+
const binaryName = getBinaryName(getPlatform().os);
|
|
9
|
+
const binaryPath = path.join(__dirname, "..", "bin", binaryName);
|
|
44
10
|
|
|
45
|
-
|
|
46
|
-
const child = spawn(
|
|
11
|
+
function runBinary(args) {
|
|
12
|
+
const child = spawn(binaryPath, args, {
|
|
47
13
|
stdio: "inherit",
|
|
48
|
-
cwd: process.cwd(),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
child.on("exit", (code) => {
|
|
52
|
-
process.exit(code || 0);
|
|
53
14
|
});
|
|
54
15
|
|
|
55
|
-
child.on("
|
|
56
|
-
|
|
57
|
-
process.exit(1);
|
|
16
|
+
child.on("close", (code) => {
|
|
17
|
+
process.exit(code);
|
|
58
18
|
});
|
|
59
19
|
}
|
|
60
20
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
21
|
+
async function main() {
|
|
22
|
+
if (fs.existsSync(binaryPath)) {
|
|
23
|
+
runBinary(process.argv.slice(2));
|
|
24
|
+
} else {
|
|
25
|
+
console.log(
|
|
26
|
+
"🚀 First run detected - downloading ai-rulez binary...\n This will only happen once and takes a few seconds.\n",
|
|
27
|
+
);
|
|
28
|
+
const { install } = require("../install");
|
|
29
|
+
try {
|
|
30
|
+
await install(true); // Pass a flag to indicate this is a post-install step
|
|
31
|
+
runBinary(process.argv.slice(2));
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error("Failed to install or run ai-rulez:", error);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
66
37
|
}
|
|
38
|
+
|
|
39
|
+
main();
|
package/install.js
CHANGED
|
@@ -275,7 +275,7 @@ async function extractArchive(archivePath, extractDir, platform) {
|
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
async function install() {
|
|
278
|
+
async function install(isPostInstall = false) {
|
|
279
279
|
const DEBUG = process.env.AI_RULEZ_DEBUG === "1";
|
|
280
280
|
|
|
281
281
|
try {
|
|
@@ -418,14 +418,20 @@ async function install() {
|
|
|
418
418
|
console.error(`[install.js] Exiting with code 0`);
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
if (!isPostInstall) {
|
|
422
|
+
process.exit(0);
|
|
423
|
+
}
|
|
422
424
|
} catch (error) {
|
|
423
425
|
if (DEBUG)
|
|
424
426
|
console.error(`[install.js] Installation failed: ${error.message}`);
|
|
425
427
|
console.error("Failed to install ai-rulez binary:", error.message);
|
|
426
428
|
console.error("You can manually download the binary from:");
|
|
427
429
|
console.error(`https://github.com/${REPO_NAME}/releases`);
|
|
428
|
-
|
|
430
|
+
if (!isPostInstall) {
|
|
431
|
+
process.exit(1);
|
|
432
|
+
} else {
|
|
433
|
+
throw error;
|
|
434
|
+
}
|
|
429
435
|
}
|
|
430
436
|
}
|
|
431
437
|
|
|
@@ -442,5 +448,5 @@ if (typeof module !== "undefined" && module.exports) {
|
|
|
442
448
|
}
|
|
443
449
|
|
|
444
450
|
if (require.main === module) {
|
|
445
|
-
install();
|
|
451
|
+
install(false);
|
|
446
452
|
}
|
package/package.json
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
2
|
+
"name": "ai-rulez",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "⚡ One config to rule them all. Centralized AI assistant configuration management - generate rules for Claude, Cursor, Copilot, Windsurf and more from a single YAML file.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"ai-assistant",
|
|
8
|
+
"ai-rules",
|
|
9
|
+
"claude",
|
|
10
|
+
"cursor",
|
|
11
|
+
"copilot",
|
|
12
|
+
"windsurf",
|
|
13
|
+
"gemini",
|
|
14
|
+
"cline",
|
|
15
|
+
"continue-dev",
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"cli",
|
|
19
|
+
"configuration",
|
|
20
|
+
"config",
|
|
21
|
+
"rules",
|
|
22
|
+
"generator",
|
|
23
|
+
"golang",
|
|
24
|
+
"go",
|
|
25
|
+
"development",
|
|
26
|
+
"developer-tools",
|
|
27
|
+
"automation",
|
|
28
|
+
"workflow",
|
|
29
|
+
"productivity",
|
|
30
|
+
"pre-commit",
|
|
31
|
+
"git-hooks",
|
|
32
|
+
"code-generation",
|
|
33
|
+
"ai-development",
|
|
34
|
+
"assistant-configuration",
|
|
35
|
+
"monorepo",
|
|
36
|
+
"presets",
|
|
37
|
+
"agents"
|
|
38
|
+
],
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/Goldziher/ai-rulez.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://goldziher.github.io/ai-rulez/",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/Goldziher/ai-rulez/issues"
|
|
46
|
+
},
|
|
47
|
+
"funding": {
|
|
48
|
+
"type": "github",
|
|
49
|
+
"url": "https://github.com/sponsors/Goldziher"
|
|
50
|
+
},
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"author": {
|
|
53
|
+
"name": "Na'aman Hirschfeld",
|
|
54
|
+
"email": "nhirschfeld@gmail.com",
|
|
55
|
+
"url": "https://github.com/Goldziher"
|
|
56
|
+
},
|
|
57
|
+
"maintainers": [
|
|
58
|
+
{
|
|
59
|
+
"name": "Na'aman Hirschfeld",
|
|
60
|
+
"email": "nhirschfeld@gmail.com",
|
|
61
|
+
"url": "https://github.com/Goldziher"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"bin": {
|
|
65
|
+
"ai-rulez": "./bin/ai-rulez.js"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {},
|
|
68
|
+
"files": [
|
|
69
|
+
"bin/",
|
|
70
|
+
"install.js",
|
|
71
|
+
"README.md"
|
|
72
|
+
],
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=14.0.0"
|
|
75
|
+
},
|
|
76
|
+
"os": [
|
|
77
|
+
"darwin",
|
|
78
|
+
"linux",
|
|
79
|
+
"win32"
|
|
80
|
+
],
|
|
81
|
+
"cpu": [
|
|
82
|
+
"x64",
|
|
83
|
+
"arm64",
|
|
84
|
+
"ia32"
|
|
85
|
+
]
|
|
86
86
|
}
|