tcmts.cli.codebase

test/
1 definitions

Types

Codebase typeof Codebase
CodebaseCore type
What the code `Codebase` itself uses (its views, mirrors, provided packages, kept values, placement) needs of a codebase, as an interface the class has. That code takes this, not the class: a type naming the class would make the two refer to each other, and they'd be hashed as one cycle, every change to one a change to all of them.
LockEntry type
One package lock entry, as codebases exchange them.
Rehashed type
What re-deriving stored definitions found (`Codebase.rehash`): each one's local analysis by the hash it's stored under, those that hash otherwise, and the problems (type errors, where they're asked for).
SaltFor type

Server

fileProblem (rec: DefRecord) => string | undefined
What's wrong with a file definition from another codebase, if anything: its IR must hash to its hash, and its content must be what the IR says (the text between its links, each link to what the IR names; or bytes with the IR's digest).
namedCodebase string | undefined
The codebase `TCM_CODEBASE` names, for running tcm from elsewhere (paths given to it are the caller's). What tcm runs has it too (a tcm run from the codebase finds it), except tests, which work in directories of their own.
openApart (root: string) => Codebase
The codebase in `root`, exactly, on its own branch: neither `TCM_CODEBASE` nor this process's session branch (`TCM_BRANCH`) is its. For a codebase a command makes or serves beside the one it runs in.
registerTransformHook () => void
Compile marked cache modules (enums, namespaces, parameter properties) as this process loads them: once a process, whichever copy of tcm asks (an app of tcm's, opening a codebase, is one), so the hook never comes after another that must see a module first (Flight's, which loads browser code as references).
sessionDirFor (root: string, branch: string) => string
Where a session (a process working on its own branch, `TCM_BRANCH`) keeps what's its own: its scratch files, and the `#codebase` shim they import its branch's names through.
sessionDirsGone (root: string, branches: string[]) => string[]
The session directories (`.tcm/sessions`) that none of `branches` has: left by a session whose branch is gone.
setUpAgents (root: string) => void
So AI agents know how to work here: tcm's MCP server in the project's .mcp.json (its instructions and tools teach the way of working), and a note in AGENTS.md for agents that read that instead. Neither is touched if it already mentions tcm.
unsavedIn (dir: string) => string[]
The scratch files in a directory (a session's) holding work that isn't saved: any with something in it, since saving one deletes it. Code, or a file kept as written that `tcm edit` wrote there (a page, a `Dockerfile`): any but the session's own (its package.json, tsconfig.json and session.json) and declarations.

Shared

IDENT_PATH RegExp
A dotted codebase name: `lib.util.sort`.
TRANSFORM_MARK "// tcm: transform"
augmentationsIn (text: string) => Set<string>
The augmentations a scratch file holds new versions of (`<namespace>.global` and `<namespace>.augments`, for each namespace it writes a `declare global` or `declare module` into): a check of it leaves the stored ones out, which would otherwise declare the same members twice.
needsFixing (cb: Codebase) => { hash: string; message: string; }[]
What needs fixing on this branch, worked out rather than taken from what was recorded: a definition that couldn't follow a change (its record, `Store.todos`, says why) needs fixing only while it's named and still uses a version something newer replaced, or uses another that needs fixing. So nothing's left over when a branch goes back to what it was (`tcm reset`, a merge undone), however the records got there.
transformHookSource (transpile: { url: string; export: string; }) => string
The same hook as a module of its own, for the processes tcm spawns (`node --import ./tcm-transform.js`).

Tests

testSessionDirsGone () => void