Skip to content

Commit 97fad79

Browse files
committed
Update docs
1 parent e933c65 commit 97fad79

2 files changed

Lines changed: 43 additions & 26 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ All `docker_image` entries found in `.pre-commit-config.yaml` will be included,
4242

4343
## Sync AI Rules Hook (`sync-ai-rules`)
4444

45-
This hook synchronizes AI coding rules from .cursor/rules/\*.mdc files to other AI assistant configuration files (CLAUDE.md, AGENTS.md, etc.). This ensures all AI coding assistants in your project stay aware of the same rules and conventions, eliminating the need to manually copy rules between different AI config files.
45+
This hook synchronizes AI coding rules from `.cursor/rules/` and `.code_review/` directories to AI assistant configuration files (CLAUDE.md, AGENTS.md, .github/copilot-instructions.md). It generates two sections:
46+
47+
- **Development Rules** - from `.cursor/rules/*.mdc` files with YAML frontmatter
48+
- **Review Guidelines** - from `.code_review/*.md` files with HTML comment frontmatter
49+
50+
This ensures all AI coding assistants stay aware of the same rules and conventions.
4651

4752
## Usage
4853

sync_ai_rules/README.md

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,64 @@
11
# sync-ai-rules
22

3-
- Synchronize AI coding rules from .cursor/rules/\*.mdc files to other AI assistant configuration files (CLAUDE.md, AGENTS.md, etc.)
4-
- Built with a plugin architecture that can easily support new input/output formats as the ecosystem evolves
3+
Synchronizes AI coding rules to configuration files for Claude, GitHub Copilot, and other AI assistants. Parses rules from source directories and generates documentation sections automatically.
54

6-
## Extending to new formats
5+
## Supported Formats
76

8-
### Adding New Input Parsers
7+
- **Development Rules** - `.cursor/rules/*.mdc` files (YAML frontmatter) → Development Rules section
8+
- **Review Guidelines** - `.code_review/*.md` files (HTML comment frontmatter) → Review Guidelines section
99

10-
Create a parser class implementing `InputParser` in `sync_ai_rules/parsers/`:
10+
Target files: `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`
11+
12+
## Extending the System
13+
14+
### Create a New Pipeline
15+
16+
1. **Create a parser** in `sync_ai_rules/parsers/`:
1117

1218
```python
13-
from sync_ai_rules.core.interfaces import InputParser, RuleMetadata
19+
from sync_ai_rules.core.parser_interface import InputParser
20+
from sync_ai_rules.core.rule_metadata import RuleMetadata
1421

1522
class YourParser(InputParser):
1623
@property
1724
def name(self) -> str:
1825
return "your-format"
1926

20-
# Implement required methods...
21-
```
27+
@property
28+
def source_directories(self) -> list[str]:
29+
return [".your-rules"] # Where to scan
2230

23-
### Adding New Output Generators
31+
# Implement can_parse() and parse()...
32+
```
2433

25-
Create a generator class implementing `OutputGenerator` in `sync_ai_rules/generators/`:
34+
2. **Create a generator** in `sync_ai_rules/generators/`:
2635

2736
```python
28-
from sync_ai_rules.core.interfaces import OutputGenerator
37+
from sync_ai_rules.generators.base_generator import BaseGenerator
2938

30-
class YourGenerator(OutputGenerator):
39+
class YourGenerator(BaseGenerator):
3140
@property
3241
def name(self) -> str:
3342
return "your-output"
3443

35-
# Implement required methods...
36-
```
44+
def get_section_markers(self) -> tuple[str, str]:
45+
return ("<your-section>", "</your-section>")
3746

38-
### Register Your Extensions
47+
# Implement generate() and _format_rule()...
48+
```
3949

40-
Add them to `sync_ai_rules/plugins.yaml`:
50+
3. **Register the pipeline** in `sync_ai_rules/plugins.yaml`:
4151

4252
```yaml
43-
parsers:
44-
- name: your-format
45-
module: your_parser
46-
class: YourParser
47-
48-
generators:
49-
- name: your-output
50-
module: your_generator
51-
class: YourGenerator
53+
pipelines:
54+
- name: your-pipeline
55+
description: Your pipeline description
56+
parser:
57+
module: your_parser
58+
class: YourParser
59+
generator:
60+
module: your_generator
61+
class: YourGenerator
5262
```
63+
64+
Parsers and generators can be reused across multiple pipelines.

0 commit comments

Comments
 (0)