ai-rulez 2.2.1 → 2.3.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.
Files changed (2) hide show
  1. package/README.md +321 -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
@@ -142,6 +274,8 @@ ai-rulez generate
142
274
 
143
275
  ## MCP Server Integration
144
276
 
277
+ > **New in v2.3.1**: `ai-rulez` now ships with the official `modelcontextprotocol/go-sdk`, ensuring protocol-compliant tooling and first-class support for streamable transports across Claude, Gemini, and other MCP clients.
278
+
145
279
  `ai-rulez` provides seamless **Model Context Protocol (MCP)** integration, automatically configuring both file-based and CLI-based AI tools with your MCP servers.
146
280
 
147
281
  ### Automatic CLI Configuration
@@ -215,58 +349,172 @@ ai-rulez mcp
215
349
  # Or configure it automatically via your ai-rulez.yaml
216
350
  mcp_servers:
217
351
  - name: "ai-rulez"
218
- command: "ai-rulez"
219
- args: ["mcp"]
352
+ command: "npx"
353
+ args: ["-y", "ai-rulez@latest", "mcp"]
220
354
  description: "Configuration management server"
221
355
  ```
222
356
 
223
- ## Installation
357
+ ## AI-Powered Rule Enforcement
224
358
 
225
- ### Run without installing
359
+ AI-Rulez provides **real-time rule enforcement** using AI agents to automatically detect violations and apply fixes across your codebase.
226
360
 
227
- For one-off executions, you can run `ai-rulez` directly without a system-wide installation.
361
+ <p align="center">
362
+ <img src="docs/assets/ai-rulez-enforce-demo.gif" alt="AI-Rulez Enforcement Demo" width="100%">
363
+ </p>
364
+
365
+ ### Basic Enforcement
228
366
 
229
- **Go**
230
367
  ```bash
231
- go run github.com/Goldziher/ai-rulez/cmd@latest --help
368
+ # Check for violations (read-only by default)
369
+ ai-rulez enforce
370
+
371
+ # Automatically apply fixes
372
+ ai-rulez enforce --fix
373
+
374
+ # Use specific AI agent
375
+ ai-rulez enforce --agent gemini --fix
232
376
  ```
233
377
 
234
- **Node.js (via npx)**
378
+ ### Advanced Enforcement Options
379
+
235
380
  ```bash
236
- # Installs and runs the latest version
237
- npx ai-rulez@latest init
381
+ # Enforce with specific level
382
+ ai-rulez enforce --level strict --agent claude
383
+
384
+ # Review workflow with iterative improvement
385
+ ai-rulez enforce --review --review-iterations 3 --review-threshold 85
386
+
387
+ # Multi-agent review (different agents for enforcement vs review)
388
+ ai-rulez enforce --agent gemini --review --review-agent claude
389
+
390
+ # Target specific files and rules
391
+ ai-rulez enforce --include-files "src/**/*.js" --only-rules "no-console-output"
392
+
393
+ # Output formats for automation
394
+ ai-rulez enforce --format json --output violations.json
395
+ ai-rulez enforce --format csv --output report.csv
396
+ ```
397
+
398
+ ### Supported AI Agents
399
+
400
+ AI-Rulez integrates with all major AI coding assistants:
401
+
402
+ - **Claude** (`claude`) - Anthropic's AI assistant
403
+ - **Gemini** (`gemini`) - Google's AI model
404
+ - **Cursor** (`cursor`) - AI-powered code editor
405
+ - **AMP** (`amp`) - Sourcegraph's AI assistant
406
+ - **Codex** (`codex`) - OpenAI's code model
407
+ - **Continue.dev** (`continue-dev`) - Open-source coding assistant
408
+ - **Junie** (`junie`) - JetBrains AI assistant
409
+
410
+ ### Enforcement Levels
411
+
412
+ - **`warn`**: Log violations but don't fail (default)
413
+ - **`error`**: Fail on violations but don't auto-fix
414
+ - **`fix`**: Automatically apply suggested fixes
415
+ - **`strict`**: Fail immediately on any violation
416
+
417
+ ### Integration with Git Hooks
418
+
419
+ Add enforcement to your Git workflow:
420
+
421
+ ```yaml
422
+ # .lefthook.yml
423
+ pre-commit:
424
+ commands:
425
+ ai-rulez-enforce:
426
+ run: ai-rulez enforce --level error --agent gemini
427
+ stage_fixed: true
238
428
  ```
239
429
 
240
- **Python (via uvx)**
241
430
  ```bash
