Skip to content

Commit 91dd6a7

Browse files
authored
chore: migrate workspace to moon/proto node stack (#17)
## Summary - migrate from deno-root layout to a Node + pnpm workspace layout - move package logic under `packages/cssforge` and add moon v2 project/task configuration - migrate package scripts into moon tasks and remove `scripts` blocks from repo package manifests - keep JSR publishing support via moon tasks and update release automation - add example projects and task wiring for e2e/dev flows ## Verification - ran CI-equivalent workflow locally: - `proto install` - `proto run pnpm -- install --frozen-lockfile` - `moon run :format` - `moon run :test` - `moon run :typecheck` Supersedes #16 (opened from the wrong branch).
1 parent 6c1545a commit 91dd6a7

File tree

246 files changed

+25875
-5125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+25875
-5125
lines changed

.agents/skills/cssforge

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../skills/cssforge

.agents/skills/moon/SKILL.md

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
---
2+
name: moon
3+
description: 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.
4+
---
5+
6+
# moon - Polyglot Monorepo Build System
7+
8+
moon is a Rust-based repository management, task orchestration, and build system for polyglot monorepos. It provides smart caching, dependency-aware task execution, and unified toolchain management.
9+
10+
> **moon v2 is now available.** Run `moon migrate v2` to migrate. See `references/v2-migration.md` for breaking changes.
11+
12+
## When to Use moon
13+
14+
- Managing monorepos with multiple projects/packages
15+
- Orchestrating tasks across projects with dependencies
16+
- Caching build outputs for faster CI/local builds
17+
- Managing toolchain versions (Node.js, Rust, Python, Go, etc.)
18+
- Generating project and action graphs
19+
20+
## Quick Reference
21+
22+
### Core Commands
23+
24+
```bash
25+
moon run <target> # Run task(s)
26+
moon run :lint # Run in all projects
27+
moon run '#tag:test' # Run by tag
28+
moon ci # CI-optimized execution
29+
moon check --all # Run all build/test tasks
30+
moon query projects # List projects
31+
moon project-graph # Visualize dependencies
32+
```
33+
34+
### Target Syntax
35+
36+
| Pattern | Description |
37+
| -------------- | ------------------------------- |
38+
| `project:task` | Specific project and task |
39+
| `:task` | All projects with this task |
40+
| `#tag:task` | Projects with tag |
41+
| `^:task` | Upstream dependencies (in deps) |
42+
| `~:task` | Current project (in configs) |
43+
44+
### Configuration Files
45+
46+
| File | Purpose |
47+
| ---------------------- | ---------------------------------------- |
48+
| `.moon/workspace.yml` | Workspace settings, project discovery |
49+
| `.moon/toolchains.yml` | Language versions, package managers (v2) |
50+
| `.moon/tasks/*.yml` | Global inherited tasks (v2) |
51+
| `moon.yml` | Project-level config and tasks |
52+
53+
> **v2 Note:** `.moon/toolchain.yml``.moon/toolchains.yml` (plural), `.moon/tasks.yml``.moon/tasks/*.yml`
54+
55+
## Workspace Configuration
56+
57+
```yaml
58+
# .moon/workspace.yml
59+
$schema: "https://moonrepo.dev/schemas/workspace.json"
60+
61+
projects:
62+
- "apps/*"
63+
- "packages/*"
64+
65+
vcs:
66+
client: "git"
67+
defaultBranch: "main"
68+
69+
pipeline:
70+
archivableTargets:
71+
- ":build"
72+
cacheLifetime: "7 days"
73+
```
74+
75+
## Project Configuration
76+
77+
```yaml
78+
# moon.yml
79+
$schema: "https://moonrepo.dev/schemas/project.json"
80+
81+
language: "typescript"
82+
layer: "application" # v2: 'type' renamed to 'layer'
83+
stack: "frontend"
84+
tags: ["react", "graphql"]
85+
86+
dependsOn:
87+
- "shared-utils"
88+
- id: "api-client"
89+
scope: "production"
90+
91+
fileGroups:
92+
sources:
93+
- "src/**/*"
94+
tests:
95+
- "tests/**/*"
96+
97+
tasks:
98+
build:
99+
command: "vite build"
100+
inputs:
101+
- "@group(sources)"
102+
outputs:
103+
- "dist"
104+
deps:
105+
- "^:build"
106+
107+
dev:
108+
command: "vite dev"
109+
preset: "server"
110+
111+
# v2: Use 'script' for shell features (pipes, redirects)
112+
lint:
113+
script: "eslint . && prettier --check ."
114+
115+
test:
116+
command: "vitest run"
117+
inputs:
118+
- "@group(sources)"
119+
- "@group(tests)"
120+
```
121+
122+
### Layer Types (v2)
123+
124+
| Layer | Description |
125+
| --------------- | --------------------- |
126+
| `application` | Apps, services |
127+
| `library` | Shareable code |
128+
| `tool` | CLIs, scripts |
129+
| `automation` | E2E/integration tests |
130+
| `scaffolding` | Templates, generators |
131+
| `configuration` | Infra, config |
132+
133+
## Task Configuration
134+
135+
### Task Fields
136+
137+
| Field | Description |
138+
| --------- | ------------------------------------ |
139+
| `command` | Command to execute (string or array) |
140+
| `args` | Additional arguments |
141+
| `deps` | Task dependencies |
142+
| `inputs` | Files for cache hashing |
143+
| `outputs` | Files to cache |
144+
| `env` | Environment variables |
145+
| `extends` | Inherit from another task |
146+
| `preset` | `server` or `utility` |
147+
148+
### Task Inheritance
149+
150+
Tasks can be inherited globally via `.moon/tasks/*.yml`:
151+
152+
```yaml
153+
# .moon/tasks/node.yml
154+
inheritedBy:
155+
toolchains: ["javascript", "typescript"]
156+
157+
fileGroups:
158+
sources: ["src/**/*"]
159+
160+
tasks:
161+
lint:
162+
command: "eslint ."
163+
inputs: ["@group(sources)"]
164+
```
165+
166+
Projects control inheritance:
167+
168+
```yaml
169+
# moon.yml
170+
workspace:
171+
inheritedTasks:
172+
include: ["lint", "test"]
173+
exclude: ["deploy"]
174+
rename:
175+
buildApp: "build"
176+
```
177+
178+
### Task Options
179+
180+
```yaml
181+
tasks:
182+
example:
183+
command: "cmd"
184+
options:
185+
cache: true # Enable caching
186+
runInCI: "affected" # affected, always, only, false
187+
persistent: true # Long-running process
188+
retryCount: 2 # Retry on failure
189+
timeout: 300 # Seconds
190+
mutex: "resource" # Exclusive lock
191+
priority: "high" # critical, high, normal, low
192+
```
193+
194+
### Input Tokens
195+
196+
```yaml
197+
inputs:
198+
- "@group(sources)" # File group
199+
- "@globs(tests)" # Glob patterns
200+
- "/tsconfig.base.json" # Workspace root file
201+
- "$NODE_ENV" # Environment variable
202+
```
203+
204+
## Toolchain Configuration
205+
206+
```yaml
207+
# .moon/toolchains.yml (v2: plural)
208+
$schema: "https://moonrepo.dev/schemas/toolchains.json"
209+
210+
# JavaScript ecosystem (v2: required for node/bun/deno)
211+
javascript:
212+
packageManager: "pnpm"
213+
inferTasksFromScripts: false
214+
215+
node:
216+
version: "20.10.0"
217+
218+
pnpm:
219+
version: "8.12.0"
220+
221+
# Alternative runtimes
222+
bun:
223+
version: "1.0.0"
224+
225+
deno:
226+
version: "1.40.0"
227+
228+
typescript:
229+
syncProjectReferences: true
230+
routeOutDirToCache: true
231+
232+
rust:
233+
version: "1.75.0"
234+
bins: ["cargo-nextest", "cargo-llvm-cov"]
235+
236+
go:
237+
version: "1.21.0"
238+
239+
python:
240+
version: "3.12.0"
241+
```
242+
243+
### Toolchain Tiers
244+
245+
| Tier | Description | Examples |
246+
| ---- | ---------------------- | ------------------------------------ |
247+
| 3 | Full management | Node.js, Bun, Deno, Rust, Go, Python |
248+
| 2 | Ecosystem integration | PHP, Ruby |
249+
| 1 | Project categorization | Bash, Batch |
250+
| 0 | System execution | Custom tools |
251+
252+
## CI Integration
253+
254+
```yaml
255+
# GitHub Actions
256+
- uses: actions/checkout@v4
257+
with:
258+
fetch-depth: 0 # Required for affected detection
259+
260+
- uses: moonrepo/setup-toolchain@v0
261+
with:
262+
auto-install: true
263+
264+
- run: moon ci :build :test
265+
266+
- uses: moonrepo/run-report-action@v1
267+
if: success() || failure()
268+
with:
269+
access-token: ${{ secrets.GITHUB_TOKEN }}
270+
```
271+
272+
### Parallelization with Matrix
273+
274+
```yaml
275+
strategy:
276+
matrix:
277+
shard: [0, 1, 2, 3]
278+
279+
steps:
280+
- run: moon ci --job ${{ matrix.shard }} --job-total 4
281+
```
282+
283+
### Affected Detection
284+
285+
```bash
286+
moon run :test --affected # Only affected projects
287+
moon run :lint --affected --status staged # Only staged files
288+
moon ci :test --base origin/main # Compare against base
289+
moon query changed-files # v2: renamed from touched-files
290+
```
291+
292+
## Docker Support
293+
294+
```bash
295+
moon docker scaffold <project> # Generate Docker layers
296+
moon docker setup # Install toolchain in Docker
297+
moon docker prune # Prune for production
298+
moon docker file <project> # Generate Dockerfile
299+
```
300+
301+
## Moon Query Language (MQL)
302+
303+
```bash
304+
# Filter projects
305+
moon query projects "language=typescript && projectType=library"
306+
moon run :build --query "tag=react"
307+
308+
# Operators: =, !=, ~, !~, &&, ||
309+
# Fields: project, language, stack, tag, task, taskType
310+
```
311+
312+
## Additional Resources
313+
314+
For detailed configuration options, consult:
315+
316+
- **`references/workspace-config.md`** - Complete workspace.yml reference
317+
- **`references/task-config.md`** - Task configuration and inheritance patterns
318+
- **`references/v2-migration.md`** - v1 to v2 migration guide
319+
- **`references/cli-reference.md`** - Full CLI command reference
320+
321+
### Examples
322+
323+
- **`examples/workspace.yml`** - Complete workspace configuration
324+
- **`examples/moon.yml`** - Full project configuration
325+
- **`examples/ci-workflow.yml`** - GitHub Actions CI workflow

0 commit comments

Comments
 (0)