@rainy-updates/cli 0.5.7 → 0.6.1

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 (105) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +90 -31
  3. package/dist/bin/cli.js +11 -126
  4. package/dist/bin/dispatch.js +35 -32
  5. package/dist/bin/help.js +79 -2
  6. package/dist/bin/main.d.ts +1 -0
  7. package/dist/bin/main.js +126 -0
  8. package/dist/cache/cache.js +13 -11
  9. package/dist/commands/audit/parser.js +38 -2
  10. package/dist/commands/audit/runner.js +41 -61
  11. package/dist/commands/audit/targets.js +13 -13
  12. package/dist/commands/bisect/oracle.js +31 -11
  13. package/dist/commands/bisect/parser.js +3 -3
  14. package/dist/commands/bisect/runner.js +16 -8
  15. package/dist/commands/changelog/fetcher.js +11 -5
  16. package/dist/commands/dashboard/parser.js +144 -1
  17. package/dist/commands/dashboard/runner.d.ts +2 -2
  18. package/dist/commands/dashboard/runner.js +67 -37
  19. package/dist/commands/doctor/parser.js +53 -4
  20. package/dist/commands/doctor/runner.js +2 -2
  21. package/dist/commands/ga/parser.js +43 -4
  22. package/dist/commands/ga/runner.js +22 -13
  23. package/dist/commands/health/parser.js +38 -2
  24. package/dist/commands/health/runner.js +5 -1
  25. package/dist/commands/hook/parser.d.ts +2 -0
  26. package/dist/commands/hook/parser.js +40 -0
  27. package/dist/commands/hook/runner.d.ts +2 -0
  28. package/dist/commands/hook/runner.js +174 -0
  29. package/dist/commands/licenses/parser.js +39 -0
  30. package/dist/commands/licenses/runner.js +9 -5
  31. package/dist/commands/resolve/graph/builder.js +5 -1
  32. package/dist/commands/resolve/parser.js +39 -0
  33. package/dist/commands/resolve/runner.js +14 -4
  34. package/dist/commands/review/parser.js +101 -4
  35. package/dist/commands/review/runner.js +31 -5
  36. package/dist/commands/snapshot/parser.js +39 -0
  37. package/dist/commands/snapshot/runner.js +21 -18
  38. package/dist/commands/snapshot/store.d.ts +0 -12
  39. package/dist/commands/snapshot/store.js +26 -38
  40. package/dist/commands/unused/parser.js +39 -0
  41. package/dist/commands/unused/runner.js +10 -8
  42. package/dist/commands/unused/scanner.d.ts +2 -1
  43. package/dist/commands/unused/scanner.js +65 -52
  44. package/dist/config/loader.d.ts +2 -2
  45. package/dist/config/loader.js +2 -5
  46. package/dist/config/policy.js +20 -11
  47. package/dist/core/analysis/run-silenced.js +0 -1
  48. package/dist/core/artifacts.js +6 -5
  49. package/dist/core/baseline.js +3 -5
  50. package/dist/core/check.js +7 -3
  51. package/dist/core/ci.js +52 -1
  52. package/dist/core/decision-plan.d.ts +14 -0
  53. package/dist/core/decision-plan.js +107 -0
  54. package/dist/core/doctor/result.js +8 -5
  55. package/dist/core/fix-pr-batch.js +38 -28
  56. package/dist/core/fix-pr.js +27 -24
  57. package/dist/core/init-ci.js +34 -28
  58. package/dist/core/options.d.ts +4 -1
  59. package/dist/core/options.js +152 -4
  60. package/dist/core/review-model.js +3 -0
  61. package/dist/core/summary.js +6 -0
  62. package/dist/core/upgrade.js +64 -2
  63. package/dist/core/verification.d.ts +2 -0
  64. package/dist/core/verification.js +108 -0
  65. package/dist/core/warm-cache.js +7 -3
  66. package/dist/generated/version.d.ts +1 -0
  67. package/dist/generated/version.js +2 -0
  68. package/dist/git/scope.d.ts +19 -0
  69. package/dist/git/scope.js +167 -0
  70. package/dist/index.d.ts +2 -1
  71. package/dist/index.js +1 -0
  72. package/dist/output/format.js +15 -0
  73. package/dist/output/github.js +6 -0
  74. package/dist/output/sarif.js +12 -18
  75. package/dist/parsers/package-json.js +2 -4
  76. package/dist/pm/detect.d.ts +40 -1
  77. package/dist/pm/detect.js +152 -9
  78. package/dist/pm/install.d.ts +3 -1
  79. package/dist/pm/install.js +18 -17
  80. package/dist/registry/npm.js +34 -76
  81. package/dist/rup +0 -0
  82. package/dist/types/index.d.ts +134 -5
  83. package/dist/ui/tui.d.ts +4 -1
  84. package/dist/ui/tui.js +156 -67
  85. package/dist/utils/io.js +5 -6
  86. package/dist/utils/lockfile.js +24 -19
  87. package/dist/utils/runtime-paths.d.ts +4 -0
  88. package/dist/utils/runtime-paths.js +35 -0
  89. package/dist/utils/runtime.d.ts +7 -0
  90. package/dist/utils/runtime.js +32 -0
  91. package/dist/workspace/discover.d.ts +7 -1
  92. package/dist/workspace/discover.js +67 -54
  93. package/package.json +24 -19
  94. package/dist/ui/dashboard/DashboardTUI.d.ts +0 -6
  95. package/dist/ui/dashboard/DashboardTUI.js +0 -34
  96. package/dist/ui/dashboard/components/DetailPanel.d.ts +0 -4
  97. package/dist/ui/dashboard/components/DetailPanel.js +0 -30
  98. package/dist/ui/dashboard/components/Footer.d.ts +0 -4
  99. package/dist/ui/dashboard/components/Footer.js +0 -9
  100. package/dist/ui/dashboard/components/Header.d.ts +0 -4
  101. package/dist/ui/dashboard/components/Header.js +0 -12
  102. package/dist/ui/dashboard/components/Sidebar.d.ts +0 -4
  103. package/dist/ui/dashboard/components/Sidebar.js +0 -23
  104. package/dist/ui/dashboard/store.d.ts +0 -34
  105. package/dist/ui/dashboard/store.js +0 -148
