proto
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseproto - Pluggable Multi-Language Version Manager
proto - 可插拔式多语言版本管理器
proto is a next-generation version manager for multiple programming languages. It provides a unified interface for managing Node.js, npm, pnpm, yarn, Bun, Deno, Rust, Go, Python, and 800+ tools via plugins.
proto是一款面向多种编程语言的下一代版本管理器。它提供统一的界面,可通过插件管理Node.js、npm、pnpm、yarn、Bun、Deno、Rust、Go、Python以及800+种工具。
When to Use proto
适用场景
- Managing language/tool versions across projects
- Pinning versions in for team consistency
.prototools - Installing and running tools without global pollution
- Replacing nvm, pyenv, rustup, gvm with a single tool
- 跨项目管理语言/工具版本
- 在.prototools中固定版本,保证团队一致性
- 安装并运行工具,避免全局环境污染
- 用单个工具替代nvm、pyenv、rustup、gvm
Installation
安装
bash
undefinedbash
undefinedLinux, macOS, WSL
Linux、macOS、WSL
bash <(curl -fsSL https://moonrepo.dev/install/proto.sh)
bash <(curl -fsSL https://moonrepo.dev/install/proto.sh)
Specific version, non-interactive
指定版本,非交互式安装
bash <(curl -fsSL https://moonrepo.dev/install/proto.sh) 1.2.3 --yes
undefinedbash <(curl -fsSL https://moonrepo.dev/install/proto.sh) 1.2.3 --yes
undefinedShell Setup
Shell 配置
bash
undefinedbash
undefinedAdd to shell profile
添加到Shell配置文件
eval "$(proto activate bash)" # Bash
eval "$(proto activate zsh)" # Zsh
undefinedeval "$(proto activate bash)" # Bash
eval "$(proto activate zsh)" # Zsh
undefinedQuick Reference
快速参考
Core Commands
核心命令
bash
proto install <tool> # Install tool
proto install node 20.10.0 # Install specific version
proto install node --build # Build from source (v0.45+)
proto run <tool> # Run with detected version
proto exec node pnpm -- cmd # Bootstrap multi-tool env (v0.53+)
proto pin <tool> <version> # Pin version locally
proto pin <tool> --global # Pin globally
proto versions <tool> # List available versions
proto outdated # Check for updates
proto clean # Remove unused tools
proto upgrade # Upgrade proto itself
proto diagnose # Identify installation issues
proto debug config # List all .prototools files
proto debug env # Show environment infobash
proto install <tool> # 安装工具
proto install node 20.10.0 # 安装指定版本
proto install node --build # 从源码构建(v0.45+)
proto run <tool> # 使用检测到的版本运行工具
proto exec node pnpm -- cmd # 引导多工具环境(v0.53+)
proto pin <tool> <version> # 在本地固定版本
proto pin <tool> --global # 全局固定版本
proto versions <tool> # 列出可用版本
proto outdated # 检查更新
proto clean # 移除未使用的工具
proto upgrade # 升级proto本身
proto diagnose # 排查安装问题
proto debug config # 列出所有.prototools文件
proto debug env # 显示环境信息Configuration: .prototools
配置:.prototools
toml
undefinedtoml
undefined.prototools
.prototools
node = "20.10.0"
npm = "10.2.0"
pnpm = "8.12.0"
yarn = "4.0.0"
bun = "1.0.0"
deno = "1.40.0"
rust = "1.75.0"
go = "1.21.0"
python = "3.12.0"
[plugins]
my-tool = "https://example.com/plugin.wasm"
[settings]
auto-install = true
auto-clean = true
detect-strategy = "prefer-prototools"
[env]
NODE_ENV = "development"
undefinednode = "20.10.0"
npm = "10.2.0"
pnpm = "8.12.0"
yarn = "4.0.0"
bun = "1.0.0"
deno = "1.40.0"
rust = "1.75.0"
go = "1.21.0"
python = "3.12.0"
[plugins]
my-tool = "https://example.com/plugin.wasm"
[settings]
auto-install = true
auto-clean = true
detect-strategy = "prefer-prototools"
[env]
NODE_ENV = "development"
undefinedVersion Specifiers
版本指定格式
| Format | Example | Description |
|---|---|---|
| Exact | | Exact version |
| Major | | Latest 20.x.x |
| Tilde | | Patch updates only |
| Alias | | Language-specific alias |
| 格式 | 示例 | 说明 |
|---|---|---|
| 精确版本 | | 完全匹配的版本 |
| 大版本 | | 最新的20.x.x版本 |
| 波浪号 | | 仅更新补丁版本 |
| 别名 | | 语言特定的别名 |
Supported Tools (Built-in)
支持的内置工具
JavaScript/TypeScript
JavaScript/TypeScript
bash
proto install node # Node.js runtime
proto install npm # npm package manager
proto install pnpm # pnpm package manager
proto install yarn # Yarn package manager
proto install bun # Bun runtime
proto install deno # Deno runtimebash
proto install node # Node.js 运行时
proto install npm # npm 包管理器
proto install pnpm # pnpm 包管理器
proto install yarn # Yarn 包管理器
proto install bun # Bun 运行时
proto install deno # Deno 运行时Systems Languages
系统级语言
bash
proto install rust # Rust (includes cargo)
proto install go # Gobash
proto install rust # Rust(包含cargo)
proto install go # GoOther
其他
bash
proto install python # Python (includes pip)bash
proto install python # Python(包含pip)Version Detection Order
版本检测顺序
- CLI argument:
proto run node 18.0.0 - Environment variable:
PROTO_NODE_VERSION=18.0.0 - Local (current + parent dirs)
.prototools - Ecosystem files: ,
.nvmrc,.node-versionenginespackage.json - Global :
.prototools~/.proto/.prototools
- 命令行参数:
proto run node 18.0.0 - 环境变量:
PROTO_NODE_VERSION=18.0.0 - 本地.prototools文件(当前目录及父目录)
- 生态系统文件:、
.nvmrc、.node-version中的engines字段package.json - 全局.prototools文件:
~/.proto/.prototools
Common Workflows
常见工作流
Pin Versions for Team
为团队固定版本
bash
undefinedbash
undefinedPin to local .prototools
固定到本地.prototools
proto pin node 20.10.0
proto pin pnpm 8.12.0
proto pin node 20.10.0
proto pin pnpm 8.12.0
Pin globally (user default)
全局固定(用户默认版本)
proto pin node 20 --global
undefinedproto pin node 20 --global
undefinedInstall All Tools
安装所有工具
bash
undefinedbash
undefinedInstall everything from .prototools
安装.prototools中配置的所有工具
proto install
undefinedproto install
undefinedCheck for Updates
检查更新
bash
proto outdated # Check for updates
proto outdated --update --latest # Update .prototoolsbash
proto outdated # 检查可用更新
proto outdated --update --latest # 更新.prototools中的版本Run with Specific Version
使用指定版本运行
bash
proto run node 18 -- script.js # Override version
PROTO_NODE_VERSION=18 proto run node # Via env varbash
proto run node 18 -- script.js # 覆盖默认版本
PROTO_NODE_VERSION=18 proto run node # 通过环境变量指定Proto Exec (v0.53+)
Proto Exec(v0.53+)
Bootstrap an environment with multiple tools:
bash
undefined引导包含多个工具的环境:
bash
undefinedRun command with multiple tools
使用多个工具运行命令
proto exec node@24 pnpm@10 ruby@3.4 -- pnpm run app:start
proto exec node@24 pnpm@10 ruby@3.4 -- pnpm run app:start
Load tools from config
从配置文件加载工具
proto exec --tools-from-config -- npm test
proto exec --tools-from-config -- npm test
Interactive shell with activated tools
进入包含已激活工具的交互式Shell
proto exec node pnpm -- bash
undefinedproto exec node pnpm -- bash
undefinedBuild From Source (v0.45+)
从源码构建(v0.45+)
Compile tools from source (useful when pre-built binaries unavailable):
bash
proto install ruby --build
proto install node --build
proto install python --buildSupported: Deno, Go, Moon, Node, Python, Ruby.
toml
undefined从源码编译工具(当预构建二进制文件不可用时适用):
bash
proto install ruby --build
proto install node --build
proto install python --build支持的工具:Deno、Go、Moon、Node、Python、Ruby。
toml
undefined.prototools
.prototools
[settings.build]
install-system-packages = true
write-log-file = true
undefined[settings.build]
install-system-packages = true
write-log-file = true
undefinedPlugins
插件
Add Third-Party Plugin
添加第三方插件
bash
proto plugin add atlas "https://raw.githubusercontent.com/.../plugin.toml"
proto install atlasbash
proto plugin add atlas "https://raw.githubusercontent.com/.../plugin.toml"
proto install atlasList Plugins
列出插件
bash
proto plugin list # Show all plugins
proto plugin list --versions # With version infobash
proto plugin list # 显示所有插件
proto plugin list --versions # 包含版本信息Plugin Sources
插件来源
toml
[plugins]toml
[plugins]Remote TOML plugin
远程TOML插件
atlas = "https://example.com/atlas/plugin.toml"
atlas = "https://example.com/atlas/plugin.toml"
Remote WASM plugin
远程WASM插件
custom = "https://example.com/plugin.wasm"
custom = "https://example.com/plugin.wasm"
GitHub releases (recommended for distribution)
GitHub Releases(推荐的分发方式)
my-tool = "github://org/repo"
my-tool = "github://org/repo"
Local development (WASM)
本地开发(WASM)
local = "file://./target/wasm32-wasip1/release/plugin.wasm"
undefinedlocal = "file://./target/wasm32-wasip1/release/plugin.wasm"
undefinedWASM Plugin Development
WASM插件开发
Build plugins with crate targeting :
proto_pdkwasm32-wasip1bash
undefined使用 crate构建目标为的插件:
proto_pdkwasm32-wasip1bash
undefinedBuild plugin
构建插件
cargo build --target wasm32-wasip1 --release
cargo build --target wasm32-wasip1 --release
Test locally
本地测试
proto install my-tool --log trace
Test configuration for local development:
```tomlproto install my-tool --log trace
本地开发测试配置:
```toml.prototools
.prototools
[settings]
unstable-lockfile = true # Create .protolock for consistency
[plugins.tools]
my-tool = "file://./target/wasm32-wasip1/release/my_tool.wasm"
Required WASM functions:
- `register_tool` - Metadata (name, type)
- `download_prebuilt` - Configure download/install
- `locate_executables` - Define executable paths
- `load_versions` - Fetch available versions
Optional: `native_install`, `detect_version_files`, `parse_version_file`[settings]
unstable-lockfile = true # 创建.protolock以保证一致性
[plugins.tools]
my-tool = "file://./target/wasm32-wasip1/release/my_tool.wasm"
必备WASM函数:
- `register_tool` - 元数据(名称、类型)
- `download_prebuilt` - 配置下载/安装逻辑
- `locate_executables` - 定义可执行文件路径
- `load_versions` - 获取可用版本列表
可选函数:`native_install`, `detect_version_files`, `parse_version_file`Settings
设置项
toml
[settings]toml
[settings]Auto-install missing tools
自动安装缺失的工具
auto-install = true
auto-install = true
Auto-clean unused tools
自动清理未使用的工具
auto-clean = true
auto-clean = true
Version detection strategy
版本检测策略
first-available, prefer-prototools, only-prototools
first-available, prefer-prototools, only-prototools
detect-strategy = "prefer-prototools"
detect-strategy = "prefer-prototools"
Pin "latest" alias to local or global config
将"latest"别名固定到本地或全局配置
pin-latest = "local"
pin-latest = "local"
Create .protolock for reproducible installs
创建.protolock以实现可复现的安装
unstable-lockfile = true
unstable-lockfile = true
Disable telemetry
禁用遥测
telemetry = false
[settings.http]
telemetry = false
[settings.http]
Configure proxies
配置代理
proxies = ["https://internal.proxy"]
root-cert = "/path/to/cert.pem"
[settings.offline]
timeout = 500 # ms
undefinedproxies = ["https://internal.proxy"]
root-cert = "/path/to/cert.pem"
[settings.offline]
timeout = 500 # 毫秒
undefinedEnvironment Variables
环境变量
| Variable | Description |
|---|---|
| Installation directory (default: |
| Log level (trace, debug, info, warn, error) |
| Override version for tool |
| Environment for config lookup |
| Skip version validation |
| 变量 | 说明 |
|---|---|
| 安装目录(默认: |
| 日志级别(trace, debug, info, warn, error) |
| 覆盖指定工具的版本 |
| 配置查找的环境上下文 |
| 跳过版本验证 |
Development/Testing Variables
开发/测试变量
| Variable | Description |
|---|---|
| Enable test mode (loads test plugins) |
| Show detailed command execution |
| Enable WASM plugin debugging |
| Detailed WASM backtraces |
| 变量 | 说明 |
|---|---|
| 启用测试模式(加载测试插件) |
| 显示详细的命令执行日志 |
| 启用WASM插件调试 |
| 显示详细的WASM调用栈 |
Integration with moon
与moon集成
proto is the toolchain backend for moon. Configure in (v2):
.moon/toolchains.ymlyaml
undefinedproto是moon的工具链后端。在(v2版本)中配置:
.moon/toolchains.ymlyaml
undefined.moon/toolchains.yml
.moon/toolchains.yml
javascript:
packageManager: "pnpm"
node:
version: "20.10.0"
Or pin moon itself via proto:
```tomljavascript:
packageManager: "pnpm"
node:
version: "20.10.0"
也可以通过proto固定moon本身的版本:
```toml.prototools
.prototools
moon = "1.31.0"
undefinedmoon = "1.31.0"
undefinedCI/CD Integration
CI/CD集成
yaml
undefinedyaml
undefinedGitHub Actions
GitHub Actions
- uses: moonrepo/setup-toolchain@v0 with: auto-install: true
undefined- uses: moonrepo/setup-toolchain@v0 with: auto-install: true
undefinedAdditional Resources
更多资源
For detailed configuration, consult:
- - Complete .prototools reference
references/config.md - - Plugin development guide
references/plugins.md - - Full CLI reference
references/commands.md
如需详细配置说明,请参考:
- - 完整的.prototools参考文档
references/config.md - - 插件开发指南
references/plugins.md - - 完整的CLI参考文档
references/commands.md
Examples
示例
- - Complete configuration
examples/prototools-full.toml - - TOML plugin example
examples/plugin.toml
- - 完整配置示例
examples/prototools-full.toml - - TOML插件示例
examples/plugin.toml