3. Install
You need Node 22.18 or newer (tcm-ts is tested on 24). Everything else comes with it, or is installed when your code first needs it.
3.1 Get tcm
From tcm's server, which runs the last build that passed all of tcm's tests:
curl -fsSLO https://tcm.codes/tcm-ts.tgz && npm install -g ./tcm-ts.tgz
tcm help
That installs the tcm command (also available as tcm-ts). tcm help lists the commands, and
tcm <command> --help shows one's arguments and options.
tcm's own code is a codebase you can read the same way you'll read yours: browse it on the docs site, or get it, history and all (tcm's server is public, so it needs no token):
mkdir tcm-code && cd tcm-code
tcm init && tcm remote add origin https://tcm.codes && tcm pull
tcm find "content-addressed"
To change tcm itself, see contributing.
3.2 Shell completion
Tab completes commands, options and arguments, and the arguments come from your codebase: definition names
for tcm view or tcm run, namespaces for tcm ls, branches for tcm switch, remotes for tcm push.
echo 'source <(tcm complete zsh)' >> ~/.zshrc # or: bash >> ~/.bashrc
tcm complete fish > ~/.config/fish/completions/tcm.fish
tcm complete powershell >> $PROFILE
If you're working on tcm-ts itself, run it straight from the source instead:
alias tcm="node /path/to/tcm-ts/cli/bin/tcm.js"
3.3 Make a codebase
A codebase lives in a directory, the way a git repository does:
mkdir myproject && cd myproject
tcm init
initialized codebase in /Users/you/myproject/.tcm next: run `tcm` and edit scratch.ts
tcm init creates:
.tcm/: the codebase itself (code, names, history), and things generated from it;package.json, with the#codebaseimport your files use to reach stored definitions;tsconfig.json, so your editor's TypeScript agrees with tcm's;scratch.ts, a file to start writing in.
Only .tcm/codebase.sqlite holds anything that can't be rebuilt; see files and folders.
3.4 Set up your editor
Any editor works, since you write ordinary TypeScript. In VS Code, the tcm-ts extension shows each definition's status as you type, with buttons to add and update, watch values inline, and your codebase in a sidebar.
3.5 Next
Follow your first codebase.