Skip to content

ruleport/RulePort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RulePort

Write Once, Run Anywhere.

Ask DeepWiki

Manage your AI assistant rules in one place and sync them across all your tools.

RulePort handles the translation and synchronization of context, coding standards, and project rules between different AI assistants. Instead of maintaining separate .cursorrules, .github/copilot-instructions.md, and .claude/rules/ configs, you define them once and let this tool handle the rest.

✨ Features

  • οΏ½ Automatic Sync - One-time or watch mode synchronization
  • 🎯 Type-Safe - Built with TypeScript for reliability
  • πŸ§ͺ Tested - Comprehensive test suite with 87+ tests
  • πŸ—οΈ Clean Architecture - Adapter-based design for easy extensibility
  • βœ… CI-Friendly - Check command for validating sync status
  • πŸ“¦ Zero Config - Works out of the box with sensible defaults

οΏ½πŸ”Œ Supported Assistants

Source \ Target Claude Code Cursor GitHub Copilot Google Antigravity Kiro Windsurf
Claude Code - βœ… βœ… βœ… βœ… βœ…
Cursor βœ… - βœ… βœ… βœ… βœ…
GitHub Copilot βœ… βœ… - βœ… βœ… βœ…
Google Antigravity βœ… βœ… βœ… - βœ… βœ…
Kiro βœ… βœ… βœ… βœ… - βœ…
Windsurf βœ… βœ… βœ… βœ… βœ… -

βœ… = Available Now | - = N/A

πŸš€ Quick Start

1. Install Dependencies

npm install

2. Build the Project

npm run build

3. Sync to Assistants

Translate your rules to all configured targets:

npm run sync

πŸ“– Usage

Commands

sync - Synchronize Rules

Sync rules from source to all targets:

npm run sync

Sync to specific targets:

npm run sync -- --target copilot
npm run sync -- --target claude --target antigravity

Sync a specific project directory:

npm run sync -- /path/to/project

check - Validate Sync Status (NEW)

Check if generated files are in sync with source rules (useful for CI):

npm run check

This command:

  • Computes what files would be generated
  • Compares against existing files
  • Exits with code 1 if drift is detected
  • Exits with code 0 if everything is in sync

Perfect for CI/CD pipelines to ensure rules are always synced!

watch - Auto-Sync on Changes

Automatically sync when you change rule files:

npm run sync:watch

Press Ctrl+C to stop watching.

Options

--target <name>

Limit sync to specific assistants:

npm run sync -- --target copilot

Available targets: copilot, claude, antigravity, cursor, kiro, windsurf

Default: All targets

--source <name>

Specify the source to read rules from:

npm run sync -- --source cursor
npm run sync -- --source claude
npm run sync -- --source kiro

Available sources: cursor, claude, copilot, antigravity, kiro, windsurf

Default: cursor

--watch / -w

Enable watch mode:

npm run sync -- --watch
# or
npm run sync -- -w

--help / -h

Display help information:

node dist/cli.js --help

πŸ—οΈ Architecture

RulePort uses a clean adapter-based architecture:

Sources (Cursor, …)
        β”‚
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Rule IR β”‚  ← canonical, typed, deterministic
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β–Ό
Targets (Copilot, Claude, Antigravity, …)
        β”‚
        β–Ό
 Planned Writes (path + content)
        β”‚
        β–Ό
   sync / check / watch

Key Principles

  • IR-First: All conversions go through a canonical Rule IR
  • No Hidden Magic: Deterministic output only
  • Adapters, Not Conditionals: Clean separation of concerns
  • Local-First, CI-Friendly: Works offline, validates in CI

πŸ§ͺ Testing

Run the test suite:

npm test

Run tests in watch mode:

npm run test:watch

Run tests with coverage:

npm run test:coverage

View tests in UI:

npm run test:ui

πŸ“ Project Structure

