cursor-rules-sync
v0.2.0
Published
[](https://www.npmjs.com/package/cursor-rules-sync) [](https://github.com/lbb00/cursor-rules-sync/blob/master/LICENSE) [![Npm do
Downloads
211
Readme
Cursor Rules Sync
This project is used by symbolic link to sync cursor rules from one git repository to any project.
Install
npm install -g cursor-rules-syncCreate a new cursor rules git repository
rulesfolder is the root folder for cursor rules.
Global Options
All commands support the following global options:
-t, --target <repo>: Specify the target rule repository to use (name or URL).
Commands
Config cursor rules git repository
crs use [git repository url | response name]If [git repository url] is not provided, it will search the response name in the ~/.cursor-rules-sync/config.json file.
List all cursor rules git repositories
crs listSync cursor rules to project
crs add [rule name] [alias]This command must be run in the root of your project.
It will generate a symbolic link form the cursor rules git repository rules/[rule name] folder to the project .cursor/rules/[rule name] folder.
If you provide an [alias], it will be linked to .cursor/rules/[alias]. This is useful for renaming rules or handling conflicts.
Adding Private Rules:
Use the -l or --local flag to add a rule to cursor-rules.local.json instead of cursor-rules.json. This is useful for rules that you don't want to commit to git.
crs add react --localThis command will also automatically add cursor-rules.local.json to your .gitignore file.
Examples:
# Add 'react' rule as 'react'
crs add react
# Add 'react' rule as 'react-v1'
crs add react react-v1
# Add 'react' rule from a specific repo as 'react-v2'
crs add react react-v2 -t other-repo
# Add 'react' rule directly from a Git URL
crs add react -t https://github.com/user/rules-repo.gitIt also creates or updates cursor-rules.json (or cursor-rules.local.json) in your project root to track dependencies.
Remove a cursor rule
crs remove [alias]This command removes the symbolic link, the ignore entry, and the dependency from cursor-rules.json (or cursor-rules.local.json).
cursor-rules.json structure
The cursor-rules.json file uses a rules object to map rule names to git repository URLs. It supports both simple string values (repo URL) and object values for aliased rules.
{
"rules": {
"react": "https://github.com/user/repo.git",
"react-v2": {
"url": "https://github.com/user/another-repo.git",
"rule": "react"
}
}
}Local/Private Rules
You can use cursor-rules.local.json to add private rules that are not committed to git. This file uses the same structure as cursor-rules.json and its rules are merged with the main configuration (local rules take precedence).
Install rules from configuration
If you have a cursor-rules.json file in your project, you can install all dependencies with one command:
crs installThis will automatically configure repositories and link rules.
Git Commands
Use git commands to manage the cursor rules git repository.
crs git [command]Example: check status of a specific repository:
crs git status -t [repo name]