rulesync 7.3.0 → 7.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.
- package/README.md +12 -941
- package/dist/{chunk-NRNUPCXY.js → chunk-UCC3WPDL.js} +172 -53
- package/dist/cli/index.cjs +177 -69
- package/dist/cli/index.js +6 -17
- package/dist/index.cjs +172 -53
- package/dist/index.js +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
[](https://github.com/Piebald-AI/awesome-gemini-cli)
|
|
13
13
|
<a href="https://flatt.tech/oss/gmo/trampoline" target="_blank"><img src="https://flatt.tech/assets/images/badges/gmo-oss.svg" height="24px"/></a>
|
|
14
14
|
|
|
15
|
+
**[Documentation](https://dyoshikawa.github.io/rulesync/)** | **[npm](https://www.npmjs.com/package/rulesync)**
|
|
16
|
+
|
|
15
17
|
A Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files. Features selective generation, comprehensive import/export capabilities, and supports major AI development tools with rules, commands, MCP, ignore files, subagents and skills.
|
|
16
18
|
|
|
17
19
|
> [!NOTE]
|
|
@@ -20,134 +22,45 @@ A Node.js CLI tool that automatically generates configuration files for various
|
|
|
20
22
|
|
|
21
23
|
## Installation
|
|
22
24
|
|
|
23
|
-
### Package Managers
|
|
24
|
-
|
|
25
25
|
```bash
|
|
26
26
|
npm install -g rulesync
|
|
27
27
|
# or
|
|
28
28
|
brew install rulesync
|
|
29
|
-
|
|
30
|
-
# And then
|
|
31
|
-
rulesync --version
|
|
32
|
-
rulesync --help
|
|
33
29
|
```
|
|
34
30
|
|
|
35
31
|
### Single Binary (Experimental)
|
|
36
32
|
|
|
37
|
-
Download pre-built binaries from the [latest release](https://github.com/dyoshikawa/rulesync/releases/latest). These binaries are built using [Bun's single-file executable bundler](https://bun.sh/docs/bundler/executables).
|
|
38
|
-
|
|
39
|
-
**Quick Install (Linux/macOS - No sudo required):**
|
|
40
|
-
|
|
41
33
|
```bash
|
|
42
34
|
curl -fsSL https://github.com/dyoshikawa/rulesync/releases/latest/download/install.sh | bash
|
|
43
35
|
```
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- Install specific version: `curl -fsSL https://github.com/dyoshikawa/rulesync/releases/latest/download/install.sh | bash -s -- v6.4.0`
|
|
48
|
-
- Custom directory: `RULESYNC_HOME=~/.local curl -fsSL https://github.com/dyoshikawa/rulesync/releases/latest/download/install.sh | bash`
|
|
49
|
-
|
|
50
|
-
<details>
|
|
51
|
-
<summary>Manual installation (requires sudo)</summary>
|
|
52
|
-
|
|
53
|
-
#### Linux (x64)
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
curl -L https://github.com/dyoshikawa/rulesync/releases/latest/download/rulesync-linux-x64 -o rulesync && \
|
|
57
|
-
chmod +x rulesync && \
|
|
58
|
-
sudo mv rulesync /usr/local/bin/
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
#### Linux (ARM64)
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
curl -L https://github.com/dyoshikawa/rulesync/releases/latest/download/rulesync-linux-arm64 -o rulesync && \
|
|
65
|
-
chmod +x rulesync && \
|
|
66
|
-
sudo mv rulesync /usr/local/bin/
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
#### macOS (Apple Silicon)
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
curl -L https://github.com/dyoshikawa/rulesync/releases/latest/download/rulesync-darwin-arm64 -o rulesync && \
|
|
73
|
-
chmod +x rulesync && \
|
|
74
|
-
sudo mv rulesync /usr/local/bin/
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
#### macOS (Intel)
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
curl -L https://github.com/dyoshikawa/rulesync/releases/latest/download/rulesync-darwin-x64 -o rulesync && \
|
|
81
|
-
chmod +x rulesync && \
|
|
82
|
-
sudo mv rulesync /usr/local/bin/
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
#### Windows (x64)
|
|
86
|
-
|
|
87
|
-
```powershell
|
|
88
|
-
Invoke-WebRequest -Uri "https://github.com/dyoshikawa/rulesync/releases/latest/download/rulesync-windows-x64.exe" -OutFile "rulesync.exe"; `
|
|
89
|
-
Move-Item rulesync.exe C:\Windows\System32\
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Or using curl (if available):
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
curl -L https://github.com/dyoshikawa/rulesync/releases/latest/download/rulesync-windows-x64.exe -o rulesync.exe && \
|
|
96
|
-
mv rulesync.exe /path/to/your/bin/
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
#### Verify checksums
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
curl -L https://github.com/dyoshikawa/rulesync/releases/latest/download/SHA256SUMS -o SHA256SUMS
|
|
103
|
-
|
|
104
|
-
# Linux/macOS
|
|
105
|
-
sha256sum -c SHA256SUMS
|
|
106
|
-
|
|
107
|
-
# Windows (PowerShell)
|
|
108
|
-
# Download SHA256SUMS file first, then verify:
|
|
109
|
-
Get-FileHash rulesync.exe -Algorithm SHA256 | ForEach-Object {
|
|
110
|
-
$actual = $_.Hash.ToLower()
|
|
111
|
-
$expected = (Get-Content SHA256SUMS | Select-String "rulesync-windows-x64.exe").ToString().Split()[0]
|
|
112
|
-
if ($actual -eq $expected) { "✓ Checksum verified" } else { "✗ Checksum mismatch" }
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
</details>
|
|
37
|
+
See [Installation docs](https://dyoshikawa.github.io/rulesync/getting-started/installation) for manual install and platform-specific instructions.
|
|
117
38
|
|
|
118
39
|
## Getting Started
|
|
119
40
|
|
|
120
41
|
```bash
|
|
121
|
-
# Install rulesync globally
|
|
122
|
-
npm install -g rulesync
|
|
123
|
-
|
|
124
42
|
# Create necessary directories, sample rule files, and configuration file
|
|
125
43
|
rulesync init
|
|
126
44
|
|
|
127
45
|
# Install official skills (recommended)
|
|
128
46
|
rulesync fetch dyoshikawa/rulesync --features skills
|
|
129
47
|
|
|
130
|
-
#
|
|
48
|
+
# Generate unified configurations with all features
|
|
49
|
+
rulesync generate --targets "*" --features "*"
|
|
131
50
|
```
|
|
132
51
|
|
|
133
|
-
|
|
52
|
+
If you already have AI tool configurations:
|
|
134
53
|
|
|
135
54
|
```bash
|
|
136
55
|
# Import existing files (to .rulesync/**/*)
|
|
137
56
|
rulesync import --targets claudecode # From CLAUDE.md
|
|
138
57
|
rulesync import --targets cursor # From .cursorrules
|
|
139
58
|
rulesync import --targets copilot # From .github/copilot-instructions.md
|
|
140
|
-
rulesync import --targets claudecode --features rules,mcp,commands,subagents
|
|
141
|
-
|
|
142
|
-
# And more tool supports
|
|
143
|
-
|
|
144
|
-
# Generate unified configurations with all features
|
|
145
|
-
rulesync generate --targets "*" --features "*"
|
|
146
59
|
```
|
|
147
60
|
|
|
148
|
-
|
|
61
|
+
See [Quick Start guide](https://dyoshikawa.github.io/rulesync/getting-started/quick-start) for more details.
|
|
149
62
|
|
|
150
|
-
|
|
63
|
+
## Supported Tools and Features
|
|
151
64
|
|
|
152
65
|
| Tool | --targets | rules | ignore | mcp | commands | subagents | skills | hooks |
|
|
153
66
|
| ------------------ | ------------ | :---: | :----: | :---: | :------: | :-------: | :----: | :---: |
|
|
@@ -156,10 +69,10 @@ Rulesync supports both **generation** and **import** for All of the major AI cod
|
|
|
156
69
|
| Claude Code | claudecode | ✅ 🌏 | ✅ | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 | ✅ |
|
|
157
70
|
| Codex CLI | codexcli | ✅ 🌏 | | 🌏 🔧 | 🌏 | 🎮 | ✅ 🌏 | |
|
|
158
71
|
| Gemini CLI | geminicli | ✅ 🌏 | ✅ | ✅ 🌏 | ✅ 🌏 | 🎮 | ✅ 🌏 | |
|
|
159
|
-
| GitHub Copilot | copilot |
|
|
72
|
+
| GitHub Copilot | copilot | ✅ 🌏 | | ✅ | ✅ | ✅ | ✅ | |
|
|
160
73
|
| Cursor | cursor | ✅ | ✅ | ✅ | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 | ✅ |
|
|
161
74
|
| Factory Droid | factorydroid | ✅ 🌏 | | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 | |
|
|
162
|
-
| OpenCode | opencode |
|
|
75
|
+
| OpenCode | opencode | ✅ 🌏 | | ✅ 🔧 | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 | ✅ 🌏 |
|
|
163
76
|
| Cline | cline | ✅ | ✅ | ✅ | ✅ 🌏 | | | |
|
|
164
77
|
| Kilo Code | kilo | ✅ 🌏 | ✅ | ✅ | ✅ 🌏 | | ✅ 🌏 | |
|
|
165
78
|
| Roo Code | roo | ✅ | ✅ | ✅ | ✅ | 🎮 | ✅ 🌏 | |
|
|
@@ -178,851 +91,9 @@ Rulesync supports both **generation** and **import** for All of the major AI cod
|
|
|
178
91
|
- 🎮: Supports simulated commands/subagents/skills (Project mode only)
|
|
179
92
|
- 🔧: Supports MCP tool config (`enabledTools`/`disabledTools`)
|
|
180
93
|
|
|
181
|
-
##
|
|
182
|
-
|
|
183
|
-
### 🧭 **Single Source of Truth**
|
|
184
|
-
|
|
185
|
-
Author rules once, generate everywhere. Rulesync turns a unified ruleset into tool-native formats so teams stop duplicating instructions across multiple AI assistants.
|
|
186
|
-
|
|
187
|
-
### 🔧 **Tool Freedom Without Friction**
|
|
188
|
-
|
|
189
|
-
Let developers pick the assistant that fits their flow—Copilot, Cursor, Cline, Claude Code, and more—without rewriting team standards.
|
|
190
|
-
|
|
191
|
-
### 📦 **Clean, Auditable Outputs**
|
|
192
|
-
|
|
193
|
-
Rulesync emits plain configuration files you can commit, review, and ship. If you ever uninstall Rulesync, your generated files keep working.
|
|
194
|
-
|
|
195
|
-
### 🚀 **Fast Onboarding & Consistency**
|
|
196
|
-
|
|
197
|
-
New team members get the same conventions, context, and guardrails immediately, keeping code style and quality consistent across tools.
|
|
198
|
-
|
|
199
|
-
### 🧩 **Multi-Tool & Modular Workflows**
|
|
200
|
-
|
|
201
|
-
Compose rules, MCP configs, commands, and subagents for different tools or scopes (project vs. global) without fragmenting your workflow.
|
|
202
|
-
|
|
203
|
-
### 🌍 **Ready for What’s Next**
|
|
204
|
-
|
|
205
|
-
AI tool ecosystems evolve quickly. Rulesync helps you add, switch, or retire tools while keeping your rules intact.
|
|
206
|
-
|
|
207
|
-
## Case Studies
|
|
208
|
-
|
|
209
|
-
Rulesync is trusted by leading companies and recognized by the industry:
|
|
210
|
-
|
|
211
|
-
- **Anthropic Official Customer Story**: [Classmethod Inc. - Improving AI coding tool consistency with Rulesync](https://claude.com/customers/classmethod)
|
|
212
|
-
- **Asoview Inc.**: [Adopting Rulesync for unified AI development rules](https://tech.asoview.co.jp/entry/2025/12/06/100000)
|
|
213
|
-
- **KAKEHASHI Tech Blog**: [Building multilingual systems for the LLM era with a monorepo and a "living specification"](https://kakehashi-dev.hatenablog.com/entry/2025/12/08/110000)
|
|
214
|
-
|
|
215
|
-
## Quick Commands
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
# Initialize new project (recommended: organized rules structure)
|
|
219
|
-
rulesync init
|
|
220
|
-
|
|
221
|
-
# Import existing configurations (to .rulesync/rules/ by default)
|
|
222
|
-
rulesync import --targets claudecode --features rules,ignore,mcp,commands,subagents,skills
|
|
223
|
-
|
|
224
|
-
# Fetch configurations from a Git repository
|
|
225
|
-
rulesync fetch owner/repo
|
|
226
|
-
rulesync fetch owner/repo@v1.0.0 --features rules,commands
|
|
227
|
-
rulesync fetch https://github.com/owner/repo --conflict skip
|
|
228
|
-
|
|
229
|
-
# Generate all features for all tools (new preferred syntax)
|
|
230
|
-
rulesync generate --targets "*" --features "*"
|
|
231
|
-
|
|
232
|
-
# Generate specific features for specific tools
|
|
233
|
-
rulesync generate --targets copilot,cursor,cline --features rules,mcp
|
|
234
|
-
rulesync generate --targets claudecode --features rules,subagents
|
|
235
|
-
|
|
236
|
-
# Generate only rules (no MCP, ignore files, commands, or subagents)
|
|
237
|
-
rulesync generate --targets "*" --features rules
|
|
238
|
-
|
|
239
|
-
# Generate simulated commands and subagents
|
|
240
|
-
rulesync generate --targets copilot,cursor,codexcli --features commands,subagents --simulate-commands --simulate-subagents
|
|
241
|
-
|
|
242
|
-
# Dry run: show changes without writing files
|
|
243
|
-
rulesync generate --dry-run --targets claudecode --features rules
|
|
244
|
-
|
|
245
|
-
# Check if files are up to date (for CI/CD pipelines)
|
|
246
|
-
rulesync generate --check --targets "*" --features "*"
|
|
247
|
-
|
|
248
|
-
# Install skills from declarative sources in rulesync.jsonc
|
|
249
|
-
rulesync install
|
|
250
|
-
|
|
251
|
-
# Force re-resolve all source refs (ignore lockfile)
|
|
252
|
-
rulesync install --update
|
|
253
|
-
|
|
254
|
-
# Fail if lockfile is missing or out of sync (for CI)
|
|
255
|
-
rulesync install --frozen
|
|
256
|
-
|
|
257
|
-
# Install then generate (typical workflow)
|
|
258
|
-
rulesync install && rulesync generate
|
|
259
|
-
|
|
260
|
-
# Add generated files to .gitignore
|
|
261
|
-
rulesync gitignore
|
|
262
|
-
|
|
263
|
-
# Update rulesync to the latest version (single-binary installs)
|
|
264
|
-
rulesync update
|
|
265
|
-
|
|
266
|
-
# Check for updates without installing
|
|
267
|
-
rulesync update --check
|
|
268
|
-
|
|
269
|
-
# Force update even if already at latest version
|
|
270
|
-
rulesync update --force
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
## Dry Run
|
|
274
|
-
|
|
275
|
-
Rulesync provides two dry run options for the `generate` command that allow you to see what changes would be made without actually writing files:
|
|
276
|
-
|
|
277
|
-
### `--dry-run`
|
|
278
|
-
|
|
279
|
-
Show what would be written or deleted without actually writing any files. Changes are displayed with a `[DRY RUN]` prefix.
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
rulesync generate --dry-run --targets claudecode --features rules
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### `--check`
|
|
286
|
-
|
|
287
|
-
Same as `--dry-run`, but exits with code 1 if files are not up to date. This is useful for CI/CD pipelines to verify that generated files are committed.
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
# In your CI pipeline
|
|
291
|
-
rulesync generate --check --targets "*" --features "*"
|
|
292
|
-
echo $? # 0 if up to date, 1 if changes needed
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
> [!NOTE]
|
|
296
|
-
> `--dry-run` and `--check` cannot be used together.
|
|
297
|
-
|
|
298
|
-
## Fetch Command (In Development)
|
|
299
|
-
|
|
300
|
-
The `fetch` command allows you to fetch configuration files directly from a Git repository (GitHub/GitLab).
|
|
301
|
-
|
|
302
|
-
> [!NOTE]
|
|
303
|
-
> This feature is in development and may change in future releases.
|
|
304
|
-
|
|
305
|
-
**Note:** The fetch command searches for feature directories (`rules/`, `commands/`, `skills/`, `subagents/`, etc.) directly at the specified path, without requiring a `.rulesync/` directory structure. This allows fetching from external repositories like `vercel-labs/agent-skills` or `anthropics/skills`.
|
|
306
|
-
|
|
307
|
-
### Source Formats
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
# Full URL format
|
|
311
|
-
rulesync fetch https://github.com/owner/repo
|
|
312
|
-
rulesync fetch https://github.com/owner/repo/tree/branch
|
|
313
|
-
rulesync fetch https://github.com/owner/repo/tree/branch/path/to/subdir
|
|
314
|
-
rulesync fetch https://gitlab.com/owner/repo # GitLab (planned)
|
|
315
|
-
|
|
316
|
-
# Prefix format
|
|
317
|
-
rulesync fetch github:owner/repo
|
|
318
|
-
rulesync fetch gitlab:owner/repo # GitLab (planned)
|
|
319
|
-
|
|
320
|
-
# Shorthand format (defaults to GitHub)
|
|
321
|
-
rulesync fetch owner/repo
|
|
322
|
-
rulesync fetch owner/repo@ref # Specify branch/tag/commit
|
|
323
|
-
rulesync fetch owner/repo:path # Specify subdirectory
|
|
324
|
-
rulesync fetch owner/repo@ref:path # Both ref and path
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Options
|
|
328
|
-
|
|
329
|
-
| Option | Description | Default |
|
|
330
|
-
| ----------------------- | ------------------------------------------------------------------------------------------ | -------------------------------- |
|
|
331
|
-
| `--target, -t <target>` | Target format to interpret files as (e.g., 'rulesync', 'claudecode') | `rulesync` |
|
|
332
|
-
| `--features <features>` | Comma-separated features to fetch (rules, commands, subagents, skills, ignore, mcp, hooks) | `*` (all) |
|
|
333
|
-
| `--output <dir>` | Output directory relative to project root | `.rulesync` |
|
|
334
|
-
| `--conflict <strategy>` | Conflict resolution: `overwrite` or `skip` | `overwrite` |
|
|
335
|
-
| `--ref <ref>` | Git ref (branch/tag/commit) to fetch from | Default branch |
|
|
336
|
-
| `--path <path>` | Subdirectory in the repository | `.` (root) |
|
|
337
|
-
| `--token <token>` | Git provider token for private repositories | `GITHUB_TOKEN` or `GH_TOKEN` env |
|
|
338
|
-
|
|
339
|
-
### Examples
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
# Fetch skills from external repositories
|
|
343
|
-
rulesync fetch vercel-labs/agent-skills --features skills
|
|
344
|
-
rulesync fetch anthropics/skills --features skills
|
|
345
|
-
|
|
346
|
-
# Fetch all features from a public repository
|
|
347
|
-
rulesync fetch dyoshikawa/rulesync --path .rulesync
|
|
348
|
-
|
|
349
|
-
# Fetch only rules and commands from a specific tag
|
|
350
|
-
rulesync fetch owner/repo@v1.0.0 --features rules,commands
|
|
351
|
-
|
|
352
|
-
# Fetch from a private repository (uses GITHUB_TOKEN env var)
|
|
353
|
-
export GITHUB_TOKEN=ghp_xxxx
|
|
354
|
-
rulesync fetch owner/private-repo
|
|
355
|
-
|
|
356
|
-
# Or use GitHub CLI to get the token
|
|
357
|
-
GITHUB_TOKEN=$(gh auth token) rulesync fetch owner/private-repo
|
|
358
|
-
|
|
359
|
-
# Preserve existing files (skip conflicts)
|
|
360
|
-
rulesync fetch owner/repo --conflict skip
|
|
361
|
-
|
|
362
|
-
# Fetch from a monorepo subdirectory
|
|
363
|
-
rulesync fetch owner/repo:packages/my-package
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
## Configuration
|
|
367
|
-
|
|
368
|
-
You can configure Rulesync by creating a `rulesync.jsonc` file in the root of your project.
|
|
369
|
-
|
|
370
|
-
### JSON Schema Support
|
|
371
|
-
|
|
372
|
-
Rulesync provides a JSON Schema for editor validation and autocompletion. Add the `$schema` property to your `rulesync.jsonc`:
|
|
373
|
-
|
|
374
|
-
```jsonc
|
|
375
|
-
// rulesync.jsonc
|
|
376
|
-
{
|
|
377
|
-
"$schema": "https://raw.githubusercontent.com/dyoshikawa/rulesync/refs/heads/main/config-schema.json",
|
|
378
|
-
"targets": ["claudecode"],
|
|
379
|
-
"features": ["rules"],
|
|
380
|
-
}
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### Configuration Options
|
|
384
|
-
|
|
385
|
-
Example:
|
|
386
|
-
|
|
387
|
-
```jsonc
|
|
388
|
-
// rulesync.jsonc
|
|
389
|
-
{
|
|
390
|
-
"$schema": "https://raw.githubusercontent.com/dyoshikawa/rulesync/refs/heads/main/config-schema.json",
|
|
391
|
-
|
|
392
|
-
// List of tools to generate configurations for. You can specify "*" to generate all tools.
|
|
393
|
-
"targets": ["cursor", "claudecode", "geminicli", "opencode", "codexcli"],
|
|
394
|
-
|
|
395
|
-
// Features to generate. You can specify "*" to generate all features.
|
|
396
|
-
"features": ["rules", "ignore", "mcp", "commands", "subagents", "hooks"],
|
|
397
|
-
|
|
398
|
-
// Base directories for generation.
|
|
399
|
-
// Basically, you can specify a `["."]` only.
|
|
400
|
-
// However, for example, if your project is a monorepo and you have to launch the AI agent at each package directory, you can specify multiple base directories.
|
|
401
|
-
"baseDirs": ["."],
|
|
402
|
-
|
|
403
|
-
// Delete existing files before generating
|
|
404
|
-
"delete": true,
|
|
405
|
-
|
|
406
|
-
// Verbose output
|
|
407
|
-
"verbose": false,
|
|
408
|
-
|
|
409
|
-
// Silent mode - suppress all output (except errors)
|
|
410
|
-
"silent": false,
|
|
411
|
-
|
|
412
|
-
// Advanced options
|
|
413
|
-
"global": false, // Generate for global(user scope) configuration files
|
|
414
|
-
"simulateCommands": false, // Generate simulated commands
|
|
415
|
-
"simulateSubagents": false, // Generate simulated subagents
|
|
416
|
-
"simulateSkills": false, // Generate simulated skills
|
|
417
|
-
|
|
418
|
-
// Declarative skill sources — installed via 'rulesync install'
|
|
419
|
-
// See the "Declarative Skill Sources" section for details.
|
|
420
|
-
// "sources": [
|
|
421
|
-
// { "source": "owner/repo" },
|
|
422
|
-
// { "source": "org/repo", "skills": ["specific-skill"] },
|
|
423
|
-
// ],
|
|
424
|
-
}
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Local Configuration
|
|
428
|
-
|
|
429
|
-
Rulesync supports a local configuration file (`rulesync.local.jsonc`) for machine-specific or developer-specific settings. This file is automatically added to `.gitignore` by `rulesync gitignore` and should not be committed to the repository.
|
|
430
|
-
|
|
431
|
-
**Configuration Priority** (highest to lowest):
|
|
432
|
-
|
|
433
|
-
1. CLI options
|
|
434
|
-
2. `rulesync.local.jsonc`
|
|
435
|
-
3. `rulesync.jsonc`
|
|
436
|
-
4. Default values
|
|
437
|
-
|
|
438
|
-
Example usage:
|
|
439
|
-
|
|
440
|
-
```jsonc
|
|
441
|
-
// rulesync.local.jsonc (not committed to git)
|
|
442
|
-
{
|
|
443
|
-
"$schema": "https://raw.githubusercontent.com/dyoshikawa/rulesync/refs/heads/main/config-schema.json",
|
|
444
|
-
// Override targets for local development
|
|
445
|
-
"targets": ["claudecode"],
|
|
446
|
-
// Enable verbose output for debugging
|
|
447
|
-
"verbose": true,
|
|
448
|
-
}
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
### Target Order and File Conflicts
|
|
452
|
-
|
|
453
|
-
When multiple targets write to the same output file, **the last target in the array wins**. This is the "last-wins" behavior.
|
|
454
|
-
|
|
455
|
-
For example, both `agentsmd` and `opencode` generate `AGENTS.md`:
|
|
456
|
-
|
|
457
|
-
```jsonc
|
|
458
|
-
{
|
|
459
|
-
// opencode wins because it comes last
|
|
460
|
-
"targets": ["agentsmd", "opencode"],
|
|
461
|
-
"features": ["rules"],
|
|
462
|
-
}
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
In this case:
|
|
466
|
-
|
|
467
|
-
1. `agentsmd` generates `AGENTS.md` first
|
|
468
|
-
2. `opencode` generates `AGENTS.md` second, overwriting the previous file
|
|
469
|
-
|
|
470
|
-
If you want `agentsmd`'s output instead, reverse the order:
|
|
471
|
-
|
|
472
|
-
```jsonc
|
|
473
|
-
{
|
|
474
|
-
// agentsmd wins because it comes last
|
|
475
|
-
"targets": ["opencode", "agentsmd"],
|
|
476
|
-
"features": ["rules"],
|
|
477
|
-
}
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
## Each File Format
|
|
481
|
-
|
|
482
|
-
### `rulesync/rules/*.md`
|
|
483
|
-
|
|
484
|
-
Example:
|
|
485
|
-
|
|
486
|
-
```md
|
|
487
|
-
---
|
|
488
|
-
root: true # true that is less than or equal to one file for overview such as `AGENTS.md`, false for details such as `.agents/memories/*.md`
|
|
489
|
-
localRoot: false # (optional, default: false) true for project-specific local rules. Claude Code: generates CLAUDE.local.md; Others: appends to root file
|
|
490
|
-
targets: ["*"] # * = all, or specific tools
|
|
491
|
-
description: "Rulesync project overview and development guidelines for unified AI rules management CLI tool"
|
|
492
|
-
globs: ["**/*"] # file patterns to match (e.g., ["*.md", "*.txt"])
|
|
493
|
-
agentsmd: # agentsmd and codexcli specific parameters
|
|
494
|
-
# Support for using nested AGENTS.md files for subprojects in a large monorepo.
|
|
495
|
-
# This option is available only if root is false.
|
|
496
|
-
# If subprojectPath is provided, the file is located in `${subprojectPath}/AGENTS.md`.
|
|
497
|
-
# If subprojectPath is not provided and root is false, the file is located in `.agents/memories/*.md`.
|
|
498
|
-
subprojectPath: "path/to/subproject"
|
|
499
|
-
cursor: # cursor specific parameters
|
|
500
|
-
alwaysApply: true
|
|
501
|
-
description: "Rulesync project overview and development guidelines for unified AI rules management CLI tool"
|
|
502
|
-
globs: ["*"]
|
|
503
|
-
antigravity: # antigravity specific parameters
|
|
504
|
-
trigger: "always_on" # always_on, glob, manual, or model_decision
|
|
505
|
-
globs: ["**/*"] # (optional) file patterns to match when trigger is "glob"
|
|
506
|
-
description: "When to apply this rule" # (optional) used with "model_decision" trigger
|
|
507
|
-
---
|
|
508
|
-
|
|
509
|
-
# Rulesync Project Overview
|
|
510
|
-
|
|
511
|
-
This is Rulesync, a Node.js CLI tool that automatically generates configuration files for various AI development tools from unified AI rule files. The project enables teams to maintain consistent AI coding assistant rules across multiple tools.
|
|
512
|
-
|
|
513
|
-
...
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
### `.rulesync/hooks.json`
|
|
517
|
-
|
|
518
|
-
Hooks run scripts at lifecycle events (e.g. session start, before tool use). Events use **canonical camelCase** in this file; Cursor uses them as-is; Claude Code gets PascalCase in `.claude/settings.json`; OpenCode hooks are generated as a JavaScript plugin at `.opencode/plugins/rulesync-hooks.js`.
|
|
519
|
-
|
|
520
|
-
**Event support:**
|
|
521
|
-
|
|
522
|
-
- **Cursor:** `sessionStart`, `preToolUse`, `postToolUse`, `stop`, `sessionEnd`, `beforeSubmitPrompt`, `subagentStop`, `preCompact`, `afterFileEdit`, `afterShellExecution`, `postToolUseFailure`, `subagentStart`, `beforeShellExecution`, `beforeMCPExecution`, `afterMCPExecution`, `beforeReadFile`, `afterAgentResponse`, `afterAgentThought`, `beforeTabFileRead`, `afterTabFileEdit`
|
|
523
|
-
- **Claude Code:** `sessionStart`, `preToolUse`, `postToolUse`, `stop`, `sessionEnd`, `beforeSubmitPrompt`, `subagentStop`, `preCompact`, `permissionRequest`, `notification`, `setup`
|
|
524
|
-
- **OpenCode:** `sessionStart`, `preToolUse`, `postToolUse`, `stop`, `afterFileEdit`, `afterShellExecution`, `permissionRequest`
|
|
525
|
-
|
|
526
|
-
> **Note:** Rulesync implements OpenCode hooks as a plugin, so importing from OpenCode to rulesync is not supported. OpenCode only supports command-type hooks (not prompt-type).
|
|
527
|
-
|
|
528
|
-
Use optional **override keys** so tool-specific events and config live in one file without leaking to others: `cursor.hooks` for Cursor-only events, `claudecode.hooks` for Claude-only, `opencode.hooks` for OpenCode-only. Events in shared `hooks` that a tool does not support are skipped for that tool (and a warning is logged at generate time).
|
|
529
|
-
|
|
530
|
-
Example:
|
|
531
|
-
|
|
532
|
-
```json
|
|
533
|
-
{
|
|
534
|
-
"version": 1,
|
|
535
|
-
"hooks": {
|
|
536
|
-
"sessionStart": [{ "type": "command", "command": ".rulesync/hooks/session-start.sh" }],
|
|
537
|
-
"postToolUse": [{ "matcher": "Write|Edit", "command": ".rulesync/hooks/format.sh" }],
|
|
538
|
-
"stop": [{ "command": ".rulesync/hooks/audit.sh" }]
|
|
539
|
-
},
|
|
540
|
-
"cursor": {
|
|
541
|
-
"hooks": {
|
|
542
|
-
"afterFileEdit": [{ "command": ".cursor/hooks/format.sh" }]
|
|
543
|
-
}
|
|
544
|
-
},
|
|
545
|
-
"claudecode": {
|
|
546
|
-
"hooks": {
|
|
547
|
-
"notification": [
|
|
548
|
-
{
|
|
549
|
-
"matcher": "permission_prompt",
|
|
550
|
-
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/notify.sh"
|
|
551
|
-
}
|
|
552
|
-
]
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
"opencode": {
|
|
556
|
-
"hooks": {
|
|
557
|
-
"afterShellExecution": [{ "command": ".rulesync/hooks/post-shell.sh" }]
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
### `rulesync/commands/*.md`
|
|
564
|
-
|
|
565
|
-
Example:
|
|
566
|
-
|
|
567
|
-
```md
|
|
568
|
-
---
|
|
569
|
-
description: "Review a pull request" # command description
|
|
570
|
-
targets: ["*"] # * = all, or specific tools
|
|
571
|
-
copilot: # copilot specific parameters (optional)
|
|
572
|
-
description: "Review a pull request"
|
|
573
|
-
antigravity: # antigravity specific parameters
|
|
574
|
-
trigger: "/review" # Specific trigger for workflow (renames file to review.md)
|
|
575
|
-
turbo: true # (Optional, default: true) Append // turbo for auto-execution
|
|
576
|
-
---
|
|
577
|
-
|
|
578
|
-
target_pr = $ARGUMENTS
|
|
579
|
-
|
|
580
|
-
If target_pr is not provided, use the PR of the current branch.
|
|
581
|
-
|
|
582
|
-
Execute the following in parallel:
|
|
583
|
-
|
|
584
|
-
...
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
### `rulesync/subagents/*.md`
|
|
588
|
-
|
|
589
|
-
Example:
|
|
590
|
-
|
|
591
|
-
```md
|
|
592
|
-
---
|
|
593
|
-
name: planner # subagent name
|
|
594
|
-
targets: ["*"] # * = all, or specific tools
|
|
595
|
-
description: >- # subagent description
|
|
596
|
-
This is the general-purpose planner. The user asks the agent to plan to
|
|
597
|
-
suggest a specification, implement a new feature, refactor the codebase, or
|
|
598
|
-
fix a bug. This agent can be called by the user explicitly only.
|
|
599
|
-
claudecode: # for claudecode-specific parameters
|
|
600
|
-
model: inherit # opus, sonnet, haiku or inherit
|
|
601
|
-
copilot: # for GitHub Copilot specific parameters
|
|
602
|
-
tools:
|
|
603
|
-
- web/fetch # agent/runSubagent is always included automatically
|
|
604
|
-
opencode: # for OpenCode-specific parameters
|
|
605
|
-
mode: subagent # (optional, defaults to "subagent") OpenCode agent mode
|
|
606
|
-
model: anthropic/claude-sonnet-4-20250514
|
|
607
|
-
temperature: 0.1
|
|
608
|
-
tools:
|
|
609
|
-
write: false
|
|
610
|
-
edit: false
|
|
611
|
-
bash: false
|
|
612
|
-
permission:
|
|
613
|
-
bash:
|
|
614
|
-
"git diff": allow
|
|
615
|
-
---
|
|
616
|
-
|
|
617
|
-
You are the planner for any tasks.
|
|
618
|
-
|
|
619
|
-
Based on the user's instruction, create a plan while analyzing the related files. Then, report the plan in detail. You can output files to @tmp/ if needed.
|
|
620
|
-
|
|
621
|
-
Attention, again, you are just the planner, so though you can read any files and run any commands for analysis, please don't write any code.
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
### `.rulesync/skills/*/SKILL.md`
|
|
625
|
-
|
|
626
|
-
Example:
|
|
627
|
-
|
|
628
|
-
```md
|
|
629
|
-
---
|
|
630
|
-
name: example-skill # skill name
|
|
631
|
-
description: >- # skill description
|
|
632
|
-
A sample skill that demonstrates the skill format
|
|
633
|
-
targets: ["*"] # * = all, or specific tools
|
|
634
|
-
claudecode: # for claudecode-specific parameters
|
|
635
|
-
allowed-tools:
|
|
636
|
-
- "Bash"
|
|
637
|
-
- "Read"
|
|
638
|
-
- "Write"
|
|
639
|
-
- "Grep"
|
|
640
|
-
codexcli: # for codexcli-specific parameters
|
|
641
|
-
short-description: A brief user-facing description
|
|
642
|
-
---
|
|
643
|
-
|
|
644
|
-
This is the skill body content.
|
|
645
|
-
|
|
646
|
-
You can provide instructions, context, or any information that helps the AI agent understand and execute this skill effectively.
|
|
647
|
-
|
|
648
|
-
The skill can include:
|
|
649
|
-
|
|
650
|
-
- Step-by-step instructions
|
|
651
|
-
- Code examples
|
|
652
|
-
- Best practices
|
|
653
|
-
- Any relevant context
|
|
654
|
-
|
|
655
|
-
Skills are directory-based and can include additional files alongside SKILL.md.
|
|
656
|
-
```
|
|
657
|
-
|
|
658
|
-
### `.rulesync/mcp.json`
|
|
659
|
-
|
|
660
|
-
Example:
|
|
661
|
-
|
|
662
|
-
```json
|
|
663
|
-
{
|
|
664
|
-
"mcpServers": {
|
|
665
|
-
"serena": {
|
|
666
|
-
"description": "Code analysis and semantic search MCP server",
|
|
667
|
-
"type": "stdio",
|
|
668
|
-
"command": "uvx",
|
|
669
|
-
"args": [
|
|
670
|
-
"--from",
|
|
671
|
-
"git+https://github.com/oraios/serena",
|
|
672
|
-
"serena",
|
|
673
|
-
"start-mcp-server",
|
|
674
|
-
"--context",
|
|
675
|
-
"ide-assistant",
|
|
676
|
-
"--enable-web-dashboard",
|
|
677
|
-
"false",
|
|
678
|
-
"--project",
|
|
679
|
-
"."
|
|
680
|
-
],
|
|
681
|
-
"env": {}
|
|
682
|
-
},
|
|
683
|
-
"context7": {
|
|
684
|
-
"description": "Library documentation search server",
|
|
685
|
-
"type": "stdio",
|
|
686
|
-
"command": "npx",
|
|
687
|
-
"args": ["-y", "@upstash/context7-mcp"],
|
|
688
|
-
"env": {}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
#### MCP Tool Config (`enabledTools` / `disabledTools`)
|
|
695
|
-
|
|
696
|
-
You can control which individual tools from an MCP server are enabled or disabled using `enabledTools` and `disabledTools` arrays per server.
|
|
697
|
-
|
|
698
|
-
```json
|
|
699
|
-
{
|
|
700
|
-
"mcpServers": {
|
|
701
|
-
"serena": {
|
|
702
|
-
"type": "stdio",
|
|
703
|
-
"command": "uvx",
|
|
704
|
-
"args": ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server"],
|
|
705
|
-
"enabledTools": ["search_symbols", "find_references"],
|
|
706
|
-
"disabledTools": ["rename_symbol"]
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
```
|
|
711
|
-
|
|
712
|
-
- `enabledTools`: An array of tool names that should be explicitly enabled for this server.
|
|
713
|
-
- `disabledTools`: An array of tool names that should be explicitly disabled for this server.
|
|
714
|
-
|
|
715
|
-
### `.rulesync/.aiignore` or `.rulesyncignore`
|
|
716
|
-
|
|
717
|
-
Rulesync supports a single ignore list that can live in either location below:
|
|
718
|
-
|
|
719
|
-
- `.rulesync/.aiignore` (recommended)
|
|
720
|
-
- `.rulesyncignore` (project root)
|
|
721
|
-
|
|
722
|
-
Rules and behavior:
|
|
723
|
-
|
|
724
|
-
- You may use either location.
|
|
725
|
-
- When both exist, Rulesync prefers `.rulesync/.aiignore` (recommended) over `.rulesyncignore` (legacy) when reading.
|
|
726
|
-
- If neither file exists yet, Rulesync defaults to creating `.rulesync/.aiignore`.
|
|
727
|
-
|
|
728
|
-
Notes:
|
|
729
|
-
|
|
730
|
-
- Running `rulesync init` will create `.rulesync/.aiignore` if no ignore file is present.
|
|
731
|
-
|
|
732
|
-
Example:
|
|
733
|
-
|
|
734
|
-
```ignore
|
|
735
|
-
tmp/
|
|
736
|
-
credentials/
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
## Global Mode
|
|
740
|
-
|
|
741
|
-
You can use global mode via Rulesync by enabling `--global` option. It can also be called as user scope mode.
|
|
742
|
-
|
|
743
|
-
Currently, supports rules and commands generation for Claude Code. Import for global files is supported for rules and commands.
|
|
744
|
-
|
|
745
|
-
1. Create an any name directory. For example, if you prefer `~/.aiglobal`, run the following command.
|
|
746
|
-
|
|
747
|
-
```bash
|
|
748
|
-
mkdir -p ~/.aiglobal
|
|
749
|
-
```
|
|
750
|
-
|
|
751
|
-
2. Initialize files for global files in the directory.
|
|
752
|
-
|
|
753
|
-
```bash
|
|
754
|
-
cd ~/.aiglobal
|
|
755
|
-
rulesync init
|
|
756
|
-
```
|
|
757
|
-
|
|
758
|
-
3. Edit `~/.aiglobal/rulesync.jsonc` to enable global mode.
|
|
759
|
-
|
|
760
|
-
```jsonc
|
|
761
|
-
{
|
|
762
|
-
"global": true,
|
|
763
|
-
}
|
|
764
|
-
```
|
|
765
|
-
|
|
766
|
-
4. Edit `~/.aiglobal/.rulesync/rules/overview.md` to your preferences.
|
|
767
|
-
|
|
768
|
-
```md
|
|
769
|
-
---
|
|
770
|
-
root: true
|
|
771
|
-
---
|
|
772
|
-
|
|
773
|
-
# The Project Overview
|
|
774
|
-
|
|
775
|
-
...
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
5. Generate rules for global settings.
|
|
779
|
-
|
|
780
|
-
```bash
|
|
781
|
-
# Run in the `~/.aiglobal` directory
|
|
782
|
-
rulesync generate
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
> [!NOTE]
|
|
786
|
-
> Currently, when in the directory enabled global mode:
|
|
787
|
-
>
|
|
788
|
-
> - `rulesync.jsonc` only supports `global`, `features`, `delete` and `verbose`. `Features` can be set `"rules"` and `"commands"`. Other parameters are ignored.
|
|
789
|
-
> - `rules/*.md` only supports single file has `root: true`, and frontmatter parameters without `root` are ignored.
|
|
790
|
-
> - Only Claude Code is supported for global mode commands.
|
|
791
|
-
|
|
792
|
-
## Simulate Commands, Subagents and Skills
|
|
793
|
-
|
|
794
|
-
Simulated commands, subagents and skills allow you to generate simulated features for cursor, codexcli and etc. This is useful for shortening your prompts.
|
|
795
|
-
|
|
796
|
-
1. Prepare `.rulesync/commands/*.md`, `.rulesync/subagents/*.md` and `.rulesync/skills/*/SKILL.md` for your purposes.
|
|
797
|
-
2. Generate simulated commands, subagents and skills for specific tools that are included in cursor, codexcli and etc.
|
|
798
|
-
|
|
799
|
-
```bash
|
|
800
|
-
rulesync generate \
|
|
801
|
-
--targets copilot,cursor,codexcli \
|
|
802
|
-
--features commands,subagents,skills \
|
|
803
|
-
--simulate-commands \
|
|
804
|
-
--simulate-subagents \
|
|
805
|
-
--simulate-skills
|
|
806
|
-
```
|
|
807
|
-
|
|
808
|
-
3. Use simulated commands, subagents and skills in your prompts.
|
|
809
|
-
- Prompt examples:
|
|
810
|
-
|
|
811
|
-
```txt
|
|
812
|
-
# Execute simulated commands. By the way, `s/` stands for `simulate/`.
|
|
813
|
-
s/your-command
|
|
814
|
-
|
|
815
|
-
# Execute simulated subagents
|
|
816
|
-
Call your-subagent to achieve something.
|
|
817
|
-
|
|
818
|
-
# Use simulated skills
|
|
819
|
-
Use the skill your-skill to achieve something.
|
|
820
|
-
```
|
|
821
|
-
|
|
822
|
-
## Official Skills
|
|
823
|
-
|
|
824
|
-
Rulesync provides official skills that you can install using the fetch command or declarative sources:
|
|
825
|
-
|
|
826
|
-
```bash
|
|
827
|
-
# One-time fetch
|
|
828
|
-
rulesync fetch dyoshikawa/rulesync --features skills
|
|
829
|
-
|
|
830
|
-
# Or declare in rulesync.jsonc and run 'rulesync install'
|
|
831
|
-
```
|
|
832
|
-
|
|
833
|
-
This will install the Rulesync documentation skill to your project.
|
|
834
|
-
|
|
835
|
-
## Declarative Skill Sources
|
|
836
|
-
|
|
837
|
-
Rulesync can fetch skills from external GitHub repositories using the `install` command. Instead of manually running `fetch` for each skill source, declare them in your `rulesync.jsonc` and run `rulesync install` to resolve and fetch them. Then `rulesync generate` picks them up as local curated skills. Typical workflow: `rulesync install && rulesync generate`.
|
|
838
|
-
|
|
839
|
-
### Configuration
|
|
840
|
-
|
|
841
|
-
Add a `sources` array to your `rulesync.jsonc`:
|
|
842
|
-
|
|
843
|
-
```jsonc
|
|
844
|
-
{
|
|
845
|
-
"$schema": "https://raw.githubusercontent.com/dyoshikawa/rulesync/refs/heads/main/config-schema.json",
|
|
846
|
-
"targets": ["copilot", "claudecode"],
|
|
847
|
-
"features": ["rules", "skills"],
|
|
848
|
-
"sources": [
|
|
849
|
-
// Fetch all skills from a repository
|
|
850
|
-
{ "source": "owner/repo" },
|
|
851
|
-
|
|
852
|
-
// Fetch only specific skills by name
|
|
853
|
-
{ "source": "anthropics/skills", "skills": ["skill-creator"] },
|
|
854
|
-
|
|
855
|
-
// With ref pinning and subdirectory path (same syntax as fetch command)
|
|
856
|
-
{ "source": "owner/repo@v1.0.0:path/to/skills" },
|
|
857
|
-
],
|
|
858
|
-
}
|
|
859
|
-
```
|
|
860
|
-
|
|
861
|
-
Each entry in `sources` accepts:
|
|
862
|
-
|
|
863
|
-
| Property | Type | Description |
|
|
864
|
-
| -------- | ---------- | ----------------------------------------------------------------------------------------------------------- |
|
|
865
|
-
| `source` | `string` | Repository source using the same format as the `fetch` command (`owner/repo`, `owner/repo@ref:path`, etc.). |
|
|
866
|
-
| `skills` | `string[]` | Optional list of skill names to fetch. If omitted, all skills are fetched. |
|
|
867
|
-
|
|
868
|
-
### How It Works
|
|
869
|
-
|
|
870
|
-
When `rulesync install` runs and `sources` is configured:
|
|
871
|
-
|
|
872
|
-
1. **Lockfile resolution** — Each source's ref is resolved to a commit SHA and stored in `rulesync.lock` (at the project root). On subsequent runs the locked SHA is reused for deterministic builds.
|
|
873
|
-
2. **Remote skill listing** — The `skills/` directory (or the path specified in the source URL) is listed from the remote repository.
|
|
874
|
-
3. **Filtering** — If `skills` is specified, only matching skill directories are fetched.
|
|
875
|
-
4. **Precedence rules**:
|
|
876
|
-
- **Local skills always win** — Skills in `.rulesync/skills/` (not in `.curated/`) take precedence; a remote skill with the same name is skipped.
|
|
877
|
-
- **First-declared source wins** — If two sources provide a skill with the same name, the one declared first in the `sources` array is used.
|
|
878
|
-
5. **Output** — Fetched skills are written to `.rulesync/skills/.curated/<skill-name>/`. This directory is automatically added to `.gitignore` by `rulesync gitignore`.
|
|
879
|
-
|
|
880
|
-
### CLI Options
|
|
881
|
-
|
|
882
|
-
The `install` command accepts these flags:
|
|
883
|
-
|
|
884
|
-
| Flag | Description |
|
|
885
|
-
| ----------------- | ------------------------------------------------------------------------------------- |
|
|
886
|
-
| `--update` | Force re-resolve all source refs, ignoring the lockfile (useful to pull new updates). |
|
|
887
|
-
| `--frozen` | Fail if lockfile is missing or out of sync. Useful for CI to ensure reproducibility. |
|
|
888
|
-
| `--token <token>` | GitHub token for private repositories. |
|
|
889
|
-
|
|
890
|
-
```bash
|
|
891
|
-
# Install skills using locked refs
|
|
892
|
-
rulesync install
|
|
893
|
-
|
|
894
|
-
# Force update to latest refs
|
|
895
|
-
rulesync install --update
|
|
896
|
-
|
|
897
|
-
# Strict CI mode — fail if lockfile doesn't cover all sources
|
|
898
|
-
rulesync install --frozen
|
|
899
|
-
|
|
900
|
-
# Install then generate
|
|
901
|
-
rulesync install && rulesync generate
|
|
902
|
-
|
|
903
|
-
# Skip source installation — just don't run install
|
|
904
|
-
rulesync generate
|
|
905
|
-
```
|
|
906
|
-
|
|
907
|
-
### Lockfile
|
|
908
|
-
|
|
909
|
-
The lockfile at `rulesync.lock` (at the project root) records the resolved commit SHA and per-skill integrity hashes for each source so that builds are reproducible. It is safe to commit this file. An example:
|
|
910
|
-
|
|
911
|
-
```json
|
|
912
|
-
{
|
|
913
|
-
"lockfileVersion": 1,
|
|
914
|
-
"sources": {
|
|
915
|
-
"owner/skill-repo": {
|
|
916
|
-
"requestedRef": "main",
|
|
917
|
-
"resolvedRef": "abc123def456...",
|
|
918
|
-
"resolvedAt": "2025-01-15T12:00:00.000Z",
|
|
919
|
-
"skills": {
|
|
920
|
-
"my-skill": { "integrity": "sha256-abcdef..." },
|
|
921
|
-
"another-skill": { "integrity": "sha256-123456..." }
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
```
|
|
927
|
-
|
|
928
|
-
To update locked refs, run `rulesync install --update`.
|
|
929
|
-
|
|
930
|
-
### Authentication
|
|
931
|
-
|
|
932
|
-
Source fetching uses the `GITHUB_TOKEN` or `GH_TOKEN` environment variable for authentication. This is required for private repositories and recommended for better rate limits.
|
|
933
|
-
|
|
934
|
-
```bash
|
|
935
|
-
# Using environment variable
|
|
936
|
-
export GITHUB_TOKEN=ghp_xxxx
|
|
937
|
-
npx rulesync install
|
|
938
|
-
|
|
939
|
-
# Or using GitHub CLI
|
|
940
|
-
GITHUB_TOKEN=$(gh auth token) npx rulesync install
|
|
941
|
-
```
|
|
942
|
-
|
|
943
|
-
> [!TIP]
|
|
944
|
-
> The `install` command also accepts a `--token` flag for explicit authentication: `rulesync install --token ghp_xxxx`.
|
|
945
|
-
|
|
946
|
-
### Curated vs Local Skills
|
|
947
|
-
|
|
948
|
-
| Location | Type | Precedence | Committed to Git |
|
|
949
|
-
| ----------------------------------- | ------- | ---------- | ---------------- |
|
|
950
|
-
| `.rulesync/skills/<name>/` | Local | Highest | Yes |
|
|
951
|
-
| `.rulesync/skills/.curated/<name>/` | Curated | Lower | No (gitignored) |
|
|
952
|
-
|
|
953
|
-
When both a local and a curated skill share the same name, the local skill is used and the remote one is not fetched.
|
|
954
|
-
|
|
955
|
-
## Rulesync MCP Server
|
|
956
|
-
|
|
957
|
-
Rulesync provides an MCP (Model Context Protocol) server that enables AI agents to manage your Rulesync files. This allows AI agents to discover, read, create, update, and delete files dynamically.
|
|
958
|
-
|
|
959
|
-
> [!NOTE]
|
|
960
|
-
> The MCP server exposes the only one tool to minimize your agent's token usage. Approximately less than 1k tokens for the tool definition.
|
|
961
|
-
|
|
962
|
-
### Usage
|
|
963
|
-
|
|
964
|
-
#### Starting the MCP Server
|
|
965
|
-
|
|
966
|
-
```bash
|
|
967
|
-
rulesync mcp
|
|
968
|
-
```
|
|
969
|
-
|
|
970
|
-
This starts an MCP server using stdio transport that AI agents can communicate with.
|
|
971
|
-
|
|
972
|
-
#### Configuration
|
|
973
|
-
|
|
974
|
-
Add the Rulesync MCP server to your `.rulesync/mcp.json`:
|
|
975
|
-
|
|
976
|
-
```json
|
|
977
|
-
{
|
|
978
|
-
"mcpServers": {
|
|
979
|
-
"rulesync-mcp": {
|
|
980
|
-
"type": "stdio",
|
|
981
|
-
"command": "npx",
|
|
982
|
-
"args": ["-y", "rulesync", "mcp"],
|
|
983
|
-
"env": {}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
```
|
|
988
|
-
|
|
989
|
-
## FAQ
|
|
990
|
-
|
|
991
|
-
### Q. The generated `.mcp.json` doesn't work properly in Claude Code
|
|
992
|
-
|
|
993
|
-
You can try adding the following to `.claude/settings.json` or `.claude/settings.local.json`:
|
|
994
|
-
|
|
995
|
-
```diff
|
|
996
|
-
{
|
|
997
|
-
+ "enableAllProjectMcpServers": true
|
|
998
|
-
}
|
|
999
|
-
```
|
|
1000
|
-
|
|
1001
|
-
According to [the documentation](https://code.claude.com/docs/en/settings), this means:
|
|
1002
|
-
|
|
1003
|
-
> Automatically approve all MCP servers defined in project .mcp.json files
|
|
1004
|
-
|
|
1005
|
-
### Q. Google Antigravity doesn't load rules when `.agent` directories are in `.gitignore`
|
|
1006
|
-
|
|
1007
|
-
Google Antigravity has a known limitation where it won't load rules, workflows, and skills if the `.agent/rules/`, `.agent/workflows/`, and `.agent/skills/` directories are listed in `.gitignore`, even with "Agent Gitignore Access" enabled.
|
|
1008
|
-
|
|
1009
|
-
**Workaround:** Instead of adding these directories to `.gitignore`, add them to `.git/info/exclude`:
|
|
1010
|
-
|
|
1011
|
-
```bash
|
|
1012
|
-
# Remove from .gitignore (if present)
|
|
1013
|
-
# **/.agent/rules/
|
|
1014
|
-
# **/.agent/workflows/
|
|
1015
|
-
# **/.agent/skills/
|
|
1016
|
-
|
|
1017
|
-
# Add to .git/info/exclude
|
|
1018
|
-
echo "**/.agent/rules/" >> .git/info/exclude
|
|
1019
|
-
echo "**/.agent/workflows/" >> .git/info/exclude
|
|
1020
|
-
echo "**/.agent/skills/" >> .git/info/exclude
|
|
1021
|
-
```
|
|
1022
|
-
|
|
1023
|
-
`.git/info/exclude` works like `.gitignore` but is local-only, so it won't affect Antigravity's ability to load the rules while still excluding these directories from Git.
|
|
94
|
+
## Documentation
|
|
1024
95
|
|
|
1025
|
-
|
|
96
|
+
For full documentation including configuration, CLI reference, file formats, programmatic API, and more, visit the **[documentation site](https://dyoshikawa.github.io/rulesync/)**.
|
|
1026
97
|
|
|
1027
98
|
## License
|
|
1028
99
|
|