mcpField
M
mise-expert

mise-expert

github.com/samhvw8開発1179 回インストール48 週間前に更新
リポジトリ

mise-expert について

mise-expertは、miseによる開発環境、ツールのバージョン、環境変数、タスクのワークフロー設定を支援するスキルです。多言語プロジェクトやオンボーディング、CI/CD設定に取り組む開発チーム向けです。

主な機能

  1. 01ランタイムとツールのバージョン管理
  2. 02依存関係とキャッシュを備えたタスク設計
  3. 03環境変数とディレクトリ環境の設定
  4. 04一般的なツールからの設定移行
  5. 05mise設定のトラブルシューティング
  6. 06CI/CD連携の設定

活用シーン

  1. 01多言語プロジェクトのツールバージョン統一
  2. 02新規プロジェクトやmonorepo向けmise.tomlの作成
  3. 03Makefileやnpm scriptsからタスク設定への移行
  4. 04ローカルとCIでの開発環境の再現

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/samhvw8/dot-claude --skill mise-expert

インストール後、Claude Code で/mise-expertを入力して読み込まれたか確認します。

詳細

Mise エキスパートスキル

目的

mise に特化したスキルです。ツールのバージョン管理(asdf の代替)、環境変数の管理(direnv の代替)、タスクの実行(make/npm scripts の代替)を統合した開発環境マネージャーです。

このスキルを使用する場面

ツールとランタイムの管理
  • ランタイム(node、python、go、ruby、rust など)のインストールと管理
  • 再現性を確保するための、プロジェクト固有のツールバージョンの設定
  • 複数の言語を使用するプロジェクトでの、複数の言語バージョンの切り替え
  • グローバルとプロジェクトローカルのツールインストールの管理
  • asdf、nvm、pyenv、rbenv、または類似のバージョンマネージャーからの移行
  • ツールのバージョン競合のトラブルシューティング
プロジェクトのセットアップとオンボーディング
  • 新しいプロジェクトの開発環境の立ち上げ
  • チーム内の一貫性を保つための mise.toml の作成
  • モノレポのツール設定
  • ディレクトリごとの環境切り替えの設定
  • プロジェクトの開発標準の確立
  • 新しいチームメンバーのオンボーディングの簡素化
タスクランナーとビルドシステム
  • mise.toml のタスク設定の作成または最適化
  • 依存関係チェーンを使ったタスクワークフローの設計
  • 並列タスク実行戦略の実装
  • sources/outputs を使ったインテリジェントなキャッシュの追加
  • make、npm scripts、just、またはその他のタスクランナーからの移行
  • クロスプラットフォーム互換のタスクシステムの構築
  • インクリメンタルビルドによるビルドパフォーマンスの最適化
環境管理
  • ディレクトリごとの環境変数の設定
  • 環境間でのシークレットと設定の管理
  • 開発/ステージング/本番環境の切り替えの設定
  • direnv を mise に置き換える
  • .env ファイルからの環境変数の読み込み
  • 環境ごとのタスクの動作の設定
CI/CD 統合
  • GitHub Actions、GitLab CI、CircleCI での mise のセットアップ
  • ローカルと CI の環境の一貫性の確保
  • mise のキャッシュによる CI ビルドの最適化
  • コンテナ化された環境でのツールバージョンの管理
トラブルシューティングと最適化
  • mise のタスク実行に関する問題のデバッグ
  • ツールバージョンの問題の診断
  • 環境変数の読み込みに関する問題の解決
  • タスクのキャッシュとパフォーマンスの最適化
  • クロスプラットフォーム互換性の問題の修正

主な機能

- **ツールのバージョン管理**:ランタイムバージョンのインストール、設定、切り替え - **タスク設計**:効率的でキャッシュ可能、かつ保守しやすいタスク設定の作成 - **環境設定**:ツール、変数、ディレクトリごとの環境の設定 - **ワークフローの最適化**:並列実行とインテリジェントな依存関係チェーンの設計 - **移行サポート**:asdf、make、npm、direnv、その他のツールからの移行 - **トラブルシューティング**:mise の設定問題の診断と解決 - **ベストプラクティス**:最新の開発ワークフローに向けた mise のパターンの適用 - **CI/CD 統合**:継続的インテグレーションパイプライン向けの mise の設定

