A utility to synchronize AI coding assistant rule files seamlessly between projects.
- Automated Synchronization: Quickly synchronize rule files across projects.
- Conflict Detection: Uses SHA-1 hashes to detect differences and automatically opens VS Code for easy manual conflict resolution.
- Flexible Patterns: Customize rule directories and exclude patterns.
- Safe Operation: Never deletes existing files; only adds or updates.
Make sure you have the following installed:
- Node.js: v23.6 or later (required for native TypeScript execution)
- Git: v2.37 or later
- VS Code: For manual conflict resolution UI
Clone the repository and install dependencies:
git clone https://github.com/Jercik/sync-rules.git
cd sync-rules
npm install
Link the package globally to use it from anywhere:
npm link
Synchronize rules from one project to another:
sync-rules ./project-a ./project-b
Preview changes without modifying files:
sync-rules ./project-a ./project-b --dry
See detailed output of synchronization operations:
sync-rules ./project-a ./project-b --verbose
Specify custom rule directories or patterns:
sync-rules ./src ./dst --rulesDir .myRules .customRules "config/*.json"
Prevent certain files or directories from being synchronized using the --exclude
option. You can provide multiple patterns.
sync-rules ./project-a ./project-b --exclude "**/temp/*" "*.log" "config-local.json"
This example would exclude:
- Any files or folders within any directory named
temp
. - Any files ending with
.log
. - A specific file named
config-local.json
at the root of any matched rule directory.
See the "Default Patterns" section for patterns excluded by default.
The tool performs the following actions:
- Prepares Destination: Creates the destination directory if it does not already exist.
- Scans: Locates rule files in both source and destination directories.
- Compares: Checks files using SHA-1 hashes to identify differences.
- Copies: Automatically copies new or updated files to the destination.
- Conflict Resolution: Opens conflicting files in VS Code for manual resolution.
- Preserves Data: Does not delete target files not present in the source.
By default, these rule files are included:
.clinerules
.cursorrules
.kilocode
(matches a file or directory named.kilocode
. If it's a directory, all nested files and folders are included recursively)
These directories are excluded from synchronization by default:
memory-bank
node_modules
.git
0
- Success; all files synchronized without issues.1
- Success with conflicts; manual resolution required.2
- Error encountered; synchronization unsuccessful.
Contributions are welcome! Please feel free to open an issue to discuss a bug or feature, or submit a pull request with your improvements.
MIT © Łukasz Jerciński