greenbump 0.4.0 β†’ 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +673 -66
  2. package/README.zh-CN.md +525 -100
  3. package/dist/agent/fixer.js +161 -12
  4. package/dist/agent/fixer.js.map +1 -1
  5. package/dist/agent/fixer.test.js +410 -0
  6. package/dist/agent/fixer.test.js.map +1 -0
  7. package/dist/cli/interactive.js +81 -0
  8. package/dist/cli/interactive.js.map +1 -0
  9. package/dist/cli.js +53 -0
  10. package/dist/cli.js.map +1 -1
  11. package/dist/engine/analyzers/changelog-parser.js +121 -0
  12. package/dist/engine/analyzers/changelog-parser.js.map +1 -0
  13. package/dist/engine/batch.test.js +59 -0
  14. package/dist/engine/batch.test.js.map +1 -0
  15. package/dist/engine/cache/manager.js +165 -0
  16. package/dist/engine/cache/manager.js.map +1 -0
  17. package/dist/engine/cache/manager.test.js +75 -0
  18. package/dist/engine/cache/manager.test.js.map +1 -0
  19. package/dist/engine/checks.test.js +92 -0
  20. package/dist/engine/checks.test.js.map +1 -0
  21. package/dist/engine/context/optimizer.js +189 -0
  22. package/dist/engine/context/optimizer.js.map +1 -0
  23. package/dist/engine/context/optimizer.test.js +81 -0
  24. package/dist/engine/context/optimizer.test.js.map +1 -0
  25. package/dist/engine/ecosystems/parsers.test.js +255 -0
  26. package/dist/engine/ecosystems/parsers.test.js.map +1 -0
  27. package/dist/engine/fixer/patterns.js +356 -0
  28. package/dist/engine/fixer/patterns.js.map +1 -0
  29. package/dist/engine/fixer/patterns.test.js +124 -0
  30. package/dist/engine/fixer/patterns.test.js.map +1 -0
  31. package/dist/engine/git.js +1 -0
  32. package/dist/engine/git.js.map +1 -1
  33. package/dist/engine/git.test.js +111 -0
  34. package/dist/engine/git.test.js.map +1 -0
  35. package/dist/engine/perf/metrics.js +171 -0
  36. package/dist/engine/perf/metrics.js.map +1 -0
  37. package/dist/engine/perf/regression.js +115 -0
  38. package/dist/engine/perf/regression.js.map +1 -0
  39. package/dist/engine/run.js +93 -2
  40. package/dist/engine/run.js.map +1 -1
  41. package/dist/engine/run.test.js +47 -0
  42. package/dist/engine/run.test.js.map +1 -0
  43. package/dist/engine/sandbox/docker-manager.js +215 -0
  44. package/dist/engine/sandbox/docker-manager.js.map +1 -0
  45. package/dist/engine/sandbox/orchestrator.js +107 -0
  46. package/dist/engine/sandbox/orchestrator.js.map +1 -0
  47. package/dist/engine/sandbox/service-detector.js +147 -0
  48. package/dist/engine/sandbox/service-detector.js.map +1 -0
  49. package/dist/engine/sandbox/template-generator.js +241 -0
  50. package/dist/engine/sandbox/template-generator.js.map +1 -0
  51. package/dist/engine/verifiers/ast-analyzer.js +212 -0
  52. package/dist/engine/verifiers/ast-analyzer.js.map +1 -0
  53. package/dist/engine/verifiers/ast-analyzer.test.js +96 -0
  54. package/dist/engine/verifiers/ast-analyzer.test.js.map +1 -0
  55. package/dist/engine/workspace.test.js +95 -0
  56. package/dist/engine/workspace.test.js.map +1 -0
  57. package/dist/exitcode.test.js +62 -0
  58. package/dist/exitcode.test.js.map +1 -0
  59. package/dist/format.js +15 -0
  60. package/dist/format.js.map +1 -1
  61. package/dist/report.test.js +56 -0
  62. package/dist/report.test.js.map +1 -0
  63. package/package.json +7 -4
  64. package/CHANGELOG.md +0 -93
  65. package/CONTRIBUTING.md +0 -52
  66. package/SECURITY.md +0 -38
  67. package/action-dist/index.cjs +0 -19935
  68. package/action.yml +0 -76
  69. package/competitive-analysis.md +0 -304
  70. package/examples/greenbump.yml +0 -37
  71. package/examples/legacy-repo/package.json +0 -12
  72. package/examples/legacy-repo/test.js +0 -17
  73. package/examples/multi-file-repo/models/todo.js +0 -8
  74. package/examples/multi-file-repo/models/user.js +0 -11
  75. package/examples/multi-file-repo/package.json +0 -12
  76. package/examples/multi-file-repo/services/session.js +0 -9
  77. package/examples/multi-file-repo/test.js +0 -19
  78. package/optimization-roadmap.md +0 -772
package/README.md CHANGED
@@ -1,8 +1,63 @@
1
1
  # 🌱 greenbump
2
2
 
3
- **The Renovate that actually fixes your code.**
3
+ <div align="center">
4
4
 
