Skip to content

Commit 828eedb

Browse files
committed
add interactive fix command with dry-run and TTY prompts
1 parent 99b50d3 commit 828eedb

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.0] - 2025-08-17
11+
12+
### Added
13+
- Interactive fix flow: `gem_guard fix --interactive` prompts per gem (via `tty-prompt`).
14+
15+
### Changed
16+
- Dry-run output refined to: `✅ Would update <gem> <from> → <to>` for clarity.
17+
18+
### Dependencies
19+
- Add runtime dependency: `tty-prompt ~> 0.23`.
20+
1021
## [1.1.2] - 2025-08-11
1122

1223
### Added

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
gem_guard (1.1.2)
4+
gem_guard (1.2.0)
55
json (~> 2.0)
66
thor (~> 1.0)
77
tty-prompt (~> 0.23)

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,38 @@ Details:
122122
🔧 Fix: bundle update thor --to 1.4.0
123123
```
124124

125+
### 🛠 Auto-fix Vulnerable Dependencies
126+
127+
Use `fix` to apply recommended upgrades. Start with a dry run to preview changes.
128+
129+
```bash
130+
# Preview only — shows what would change, does not modify files
131+
gem_guard fix --dry-run
132+
133+
# Interactively confirm each upgrade (uses tty-prompt)
134+
gem_guard fix --interactive
135+
136+
# Apply fixes non-interactively
137+
gem_guard fix
138+
```
139+
140+
Dry run output example:
141+
142+
```
143+
🔍 Dry run — no files will be modified.
144+
========================================
145+
✅ Would update nokogiri 1.12.0 → 1.14.3
146+
147+
Dry run completed. 1 fixes planned.
148+
Run without --dry-run to apply these fixes.
149+
```
150+
151+
Behavior notes:
152+
153+
- **Interactive**: You’ll be asked per gem: `Upgrade nokogiri 1.12.0 → 1.14.3?` Answering “no” skips that gem.
154+
- **Backups**: A `Gemfile.lock.backup.YYYYMMDD_HHMMSS` is created only if at least one fix is approved/applied.
155+
- **Requirements**: `Gemfile` and `Gemfile.lock` must exist. Interactive prompts require a TTY-capable environment.
156+
125157
### 🎯 Typosquat Detection
126158

127159
**Basic typosquat check:**

lib/gem_guard/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module GemGuard
2-
VERSION = "1.1.2"
2+
VERSION = "1.2.0"
33
end

0 commit comments

Comments
 (0)