Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 104 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,117 @@
# bun-react-template
# BVM — Bun Version Manager

To install dependencies:
<div align="center">
<a href="https://bvm-core.pages.dev">
<img src="https://bvm-core.pages.dev/logo.svg" alt="BVM Logo" width="180" height="180" />
</a>

<h3 align="center">The Native, Zero-Dependency Version Manager for Bun</h3>

<p align="center">
<a href="https://bvm-core.pages.dev"><strong>Official Website & Documentation »</strong></a>
<br />
<br />
<a href="./README.zh-CN.md">🇨🇳 中文文档</a>
·
<a href="https://github.com/EricLLLLLL/bvm/issues">Report Bug</a>
·
<a href="https://github.com/EricLLLLLL/bvm/discussions">Request Feature</a>
</p>

<p align="center">
<a href="https://github.com/EricLLLLLL/bvm/releases">
<img src="https://img.shields.io/github/v/release/EricLLLLLL/bvm?color=f472b6&label=latest" alt="Release" />
</a>
<a href="https://github.com/EricLLLLLL/bvm/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/EricLLLLLL/bvm?color=orange" alt="License" />
</a>
<a href="#">
<img src="https://img.shields.io/badge/platform-win%20%7C%20mac%20%7C%20linux-blue" alt="Platform" />
</a>
</p>
</div>

---

## ⚡ Quick Install

BVM uses a smart installation script that automatically detects your OS and network environment (selecting the fastest registry for China/Global users).

### Method 1: Shell Script (Recommended - macOS / Linux)
```bash
bun install
curl -fsSL https://bvm-core.pages.dev/install | bash
```

To start a development server:
### Method 2: PowerShell (Recommended - Windows)
```powershell
irm https://bvm-core.pages.dev/install | iex
```

### Method 3: NPM (Optional)
```bash
bun dev
npm install -g bvm-core@latest
```

To run for production:
---

## Key Features

- **🚀 Zero Latency**: Shim-based design ensures ~0ms shell startup overhead.
- **🛡️ Bunker Architecture**: BVM manages its own isolated Bun runtime, ensuring stability even if your system Bun is broken or missing.
- **🛡️ Atomic Isolation**: Each Bun version has its own global package directory. No more conflicts.
- **🌏 Smart Mirroring**: Automatically detects your region and picks the fastest registry (npmmirror/npmjs).
- **📦 Zero Dependency**: BVM bootstraps itself. No pre-requisites required (it can reuse your system Bun or download its own).

---

## Usage

### Basic Commands

* `bvm install latest`: Install the latest stable version of Bun.
* `bvm install 1.1.0`: Install a specific version.
* `bvm use 1.1.0`: Switch the active Bun version immediately.
* `bvm default 1.1.0`: Set a global default version for new shell sessions.
* `bvm ls`: List all locally installed versions.
* `bvm ls-remote`: List all available versions from the registry.
* `bvm uninstall 1.1.0`: Remove a specific version.
* `bvm upgrade`: Upgrade BVM itself to the latest version.

### Running Commands

You can run a command with a specific Bun version without switching your global environment:
```bash
bun start
bvm run 1.0.30 index.ts
```

This project was created using `bun init` in bun v1.3.6. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
### Aliases

Create custom names for specific versions:
```bash
bvm alias prod 1.1.0
bvm use prod
```

### Configuration (.bvmrc)

BVM supports automatic version switching via `.bvmrc` files. Create a file named `.bvmrc` in your project root:

```bash
echo "1.1.0" > .bvmrc
```

---

## Design Philosophy

### ArchSense (Self-Bootstrapping)
BVM does not ship with heavy pre-compiled binaries. Instead, it uses **Bun to manage Bun**. The installer downloads a minimal Bun runtime to serve as BVM's execution engine, ensuring the manager itself is always running on the most optimized environment.

### Atomic Isolation
Unlike managers that only switch the `PATH`, BVM performs **Filesystem-level Locking**. It dynamically injects a unique `BUN_INSTALL` path for every version, ensuring that global packages installed in one version never conflict with another.

---

## License

MIT © [EricLLLLLL](https://github.com/EricLLLLLL)
42 changes: 27 additions & 15 deletions my-skills/bvm-architect/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,33 @@ Configuration blocks in Shell profiles MUST use standardized markers:
* **The Emulation Trap**: `uname -m` or `process.arch` can return `x64` on Apple Silicon if running under Rosetta 2.
* **Standard**: Always use `sysctl -in hw.optional.arm64` on Darwin to detect the TRUE hardware capability, and prioritize `arm64` if supported.

## 5. Version Management & Stability Strategy

* **Rule 1: Protected Main**: Direct pushes to `main` are FORBIDDEN. Use feature branches.
* **Rule 2: Mandatory PRs**: Every change MUST go through a GitHub Pull Request.
* **Rule 3: Automated Gate**: No PR shall be merged unless `PR Quality Gate` passes.
* **Rule 4: Merge-to-Release**: Merging a PR that bumps the version in `package.json` into `main` AUTOMATICALLY triggers the full production release (Tag, NPM, GitHub Release).

## 6. Standard Workflow (The "Golden Path")

1. **Branch**: Create a new branch (`feat/` or `fix/`).
2. **Develop**: Change code.
3. **Prepare**: Run `npx bun run release` on the feature branch. This handles version bumping, script syncing, and documentation updates.
4. **Verify**: Run `npx bun run check-integrity` and `npx bun run test:e2e:npm`.
5. **PR**: Push the branch and open a PR.
6. **Merge**: Once CI passes, merge the PR via GitHub UI. The system will handle the rest!
## 5. BVM Release Lifecycle Protocol

The project follows a strict **"Merge-to-Release"** automated pipeline. The `main` branch is protected and serves as the source of truth for production.

* **P1: Protected Main**: NEVER push directly to `main`. No exceptions.
* **P2: Feature Isolation**: All work starts on a `feat/` or `fix/` branch.
* **P3: Pre-flight Checks**: Before opening a PR, the developer MUST run `npx bun run release`. This local gate performs:
* Integrity checks (via `check-integrity.ts`).
* Version bumping & installation script syncing.
* Documentation & Website synchronization.
* **P4: Automated PR Gate**: Every PR triggers the `PR Quality Gate` CI. Merging is blocked until:
* Unit tests pass.
* Full E2E NPM simulation (`test:e2e:npm`) passes.
* **P5: Atomic Release**: Merging a version-bumping PR into `main` AUTOMATICALLY triggers:
* Git Tagging (`v*`).
* NPM Publication.
* GitHub Release creation with assets.
* CDN cache purging.

## 6. Standard Developer Workflow

1. **Branch**: `git checkout -b feat/your-feature`
2. **Develop**: Implement changes and local tests.
3. **Local Release Prep**: `npx bun run release`. Select version type (patch/minor/major).
4. **Submit**: `git push origin feat/your-feature` and open GitHub PR.
5. **Audit**: Ensure CI passes on PR.
6. **Deploy**: Click **Merge** on GitHub. The CD pipeline handles the production rollout.

## Reference Navigation

Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"publishConfig": {
"access": "public"
},
"homepage": "https://bvm-core.pages.dev",
"bugs": {
"url": "https://github.com/EricLLLLLL/bvm/issues"
},
"scripts": {
"dev": "bun run src/index.ts",
"build": "bun build src/index.ts --target=bun --outfile dist/index.js --minify && bun run scripts/sync-runtime.ts",
Expand Down
Loading