files

tcmts.docs.files · #b34qll2c · md file

Files and folders

What tcm init creates, what tcm writes as it works, and what to keep in version control.

myproject/
  package.json            "#codebase" and "#tcm/host" imports; your npm dependencies
  tsconfig.json           compiler options (see compiler options)
  .mcp.json               tcm mcp, the tools AI agents use to work in the codebase (see agents)
  AGENTS.md               a note for agents on working in a codebase (added to, if you have one)
  scratch.ts              where you write; any top-level .ts or .tsx file is a scratch file
  .tcm/
    codebase.sqlite       the codebase: definitions, names, history, branches, patches, todo
    codebase/             the #codebase modules your scratch files import (generated)
    cache/                every definition as a runnable module, by hash, what npm packages' code does
                          (npm-facts/), and server code's copies of the packages it uses (server_modules/:
                          hard links, for React's server environment) (generated)
    src/                  every named definition as a read-only file, for debuggers (generated)
    data/                 app data: tables, sessions, jobs (created when an app first runs)
    apps/                 production builds, by hash (tcm build / tcm start)
    web/, build/          working files for tcm dev and tcm build (generated)
    examples/             doc examples, as runnable modules (generated)
    pack/                 packages made by tcm pack, by package name (generated)
    compiled/             component modules as React Compiler makes them, by their text (generated)
    secret, tls/          the server's session secret and TLS certificate, once there are any
    .gitignore            ignores everything above except codebase.sqlite

What to keep

tcm init writes .tcm/.gitignore, which leaves only codebase.sqlite to commit: generated directories, app data and secrets are all ignored.

The two imports

tcm init adds these to package.json's imports:

Generated modules

.tcm/cache/<hash>.ts holds each definition as a module, with current names spliced in and imports by hash (<hash>.tsx when it uses JSX). Node runs these directly; there's no build step. Modules Node's type stripping can't run (JSX, and enums or namespaces from imported projects) are compiled as they load. You can read them, but there's no need to: tcm view, and in VS Code Go to Definition, show the source.

used by