You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(doctor): derive install source and npm prefix from the binary itself
`CURL_INSTALLER_FOOTPRINTS` decided a binary was curl-installed by checking
whether some path existed under `$HOME`. That answers a question about the
machine, not about the binary PATH resolved to: with amp installed both ways
(curl at `~/.amp/bin`, npm-global on a user-configured prefix) the marker is
present either way, so a user-managed npm install could be labelled `CurlPipe`
and have its update nag silenced. Delete the heuristic and fix the *action* it
was standing in for.
- resolve.rs: drop `CurlInstallerFootprint`, `CURL_INSTALLER_FOOTPRINTS`,
`matches_curl_installer_footprint`, its early promotion in
`detect_install_source_inner`, and signal 1 of `fingerprint_curl_pipe`.
The fingerprint itself stays: signal 2 (a `~/.local/bin` entry symlinked into
a versioned install dir) is the sole positive classifier for cursor-agent's
and the native claude's layouts.
- resolve.rs: repair signal 2's home gate, which compared a canonicalized
symlink target against a non-canonicalized `$HOME` — any home reached through
a symlinked ancestor never matched, and the footprint was masking it.
- resolve.rs: add `npm_prefix_for_binary`, deriving `<prefix>` from the package
tree the bin entry canonicalizes into (`<prefix>/lib/node_modules/<pkg>/…`),
anchored on the first `lib`/`node_modules` pair so nested dependency trees
still yield the outer prefix.
- agents.rs/lib.rs: `derive_update_command` takes that prefix and emits
`npm install -g --prefix <P> <pkg>@latest` (shell-quoted — the command runs
under `sh -c`). npm installs into whichever prefix npm is *configured* with,
which is not always the one the resolved binary lives in; without this, an
install made with an explicit `--prefix`, or one under a node version the user
has since switched away from, gets "updated" by a second copy landing
elsewhere while the stale binary keeps resolving. Where the two agree the flag
is a no-op, and an underivable prefix falls back to the bare command. Main and
bridge readouts derive independently.
- Pi's `~/.local` installer fallback now classifies `Npm` — honestly, since the
installer runs `npm install -g --ignore-scripts --prefix ~/.local` — and
updates through the npm recipe. That makes the `CurlPipe`-gated
`self_update_command` path unreachable, so drop the field, its `pi update
--self` entry, and `agent_self_update_command`. `pi update --self` is not a
drop-in replacement in the general case: it errors out on a pnpm-managed
install ("not managed by a global npm install"), so gating on it per source
would reintroduce the same species of per-agent table.
- package_ids.rs: add Amp's npm main package `@ampcode/cli` (canonical;
`@sourcegraph/amp` is the renamed alias). Correct but inert behind a mirror
that filters young versions — Amp publishes continuously, so Block's
Artifactory serves both packages with no `latest` dist-tag; the comment says
so.
Live-verified through `run_checks_with_options` and
`execute_fix_streaming_with_env_options`: pi at `~/.local` classifies `Npm`,
gets `--prefix '/Users/…/.local'`, and upgrades 0.82.1 -> 0.83.0 in place with
no second install in any other prefix; pi at the configured prefix emits a
prefix equal to `npm prefix -g` (a no-op) and upgrades in place, main and
bridge (pi-acp 0.0.32 -> 0.0.33); a pi under a prefix that differs from the
configured one upgrades in place while the configured prefix stays untouched.
cursor-agent and the native claude still classify `CurlPipe`; curl-installed
amp still reports `Unknown` raw and `CurlPipe` via its per-agent override. All
with the Artifactory registry override appended.
Note for berd: `InstallSource` is a cross-repo wire contract and the `pnpm`/
`bun` variants added by e84c6df are still missing from berd's TS union and its
exhaustive `SOURCE_LABEL_KEYS`, so those installs render a broken "installed
via …" line. That remains outstanding and must land with the doctor rev bump.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
0 commit comments