fix(setup): register a stable launcher when run through bunx (#1731)

Setup run through bunx or bun x registered the bin inside bun's temporary
package cache. Detect bun's package-runner launch from npm_command=exec
with a bun user agent and register the pinned bunx launcher, wrapped in
cmd.exe on Windows like the npx launcher. Doctor, update maintenance and
uninstall recognize it as REA-owned, and setup's printed commands name
the runner that launched it.

Read the runner variables case-insensitively on Windows, where the CLI
environment snapshot upper-cases variable names and setup run through
npx also fell back to the cache path.

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
xeropresence
2026-10-11 19:17:15 +08:00
committed by GitHub
co-authored by morluto
parent 3a17882cc4
commit d412def722
14 changed files with 317 additions and 98 deletions
+18 -4
View File
@@ -216,11 +216,20 @@ describe("interactive setup journey", () => {
describe("interactive setup completion", () => {
it.each([
{ npmCommand: "", launcher: "rea" },
{ npmCommand: "exec", launcher: "npx rea-agents" },
{ npmCommand: "", userAgent: "", launcher: "rea" },
{
npmCommand: "exec",
userAgent: "npm/10.9.0 node/v24.11.0 linux x64",
launcher: "npx rea-agents",
},
{
npmCommand: "exec",
userAgent: "bun/1.4.2 npm/? node/v26.3.0 linux x64",
launcher: "bunx rea-agents",
},
])(
"prints an available next command for $launcher invocation",
async ({ npmCommand, launcher }) => {
async ({ npmCommand, userAgent, launcher }) => {
const { stderr } = await execute(
process.execPath,
[
@@ -246,7 +255,12 @@ describe("interactive setup completion", () => {
],
{
cwd: process.cwd(),
env: { ...process.env, npm_command: npmCommand, NO_COLOR: "1" },
env: {
...process.env,
npm_command: npmCommand,
npm_config_user_agent: userAgent,
NO_COLOR: "1",
},
},
);