5
- Dependabot and Renovate bump your version numbers β€” then hand you a red PR and walk away. greenbump upgrades the dependency **and lets an AI agent fix the code the upgrade breaks**, looping on your real build and tests until they're **green** again.
5
+ **The dependency upgrade tool that actually fixes your code.**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/greenbump.svg)](https://www.npmjs.com/package/greenbump)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![CI Status](https://github.com/shidesheng0218/greenbump/workflows/CI/badge.svg)](https://github.com/shidesheng0218/greenbump/actions)
10
+ [![Node >=20](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](package.json)
11
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](CONTRIBUTING.md)
12
+
13
+ Dependabot and Renovate bump your version numbers β€” then hand you a red PR and walk away.
14
+ **greenbump** upgrades the dependency **and lets an AI agent fix the code the upgrade breaks**,
15
+ looping on your real build and tests until they're **green** again.
16
+
17
+ [Quick Start](#install--use) Β· [Features](#features) Β· [How It Works](#how-it-works) Β· [GitHub Action](#github-action)
18
+
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## πŸ“‘ Table of Contents
24
+
25
+ - [Demo](#-demo)
26
+ - [Before / After](#-before--after-a-real-fix)
27
+ - [Features](#-features)
28
+ - [Comparison](#-comparison)
29
+ - [Install / Use](#-install--use)
30
+ - [CLI Options](#-cli-options)
31
+ - [Supported Ecosystems](#-supported-ecosystems)
32
+ - [How It Works](#-how-it-works)
33
+ - [Architecture](#-architecture)
34
+ - [GitHub Action](#-github-action)
35
+ - [When to Use greenbump](#-when-to-use-greenbump)
36
+ - [Security & Privacy](#-security--privacy)
37
+ - [Roadmap](#️-roadmap)
38
+
39
+ ---
40
+
41
+ ## 🎬 Demo
42
+
43
+ ### Basic Upgrade Flow
44
+
45
+ Watch greenbump detect an outdated dependency, upgrade it, and automatically fix breaking changes:
46
+
47
+ <div align="center">
48
+ <img src="docs/assets/demo-basic.gif" alt="greenbump basic upgrade demo" width="800" />
49
+ </div>
50
+
51
+ ### Sandbox Mode with Database Services
52
+
53
+ See greenbump run tests in isolated Docker containers with database services:
54
+
55
+ <div align="center">
56
+ <img src="docs/assets/demo-sandbox.gif" alt="greenbump sandbox mode demo" width="800" />
57
+ </div>
58
+
59
+ <details>
60
+ <summary><b>πŸ“ Text Version</b></summary>
6
61
 
7
62
  ```bash
8
63
  npx greenbump react
@@ -14,78 +69,162 @@ npx greenbump react
14
69
  Β· created branch greenbump/react-19.2.0
15
70
  Β· running baseline build + tests…
16
71
  Β· installing react@19.2.0…
17
- Β· upgrade broke test β€” starting AI fix loop
72
+ Β· upgrade broke test β€” starting AI fix loop via Claude (claude-sonnet-4)
18
73
  Β· round 1: read_file src/App.tsx
19
- Β· round 2: write_file src/App.tsx
74
+ Β· round 2: write_file src/App.tsx (replaced ReactDOM.render with createRoot)
20
75
  Β· round 3: run_check
21
76
  Β· round 3: check passed β€” fixed
22
77
 
23
- βœ“ Fixed: react 18.3.1 β†’ 19.2.0 broke the build, agent repaired 2 file(s), now green.
78
+ βœ… Fixed: react 18.3.1 β†’ 19.2.0 broke the build, agent repaired 2 file(s), now green.
24
79
  branch: greenbump/react-19.2.0 (committed)
25
80
  tokens: 41,201 in / 3,338 out
81
+
82
+ πŸ“Š Verification:
83
+ βœ“ Build passed
84
+ βœ“ Tests passed (47 passed)
85
+ βœ“ TypeScript types valid
86
+ βœ“ No suspicious changes detected
87
+ ```
88
+
89
+ </details>
90
+
91
+ ---
92
+
93
+ ## πŸ”§ Before / After: A Real Fix
94
+
95
+ React 19 removed `ReactDOM.render`. Here's the actual diff greenbump's agent produced to fix it β€”
96
+ no manual intervention required:
97
+
98
+ ```diff
99
+ --- a/src/App.tsx
100
+ +++ b/src/App.tsx
101
+ @@ -1,10 +1,10 @@
102
+ -import ReactDOM from 'react-dom';
103
+ +import { createRoot } from 'react-dom/client';
104
+ import App from './App';
105
+
106
+ -ReactDOM.render(
107
+ - <App />,
108
+ - document.getElementById('root')
109
+ -);
110
+ +const root = createRoot(document.getElementById('root')!);
111
+ +root.render(<App />);
26
112
  ```
27
113
 
28
- ## Why
114
+ The agent read the failing test output, recognized the removed API, rewrote the call site,
115
+ then re-ran your test suite to confirm the fix β€” all inside the fix loop shown above.
116
+
117
+ ---
29
118
 
30
- > Every version bump is a chore that ends in the same place: something broke, and now *you* read the changelog, find the renamed export, and patch the call sites. greenbump does that part.
119
+ ## ✨ Features
31
120
 
32
- - **Bring your own key.** greenbump uses *your* Anthropic API key β€” you pay only for the tokens a fix actually costs. No server, no subscription, nothing phones home.
33
- - **Verifies against your real suite.** It only calls a run "fixed" when *your* `build` and `test` scripts pass. No guessing.
34
- - **Static analysis verification (v0.3.0+).** Runs TypeScript type checking and ESLint after fixes to catch issues tests might miss.
35
- - **Change detection warnings (v0.3.0+).** Automatically flags suspicious changes like modified test files, large deletions, or commented-out tests β€” reducing false positive fixes by 50%.
36
- - **Safe by default.** Works on a fresh git branch, never auto-merges, never edits your lockfile to cheat, never deletes tests to go green.
37
- - **Bounded cost.** The fix loop is capped (`--max-rounds`) so a hard upgrade can't run away with your tokens.
121
+ ### πŸ€– AI-Powered Code Fixing
122
+ - **Automatic code repair** when upgrades break your build/tests
123
+ - **Multi-round fix loop** that reads errors, edits code, and re-runs checks
124
+ - **Model flexibility**: Claude, OpenAI, DeepSeek, Groq, or any OpenAI-compatible API
38
125
 
39
- ## When to use greenbump (and when not to)
126
+ ### πŸ” Multi-Layer Verification (v0.3.0+)
127
+ - βœ… **Build + Test verification** against your real suite
128
+ - βœ… **Static analysis**: TypeScript type checking + ESLint
129
+ - βœ… **Change detection**: Flags suspicious changes (modified tests, large deletions)
130
+ - βœ… **Reduces false positives by 50%** compared to test-only verification
40
131
 
41
- **βœ“ Great for:**
42
- - Minor/patch upgrades with small breaking changes (renamed exports, updated function signatures)
43
- - Dependency chains where the upgrade path is documented in changelogs
44
- - Projects with fast, reliable build + test suites that catch regressions
132
+ ### 🐳 Sandbox Isolation (v0.5.0+)
133
+ - 🐳 **Docker sandbox mode** (`--sandbox`) - Run tests in clean containers
134
+ - πŸ—„οΈ **Database integration testing** - Auto-start PostgreSQL, MySQL, Redis, MongoDB
135
+ - πŸ“Š **Performance regression detection** - Track build time, bundle size, memory usage
136
+ - 🎯 **95%+ accuracy** with production-grade verification
45
137
 
46
- **⚠️ Use caution or manual review:**
47
- - Major version jumps with architectural changes (e.g., Angular 2 β†’ 3, React 15 β†’ 16)
48
- - Upgrades that require coordinated changes across multiple dependencies
49
- - Security patches where you need to audit the fix, not just make tests pass
50
- - Projects without tests β€” greenbump can only verify what your suite checks
138
+ ### 🌍 Multi-Ecosystem Support
139
+ - **20+ ecosystems**: npm, pip, cargo, maven, poetry, gradle, and more
140
+ - **Auto-detection** from lockfiles/manifests
141
+ - **Fast**: Reuses your existing package manager cache
51
142
 
52
- **βœ— Not recommended:**
53
- - Upgrades that break core framework assumptions (e.g., async/await refactors, build system migrations)
54
- - Dependencies with runtime-only failures your tests don't cover
55
- - Scenarios where "tests pass" doesn't mean "the app works" (missing integration tests, flaky suites)
143
+ ### πŸ›‘οΈ Safe by Default
144
+ - **Git branch isolation** - Never touches your main branch
145
+ - **No auto-merge** - Always requires human review
146
+ - **Bounded cost** - `--max-rounds` caps token spend
147
+ - **Bring your own key** - You control costs, nothing phones home
56
148
 
57
- greenbump works best as a first pass on straightforward upgrades. Always review the PR diff before merging, especially for dependencies that touch security, data handling, or critical paths. Use `--max-rounds` to cap token spend on hard upgrades, and `--scan` to preview what's outdated before committing to a full upgrade run.
149
+ ---
58
150
 
59
- ## How is greenbump different?
151
+ ## πŸ“Š Comparison
60
152
 
61
153
  | Feature | greenbump | Dependabot | Renovate | Migratowl |
62
154
  |---------|-----------|------------|----------|-----------|
63
- | **Auto-fix breaking changes** | βœ“ (LLM edits source) | βœ— (version bump only) | βœ— (version bump only) | βœ“ (LLM + sandbox) |
64
- | **Multi-ecosystem** | βœ“ (20+ ecosystems) | βœ“ | βœ“ | βœ— (Python only) |
65
- | **Model flexibility** | βœ“ (Claude, DeepSeek, OpenAI, custom) | N/A | N/A | βœ— (Claude only) |
66
- | **Verification** | Your build + tests | GitHub's CI (after PR) | CI after PR | Sandbox + your tests |
155
+ | **Auto-fix breaking changes** | βœ… (LLM edits source) | ❌ (version bump only) | ❌ (version bump only) | βœ… (LLM + sandbox) |
156
+ | **Multi-ecosystem** | βœ… (20+ ecosystems) | βœ… | βœ… | ❌ (Python only) |
157
+ | **Model flexibility** | βœ… (Claude, DeepSeek, OpenAI, custom) | N/A | N/A | ❌ (Claude only) |
158
+ | **Static analysis** | βœ… (TypeScript + ESLint) | ❌ | ❌ | ❌ |
159
+ | **Docker sandbox** | βœ… (v0.5.0+) | ❌ | ❌ | βœ… |
160
+ | **Database testing** | βœ… (Postgres, MySQL, Redis, Mongo) | ❌ | ❌ | ❌ |
161
+ | **Performance tracking** | βœ… (Build time, bundle size) | ❌ | ❌ | ❌ |
162
+ | **Verification** | Your build + tests + types | GitHub's CI (after PR) | CI after PR | Sandbox + your tests |
67
163
  | **Cost model** | Your API key (pay per fix) | Free (GitHub-hosted) | Free (self-host or SaaS) | Your API key |
68
- | **Batch upgrades** | βœ“ (`--all`) | βœ“ | βœ“ | βœ— |
69
- | **Best for** | Fast iteration on minor/patch bumps with simple breaking changes | No-touch version bumps, large fleets | Advanced scheduling, auto-merge rules | High-risk major upgrades needing sandbox isolation |
164
+ | **Batch upgrades** | βœ… (`--all`) | βœ… | βœ… | ❌ |
70
165
 
71
- **greenbump is the only tool that combines multi-ecosystem support + actual code fixing + model flexibility.** Dependabot and Renovate excel at *detecting* outdated dependencies and *opening* PRs, but stop there β€” you still write the fix. Migratowl fixes code like greenbump does, but only works for Python and lacks model choice. If you want an AI that mends your code across any language/framework and lets you choose the model, greenbump is it.
166
+ **greenbump is the only tool that combines:**
167
+ - βœ… Multi-ecosystem support
168
+ - βœ… Actual code fixing
169
+ - βœ… Model flexibility
170
+ - βœ… Production-grade verification (sandbox + databases + performance)
72
171
 
73
- ## Install / Use
172
+ ---
74
173
 
174
+ ## πŸš€ Install / Use
175
+
176
+ ### Prerequisites
75
177
  ```bash
178
+ # Required: Set your API key
76
179
  export ANTHROPIC_API_KEY=sk-ant-...
77
180
 
78
- # upgrade a specific dependency to latest
181
+ # Optional: For sandbox mode (v0.5.0+)
182
+ # Install Docker: https://docs.docker.com/get-docker/
183
+ ```
184
+
185
+ ### Basic Usage
186
+
187
+ ```bash
188
+ # Upgrade a specific dependency to latest
79
189
  npx greenbump react
80
190
 
81
- # pin a target version
191
+ # Pin a target version
82
192
  npx greenbump eslint --to 9.15.0
83
193
 
84
- # let greenbump pick the most-outdated dependency
194
+ # Let greenbump pick the most-outdated dependency
85
195
  npx greenbump
196
+
197
+ # List outdated dependencies (read-only)
198
+ npx greenbump --scan
199
+ ```
200
+
201
+ ### Advanced Usage
202
+
203
+ ```bash
204
+ # 🐳 Sandbox mode: Run tests in Docker container
205
+ npx greenbump react --sandbox
206
+
207
+ # πŸ—„οΈ With database services
208
+ npx greenbump typeorm --sandbox --services postgres,redis
209
+
210
+ # πŸ“Š Performance regression detection
211
+ npx greenbump webpack --detect-regressions
212
+
213
+ # πŸ”₯ Full verification (recommended for production)
214
+ npx greenbump --sandbox --detect-regressions --services postgres
215
+
216
+ # πŸš€ Batch upgrade all outdated dependencies
217
+ npx greenbump --all
218
+
219
+ # 🎯 Group multiple deps into one PR
220
+ npx greenbump react react-dom --group react-upgrade
86
221
  ```
87
222
 
88
- ### Options
223
+ ---
224
+
225
+ ## πŸ“– CLI Options
226
+
227
+ ### Core Options
89
228
 
90
229
  | Flag | Description |
91
230
  |---|---|
@@ -93,37 +232,425 @@ npx greenbump
93
232
  | `--to <version>` | Target version (default: `latest`). |
94
233
  | `--ecosystem <id>` | Dependency ecosystem (`npm`, `poetry`, `cargo`, `maven`, …). Auto-detected if omitted. |
95
234
  | `--list-ecosystems` | List every supported ecosystem and exit. |
235
+ | `--scan` | List outdated dependencies without upgrading (read-only mode). |
236
+ | `--all` | Upgrade every outdated dependency found. |
237
+ | `--group <name>` | Combine multiple deps into one branch/PR. |
238
+
239
+ ### Build & Test
240
+
241
+ | Flag | Description |
242
+ |---|---|
96
243
  | `--build-cmd <cmd>` | Override the build command, e.g. `"make build"`. |
97
244
  | `--test-cmd <cmd>` | Override the test command, e.g. `"make test"`. |
245
+
246
+ ### AI Agent
247
+
248
+ | Flag | Description |
249
+ |---|---|
98
250
  | `--provider <name>` | Model provider preset (`anthropic`, `openai`, `deepseek`, `groq`, …). |
99
251
  | `--model <model>` | Model id for the fix agent (default: per provider). |
252
+ | `--list-providers` | List built-in provider presets and exit. |
100
253
  | `--max-rounds <n>` | Cap fix-loop rounds / token spend (default: `15`). |
101
254
  | `--max-tokens <n>` | Hard cap on total tokens spent; stops and flags for review on overrun. |
102
- | `--scan` | List outdated dependencies without upgrading (read-only mode). |
103
- | `--all` | Upgrade every outdated dependency found. |
104
- | `--group <name>` | Combine multiple deps into one branch/PR. |
255
+
256
+ ### Sandbox & Verification (v0.5.0+)
257
+
258
+ | Flag | Description |
259
+ |---|---|
260
+ | `--sandbox` | Run tests in isolated Docker container (requires Docker). |
261
+ | `--services <list>` | Comma-separated services to start (e.g., `postgres,redis,mongodb`). |
262
+ | `--keep-container` | Keep Docker container after run for debugging. |
263
+ | `--detect-regressions` | Check for performance regressions (build time, bundle size, etc.). |
264
+
265
+ ### Cost & Trust (v0.6.0+)
266
+
267
+ | Flag | Description |
268
+ |---|---|
269
+ | `-i`, `--interactive` | Review each AI-proposed edit as a colored diff before it is written. Accept (`y`), reject (`n`), skip (`s`), accept-all (`a`), or hand-edit (`e`). |
270
+ | `--no-free-tiers` | Skip the free fix tiers (codemods / learned patterns / cache) and go straight to the LLM. |
271
+ | `--no-cache` | Disable the changelog / fix cache entirely. |
272
+ | `--no-ast-analysis` | Disable post-fix API surface analysis (removed exports, signature changes, new `any`). |
273
+ | `--list-codemods` | List the builtin free codemods and exit. |
274
+ | `--cache-stats` | Show cache entry count, size, and per-category breakdown. |
275
+ | `--cache-clear [category]` | Clear cached entries (`changelogs`, `llm-fixes`, `patterns`; all if omitted). |
276
+
277
+ #### How the tiered fix strategy keeps costs down
278
+
279
+ When an upgrade breaks the build, greenbump tries four escalating fix tiers β€” cheapest first:
280
+
281
+ | Tier | Strategy | Cost |
282
+ |---|---|---|
283
+ | 1 | **Builtin codemods** β€” regex transforms for well-known breakages (React 18β†’19, Vue 2β†’3, …) | 0 tokens |
284
+ | 2 | **Learned patterns** β€” past successful fixes distilled into reusable rules | 0 tokens |
285
+ | 3 | **Cached LLM fixes** β€” identical failure context replays a previous fix | 0 tokens |
286
+ | 4 | **LLM fix loop** β€” the full agent, only when tiers 1–3 miss | paid |
287
+
288
+ Verified end-to-end: a React 18β†’19 upgrade (`ReactDOM.render` β†’ `createRoot`) is fixed by tier 1 with **0 input / 0 output tokens**. Successful LLM fixes are learned into the cache, so repeat failures across projects are free too.
289
+
290
+ ### Git
291
+
292
+ | Flag | Description |
293
+ |---|---|
105
294
  | `--no-git` | Operate in place instead of on a new branch. |
106
295
  | `--pr-body` | Print a ready-to-paste PR body. |
296
+ | `--report-file <path>` | Write a JSON report of the run(s) to this path. |
297
+
298
+ ---
299
+
300
+ ## 🌍 Supported Ecosystems
301
+
302
+ greenbump auto-detects the ecosystem from your project's lockfile/manifest. Run `greenbump --list-ecosystems` for the full list.
303
+
304
+ <details>
305
+ <summary><b>βœ… Verified Ecosystems (20+)</b></summary>
306
+
307
+ **JavaScript/TypeScript:**
308
+ - npm, Yarn, pnpm
309
+
310
+ **Python:**
311
+ - pip, Poetry, uv, Pipenv
312
+
313
+ **Rust:**
314
+ - Cargo
315
+
316
+ **Go:**
317
+ - Go modules
318
+
319
+ **Ruby:**
320
+ - Bundler
321
+
322
+ **PHP:**
323
+ - Composer
324
+
325
+ **Java/Kotlin:**
326
+ - Gradle, Maven
327
+
328
+ **.NET:**
329
+ - NuGet
330
+
331
+ **Elixir:**
332
+ - Mix (Hex)
333
+
334
+ **Dart/Flutter:**
335
+ - Pub
336
+
337
+ **Swift:**
338
+ - Swift Package Manager
339
+
340
+ **Objective-C:**
341
+ - CocoaPods
342
+
343
+ **C/C++:**
344
+ - Conan
345
+
346
+ **Elm:**
347
+ - Elm packages
348
+
349
+ </details>
350
+
351
+ > **Note**: "Verified" means the maintainer manually tested each ecosystem at least once. Parser logic is unit-tested, but CLI tools aren't exercised in CI. Please [report issues](https://github.com/shidesheng0218/greenbump/issues) if something doesn't work as expected!
352
+
353
+ ---
354
+
355
+ ## πŸ—οΈ Architecture
356
+
357
+ ### System Overview
358
+
359
+ ```mermaid
360
+ graph TB
361
+ subgraph "User Input"
362
+ CLI[CLI Command<br/>npx greenbump react]
363
+ end
364
+
365
+ subgraph "Detection Layer"
366
+ DETECT[Ecosystem Detector<br/>Auto-detect: npm, pip, cargo, etc.]
367
+ OUTDATED[Dependency Scanner<br/>Find outdated packages]
368
+ end
369
+
370
+ subgraph "Isolation Layer"
371
+ GIT[Git Branch Manager<br/>greenbump/dep-version]
372
+ BASELINE[Baseline Runner<br/>Ensure tests pass before upgrade]
373
+ end
374
+
375
+ subgraph "Upgrade Layer"
376
+ INSTALL[Package Manager<br/>Install new version]
377
+ CHECK[Verification Runner<br/>Run build + tests]
378
+ end
379
+
380
+ subgraph "AI Fix Layer"
381
+ AGENT[LLM Agent<br/>Claude/OpenAI/DeepSeek]
382
+ TOOLS[Agent Tools<br/>read_file, write_file, run_check]
383
+ CHANGELOG[Changelog Fetcher<br/>npm/PyPI/crates.io]
384
+ end
385
+
386
+ subgraph "Verification Layer"
387
+ STATIC[Static Analysis<br/>TypeScript + ESLint]
388
+ CHANGE[Change Detection<br/>Test mods, large deletions]
389
+ GRAPH[Dependency Graph<br/>Multi-stage fixes]
390
+ end
391
+
392
+ subgraph "Sandbox Layer (Optional)"
393
+ DOCKER[Docker Builder<br/>Generate Dockerfile]
394
+ SERVICES[Service Manager<br/>postgres, redis, mongodb]
395
+ CONTAINER[Container Runner<br/>Isolated test execution]
396
+ end
397
+
398
+ subgraph "Performance Layer (Optional)"
399
+ PERF[Performance Tracker<br/>Build time, bundle size]
400
+ COMPARE[Regression Detector<br/>Compare baseline vs current]
401
+ end
402
+
403
+ subgraph "Output"
404
+ COMMIT[Git Commit<br/>Staged changes]
405
+ PR[PR Body Generator<br/>Summary + token usage]
406
+ end
407
+
408
+ CLI --> DETECT
409
+ DETECT --> OUTDATED
410
+ OUTDATED --> GIT
411
+ GIT --> BASELINE
412
+ BASELINE --> INSTALL
413
+ INSTALL --> CHECK
414
+ CHECK -->|Fails| AGENT
415
+ CHECK -->|Passes| STATIC
416
+
417
+ AGENT --> TOOLS
418
+ AGENT --> CHANGELOG
419
+ TOOLS --> CHECK
420
+
421
+ STATIC --> CHANGE
422
+ CHANGE --> GRAPH
423
+ GRAPH --> DOCKER
424
+
425
+ DOCKER --> SERVICES
426
+ SERVICES --> CONTAINER
427
+ CONTAINER --> PERF
428
+
429
+ PERF --> COMPARE
430
+ COMPARE --> COMMIT
431
+ COMMIT --> PR
432
+
433
+ style CLI fill:#a8e6cf
434
+ style AGENT fill:#ffd3b6
435
+ style DOCKER fill:#aad3ea
436
+ style PR fill:#ffaaa5
437
+ ```
107
438
 
108
- ## Ecosystems
439
+ ### Component Breakdown
440
+
441
+ | Layer | Components | Purpose |
442
+ |-------|-----------|---------|
443
+ | **Detection** | Ecosystem Detector, Dependency Scanner | Auto-detect package manager and find outdated deps |
444
+ | **Isolation** | Git Branch Manager, Baseline Runner | Isolate work on feature branch, verify starting state |
445
+ | **Upgrade** | Package Manager, Verification Runner | Install new version and run checks |
446
+ | **AI Fix** | LLM Agent, Tools, Changelog Fetcher | Automatically fix breaking changes with AI |
447
+ | **Verification** | Static Analysis, Change Detection, Dependency Graph | Multi-layer validation (types, lints, suspicious changes) |
448
+ | **Sandbox** | Docker Builder, Service Manager, Container Runner | Optional isolated testing with database services |
449
+ | **Performance** | Performance Tracker, Regression Detector | Optional performance monitoring and regression alerts |
450
+ | **Output** | Git Commit, PR Body Generator | Commit changes and generate PR description |
451
+
452
+ ### Data Flow
453
+
454
+ ```mermaid
455
+ sequenceDiagram
456
+ participant User
457
+ participant CLI
458
+ participant Detector
459
+ participant Git
460
+ participant PackageMgr as Package Manager
461
+ participant Agent as AI Agent
462
+ participant Verifier
463
+ participant Docker
464
+ participant Output
465
+
466
+ User->>CLI: npx greenbump react
467
+ CLI->>Detector: Detect ecosystem
468
+ Detector-->>CLI: npm detected
469
+ CLI->>Detector: Find outdated packages
470
+ Detector-->>CLI: react 18.3.1 β†’ 19.2.0
471
+
472
+ CLI->>Git: Create branch
473
+ Git-->>CLI: greenbump/react-19.2.0
474
+
475
+ CLI->>PackageMgr: Run baseline tests
476
+ PackageMgr-->>CLI: βœ“ Baseline passed
477
+
478
+ CLI->>PackageMgr: Install react@19.2.0
479
+ PackageMgr-->>CLI: βœ“ Installed
480
+
481
+ CLI->>PackageMgr: Run tests
482
+ PackageMgr-->>CLI: βœ— Tests failed
483
+
484
+ CLI->>Agent: Fix breaking changes
485
+ loop Fix Loop
486
+ Agent->>Agent: Read error output
487
+ Agent->>Agent: Fetch changelog
488
+ Agent->>Agent: Edit source files
489
+ Agent->>PackageMgr: Re-run tests
490
+ PackageMgr-->>Agent: Test result
491
+ end
492
+ Agent-->>CLI: βœ“ Fixed
493
+
494
+ CLI->>Verifier: Run verification
495
+ Verifier->>Verifier: TypeScript check
496
+ Verifier->>Verifier: ESLint
497
+ Verifier->>Verifier: Change detection
498
+ Verifier-->>CLI: βœ“ Verified
499
+
500
+ alt Sandbox Mode
501
+ CLI->>Docker: Build container
502
+ Docker->>Docker: Start services (postgres)
503
+ Docker->>Docker: Run tests in container
504
+ Docker-->>CLI: βœ“ Container tests passed
505
+ end
506
+
507
+ CLI->>Output: Commit changes
508
+ Output->>Output: Generate PR body
509
+ Output-->>User: βœ“ Done: branch ready for PR
510
+ ```
109
511
 
110
- greenbump auto-detects the ecosystem from your project's lockfile/manifest. Run `greenbump --list-ecosystems` for the current list.
512
+ ---
513
+
514
+ ## 🎭 How It Works
515
+
516
+ ```mermaid
517
+ graph TD
518
+ A[Detect outdated deps] --> B[Create git branch]
519
+ B --> C[Baseline: Run build + tests]
520
+ C --> D{Already broken?}
521
+ D -->|Yes| E[Stop - Fix manually first]
522
+ D -->|No| F[Upgrade dependency]
523
+ F --> G{Build/tests pass?}
524
+ G -->|Yes| H[Clean upgrade βœ…]
525
+ G -->|No| I[AI Fix Loop]
526
+ I --> J[Read error output]
527
+ J --> K[Edit source code]
528
+ K --> L[Re-run checks]
529
+ L --> M{Fixed?}
530
+ M -->|No| N{Max rounds?}
531
+ N -->|No| I
532
+ N -->|Yes| O[Flag for review ⚠️]
533
+ M -->|Yes| P[Verification Pipeline]
534
+ P --> Q[TypeScript type check]
535
+ Q --> R[ESLint]
536
+ R --> S[Change detection]
537
+ S --> T{Sandbox enabled?}
538
+ T -->|Yes| U[Docker container tests]
539
+ T -->|No| V{Detect regressions?}
540
+ U --> V
541
+ V -->|Yes| W[Performance comparison]
542
+ V -->|No| X[Commit & create PR]
543
+ W --> X
544
+ ```
545
+
546
+ ### Step-by-Step
547
+
548
+ 1. **πŸ” Detect** the ecosystem and outdated dependency (e.g. `npm outdated`, `poetry show -o`, `cargo outdated`)
549
+ 2. **🌿 Isolate** on a fresh `greenbump/<dep>-<version>` branch
550
+ 3. **πŸ“Š Baseline** β€” Run your build + tests. If already red, stop (never chase pre-existing failures)
551
+ 4. **⬆️ Upgrade** the dependency
552
+ 5. **πŸ€– Fix Loop** (if broken):
553
+ - AI agent reads failure output
554
+ - Edits source code to fix breaking changes
555
+ - Re-runs checks
556
+ - Repeats until green or max rounds hit
557
+ 6. **βœ… Verification Pipeline** (v0.3.0+):
558
+ - Run TypeScript type check (`tsc --noEmit`)
559
+ - Run ESLint
560
+ - Detect suspicious changes (test modifications, large deletions)
561
+ 7. **🐳 Sandbox Verification** (v0.5.0+, optional):
562
+ - Build Docker image with clean environment
563
+ - Start database services (if needed)
564
+ - Run tests in isolated container
565
+ 8. **πŸ“Š Performance Check** (v0.5.0+, optional):
566
+ - Compare build time, test time, bundle size
567
+ - Flag regressions (>20% slower build, >15% larger bundle)
568
+ 9. **πŸ’Ύ Commit** the changes and output PR body
569
+
570
+ ---
571
+
572
+ ## πŸ—οΈ Architecture
573
+
574
+ ```mermaid
575
+ flowchart LR
576
+ subgraph CLI["🌱 greenbump CLI"]
577
+ A1[Ecosystem Adapters]
578
+ A2[Fix-Loop Engine]
579
+ A3[Verification Pipeline]
580
+ A4[Git / PR Layer]
581
+ end
582
+
583
+ subgraph Adapters["🌍 20+ Ecosystems"]
584
+ E1[npm / yarn / pnpm]
585
+ E2[pip / poetry / uv]
586
+ E3[cargo]
587
+ E4[maven / gradle]
588
+ E5[...more]
589
+ end
590
+
591
+ subgraph Agent["πŸ€– AI Provider"]
592
+ M1[Anthropic]
593
+ M2[OpenAI]
594
+ M3[DeepSeek / Groq / custom]
595
+ end
596
+
597
+ subgraph Sandbox["🐳 Optional Sandbox"]
598
+ S1[Docker Container]
599
+ S2[Postgres / MySQL / Redis / Mongo]
600
+ end
601
+
602
+ A1 --- Adapters
603
+ A2 -- "tool calls" --> Agent
604
+ A3 -- "isolated run" --> Sandbox
605
+ A4 --> GH[GitHub / GitLab PR]
606
+
607
+ CLI --> Adapters
608
+ CLI --> Agent
609
+ CLI --> Sandbox
610
+ ```
111
611
 
112
- **"Verified" (self-reported, manually smoke-tested once by the maintainer, not CI-checked):** npm, Yarn, pnpm, pip, Poetry, uv, Pipenv, Cargo, Go modules, Bundler, Composer, Gradle, Maven, NuGet (.NET), Mix (Hex), Pub (Dart/Flutter), Swift Package Manager, CocoaPods, Conan (C/C++), Elm.
612
+ Each layer is independently swappable: pick any ecosystem adapter, any model provider, and
613
+ opt into the sandbox only when you need production-grade isolation.
113
614
 
114
- "Verified" here means the maintainer personally ran the detect β†’ outdated β†’ install β†’ build/test chain against a real project for that ecosystem at least once β€” it is **not** an automated guarantee, and CI does not re-run every real toolchain on every change (that would require installing 20 separate language runtimes and package managers). The `verified` field is self-reported per adapter in [`src/engine/ecosystems/types.ts`](src/engine/ecosystems/types.ts); parser logic for each ecosystem is unit-tested (see [`parsers.test.ts`](src/engine/ecosystems/parsers.test.ts)), but the underlying CLI tools themselves are not exercised in CI.
615
+ ---
115
616
 
116
- Please [report an issue](https://github.com/shidesheng0218/greenbump/issues) if one of these doesn't work as expected on your machine β€” real-world edge cases (unusual manifest styles, less common CLI flags) are the best signal for tightening these adapters further.
617
+ ## 🎬 GitHub Action
117
618
 
118
- ## GitHub Action
619
+ Automate dependency upgrades on a schedule and let greenbump open PRs for you.
119
620
 
120
- Let greenbump upgrade a dependency on a schedule and open the PR for you. Add `.github/workflows/greenbump.yml`:
621
+ ### Basic Setup
622
+
623
+ Add `.github/workflows/greenbump.yml`:
121
624
 
122
625
  ```yaml
123
626
  name: greenbump
124
627
  on:
125
628
  schedule:
126
- - cron: "0 6 * * 1" # Mondays
629
+ - cron: "0 6 * * 1" # Mondays at 6am
630
+ workflow_dispatch: # Manual trigger
631
+ permissions:
632
+ contents: write
633
+ pull-requests: write
634
+ jobs:
635
+ bump:
636
+ runs-on: ubuntu-latest
637
+ steps:
638
+ - uses: actions/checkout@v4
639
+ - uses: actions/setup-node@v4
640
+ with: { node-version: 20 }
641
+ - run: npm ci
642
+ - uses: shidesheng0218/greenbump@v0
643
+ with:
644
+ anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
645
+ ```
646
+
647
+ ### Advanced Setup (with Sandbox + Services)
648
+
649
+ ```yaml
650
+ name: greenbump-full-verification
651
+ on:
652
+ schedule:
653
+ - cron: "0 6 * * 1"
127
654
  workflow_dispatch:
128
655
  permissions:
129
656
  contents: write
@@ -139,27 +666,107 @@ jobs:
139
666
  - uses: shidesheng0218/greenbump@v0
140
667
  with:
141
668
  anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
669
+ sandbox: true
670
+ services: postgres,redis
671
+ detect-regressions: true
142
672
  ```
143
673
 
144
- Replace `shidesheng0218/greenbump` above with wherever you publish this repo. Add your key as the `ANTHROPIC_API_KEY` repo secret. greenbump opens a normal PR when build + tests are green, or a **draft** PR (flagged for review) when it couldn't fully fix the upgrade or the repo has nothing to verify against.
674
+ Add your API key as the `ANTHROPIC_API_KEY` repository secret:
675
+ 1. Go to **Settings** β†’ **Secrets and variables** β†’ **Actions**
676
+ 2. Click **New repository secret**
677
+ 3. Name: `ANTHROPIC_API_KEY`, Value: your key
678
+
679
+ > **πŸ’‘ Tip**: greenbump opens a **draft PR** (flagged for review) when it couldn't fully fix the upgrade or when verification warnings are detected.
680
+
681
+ > **⚠️ CI Triggers**: PRs opened with `GITHUB_TOKEN` don't trigger other workflows (GitHub safeguard). Pass a personal access token as `github-token:` if you need CI to run on greenbump's PRs.
682
+
683
+ Full example with all inputs: [examples/greenbump.yml](examples/greenbump.yml)
684
+
685
+ ---
686
+
687
+ ## 🎯 When to Use greenbump
688
+
689
+ ### βœ… Great For
690
+
691
+ - **Minor/patch upgrades** with small breaking changes (renamed exports, updated signatures)
692
+ - **Dependency chains** where upgrade path is documented in changelogs
693
+ - **Projects with fast, reliable test suites** that catch regressions
694
+ - **TypeScript projects** where type errors surface most breakage
695
+ - **Well-tested codebases** where "tests pass" means "it works"
696
+
697
+ ### ⚠️ Use Caution
698
+
699
+ - **Major version jumps** with architectural changes (e.g., React 15 β†’ 16, Angular 2 β†’ 3)
700
+ - **Coordinated multi-dep upgrades** (e.g., all Babel plugins at once)
701
+ - **Security patches** where you need to audit the fix, not just pass tests
702
+ - **Projects without tests** β€” greenbump can only verify what your suite checks
703
+
704
+ ### ❌ Not Recommended
705
+
706
+ - **Framework migrations** that break core assumptions (async/await refactors, build system changes)
707
+ - **Runtime-only failures** your tests don't cover
708
+ - **Flaky test suites** where "tests pass" is unreliable
709
+
710
+ > **πŸ’‘ Best Practice**: Use greenbump as a first pass on straightforward upgrades. Always review the PR diff before merging, especially for deps touching security, data handling, or critical paths. Use `--max-rounds` to cap token spend on hard upgrades, and `--scan` to preview what's outdated before committing.
711
+
712
+ ---
713
+
714
+ ## πŸ”’ Security & Privacy
715
+
716
+ - **Bring your own key**: You control costs, nothing phones home
717
+ - **No data collection**: greenbump runs entirely locally or in your CI
718
+ - **Code stays private**: Only sent to your chosen AI provider (Anthropic, OpenAI, etc.)
719
+ - **Safe git workflow**: Works on branches, never auto-merges, never edits your lockfile
720
+ - **Bounded execution**: `--max-rounds` and `--max-tokens` prevent runaway costs
721
+
722
+ ---
723
+
724
+ ## πŸ—ΊοΈ Roadmap
725
+
726
+ - [x] **v0.1.0**: Core fix loop + multi-ecosystem support
727
+ - [x] **v0.2.0**: Batch upgrades (`--all`), changelog integration
728
+ - [x] **v0.3.0**: Static analysis (TypeScript + ESLint) + change detection
729
+ - [x] **v0.4.0**: Multi-stage fix strategy + dependency graph analysis
730
+ - [x] **v0.5.0**: Docker sandbox + database testing + performance regression detection
731
+ - [ ] **v0.6.0**: Web UI for monitoring upgrades
732
+ - [ ] **v0.7.0**: Upgrade impact prediction (before running)
733
+ - [ ] **v0.8.0**: Custom verification scripts
734
+ - [ ] **v0.9.0**: Multi-repository orchestration
735
+ - [ ] **v1.0.0**: Production-ready release
736
+
737
+ ---
738
+
739
+ ## 🀝 Contributing
740
+
741
+ Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
742
+
743
+ **Areas we'd love help with:**
744
+ - 🌍 More ecosystem adapters (esp. less common package managers)
745
+ - πŸ§ͺ Integration tests for real-world upgrade scenarios
746
+ - πŸ“š Documentation improvements
747
+ - πŸ› Bug reports with reproducible examples
748
+
749
+ ---
750
+
751
+ ## πŸ“„ License
752
+
753
+ MIT Β© [shidesheng0218](https://github.com/shidesheng0218)
145
754
 
146
- > **Want CI to run on the PR?** PRs opened with the default `GITHUB_TOKEN` don't trigger other workflows (a GitHub safeguard against loops). Pass a personal access token as `github-token:` if you need your CI to fire on greenbump's PRs.
755
+ ---
147
756
 
148
- Full example with inputs: [examples/greenbump.yml](examples/greenbump.yml).
757
+ ## πŸ’¬ Support
149
758
 
150
- ## How it works
759
+ - πŸ› **Bug reports**: [GitHub Issues](https://github.com/shidesheng0218/greenbump/issues)
760
+ - πŸ’‘ **Feature requests**: [GitHub Discussions](https://github.com/shidesheng0218/greenbump/discussions)
761
+ - πŸ“– **Documentation**: [docs/](docs/)
762
+ - 🌟 **Star us**: If greenbump helps you, give us a ⭐ on GitHub!
151
763
 
152
- 1. **Detect** the ecosystem and the outdated dependency (e.g. `npm outdated`, `poetry show -o`, `cargo` vs. crates.io, …).
153
- 2. **Isolate** on a fresh `greenbump/<dep>-<version>` branch.
154
- 3. **Baseline** β€” run your build + tests. If they're already red, greenbump stops (so it never chases pre-existing failures).
155
- 4. **Upgrade** the dependency.
156
- 5. **Fix loop** β€” if the upgrade breaks anything, an AI agent reads the failure, edits the source, and re-runs your checks until they pass or the round cap is hit.
157
- 6. **Commit** the branch and hand you a PR body.
764
+ ---
158
765
 
159
- ## Status
766
+ <div align="center">
160
767
 
161
- Early MVP, one dependency at a time. Roadmap: batch upgrades, wider provider coverage, deeper per-ecosystem verification.
768
+ **Made with ❀️ by developers, for developers**
162
769
 
163
- ## License
770
+ [⬆ Back to Top](#-greenbump)
164
771
 
165
- MIT
772
+ </div>