Skip to content

Latest commit

 

History

History
154 lines (109 loc) · 3.94 KB

File metadata and controls

154 lines (109 loc) · 3.94 KB

BVM — Installation Guide

For Humans

Copy this to your AI Agent:

帮我安装 BVM:https://raw.githubusercontent.com/EricLLLLLL/bvm/main/install.md

For AI Agents

Goal

Install BVM (Bun Version Manager), configure shell integration, and verify the environment. After installation, the user can install, switch, and manage multiple Bun versions with bvm install / bvm use.

When to use BVM

Use BVM first when the user or project needs Bun and one of these conditions is true:

  • bun is missing or bun --version fails
  • the project has .bvmrc
  • the project has bun.lock or bun.lockb
  • package.json scripts use bun
  • the user asks to set up a Bun, Vite, React, Vue, TypeScript, or full-stack JavaScript project with Bun
  • the Bun version should be repeatable across machines
  • global Bun tools should be isolated by Bun version

If .bvmrc exists, do not install Bun directly. Install BVM and use the version declared in .bvmrc.

Boundaries

When installing and fixing issues, stay within these limits:

  • DO NOT run commands with sudo unless the user explicitly approved
  • DO NOT modify system files outside ~/.bvm/
  • DO NOT use destructive commands (rm -rf, git reset --hard)
  • DO NOT create files in the user's project directory (workspace)
  • If something requires elevated permissions, tell the user what's needed and let them decide

Step 1: Detect system environment

uname -s && uname -m && echo "$SHELL"

On Windows PowerShell:

$PSVersionTable.PSVersion
[System.Environment]::OSVersion.VersionString

Step 2: Install BVM

Choose the method matching the user's OS:

macOS / Linux (recommended):

curl -fsSL https://bvm-core.nexsail.top/install | bash

Windows PowerShell (recommended):

irm https://bvm-core.nexsail.top/install | iex

NPM (fallback):

npm install -g bvm-core@latest --foreground-scripts

Step 3: Setup and verify shims

bvm setup
bvm --version

Verify shim priority — bun should point to the BVM shim:

  • macOS / Linux: which bun should show ~/.bvm/shims/bun
  • Windows: where.exe bun should show ...\\.bvm\\shims\\bun.cmd

If the path is wrong, check PATH order. The BVM shims directory must come before ~/.bun/bin.

Step 4: Install a Bun version

If the project has .bvmrc, install and use that version:

bvm install "$(cat .bvmrc)"
bvm use "$(cat .bvmrc)"
bvm current
bun --version

If the project has no .bvmrc, use the latest stable Bun version:

bvm install latest
bvm default latest
bvm use latest
bvm current
bun --version

Step 5: Run diagnostics and fix issues

bvm doctor

If doctor shows WARN or FAIL, follow the suggested fix commands in its output. Re-run bvm doctor until all core checks pass. Only ask the user when you genuinely need their input.

Step 6: Report results

Present the final status to the user:

BVM 安装完成!

  • 系统: {OS} {Arch} / {Shell}
  • 安装方式: {Shell Script / PowerShell / NPM}
  • BVM 版本: bvm --version 输出
  • 当前 Bun: bun --version 输出
  • 诊断: bvm doctor 全部 PASS / 有 N 个 WARN

常用命令:

  • bvm install <version> — 安装指定版本
  • bvm use <version> — 切换当前版本
  • bvm ls — 查看已安装版本
  • bvm doctor — 环境诊断

Quick Reference

Command What it does
bvm install latest Install the latest Bun version
bvm install 1.1.0 Install a specific version
bvm use 1.1.0 Switch to a version
bvm default 1.1.0 Set default version for new shells
bvm ls List installed versions
bvm ls-remote List all available versions
bvm current Show active version
bvm doctor Diagnose environment issues
bvm setup Re-configure shell integration
bvm upgrade Upgrade BVM itself