242
- # Runs ai-rulez in a temporary virtual environment
243
- uvx ai-rulez init
431
+ # Or with pre-commit hooks
432
+ # .pre-commit-config.yaml
433
+ repos:
434
+ - repo: local
435
+ hooks:
436
+ - id: ai-rulez-enforce
437
+ name: AI-Rulez Enforcement
438
+ entry: ai-rulez enforce --level error
439
+ language: system
440
+ pass_filenames: false
244
441
  ```
245
442
 
246
- ### Install globally
443
+ ### Review Workflow
247
444
 
248
- For frequent use, a global installation is recommended.
445
+ The review system provides iterative code improvement:
249
446
 
250
- **Go**
251
447
  ```bash
252
- go install github.com/Goldziher/ai-rulez/cmd@latest
448
+ # Enable review with quality scoring
449
+ ai-rulez enforce --review --review-threshold 80
450
+
451
+ # Multiple review iterations
452
+ ai-rulez enforce --review --review-iterations 5
453
+
454
+ # Auto-approve after reaching threshold
455
+ ai-rulez enforce --review --review-auto-approve
456
+
457
+ # Require improvement between iterations
458
+ ai-rulez enforce --review --require-improvement
253
459
  ```
254
460
 
255
- **Homebrew (macOS/Linux)**
461
+ The AI reviewer analyzes:
462
+ - ✅ Code quality and adherence to rules
463
+ - ✅ Suggested fixes and their appropriateness
464
+ - ✅ Overall improvement between iterations
465
+ - ✅ Compliance with project standards
466
+
467
+ ## 📦 Installation
468
+
469
+ Choose your installation method based on your primary use case:
470
+
471
+ ### 🚀 Quick Start (No Installation)
472
+
473
+ **For Configuration Management** (project setup, file generation):
474
+ ```bash
475
+ # Node.js - Best for web/JS projects
476
+ npx ai-rulez@latest init "My Project" --preset popular
477
+ npx ai-rulez@latest generate
478
+ ```
479
+
480
+ **For Rule Enforcement** (AI-powered validation):
481
+ ```bash
482
+ # Python - Latest features, fastest updates
483
+ uvx ai-rulez@latest enforce --agent claude --fix
484
+ uvx ai-rulez@latest enforce --agent gemini --review
485
+ ```
486
+
487
+ **For Go Projects**:
488
+ ```bash
489
+ go run github.com/Goldziher/ai-rulez/cmd@latest init
490
+ ```
491
+
492
+ ### 🔧 Global Installation
493
+
494
+ For teams and frequent usage:
495
+
496
+ **Homebrew (Recommended for macOS/Linux)**
256
497
  ```bash
257
498
  brew install goldziher/tap/ai-rulez
499
+ ai-rulez init "My Project"
500
+ ai-rulez enforce --agent claude
258
501
  ```
259
502
 
260
- **npm**
503
+ **npm (Best for Node.js teams)**
261
504
  ```bash
262
505
  npm install -g ai-rulez
263
506
  ```
264
507
 
265
- **pip**
508
+ **pip (Best for Python teams)**
266
509
  ```bash
267
510
  pip install ai-rulez
268
511
  ```
269
512
 
513
+ **Go (For Go developers)**
514
+ ```bash
515
+ go install github.com/Goldziher/ai-rulez/cmd@latest
516
+ ```
517
+
270
518
  ## Pre-commit Hooks
271
519
 
272
520
  You can use `ai-rulez` with `pre-commit` to automatically validate and generate your AI configuration files.
@@ -276,7 +524,7 @@ Add the following to your `.pre-commit-config.yaml`:
276
524
  ```yaml
277
525
  repos:
278
526
  - repo: https://github.com/Goldziher/ai-rulez
279
- rev: v2.1.4
527
+ rev: v2.3.1
280
528
  hooks:
281
529
  - id: ai-rulez-validate
282
530
  - 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.3.1",
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",