π aisyncrule

Synchronize AI coding tool rule files across directories with path adjustments.
π Features
- β
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
π Installation
Using Go
go install github.com/upamune/airulesync@latest
Using Homebrew
brew install upamune/tap/airulesync
Binary Releases
Download the appropriate binary for your platform from the releases page.
π Usage
Quick Start
# 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
Commands
airulesync sync - Synchronizes rule files according to configuration
airulesync init [dir] - Scans directory and generates a configuration file
airulesync version - Displays version information
airulesync help - Displays help information
Flags
Global Flags
--config, -c - Path to config file (default: .airulesync.yaml)
--verbose, -v - Enable verbose output
--help, -h - Display help information
Sync Command Flags
--dry-run, -d - Simulate execution without applying changes
βοΈ Configuration
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.
Example Configuration
# 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
Configuration Reference
Source Directories
path: Directory path containing rule files to sync
overwrite: 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)
ignore_files: List of files to ignore (supports glob patterns)
Target Directories
path: Directory path to sync files to
external: Flag for targets outside the current repository (optional)
ignore_files: List of files to ignore (supports glob patterns)
π Path Adjustment
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
Path Detection Patterns
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
Development Commands
For developers contributing to the project:
make schema - Generates the JSON Schema for configuration validation
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
π License
This project is licensed under the MIT License - see the LICENSE file for details.