|
| 1 | +--- |
| 2 | +allowed-tools: Bash(bundle :*), Bash(git :*), Read, Edit, MultiEdit, Glob |
| 3 | +description: Update Gemfile dependencies to latest minor versions |
| 4 | +argument-hint: [gemfile] [commit] |
| 5 | +--- |
| 6 | + |
| 7 | +Update the dependencies in the specified Gemfile (or ./Gemfile if no path provided) to their latest minor versions while |
| 8 | +preserving major version constraints. Only update MAJOR.MINOR versions, never PATCH versions unless explicitly needed. |
| 9 | + |
| 10 | +Steps: |
| 11 | +1. Read the Gemfile at the specified path (or ./Gemfile if $ARGUMENTS is empty) |
| 12 | +2. Read the corresponding Gemfile.lock to get current resolved versions |
| 13 | +3. Run `bundle outdated --only-explicit` to check for available minor updates of explicitly declared gems |
| 14 | +4. For each gem in Gemfile, check if Gemfile.lock has a newer minor version than the current Gemfile constraint allows |
| 15 | +5. Update gem version constraints to match the minor version from Gemfile.lock or latest available, whichever is newer (MAJOR.MINOR format) |
| 16 | +6. Use pessimistic version constraints (~> MAJOR.MINOR) to prevent automatic patch updates |
| 17 | +7. Preserve any existing version operators but ensure they follow minor-only update strategy |
| 18 | +8. Run `bundle update` to apply the changes |
| 19 | +7. Skip step 8, 9 and 10 if --commit flag is not provided |
| 20 | +8. Stage Gemfile (only if not gitignored) |
| 21 | +9. Verify if Gemfile.lock is tracked and not gitignored. If both conditions are met, stage it for commit. |
| 22 | +10. Create a git commit with message 'Update development dependencies' and a description listing all updated gems with their old and new versions like: |
| 23 | + |
| 24 | +<commit-message> |
| 25 | + Updated gems: |
| 26 | +- rubocop: 1.75.2 → 1.78.0 |
| 27 | +- rubocop-yard: 0.10.0 → 1.0.0 |
| 28 | +</commit-message> |
| 29 | + |
| 30 | +11. If any dependencies were updated, respond only with the update message. And if the user has chose to commit, |
| 31 | +include the update commit message. Otherwise, respond only with the no op message. |
| 32 | + |
| 33 | +<update-message> |
| 34 | +Updated gems: |
| 35 | +- rbs: 3.8 → 3.9 |
| 36 | +- rubocop: 1.78 → 1.80 |
| 37 | +- rubocop-rspec: 3.6 → 3.7 |
| 38 | + |
| 39 | +<update-commit-message>The changes have been committed with the message "Update development dependencies".</update-commit-message> |
| 40 | +</update-message> |
| 41 | + |
| 42 | +<no-op-message>All dependencies are up to date.</no-op-message> |
| 43 | + |
| 44 | +Key bundle outdated flags used: |
| 45 | +- `--only-explicit`: Only show gems explicitly listed in Gemfile (not dependencies) |
| 46 | +- No `--local` flag to ensure remote gem sources are checked for latest versions |
| 47 | + |
| 48 | +Arguments: |
| 49 | +- `gemfile`: Gemfile path (defaults to ./Gemfile if not provided) |
| 50 | +- `--commit`: Create a git commit after updating dependencies with message 'Update development dependencies' and a description listing all updated gems with their old and new versions |
| 51 | + |
| 52 | +Gemfile path: ${ARGUMENTS:-./Gemfile} |
0 commit comments