Skip to content

feat(installer): skip reinstall when already on the latest version - #32

Open
antonisobkowicz-asana wants to merge 2 commits into
mainfrom
installer-version-check
Open

feat(installer): skip reinstall when already on the latest version#32
antonisobkowicz-asana wants to merge 2 commits into
mainfrom
installer-version-check

Conversation

@antonisobkowicz-asana

Copy link
Copy Markdown
Collaborator

Summary

  • install.sh always ran a fresh npm install --global 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.
  • Reads the version from the downloaded release archive's package.json (via tar -xzOf) and, when a previous install exists, from the installed package's package.json; prints both (Installed version: X / Latest release version: Y), and skips the npm install step 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.
  • Adds a tar dependency check alongside the existing curl/wget, sha256sum/shasum, node, and npm checks.
  • Updates tests/installer.test.ts: createArchive now builds a real minimal tarball with an embedded version (instead of an arbitrary content string), and the fake npm stub now also lays down the installed package's package.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.sh
  • npm run typecheck
  • npm run lint
  • npm test (359 tests passing, including the extended installer suite covering fresh install, version-bump update, and up-to-date skip)
  • npm run build

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant