Repository navigation
Description
Part of #193. Implements spec §13 (the dev runtime) and the dev half of §7; decisions Dev is local, on real code, with fixtures, the PGlite research, What init pulls from the server § patchy dev for agents, The tables surface § Dev follows production and Tier 1 serving § Dev serves production. The init prototype's patchy dev (PR #187) is the shape to lift; the repo's own pnpm dev runner is the daemon shape.
What to build
patchy/dev in packages/patchy: the dev runtime composing runtime, primitives, integrations (dev layers) and company-database (PGlite layer) with a filesystem content store under .patchy/dev/, serving @patchy/serving/shell, never importing apps/server.
patchy dev [--foreground]: the release check (new starts refuse an outdated pin, CLI or runtime; a running session is never killed by a release); authenticate and bind the viewer from/api/meas the machine token's user; pullGET /api/patches/:id/inventorywhenpatchy.jsonhas an id and the declaration metadata, regenerate declarations (ticket 11's generation); execute the config and provision into PGlite with the same additive diff and refusals (before the first publish the local database is disposable and recreated on every schema change; after it, the baseline is the published inventory); loadfixtures/postgres-<handle>.sqlinto one PGlite per connection andfixtures/shared-<alias>.sqlinto a local copy of the source's inventory definition (a declaration with no fixture file fails naming the file); run Vite in build-watch mode producing the same single-file bundle publish would; serve the production shell, CSP, sandbox and broker at the by-id content URL; swap the bundle atomically and reload the whole shell at the current route after each build; exposePOST /api/runtime/calland the bytes routes locally with the same admission minus Clerk. Detached and idempotent, exits 0 only when healthy, prints one URL, the log path and the stop command. State and daemon identity under.patchy/dev/, scoped to repo and instance; a stale record never kills an unrelated process.patchy dev status,stop,logs,reset(wipes local rows and files, never the baseline), each with--json.- Dev-loop calls are not logged; the keyring and the runtime log store are never loaded.
Done when
- On ticket 11's tree,
patchy devprovisions the starter table in a few seconds; the browser at the printed URL inserts and lists through the real broker; a file uploads and renders throughurl(name); code that fetches, useslocalStorageor opens a popup fails exactly as in production. - A schema change publish would refuse is refused at
devstart with the same message once the repo has a published id; before the id, the local database is recreated. devtwice is one daemon;stopends it; a stale pid file for a dead process is cleaned;resetempties rows and files and keeps the baseline;--foregroundstreams logs.- A Postgres declaration with its fixture answers
listandquerylocally; a shared-table declaration reads its fixture rows; without a fixture file,devfails naming it. - The prototype's fresh-agent run on the laid-down tree reaches a local insert and a publish without editing
_generated/, touching production or re-installing. - The
patchy-dev-loopskill anddocs/DEVELOPMENT.mdsay how a maintainer runs a patch repo against a worktree's instance.
Surfaces
The CLI (README, ADR-0004 for dev and its subcommands), the dev loop (docs/DEVELOPMENT.md, patchy-dev-loop), vocabulary (Dev runtime, Environment, Fixture), docs/product.md § Building a patch (the dev loop) and § Integrations › Development.
Activity