feat(update): update Bun global installations (#1735)

* feat(update): update Bun global installations

`rea update` only recognized npm global installations and looked up
releases with `npm view`, so a `bun add --global rea-agents` install on a
machine without npm failed with `spawn npm ENOENT`.

Detect the running package inside Bun's global directory
(BUN_INSTALL_GLOBAL_DIR, $BUN_INSTALL/install/global,
$XDG_CACHE_HOME/.bun/install/global, ~/.bun/install/global), resolve the
latest release with `bun info`, install with
`bun add --global --ignore-scripts`, then verify the installed entry point
and plan integration maintenance exactly as for npm.

Bun commands run inside the owning global directory with
BUN_INSTALL_GLOBAL_DIR pinned, so the caller's current project is never
selected. A global directory without package.json is not treated as an
owned installation: Bun then installs into the nearest ancestor project.
npm installations keep their existing commands and messages.

* fix(update): gate Bun self-updates on supported CLI versions

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
xeropresence
2026-10-11 17:56:05 +08:00
committed by GitHub
co-authored by morluto
parent e365f3715f
commit e4027e4afc
8 changed files with 492 additions and 51 deletions
+2 -1
View File
@@ -42,9 +42,10 @@ it("does not treat ordinary error-looking data or nested Evidence as command fai
describe("CLI command outcome classification", () => {
it("returns nonzero for the UpdateResult failure variant", async () => {
const installation = {
manager: "npm",
prefix: "/fixture",
packageRoot: "/fixture/lib/node_modules/rea-agents",
};
} as const;
const updateHost: UpdateHost = {
installation: () => Promise.resolve(installation),
latestVersion: () =>