fix(install): guard link-mode conflicts#449
Open
fengjikui wants to merge 1 commit into
Open
Conversation
devinoldenburg
requested changes
Jul 8, 2026
devinoldenburg
left a comment
Owner
There was a problem hiding this comment.
Nice fix, this is definitely the right direction. One small thing before merging: prepareLinkDestination() uses existsSync(dest), which misses dangling symlinks because it follows the link. With a broken existing symlink, --link --force now skips cleanup and then fails with EEXIST when symlinkSync() runs. Could you switch that check to lstatSync() in a try/catch and treat only ENOENT as missing? A small regression test for a dangling symlink would be great too.
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
--linkinstalls unless--forceis provided.--dry-runso destructive link-mode conflicts are visible before install.plugins/goal-mode/directory and for the explicit--forcereplacement path.Why
opencode-goal-mode-install --linkremoved existing destinations before creating symlinks. If a user already had a realplugins/goal-mode/directory under their OpenCode config, the installer could delete those files without requiring--force. Copy installs already treat conflicts conservatively, so link installs should do the same.Validation
plugins/goal-mode/keep.txt: install exited 0 and removed the file.--linkexits 1 and preserveskeep.txtwithout--force.--link --forcereplaces the directory with a symlink.npm test(26 pass)npm run lint(passes; existing warnings only in unrelated files)git diff --check