fix(cli): correct update-check version comparison + support --version#1264
Merged
Merged
Conversation
`fsh info` and `fsh new`'s update check compared versions with string inequality, and the current version carries a `+gitsha` build-metadata suffix, so they always reported "update available" -- even when the local build was NEWER than the latest published prerelease (10.0.0 vs 10.0.0-rc.2, and template 10.0.0 vs 2.0.4-rc). Added a small semver-aware VersionComparer.IsNewer (drops build metadata, ranks a stable release above a prerelease of the same core) and used it in both places, so the hint only shows for a genuine upgrade. Also wired config.SetApplicationVersion so `fsh --version` prints the version instead of erroring "Did you forget the command?". Found while smoke-testing the CLI for release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Found while smoke-testing the CLI ahead of release.
Bug 1 — phantom "update available".
fsh infoand the post-scaffold update check infsh newcompared versions with string inequality. Since the running version carries a+gitshasuffix (and "latest" from NuGet can be a prerelease), they always nagged "update available" — even when the local build was newer than what's published (10.0.0vs10.0.0-rc.2; template10.0.0vs2.0.4-rc). AddedVersionComparer.IsNewer(semver-aware: ignores build metadata, ranks stable above prerelease of the same core version) and used it in both spots.Bug 2 —
fsh --versionerrored. It printed "Did you forget the command?". Wiredconfig.SetApplicationVersion(...)sofsh --version→10.0.0.Verified:
fsh --version→10.0.0;fsh infonow shows "up to date" for CLI + template.🤖 Generated with Claude Code