Warn when multiple lstk installs are detected on PATH#398
Merged
Conversation
skyrpex
marked this pull request as ready for review
July 21, 2026 13:31
anisaoshafi
approved these changes
Jul 22, 2026
anisaoshafi
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, thanks for handling this 🏅
There was an issue with the rendering in TUI (interactive mode) because it was missing some colors so it looked the same in non-interactive mode. I took the liberty to push a fix: 24400a2
| Before | After |
|---|---|
![]() |
![]() |
anisaoshafi
enabled auto-merge (squash)
July 22, 2026 14:13
Contributor
Author
|
Thank you for the attention to the detail and the proactiveness :) |
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.


Motivation
A previous Homebrew installation can shadow a fresh npm install:
npm installappears successful whilelstkstill resolves to the older binary. Detect this and tell the user.Changes
FindInstalls(internal/update/installs.go): scans every absolutePATHdirectory for lstk executables, resolves symlinks, and deduplicates real duplicates viaos.SameFile(symlink aliases like/usr/local/bin→ Caskroom, hardlinks, repeated PATH dirs count once). Results follow PATH order, so the first entry is what a shell executes.lstkfile with an execute bit (same test asexec.LookPath); Windows probesPATHEXTextensions (lstk.exefrom binary/scoop installs,lstk.cmdfrom npm shims) and ignores bare extensionless files, matching cmd.exe resolution.node_modulesroot).WarnMultipleInstallsemits a newMultipleInstallsEventwhen two or more distinct installs are found. Wired intolstk update(all modes) and the start-path update notification (NotifyUpdate), since a stale shadowing install is exactly what makes updates appear to not take effect.FormatEventLinefallback, and aMULTIPLE_INSTALLSwarning in the--jsonenvelope.Example output:
Tests
PATHEXTtests (also cross-compiled withGOOS=windows).--json.Closes DEVX-882