ai-rulez 2.2.1 → 2.4.0

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.
Files changed (2) hide show
  1. package/README.md +319 -73
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,30 +4,45 @@
4
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
5
  </p>
6
6
 
7
- **One config to rule them all.**
7
+ **AI-powered development governance. One config to rule them all.**
8
8
 
9
- ## The Problem
9
+ ## The Complete AI Development Platform
10
10
 
11
- If you're using multiple AI coding assistants (Claude Code, Cursor, Windsurf, GitHub Copilot), you've probably noticed the configuration fragmentation. Each tool demands its own format - `CLAUDE.md`, `.cursorrules`, `.windsurfrules`, `.github/copilot-instructions.md`. Keeping coding standards consistent across all these tools is frustrating and error-prone.
11
+ AI-Rulez is the **definitive platform for AI-powered development governance**. Beyond just generating configuration files, it provides real-time rule enforcement, automated code quality assurance, and intelligent governance across your entire development workflow.
12
12
 
13
- ## The Solution
13
+ ### 🚀 Two Powerful Capabilities
14
14
 
15
- AI-Rulez lets you write your project configuration once and automatically generates native files for every AI tool - current and future ones. It's like having a build system for AI context.
15
+ **1. Universal Configuration Management** - Write once, deploy everywhere
16
+ **2. AI-Powered Rule Enforcement** - Real-time governance with automated fixes
16
17
 
17
- <p align="center">
18
- <img src="docs/assets/ai-rulez-python-demo.gif" alt="AI-Rulez Demo" width="100%">
19
- </p>
18
+ ## Why AI-Rulez?
20
19
 
21
- ## Why This Matters
20
+ Modern development teams need more than just configuration management:
22
21
 
23
- Development teams using AI assistants face common challenges:
24
- - **Multiple tools, multiple configs**: Your team uses Claude Code for reviews, Cursor for development, Copilot for completions
25
- - **Configuration drift**: Maintaining separate files leads to inconsistent standards across tools
26
- - **Monorepo complexity**: Multiple services and packages all need different AI contexts
27
- - **Team consistency**: Junior devs get different AI guidance than seniors
28
- - **Future-proofing**: New AI tools require rewriting all configurations
22
+ ### ⚠️ **The Problem**
23
+ - **Configuration Hell**: Each AI tool needs its own format (`.cursorrules`, `CLAUDE.md`, `.windsurfrules`, etc.)
24
+ - **Rule Enforcement Gap**: No way to automatically validate that code follows your standards
25
+ - **Team Inconsistency**: Different developers get different AI guidance
26
+ - **Manual Quality Control**: Time-consuming code reviews for basic rule violations
27
+ - **Reactive Governance**: Finding issues after they're already committed
29
28
 
30
- AI-Rulez solves this with a single `ai-rulez.yaml` that understands your project's conventions.
29
+ ### **The Solution**
30
+ AI-Rulez provides **proactive development governance** with a single `ai-rulez.yaml` that:
31
+ - **Generates configurations** for every AI tool automatically
32
+ - **Enforces rules in real-time** using AI agents (Claude, Gemini, etc.)
33
+ - **Applies automatic fixes** for code quality issues
34
+ - **Integrates with your workflow** (Git hooks, CI/CD, pre-commit)
35
+ - **Scales across teams** with consistent standards
36
+
37
+ <p align="center">
38
+ <img src="docs/assets/ai-rulez-python-demo.gif" alt="AI-Rulez Configuration Demo" width="100%">
39
+ <br><em>📝 Configuration Management (via npx ai-rulez)</em>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <img src="docs/assets/ai-rulez-enforce-demo.gif" alt="AI-Rulez Enforcement Demo" width="100%">
44
+ <br><em>🤖 AI-Powered Rule Enforcement (via uvx ai-rulez@latest)</em>
45
+ </p>
31
46
 