package/CHANGELOG.md CHANGED
@@ -2,6 +2,140 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.6.1] - 2026-03-03
6
+
7
+ Compatibility, git-aware workspace scoping, and release-readiness stabilization for the `v0.6` line.
8
+
9
+ ### Added
10
+
11
+ - **First-class package-manager profile layer**:
12
+ - detection now prefers `package.json.packageManager` before falling back to lockfiles,
13
+ - additive package-manager metadata for lockfile source and Yarn flavor detection,
14
+ - centralized install, add, and test command construction for npm, pnpm, Bun, and Yarn.
15
+ - **Git-aware workspace scoping**:
16
+ - `--affected`,
17
+ - `--staged`,
18
+ - `--base <ref>`,
19
+ - `--head <ref>`,
20
+ - `--since <ref>`.
21
+ - **Workspace dependent expansion for affected scans**:
22
+ - changed packages can now expand to dependent workspace packages instead of stopping at direct file matches.
23
+ - **New `hook` command**:
24
+ - `rup hook install`,
25
+ - `rup hook uninstall`,
26
+ - `rup hook doctor`.
27
+ - **Rainy-managed git hooks**:
28
+ - `pre-commit` runs `rup unused --workspace --staged` and `rup resolve --workspace --staged`,
29
+ - `pre-push` runs `rup audit --workspace --affected --report summary`.
30
+ - **New test coverage** for:
31
+ - package-manager field precedence and Yarn Berry behavior,
32
+ - git-scoped workspace discovery,
33
+ - hook install/doctor/uninstall lifecycle,
34
+ - scoped standalone parser support.
35
+
36
+ ### Changed
37
+
38
+ - `init-ci` workflow generation now uses the centralized package-manager profile layer instead of special-casing npm/pnpm/Bun only.
39
+ - Yarn support is now explicit in generated workflows:
40
+ - Corepack enablement for Yarn/pnpm repos,
41
+ - Yarn Berry uses immutable installs,
42
+ - Yarn package adds no longer fall back to npm command construction.
43
+ - `verification`, `audit --fix`, and `bisect` now reuse the same package-manager command model as `upgrade`.
44
+ - `ga` package-manager reporting now includes detection source details and respects the git-scoped workspace discovery flow.
45
+ - `check`, `warm-cache`, `audit`, `unused`, `resolve`, `health`, `licenses`, `snapshot`, and `ga` now share the same git-aware workspace scoping path.
46
+ - Command help and parser support were aligned so git-scoping flags are consistently accepted across the primary and standalone command surfaces.
47
+
48
+ ### Tests
49
+
50
+ - Full release validation passed:
51
+ - `pnpm -s exec tsc --noEmit`
52
+ - `bun test`
53
+ - `pnpm run build`
54
+ - `bun run build:exe`
55
+ - `bun run test:prod`
56
+ - `bun ./dist/bin/cli.js ga --workspace`
57
+
58
+ ## [0.6.0] - 2026-03-01
59
+
60
+ Dashboard-first release candidate for the `v0.6` series, focused on unifying the interactive surface, introducing replayable decision plans, tightening CI/apply verification flows, and undergoing a complete native Bun performance optimization.
61
+
62
+ ### Added
63
+
64
+ - **Decision plan artifact flow**:
65
+ - new deterministic decision plan model for reviewed update sets,
66
+ - reusable `.artifacts/decision-plan.json` workflow,
67
+ - `upgrade --from-plan <path>` replay support,
68
+ - additive summary/output metadata for:
69
+ - `suggestedCommand`,
70
+ - `decisionPlan`,
71
+ - `interactiveSurface`,
72
+ - `queueFocus`.
73
+ - **Verification flow for applied plans and upgrades**:
74
+ - `--verify none|install|test|install,test`,
75
+ - `--test-command "<cmd>"`,
76
+ - `--verification-report-file <path>`,
77
+ - additive verification metadata in summary and GitHub/metrics outputs:
78
+ - `verificationState`,
79
+ - `verificationFailures`.
80
+ - **New CI gate model**:
81
+ - `ci --gate check|doctor|review|upgrade`,
82
+ - review gate emits a decision plan artifact without mutating manifests,
83
+ - upgrade gate replays a prior decision plan and can run verification.
84
+ - **New verification core** under `src/core/verification.ts`.
85
+ - **New decision plan core** under `src/core/decision-plan.ts`.
86
+ - **New test coverage** for:
87
+ - decision plan serialization and replay,
88
+ - CI upgrade gate plan replay,
89
+ - verification report generation.
90
+
91
+ - **Native Bun Optimizations**:
92
+ - Bun is now the primary Rainy runtime path for local execution, CI templates, and release verification flows.
93
+ - Added a shared Bun-first runtime layer for cwd/env/stdout/stderr/exit handling across the CLI command surface.
94
+ - Migrated verification and package-manager-aware test execution onto `Bun.spawn`, while keeping npm, pnpm, Bun, and yarn target-repo support intact.
95
+ - Migrated internal hot-path file operations onto `Bun.file()`, `Bun.write()`, `Bun.Glob`, and `Bun.CryptoHasher` across workspace discovery, lockfile hashing, snapshot persistence, audit target resolution, changelog cache reads, and CLI/package metadata loading.
96
+ - Added real atomic file writes for Rainy-managed artifacts, reports, caches, baselines, and snapshot restore paths.
97
+ - Added native `build:exe` target compilation for standalone Bun-first distributions using `bun build --compile`.
98
+
99
+ ### Changed
100
+
101
+ - `dashboard` is now the primary interactive dependency decision surface.
102
+ - `review --interactive` now routes into the shared dashboard flow instead of maintaining a separate interactive implementation path.
103
+ - `doctor` now recommends dashboard-first next steps:
104
+ - `rup dashboard --mode review`
105
+ - `rup dashboard --mode review --focus security`
106
+ - `rup dashboard --mode review --focus blocked`
107
+ - CLI help and README now document:
108
+ - `dashboard` as the primary interactive workflow,
109
+ - `upgrade --from-plan`,
110
+ - `ci --gate ...`,
111
+ - verification and verification-report flows,
112
+ - Bun as the preferred Rainy runtime via `bunx --bun` and compiled Bun artifacts.
113
+ - `init-ci` generated workflows now:
114
+ - use Bun as the Rainy runtime by default,
115
+ - use explicit CI gates,
116
+ - emit a decision plan artifact in strict and enterprise modes,
117
+ - replay approved plans with verification in enterprise mode,
118
+ - align install and test commands with detected npm, pnpm, or Bun target repos.
119
+ - Artifact manifests now include verification report output paths when configured.
120
+ - Package-manager detection and verification defaults now treat Bun as a first-class package ecosystem instead of falling back to npm/pnpm-only assumptions.
121
+ - GA readiness checks now validate both the JS dist CLI and the compiled Bun runtime artifact.
122
+
123
+ ### Removed
124
+
125
+ - Removed the legacy standalone dashboard Ink/store implementation under `src/ui/dashboard/` in favor of a single shared interactive path.
126
+ - Removed the remaining explicit `node:process` imports from the main CLI command surface in favor of the shared runtime layer.
127
+ - Removed manual recursive workspace directory walking in favor of Bun-native glob expansion.
128
+
129
+ ### Tests
130
+
131
+ - Added coverage for:
132
+ - `dashboard` parser support for mode/focus/plan/verification flags,
133
+ - additive GitHub output fields for decision-plan and verification metadata,
134
+ - updated CI bootstrap templates for review/upgrade gates,
135
+ - Bun-aware package-manager detection and verification defaults,
136
+ - GA runtime-artifact readiness checks,
137
+ - Bun-glob workspace discovery with hidden-directory and `node_modules` exclusions.
138
+
5
139
  ## [0.5.7] - 2026-03-01
6
140
 
7
141
  Final stabilization release for the `v0.5` series, focused on modularization, doctor scan quality, and maintainability.
package/README.md CHANGED
@@ -29,6 +29,7 @@ Rainy Updates gives teams one dependency lifecycle:
29
29
  - `check` detects candidate updates.
30
30
  - `doctor` summarizes the current situation.
31
31
  - `review` decides what should happen.
32
+ - `dashboard` is the primary interactive decision surface.
32
33
  - `upgrade` applies the approved change set.
33
34
 
34
35
  Everything else supports that lifecycle: CI orchestration, advisory lookup, peer resolution, licenses, snapshots, baselines, and fix-PR automation.
@@ -43,16 +44,16 @@ Everything else supports that lifecycle: CI orchestration, advisory lookup, peer
43
44
 
44
45
  ```bash
45
46
  # 1) Detect what changed
46
- npx @rainy-updates/cli check --workspace --show-impact
47
+ bunx --bun @rainy-updates/cli check --workspace --show-impact
47
48
 
48
49
  # 2) Summarize what matters
49
- npx @rainy-updates/cli doctor --workspace
50
+ bunx --bun @rainy-updates/cli doctor --workspace
50
51
 
51
- # 3) Decide in the review surface
52
- npx @rainy-updates/cli review --interactive
52
+ # 3) Decide in the dashboard
53
+ bunx --bun @rainy-updates/cli dashboard --mode review --plan-file .artifacts/decision-plan.json
53
54
 
54
- # 4) Apply the approved set
55
- npx @rainy-updates/cli upgrade --interactive
55
+ # 4) Apply the approved plan
56
+ bunx --bun @rainy-updates/cli upgrade --from-plan .artifacts/decision-plan.json
56
57
  ```
57
58
 
58
59
  ## Why teams use it
@@ -67,10 +68,15 @@ npx @rainy-updates/cli upgrade --interactive
67
68
  ## Install
68
69
 
69
70
  ```bash
71
+ # Preferred: run with Bun's runtime directly
72
+ bunx --bun @rainy-updates/cli check
73
+
70
74
  # As a project dev dependency (recommended for teams)
71
75
  npm install --save-dev @rainy-updates/cli
72
76
  # or
73
77
  pnpm add -D @rainy-updates/cli
78
+ # or
79
+ bun add -d @rainy-updates/cli
74
80
  ```
75
81
 
76
82
  Once installed, three binary aliases are available in your `node_modules/.bin/`:
@@ -88,16 +94,25 @@ rainy-up check
88
94
  rainy-updates check
89
95
  ```
90
96
 
91
- ### One-off usage with npx (no install required)
97
+ ### Bun-first runtime
92
98
 
93
99
  ```bash
94
- # Always works without installing:
100
+ # Preferred no-install path:
101
+ bunx --bun @rainy-updates/cli check
102
+ bunx --bun @rainy-updates/cli audit --severity high
103
+ bunx --bun @rainy-updates/cli ci --workspace --mode strict
104
+ ```
105
+
106
+ ### One-off usage with npx (compatibility path)
107
+
108
+ ```bash
109
+ # Compatibility path when Bun is not available:
95
110
  npx @rainy-updates/cli check
96
111
  npx @rainy-updates/cli audit --severity high
97
112
  npx @rainy-updates/cli ci --workspace --mode strict
98
113
  ```
99
114
 
100
- > **Note:** The short aliases (`rup`, `rainy-up`) only work after installing the package. For one-off `npx` runs, use `npx @rainy-updates/cli <command>`.
115
+ > **Note:** Rainy is Bun-first at runtime. `bunx --bun @rainy-updates/cli ...` is the fastest no-install path. The npm package and `npx` remain supported compatibility paths.
101
116
 
102
117
  ## Commands
103
118
 
@@ -106,6 +121,7 @@ npx @rainy-updates/cli ci --workspace --mode strict
106
121
  - `check` — detect candidate dependency updates
107
122
  - `doctor` — summarize the current dependency situation
108
123
  - `review` — decide what to do with security, risk, peer, and policy context
124
+ - `dashboard` — open the primary interactive decision console
109
125
  - `upgrade` — apply the approved change set
110
126
  - `ga` — audit GA and CI readiness for the current checkout
111
127
 
@@ -123,71 +139,108 @@ npx @rainy-updates/cli ci --workspace --mode strict
123
139
 
124
140
  ## Quick usage
125
141
 
126
- > Commands work with `npx` (no install) **or** with the `rup` / `rainy-up` shortcut if the package is installed.
142
+ > Commands work with `bunx --bun`, with `npx` as a compatibility path, or with the `rup` / `rainy-up` shortcut if the package is installed.
127
143
 
128
144
  ```bash
129
145
  # 1) Detect updates
146
+ bunx --bun @rainy-updates/cli check --format table
130
147
  npx @rainy-updates/cli check --format table
131
148
  rup check --format table # if installed
132
149
 
133
150
  # 2) Summarize the state
134
- npx @rainy-updates/cli doctor --workspace
151
+ bunx --bun @rainy-updates/cli doctor --workspace
135
152
  rup doctor --workspace
136
153
 
137
154
  # 3) Review and decide
138
- npx @rainy-updates/cli review --security-only
139
- rup review --interactive
155
+ bunx --bun @rainy-updates/cli review --security-only
156
+ rup dashboard --mode review --plan-file .artifacts/decision-plan.json
140
157
  rup review --show-changelog
141
158
 
142
- # 4) Apply upgrades with workspace sync
143
- npx @rainy-updates/cli upgrade --target latest --workspace --sync --install
144
- rup upgrade --target latest --workspace --sync --install
159
+ # 4) Apply an approved decision plan with verification
160
+ bunx --bun @rainy-updates/cli upgrade --from-plan .artifacts/decision-plan.json --verify install,test --test-command "bun test"
161
+ rup upgrade --from-plan .artifacts/decision-plan.json --verify install,test --test-command "npm test"
145
162
 
146
163
  # 5) CI orchestration with policy gates
147
- npx @rainy-updates/cli ci --workspace --mode strict --format github
148
- rup ci --workspace --mode strict --format github
164
+ bunx --bun @rainy-updates/cli ci --workspace --mode strict --gate review --plan-file .artifacts/decision-plan.json --format github
165
+ rup ci --workspace --mode strict --gate review --plan-file .artifacts/decision-plan.json --format github
166
+
167
+ # 6) Replay an approved plan in CI
168
+ rup ci --workspace --mode strict --gate upgrade --from-plan .artifacts/decision-plan.json --verify test --test-command "npm test"
149
169
 
150
- # 6) Batch fix branches by scope (enterprise)
170
+ # 7) Batch fix branches by scope (enterprise)
151
171
  npx @rainy-updates/cli ci --workspace --mode enterprise --group-by scope --fix-pr --fix-pr-batch-size 2
152
172
  rup ci --workspace --mode enterprise --group-by scope --fix-pr --fix-pr-batch-size 2
153
173
 
154
- # 7) Warm cache deterministic offline CI check
174
+ # 8) Warm cache -> deterministic offline CI check
155
175
  npx @rainy-updates/cli warm-cache --workspace --concurrency 32
156
176
  npx @rainy-updates/cli check --workspace --offline --ci
157
177
 
158
- # 8) Save and compare baseline drift
178
+ # 9) Save and compare baseline drift
159
179
  npx @rainy-updates/cli baseline --save --file .artifacts/deps-baseline.json --workspace
160
180
  npx @rainy-updates/cli baseline --check --file .artifacts/deps-baseline.json --workspace --ci
161
181
 
162
- # 9) Scan for known CVEs
182
+ # 10) Scan for known CVEs
163
183
  npx @rainy-updates/cli audit
164
184
  npx @rainy-updates/cli audit --severity high
165
185
  npx @rainy-updates/cli audit --summary
166
186
  npx @rainy-updates/cli audit --source osv
167
- npx @rainy-updates/cli audit --fix # prints the patching npm install command
187
+ npx @rainy-updates/cli audit --fix # prints the patching install command for the detected package manager
168
188
  rup audit --severity high # if installed
169
189
 
170
- `audit` prefers npm/pnpm lockfiles today for exact installed-version inference, and now also reads simple `bun.lock` workspace entries when available. It reports source-health warnings when OSV or GitHub returns only partial coverage.
190
+ `audit` resolves installed versions from lockfiles across npm, pnpm, and simple `bun.lock` workspace entries when available. It reports source-health warnings when OSV or GitHub returns only partial coverage.
171
191
 
172
- # 10) Check dependency maintenance health
192
+ # 11) Check dependency maintenance health
173
193
  npx @rainy-updates/cli health
174
194
  npx @rainy-updates/cli health --stale 6m # flag packages with no release in 6 months
175
195
  npx @rainy-updates/cli health --stale 180d # same but in days
176
196
  rup health --stale 6m # if installed
177
197
 
178
- # 11) Find which version introduced a breaking change
198
+ # 12) Find which version introduced a breaking change
179
199
  npx @rainy-updates/cli bisect axios --cmd "bun test"
180
200
  npx @rainy-updates/cli bisect react --range "18.0.0..19.0.0" --cmd "npm test"
181
201
  npx @rainy-updates/cli bisect lodash --cmd "npm run test:unit" --dry-run
182
202
  rup bisect axios --cmd "bun test" # if installed
183
203
 
184
- # 12) Focus review on high-risk changes
204
+ # 13) Focus review on high-risk changes
185
205
  rup review --risk high --diff major
186
206
 
187
- # 13) Audit GA / CI readiness
207
+ # 14) Audit GA / CI readiness
188
208
  rup ga --workspace
189
209
  ```
190
210
 
211
+ ## Decision Plans And Verification
212
+
213
+ Rainy can persist an approved update set as a deterministic decision plan and replay it later:
214
+
215
+ ```bash
216
+ # Create a reviewed plan
217
+ rup dashboard --mode review --plan-file .artifacts/decision-plan.json
218
+
219
+ # Apply only that approved plan later
220
+ rup upgrade --from-plan .artifacts/decision-plan.json
221
+
222
+ # Apply and verify install + tests
223
+ rup upgrade \
224
+ --from-plan .artifacts/decision-plan.json \
225
+ --verify install,test \
226
+ --test-command "bun test" \
227
+ --verification-report-file .artifacts/verification.json
228
+ ```
229
+
230
+ This is the intended local review -> CI replay workflow.
231
+
232
+ Verification follows the target repository's package manager when one is detected.
233
+ That means Bun repositories can verify with `bun install` / `bun test`, while npm and pnpm projects keep their native install/test flows.
234
+
235
+ ## CI Gates
236
+
237
+ `ci` supports explicit execution gates:
238
+
239
+ - `--gate check` runs detection only.
240
+ - `--gate doctor` computes the high-level verdict and doctor metadata.
241
+ - `--gate review` emits a decision plan artifact without mutating the repo.
242
+ - `--gate upgrade` replays an existing plan and can run verification.
243
+
191
244
  ## What it does in production
192
245
 
193
246
  ### Update detection engine
@@ -275,8 +328,8 @@ Generated file:
275
328
 
276
329
  Modes:
277
330
 
278
- - `strict`: warm-cache + offline check + artifacts + SARIF upload.
279
- - `enterprise`: strict checks + runtime matrix + retention policy + rollout gates.
331
+ - `strict`: warm-cache + review gate + artifacts + SARIF upload.
332
+ - `enterprise`: strict checks + runtime matrix + review/upgrade gates + retention policy.
280
333
  - `minimal`: fast check-only workflow for quick adoption.
281
334
 
282
335
  Schedule:
@@ -307,9 +360,15 @@ Schedule:
307
360
  - `--pr-limit <n>`
308
361
  - `--only-changed`
309
362
  - `--interactive`
363
+ - `--plan-file <path>`
364
+ - `--from-plan <path>`
365
+ - `--verify none|install|test|install,test`
366
+ - `--test-command <cmd>`
367
+ - `--verification-report-file <path>`
310
368
  - `--show-impact`
311
369
  - `--show-homepage`
312
370
  - `--mode minimal|strict|enterprise` (for `ci`)
371
+ - `--gate check|doctor|review|upgrade` (for `ci`)
313
372
  - `--fix-pr-batch-size <n>` (for batched fix branches in `ci`)
314
373
  - `--policy-file <path>`
315
374
  - `--format table|json|minimal|github`
@@ -328,7 +387,7 @@ Schedule:
328
387
  ### Upgrade-only
329
388
 
330
389
  - `--install`
331
- - `--pm auto|npm|pnpm`
390
+ - `--pm auto|bun|npm|pnpm|yarn`
332
391
  - `--sync`
333
392
 
334
393
  ### Review-only
package/dist/bin/cli.js CHANGED
@@ -1,134 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import { promises as fs } from "node:fs";
3
- import path from "node:path";
4
- import process from "node:process";
2
+ import { spawnSync } from "node:child_process";
5
3
  import { fileURLToPath } from "node:url";
6
- import { parseCliArgs } from "../core/options.js";
7
- import { applyFixPr } from "../core/fix-pr.js";
8
- import { applyFixPrBatches } from "../core/fix-pr-batch.js";
9
- import { createRunId, writeArtifactManifest } from "../core/artifacts.js";
10
- import { renderResult } from "../output/format.js";
11
- import { writeGitHubOutput } from "../output/github.js";
12
- import { createSarifReport } from "../output/sarif.js";
13
- import { renderPrReport } from "../output/pr-report.js";
14
- import { writeFileAtomic } from "../utils/io.js";
15
- import { resolveFailReason } from "../core/summary.js";
16
- import { stableStringify } from "../utils/stable-json.js";
17
- import { handleDirectCommand, runPrimaryCommand } from "./dispatch.js";
18
- import { renderHelp } from "./help.js";
4
+ import { runCli } from "./main.js";
19
5
  async function main() {
20
- try {
21
- const argv = process.argv.slice(2);
22
- if (argv.includes("--version") || argv.includes("-v")) {
23
- process.stdout.write((await readPackageVersion()) + "\n");
24
- return;
25
- }
26
- if (argv.includes("--help") || argv.includes("-h")) {
27
- process.stdout.write(renderHelp(argv[0]) + "\n");
28
- return;
29
- }
30
- const parsed = await parseCliArgs(argv);
31
- if (await handleDirectCommand(parsed))
32
- return;
33
- if (parsed.command !== "check" &&
34
- parsed.command !== "upgrade" &&
35
- parsed.command !== "warm-cache" &&
36
- parsed.command !== "ci") {
37
- throw new Error(`Unhandled command: ${parsed.command}`);
38
- }
39
- const result = await runPrimaryCommand(parsed);
40
- result.summary.runId = createRunId(parsed.command, parsed.options, result);
41
- if (parsed.options.fixPr &&
42
- (parsed.command === "check" ||
43
- parsed.command === "upgrade" ||
44
- parsed.command === "ci")) {
45
- result.summary.fixPrApplied = false;
46
- result.summary.fixBranchName =
47
- parsed.options.fixBranch ?? "chore/rainy-updates";
48
- result.summary.fixCommitSha = "";
49
- result.summary.fixPrBranchesCreated = 0;
50
- if (parsed.command === "ci") {
51
- const batched = await applyFixPrBatches(parsed.options, result);
52
- result.summary.fixPrApplied = batched.applied;
53
- result.summary.fixBranchName =
54
- batched.branches[0] ??
55
- parsed.options.fixBranch ??
56
- "chore/rainy-updates";
57
- result.summary.fixCommitSha = batched.commits[0] ?? "";
58
- result.summary.fixPrBranchesCreated = batched.branches.length;
59
- if (batched.branches.length > 1) {
60
- result.warnings.push(`Created ${batched.branches.length} fix-pr batch branches.`);
61
- }
62
- }
63
- else {
64
- const fixResult = await applyFixPr(parsed.options, result, []);
65
- result.summary.fixPrApplied = fixResult.applied;
66
- result.summary.fixBranchName = fixResult.branchName ?? "";
67
- result.summary.fixCommitSha = fixResult.commitSha ?? "";
68
- result.summary.fixPrBranchesCreated = fixResult.applied ? 1 : 0;
69
- }
70
- }
71
- if (parsed.options.prReportFile) {
72
- const markdown = renderPrReport(result);
73
- await writeFileAtomic(parsed.options.prReportFile, markdown + "\n");
74
- }
75
- const artifactManifest = await writeArtifactManifest(parsed.command, parsed.options, result);
76
- if (artifactManifest) {
77
- result.summary.artifactManifest = artifactManifest.artifactManifestPath;
78
- }
79
- result.summary.failReason = resolveFailReason(result.updates, result.errors, parsed.options.failOn, parsed.options.maxUpdates, parsed.options.ci);
80
- const renderStartedAt = Date.now();
81
- let rendered = renderResult(result, parsed.options.format, {
82
- showImpact: parsed.options.showImpact,
83
- showHomepage: parsed.options.showHomepage,
6
+ if (typeof Bun === "undefined") {
7
+ const currentFile = fileURLToPath(import.meta.url);
8
+ const result = spawnSync("bun", [currentFile, ...process.argv.slice(2)], {
9
+ stdio: "inherit",
84
10
  });
85
- result.summary.durationMs.render = Math.max(0, Date.now() - renderStartedAt);
86
- if (parsed.options.format === "json" ||
87
- parsed.options.format === "metrics") {
88
- rendered = renderResult(result, parsed.options.format, {
89
- showImpact: parsed.options.showImpact,
90
- showHomepage: parsed.options.showHomepage,
91
- });
92
- }
93
- if (parsed.options.onlyChanged &&
94
- result.updates.length === 0 &&
95
- result.errors.length === 0 &&
96
- result.warnings.length === 0 &&
97
- (parsed.options.format === "table" ||
98
- parsed.options.format === "minimal" ||
99
- parsed.options.format === "github")) {
100
- rendered = "";
11
+ if (result.error) {
12
+ process.stderr.write("rainy-updates (rup): Bun is required to run the published JavaScript entrypoint. Install Bun or use the compiled binary release.\n");
13
+ process.exit(1);
101
14
  }
102
- if (parsed.options.jsonFile) {
103
- await writeFileAtomic(parsed.options.jsonFile, stableStringify(result, 2) + "\n");
104
- }
105
- if (parsed.options.githubOutputFile) {
106
- await writeGitHubOutput(parsed.options.githubOutputFile, result);
107
- }
108
- if (parsed.options.sarifFile) {
109
- const sarif = createSarifReport(result);
110
- await writeFileAtomic(parsed.options.sarifFile, stableStringify(sarif, 2) + "\n");
111
- }
112
- process.stdout.write(rendered + "\n");
113
- process.exitCode = resolveExitCode(result, result.summary.failReason);
114
- }
115
- catch (error) {
116
- process.stderr.write(`rainy-updates (rup): ${String(error)}\n`);
117
- process.exitCode = 2;
15
+ process.exit(result.status ?? 1);
118
16
  }
17
+ await runCli();
119
18
  }
120
19
  void main();
121
- async function readPackageVersion() {
122
- const currentFile = fileURLToPath(import.meta.url);
123
- const packageJsonPath = path.resolve(path.dirname(currentFile), "../../package.json");
124
- const content = await fs.readFile(packageJsonPath, "utf8");
125
- const parsed = JSON.parse(content);
126
- return parsed.version ?? "0.0.0";
127
- }
128
- function resolveExitCode(result, failReason) {
129
- if (result.errors.length > 0)
130
- return 2;
131
- if (failReason !== "none")
132
- return 1;
133
- return 0;
134
- }