Skip to content

Scripts

Every pnpm script in the repository root, plus the per-package scripts you run with pnpm --filter. Run root scripts from the repository root.

<!-- source: package.json, packages/db/package.json, services/web/package.json, services/mcp/package.json -->

Setup and running

ScriptDoes
pnpm bootstrapfirst-run setup: checks Node, pnpm and Docker; copies each .env.example to .env without overwriting; installs; starts Supabase; fills blank local values; applies migrations
pnpm bootstrap --no-supabasethe same without Docker or Supabase; bring your own Postgres and set DATABASE_URL / DIRECT_URL
pnpm devruns the web app and the api in watch mode
pnpm buildbuilds every package (runs pnpm gen first)
pnpm preflightchecks a deployment's configuration and exits 0 when it is safe to start
pnpm dev:guardedpnpm dev, started only once preflight passes
pnpm dev:toolslists the local consoles; pnpm dev:tools <name> opens one
pnpm dev:tools:mailopens Inbucket, the local mail catcher
pnpm dev:tools:supabaseopens Supabase Studio
pnpm dev:tools:dbopens Prisma Studio
pnpm dev:tools:allopens all three
pnpm enable:dev-flagsturns on, for the local database only, the flags a developer normally wants (wiki, chat, public API, service accounts, query language, public forms). Refuses to run in production

Code generation

ScriptDoes
pnpm genruns gen:schema, gen:events and gen:routers in that order
pnpm gen:schemaassembles packages/db/prisma/schema.prisma from base.prisma and each module's prisma/*.prisma fragment
pnpm gen:eventsregenerates the DomainEvent union from each manifest module's contracts/events.ts
pnpm gen:routersregenerates the api's tRPC app router from each manifest module's router
pnpm gen:module <name> --tier core|extendedscaffolds a new package and adds it to modules.manifest.ts

Database

ScriptDoes
pnpm db:migrateapplies committed migrations (prisma migrate deploy)
pnpm db:resetdrops the local database and re-applies every migration
pnpm --filter @monark/db db:migrate:devcreates a migration from schema changes and applies it
pnpm --filter @monark/db db:generateregenerates the Prisma client (also runs on install)
pnpm --filter @monark/db db:studioopens Prisma Studio
pnpm --filter @monark/db db:seedruns the seed script

Tests and coverage

ScriptDoes
pnpm testunit and component tests in every workspace package
pnpm test:integrationintegration tests against a throwaway Postgres container, one package at a time; needs Docker
pnpm test:e2ePlaywright end-to-end tests in services/web; needs the full stack running
pnpm test:toolstests for the repository scripts in tools/
pnpm test:coveragepnpm test with coverage written to each package's coverage/unit/
pnpm test:integration:coveragepnpm test:integration with coverage written to coverage/integration/
pnpm coverage:mergemerges unit and integration coverage per package and fails on any package below its floor
pnpm coverage:suggestprints suggested floors derived from the last coverage run
pnpm webhook-receiverstarts a local webhook receiver on port 4123 (--secret, --fail-once, --port, --quiet)

Checks

ScriptFails when
pnpm lintESLint reports a problem
pnpm typecheckTypeScript reports an error
pnpm check:tiersan extended module depends on another extended module or edits the core schema
pnpm check:modulesa module is missing from the manifest, or lacks a README, contracts/events.ts or an integration suite
pnpm check:i18na locale catalog's keys differ from en.json
pnpm check:mcpa public API route has no MCP decision, or a tool name is malformed or duplicated
pnpm check:changeloga changelog.d/ fragment is misnamed or its date doesn't match its entry
pnpm check:migrationsthe migrations don't reproduce schema.prisma; needs SHADOW_DATABASE_URL
pnpm format:checka file isn't Prettier-formatted (pnpm format fixes it)

Operations

ScriptDoes
pnpm sysadmin grant <email>grants the system administrator role; also revoke <email> and list
pnpm provision:orgcreates the single organization from the INITIAL_ORG_* variables; idempotent
pnpm changelog:compilerebuilds CHANGELOG.md from changelog.d/ (CI runs it on develop)
pnpm agent <command>the contributor toolkit: worktrees, port slots, the pre-PR gate, opening PRs

Per-package

ScriptDoes
pnpm --filter <package> test:integrationone package's integration suite
pnpm --filter web screenshotsrenders components in isolation for visual checks
pnpm --filter @monark/mcp buildbundles the MCP server into services/mcp/dist/index.js

Related