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