proto について
protoは、プロジェクト間で言語やツールのバージョンをそろえたい開発者向けのコマンドラインバージョンマネージャーです。プラグインで、Node.js、Python、Rust、Goなどの組み込み対応を拡張できます。
主な機能
- 01複数プロジェクトのバージョン管理
- 02.prototoolsでバージョンを固定
- 03ツールのインストールと実行
- 04プラグインによる対応ツールの拡張
- 05一部ツールのソースからのビルド
活用シーン
- 01チーム内のツールバージョン統一
- 02グローバルインストールなしでの実行
- 03複数ツール環境でのコマンド実行
- 04サードパーティ製プラグインの追加
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ hyperb1iss/ moonrepo-skill --skill protoインストール後、Claude Code で/protoを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
examples/prototools-full.tomlreferences/commands.mdconfig.md詳細
proto - プラグイン対応のマルチ言語バージョンマネージャー
proto は、複数のプログラミング言語に対応する次世代のバージョンマネージャーです。Node.js、npm、pnpm、yarn、Bun、Deno、Rust、Go、Python、およびプラグインを通じて800以上のツールを管理するための統一インターフェースを提供します。
proto を使用する場面
- プロジェクト間で言語やツールのバージョンを管理する
- チーム内の一貫性を保つため、
.prototoolsでバージョンを固定する - グローバル環境を汚さずにツールをインストールして実行する
- nvm、pyenv、rustup、gvm を単一のツールに置き換える
インストール
# Linux, macOS, WSL
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
シェルのセットアップ
# Add to shell profile
eval "$(proto activate bash)" # Bash
eval "$(proto activate zsh)" # Zsh
クイックリファレンス
基本的なコマンド
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 info
設定:.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"
バージョン指定子
| 形式 | 例 | 説明 |
|---|---|---|
| 固定 | "20.10.0" | 正確なバージョン |
| メジャー | "20" | 最新の20.x.x |
| チルダ | "~20.10" | パッチ更新のみ |
| エイリアス | "stable" | 言語固有のエイリアス |
対応ツール(組み込み)
JavaScript/TypeScript
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 runtime
システム言語
proto install rust # Rust (includes cargo)
proto install go # Go
その他
proto install python # Python (includes pip)
バージョンの検出順序
- CLI 引数:
proto run node 18.0.0 - 環境変数:
PROTO_NODE_VERSION=18.0.0 - ローカルの
.prototools(現在のディレクトリと親ディレクトリ) - エコシステムのファイル:
.nvmrc、.node-version、package.jsonの engines - グローバルの
.prototools:~/.proto/.prototools
よく使うワークフロー
チーム向けにバージョンを固定する
# Pin to local .prototools
proto pin node 20.10.0
proto pin pnpm 8.12.0
# Pin globally (user default)
proto pin node 20 --global
すべてのツールをインストールする
# Install everything from .prototools
proto install
更新を確認する
proto outdated # Check for updates
proto outdated --update --latest # Update .prototools
特定のバージョンで実行する
proto run node 18 -- script.js # Override version
PROTO_NODE_VERSION=18 proto run node # Via env var
Proto Exec(v0.53+)
複数のツールを使う環境をブートストラップします。
# Run command with multiple tools
proto exec node@24 pnpm@10 [email protected] -- pnpm run app:start
# Load tools from config
proto exec --tools-from-config -- npm test
# Interactive shell with activated tools
proto exec node pnpm -- bash
ソースからビルドする(v0.45+)
ツールをソースからコンパイルします(ビルド済みバイナリが利用できない場合に便利です)。
proto install ruby --build
proto install node --build
proto install python --build
対応対象:Deno、Go、Moon、Node、Python、Ruby。
# .prototools
[settings.build]
install-system-packages = true
write-log-file = true
プラグイン
サードパーティ製プラグインを追加する
proto plugin add atlas "https://raw.githubusercontent.com/.../plugin.toml"
proto install atlas
プラグインを一覧表示する
proto plugin list # Show all plugins
proto plugin list --versions # With version info
プラグインソース
[plugins]
# Remote TOML plugin
atlas = "https://example.com/atlas/plugin.toml"
# Remote WASM plugin
custom = "https://example.com/plugin.wasm"
# GitHub releases (recommended for distribution)
my-tool = "github://org/repo"
# Local development (WASM)
local = "file://./target/wasm32-wasip1/release/plugin.wasm"
WASM プラグインの開発
proto_pdk crate を使用し、wasm32-wasip1 をターゲットとしてプラグインをビルドします。
# Build plugin
cargo build --target wasm32-wasip1 --release
# Test locally
proto install my-tool --log trace
ローカル開発用のテスト設定:
# .prototools
[settings]
unstable-lockfile = true # Create .protolock for consistency
[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]
# Auto-install missing tools
auto-install = true
# Auto-clean unused tools
auto-clean = true
# Version detection strategy
# first-available, prefer-prototools, only-prototools
detect-strategy = "prefer-prototools"
# Pin "latest" alias to local or global config
pin-latest = "local"
# Create .protolock for reproducible installs
unstable-lockfile = true
# Disable telemetry
telemetry = false
[settings.http]
# Configure proxies
proxies = ["https://internal.proxy"]
root-cert = "/path/to/cert.pem"
[settings.offline]
timeout = 500 # ms
環境変数
| 変数 | 説明 |
|---|---|
PROTO_HOME | インストールディレクトリ(デフォルト:~/.proto) |
PROTO_LOG | ログレベル(trace、debug、info、warn、error) |
PROTO_*_VERSION | ツールのバージョンを上書き |
PROTO_ENV | 設定の検索に使用する環境 |
PROTO_BYPASS_VERSION_CHECK | バージョン検証をスキップ |
開発/テスト用の変数
| 変数 | 説明 |
|---|---|
PROTO_TEST | テストモードを有効化(テスト用プラグインを読み込む) |
PROTO_DEBUG_COMMAND | コマンドの実行内容を詳細に表示 |
PROTO_DEBUG_WASM | WASM プラグインのデバッグを有効化 |
WASMTIME_BACKTRACE_DETAILS | WASM の詳細なバックトレース |
moon との連携
proto は moon のツールチェーンバックエンドです。.moon/toolchains.yml で設定します(v2)。
# .moon/toolchains.yml
javascript:
packageManager: "pnpm"
node:
version: "20.10.0"
または、proto を使って moon 自体のバージョンを固定します。
# .prototools
moon = "1.31.0"
CI/CD との連携
# GitHub Actions
- uses: moonrepo/setup-toolchain@v0
with:
auto-install: true
その他のリソース
詳細な設定については、以下を参照してください。
references/config.md-.prototoolsの完全なリファレンスreferences/plugins.md- プラグイン開発ガイドreferences/commands.md- CLI の完全なリファレンス
Examples
examples/prototools-full.toml- Complete configurationexamples/plugin.toml- TOML plugin example
コメント
Markdown 対応