Skip to content

Commit 93e0971

Browse files
ndbroadbentclaude
andcommitted
refactor: rename atomic flags for clarity and remove atomic-apply
- Rename --atomic to --atomic-identifiers for clarity - Rename --no-atomic to --no-atomic-identifiers - Remove --atomic-apply flag (always atomic by default) - Keep --atomic-search and --atomic-replace unchanged - Update all CLI handlers, docs, MCP server, and tests - All tests passing (536 tests in Rust, 63 in MCP, VS Code clean) This prevents confusion between identifier atomicity (treating compound words as single units) and transactional apply operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 172b291 commit 93e0971

File tree

16 files changed

+59
-60
lines changed

16 files changed

+59
-60
lines changed

docs/src/content/docs/commands/apply.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ renamify apply [ID] [OPTIONS]
1919

2020
## Options
2121

22-
- `--atomic` - Apply changes atomically (default: true)
2322
- `--commit` - Create a git commit after applying
2423
- `--force-with-conflicts` - Apply even if conflicts are detected
2524

docs/src/content/docs/commands/plan.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ Note: The plan is always saved to `.renamify/plan.json` (or the path specified b
6666
"Atomic" means treating a search or replace identifier as a single unit,
6767
not splitting it into separate components. E.g. GitHub → github, not git_hub
6868

69-
- `--atomic` - Treat both search and replace terms as indivisible units
69+
- `--atomic-identifiers` - Treat both search and replace terms as indivisible units
7070
- `--atomic-search` - Only treat search term as atomic
7171
- `--atomic-replace` - Only treat replace term as atomic
72-
- `--no-atomic` - Disable atomic mode (override config)
72+
- `--no-atomic-identifiers` - Disable atomic mode (override config)
7373
- `--no-atomic-search` - Disable atomic for search term
7474
- `--no-atomic-replace` - Disable atomic for replace term
7575

@@ -190,7 +190,7 @@ renamify plan old_name new_name --dry-run
190190

191191
```bash
192192
# Treat compound words as single units
193-
renamify plan DocSpring FormAPI --atomic
193+
renamify plan DocSpring FormAPI --atomic-identifiers
194194

195195
# Only search term is atomic
196196
renamify plan DocSpring form_api --atomic-search

docs/src/content/docs/commands/rename.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ renamify rename <OLD> <NEW> [PATHS]... [OPTIONS]
7272
"Atomic" means treating a search or replace identifier as a single unit,
7373
not splitting it into separate components. E.g. GitHub → github, not git_hub
7474

75-
- `--atomic` - Treat both search and replace terms as indivisible units
75+
- `--atomic-identifiers` - Treat both search and replace terms as indivisible units
7676
- `--atomic-search` - Only treat search term as atomic
7777
- `--atomic-replace` - Only treat replace term as atomic
78-
- `--no-atomic` - Disable atomic mode (override config)
78+
- `--no-atomic-identifiers` - Disable atomic mode (override config)
7979
- `--no-atomic-search` - Disable atomic for search term
8080
- `--no-atomic-replace` - Disable atomic for replace term
8181

@@ -130,10 +130,10 @@ renamify rename oldApi newApi \
130130

131131
```bash
132132
# Treat compound words as single units
133-
renamify rename DocSpring FormAPI --atomic
133+
renamify rename DocSpring FormAPI --atomic-identifiers
134134

135-
# Without --atomic, DocSpring would match doc_spring in snake_case
136-
# With --atomic, DocSpring only matches docspring (as single unit)
135+
# Without --atomic-identifiers, DocSpring would match doc_spring in snake_case
136+
# With --atomic-identifiers, DocSpring only matches docspring (as single unit)
137137
```
138138

139139
### Case Style Control

docs/src/content/docs/commands/search.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ Available styles: `snake`, `kebab`, `camel`, `pascal`, `screaming-snake`,
5656

5757
### Atomic Mode
5858

59-
- `--atomic` - Treat the search term as an indivisible unit (no word boundaries)
60-
- `--atomic-search` - Same as `--atomic` for search command
61-
- `--no-atomic` - Disable atomic mode (override config)
62-
- `--no-atomic-search` - Same as `--no-atomic` for search command
59+
- `--atomic-identifiers` - Treat the search term as an indivisible unit (no word boundaries)
60+
- `--atomic-search` - Same as `--atomic-identifiers` for search command
61+
- `--no-atomic-identifiers` - Disable atomic mode (override config)
62+
- `--no-atomic-search` - Same as `--no-atomic-identifiers` for search command
6363

6464
### Output Control
6565

@@ -145,7 +145,7 @@ Search for compound words as single units:
145145

146146
```bash
147147
# DocSpring will match as a whole word, not doc_spring
148-
renamify search DocSpring --atomic
148+
renamify search DocSpring --atomic-identifiers
149149
```
150150

151151
### JSON Output for Processing

docs/src/content/docs/features/atomic-identifiers.mdx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,22 @@ You can specify atomic mode using CLI flags:
4646

4747
<Tabs>
4848
<TabItem label="Both atomic">
49-
```bash # Both search and replace terms are atomic renamify rename FormAPI
50-
DocSpring --atomic
49+
```bash
50+
# Both search and replace terms are atomic
51+
renamify rename FormAPI DocSpring --atomic-identifiers
5152
```
5253
</TabItem>
5354
<TabItem label="Search only">
54-
```bash # Only search term is atomic renamify rename FormAPI Helper
55-
--atomic-search
55+
```bash
56+
# Only search term is atomic
57+
renamify rename FormAPI Helper --atomic-search
5658
```
5759
</TabItem>
5860
<TabItem label="Replace only">
5961

60-
```bash # Only replace term is atomic renamify rename OldName DocSpring
61-
--atomic-replace
62+
```bash
63+
# Only replace term is atomic
64+
renamify rename OldName DocSpring --atomic-replace
6265
```
6366

6467
</TabItem>
@@ -97,7 +100,7 @@ renamify rename OldName DocSpring --no-atomic-replace
97100
When renaming "FormAPI" to "DocSpring" with atomic mode:
98101

99102
```bash
100-
renamify rename FormAPI DocSpring --atomic
103+
renamify rename FormAPI DocSpring --atomic-identifiers
101104
```
102105

103106
Results:

renamify-cli/src/cli/args.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,21 @@ pub struct AcronymArgs {
124124
/// Atomic identifier arguments
125125
#[derive(Args, Debug, Clone)]
126126
pub struct AtomicArgs {
127-
/// Treat both terms as atomic (single words). E.g. DocSpring becomes docspring in snake_case, not doc_spring
127+
/// Treat both search and replace terms as atomic identifiers (no word boundaries). E.g. GitHub becomes github in snake_case, not git_hub
128128
#[arg(long, conflicts_with_all = ["atomic_search", "atomic_replace"])]
129-
pub atomic: bool,
129+
pub atomic_identifiers: bool,
130130

131-
/// Treat search term as atomic (GitHub → github, not git_hub)
131+
/// Treat search term as atomic identifier (GitHub → github, not git_hub)
132132
#[arg(long)]
133133
pub atomic_search: bool,
134134

135-
/// Treat replace term as atomic (GitHub → github, not git_hub)
135+
/// Treat replace term as atomic identifier (GitHub → github, not git_hub)
136136
#[arg(long)]
137137
pub atomic_replace: bool,
138138

139-
/// Override config: allow word boundary detection
140-
#[arg(long, conflicts_with = "atomic")]
141-
pub no_atomic: bool,
139+
/// Override config: allow word boundary detection for both terms
140+
#[arg(long, conflicts_with = "atomic_identifiers")]
141+
pub no_atomic_identifiers: bool,
142142

143143
/// Override config for search: allow word boundaries
144144
#[arg(long, conflicts_with = "atomic_search")]
@@ -422,10 +422,6 @@ pub enum Commands {
422422
/// Plan ID or path to apply (optional - defaults to .renamify/plan.json)
423423
id: Option<String>,
424424

425-
/// Apply changes atomically
426-
#[arg(long, default_value_t = true)]
427-
atomic: bool,
428-
429425
/// Commit changes to git
430426
#[arg(long)]
431427
commit: bool,

renamify-cli/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ fn main() {
195195
acronyms.exclude_acronyms,
196196
acronyms.only_acronyms,
197197
cli::args::AtomicArgs {
198-
atomic: false,
198+
atomic_identifiers: false,
199199
atomic_search: false,
200200
atomic_replace: false,
201-
no_atomic: false,
201+
no_atomic_identifiers: false,
202202
no_atomic_search: false,
203203
no_atomic_replace: false,
204204
},
@@ -210,7 +210,6 @@ fn main() {
210210

211211
Commands::Apply {
212212
id,
213-
atomic: _,
214213
commit,
215214
force_with_conflicts,
216215
output,
@@ -258,7 +257,7 @@ fn main() {
258257
no_rename_root,
259258
dry_run,
260259
acronyms,
261-
atomic: _, // Not implemented in rename yet
260+
atomic,
262261
output,
263262
quiet,
264263
} => {
@@ -291,6 +290,7 @@ fn main() {
291290
acronyms.include_acronyms,
292291
acronyms.exclude_acronyms,
293292
acronyms.only_acronyms,
293+
atomic,
294294
cli.yes,
295295
use_color,
296296
output,

renamify-cli/src/plan.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ pub fn handle_plan(
5858

5959
// Build atomic config from CLI args and config file
6060
let atomic_config = renamify_core::atomic::AtomicConfig::from_flags_and_config(
61-
atomic.atomic,
62-
atomic.atomic_search || (atomic.atomic && !atomic.no_atomic_search),
63-
atomic.atomic_replace || (atomic.atomic && !atomic.no_atomic_replace),
61+
atomic.atomic_identifiers,
62+
atomic.atomic_search || (atomic.atomic_identifiers && !atomic.no_atomic_search),
63+
atomic.atomic_replace || (atomic.atomic_identifiers && !atomic.no_atomic_replace),
6464
config.atomic,
6565
);
6666

renamify-cli/src/rename.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::Result;
22
use renamify_core::{rename_operation, OutputFormatter, Style};
33
use std::path::PathBuf;
44

5-
use crate::cli::{types::StyleArg, OutputFormat, PreviewArg};
5+
use crate::cli::{args::AtomicArgs, types::StyleArg, OutputFormat, PreviewArg};
66

77
#[allow(clippy::too_many_arguments)]
88
pub fn handle_rename(
@@ -31,6 +31,7 @@ pub fn handle_rename(
3131
include_acronyms: Vec<String>,
3232
exclude_acronyms: Vec<String>,
3333
only_acronyms: Vec<String>,
34+
atomic: AtomicArgs,
3435
auto_approve: bool,
3536
use_color: bool,
3637
output: OutputFormat,
@@ -41,6 +42,17 @@ pub fn handle_rename(
4142
let include_styles: Vec<Style> = include_styles.into_iter().map(Into::into).collect();
4243
let only_styles: Vec<Style> = only_styles.into_iter().map(Into::into).collect();
4344

45+
// Load config to get atomic identifiers
46+
let config = renamify_core::Config::load().unwrap_or_default();
47+
48+
// Build atomic config from CLI args and config file
49+
let atomic_config = renamify_core::atomic::AtomicConfig::from_flags_and_config(
50+
atomic.atomic_identifiers,
51+
atomic.atomic_search || (atomic.atomic_identifiers && !atomic.no_atomic_search),
52+
atomic.atomic_replace || (atomic.atomic_identifiers && !atomic.no_atomic_replace),
53+
config.atomic,
54+
);
55+
4456
// Handle quiet mode - overrides preview to none unless output is json
4557
let effective_preview = if quiet && output != OutputFormat::Json {
4658
None
@@ -87,6 +99,7 @@ pub fn handle_rename(
8799
&include_acronyms,
88100
&exclude_acronyms,
89101
&only_acronyms,
102+
Some(&atomic_config),
90103
auto_approve,
91104
use_color,
92105
)?;

renamify-cli/tests/train_case_e2e_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ The Rename-Tool-Based-Solution is working.
248248
&[], // include_acronyms
249249
&[], // exclude_acronyms
250250
&[], // only_acronyms
251+
None, // atomic_config
251252
true, // auto_approve
252253
true, // use_color
253254
)

0 commit comments

Comments
 (0)