1---2name: moon-guide3description: Use when configuring moonrepo monorepo tasks. Triggers on `.moon/` config files, `moon.yml`, and prompts about task definitions, project tags, task inheritance, language toolchains, project queries, or task caching, even when the user doesn't say 'moonrepo'.4---56# Moon Build System Guidelines78## Requirements910- Moon ≥ 2.0, Node.js for JavaScript/TypeScript projects.11- Migration from v1: Run `moon migrate v2` to automate configuration updates.1213## Essentials1415- **Task configuration** - Define in `.moon/tasks/*.yml` for auto-inheritance, see [references/task-configuration.md](references/task-configuration.md), [references/task-inheritance.md](references/task-inheritance.md)16- **Tags** - Use for categorization, filtering, boundaries, inheritance, see [references/tag-based-filtering.md](references/tag-based-filtering.md)17- **Execution** - `project:task`, `#tag:task`, `:task` (all), `--query`, `--affected`18- **Querying** - Query projects/tasks by tags, language, or query language, see [references/query-language.md](references/query-language.md)19- **Configuration** - Projects use `moon.yml`, workspace uses `.moon/workspace.yml`20- **Toolchains** - Moon manages language toolchains, configured in `.moon/toolchains.yml` (plural in v2)21- **Caching** - Built-in task caching with output definitions, see [references/task-configuration.md](references/task-configuration.md)2223## Moon 2.0 Key Changes2425- **command vs script** - Use `script:` for shell features (pipes, redirects, chaining); `command:` for simple executables only26- **Shell by default** - Tasks run in shell by default (`bash` on Unix, `pwsh` on Windows)27- **Deep merging** - Configs merge sequentially (not shallow), fileGroups combine instead of replace28- **Renamed settings** - `platform` → `toolchains`, `type` → `layer`, `toolchain.yml` → `toolchains.yml`29- **Env var syntax** - `$VAR` substitutes empty string (not syntax fallback); use `${VAR:-default}` for defaults3031## Gotchas3233- Task inheritance flows from `.moon/tasks/*.yml` (by tag/language) → project `moon.yml`: overriding requires the same task key in the project file34- Implicit task dependencies via `deps:` are project-scoped: cross-project deps need `<project>:<task>` syntax35- `moon ci` skips persistent server tasks (`preset: 'server'`) and any task with `options.runInCI: false`, never gate CI-only checks behind a non-CI task36- Project tags drive task inheritance; misspelling a tag silently disables the inherited tasks for that project3738## Progressive disclosure3940- Read [references/task-configuration.md](references/task-configuration.md) - Load when defining or modifying task configurations41- Read [references/tag-based-filtering.md](references/tag-based-filtering.md) - Load when filtering projects or tasks by tags42- Read [references/query-language.md](references/query-language.md) - Load when using advanced query syntax43- Read [references/task-inheritance.md](references/task-inheritance.md) - Load when setting up task inheritance patterns44- Read [references/project-constraints.md](references/project-constraints.md) - Load when enforcing project boundaries45- Read [references/migration-v2.md](references/migration-v2.md) - Load when migrating from moon v1 to v246- Read [references/docker-multistage.md](references/docker-multistage.md) - Load when building Docker images with moon scaffold