32
47
  [![Go Version](https://img.shields.io/badge/Go-1.24%2B-00ADD8)](https://go.dev)
33
48
  [![NPM Version](https://img.shields.io/npm/v/ai-rulez)](https://www.npmjs.com/package/ai-rulez)
@@ -38,40 +53,58 @@ AI-Rulez solves this with a single `ai-rulez.yaml` that understands your project
38
53
 
39
54
  ---
40
55
 
41
- ## Key Features
56
+ ## 🚀 Core Capabilities
57
+
58
+ ### 1. 📋 Universal Configuration Management
42
59
 
43
- ### AI-Powered Project Analysis
44
- The `init` command is where AI-Rulez shines. Instead of manually writing configurations, let AI analyze your codebase:
60
+ Write once, deploy everywhere with intelligent AI-powered project analysis:
45
61
 
46
62
  ```bash
47
63
  # AI analyzes your codebase and generates tailored config
48
- npx ai-rulez init "My Project" --preset popular --use-agent claude --yes
64
+ npx ai-rulez init "My Project" --preset popular
65
+ ```
66
+
67
+ **Features:**
68
+ - **AI Project Analysis**: Automatically detects your tech stack, patterns, and conventions
69
+ - **Universal Output Generation**: One YAML → all AI tool formats (`CLAUDE.md`, `.cursorrules`, `.windsurfrules`, etc.)
70
+ - **Smart Gitignore Management**: Automatically excludes generated files from version control
71
+ - **MCP Integration**: Auto-configure MCP servers across CLI tools (Claude, Gemini, etc.)
72
+ - **Team Collaboration**: Remote includes, local overrides, monorepo support
73
+
74
+ ### 2. 🤖 AI-Powered Rule Enforcement
75
+
76
+ Real-time governance with automated fixes using multiple AI agents:
77
+
78
+ ```bash
79
+ # Check for violations with AI analysis
80
+ uvx ai-rulez@latest enforce --agent claude
81
+
82
+ # Automatically apply fixes
83
+ uvx ai-rulez@latest enforce --agent claude --fix
84
+
85
+ # Multi-agent review workflow
86
+ uvx ai-rulez@latest enforce --agent gemini --review --review-agent claude
49
87
  ```
50
88
 
51
- This automatically:
52
- - Detects your tech stack (Python/Node/Go, testing frameworks, linters)
53
- - Identifies project patterns and conventions
54
- - Generates appropriate coding standards and practices
55
- - Creates specialized agents for different tasks (code review, testing, docs)
56
- - **Automatically adds all generated AI files to .gitignore** - no more committing `.cursorrules` or `CLAUDE.md` by accident
57
-
58
- ### Universal Output Generation
59
- One YAML config generates files for every tool:
60
- - `CLAUDE.md` for Claude Code
61
- - `.cursorrules` for Cursor
62
- - `.windsurfrules` for Windsurf
63
- - `.github/copilot-instructions.md` for GitHub Copilot
64
- - Custom formats for any future AI tool
65
-
66
- ### Powerful Enterprise Features
67
- - **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.
68
- - **Team Collaboration:** Remote config includes, local overrides, and monorepo support with `--recursive`
69
- - **Full-Featured CLI:** Manage your entire configuration from the command line. Add rules, update agents, and generate files without ever opening a YAML file.
70
- - **Security & Performance:** SSRF protection, schema validation, Go-based performance with instant startup
89
+ **Features:**
90
+ - **Multi-Agent Support**: Claude, Gemini, AMP, Cursor, Codex, Continue.dev, Junie
91
+ - **Automated Fixes**: AI suggests and applies code improvements
92
+ - **Review Workflows**: Iterative improvement with quality thresholds
93
+ - **Multiple Output Formats**: Table, JSON, CSV, summary reports
94
+ - **CI/CD Integration**: Git hooks, pre-commit, workflow automation
95
+ - **Quality Scoring**: 0-100% compliance with configurable thresholds
71
96
 
72
97
  ## How It Works
73
98
 
74
- `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.
99
+ AI-Rulez operates as a **comprehensive AI development governance platform**:
100
+
101
+ 1. **📝 Configuration Phase**: Your `ai-rulez.yml` serves as the single source of truth
102
+ 2. **🏗️ Generation Phase**: Automatically creates native files for every AI tool
103
+ 3. **🔍 Enforcement Phase**: AI agents continuously validate code against your rules
104
+ 4. **🛠️ Fix Phase**: Automatic corrections and improvements applied in real-time
105
+ 5. **📊 Reporting Phase**: Detailed compliance reports and quality metrics
106
+
107
+ Think of it as **CI/CD for code quality** - proactive governance instead of reactive fixes.
75
108
 
76
109
  ## Example: `ai-rulez.yml`
77
110
 
@@ -84,7 +117,7 @@ metadata:
84
117
 
85
118
  # Use presets for common configurations
86
119
  presets:
87
- - "popular" # Includes Claude, Cursor, Windsurf, and Copilot
120
+ - "popular" # Includes Claude, Cursor, Windsurf, Copilot, and Gemini
88
121
 
89
122
  rules:
90
123
  - name: "Go Code Standards"
@@ -107,33 +140,132 @@ agents:
107
140
  # MCP servers for direct AI tool integration
108
141
  mcp_servers:
109
142
  - name: "ai-rulez"
110
- command: "ai-rulez"
111
- args: ["mcp"]
143
+ command: "npx"
144
+ args: ["-y", "ai-rulez@latest", "mcp"]
112
145
  description: "AI-Rulez MCP server for configuration management"
113
146
  ```
114
147
 
115
148
  Run `ai-rulez generate` → get all your configuration files, perfectly synchronized.
116
149
 
117
- ## Quick Start
150
+ ## Quick Start
118
151
 
152
+ ### 📋 Configuration Management
119
153
  ```bash
120
- # 1. AI-powered initialization (recommended)
121
- ai-rulez init "My Project" --preset popular --use-agent claude
154
+ # 1. AI-powered project analysis and setup
155
+ npx ai-rulez@latest init "My Project" --preset popular
122
156
 
123
- # 2. Generate all AI instruction files
124
- ai-rulez generate
157
+ # 2. Generate all AI tool configuration files
158
+ npx ai-rulez@latest generate
125
159
 
126
160
  # 3. Your AI tools now have comprehensive, project-specific context!
127
161
  ```
128
162
 
129
- **That's it!** The AI will analyze your codebase and generate tailored rules, documentation, and specialized agents automatically.
163
+ ### 🤖 AI-Powered Rule Enforcement
164
+ ```bash
165
+ # 1. Check for rule violations
166
+ uvx ai-rulez@latest enforce --agent claude --format table
167
+
168
+ # 2. Get detailed analysis and suggestions
169
+ uvx ai-rulez@latest enforce --agent claude --format json
170
+
171
+ # 3. Apply automatic fixes
172
+ uvx ai-rulez@latest enforce --agent claude --fix
173
+
174
+ # 4. Set up review workflow
175
+ uvx ai-rulez@latest enforce --agent claude --review --review-iterations 2
176
+ ```
177
+
178
+ **That's it!** You now have both intelligent configuration management AND real-time rule enforcement powered by AI.
179
+
180
+ ---
181
+
182
+ ## 🗂️ .gitignore Management
183
+
184
+ AI-Rulez manages your `.gitignore` to keep generated files out of version control.
185
+
186
+ **Automatic updates:**
187
+ ```bash
188
+ # During init (enabled by default)
189
+ ai-rulez init --preset claude
190
+
191
+ # During generate (optional)
192
+ ai-rulez generate --update-gitignore
193
+
194
+ # Disable if needed
195
+ ai-rulez init --preset popular --no-gitignore
196
+ ```
197
+
198
+ **What gets ignored:**
199
+ - Generated markdown files (`CLAUDE.md`, `GEMINI.md`, `AGENTS.md`)
200
+ - AI tool directories (`.claude/`, `.cursor/`, `.windsurf/`, `.clinerules/`, etc.)
201
+ - Config files (`.mcp.json`, `.gemini/settings.json`)
202
+
203
+ All entries are added under `# AI Rules generated files` without duplicates.
204
+
205
+ **Best practice:** Commit `ai-rulez.yaml` and `.gitignore`, but not the generated AI configuration files.
206
+
207
+ ---
208
+
209
+ ## 🤖 AI-Powered Rule Enforcement
210
+
211
+ The killer feature that sets AI-Rulez apart: **real-time rule enforcement using AI agents**. No more manual code reviews for basic violations—let AI catch and fix issues automatically.
212
+
213
+ ### ✨ Key Benefits
214
+
215
+ - **Proactive Quality Control**: Catch issues before they reach production
216
+ - **Multi-Agent Support**: Claude, Gemini, AMP, Cursor, Codex—use the best AI for each task
217
+ - **Automatic Fixes**: AI doesn't just find problems, it solves them
218
+ - **Workflow Integration**: Git hooks, CI/CD, pre-commit—enforcement everywhere
219
+ - **Team Consistency**: Same standards for everyone, from junior to senior devs
220
+
221
+ ### 🎯 Real-World Use Cases
222
+
223
+ ```bash
224
+ # Prevent console.log in production builds
225
+ ai-rulez enforce --agent claude --only-rules "no-console-output" --fix
226
+
227
+ # Ensure all functions have proper error handling
228
+ ai-rulez enforce --agent gemini --level strict --format json
229
+
230
+ # Multi-agent review for critical code changes
231
+ ai-rulez enforce --agent claude --review --review-agent gemini --review-threshold 95
232
+
233
+ # Automated fixes in CI/CD pipeline
234
+ ai-rulez enforce --agent claude --fix --format csv --output violations.csv
235
+ ```
236
+
237
+ ### 📊 Output Formats & Integration
238
+
239
+ | Format | Use Case | Command |
240
+ |--------|----------|---------|
241
+ | **Table** | Human-readable terminal output | `--format table` |
242
+ | **JSON** | API integration, detailed analysis | `--format json --pretty` |
243
+ | **CSV** | Data analysis, reporting | `--format csv --output report.csv` |
244
+ | **Summary** | Quick overview with scores | `--format summary` |
245
+
246
+ ### 🔄 Advanced Workflows
247
+
248
+ **Review Pipeline**: Multi-agent validation with quality gates
249
+ ```bash
250
+ ai-rulez enforce --agent claude --review --review-iterations 3 --review-threshold 85
251
+ ```
252
+
253
+ **Fix & Verify**: Apply fixes and validate improvements
254
+ ```bash
255
+ ai-rulez enforce --agent gemini --fix --review --require-improvement
256
+ ```
257
+
258
+ **Team Standards**: Consistent enforcement across the entire codebase
259
+ ```bash
260
+ ai-rulez enforce --include-files "src/**/*.{js,ts,py}" --level strict --agent claude
261
+ ```
130
262
 
131
263
  **Prefer manual setup?**
132
264
  ```bash
133
265
  # Basic initialization without AI assistance
134
- ai-rulez init "My Project" --preset popular
266
+ ai-rulez init "My Project" --preset popular --no-agent
135
267
 
136
- # Add your project-specific context
268
+ # Add your project-specific context
137
269
  ai-rulez add rule "Tech Stack" --priority critical --content "This project uses Go and PostgreSQL."
138
270
 
139
271
  # Generate files
@@ -215,58 +347,172 @@ ai-rulez mcp
215
347
  # Or configure it automatically via your ai-rulez.yaml
216
348
  mcp_servers:
217
349
  - name: "ai-rulez"
218
- command: "ai-rulez"
219
- args: ["mcp"]
350
+ command: "npx"
351
+ args: ["-y", "ai-rulez@latest", "mcp"]
220
352
  description: "Configuration management server"
221
353
  ```
222
354
 
223
- ## Installation
355
+ ## AI-Powered Rule Enforcement
224
356
 
225
- ### Run without installing
357
+ AI-Rulez provides **real-time rule enforcement** using AI agents to automatically detect violations and apply fixes across your codebase.
226
358
 
227
- For one-off executions, you can run `ai-rulez` directly without a system-wide installation.
359
+ <p align="center">
360
+ <img src="docs/assets/ai-rulez-enforce-demo.gif" alt="AI-Rulez Enforcement Demo" width="100%">
361
+ </p>
362
+
363
+ ### Basic Enforcement
228
364
 
229
- **Go**
230
365
  ```bash
231
- go run github.com/Goldziher/ai-rulez/cmd@latest --help
366
+ # Check for violations (read-only by default)
367
+ ai-rulez enforce
368
+
369
+ # Automatically apply fixes
370
+ ai-rulez enforce --fix
371
+
372
+ # Use specific AI agent
373
+ ai-rulez enforce --agent gemini --fix
232
374
  ```
233
375
 
234
- **Node.js (via npx)**
376
+ ### Advanced Enforcement Options
377
+
235
378
  ```bash
236
- # Installs and runs the latest version
237
- npx ai-rulez@latest init
379
+ # Enforce with specific level
380
+ ai-rulez enforce --level strict --agent claude
381
+
382
+ # Review workflow with iterative improvement
383
+ ai-rulez enforce --review --review-iterations 3 --review-threshold 85
384
+
385
+ # Multi-agent review (different agents for enforcement vs review)
386
+ ai-rulez enforce --agent gemini --review --review-agent claude
387
+
388
+ # Target specific files and rules
389
+ ai-rulez enforce --include-files "src/**/*.js" --only-rules "no-console-output"
390
+
391
+ # Output formats for automation
392
+ ai-rulez enforce --format json --output violations.json
393
+ ai-rulez enforce --format csv --output report.csv
394
+ ```
395
+
396
+ ### Supported AI Agents
397
+
398
+ AI-Rulez integrates with all major AI coding assistants:
399
+
400
+ - **Claude** (`claude`) - Anthropic's AI assistant
401
+ - **Gemini** (`gemini`) - Google's AI model
402
+ - **Cursor** (`cursor`) - AI-powered code editor
403
+ - **AMP** (`amp`) - Sourcegraph's AI assistant
404
+ - **Codex** (`codex`) - OpenAI's code model
405
+ - **Continue.dev** (`continue-dev`) - Open-source coding assistant
406
+ - **Junie** (`junie`) - JetBrains AI assistant
407
+
408
+ ### Enforcement Levels
409
+
410
+ - **`warn`**: Log violations but don't fail (default)
411
+ - **`error`**: Fail on violations but don't auto-fix
412
+ - **`fix`**: Automatically apply suggested fixes
413
+ - **`strict`**: Fail immediately on any violation
414
+
415
+ ### Integration with Git Hooks
416
+
417
+ Add enforcement to your Git workflow:
418
+
419
+ ```yaml
420
+ # .lefthook.yml
421
+ pre-commit:
422
+ commands:
423
+ ai-rulez-enforce:
424
+ run: ai-rulez enforce --level error --agent gemini
425
+ stage_fixed: true
238
426
  ```
239
427
 
240
- **Python (via uvx)**
241
428
  ```bash
242
- # Runs ai-rulez in a temporary virtual environment
243
- uvx ai-rulez init
429
+ # Or with pre-commit hooks
430
+ # .pre-commit-config.yaml
431
+ repos:
432
+ - repo: local
433
+ hooks:
434
+ - id: ai-rulez-enforce
435
+ name: AI-Rulez Enforcement
436
+ entry: ai-rulez enforce --level error
437
+ language: system
438
+ pass_filenames: false
244
439
  ```
245
440
 
246
- ### Install globally
441
+ ### Review Workflow
247
442
 
248
- For frequent use, a global installation is recommended.
443
+ The review system provides iterative code improvement:
249
444
 
250
- **Go**
251
445
  ```bash
252
- go install github.com/Goldziher/ai-rulez/cmd@latest
446
+ # Enable review with quality scoring
447
+ ai-rulez enforce --review --review-threshold 80
448
+
449
+ # Multiple review iterations
450
+ ai-rulez enforce --review --review-iterations 5
451
+
452
+ # Auto-approve after reaching threshold
453
+ ai-rulez enforce --review --review-auto-approve
454
+
455
+ # Require improvement between iterations
456
+ ai-rulez enforce --review --require-improvement
253
457
  ```
254
458
 
255
- **Homebrew (macOS/Linux)**
459
+ The AI reviewer analyzes:
460
+ - ✅ Code quality and adherence to rules
461
+ - ✅ Suggested fixes and their appropriateness
462
+ - ✅ Overall improvement between iterations
463
+ - ✅ Compliance with project standards
464
+
465
+ ## 📦 Installation
466
+
467
+ Choose your installation method based on your primary use case:
468
+
469
+ ### 🚀 Quick Start (No Installation)
470
+
471
+ **For Configuration Management** (project setup, file generation):
472
+ ```bash
473
+ # Node.js - Best for web/JS projects
474
+ npx ai-rulez@latest init "My Project" --preset popular
475
+ npx ai-rulez@latest generate
476
+ ```
477
+
478
+ **For Rule Enforcement** (AI-powered validation):
479
+ ```bash
480
+ # Python - Latest features, fastest updates
481
+ uvx ai-rulez@latest enforce --agent claude --fix
482
+ uvx ai-rulez@latest enforce --agent gemini --review
483
+ ```
484
+
485
+ **For Go Projects**:
486
+ ```bash
487
+ go run github.com/Goldziher/ai-rulez/cmd@latest init
488
+ ```
489
+
490
+ ### 🔧 Global Installation
491
+
492
+ For teams and frequent usage:
493
+
494
+ **Homebrew (Recommended for macOS/Linux)**
256
495
  ```bash
257
496
  brew install goldziher/tap/ai-rulez
497
+ ai-rulez init "My Project"
498
+ ai-rulez enforce --agent claude
258
499
  ```
259
500
 
260
- **npm**
501
+ **npm (Best for Node.js teams)**
261
502
  ```bash
262
503
  npm install -g ai-rulez
263
504
  ```
264
505
 
265
- **pip**
506
+ **pip (Best for Python teams)**
266
507
  ```bash
267
508
  pip install ai-rulez
268
509
  ```
269
510
 
511
+ **Go (For Go developers)**
512
+ ```bash
513
+ go install github.com/Goldziher/ai-rulez/cmd@latest
514
+ ```
515
+
270
516
  ## Pre-commit Hooks
271
517
 
272
518
  You can use `ai-rulez` with `pre-commit` to automatically validate and generate your AI configuration files.
@@ -276,7 +522,7 @@ Add the following to your `.pre-commit-config.yaml`:
276
522
  ```yaml
277
523
  repos:
278
524
  - repo: https://github.com/Goldziher/ai-rulez
279
- rev: v2.1.4
525
+ rev: v2.2.1
280
526
  hooks:
281
527
  - id: ai-rulez-validate
282
528
  - id: ai-rulez-generate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-rulez",
3
- "version": "2.2.1",
3
+ "version": "2.4.0",
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",