Skip to content

Commit 537275f

Browse files
ndbroadbentclaude
andcommitted
feat: implement contextual separator coercion
Fixes the critical issue where refaktor-core was renamed to smart_search_and_replace-core (mixed separators) instead of smart-search-and-replace-core (consistent hyphens). Key features: - Automatic style detection (kebab-case, snake_case, PascalCase, etc.) - Context-aware coercion maintains container naming conventions - Smart file extension handling for proper style detection - Case-insensitive multi-occurrence replacement - Dot-case exclusion by default (risky for extensions) - Integration with both content matches and file/directory renames Comprehensive test coverage includes: - Critical test case: refaktor-core → smart-search-and-replace-core - Various container styles and edge cases - End-to-end repository scanning with coercion - File/directory rename coercion - Content match coercion within code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8f9b8d3 commit 537275f

11 files changed

Lines changed: 906 additions & 16 deletions

File tree

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22

33
Smart search & replace for code and files with case-aware transformations and built-in undo/redo.
44

5-
## Demo: Refaktor Refactoring Itself! 🤯
5+
- CLI tool
6+
- Extension for VS Code and Cursor _(coming soon)_
7+
- MCP server for AI integrations _(coming soon)_
8+
9+
## Features
10+
11+
- Case-aware transformations (snake_case, kebab-case, camelCase, PascalCase, UPPER_SNAKE_CASE)
12+
- File and directory renaming
13+
- Plan / apply workflow for safety during large refactorings
14+
- Built-in undo/redo with history tracking (separate to git history)
15+
- Perform a large refactor safely without needing to commit anything first
16+
- Cross-platform support (Linux, macOS, Windows)
17+
18+
## Demo
619

720
Watch Refaktor rename itself to `smart_search_and_replace`, then use the renamed binary to change it back:
821

@@ -30,16 +43,7 @@ cargo build --release
3043
./target/release/refaktor --help
3144
```
3245

33-
This demonstrates Refaktor's power: it can rename entire projects including all code references, file names, directory names, and even the binary itself - all while maintaining perfect consistency across different naming conventions!
34-
35-
## Features
36-
37-
- Case-aware transformations (snake_case, kebab-case, camelCase, PascalCase, UPPER_SNAKE_CASE)
38-
- File and directory renaming
39-
- Built-in undo/redo with history tracking
40-
- Cross-platform support (Linux, macOS, Windows)
41-
- VS Code extension
42-
- MCP server for AI integrations
46+
This demonstrates Refaktor's power: it can rename entire projects including all code references, file names, and directory names - all while maintaining perfect consistency across different naming conventions.
4347

4448
## Build Status
4549

@@ -75,4 +79,4 @@ cargo llvm-cov --package refaktor-core
7579

7680
## License
7781

78-
MIT License - Copyright (c) 2025 DocSpring
82+
MIT License - Copyright (c) 2025 DocSpring

refaktor-cli/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ fn handle_plan(
398398
rename_files,
399399
rename_dirs,
400400
plan_out: plan_out.clone(),
401+
coerce_separators: refaktor_core::scanner::CoercionMode::Auto, // TODO: make configurable
401402
};
402403

403404
// Scan the repository

0 commit comments

Comments
 (0)