運用ガイドライン

タスク設定の原則

<task_design_principles>

  1. キャッシュを最優先:キャッシュ可能なタスクには必ず sources と outputs を定義します
  2. デフォルトで並列実行:並列実行には depends 配列を使用します
  3. 単一責任:各タスクの目的は明確に一つにします
  4. 名前空間の使用:関連するタスクを接頭辞でグループ化します(例:db:migrate、test:unit)
  5. 冪等性:タスクは複数回実行しても安全である必要があります
  6. プラットフォームへの配慮:クロスプラットフォーム互換性のために run_windows を使用します
  7. ウォッチモードへの対応:mise watch と互換性のあるタスクを設計します </task_design_principles>
判断の枠組み

<when_to_use_mise> mise を選ぶケース:

  • バージョン管理が必要な複数言語のプロジェクト(Python + Node + Go)
  • ディレクトリごとの環境変数が必要なプロジェクト
  • クロスプラットフォームの開発チーム(Linux/Mac/Windows)
  • 複雑な Makefile や npm スクリプトを置き換える場合
  • タスクの並列実行が必要なプロジェクト
  • 一貫した開発環境を求めるチーム(新しい開発者のオンボーディング)
  • 複数のツール(asdf + direnv + make)を 1 つに置き換える場合
  • 再現可能なビルドが必要な CI/CD パイプライン

mise を使わないケース:

  • ビルド手順がシンプルな単一言語のプロジェクト
  • npm スクリプトで十分なプロジェクト
  • TOML に不慣れで、学習に割ける時間がないチーム
  • 既存のタスクシステムが問題なく機能しており、困りごとがないプロジェクト
  • 組み込みシステムや制約のある環境 </when_to_use_mise>
ツールのバージョン管理パターン

<tool_installation_patterns> プロジェクト固有のツール

# mise.toml - Project root configuration
[tools]
# Exact versions for reproducibility
node = "20.10.0"
python = "3.11.6"
go = "1.21.5"
terraform = "1.6.6"

# Read from version file
ruby = { file = ".ruby-version" }
java = { file = ".java-version" }

# Latest patch version
postgres = "16"
redis = "7"

# Multiple versions (switch with mise use)
# mise use node@18 (temporarily override)

グローバル開発ツール

# Install globally useful CLI tools
mise use -g ripgrep@latest      # Better grep
mise use -g bat@latest          # Better cat

バージョンファイルの移行

# Migrate from existing version files
echo "20.10.0" > .node-version
echo "3.11.6" > .python-version

# mise.toml
[tools]
node = { file = ".node-version" }
python = { file = ".python-version" }

</tool_installation_patterns>

プロジェクトセットアップのワークフロー

<project_setup_patterns> 新規プロジェクトの初期設定

# mise.toml
[tools]
node = "20"
python = "3.11"

[env]
PROJECT_ROOT = "{{cwd}}"
LOG_LEVEL = "debug"

[vars]
project_name = "my-app"

[tasks.setup]
description = "Setup development environment"
run = [
  "mise install",
  "npm install",
  "pip install -r requirements.txt",
  "cp .env.example .env"
]

[tasks.dev]
alias = "d"
description = "Start development server"
depends = ["setup"]
env = { NODE_ENV = "development" }
run = "npm run dev"

モノレポの設定

# Root mise.toml
[tools]
node = "20"
go = "1.21"

[tasks.install]
description = "Install all dependencies"
run = [
  "cd frontend && npm install",
  "cd backend && go mod download"
]

# frontend/mise.toml
[tasks.dev]
dir = "{{cwd}}/frontend"
run = "npm run dev"

# backend/mise.toml
[tools]
go = "1.21"

[tasks.dev]
dir = "{{cwd}}/backend"
run = "go run main.go"

</project_setup_patterns>

設定パターン

<common_patterns> 開発ワークフロー

[tasks.dev]
alias = "d"
description = "Start development server with hot reload"
env = { NODE_ENV = "development", DEBUG = "true" }
run = "npm run dev"

[tasks.dev-watch]
description = "Watch and rebuild on changes"
run = "mise watch build"

キャッシュを使ったビルドパイプライン

[tasks.clean]
description = "Remove build artifacts"
run = "rm -rf dist"

[tasks.build]
alias = "b"
description = "Build production bundle"
depends = ["clean"]
sources = ["src/**/*", "package.json", "tsconfig.json"]
outputs = ["dist/**/*"]
env = { NODE_ENV = "production" }
run = "npm run build"

[tasks.build-watch]
description = "Rebuild on source changes"
run = "mise watch build"

テストスイート

[tasks.test]
alias = "t"
description = "Run all tests"
depends = ["test:unit", "test:integration"]  # Runs in parallel

[tasks."test:unit"]
description = "Run unit tests"
sources = ["src/**/*.ts", "tests/unit/**/*.ts"]
run = "npm test -- --testPathPattern=unit"

[tasks."test:integration"]
description = "Run integration tests"
sources = ["src/**/*.ts", "tests/integration/**/*.ts"]
run = "npm test -- --testPathPattern=integration"

[tasks."test:watch"]
description = "Run tests in watch mode"
run = "npm test -- --watch"

[tasks."test:coverage"]
description = "Generate coverage report"
run = "npm test -- --coverage"

[tasks."test:e2e"]
description = "Run end-to-end tests"
depends = ["build"]
run = "playwright test"

データベースのワークフロー

[tasks."db:migrate"]
description = "Run database migrations"
run = "npx prisma migrate deploy"

[tasks."db:seed"]
description = "Seed database with test data"
depends = ["db:migrate"]
run = "npx prisma db seed"

[tasks."db:reset"]
description = "Reset database to clean state"
run = ["npx prisma migrate reset --force", "mise run db:seed"]

[tasks."db:studio"]
description = "Open Prisma Studio"
run = "npx prisma studio"

リンティングとフォーマット

[tasks.lint]
description = "Lint code"
sources = ["src/**/*.ts"]
run = "eslint src"

[tasks.format]
description = "Format code"
sources = ["src/**/*.ts"]
run = "prettier --write src"

[tasks."lint:fix"]
description = "Lint and auto-fix issues"
run = "eslint src --fix"

[tasks.check]
description = "Run all checks"
depends = ["lint", "format", "test"]  # Runs in parallel

デプロイパイプライン

[tasks.deploy]
description = "Deploy to production"
usage = '''
arg "environment" description="Target environment" default="staging"
flag "-f --force" description="Skip confirmation"
'''
depends = ["build", "test"]
depends_post = ["notify:slack"]
run = './scripts/deploy.sh {{arg(name="environment")}} {{flag(name="force")}}'

[tasks."deploy:staging"]
description = "Deploy to staging"
depends = ["build", "test"]
run = "./scripts/deploy.sh staging"

[tasks."deploy:production"]
description = "Deploy to production"
depends = ["build", "test"]
run = "./scripts/deploy.sh production"

[tasks."notify:slack"]
hide = true
run = 'curl -X POST $SLACK_WEBHOOK -d "Deployment complete"'

Docker との統合

[tasks."docker:build"]
description = "Build Docker image"
sources = ["Dockerfile", "src/**/*"]
run = "docker build -t myapp:latest ."

[tasks."docker:run"]
description = "Run Docker container"
depends = ["docker:build"]
run = "docker run -p 3000:3000 myapp:latest"

[tasks."docker:compose"]
description = "Start services with docker-compose"
run = "docker-compose up -d"

Go プラグインのビルドシステム

[tasks."build:plugins"]
description = "Build all Go plugins in parallel"
sources = ["plugins/**/*.go"]
outputs = ["plugins/**/main.so"]
run = '''
for plugin in plugins/*/; do
  (cd "$plugin" && go build -buildmode=plugin -o main.so main.go) &
done
wait
'''

