Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>AI Rules SyncNew to Visual Studio Code? Get it now.
AI Rules Sync

AI Rules Sync

zidong.lin

|
33 installs
| (1) | Free
Sync rule files between different AI IDEs
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AI Rules Sync

This is a VS Code extension designed to synchronize the rule file contents of various AI-assisted programming tools (like Windsurf, Cursor, Cline, Roo Code, etc.). With this extension, you can maintain your AI tool rule configurations in one place and automatically sync them to all other tools, ensuring a consistent AI assistance experience across different environments.

Background

With the growing popularity of AI-assisted programming tools, developers might use multiple different AI tools simultaneously. These tools often have their own rule configuration files to customize the AI assistant's behavior. Manually maintaining multiple rule files is time-consuming and error-prone. This extension aims to solve this problem by providing a one-stop solution for rule management.

Features

  • Select a base rule file as the primary source (custom or from presets).
  • Automatically or manually synchronize the base rule file content to target rule files.
  • Provides a sidebar Tree View for intuitive display of rule files and sync status.
  • Customizable list of target rule files, with presets available.
  • Supports path variables (currently ${userHome}) for cross-platform compatibility.
  • NEW: Command to ensure configured rule files exist, creating them if necessary.
  • NEW: Command to switch the display language of the extension UI (English/Chinese).
  • NEW: Auto-sync feature triggers synchronization when the base rule file is saved (with debounce).
  • NEW: Centralized services for configuration, localization, error handling, file watching, and state management.

Project Structure

  • src/: Source code directory
    • extension.ts: Main extension entry point
    • treeDataProvider.ts: Sidebar Tree View provider
    • commandRegistrar.ts: Handles command registration
    • pathResolver.ts: Resolves paths with variables
    • logger.ts: Simple output channel logger
    • commands/: Directory containing command implementations (e.g., syncRulesCommand.ts, selectBaseRuleCommand.ts, etc.)
    • services/: Directory containing service implementations (e.g., configService.ts, localizationService.ts, errorHandlerService.ts, fileWatcherService.ts, stateManagementService.ts)
  • rules/: Directory for preset rule files
  • test-rules/: Directory for test rule files

Usage

1. Select Base Rule File

Select the base rule file using one of the following methods:

  • Execute the AI Rules Sync: Select Base Rule File command from the Command Palette (Ctrl+Shift+P).
  • Click the "Select Base Rule File" action item in the sidebar view.
  • Click on a preset rule file in the sidebar view and choose "Select as Base Rule File".

Presets include:

  • Windsurf
  • Cursor
  • Cline
  • Roo Code
  • Test Rule

You can also select a custom file.

2. Configure Target Rule Files

Configure target rule files using one of the following methods:

  • Execute the AI Rules Sync: Configure Target Rule Files command from the Command Palette.
  • Click the "Configure Target Files" action item in the sidebar view.

You can select multiple files from the preset list or add custom files as synchronization targets. The target file list is displayed in the sidebar, and you can add or remove targets at any time.

3. Synchronize Rule Files

Synchronize rule files in the following ways:

  1. Manual Sync: Execute the AI Rules Sync: Sync Rule Files command from the Command Palette or click the "Sync Rules Now" action item in the sidebar.
  2. Auto Sync: Enable the aiRulesSync.autoSync setting. When the base rule file is saved, changes will be automatically synchronized to all target files after a short delay (debounce).

Synchronization results will be shown in notifications.

4. Ensure Rule Files Exist

Execute the AI Rules Sync: Ensure Rule Files Exist command from the Command Palette or click the "Ensure Rule Files Exist" action item in the sidebar. This command checks if the configured base and target rule files exist at their resolved paths. If a file does not exist, it will be created (including necessary directories). A summary report is shown afterwards.

5. Select Display Language

Execute the AI Rules Sync: Select Display Language command from the Command Palette or click the "Select Display Language" action item in the sidebar to choose between English and Chinese for the extension's UI elements. A window reload might be required for all changes to take effect.

Extension Settings

This extension provides the following settings:

  • aiRulesSync.baseRulePath: Path to the base rule file (absolute or relative).
  • aiRulesSync.targetRulePaths: List of paths to target rule files (absolute or relative).
  • aiRulesSync.autoSync: Whether to automatically sync rule files on save (default: false).
  • aiRulesSync.presets: Preset rule file paths (default includes Windsurf, Cursor, Cline, Roo Code, and a test rule).

Path Variables

The following variable can be used in file paths within the settings:

  • ${userHome}: The user's home directory.

Installation

  1. Open the Extensions view in VS Code (Ctrl+Shift+X).
  2. Search for "AI Rules Sync".
  3. Click "Install".

Alternatively, download the .vsix file and install it using the "Install from VSIX..." option.

Development Notes

.gitignore Configuration

The project includes a .gitignore file to exclude files and directories that should not be committed to version control:

  • node_modules/: Dependency packages directory
  • dist/ and out/: Build output directories
  • *.vsix: Extension package files
  • .vscode-test/: VS Code test directory
  • .history/: Local history directory
  • Various log and temporary files
  • OS-specific files (e.g., .DS_Store)

This ensures a clean repository and prevents unnecessary files from being committed.

Building from Source

git clone https://github.com/yourusername/ai-rules-sync.git # Replace with actual repo URL if available
cd ai-rules-sync
npm install
npm run compile # Or use the webpack script if defined, e.g., npm run webpack-dev

Packaging

npm run package # Assumes vsce is installed globally or via devDependencies

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft