feat(cli): sideshow --version with update check#154
Merged
Merged
Conversation
`sideshow --version`, `sideshow -V`, and `sideshow version` all print the current version and check the npm registry for a newer release. The check is best-effort: 3 s timeout, 24 h disk cache, failures silently swallowed. When a newer version exists the output shows the available update and the install command. Reuses the same registry lookup the server already does for the viewer update notice, but runs it directly from the CLI — no running server required.
Member
|
Good call |
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.
What
Adds
sideshow --version,sideshow -V, andsideshow version— all three behave identically: print the installed version and check the npm registry for a newer release.The update hint only appears when a newer version exists.
How the update check works
https://registry.npmjs.org/sideshow/latestdirectly — no running sideshow server required$TMPDIR/sideshow-<user>/update-check.json) so repeated calls don't hit the registryThis mirrors the pattern used by npm, gh, brew, and cargo. The server already does the same registry check for the viewer's update notice (with a 6 h in-memory cache); the CLI reuses the same registry endpoint but caches to disk since it's a short-lived process.
Tests
4 new tests in
test/cli.test.ts:--version,-V, andversionall print the versionversionruns end-to-end without errors (update check is best-effort)