Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

moonrepo

БесплатноБез исполняемых скриптовНе проверен

Runs and caches tasks across a monorepo with moonrepo (moon): a Rust-based build system that reads the project dependency graph, orders tasks, skips unchanged…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

moonrepo

Overview

moon is a Rust-based monorepo tool and task runner. It builds a graph of projects and tasks, runs tasks in dependency order, caches results by content hash, installs pinned toolchains (Node.js, package managers, and others) through proto, and runs only what a change affects. It works for JavaScript, TypeScript, Rust, Go, Python and more.

This skill targets moon v2 (v2.6.4 at the time of writing). v2 renamed many v1 settings; if a repository still has .moon/toolchain.yml, a runner: key, type: in a project file or local: true on a task, it is a v1 setup: run moon migrate v2 and review the diff. All commands and configs below were run on 2.6.4 with a three-project repository.

When to Use

  • A repository with several apps and packages whose tasks depend on each other
  • CI that rebuilds everything on each pull request
  • A team that needs the same Node.js and package manager version everywhere

Instructions

Setup

npm install -D @moonrepo/cli    # or: pnpm add -D @moonrepo/cli
npx moon --version              # moon 2.6.4
npx moon init                   # interactive; --yes accepts defaults, --minimal writes less

Moon needs a git repository with at least one commit. With pnpm, also create pnpm-workspace.yaml (packages: ['apps/*', 'packages/*']) and give each package.json the project's name: moon writes dependsOn projects into package.json as workspace:* dependencies, and the first run fails with ERR_PNPM_WORKSPACE_PKG_NOT_FOUND without it.

moon init creates a .moon/ folder. Commit it. Put .moon/cache and .moon/docker in .gitignore.

Workspace configuration

# .moon/workspace.yml
projects:
  - 'apps/*'
  - 'packages/*'

vcs:
  client: git            # was vcs.manager in v1
  defaultBranch: main

pipeline:                # was runner: in v1
  cacheLifetime: '7 days'

# defaultProject: 'web'  # lets `moon run build` work without a project prefix

Toolchain pinning

# .moon/toolchains.yml  (plural in v2; was toolchain.yml)
javascript:
  packageManager: pnpm   # package manager settings are top level now
node:
  version: '22.14.0'
pnpm:
  version: '10.6.0'

moon downloads proto and these exact versions on the first run, so every machine and CI job uses the same ones.

Project configuration

# packages/shared/moon.yml
layer: library            # was type: in v1
language: javascript
tasks:
  build:
    command: tsup
    inputs: ['src/**/*', 'tsup.config.ts']
    outputs: ['dist']
  test:
    command: vitest run
    inputs: ['src/**/*', 'tests/**/*']
# apps/web/moon.yml
layer: application
language: typescript
dependsOn: ['ui', 'shared']     # project IDs, not paths
tasks:
  build:
    command: next build
    deps: ['ui:build']          # runs first; shared:build comes through ui
    inputs: ['src/**/*', 'package.json', 'next.config.js']
    outputs: ['.next']
  dev:
    command: next dev
    preset: server              # long-running; replaces local: true in v2
  lint:
    command: oxlint src/
    inputs: ['src/**/*']
  package:
    script: 'tar -czf dist.tgz .next && echo packed'   # pipes, &&, redirects need script
    deps: ['~:build']

v2 rules that bite:

  • command is a plain executable with arguments. Pipes, &&, ; and KEY=value prefixes go in script.
  • Tasks run in a shell by default (bash on Unix, pwsh on Windows).
  • inferInputs defaults to false, so declare inputs for caching to be accurate.
  • ~:task means "this project"; a bare build target needs defaultProject.
  • To keep a task out of CI use options: { runInCI: false }.

Running tasks

npx moon run web:build              # builds ui and shared first, then web
npx moon run :test                  # the test task in every project that has it
npx moonx web:build                 # shorthand binary shipped with the CLI
npx moon task web:dev               # show the resolved task (command, inputs, preset)
npx moon projects                   # table of projects and toolchains
npx moon run :build --affected --base main --head HEAD

Without --base/--head, --affected looks at uncommitted changes only; after committing it reports "No tasks affected". v2 considers only changed files; to also run dependents, pass both --include-relations (-g) and --downstream deep (either flag alone still runs only the changed project). There is no --dryRun flag in v2.

CI

# .github/workflows/ci.yml
name: CI
on: [pull_request]
jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0          # moon needs history to find the merge base
          filter: 'blob:none'
      - uses: moonrepo/setup-toolchain@v0
      - run: moon ci

moon ci finds the changed files against the base, picks the affected tasks, runs them in graph order, and honors runInCI. Split a big pipeline across runners with `--job 0 --job-total

Полный SKILL.md на GitHub

Установить moonrepo в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл moonrepo?

Runs and caches tasks across a monorepo with moonrepo (moon): a Rust-based build system that reads the project dependency graph, orders tasks, skips unchanged work, pins toolchains such as Node.js and pnpm, and runs only affected tasks in CI. Use when someone asks to "manage a monorepo", "moonrepo", "task runner for monorepo", "faster than Turborepo", "build system with dependency graph", or "migrate from Turborepo". Covers moon v2 configuration, tasks, caching and CI.

Как установить скилл moonrepo?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл moonrepo запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить moonrepo с