fix(@inquirerer/utils): use semver for version comparison and add clearUpdateCache()#62
Merged
pyramation merged 1 commit intomainfrom Feb 13, 2026
Merged
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(@inquirerer/utils): use semver for version comparison and add clearUpdateCache()
Summary
Two fixes to the update-check module in
@inquirerer/utils:Semver comparison bug:
checkForUpdates()used JS string comparison (>) to determine if a newer version exists. This silently fails for multi-digit semver segments — e.g."3.10.0" > "3.9.0"isfalsein JS string comparison. Replaced withsemver.gt()via a newisNewerVersion()helper (falls back to string comparison for non-semver strings).New
clearUpdateCache(toolName)export: Consumers (e.g.pgpm update) need to invalidate the cached update-check result after a successful self-update, so subsequent commands don't re-prompt with a stale "update available" message. Previously there was no way to do this without knowing the internal cache path. This adds a clean public API for it.Also extracted
'update-check.json'into aCACHE_FILENAMEconstant so the filename isn't duplicated betweencheckForUpdatesandclearUpdateCache.Adds
semver(^7.7.4) as a new dependency.Review & Testing Checklist for Human
semveras a new dependency is acceptable — downstream consumers (pgpm,cnc) already depend onsemverdirectly, so no version conflict expected, but confirm no bundle size concernsisNewerVersion()fallback: when either version string isn't valid semver, it falls back to the old string comparison (latest !== current && latest > current). Decide if this is the right behavior or if it should just returnfalsefor invalid semverclearUpdateCache()orisNewerVersion()— consider whether test coverage is needed before mergesemver/@types/semveradditions — no packages should have been removedNotes
pgpmcan callclearUpdateCache('pgpm')after update and trusthasUpdatedirectly without a local semver workaround.