Skip to content

CLI reference

Sadie’s scripts live in the root package.json and are fanned out to workspace packages by Turbo where appropriate. Package manager is [email protected].

The one-command bootstrap at the repo root. Installs dependencies if missing, confirms .env.local exists, and launches pnpm dev:all: Next.js + Yjs collab + scheduler in one shell.

Terminal window
./sadie

Prints a short banner with the three local URLs and exits cleanly on Ctrl-C.

Runs Next.js dev server against apps/app on localhost:3000.

Terminal window
pnpm dev

Backed by next dev -p 3000 in the app workspace. Only process that runs; Studio multiplayer and the cadence scheduler are not included.

Runs the Yjs y-websocket server at scripts/collab-server.mjs. Required for Studio multiplayer; optional for solo editing (y-indexeddb persists locally).

Terminal window
pnpm dev:collab

Default bind ws://127.0.0.1:1234. Override with COLLAB_HOST / COLLAB_PORT.

Runs the cadence scheduler at scripts/scheduler.mjs. Periodically POSTs to /api/compile/run and /api/feeds/refresh-all using SADIE_CRON_SECRET.

Terminal window
pnpm dev:scheduler

Loads env via --env-file=.env.local. Without the cron secret, it logs and no-ops.

All three (dev, dev:collab, dev:scheduler) in one shell via concurrently. This is what ./sadie wraps.

Terminal window
pnpm dev:all

Turbo-fanned build across the workspace.

Terminal window
pnpm build

For the Cloudflare deploy target, use the app-specific script:

Terminal window
pnpm --filter @sadie/app build:cf

Which runs next build followed by @opennextjs/cloudflare build. See Cloudflare Pages deploy.

Turbo-fanned lint. In the app, this is eslint . --ext .ts,.tsx --max-warnings=0: zero tolerance.

Terminal window
pnpm lint

Turbo-fanned tsc --noEmit. Catches type errors across the whole monorepo without producing artifacts.

Terminal window
pnpm typecheck

Turbo-fanned test. In the app, runs tsx --test tests/**/*.test.ts.

Terminal window
pnpm test

Replays packages/db/drizzle/*.sql against DATABASE_URL in order. Production-safe and idempotent.

Terminal window
pnpm db:migrate

See Migrations.

Diffs packages/db/src/schema.ts against the live database and applies the changes directly, without recording a migration. Destructive for renames; use on empty databases only.

Terminal window
pnpm db:push

Wipes the database and re-seeds demo fixtures: seven wiki entries, two briefs, eight sources, five feeds, ten feed items, three Studio documents, two conversations, nine activity events, three discourse opportunities.

Terminal window
pnpm db:reset

Useful for resetting dev state to a known baseline. Runs apps/app/scripts/reset.ts with .env.local loaded.

CI gate. Spawns next dev, bootstraps a session cookie, curls every canonical route (Today / Chats / Studio / Memory graph+wiki+sources+briefs+soul+activity / Feeds / Access / Settings), asserts every response is 200, and checks /api/internal/health. Exits non-zero on failure.

Terminal window
pnpm verify:health

Implementation at scripts/verify-health.mjs.

Drill into one package by filtering:

Terminal window
# app only
pnpm --filter @sadie/app dev
pnpm --filter @sadie/app build
pnpm --filter @sadie/app lint
pnpm --filter @sadie/app typecheck
pnpm --filter @sadie/app test
pnpm --filter @sadie/app build:cf
pnpm --filter @sadie/app deploy # build:cf + wrangler pages deploy
# db only
pnpm --filter @repo/db db:migrate
pnpm --filter @repo/db db:push
pnpm --filter @repo/db exec drizzle-kit generate

turbo.json at the repo root controls the fan-out. build, lint, typecheck, test each declare their inputs and the workspaces they apply to. Running a top-level script (pnpm lint) invokes the workspace-level script (eslint in the app, etc.) through Turbo’s cache.