Loading...
Loading...
This skill should be used when the user asks to "configure moon", "set up moonrepo", "create moon tasks", "run moon commands", "configure moon workspace", "add moon project", "moon ci setup", "moon docker", "moon query", "migrate to moon v2", or mentions moon.yml, .moon/workspace.yml, .moon/toolchains.yml, moon run, moon ci, or moonrepo in general.
npx skill4agent add hyperb1iss/moonrepo-skill moonmoon v2 is now available. Runto migrate. Seemoon migrate v2for breaking changes.references/v2-migration.md
moon run <target> # Run task(s)
moon run :lint # Run in all projects
moon run '#tag:test' # Run by tag
moon ci # CI-optimized execution
moon check --all # Run all build/test tasks
moon query projects # List projects
moon project-graph # Visualize dependencies| Pattern | Description |
|---|---|
| Specific project and task |
| All projects with this task |
| Projects with tag |
| Upstream dependencies (in deps) |
| Current project (in configs) |
| File | Purpose |
|---|---|
| Workspace settings, project discovery |
| Language versions, package managers (v2) |
| Global inherited tasks (v2) |
| Project-level config and tasks |
v2 Note:→.moon/toolchain.yml(plural),.moon/toolchains.yml→.moon/tasks.yml.moon/tasks/*.yml
# .moon/workspace.yml
$schema: "https://moonrepo.dev/schemas/workspace.json"
projects:
- "apps/*"
- "packages/*"
vcs:
client: "git"
defaultBranch: "main"
pipeline:
archivableTargets:
- ":build"
cacheLifetime: "7 days"# moon.yml
$schema: "https://moonrepo.dev/schemas/project.json"
language: "typescript"
layer: "application" # v2: 'type' renamed to 'layer'
stack: "frontend"
tags: ["react", "graphql"]
dependsOn:
- "shared-utils"
- id: "api-client"
scope: "production"
fileGroups:
sources:
- "src/**/*"
tests:
- "tests/**/*"
tasks:
build:
command: "vite build"
inputs:
- "@group(sources)"
outputs:
- "dist"
deps:
- "^:build"
dev:
command: "vite dev"
preset: "server"
# v2: Use 'script' for shell features (pipes, redirects)
lint:
script: "eslint . && prettier --check ."
test:
command: "vitest run"
inputs:
- "@group(sources)"
- "@group(tests)"| Layer | Description |
|---|---|
| Apps, services |
| Shareable code |
| CLIs, scripts |
| E2E/integration tests |
| Templates, generators |
| Infra, config |
| Field | Description |
|---|---|
| Command to execute (string or array) |
| Additional arguments |
| Task dependencies |
| Files for cache hashing |
| Files to cache |
| Environment variables |
| Inherit from another task |
| |
.moon/tasks/*.yml# .moon/tasks/node.yml
inheritedBy:
toolchains: ["javascript", "typescript"]
fileGroups:
sources: ["src/**/*"]
tasks:
lint:
command: "eslint ."
inputs: ["@group(sources)"]# moon.yml
workspace:
inheritedTasks:
include: ["lint", "test"]
exclude: ["deploy"]
rename:
buildApp: "build"tasks:
example:
command: "cmd"
options:
cache: true # Enable caching
runInCI: "affected" # affected, always, only, false
persistent: true # Long-running process
retryCount: 2 # Retry on failure
timeout: 300 # Seconds
mutex: "resource" # Exclusive lock
priority: "high" # critical, high, normal, lowinputs:
- "@group(sources)" # File group
- "@globs(tests)" # Glob patterns
- "/tsconfig.base.json" # Workspace root file
- "$NODE_ENV" # Environment variable# .moon/toolchains.yml (v2: plural)
$schema: "https://moonrepo.dev/schemas/toolchains.json"
# JavaScript ecosystem (v2: required for node/bun/deno)
javascript:
packageManager: "pnpm"
inferTasksFromScripts: false
node:
version: "20.10.0"
pnpm:
version: "8.12.0"
# Alternative runtimes
bun:
version: "1.0.0"
deno:
version: "1.40.0"
typescript:
syncProjectReferences: true
routeOutDirToCache: true
rust:
version: "1.75.0"
bins: ["cargo-nextest", "cargo-llvm-cov"]
go:
version: "1.21.0"
python:
version: "3.12.0"| Tier | Description | Examples |
|---|---|---|
| 3 | Full management | Node.js, Bun, Deno, Rust, Go, Python |
| 2 | Ecosystem integration | PHP, Ruby |
| 1 | Project categorization | Bash, Batch |
| 0 | System execution | Custom tools |
# GitHub Actions
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for affected detection
- uses: moonrepo/setup-toolchain@v0
with:
auto-install: true
- run: moon ci :build :test
- uses: moonrepo/run-report-action@v1
if: success() || failure()
with:
access-token: ${{ secrets.GITHUB_TOKEN }}strategy:
matrix:
shard: [0, 1, 2, 3]
steps:
- run: moon ci --job ${{ matrix.shard }} --job-total 4moon run :test --affected # Only affected projects
moon run :lint --affected --status staged # Only staged files
moon ci :test --base origin/main # Compare against base
moon query changed-files # v2: renamed from touched-filesmoon docker scaffold <project> # Generate Docker layers
moon docker setup # Install toolchain in Docker
moon docker prune # Prune for production
moon docker file <project> # Generate Dockerfile# Filter projects
moon query projects "language=typescript && projectType=library"
moon run :build --query "tag=react"
# Operators: =, !=, ~, !~, &&, ||
# Fields: project, language, stack, tag, task, taskTypereferences/workspace-config.mdreferences/task-config.mdreferences/v2-migration.mdreferences/cli-reference.mdexamples/workspace.ymlexamples/moon.ymlexamples/ci-workflow.yml