[tasks."rebuild:plugins"]
description = "Rebuild plugins when engine changes"
sources = ["engine/**/*.go"]
depends = ["build:engine"]
run = "mise run build:plugins"

</common_patterns>

変数と環境の管理

<environment_patterns> 環境ごとの変数

[vars]
# Default development values
api_url = "http://localhost:3000"
db_host = "localhost"
db_port = "5432"
debug_mode = "true"

# Load additional vars from .env
_.file = ".env"

[env]
# Static environment variables
NODE_ENV = "development"
LOG_LEVEL = "debug"

# Reference variables
API_URL = "{{vars.api_url}}"
DATABASE_URL = "postgres://{{vars.db_host}}:{{vars.db_port}}/myapp"
DEBUG = "{{vars.debug_mode}}"

[tasks.dev]
env = {
  NODE_ENV = "development",
  API_URL = "{{vars.api_url}}"
}
run = "npm run dev"

複数環境のセットアップ

# mise.toml (base development config)
[vars]
environment = "development"
api_url = "http://localhost:3000"

[env]
NODE_ENV = "development"

# mise.staging.toml
[vars]
environment = "staging"
api_url = "https://api.staging.example.com"

[env]
NODE_ENV = "staging"

# mise.production.toml
[vars]
environment = "production"
api_url = "https://api.example.com"
debug_mode = "false"

[env]
NODE_ENV = "production"

シークレット管理

# mise.toml (checked into git)
[vars]
# Non-sensitive defaults
api_url = "http://localhost:3000"

# Load secrets from .env (gitignored)
_.file = ".env"

[env]
# Reference secrets loaded from .env
API_KEY = "{{vars.api_key}}"
DATABASE_PASSWORD = "{{vars.db_password}}"

# .env (NOT in git)
api_key=secret-key-here
db_password=secret-password

</environment_patterns>

ワークフローの手順

<workflow_steps> mise の設定を支援する際は、次の手順に従います。

  1. 現在の状態を評価する

    • 既存の mise.toml があれば読み取る
    • 現在のタスクランナー(make、npm など)を特定する
    • バージョンマネージャー(asdf、nvm、pyenv)を確認する
    • プロジェクトの構成と要件を把握する
  2. アーキテクチャを設計する

    • ツールのバージョン要件を決定する
    • タスクの依存関係と関連性を整理する
    • 並列実行できる箇所を特定する
    • sources/outputs を使ったキャッシュ戦略を計画する
    • クロスプラットフォームの要件を考慮する
  3. 設定を実装する

    • ツールのバージョンと環境設定から始める
    • シンプルなタスクを作成し、段階的に複雑さを加える
    • 関連するタスクには名前空間を使う
    • 頻繁に使うタスクにエイリアスを追加する
    • 複雑なタスクには説明を記載する
  4. パフォーマンスを最適化する

    • キャッシュ用に sources/outputs を追加する
    • depends による並列実行を活用する
    • 適切な jobs の上限を設定する
    • 開発ワークフローには監視モードを使う
  5. 検証とテストを行う

    • mise install を実行してツールのインストールを確認する
    • mise tasks ls を実行してタスクが登録されていることを確認する
    • タスクの実行をテストする:mise run <task>
    • キャッシュの動作を確認する
    • 該当する場合はクロスプラットフォームでテストする
    • 診断のために mise doctor を実行する </workflow_steps>

移行戦略

<migration_from_asdf> .tool-versions から mise.toml への移行

.tool-versions:

nodejs 20.10.0
python 3.11.6
golang 1.21.5
terraform 1.6.6

mise.toml:

[tools]
node = "20.10.0"
python = "3.11.6"
go = "1.21.5"
terraform = "1.6.6"

移行コマンド:

# Mise can read .tool-versions directly
mise install

# Or convert to mise.toml
mise use [email protected] [email protected] [email protected] [email protected]

</migration_from_asdf>

<migration_from_make> Makefile から mise.toml への移行

Makefile:

.PHONY: build test clean deploy

clean:
	rm -rf dist

build: clean
	npm run build

test: build
	npm test

deploy: build test
	./deploy.sh

mise.toml:

[tasks.clean]
description = "Remove build artifacts"
run = "rm -rf dist"

[tasks.build]
alias = "b"
description = "Build production bundle"
depends = ["clean"]
sources = ["src/**/*", "package.json"]
outputs = ["dist/**/*"]
run = "npm run build"

[tasks.test]
alias = "t"
description = "Run tests"
depends = ["build"]
run = "npm test"

[tasks.deploy]
description = "Deploy to production"
depends = ["build", "test"]  # build and test run in parallel
run = "./deploy.sh"

メリット:

  • sources/outputs による自動キャッシュ
  • 独立したタスクの並列実行
  • クロスプラットフォーム互換性
  • 環境変数の管理
  • ツールのバージョン管理を統合 </migration_from_make>

<migration_from_npm> package.json のスクリプトから mise.toml への移行

package.json:

{
  "scripts": {
    "dev": "NODE_ENV=development npm start",
    "build": "webpack --mode production",
    "test": "jest",
    "lint": "eslint src",
    "deploy": "npm run build && npm run test && ./deploy.sh"
  }
}

mise.toml:

[tasks.dev]
alias = "d"
description = "Start development server"
env = { NODE_ENV = "development" }
run = "npm start"

[tasks.build]
alias = "b"
description = "Build production bundle"
sources = ["src/**/*", "webpack.config.js"]
outputs = ["dist/**/*"]
run = "webpack --mode production"

[tasks.test]
alias = "t"
description = "Run tests"
run = "jest"

[tasks.lint]
description = "Lint code"
sources = ["src/**/*.js"]
run = "eslint src"

[tasks.deploy]
description = "Deploy to production"
depends = ["build", "test"]  # Runs in parallel
run = "./deploy.sh"

メリット:

  • 依存関係の管理が向上(ビルドとテストを並列実行)
  • キャッシュにより不要な再ビルドを防止
  • 設定内で環境変数を管理
  • 異なる種類のプロジェクト間で一貫したインターフェース
  • Node.js だけでなく、あらゆる言語で動作 </migration_from_npm>

<migration_from_direnv> .envrc から mise.toml への移行

.envrc:

export NODE_ENV=development
export API_URL=http://localhost:3000
export DATABASE_URL=postgres://localhost/myapp

mise.toml:

[env]
NODE_ENV = "development"
API_URL = "http://localhost:3000"
DATABASE_URL = "postgres://localhost/myapp"

# Or use variables for DRY
[vars]
api_host = "localhost"
api_port = "3000"

[env]
API_URL = "http://{{vars.api_host}}:{{vars.api_port}}"

メリット:

  • TOML 形式は bash より読み書きが簡単
  • DRY な設定のための変数
  • タスクランナーやツールのバージョンと統合
  • シェル固有の構文が不要 </migration_from_direnv>

CI/CD 統合

<ci_integration> GitHub Actions

name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup mise
        uses: jdx/mise-action@v2
        with:
          version: latest  # or specific version

      - name: Install tools and dependencies
        run: mise install

      - name: Run tests
        run: mise run test

      - name: Build
        run: mise run build

GitLab CI

image: ubuntu:latest

before_script:
  - curl https://mise.run | sh
  - export PATH="$HOME/.local/bin:$PATH"
  - mise install

test:
  script:
    - mise run test

build:
  script:
    - mise run build

Docker

FROM ubuntu:latest

# Install mise
RUN curl https://mise.run | sh
ENV PATH="/root/.local/bin:$PATH"

# Copy project files
COPY . /app
WORKDIR /app

# Install tools and dependencies
RUN mise install

# Run build
RUN mise run build

CMD ["mise", "run", "start"]

</ci_integration>

トラブルシューティングガイド

<common_issues> ツールが見つからない/バージョンが違う

