Synchronize AI coding tool rule files across directories with path adjustments.
- ✅ Sync AI tool rule files between any directories (parent-to-child, child-to-parent, siblings, or cross-repository)
- ✅ Automatically adjust relative paths in rule files
- ✅ Flexible configuration with YAML
- ✅ Auto-detection of rule files
- ✅ Dry-run simulation mode
go install github.com/upamune/airulesync@latest
brew install upamune/tap/airulesync
Download the appropriate binary for your platform from the releases page.
# Auto-generate a config file
airulesync init .
# Edit .airulesync.yaml if needed
# Run a dry-run simulation
airulesync sync --dry-run
# Perform the actual synchronization
airulesync sync
airulesync sync
- Synchronizes rule files according to configurationairulesync init [dir]
- Scans directory and generates a configuration fileairulesync version
- Displays version informationairulesync help
- Displays help information
--config, -c
- Path to config file (default:.airulesync.yaml
)--verbose, -v
- Enable verbose output--help, -h
- Display help information
--dry-run, -d
- Simulate execution without applying changes
airulesync uses a YAML configuration file to define source and target directories, files to sync, and sync options. The configuration file includes helpful header comments for editor integration.
# yaml-language-server: $schema=https://raw.githubusercontent.com/upamune/airulesync/refs/heads/main/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
# Source directories containing rule files to sync
source_dirs:
- path: "./src/main-project"
files:
- ".clinerules"
- pattern: ".cursor/rules/**/*.mdc"
adjust_paths: true
- pattern: ".roomodes"
adjust_paths: false
ignore_files:
- ".cursor/rules/private/*.mdc"
# Target directories to sync to
target_dirs:
- path: "./src/sub-project-a"
- path: "./src/sub-project-b"
- path: "../other-repo/src/component"
external: true
path
: Directory path containing rule files to syncoverwrite
: Whether to overwrite existing files (default: true)files
: List of files to synchronize- Simple format:
".clinerules"
(uses default settings) - Detailed format:
pattern
: File pattern (supports glob patterns)adjust_paths
: Whether to adjust relative paths in file (default: true)overwrite
: Whether to overwrite existing files (default: true)
- Simple format:
ignore_files
: List of files to ignore (supports glob patterns)
path
: Directory path to sync files toexternal
: Flag for targets outside the current repository (optional)ignore_files
: List of files to ignore (supports glob patterns)
airulesync handles path adjustments based on the relationship between source and target directories:
- Parent to Child: Adjusts paths for use in subdirectories
- Child to Parent: Adjusts paths for use in parent directories
- Sibling to Sibling: Computes correct relative paths between siblings
- Cross-Repository: Handles external repository targets with appropriate warnings
airulesync detects and adjusts various path formats:
- Import/require statements in various languages
- JSON/YAML path references
- File path references in configuration files
- Markdown links and references
- HTML href and src attributes
- General file paths with common extensions
For developers contributing to the project:
make schema
- Generates the JSON Schema for configuration validation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.