Repository navigation
Description
Problem
There is no local instance an agent can start, keep alive across turns and tear down cleanly. The runner is also the port's first Effect 4 code and the harness every later port PR is smoked on, so it lands before any package moves.
Do
An Effect 4 CLI under scripts/ (e.g. scripts/dev/), entry pnpm dev. Requirements from Local dev environment and Dev runner supervisor prototype (branch prototype/dev-runner-supervisor is throwaway reference, not a base):
- Plan: per-worktree ports from a hash of the worktree path (scan upward for a free port); per-worktree state in
<worktree>/.local/dev/(Postgres data, logs,env,plan.json).--dry-run --jsonprints the resolvedPlan(an EffectSchema) with no side effects;plan.jsonis the same document. First tests are plan-computation tests (hash → ports, worktree detection) with no processes. - Start is idempotent and end to end: compute plan →
initdb --no-syncif missing → start embedded Postgres → run migrations → seed → start the server → write.local/dev/env+plan.json→ print the plan. Spawn the supervisordetached+unref, run undernode --import tsx(never thetsxwrapper) so the recorded pid is the one signals reach; poll/healthz. - Supervisor: one Effect scope owning every handle — Postgres via
acquireRelease, each service viaeffect/unstable/processspawnwithkillSignal: SIGTERM+forceKillAfter; any service's exit closes the scope. Env goes straight to each child; log lines carry one[service]prefix. Turbo is not on the dev path. - Subcommands:
status,stop(SIGTERM only the pidsplan.jsonrecords, keep state),logs,reset(stop + wipe.local/dev/+ re-initdb). Always scoped to the current worktree. - Seed: one dev company + one working token, the token written into
.local/dev/env(PATCHY_API_URL,PATCHY_API_TOKEN) so the CLI works right afterpnpm dev. Seeds are SQL fixtures; the same module feeds the vitestglobalSetupfrom #39. - Migrations run through today's
packages/dbrunner via a thin adapter; thesqlticket swaps it for Effect'sMigrator. - Server startup stays Fastify; the runner only spawns it.
docs/DEVELOPMENT.mddocumentspnpm dev, the subcommands and.local/dev/;.local/is gitignored.
Conventions: .agents/skills/effect-service-conventions/SKILL.md; namespace imports; Schema.TaggedError failures; NodeRuntime.runMain maps SIGINT/SIGTERM to interruption. Promote the language-service warning rules to error for scripts/dev.
Done when
pnpm dev from two worktrees runs two instances side by side; stop leaves the other untouched; reset gives a fresh seeded instance; --dry-run --json is stable and tested; the CLI, pointed at .local/dev/env by hand (PATCHY_API_URL/token exported), can whoami and upload.
Decisions implemented
Local dev environment, Dev runner supervisor prototype, spec §11.
Filed from the Effect v4 port spec (#68) by the map task Write the port spec and file the build tickets.
Activity