Skip to content

justEstif/ai-code-editor-rules-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Code Editor Rules Manager

A CLI tool to synchronize AI code editor configurations (Cursor, GitHub Copilot, and Windsurf) from a single source of truth.

Supported Editors

This tool supports the following AI code editors:

  1. Cursor

    • Location: .cursor/rules/cursor-rules.mdc

    • Format: Markdown with YAML frontmatter

    • Example:

      ---
      description: Project Guidelines
      globs:
        - "src/**/*.ts"
        - "src/**/*.tsx"
      alwaysApply: false
      ---
      
      # Cursor Rules
      
      - Follow TypeScript best practices
      - Use functional programming patterns
      - Write comprehensive tests
  2. GitHub Copilot

    • Location: .github/copilot-instructions.md

    • Format: Markdown

    • Example:

      # GitHub Copilot Instructions
      
      - Use TypeScript for JavaScript development
      - Follow React best practices
      - Implement proper error handling
  3. Windsurf

    • Location: .windsurfrules

    • Format: Markdown

    • Example:

      # Windsurf AI Rules
      
      - Follow functional programming patterns
      - Create thorough test coverage
      - Use project-specific architecture

Installation

npm install -g editor-config-sync

Usage

Initialize a New Project

editor-config-sync init

This will create:

  1. A template ai-rules.md file with example rules
  2. A .editor-config-sync.json configuration file

Apply Rules

editor-config-sync apply

Options:

  • -s, --source <path>: Path to the source markdown file (default: ai-rules.md)
  • -e, --editors <editors>: Comma-separated list of editors to generate configs for
  • -g, --gitignore <boolean>: Whether to manage gitignore entries (default: true)
  • -n, --name <name>: Name for Cursor MDC file (default: "default")
  • -d, --description <description>: Description for Cursor MDC file
  • --globs <globs>: Comma-separated list of globs for Cursor MDC file
  • --always-apply <boolean>: Whether to always apply the Cursor rule (default: false)

List Supported Editors

editor-config-sync list-editors

Source File Format

The source markdown file (ai-rules.md) should follow this structure:

# AI Code Editor Rules

## General Rules

These rules apply to all AI code editors unless overridden.

- Follow project coding standards
- Use meaningful variable names
- Write comprehensive documentation
- Follow the DRY principle
- Implement proper error handling

## Editor-Specific Rules

### Cursor

- Create self-contained modules
- Add type hints for better code completion
- Optimize for readability over cleverness

### GitHub Copilot

- Use TypeScript for JavaScript development
- Follow React best practices
- Implement comprehensive error handling

### Windsurf

- Use functional programming patterns
- Create thorough test coverage
- Follow project architecture

Configuration

The .editor-config-sync.json file allows you to customize the default behavior:

{
  "sourcePath": "ai-rules.md",
  "editors": ["cursor", "github-copilot", "windsurf"],
  "gitignoreManagement": true
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors