fix(cli): use the public npm registry for the self-update check#1395
fix(cli): use the public npm registry for the self-update check#1395John-David Dalton (jdalton) wants to merge 1 commit into
Conversation
5160d31 to
a22ce42
Compare
f7d8aa9 to
4abfd52
Compare
The self-update check now always uses the public npm registry instead of resolving it from the local npm config, so it behaves the same regardless of the directory the CLI runs in. - Extract it into runSelfUpdateCheck() with a unit test covering the pinned registry. - Drop the now-unused registry-url / registry-auth-token dependencies.
4abfd52 to
44bec12
Compare
|
CodeRabbit (@coderabbitai) review this PR |
|
✅ Action performedReview finished.
|
The changes look good. Here's a summary of the review:
CI is green. LGTM ✅ |
|
Cursor (@cursor) review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 44bec12. Configure here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe self-update check previously inlined in the CLI entry point was extracted into a new ChangesSelf-update Extraction
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant CLI as src/cli.mts
participant SelfUpdate as runSelfUpdateCheck
participant Updater as tiny-updater
participant Registry as npm Registry
CLI->>SelfUpdate: await runSelfUpdateCheck()
SelfUpdate->>Updater: check(pkgName, options, registry URL)
Updater->>Registry: query latest version
Registry-->>Updater: version info
Updater-->>SelfUpdate: update available?
alt update found
SelfUpdate->>SelfUpdate: log version + changelog link
end
SelfUpdate-->>CLI: return
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The self-update check now always uses the public npm registry instead of resolving it from the local npm config, so it behaves the same regardless of the directory the CLI runs in.
runSelfUpdateCheck()with a unit test covering the pinned registry.registry-url/registry-auth-tokendependencies.Note
Low Risk
Small startup-path refactor with a pinned public registry URL; behavior change is intentional and covered by a unit test.
Overview
The CLI self-update notice no longer derives the registry URL or auth from the user’s npm config (cwd-sensitive). It always queries
https://registry.npmjs.org/via a newrunSelfUpdateCheck()helper, so update availability is consistent everywhere the binary runs.src/cli.mtsdelegates startup to that helper instead of inliningregistry-url,registry-auth-token, andtiny-updatersetup.registry-urlandregistry-auth-tokenare removed frompackage.json/ lockfile. A unit test asserts the pinned registry and thatauthInfois not passed.Reviewed by Cursor Bugbot for commit 44bec12. Configure here.