rulix 0.1.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.
- package/LICENSE +21 -0
- package/README.md +237 -0
- package/dist/chunk-I6MHHT6P.cjs +1235 -0
- package/dist/chunk-I6MHHT6P.cjs.map +1 -0
- package/dist/chunk-IX4ZOAKV.js +1235 -0
- package/dist/chunk-IX4ZOAKV.js.map +1 -0
- package/dist/cli/index.cjs +417 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +417 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.cjs +91 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +298 -0
- package/dist/index.d.ts +298 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rulix Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<h1 align="center">Rulix</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="docs/assets/rulix-logo.jpeg" alt="Rulix — One ruleset. Every AI coding tool." width="640">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/rulix"><img src="https://img.shields.io/npm/v/rulix.svg" alt="npm version"></a>
|
|
9
|
+
<a href="https://github.com/danielcinome/rulix/actions/workflows/ci.yml"><img src="https://github.com/danielcinome/rulix/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
10
|
+
<a href="https://github.com/danielcinome/rulix/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/rulix.svg" alt="MIT License"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/rulix"><img src="https://img.shields.io/npm/dm/rulix.svg" alt="Downloads"></a>
|
|
12
|
+
<img src="https://img.shields.io/node/v/rulix.svg" alt="Node.js">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="#installation">Installation</a> ·
|
|
17
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
18
|
+
<a href="docs/getting-started.md">Getting Started</a> ·
|
|
19
|
+
<a href="docs/cli-reference.md">CLI Reference</a> ·
|
|
20
|
+
<a href="docs/api-reference.md">API Reference</a> ·
|
|
21
|
+
<a href="CONTRIBUTING.md">Contributing</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Rulix is a CLI tool and TypeScript library that gives you a **single source of truth** for AI coding rules across Cursor, Claude Code, AGENTS.md, and more.
|
|
27
|
+
|
|
28
|
+
Write your rules once. Rulix generates optimized configs for each tool — handling format differences, scoping semantics, and token budgets automatically.
|
|
29
|
+
|
|
30
|
+
## Why Rulix?
|
|
31
|
+
|
|
32
|
+
Every AI coding tool has its own rules format:
|
|
33
|
+
|
|
34
|
+
| Tool | Format | Location |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| Cursor | `.mdc` with YAML frontmatter | `.cursor/rules/` |
|
|
37
|
+
| Claude Code | Plain markdown | `CLAUDE.md` + `.claude/rules/` |
|
|
38
|
+
| AGENTS.md | Plain markdown | `AGENTS.md` |
|
|
39
|
+
| Windsurf | Markdown | `.windsurf/rules/` |
|
|
40
|
+
| Copilot | Markdown | `.github/copilot-instructions.md` |
|
|
41
|
+
|
|
42
|
+
If you use more than one tool, you're maintaining duplicate rules that drift apart. Rulix solves this:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
.rulix/rules/ .cursor/rules/*.mdc
|
|
46
|
+
├── typescript.md → CLAUDE.md + .claude/rules/
|
|
47
|
+
├── testing.md → AGENTS.md
|
|
48
|
+
└── security.md → (more targets coming)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# npm
|
|
55
|
+
npm install -D rulix
|
|
56
|
+
|
|
57
|
+
# pnpm
|
|
58
|
+
pnpm add -D rulix
|
|
59
|
+
|
|
60
|
+
# yarn
|
|
61
|
+
yarn add -D rulix
|
|
62
|
+
|
|
63
|
+
# bun
|
|
64
|
+
bun add -D rulix
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Or run directly with `npx`:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx rulix init
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> **Requirements**: Node.js 22 or higher.
|
|
74
|
+
|
|
75
|
+
## Quick Start
|
|
76
|
+
|
|
77
|
+
### 1. Initialize your project
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npx rulix init
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This creates a `.rulix/` directory with a `config.json` and a `rules/` folder.
|
|
84
|
+
|
|
85
|
+
### 2. Import existing rules (optional)
|
|
86
|
+
|
|
87
|
+
Already have rules in Cursor or Claude Code? Import them:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx rulix import --from cursor
|
|
91
|
+
npx rulix import --from claude-code
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. Write a rule
|
|
95
|
+
|
|
96
|
+
Create `.rulix/rules/typescript-strict.md`:
|
|
97
|
+
|
|
98
|
+
```markdown
|
|
99
|
+
---
|
|
100
|
+
id: typescript-strict
|
|
101
|
+
scope: always
|
|
102
|
+
description: "Enforce strict TypeScript conventions"
|
|
103
|
+
category: style
|
|
104
|
+
priority: 1
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
# TypeScript Conventions
|
|
108
|
+
|
|
109
|
+
- Use `strict: true` in tsconfig
|
|
110
|
+
- Never use `any` — prefer `unknown` with type narrowing
|
|
111
|
+
- Use explicit return types on public functions
|
|
112
|
+
- Prefer `interface` over `type` for object shapes
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 4. Sync to your tools
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npx rulix sync
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This generates tool-specific configs for every target in your `config.json`.
|
|
122
|
+
|
|
123
|
+
### 5. Validate your rules
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx rulix validate
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Catches duplicates, vague descriptions, missing fields, and token budget issues.
|
|
130
|
+
|
|
131
|
+
### 6. Check status
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx rulix status
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Shows rule count, token budget usage per tool, and configured targets.
|
|
138
|
+
|
|
139
|
+
## Rule Format
|
|
140
|
+
|
|
141
|
+
Rules live in `.rulix/rules/*.md` as Markdown with YAML frontmatter:
|
|
142
|
+
|
|
143
|
+
| Field | Type | Required | Description |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| `id` | `string` | Yes | Unique kebab-case identifier |
|
|
146
|
+
| `scope` | `"always" \| "file-scoped" \| "agent-selected"` | Yes | When the rule applies |
|
|
147
|
+
| `description` | `string` | Yes | What the rule does (used by AI for selection) |
|
|
148
|
+
| `category` | `"style" \| "security" \| "testing" \| "architecture" \| "workflow" \| "general"` | No | Rule category (defaults to `"general"`) |
|
|
149
|
+
| `priority` | `1-5` | No | 1 = critical, 5 = nice-to-have (defaults to `3`) |
|
|
150
|
+
| `globs` | `string[]` | If `file-scoped` | File patterns this rule applies to |
|
|
151
|
+
|
|
152
|
+
**Scopes explained:**
|
|
153
|
+
|
|
154
|
+
- **`always`** — Applied to every AI request. Use for project-wide conventions.
|
|
155
|
+
- **`file-scoped`** — Applied only when matching files are open. Requires `globs`.
|
|
156
|
+
- **`agent-selected`** — The AI decides when to apply this rule based on its `description`.
|
|
157
|
+
|
|
158
|
+
See [Writing Rules](docs/writing-rules.md) for detailed examples and best practices.
|
|
159
|
+
|
|
160
|
+
## Key Features
|
|
161
|
+
|
|
162
|
+
- **Import** existing rules from Cursor or Claude Code
|
|
163
|
+
- **Export** to Cursor, Claude Code, and AGENTS.md (more targets coming)
|
|
164
|
+
- **Validate** rules for duplicates, conflicts, and vague content
|
|
165
|
+
- **Token budgets** — know when your rules exceed a tool's recommended limits
|
|
166
|
+
- **Zero LLM dependency** — all validation is deterministic, works offline
|
|
167
|
+
- **Programmatic API** — use Rulix as a library in your own tools
|
|
168
|
+
- **Zero config** — sensible defaults, override only what you need
|
|
169
|
+
|
|
170
|
+
## Supported Tools
|
|
171
|
+
|
|
172
|
+
| Tool | Import | Export | Status |
|
|
173
|
+
|---|---|---|---|
|
|
174
|
+
| Cursor | Yes | Yes | v0.1 |
|
|
175
|
+
| Claude Code | Yes | Yes | v0.1 |
|
|
176
|
+
| AGENTS.md | — | Yes | v0.1 |
|
|
177
|
+
| Windsurf | — | — | Planned |
|
|
178
|
+
| Copilot | — | — | Planned |
|
|
179
|
+
| Codex | — | — | Planned |
|
|
180
|
+
|
|
181
|
+
## Configuration
|
|
182
|
+
|
|
183
|
+
Rulix is configured via `.rulix/config.json`:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"targets": ["cursor", "claude-code", "agents-md"],
|
|
188
|
+
"presets": [],
|
|
189
|
+
"overrides": {},
|
|
190
|
+
"options": {
|
|
191
|
+
"tokenEstimation": "heuristic",
|
|
192
|
+
"agentsMdHeader": true,
|
|
193
|
+
"claudeMdStrategy": "concatenate",
|
|
194
|
+
"syncOnSave": false
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
See [Configuration Reference](docs/configuration.md) for all options.
|
|
200
|
+
|
|
201
|
+
## Programmatic API
|
|
202
|
+
|
|
203
|
+
Rulix can be used as a library in your own tools:
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { loadRuleset, exportRules, validateRuleset } from "rulix";
|
|
207
|
+
|
|
208
|
+
// Load rules from a project
|
|
209
|
+
const ruleset = await loadRuleset("./my-project");
|
|
210
|
+
|
|
211
|
+
// Validate
|
|
212
|
+
const result = validateRuleset(ruleset);
|
|
213
|
+
console.log(result.passed); // true if no errors
|
|
214
|
+
|
|
215
|
+
// Export to a specific tool
|
|
216
|
+
await exportRules("cursor", ruleset.rules, "./my-project");
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
See [API Reference](docs/api-reference.md) for the complete API.
|
|
220
|
+
|
|
221
|
+
## Contributing
|
|
222
|
+
|
|
223
|
+
Contributions are welcome! The most impactful ways to help:
|
|
224
|
+
|
|
225
|
+
1. **New adapters** — Add support for Windsurf, Copilot, Cline, etc.
|
|
226
|
+
2. **Validation rules** — New checks for common rule issues
|
|
227
|
+
3. **Bug reports** — Especially format edge cases
|
|
228
|
+
|
|
229
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and guidelines, and [Writing an Adapter](docs/adapters.md) for the adapter guide.
|
|
230
|
+
|
|
231
|
+
## Author
|
|
232
|
+
|
|
233
|
+
**Daniel Chinome** — [@danielcinome](https://github.com/danielcinome)
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
[MIT](LICENSE)
|