Skip to content

Commit 2a91d9a

Browse files
committed
Remove root special casing
1 parent d23a02a commit 2a91d9a

4 files changed

Lines changed: 8 additions & 22 deletions

File tree

sync_ai_rules/__main__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@
1515

1616

1717
def find_project_root() -> str:
18-
"""Find project root by looking for .cursor/rules or .code_review directories."""
19-
current = Path.cwd()
20-
21-
for path in [current] + list(current.parents):
22-
if (path / ".cursor" / "rules").exists() or (path / ".code_review").exists():
23-
return str(path)
24-
25-
return str(current)
18+
"""Return current working directory as project root."""
19+
return str(Path.cwd())
2620

2721

2822
def get_category(file_path: str, source_dir: str) -> str:

sync_ai_rules/generators/base_generator.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,8 @@ def default_filenames(self) -> List[str]:
2323

2424
def _format_heading(self, category: str) -> str:
2525
"""Format category as heading."""
26-
if category == "root":
27-
return "Root Rules"
28-
29-
# Convert folder name to title case
3026
return category.replace("-", " ").replace("_", " ").title()
3127

32-
def _sort_categories(self, categories: List[str]) -> List[str]:
33-
"""Sort categories with 'root' always last."""
34-
return sorted(categories, key=lambda x: (x == "root", x))
35-
3628
def _sort_rules_by_title(self, rules: List[RuleMetadata]) -> List[RuleMetadata]:
3729
"""Sort rules alphabetically by title."""
3830
return sorted(rules, key=lambda r: r.title)

sync_ai_rules/generators/code_review_guidelines_generator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ def generate(self, rules: Dict[str, List[RuleMetadata]], config: Dict[str, Any])
2626
"",
2727
]
2828

29-
# Sort categories (root comes last)
30-
sorted_categories = self._sort_categories(list(rules.keys()))
29+
# Sort categories alphabetically
30+
sorted_categories = sorted(rules.keys())
3131

3232
for category in sorted_categories:
3333
category_rules = rules[category]
3434
if not category_rules:
3535
continue
3636

37-
# Add category heading (skip for root or if only one category)
38-
if category != "root" and len(sorted_categories) > 1:
37+
# Add category heading if there are multiple categories
38+
if len(sorted_categories) > 1:
3939
heading = self._format_heading(category)
4040
lines.append(f"### {heading}")
4141
lines.append("")

sync_ai_rules/generators/development_rules_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def generate(self, rules: Dict[str, List[RuleMetadata]], config: Dict[str, Any])
3535
"",
3636
]
3737

38-
# Sort categories (root comes last)
39-
sorted_categories = self._sort_categories(list(rules.keys()))
38+
# Sort categories alphabetically
39+
sorted_categories = sorted(rules.keys())
4040

4141
for category in sorted_categories:
4242
category_rules = rules[category]

0 commit comments

Comments
 (0)