feat(installer): skip reinstall when already on the latest version - #32
Open
antonisobkowicz-asana wants to merge 2 commits into
Open
feat(installer): skip reinstall when already on the latest version#32antonisobkowicz-asana wants to merge 2 commits into
antonisobkowicz-asana wants to merge 2 commits into
Conversation
install.sh always ran a fresh npm global install on every invocation, even when the installed version already matched the latest release, and never told the user what version it was installing or already had. Read the version from the downloaded release archive's package.json and compare it against the installed package's package.json (when present); print both, and skip the npm install when they match.
CI failed on Linux with "tar (child): gzip: Cannot exec: No such file or directory". GNU tar shells out to a separate gzip binary for -z, unlike macOS's bsdtar which has zlib linked in directly, so this only reproduced on the Ubuntu CI runner, not locally. Reproduced locally with gtar (GNU tar via Homebrew) against a restricted PATH to confirm the root cause and the fix.
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.
Summary
install.shalways ran a freshnpm install --globalon every invocation, even when the installed version already matched the latest release, and never told the user what version it was installing or already had.package.json(viatar -xzOf) and, when a previous install exists, from the installed package'spackage.json; prints both (Installed version: X/Latest release version: Y), and skips thenpm installstep when they already match (Already up to date; skipping reinstall.). Client configuration (Claude Code/Codex/Cursor) and old-package cleanup still run as before regardless of whether the reinstall was skipped.tardependency check alongside the existing curl/wget, sha256sum/shasum, node, and npm checks.tests/installer.test.ts:createArchivenow builds a real minimal tarball with an embedded version (instead of an arbitrary content string), and the fakenpmstub now also lays down the installed package'spackage.json, mirroring real npm's global-install layout, so the version-comparison logic has real state to check against. Extends the main install/update test with a third run on an unchanged version to verify the skip path, and updates the other archive-content assertions to check the embedded version instead of raw file bytes.Test plan
sh -n install.shnpm run typechecknpm run lintnpm test(359 tests passing, including the extended installer suite covering fresh install, version-bump update, and up-to-date skip)npm run build