Fix jumpcall install for Homebrew installs (bundle not found + destructive --from fallback) - #3
Merged
Merged
Conversation
…ete files we don't own `brew install joncode/tap/jumpcall && jumpcall install` — the README's recommended flow — failed with "could not locate a JumpCall.app bundle". The formula builds JumpCall.app into the Cellar and symlinks /opt/homebrew/bin/jumpcall into it, but sourceBundle() only checked Bundle.main.bundlePath, which reports the symlink's directory. Worse, the error suggested `--from <path>`, and --from accepted any path unvalidated. Passing the CLI binary itself copied a bare file to ~/Applications/JumpCall.app, then symlinkCLI() deleted the Homebrew symlink at /opt/homebrew/bin/jumpcall (the install source!) and replaced it with a dangling link — and the command still printed "JumpCall is running". - resolve symlinks on the executable (and on --from arguments) and walk up to the enclosing .app, requiring Contents/MacOS/jumpcall inside - reject invalid --from paths with a clear error instead of copying them - symlinkCLI only ever replaces symlinks, never regular files - report launchctl bootstrap failures instead of piping them to nowhere - only print the success line when `open` actually succeeded Co-Authored-By: Claude Fable 5 <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.
The bug
Reported by a user on a MacBook Pro (M2, macOS Tahoe 26.5.1) following the README's recommended flow:
The tap formula builds
JumpCall.appinto the Cellar (/opt/homebrew/Cellar/jumpcall/<v>/JumpCall.app) and symlinks/opt/homebrew/bin/jumpcall→.../Contents/MacOS/jumpcall. ButsourceBundle()only looked atBundle.main.bundlePath, which for a symlinked invocation is/opt/homebrew/bin— not an.app— so the documented Homebrew path could never work.The cascade
The error message then steered the user into something worse. They ran:
Four distinct bugs in that transcript:
--fromwas never validated. It accepted the CLI binary path and "installed" it as~/Applications/JumpCall.app— a bare file, not a bundle.symlinkCLI()deleted the install source. It blindlyremoveItems whatever sits at/opt/homebrew/bin/jumpcall— here, the Homebrew-managed symlink the user had just passed as--from— and replaced it with a dangling symlink into the broken "bundle". After this, both the Homebrew install and the CLI are broken.launchctl bootstrapfailure went to a discarded pipe.openhad just reported the app doesn't exist.The fix
sourceBundle()resolves symlinks on the real executable and walks up to the enclosing.app(same trickAppInfo.versionalready used), requiringContents/MacOS/jumpcallinside.brew install && jumpcall installnow just works.--from, so even the user's "wrong" command (--from /opt/homebrew/bin/jumpcall) now resolves through the symlink to the Cellar bundle and installs correctly. Genuinely invalid paths fail fast with a clear message instead of being copied.symlinkCLI()only ever replaces symlinks — a regular file at the target path is left alone with a note.launchctl bootstrapfailures are reported; the final success line only prints whenopenexits 0, otherwise the command fails with a pointer to try Finder.Covered by new
installBundleTests()in the framework-free test runner (fake Cellar layout with the bin symlink, bare-binary rejection, bundle-without-binary rejection).make test: 79 passed, 0 failed.Possible follow-ups (not in this PR)
bin.write_exec_scriptor the caveats could clarify that the app lives in the Cellar untiljumpcall installcopies it out./opt/homebrew/bin/jumpcallwith our own (current behavior when it is a symlink) survives until the nextbrew upgraderelinks it — consider leaving brew's link alone and preferring~/.local/binwhen the existing symlink isn't ours.--dry-runflag, and printing each step's target before acting, would make transcripts like the one above self-diagnosing.jumpcall statusalready explains;installcould end by pointing atjumpcall status.🤖 Generated with Claude Code