fix(install): hand off Phantom install to phantom's own one-liner#2
Open
MasonStation wants to merge 1 commit intofix/install-auto-pathfrom
Open
fix(install): hand off Phantom install to phantom's own one-liner#2MasonStation wants to merge 1 commit intofix/install-auto-pathfrom
MasonStation wants to merge 1 commit intofix/install-auto-pathfrom
Conversation
The previous code shelled out to `bun add -g phantom-secrets` / `npm i -g phantom-secrets`. On a fresh Windows machine that path silently misbehaves in two ways: 1. PS5.1 + native-stderr-as-error: Stack invoked bun under `try/catch` with `EAP=Stop` and `*> $null`. In Windows PowerShell 5.1 that turns bun's normal "Resolving dependencies" stderr line into a `NativeCommandError` that throws — so even though bun exits 0 and installs the package, Stack reports failure. 2. Bun-on-Windows shim non-generation: even when bun *does* succeed, `~\.bun\bin` ends up containing only `bun.exe` — the `phantom` shim from phantom-secrets' `bin` field never lands. Net effect: `phantom` is not on PATH after a "successful" install. Switching to phantom's own curl/irm installer: - Downloads the signed GitHub release directly (no lazy npm wrapper) - Wires User PATH itself - Sidesteps both PS5.1 and bun-on-Windows quirks - Keeps Homebrew preference on macOS (it's still the canonical path there, and gives users `brew upgrade` for free) - Refreshes `$env:Path` from the registry after install so subsequent Stack steps see the new entries Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Stops asking bun/npm to install
phantom-secretsand calls phantom's ownhttps://phm.dev/install.{sh,ps1}one-liner instead.Why
Two real bugs in the bun/npm path on Windows, found by reproducing a fresh-machine install:
1. PS5.1 native-stderr-as-error. Stack was running:
inside a
try/catchwith$ErrorActionPreference = 'Stop'. In Windows PowerShell 5.1, redirecting a native command's stderr (*>) wraps each stderr line in aNativeCommandErrorErrorRecord, which trips the catch even on exit code 0. Result: bun succeeds, installs the package, but Stack reportsphantom-secrets install failed -- continuing; install manually later. (Resolving dependencies). The "Resolving dependencies" was bun's normal progress output.2. Bun-on-Windows shim non-generation. Even when
bun add -g phantom-secretssucceeds (verified by running it directly),~\.bun\bincontains onlybun.exe— thephantomshim from phantom-secrets'binfield never gets materialized. Sophantomisn't on PATH and Stack's next-runTest-CommandExists 'phantom'keeps failing.Net effect of the bun path on Windows: user installs Stack → Stack thinks Phantom failed → even if it didn't, Phantom isn't actually callable.
Fix
install.ps1:bun add -g phantom-secrets/npm i -g phantom-secretsblock withirm https://phm.dev/install.ps1 | iex(piped through a childpowershell.exeso phantom'sEAP=Stopdoesn't pollute Stack's outer scope)$env:Pathfrom User+Machine registry so subsequent steps in this same shell can see the new entriesinstall.sh:brew upgradefor free)curl -fsSL https://phm.dev/install.sh | bashinstead ofbun add -g/npm i -g~/.phantom-secrets/bininto the current shell's PATH so the rest of the script can reachphantompackages/site/public/install.{sh,ps1}synced toscripts/.Stacked on
This PR is stacked on #1 (install-auto-path). Please merge that one first; this rebases trivially.
Test plan
irm https://stack.ashlr.ai/install.ps1 | iex→ confirm phantom install reports success in stack output andphantom --versionworks in a new shellbrew install phantompath still preferredphantomis already present: confirm "phantom already installed" branch hitsOut of scope (worth filing separately)
An Application Control policy has blocked this file. Not signing-related (v0.5.0 in the same machine's Temp also runs unsigned). Likely Smart App Control reputation, but warrants investigation in phantom-secrets.🤖 Generated with Claude Code