ai-rulez 2.0.1 → 2.1.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 +105 -5
- package/package.json +1 -1
- package/bin/ai-rulez +0 -193
- package/bin/ai-rulez-bin +0 -0
- package/bin/ai-rulez.js +0 -39
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Tired of manually managing rule files, subagents, and custom commands across dif
|
|
|
32
32
|
### Powerful Tooling
|
|
33
33
|
- **Custom Commands:** Define custom commands that your AI assistant can execute, enabling powerful, interactive workflows.
|
|
34
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
|
|
35
|
+
- **MCP Integration:** Automatically configure MCP servers across CLI tools (Claude, Gemini) and generate config files for others (Cursor, VS Code). One configuration, every tool connected.
|
|
36
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
37
|
|
|
38
38
|
### Flexible Integrations
|
|
@@ -73,6 +73,13 @@ agents:
|
|
|
73
73
|
- name: "go-developer"
|
|
74
74
|
description: "Go language expert for core development"
|
|
75
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
|
+
# MCP servers for direct AI tool integration
|
|
78
|
+
mcp_servers:
|
|
79
|
+
- name: "ai-rulez"
|
|
80
|
+
command: "ai-rulez"
|
|
81
|
+
args: ["mcp"]
|
|
82
|
+
description: "AI-Rulez MCP server for configuration management"
|
|
76
83
|
```
|
|
77
84
|
|
|
78
85
|
Run `ai-rulez generate` → get all your configuration files, perfectly synchronized.
|
|
@@ -80,14 +87,107 @@ Run `ai-rulez generate` → get all your configuration files, perfectly synchron
|
|
|
80
87
|
## Quick Start
|
|
81
88
|
|
|
82
89
|
```bash
|
|
83
|
-
# 1.
|
|
90
|
+
# 1. AI-powered initialization (recommended)
|
|
91
|
+
ai-rulez init "My Project" --preset popular --use-agent claude
|
|
92
|
+
|
|
93
|
+
# 2. Generate all AI instruction files
|
|
94
|
+
ai-rulez generate
|
|
95
|
+
|
|
96
|
+
# 3. Your AI tools now have comprehensive, project-specific context!
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**That's it!** The AI will analyze your codebase and generate tailored rules, documentation, and specialized agents automatically.
|
|
100
|
+
|
|
101
|
+
**Prefer manual setup?**
|
|
102
|
+
```bash
|
|
103
|
+
# Basic initialization without AI assistance
|
|
84
104
|
ai-rulez init "My Project" --preset popular
|
|
85
105
|
|
|
86
|
-
#
|
|
106
|
+
# Add your project-specific context
|
|
87
107
|
ai-rulez add rule "Tech Stack" --priority critical --content "This project uses Go and PostgreSQL."
|
|
88
108
|
|
|
89
|
-
#
|
|
109
|
+
# Generate files
|
|
110
|
+
ai-rulez generate
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## MCP Server Integration
|
|
114
|
+
|
|
115
|
+
`ai-rulez` provides seamless **Model Context Protocol (MCP)** integration, automatically configuring both file-based and CLI-based AI tools with your MCP servers.
|
|
116
|
+
|
|
117
|
+
### Automatic CLI Configuration
|
|
118
|
+
|
|
119
|
+
When you run `ai-rulez generate`, MCP servers are **automatically configured** for available CLI tools:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
90
122
|
ai-rulez generate
|
|
123
|
+
# ✅ Generated 3 file(s) successfully
|
|
124
|
+
# ✅ Configured claude MCP server: ai-rulez
|
|
125
|
+
# ✅ Configured gemini MCP server: database-tools
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Supported CLI tools:**
|
|
129
|
+
- **Claude CLI**: `claude mcp add` with full env/transport support
|
|
130
|
+
- **Gemini CLI**: `gemini mcp add` with automatic configuration
|
|
131
|
+
|
|
132
|
+
### Hybrid Configuration
|
|
133
|
+
|
|
134
|
+
`ai-rulez` supports both CLI and file-based configurations simultaneously:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
mcp_servers:
|
|
138
|
+
- name: "database-tools"
|
|
139
|
+
command: "uvx"
|
|
140
|
+
args: ["mcp-server-postgres"]
|
|
141
|
+
env:
|
|
142
|
+
DATABASE_URL: "postgresql://localhost/mydb"
|
|
143
|
+
targets:
|
|
144
|
+
- "@claude-cli" # Configure Claude CLI
|
|
145
|
+
- "@gemini-cli" # Configure Gemini CLI
|
|
146
|
+
- ".cursor/mcp.json" # Generate Cursor config file
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
This single configuration:
|
|
150
|
+
- ✅ Executes `claude mcp add` commands
|
|
151
|
+
- ✅ Executes `gemini mcp add` commands
|
|
152
|
+
- ✅ Generates `.cursor/mcp.json` file
|
|
153
|
+
|
|
154
|
+
### Control Options
|
|
155
|
+
|
|
156
|
+
**Default behavior** (recommended):
|
|
157
|
+
```bash
|
|
158
|
+
ai-rulez generate
|
|
159
|
+
# Configures all available CLI tools + generates files
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Disable CLI configuration** when needed:
|
|
163
|
+
```bash
|
|
164
|
+
ai-rulez generate --no-configure-cli-mcp
|
|
165
|
+
# Only generates files, skips CLI tool configuration
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Target specific tools:**
|
|
169
|
+
```yaml
|
|
170
|
+
mcp_servers:
|
|
171
|
+
- name: "github-integration"
|
|
172
|
+
command: "npx"
|
|
173
|
+
args: ["@modelcontextprotocol/server-github"]
|
|
174
|
+
targets: ["@claude-cli"] # Only configure Claude CLI
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Built-in MCP Server
|
|
178
|
+
|
|
179
|
+
`ai-rulez` includes its own MCP server for configuration management:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Start the ai-rulez MCP server
|
|
183
|
+
ai-rulez mcp
|
|
184
|
+
|
|
185
|
+
# Or configure it automatically via your ai-rulez.yaml
|
|
186
|
+
mcp_servers:
|
|
187
|
+
- name: "ai-rulez"
|
|
188
|
+
command: "ai-rulez"
|
|
189
|
+
args: ["mcp"]
|
|
190
|
+
description: "Configuration management server"
|
|
91
191
|
```
|
|
92
192
|
|
|
93
193
|
## Installation
|
|
@@ -146,7 +246,7 @@ Add the following to your `.pre-commit-config.yaml`:
|
|
|
146
246
|
```yaml
|
|
147
247
|
repos:
|
|
148
248
|
- repo: https://github.com/Goldziher/ai-rulez
|
|
149
|
-
rev: v2.
|
|
249
|
+
rev: v2.1.0
|
|
150
250
|
hooks:
|
|
151
251
|
- id: ai-rulez-validate
|
|
152
252
|
- id: ai-rulez-generate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-rulez",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"ai",
|
package/bin/ai-rulez
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const { spawn } = require('child_process');
|
|
6
|
-
|
|
7
|
-
// Path to the actual binary that install.js will create
|
|
8
|
-
// The binary has a different name to avoid conflict with this wrapper script
|
|
9
|
-
const BINARY_NAME = process.platform === 'win32' ? 'ai-rulez-bin.exe' : 'ai-rulez-bin';
|
|
10
|
-
const BINARY_PATH = path.join(__dirname, BINARY_NAME);
|
|
11
|
-
|
|
12
|
-
const REPO_URL = 'https://github.com/Goldziher/ai-rulez';
|
|
13
|
-
const ISSUES_URL = `${REPO_URL}/issues`;
|
|
14
|
-
|
|
15
|
-
function isNetworkError(error) {
|
|
16
|
-
const networkErrors = [
|
|
17
|
-
'ENOTFOUND', 'ECONNREFUSED', 'ECONNRESET', 'ETIMEDOUT',
|
|
18
|
-
'EHOSTUNREACH', 'ENETUNREACH', 'EADDRNOTAVAIL', 'ENETDOWN'
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
return networkErrors.includes(error.code) ||
|
|
22
|
-
error.message.includes('network') ||
|
|
23
|
-
error.message.includes('fetch') ||
|
|
24
|
-
error.message.includes('download') ||
|
|
25
|
-
error.message.includes('timeout');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function isPermissionError(error) {
|
|
29
|
-
return error.code === 'EACCES' ||
|
|
30
|
-
error.code === 'EPERM' ||
|
|
31
|
-
error.message.includes('permission') ||
|
|
32
|
-
error.message.includes('access denied');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function runInstallScript() {
|
|
36
|
-
console.error('⚡ ai-rulez binary not found. Installing...');
|
|
37
|
-
console.error(` Looking for: ${BINARY_PATH}`);
|
|
38
|
-
|
|
39
|
-
const installScript = path.join(__dirname, '..', 'install.js');
|
|
40
|
-
console.error(` Running install script: ${installScript}`);
|
|
41
|
-
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
let errorOutput = '';
|
|
44
|
-
|
|
45
|
-
const child = spawn('node', [installScript], {
|
|
46
|
-
stdio: ['inherit', 'inherit', 'pipe'],
|
|
47
|
-
cwd: path.dirname(installScript),
|
|
48
|
-
env: { ...process.env, AI_RULEZ_DEBUG: '1' }
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
child.stderr.on('data', (data) => {
|
|
52
|
-
process.stderr.write(data);
|
|
53
|
-
errorOutput += data.toString();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
child.on('exit', (code) => {
|
|
57
|
-
console.error(` Install script exited with code: ${code}`);
|
|
58
|
-
if (code === 0) {
|
|
59
|
-
resolve();
|
|
60
|
-
} else {
|
|
61
|
-
const error = new Error(`Install script failed with code ${code}`);
|
|
62
|
-
error.output = errorOutput;
|
|
63
|
-
reject(error);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
child.on('error', (err) => {
|
|
68
|
-
console.error(` Install script error: ${err.message}`);
|
|
69
|
-
reject(err);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async function main() {
|
|
75
|
-
// Check if binary exists
|
|
76
|
-
if (!fs.existsSync(BINARY_PATH)) {
|
|
77
|
-
try {
|
|
78
|
-
// Run the install script if binary is missing
|
|
79
|
-
await runInstallScript();
|
|
80
|
-
|
|
81
|
-
console.error(` Checking if binary exists at: ${BINARY_PATH}`);
|
|
82
|
-
|
|
83
|
-
// Double-check that binary now exists
|
|
84
|
-
if (!fs.existsSync(BINARY_PATH)) {
|
|
85
|
-
console.error('\n❌ Error: Binary still not found after installation attempt');
|
|
86
|
-
console.error('\n🔧 This is unexpected. Please report this issue:');
|
|
87
|
-
console.error(` ${ISSUES_URL}`);
|
|
88
|
-
console.error('\nInclude your platform info:');
|
|
89
|
-
console.error(` Platform: ${process.platform}`);
|
|
90
|
-
console.error(` Architecture: ${process.arch}`);
|
|
91
|
-
console.error(` Node version: ${process.version}`);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
} catch (error) {
|
|
95
|
-
console.error('\n❌ Installation failed');
|
|
96
|
-
|
|
97
|
-
if (isNetworkError(error)) {
|
|
98
|
-
console.error('\n🌐 Network Issue Detected');
|
|
99
|
-
console.error(' Unable to download ai-rulez binary from GitHub releases.');
|
|
100
|
-
console.error('\n Possible causes:');
|
|
101
|
-
console.error(' • No internet connection');
|
|
102
|
-
console.error(' • GitHub is temporarily unreachable');
|
|
103
|
-
console.error(' • Corporate firewall/proxy blocking GitHub');
|
|
104
|
-
console.error('\n Solutions:');
|
|
105
|
-
console.error(' 1. Check your internet connection');
|
|
106
|
-
console.error(' 2. Try again in a few moments');
|
|
107
|
-
console.error(' 3. If behind a proxy, configure npm proxy settings');
|
|
108
|
-
console.error(' 4. Download the binary manually from:');
|
|
109
|
-
console.error(` ${REPO_URL}/releases`);
|
|
110
|
-
} else if (isPermissionError(error)) {
|
|
111
|
-
console.error('\n🔒 Permission Denied');
|
|
112
|
-
console.error(` Cannot write to: ${path.dirname(BINARY_PATH)}`);
|
|
113
|
-
console.error('\n Solutions:');
|
|
114
|
-
console.error(' 1. Run with appropriate permissions');
|
|
115
|
-
console.error(' 2. Install globally with: npm install -g ai-rulez');
|
|
116
|
-
console.error(' 3. Check directory permissions');
|
|
117
|
-
} else {
|
|
118
|
-
console.error('\n⚠️ Unexpected Error');
|
|
119
|
-
console.error(` ${error.message}`);
|
|
120
|
-
if (error.output && error.output.trim()) {
|
|
121
|
-
console.error('\n Details:');
|
|
122
|
-
console.error(` ${error.output.trim().split('\n').join('\n ')}`);
|
|
123
|
-
}
|
|
124
|
-
console.error('\n This shouldn\'t happen. Please report this issue:');
|
|
125
|
-
console.error(` ${ISSUES_URL}`);
|
|
126
|
-
console.error('\n Include:');
|
|
127
|
-
console.error(' • The error message above');
|
|
128
|
-
console.error(` • Platform: ${process.platform}/${process.arch}`);
|
|
129
|
-
console.error(` • Node version: ${process.version}`);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
process.exit(1);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Run the actual binary with all arguments
|
|
137
|
-
const proc = spawn(BINARY_PATH, process.argv.slice(2), {
|
|
138
|
-
stdio: 'inherit',
|
|
139
|
-
env: process.env
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
proc.on('exit', (code) => {
|
|
143
|
-
process.exit(code || 0);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
proc.on('error', (err) => {
|
|
147
|
-
console.error('\n❌ Failed to execute ai-rulez binary');
|
|
148
|
-
|
|
149
|
-
if (err.code === 'ENOENT') {
|
|
150
|
-
console.error('\n📁 File Not Found');
|
|
151
|
-
console.error(` Binary path: ${BINARY_PATH}`);
|
|
152
|
-
console.error('\n The file exists but cannot be executed.');
|
|
153
|
-
console.error(' Try reinstalling: npm install -g ai-rulez');
|
|
154
|
-
} else if (err.code === 'EACCES' || err.code === 'EPERM') {
|
|
155
|
-
console.error('\n🔒 Permission Denied');
|
|
156
|
-
console.error(` Binary path: ${BINARY_PATH}`);
|
|
157
|
-
console.error('\n The binary is not executable.');
|
|
158
|
-
console.error('\n Solutions:');
|
|
159
|
-
if (process.platform !== 'win32') {
|
|
160
|
-
console.error(` 1. Make it executable: chmod +x ${BINARY_PATH}`);
|
|
161
|
-
console.error(' 2. Reinstall: npm install -g ai-rulez');
|
|
162
|
-
} else {
|
|
163
|
-
console.error(' 1. Check file permissions in Windows');
|
|
164
|
-
console.error(' 2. Reinstall: npm install -g ai-rulez');
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
console.error('\n⚠️ Unexpected Execution Error');
|
|
168
|
-
console.error(` Error code: ${err.code}`);
|
|
169
|
-
console.error(` Message: ${err.message}`);
|
|
170
|
-
console.error('\n This shouldn\'t happen. Please report this issue:');
|
|
171
|
-
console.error(` ${ISSUES_URL}`);
|
|
172
|
-
console.error('\n Include:');
|
|
173
|
-
console.error(' • The error details above');
|
|
174
|
-
console.error(` • Platform: ${process.platform}/${process.arch}`);
|
|
175
|
-
console.error(` • Node version: ${process.version}`);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
process.exit(1);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
main().catch(err => {
|
|
183
|
-
console.error('\n❌ Unexpected error in wrapper script');
|
|
184
|
-
console.error(` ${err.message}`);
|
|
185
|
-
if (err.stack) {
|
|
186
|
-
console.error('\n Stack trace:');
|
|
187
|
-
console.error(` ${err.stack.split('\n').slice(1).join('\n ')}`);
|
|
188
|
-
}
|
|
189
|
-
console.error('\n This shouldn\'t happen. Please report this issue:');
|
|
190
|
-
console.error(` ${ISSUES_URL}`);
|
|
191
|
-
console.error('\n Include the full error output above.');
|
|
192
|
-
process.exit(1);
|
|
193
|
-
});
|
package/bin/ai-rulez-bin
DELETED
|
Binary file
|
package/bin/ai-rulez.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
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");
|
|
7
|
-
|
|
8
|
-
const binaryName = getBinaryName(getPlatform().os);
|
|
9
|
-
const binaryPath = path.join(__dirname, "..", "bin", binaryName);
|
|
10
|
-
|
|
11
|
-
function runBinary(args) {
|
|
12
|
-
const child = spawn(binaryPath, args, {
|
|
13
|
-
stdio: "inherit",
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
child.on("close", (code) => {
|
|
17
|
-
process.exit(code);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
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
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
main();
|