# Symptom: Command not found or using system version
mise ls                          # List installed tools
mise install                     # Install missing tools
mise use node@20                 # Set specific version
mise doctor                      # Diagnose configuration
which node                       # Verify mise shim
mise reshim                      # Rebuild shims if needed

タスクが見つからない

# Symptom: "Task 'xyz' not found"
mise tasks ls                    # List all tasks
mise config                      # Show active config files
cat mise.toml                    # Verify task definition
mise tasks info <task>           # Get task details

タスクのキャッシュに関する問題

# Symptom: Task not re-running when files change
[tasks.build]
sources = ["src/**/*"]           # Check glob patterns are correct
outputs = ["dist/**/*"]          # Verify output paths match actual outputs
run = "npm run build"

# Debug: Remove outputs and re-run
# rm -rf dist && mise run build

環境変数が読み込まれない

# Symptom: Environment variables not set in tasks
mise config                      # Verify mise.toml location (project root)
mise run --verbose <task>        # Check env loading with verbose output
mise doctor                      # Diagnostic check
env | grep VAR_NAME              # Check if var is actually set

クロスプラットフォームの問題

# Symptom: Task fails on Windows
[tasks.build]
run = "npm run build"            # Use cross-platform commands
run_windows = "npm.cmd run build"  # Windows-specific override

# Or use mise variables for paths
run = "{{cwd}}/scripts/build.sh"

並列実行が機能しない

# Symptom: Tasks running sequentially instead of parallel
[tasks.ci]
depends = ["lint", "test", "build"]  # Runs in parallel by default

# For sequential execution, use run array
[tasks.sequential]
run = [
  "mise run step1",
  "mise run step2",
  "mise run step3"
]

ツールのインストールに失敗する

# Symptom: mise install fails for a tool
mise doctor                      # Check for system dependencies
mise ls-remote node              # List available versions
mise install node@20 --verbose   # Verbose installation
mise cache clear                 # Clear cache and retry

</common_issues>

ベストプラクティスのチェックリスト

<best_practices> ツール管理:

  • 再現性を確保するため、正確なバージョンを固定する(node = "20" ではなく node = "20.10.0")
  • バージョンを選んだ理由をコメントで記載する
  • 互換性のために .tool-versions またはバージョンファイルを使用する
  • 新規クローンでツールのインストールをテストする

タスク設定:

  • 頻繁に使うタスクにはすべて短いエイリアスを設定する
  • ビルドタスクでは、キャッシュ用に sources と outputs を定義する
  • 関連するタスクでは名前空間のプレフィックス(db:、test:、docker:)を使用する
  • 複雑なタスクには分かりやすい説明を付ける
  • 引数を取るタスクでは、ドキュメント用に usage 仕様を使用する
  • 内部向けの非表示タスクには hide = true を設定する

環境管理:

  • DRY にするため、環境変数には mise の変数を使用する
  • シークレットは .env(gitignore 対象)から読み込む
  • 開発用のデフォルト値は mise.toml に設定する(バージョン管理対象)
  • 本番環境用のオーバーライドは別の設定ファイルに記載する

パフォーマンス:

  • depends 配列を使って並列実行を活用する
  • sources/outputs を使ってキャッシュを設定する
  • 反復的な開発で使えるウォッチモードを用意する
  • jobs 設定をシステムリソースに合わせて最適化する

クロスプラットフォーム:

  • プラットフォーム固有のコマンドでは run_windows を使用する
  • ハードコードした値の代わりに {{cwd}} を使ってパスを指定する
  • 対象プラットフォーム(Linux/Mac/Windows)でテストする

チームと CI:

  • mise.toml をバージョン管理する
  • README に mise のインストール方法と使い方を記載する
  • 一貫した環境を実現するため、CI/CD で mise を使用する
  • mise doctor で検証する </best_practices>

出力基準

mise の設定を作成する際は、次の点に従ってください。

  1. 断片ではなく、mise.toml のセクションを完全な形で提示する
  2. 分かりにくい設定には、説明コメントを付ける
  3. ユーザー向けのすべてのタスクに説明を追加する
  4. mise run コマンドを使った使用例を示す
  5. sources/outputs を使う場合は、キャッシュ戦略を説明する
  6. 環境変数とその用途を文書化する
  7. 他のシステムから移行する場合は、移行手順を示す
  8. 設定が機能することを確認する検証手順を含める
  9. ツールを設定する際は、mise install によるインストール方法を示す
  10. 実際のコマンド例を使ってテスト方法を示す

対話例

<example_setup> ユーザー:「Node.js プロジェクトで mise をセットアップしてください」

応答:

# mise.toml
[tools]
node = "20.10.0"

[env]
NODE_ENV = "development"

[tasks.install]
description = "Install dependencies"
run = "npm install"

[tasks.dev]
alias = "d"
description = "Start development server"
env = { NODE_ENV = "development" }
run = "npm run dev"

[tasks.build]
alias = "b"
description = "Build for production"
sources = ["src/**/*", "package.json"]
outputs = ["dist/**/*"]
env = { NODE_ENV = "production" }
run = "npm run build"

[tasks.test]
alias = "t"
description = "Run tests"
run = "npm test"

セットアップ:

mise install        # Install Node.js 20.10.0
mise run install    # Install npm dependencies
mise dev            # Start development server

</example_setup>

<example_polyglot> ユーザー:「Python のバックエンドと Node のフロントエンドを含むプロジェクトがあります」

応答:

# mise.toml
[tools]
node = "20.10.0"
python = "3.11.6"

[env]
PROJECT_ROOT = "{{cwd}}"

[tasks."backend:install"]
description = "Install Python dependencies"
dir = "{{cwd}}/backend"
run = "pip install -r requirements.txt"

[tasks."frontend:install"]
description = "Install Node dependencies"
dir = "{{cwd}}/frontend"
run = "npm install"

[tasks.install]
description = "Install all dependencies"
depends = ["backend:install", "frontend:install"]

[tasks."backend:dev"]
description = "Start Python backend"
dir = "{{cwd}}/backend"
env = { FLASK_ENV = "development" }
run = "python app.py"

[tasks."frontend:dev"]
description = "Start Node frontend"
dir = "{{cwd}}/frontend"
env = { NODE_ENV = "development" }
run = "npm run dev"

[tasks.dev]
description = "Start both frontend and backend"
depends = ["backend:dev", "frontend:dev"]

使用方法:

mise install              # Install both Node and Python
mise run install          # Install all dependencies
mise dev                  # Start both services in parallel

</example_polyglot>

避けるべきアンチパターン

<anti_patterns> 避けるべきこと:

  • ❌ 広いバージョン範囲を指定する(node = "20" → 予測不能)
  • ❌ 説明のないタスクを作成する(保守が難しくなります)
  • ❌ ビルドタスクで sources/outputs を無視する(キャッシュのメリットを活用できません)
  • ❌ depends で並列実行できる場合に、逐次実行の run 配列を使用する
  • ❌ 環境固有の値をハードコードする(代わりに vars を使用する)
  • ❌ モノリシックなタスクを作成する(より小さく、再利用可能な要素に分割する)
  • ❌ チームプロジェクトでクロスプラットフォームへの配慮を怠る
  • ❌ mise.toml のバージョン管理を忘れる
  • ❌ 単一のコマンドだけを実行する単純なプロジェクトに mise を使用する
  • ❌ mise.toml にシークレットをコミットする(.env を使用する)

行うべきこと:

  • ✅ 再現性のためにツールのバージョンを正確に固定する
  • ✅ 関連するタスクに名前空間を使用する
  • ✅ 頻繁に使用するタスクにエイリアスを追加する
  • ✅ キャッシュ可能なタスクに sources/outputs を定義する
  • ✅ depends で並列実行を活用する
  • ✅ DRY な設定に変数を使用する
  • ✅ 複雑なタスクの引数を usage spec で文書化する
  • ✅ コミット前に mise doctor でテストする
  • ✅ チームメンバーに向けて明確な説明を記載する
  • ✅ Git で無視される .env ファイルからシークレットを読み込む </anti_patterns>

コメント