From 1cccff8031ecfcd74384dd53894829ec6d4b76f5 Mon Sep 17 00:00:00 2001 From: Callum Alpass Date: Tue, 3 Nov 2026 01:12:17 +1100 Subject: [PATCH] Rename to t3tui The command, package, env vars (T3TUI_*), config folder, tmux session and the session label it issues itself. An existing ~/.config/tui3 moves to ~/.config/t3tui on the first run. --- README.md | 26 +++++++++++++------------- bun.lock | 2 +- docs/development.md | 16 ++++++++-------- docs/reference.md | 20 ++++++++++---------- package.json | 4 ++-- scripts/build.ts | 2 +- scripts/demo-capture.tsx | 12 ++++++------ src/bin.ts | 32 +++++++++++++++++--------------- src/client/auth.ts | 39 +++++++++++++++++++++++---------------- src/client/rpc.ts | 4 ++-- src/client/session.ts | 8 ++++---- src/config.ts | 24 ++++++++++++------------ src/model/alerts.ts | 2 +- src/model/composerMenu.ts | 2 +- src/model/details.ts | 6 +++--- src/model/settings.ts | 12 ++++++------ src/model/threadMenu.ts | 12 ++++++------ src/model/timeline.ts | 2 +- src/mux/tmux.ts | 10 +++++----- src/ui/App.tsx | 8 ++++---- src/ui/SettingsView.tsx | 4 ++-- src/ui/ThreadView.tsx | 8 ++++---- src/ui/editor.ts | 2 +- src/ui/terminalAttach.ts | 6 +++--- src/ui/terminalOut.ts | 4 ++-- src/ui/useDetails.ts | 4 ++-- src/ui/useThreadMenu.ts | 4 ++-- test/app/harness.tsx | 6 +++--- test/automations.test.ts | 2 +- test/commands.test.ts | 2 +- 30 files changed, 147 insertions(+), 138 deletions(-) diff --git a/README.md b/README.md index ad9dd58..1a45b71 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,23 @@ -# tui3 +# t3tui **A TUI for a GUI for TUIs.** -Claude Code and Codex run in a terminal. [T3 Code](https://github.com/pingdotgg/t3code) gives them a proper app, with your threads, worktrees, diffs and approvals in one window, which is a lot nicer than keeping track of a dozen terminal tabs. tui3 takes that app and puts it back in a terminal. +Claude Code and Codex run in a terminal. [T3 Code](https://github.com/pingdotgg/t3code) gives them a proper app, with your threads, worktrees, diffs and approvals in one window, which is a lot nicer than keeping track of a dozen terminal tabs. t3tui takes that app and puts it back in a terminal. -It works anywhere you can get a shell, so you can check on a run over SSH from a laptop or your phone, or from a server you were already logged into. `tui3 tmux --watch` mirrors each active thread into its own tmux window, which you can detach from and come back to later. Everything is on the keyboard (`j`/`k` between threads, `y` to approve, `D` for the diff, `ctrl+k` for the rest), and `tui3 list --json` gives scripts something to read. Since it talks to the same server as the app, you can start a run in one and carry on in the other without anything needing to sync. +It works anywhere you can get a shell, so you can check on a run over SSH from a laptop or your phone, or from a server you were already logged into. `t3tui tmux --watch` mirrors each active thread into its own tmux window, which you can detach from and come back to later. Everything is on the keyboard (`j`/`k` between threads, `y` to approve, `D` for the diff, `ctrl+k` for the rest), and `t3tui list --json` gives scripts something to read. Since it talks to the same server as the app, you can start a run in one and carry on in the other without anything needing to sync. -tui3 doesn't have to do much. T3 Code's server runs the agents and keeps track of sessions, worktrees, checkpoints, approvals, terminals and pull requests. tui3 connects to the server you already have running, speaks its WebSocket protocol, and applies updates with upstream's own types and reducers, so mostly it draws what T3 Code already knows and sends back what you type. That's why it was quick to build, and why it tends to stay in step with the app. Credit for the parts that work goes to T3 Code; anything that looks wrong is probably tui3's fault. +t3tui doesn't have to do much. T3 Code's server runs the agents and keeps track of sessions, worktrees, checkpoints, approvals, terminals and pull requests. t3tui connects to the server you already have running, speaks its WebSocket protocol, and applies updates with upstream's own types and reducers, so mostly it draws what T3 Code already knows and sends back what you type. That's why it was quick to build, and why it tends to stay in step with the app. Credit for the parts that work goes to T3 Code; anything that looks wrong is probably t3tui's fault. -Built with Bun and [OpenTUI](https://github.com/anomalyco/opentui) (React). tui3 is an unofficial project, not made by or affiliated with the T3 Code team. +Built with Bun and [OpenTUI](https://github.com/anomalyco/opentui) (React). t3tui is an unofficial project, not made by or affiliated with the T3 Code team. ## Install You need [Bun](https://bun.sh) and a T3 Code server running on the same machine (or a token for a remote one; see [How it connects](#how-it-connects)). ```sh -git clone --recurse-submodules https://github.com/callumalpass/tui3.git && cd tui3 +git clone --recurse-submodules https://github.com/callumalpass/t3tui.git && cd t3tui bun install # also links the pinned T3 Code packages into node_modules and builds dist/ -bun link # optional: puts `tui3` on your PATH +bun link # optional: puts `t3tui` on your PATH ``` After pulling changes, run `bun run build` (or `bun install`) to rebuild. @@ -25,13 +25,13 @@ After pulling changes, run `bun run build` (or `bun install`) to rebuild. ## Use ```sh -tui3 # dashboard: threads on the left, the selected thread on the right -tui3 attach # one thread, full screen (id, short id from `tui3 list`, or title text) -tui3 list [--json] # print threads and exit -tui3 tmux [--watch] # mirror active threads into a tmux session, one window each +t3tui # dashboard: threads on the left, the selected thread on the right +t3tui attach # one thread, full screen (id, short id from `t3tui list`, or title text) +t3tui list [--json] # print threads and exit +t3tui tmux [--watch] # mirror active threads into a tmux session, one window each ``` -The message box is always at the bottom. tui3 has two modes: **typing**, where keys go to the message box, and **navigation**, where single keys act. `esc` switches to navigation; `i`, `enter` or `tab` switch back. +The message box is always at the bottom. t3tui has two modes: **typing**, where keys go to the message box, and **navigation**, where single keys act. `esc` switches to navigation; `i`, `enter` or `tab` switch back. The keys you'll use most: @@ -57,7 +57,7 @@ See [docs/reference.md](docs/reference.md) for every key, the message box, diffs ## How it connects -tui3 finds the local T3 Code server from `~/.t3/userdata/server-runtime.json` (override with `TUI3_SERVER`). On first run it issues itself a session with `t3 auth session issue --label tui3`, scoped to what it needs, and stores it in `~/.config/tui3/credentials.json`. Revoke it any time with `t3 auth session revoke`. For a remote server, pass a token in `TUI3_TOKEN`. +t3tui finds the local T3 Code server from `~/.t3/userdata/server-runtime.json` (override with `T3TUI_SERVER`). On first run it issues itself a session with `t3 auth session issue --label t3tui`, scoped to what it needs, and stores it in `~/.config/t3tui/credentials.json`. Revoke it any time with `t3 auth session revoke`. For a remote server, pass a token in `T3TUI_TOKEN`. The scopes, the protocol and how to update for a newer T3 Code are in [docs/development.md](docs/development.md). diff --git a/bun.lock b/bun.lock index 17961d1..7089e83 100644 --- a/bun.lock +++ b/bun.lock @@ -3,7 +3,7 @@ "configVersion": 1, "workspaces": { "": { - "name": "tui3", + "name": "t3tui", "dependencies": { "@opentui/core": "0.2.7", "@opentui/react": "0.2.7", diff --git a/docs/development.md b/docs/development.md index 8f3a2db..30dcb35 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,26 +1,26 @@ -# Developing tui3 +# Developing t3tui ## Running from source -`tui3` runs the bundle in `dist/`, which uses over 100 MB less memory than the sources. After pulling changes, run `bun run build` (or `bun install`) to rebuild it; `bun run dev` runs the sources directly. +`t3tui` runs the bundle in `dist/`, which uses over 100 MB less memory than the sources. After pulling changes, run `bun run build` (or `bun install`) to rebuild it; `bun run dev` runs the sources directly. -Set `TUI3_DEBUG=/path/to/log` to log thread subscriptions and snapshots. +Set `T3TUI_DEBUG=/path/to/log` to log thread subscriptions and snapshots. ## How it connects -- It finds the local server from `~/.t3/userdata/server-runtime.json` (override with `TUI3_SERVER`). -- On first run it mints its own bearer session with `t3 auth session issue --label tui3`, scoped to `orchestration:read`, `orchestration:operate` (attachments and automations ride on it), `filesystem:read` (diffs), `source-control:write` (git actions), `terminal:read` and `terminal:operate` (terminals, stopping servers), `diagnostics:read` (usage totals) and `providers:manage` (reset credits), and stores it in `~/.config/tui3/credentials.json` (mode 600). A stored credential missing any of these scopes is replaced with a new one. Revoke it any time with `t3 auth session revoke`. For a remote server, pass a token in `TUI3_TOKEN`. +- It finds the local server from `~/.t3/userdata/server-runtime.json` (override with `T3TUI_SERVER`). +- On first run it mints its own bearer session with `t3 auth session issue --label t3tui`, scoped to `orchestration:read`, `orchestration:operate` (attachments and automations ride on it), `filesystem:read` (diffs), `source-control:write` (git actions), `terminal:read` and `terminal:operate` (terminals, stopping servers), `diagnostics:read` (usage totals) and `providers:manage` (reset credits), and stores it in `~/.config/t3tui/credentials.json` (mode 600). A stored credential missing any of these scopes is replaced with a new one. Revoke it any time with `t3 auth session revoke`. For a remote server, pass a token in `T3TUI_TOKEN`. - It speaks T3 Code's own WebSocket RPC protocol, typed by upstream's `@t3tools/contracts`, and applies thread updates with upstream's own reducers. Both come from `vendor/t3code`, a submodule pinned to the server version this was built against (`v0.1.6-nightly.20261030.3917`). ## Following the web app -tui3 aims to behave like T3 Code's web app: the same sidebar sections and status words, timeline, thread menu, palette scoring, alert rules, setting names and defaults (except the two alert settings), attachment limits, and editor fallback order. Where it can, it uses the web app's own code from `vendor/t3code` rather than reimplementing it. When a behaviour differs, that's either a gap (listed under "Not yet supported" in the README) or a terminal constraint, such as links showing as raw markdown in the message box instead of chips. +t3tui aims to behave like T3 Code's web app: the same sidebar sections and status words, timeline, thread menu, palette scoring, alert rules, setting names and defaults (except the two alert settings), attachment limits, and editor fallback order. Where it can, it uses the web app's own code from `vendor/t3code` rather than reimplementing it. When a behaviour differs, that's either a gap (listed under "Not yet supported" in the README) or a terminal constraint, such as links showing as raw markdown in the message box instead of chips. -Some gaps come from the pinned server rather than tui3: it doesn't publish update-available or shutting-down events, historical checkpoint diffs have no unchanged context, and the open-in-editor RPC has no line argument. +Some gaps come from the pinned server rather than t3tui: it doesn't publish update-available or shutting-down events, historical checkpoint diffs have no unchanged context, and the open-in-editor RPC has no line argument. ## Updating for a newer T3 Code -The protocol packages are private and change without notice, so tui3 tracks a pinned upstream tag: +The protocol packages are private and change without notice, so t3tui tracks a pinned upstream tag: ```sh cd vendor/t3code && git fetch --depth 1 origin tag && git checkout && cd - diff --git a/docs/reference.md b/docs/reference.md index 57a774e..9a417ce 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -1,6 +1,6 @@ -# tui3 reference +# t3tui reference -Everything tui3 does, by area. Most of it is also in the command palette (`ctrl+k`), which lists every action and its key. +Everything t3tui does, by area. Most of it is also in the command palette (`ctrl+k`), which lists every action and its key. - [Modes](#modes) - [Keys](#keys) @@ -18,7 +18,7 @@ Everything tui3 does, by area. Most of it is also in the command palette (`ctrl+ ## Modes -The message box is always at the bottom. tui3 has two modes: **typing**, where keys go to the message box, and **navigation**, where single keys act. `esc` switches to navigation; `i`, `enter` or `tab` switch back. Drafts are kept per thread. +The message box is always at the bottom. t3tui has two modes: **typing**, where keys go to the message box, and **navigation**, where single keys act. `esc` switches to navigation; `i`, `enter` or `tab` switch back. Drafts are kept per thread. ## Keys @@ -105,8 +105,8 @@ The layout follows T3 Code's web app, and much of it uses the web app's own code - **Find in thread:** `f`, or `Find in thread` in the palette or thread menu, searches the whole conversation, counts matches, highlights them, and loads earlier history to reach the selected one. Matching Markdown shows as plain text while you search. - **Archived threads:** `A` or `Show archived threads` opens the archive. Open a thread as usual; `Unarchive thread` in the palette restores it, and `Show active threads` returns to the live list. - **Ordering:** `J` / `K` or `Move pinned thread down` / `up` in the palette reorder pinned threads. Active threads stay ordered by when they came back to you. -- **Read state:** opening a thread marks it read after a moment. Set `TUI3_NO_VISIT=1` to turn that off. -- **Bottom line:** server restarts, update results and migration events flash here, along with reconnect status. If the connection drops, tui3 reconnects and resubscribes on its own; press `r` to retry straight away. +- **Read state:** opening a thread marks it read after a moment. Set `T3TUI_NO_VISIT=1` to turn that off. +- **Bottom line:** server restarts, update results and migration events flash here, along with reconnect status. If the connection drops, t3tui reconnects and resubscribes on its own; press `r` to retry straight away. ## Mouse @@ -149,7 +149,7 @@ Limits: GIF, JPEG, PNG and WebP images up to 10 MB each and 80 MB in all, other ## Terminals -`ctrl+j` attaches to the thread's terminal on the T3 server, the same one the app's terminal drawer shows. If the thread has none, it starts one in the thread's worktree or project folder; with several, you pick one or start another. tui3 hands the whole screen to the terminal; `ctrl+j` or `ctrl+]` comes back, and the terminal keeps running. Its size is shared, so attaching resizes it for anyone else watching. +`ctrl+j` attaches to the thread's terminal on the T3 server, the same one the app's terminal drawer shows. If the thread has none, it starts one in the thread's worktree or project folder; with several, you pick one or start another. t3tui hands the whole screen to the terminal; `ctrl+j` or `ctrl+]` comes back, and the terminal keeps running. Its size is shared, so attaching resizes it for anyone else watching. `T` opens the terminal picker even with only one terminal. Choose `New terminal`, `Close terminal…` or `Clear terminal…`; typing `close` or `clear` finds each terminal's action directly. Closing ends the shell and deletes its history; clearing clears its scrollback. These are in the command palette too. @@ -159,11 +159,11 @@ Limits: GIF, JPEG, PNG and WebP images up to 10 MB each and 80 MB in all, other While a worktree is being prepared, its stage, progress and any failure show above the message box. `Cancel worktree setup…` in the palette asks first. -`E` opens the workspace in an editor on the server. In a single-file diff it opens that file; in a whole-tree diff it asks which file. It picks from the server's available editors in the app's fallback order (tui3 can't see which editor your browser last used), and it can't jump to a line. +`E` opens the workspace in an editor on the server. In a single-file diff it opens that file; in a whole-tree diff it asks which file. It picks from the server's available editors in the app's fallback order (t3tui can't see which editor your browser last used), and it can't jump to a line. ## Alerts -tui3 alerts when a thread you aren't watching finishes or needs you (approval, input, a request, a failure or a usage limit), on the same rules as T3 Code. Subagents don't alert. Depending on `notificationMode`: +t3tui alerts when a thread you aren't watching finishes or needs you (approval, input, a request, a failure or a usage limit), on the same rules as T3 Code. Subagents don't alert. Depending on `notificationMode`: - **Bell:** the terminal bell. - **Desktop notifications:** sent through the terminal (OSC 9, or OSC 99 in kitty), only when the terminal window isn't focused. Under tmux they need `set -g allow-passthrough on`. @@ -172,7 +172,7 @@ While the terminal is focused, alerts for other threads also show on the bottom ## Settings -Open them from the command palette (`Settings`). `j`/`k` move, `enter` or a click changes one, and changes save to `~/.config/tui3/config.json`: +Open them from the command palette (`Settings`). `j`/`k` move, `enter` or a click changes one, and changes save to `~/.config/t3tui/config.json`: | Setting | Choices | Default | | --- | --- | --- | @@ -184,6 +184,6 @@ Open them from the command palette (`Settings`). `j`/`k` move, `enter` or a clic | `inAppNotificationsEnabled` | `true`, `false` | `true` | | `theme` | `auto` (match the terminal), `dark`, `light`; applies from the next start | `auto` | -They have the same names as the app's settings. The app keeps its settings in the browser, so tui3 keeps its own, and turns the two alert settings on by default where the app leaves them off. +They have the same names as the app's settings. The app keeps its settings in the browser, so t3tui keeps its own, and turns the two alert settings on by default where the app leaves them off. The same view shows the server settings that matter here (model and mode for new threads, auto-settle, rate-limited threads), read-only; change those in the app. Below them is usage: each provider's limit windows as room left, its banked reset credits, and the last 30 days' cost and tokens. When a window is 90% used or more, the top line says so. `Use reset credit: …` in the palette spends a banked credit, after asking. diff --git a/package.json b/package.json index ac00ca9..5dc86c2 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "tui3", + "name": "t3tui", "version": "0.0.1", "private": true, "license": "MIT", "type": "module", "bin": { - "tui3": "./dist/bin.js" + "t3tui": "./dist/bin.js" }, "scripts": { "dev": "bun run src/bin.ts", diff --git a/scripts/build.ts b/scripts/build.ts index 503bd9b..320e7f2 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -1,4 +1,4 @@ -// Bundles tui3 into dist/. Running the TypeScript sources makes Bun compile and keep +// Bundles t3tui into dist/. Running the TypeScript sources makes Bun compile and keep // hundreds of vendored modules at startup, which costs over 100 MB of memory. import { rm } from "node:fs/promises"; import { join } from "node:path"; diff --git a/scripts/demo-capture.tsx b/scripts/demo-capture.tsx index ee8c1fa..7f98ab9 100644 --- a/scripts/demo-capture.tsx +++ b/scripts/demo-capture.tsx @@ -50,7 +50,7 @@ const snapshot = { schemaVersion: 1, snapshotSequence: 0, projects: [ - project("project-tui3", "tui3", "/home/dev/projects/tui3"), + project("project-t3tui", "t3tui", "/home/dev/projects/t3tui"), project("project-acme", "acme-api", "/home/dev/projects/acme-api"), project("project-dotfiles", "dotfiles", "/home/dev/dotfiles"), ], @@ -58,7 +58,7 @@ const snapshot = { // The open thread: pinned, running, and waiting on a command approval. thread({ id: OPEN_THREAD, - projectId: "project-tui3", + projectId: "project-t3tui", title: "Bundle into dist/", runtimeMode: "approval-required", status: "running", @@ -95,7 +95,7 @@ const snapshot = { // Waiting for an answer. thread({ id: "thread-resize", - projectId: "project-tui3", + projectId: "project-t3tui", title: "Resize the thread list", status: "running", latestRunId: "run-resize", @@ -136,7 +136,7 @@ const snapshot = { // Idle and read. thread({ id: "thread-tmux", - projectId: "project-tui3", + projectId: "project-t3tui", title: "Add tmux mirror", latestRunRequestedAt: ago(3 * HOUR + 10 * MIN), latestRunStartedAt: ago(3 * HOUR + 10 * MIN), @@ -263,7 +263,7 @@ const projection = { thread: { ...v2Projection.thread, id: OPEN_THREAD, - projectId: "project-tui3", + projectId: "project-t3tui", title: "Bundle into dist/", runtimeMode: "approval-required", createdAt: ago(2 * DAY), @@ -340,7 +340,7 @@ function standalonePage(fragment: string, pageBg: string): string { -tui3 — demo screen +t3tui — demo screen