feat: implement remove command with sequential removals

This commit is contained in:
Rogee
2025-10-29 18:59:55 +08:00
parent 446bd46b95
commit f66c59fd57
31 changed files with 986 additions and 110 deletions

View File

@@ -20,6 +20,7 @@ tests/
- `renamer list` — preview rename scope with shared flags before executing changes.
- `renamer replace` — consolidate multiple literal patterns into a single replacement (supports `--dry-run` + `--yes`).
- `renamer remove` — delete ordered substrings from filenames with empty-name protections, duplicate warnings, and undoable ledger entries.
- `renamer undo` — revert the most recent rename/replace batch using ledger entries.
- Persistent scope flags: `--path`, `-r/--recursive`, `-d/--include-dirs`, `--hidden`, `--extensions`, `--yes`, `--dry-run`.
@@ -32,12 +33,12 @@ tests/
## Testing
- `go test ./...`
- Contract tests: `tests/contract/replace_command_test.go`
- Integration tests: `tests/integration/replace_flow_test.go`
- Smoke: `scripts/smoke-test-replace.sh`
- Contract tests: `tests/contract/replace_command_test.go`, `tests/contract/remove_command_preview_test.go`, `tests/contract/remove_command_ledger_test.go`
- Integration tests: `tests/integration/replace_flow_test.go`, `tests/integration/remove_flow_test.go`, `tests/integration/remove_undo_test.go`, `tests/integration/remove_validation_test.go`
- Smoke: `scripts/smoke-test-replace.sh`, `scripts/smoke-test-remove.sh`
## Recent Changes
- 003-add-remove-command: Added Go 1.24 + `spf13/cobra`, `spf13/pflag`
- 003-add-remove-command: Added sequential `renamer remove` subcommand, automation-friendly ledger metadata, and CLI warnings for duplicates/empty results
- 002-add-replace-command: Added `renamer replace` command, ledger metadata, and automation docs.
- 001-list-command-filters: Added `renamer list` command with shared scope flags and formatters.