moon-build-orchestration

star 1

Adopt moonrepo/moon as the build orchestration layer above cargo/pnpm/vite/tauri. Moon adds: content-hash-based task caching (BLAKE3), affected-change detection (only rebuild what the PR touched), DAG-parallel task execution, and optional remote cache (Bazel RE v2). Use when the monorepo's build time is unacceptable, when OOM from parallel Tauri builds is occurring, or when CI needs affected-only builds. Moon wraps existing tools — it does NOT replace cargo, pnpm, or tauri. Recommendation from moonrepo ingest: ADOPT-AS-TOOL (8/10), do NOT fork.

B2Gdevs By B2Gdevs schedule Updated 6/8/2026

name: moon-build-orchestration description: >- Adopt moonrepo/moon as the build orchestration layer above cargo/pnpm/vite/tauri. Moon adds: content-hash-based task caching (BLAKE3), affected-change detection (only rebuild what the PR touched), DAG-parallel task execution, and optional remote cache (Bazel RE v2). Use when the monorepo's build time is unacceptable, when OOM from parallel Tauri builds is occurring, or when CI needs affected-only builds. Moon wraps existing tools — it does NOT replace cargo, pnpm, or tauri. Recommendation from moonrepo ingest: ADOPT-AS-TOOL (8/10), do NOT fork. status: stable lane: [infra, build, ci] type: tooling-adoption trigger: >- "moon build", "moonrepo", "affected builds", "build orchestration", "build caching", "speed up monorepo build", "only rebuild what changed", "tauri build oom", "parallel build oom" source-ingest: .planning/ingest/2026-06-07-article-github-com-moonrepo-moon.md port-score: 8.0/10 (adopt-as-tool) argument-hint: --target : [--affected]

moon-build-orchestration

Wraps our monorepo build tools (cargo, pnpm, vite, tauri) with a content-hash cache, affected-detection, and parallel DAG execution via moonrepo/moon.

NOT a code port — moon is adopted as a binary tool via proto. Ingest recommendation: ADOPT, do NOT fork or vendor.

Why adopt moon

  1. OOM prevention — affected-detection means CI/CD only runs cargo build for crates that CHANGED, not all 70+ crates. Directly addresses the OOM parallel-Tauri-build issue (memory feedback_serialize_heavy_tauri_builds_oom)
  2. Cache reuse — BLAKE3 content hash means a re-run of the same commit hits cache instantly (hydrates tarred output, skips compilation entirely)
  3. Affected detectionmoon run --affected :build runs only build tasks for projects touched by the current git diff vs defaultBranch
  4. Stack orthogonal — moon does NOT replace gad (planning/STATE.xml) or xp/gad CLI; it sits between gad and cargo/pnpm

Adoption workflow (3-day estimate)

Day 1 — Bootstrap

# Install proto (moon's toolchain manager)
curl -fsSL https://moonrepo.dev/install/proto.sh | sh

# Install moon via proto
proto install moon

# Init workspace at repo root
moon init   # generates .moon/workspace.yml + .moon/toolchains.yml

Day 2 — Wire priority projects

For each of: apps/kael, apps/meshboard, apps/ide, crates/xp, packages/magicborn-cli:

# <project>/moon.yml
language: rust   # or node
type: application|library
tasks:
  build:
    command: cargo build --release
    inputs:
      - "src/**/*"
      - "Cargo.toml"
    outputs:
      - "target/release/<name>"
  check:
    command: cargo check --message-format=short
    inputs:
      - "src/**/*"
      - "Cargo.toml"

Day 3 — Wire CI / affected detection

# In CI pipeline:
moon run --affected :build    # builds only changed projects
moon run --affected :test     # tests only projects with changes
moon run --affected :check    # type/lint checks for changed only

# Remote cache (optional, Depot.dev or self-hosted bazel-remote):
# .moon/workspace.yml → remote: { host: 'grpcs://cache.depot.dev', ... }

Stack order

gad (planning) → moon (build orchestration) → cargo/pnpm/vite/tauri (compile)

Moon does NOT interfere with:

  • sccache (operates at rustc level; moon operates at task level — they stack)
  • release-fast profile (cargo args pass through; moon keys cache per --profile)
  • pnpm workspaces (moon discovers pnpm packages as projects; pnpm manages lockfile)

Config reference

# .moon/workspace.yml
projects:
  globs:
    - 'apps/*'
    - 'crates/*'
    - 'packages/*'
    - 'sites/*'
vcs:
  manager: git
  defaultBranch: main
# .prototools (pin toolchain versions)
node = "22.14.0"
rust = "stable"
bun = "1.2.2"

Anti-patterns

  • Do NOT fork moon — consume pinned binary via proto; moon releases weekly
  • Do NOT replace sccache with moon's cache — they are different layers; use both
  • Do NOT add moon tasks for tasks that already run fast (<5s); cache overhead is not worth it for trivial scripts
  • Do NOT use moon run :build in non-CI contexts if you are already running cargo build directly — moon adds value for multi-project orchestration, not single-crate builds

Provenance

  • Source: moonrepo/moon (MIT) — .planning/ingest/2026-06-07-article-github-com-moonrepo-moon.md
  • Recommendation: ADOPT-AS-TOOL (8/10), do NOT fork (4.2/10)
  • Key insight: affected-detection + content-hash cache directly solve our OOM parallel-build problem without any source modification
  • Built: 2026-06-07
Install via CLI
npx skills add https://github.com/B2Gdevs/get-anything-done-monorepo --skill moon-build-orchestration
Repository Details
star Stars 1
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator