AGENTS

tcmts.AGENTS · #d3qsl6lz · md file

AGENTS.md

tcm-ts is Unison's content-addressed codebase model for plain TypeScript, plus an app platform on top (inferred client/server placement, server functions, jobs, typed tables). Its docs are pages of its codebase: start with tcmts.docs.README (tcm_view, or the docs site at https://tcm.codes/docs); tcmts.docs.developing has the codebase's layout.

Working in tcm's codebase

tcm is developed in its own codebase, and nowhere else: this repository only says how to get it (pnpm tcm makes codebase/ from tcm's server). There are no source files to edit. With the tcm MCP server (this repository's .mcp.json), use its tools: tcm_status to start, tcm_find, tcm_view and tcm_at to read, tcm_patch for a small change, tcm_edit then tcm_update for a bigger one, tcm_todo, tcm_test. Without it, pnpm tcm <command> is the CLI. The tcm doing this is the last build pnpm verify passed, not the code being changed: tcm_test tests the change, TCM_LIVE=1 pnpm tcm … runs it (from the codebase), and live: true on tcm_edit, tcm_patch, tcm_check, tcm_update, tcm_add and tcm_test uses it, to use a change to tcm before it's verified (tcm_cli with live and cwd runs it on a codebase made for a repro).

Keep the docs current

tcmts.docs documents every user-visible feature, one page per area (index in tcmts.docs.README). It describes what the code does now. Pages are files of the codebase: tcm_edit tcmts.docs.cli writes cli.md to change and save with tcm_update.

Verifying a change

Run pnpm verify when a change is done; it names any failing tests. A change on a session's branch (each MCP session has one: tcm_status names it) is verified there, TCM_BRANCH=<branch> pnpm verify: that checks it all without making it the known-good tcm, which waits for the change to land on main (when the user says to) and main to be verified. Plain pnpm verify checks main. It's a definition in tcm's codebase (tcmts.dev.verify, run with pnpm tcm run): it checks the codebase (tcm todo, tcm verify), runs its test definitions, builds the docs site, and packs tcm-ts and runs the end-to-end tests against that, all side by side. Tests run again only where code they ran changed, so with nothing changed it takes under a second, and a few seconds to a few minutes otherwise.

pnpm test (tcm test) runs the tests the change reaches: the quick check while working.

New behaviour gets a test, written as test definitions (export const testX = () => …). End-to-end tests, running tcm as a program, go in tcmts.cli.test.e2e (helpers in tcmts.cli.test.e2e.harness; each test independent, since each runs as a program of its own, cached by the code it ran); what they need as files they import from the codebase (tcmts.fixtures). Tests that call code directly go in a test namespace beside the code, cached by hash.

Rules

History