studio

tcmts.docs.studio · #uwa2uwou · md file

description`tcm studio`: your codebase in the browser, with live values, traces and agents' branches

The studio

The studio is your codebase in the browser, on your machine: what needs you, code to read, edit and run as a notebook, tests, what tcm is running, how the app runs (its traces), data, branches and agents' sessions, history and releases.

$ tcm studio
tcm studio /home/ada/board
  starting (its first start, and the first after tcm changes, builds it: a few seconds)
  open   http://127.0.0.1:4747/#token=3f9c…  (signs this browser in)

It opens in your browser and stops when tcm studio does.

Starting it

What's in it

The column on the left has its pages.

Overview

What runs worse than its version before and the change that did it; what's running on the codebase (each tcm dev, start, serve and the studio, to open); agents' sessions; scratch files holding work; the last day's answers and errors; what needs fixing; the latest history entries. It refreshes every few seconds.

Code

The codebase's front page, namespaces and definitions, and the finder (⌘K: names, words in docs, types), as the web UI shows them. A definition's page also says how it runs on this machine, from the last day's traces: what runs worse than before and what changed; each version side by side (calls, errors, p50, p95); where its calls came from in the browser; its slowest traces.

Scratch files

Unsaved work, newest first: the .ts and .tsx files beside the codebase, and files kept as written being edited (each with where it goes back). New scratch file makes one.

A scratch file's page is an editor. What you write is saved to the file and checked as you type (a pause, or ⌘S), as the editor checks it:

A scratch file is a notebook. Once the file checks, each statement shows what it comes to (its watch, as tcm check shows it):

Select an expression for Evaluate (what it comes to and prints, without writing a statement; it sees the file's top-level names) or Extract to a definition (a new definition above, named as you say, its free locals as typed parameters, and the expression replaced by a call, awaited if it awaits).

Tests

The codebase's tests by namespace, each with its last outcome as tcm test keeps it (passed, failed, not run as it is now), failures first with what they said, each to Edit or Run it. A package's suites are counted apart. Run all, a namespace's Run them, or the tests a search finds run tcm test on the studio's branch, one run at a time, output shown as it comes.

Libraries

Other codebases' code mounted read-only, as tcm lib lists it: each library's release, who announced it, where it's fetched from, what it reaches outside itself, how much uses it, and what its author and the people you trust say of it (yanks, advisories, reviews).

Packages

The npm packages the codebase runs, as tcm packages lists them: each range with its locked version and how many definitions use it. A package's page has its README, its API (each export's signature and doc), what uses it, license, homepage and types, and Upgrade: the newest versions in its ranges, as tcm upgrade <package> (no hash changes; everything using it is checked again; the lock goes back if anything breaks).

Processes

What tcm runs on the codebase, whoever started it (the studio, a terminal, an editor, an agent), as tcm ps lists it: each tcm dev, start, serve and studio, with its address, branch, process and uptime, to open or stop (as Ctrl-C would; the studio doesn't stop itself). Agents' sessions are here too, with their background jobs.

The codebase's apps that aren't running each have Start: tcm dev <app> on a free port, on the studio's branch, opened once it listens. It keeps running after the studio stops. Its Output has a page of its own (kept in .tcm/studio/logs/<app>.log).

Each app has a page of what it's made of, as tcm build plans it: the server functions its browser code calls, its browser code, the tables its server code reaches (with rows), and its namespace's recurring jobs and tests (to run). The page refreshes every few seconds.

Slots

The machine's slots, shared by every tcm on it (testing):

Traces

What the app did on this machine in the last hour, day or week, as tcm traces says it: what runs worse than its version before and the change that did it; time spent by definition as named now, each row (a definition's, a page's, a statement's) linking to its numbers, versions, callers, and slowest and latest traces; and errors, grouped by the definition that threw them, with the version they began with.

A trace is a waterfall on one clock, from the browser to the SQL: each span under its parent, coloured by where it ran, linked to its definition, with errors under the span that threw them and the jobs it enqueued.

Production shows a deployed server's traces the same way. Set TCM_TRACES_TOKEN where tcm start runs (traces), then give the studio the server's address and the token (kept in .tcm/studio/production.json, readable only by you). It fetches a copy; Fetch again gets a newer one.

Jobs

The app's background jobs on this machine, as tcm jobs lists them: counts of queued, running, done, failed and cancelled (each a filter), and the newest 200 with function, attempts, when it runs or ran, and error. A job's page has its arguments, error and trace, with Retry (or Run again), or Cancel while it's queued, as tcm jobs retry and cancel. Beside them, recurring jobs (every()) with their interval and last run. It refreshes every few seconds.

Data

The app's data on this machine, as tcm data has it: each table declared or holding rows (a test's included), with its columns, row count, rows stored as an older row type, last write, and declaring definition.

A table's page shows its rows 50 at a time:

Click a row to edit it, in a form (each field as its type takes it: text, number, checkbox, date and time, one of its values, JSON for nested data) or as JSON. Save writes it as the table's own writes do: checked against its row type (the reason, if it doesn't fit), recorded with its schema, and refused if it'd share a unique field with another row (which is named). New row starts from what the type needs; Delete asks first. Rows of an older row type are marked, with Migrate them (tcm data migrate <table>).

Releases

The codebase's packages, those with changes since their latest release first (with a finder when there are many), each with its latest release and whether one is waiting.

A package's page shows its next release as things stand:

Releasing is main's only: on another branch, or reading one, the button is gone and the page says why. Below, the releases made, newest first, with their notes, and, on main, Announce (as whom, and where it's fetched from), as tcm release <package>@<version> --announce does (the first time, sign-in opens in the browser). Beside them, the package's namespace, exports and commands. Up to date means nothing under its namespace changed since its last release.

History

The branch's entries and what each changed, as the web UI shows them, optionally narrowed to a namespace.

Branches

The codebase's own branch first, then the others, then agents' sessions (those unchanged for a day folded away), each with when it last changed, how many names differ from the codebase's own, and a contribution proposing it.

While the branch menu reads another branch, its notice has Merge it in and Work on it too. Under tcm dev, the studio serves its session's branch and stays on it: there's no Work on it, and a new branch is only read.

Needs fixing

What tcm todo lists (counted in the column), each with what fixes it:

A merge that left conflicts or broke something waits apart, the branch unchanged until it's settled: the page says so, shows what's left as merged, links the files written to settle it, and has Drop the merge (tcm merge --abort). Once nothing's left, the branch has the merge.

Changing the codebase

Editing, updating, renaming, deleting, settling what needs fixing, release notes, releasing, upgrading packages and starting apps act on the branch the studio serves (the codebase's own; under tcm dev, the session's). While the branch menu reads another branch, they're read-only too. Branch actions (making, merging, switching, deleting) act on the codebase's own branch, whichever is read.

Not the web UI

The studio is built from the web UI's pages, but it's yours alone: only the token's holder uses it, on your machine. That's why it can run the codebase's code and show its traces, which the web UI, open to anyone a --public server lets read, never does.

To work on the studio itself: tcm dev tcmts.studio.App in tcm's codebase.

Not yet

used by