ruleport/
β”œβ”€β”€ src/                    # TypeScript source code
β”‚   β”œβ”€β”€ cli.ts             # Main CLI entry point
β”‚   β”œβ”€β”€ core/              # Core infrastructure
β”‚   β”‚   β”œβ”€β”€ ir.ts          # Rule IR data model
β”‚   β”‚   β”œβ”€β”€ frontmatter.ts # YAML parser
β”‚   β”‚   β”œβ”€β”€ fs.ts          # File operations
β”‚   β”‚   β”œβ”€β”€ log.ts         # Logging utilities
β”‚   β”‚   └── planner.ts     # Write planning
β”‚   β”œβ”€β”€ config/            # Configuration
β”‚   β”‚   β”œβ”€β”€ types.ts       # Type definitions
β”‚   β”‚   └── defaults.ts    # Default values
β”‚   β”œβ”€β”€ sources/           # Source adapters
β”‚   β”‚   β”œβ”€β”€ cursor.ts      # Cursor rules reader
β”‚   β”‚   β”œβ”€β”€ claude.ts      # Claude Code reader
β”‚   β”‚   β”œβ”€β”€ copilot.ts     # GitHub Copilot reader
β”‚   β”‚   β”œβ”€β”€ antigravity.ts # Google Antigravity reader
β”‚   β”‚   β”œβ”€β”€ kiro.ts        # Kiro reader
β”‚   β”‚   └── windsurf.ts    # Windsurf reader
β”‚   β”œβ”€β”€ targets/           # Target adapters
β”‚   β”‚   β”œβ”€β”€ copilot.ts     # GitHub Copilot
β”‚   β”‚   β”œβ”€β”€ claude.ts      # Claude Code
β”‚   β”‚   β”œβ”€β”€ antigravity.ts # Google Antigravity
β”‚   β”‚   β”œβ”€β”€ cursor.ts      # Cursor
β”‚   β”‚   β”œβ”€β”€ kiro.ts        # Kiro
β”‚   β”‚   └── windsurf.ts    # Windsurf
β”‚   └── commands/          # CLI commands
β”‚       β”œβ”€β”€ sync.ts        # Sync command
β”‚       β”œβ”€β”€ check.ts       # Check command
β”‚       └── watch.ts       # Watch command
β”œβ”€β”€ tests/                 # Test suite
β”‚   β”œβ”€β”€ cli.test.ts        # CLI tests
β”‚   β”œβ”€β”€ cursor.test.ts     # Cursor source adapter tests
β”‚   β”œβ”€β”€ sources.test.ts    # All other source adapter tests
β”‚   β”œβ”€β”€ targets.test.ts    # Target adapter tests
β”‚   β”œβ”€β”€ e2e.test.ts        # End-to-end tests
β”‚   └── fixtures/          # Test fixtures
β”œβ”€β”€ dist/                  # Compiled JavaScript
└── .cursor/rules/         # Your source rules

πŸ”§ Development

Build

npm run build

Development Mode

Run without building (uses tsx):

npm run dev

Code Quality Tools

Linting:

npm run lint      # Check code style
npm run lint:fix  # Fix automatic issues

Type Checking:

npm run typecheck # Verify TypeScript types

Pre-commit Hooks: This project uses husky and lint-staged. On every commit, it automatically:

  • Fixes linting issues (eslint --fix)
  • Runs relevant tests (vitest related)
  • Blocks the commit if checks fail

Contribution Guidelines

Conventional Commits: We use Conventional Commits to automate versioning and changelogs. Please use one of the following types:

  • feat: A new feature (minor release)
  • fix: A bug fix (patch release)
  • chore: Maintenance, dependencies, etc. (no release)
  • docs: Documentation changes
  • test: Adding or correcting tests

Example:

git commit -m "feat: add support for new target adapter"

Add a New Target Adapter

  1. Create src/targets/your-target.ts
  2. Implement the render function that accepts RuleIR[] and returns RenderResult
  3. Add target to VALID_TARGETS in src/config/defaults.ts
  4. Update command routing in src/commands/sync.ts
  5. Add tests in tests/targets.test.ts

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details on how to get started, report bugs, or suggest features.

πŸ“„ License

MIT

πŸ™ Acknowledgments

Built with TypeScript, Vitest, and ❀️ for the AI coding community.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors