Repository navigation
feat(opentui): port the legacy TUI to OpenTUI - #2
Merged
Merged
Conversation
Move the legacy TUI's UI-independent code (agent process bridge, event parser, SSH remote quoting, Live UI protocol types, event reducer, state modules, and the logo text) into the new @onpoint-dev-tools/crewcoder-tui-core package. The legacy crewcoder-tui keeps working on top of it and stays published separately. Add @onpoint-dev-tools/crewcoder-opentui (React on OpenTUI 0.9.2, Node >=26.4): - split-footer mode: settled transcript is written once, in order, into the terminal's native scrollback; streaming replies commit finished rows live - centered welcome screen with the big wordmark (composer only on small windows), then a chat layout with the composer pinned to the bottom - Gotham background across the whole window via OSC 11, restored on exit - footer components vendored from termcn (MIT) with fixes, including removal of a global "y" key handler that approved tool calls while typing Switch the crewcoder umbrella to crewcoder-opentui as an optionalDependency so headless VPS and sandbox installs succeed without native binaries. A bare crewcoder now explains how to continue when there is no terminal, the TUI is not installed, or Node.js is too old. Update release checks, the publish workflow order, CI (Node 26 job), and docs.
OpenTUI (crewcoder-opentui): - Slash command palette built on the termcn OpenTUI command palette, with grouped fuzzy search, scrolling, current-value markers, and exact footer sizing (fixes clipped palette and wrong-item selection with groups). - Every legacy picker: sessions, rewind, provider/model/effort, modes and workers, prompts, tool mode, profile, remove-dir, commands, skills, handoff. Picker commands also take a value directly (/effort high). - Remaining legacy commands: branch, compact (+ preview summary editor and auto on/off), export, goal, reload, clear, thinking, identity, full-access, checkpoints, memory, remember, set-budget, add-dir, extensions, plugins, review-summary, why, task, teams, team, approve, deny, approve-plan, follow-up, help. /crew skipped; /sidebar and /file-changes deferred. - Status, on/off, and text-output results show in a vendored termcn alert above the composer until the next key. - Multi-line composer on <textarea>: Enter sends, Shift+Enter / Ctrl+J add a line, grows to 8 lines. - Slate theme, top-first transcript on wide terminals, bottom-pinned on narrow ones, clickable approval buttons, no key-hint row. Shared core (crewcoder-tui-core): - Move provider defaults and CLI result parsers into state/provider-defaults and state/command-results; the legacy UI re-exports them unchanged. Agent: - Automatic checkpoints are opt-in: a missing checkpointsEnabled now means off in config normalization, both TUIs, and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Answer confirm, select, input, and declarative component requests from trusted extensions in a focused footer card; answers go back over the ui_response control channel. Esc cancels the question, not the run. - Question text, option labels, and descriptions wrap; question-model.ts is the single source for rows and footer height; no extension/request ids shown. - Vendor termcn select and confirm without global keyboard handlers; free text uses OpenTUI's native input. - Keep the composer draft when a question or live compaction preview opens. - Key hints read Enter/Esc/PgUp/PgDn. - README: rewrite Not yet ported from the legacy audit; /crew, /sidebar, /file-changes deferred. Add docs/QUESTIONS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Reasoning commits to native scrollback as termcn's thinking-block design: a bordered panel with a "▼ Reasoning" header and muted text. Ported to core renderables because scrollback is not React; always expanded, since committed rows cannot toggle and summaries must stay visible. - Streaming reasoning holds back its last text row and bottom border; the footer tail continues the panel's left border and the spinner reads "Thinking". - Block layout moves from ScrollbackWriter into per-kind BlockViews (scrollback-blocks.ts) that report their stable rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Assistant replies and reasoning render through OpenTUI's native MarkdownRenderable in slate markup.* styles: headings, emphasis, inline code, links, lists, quotes, content-width tables, and fenced code behind a rail. Chosen over termcn markdown, which is React-only (cannot render into scrollback) and lacks fenced code, numbered lists, and tables. - Streaming commits only final rows: blocks the engine reports committed, plus all but the last row of an open paragraph or code block. A test checks that a chunk-streamed document commits exactly the rows of a one-shot render. - Fenced code is plain accent text for now; async tree-sitter highlighting would land after rows are committed. - Docs: SCROLLBACK block views and stable-row rules, TERMCN ported designs, README and AGENTS updates for the Reasoning panel and markdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A turn reads as sections in event order, divided by a blank row: reasoning panel, then the agent's work, then the reply. Consecutive tool calls stack into one work section without spacer rows. - Reasoning panel restyled to the owner's reference: amber border, bold "💭 Reasoning" header, foreground-colored markdown. The streaming footer tail uses the same amber rail. - Tool calls render as icon + bold title sections: "📖 Read File" with the target on the next row, "± Edit File: path" inline, "💻 Run Command" with clamped output. Paths under the workspace are shown relative. Read, edit, and search output is hidden; failures always show their output. - tool-presentation.ts maps CrewCoder, Claude Code, Codex, and MCP-prefixed tool names to one presentation, shared by scrollback (ToolView) and the footer's running tools. - Docs: README, AGENTS, SCROLLBACK, TERMCN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Emit a file_diff event before each mutating tool's tool_execution_end, built from private before/after workspace snapshots, so UIs can show exact diffs for every provider. Controlled by the fileDiffs config key (default on). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parse file_diff events and store the files on the matching running tool block, and track their paths as changed files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace the native-scrollback writer with an alternate-screen scrollbox transcript: reasoning panel, dashed Agent work box with live tool rows, collapsible output (Ctrl+O). - Show inline diffs for edit/write tools across CrewCoder, Claude, and Codex (file_diff events first, tool arguments as fallback), with real line numbers from diff-anchors and Ctrl+T to hide. Shell commands and deleted files never show a diff. - /diff runs the external Hunk viewer on the real terminal. - Use emoji icons only when the terminal reports Unicode widths and no multiplexer; otherwise single-cell icons so they never clip. CREWCODER_TUI_ICONS=emoji|text overrides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add readGitRepoName (the main repository's name, also from linked worktrees and bare repos) and a gitRepo field on the shared TUI state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port more of the legacy UI (tracked in docs/PORT_LIST.md): - Status line under the composer: access, mode or worker, provider/model (effort), the session as <repo> · <first prompt> instead of its raw id, and context usage with cost pinned right. Widths are measured in terminal cells (string-width, pinned to OpenTUI's version). - Prompt history: Up/Down move between composer lines, then recall this session's sent messages and restore the draft. - /repaint (/redraw): full redraw via a resize away and back, since OpenTUI ignores a same-size resize. - /quit, and /ext.<id>.<command> through `crewcoder command run` with arguments after `--`. - Focus gate: keys and pastes are ignored while the terminal is unfocused. CREWCODER_TUI_MOUSE=0 turns mouse reporting off. - Port list records the owner decision to bundle extra Tree-sitter grammars rather than download them at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Move the clipboard helpers (readClipboardImage, readClipboard, writeClipboard) from the legacy UI into tui-core state/clipboard so the OpenTUI UI can use them; the legacy module re-exports them. - Move imagePathsFromText (image paths in typed or dropped text) into state/image-attachment. - Fix re-attaching the same image file: every attach copies into the cache under a new random name, so comparing cache paths never matched. File attachments now record sourcePath, and both UIs check attachedSources() before copying. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tcuts Port more of the legacy UI (tracked in docs/PORT_LIST.md): - Tree-sitter highlighting for fenced code, inline diffs with real line numbers, and read output. Python, Bash, JSON, Rust, Go, YAML, CSS, and HTML grammars are bundled in grammars/ from each grammar's own npm package (wasm + its highlights.scm + LICENSE), pinned by version and SHA-256, registered from absolute local paths; no runtime downloads. scripts/update-grammars.mjs reproduces them. Adds 0.48 MB packed / 3.5 MB unpacked. Unknown languages and line-numbered read output stay plain (docs/SYNTAX.md). - @ path suggestions under the composer: workspace walk ported from legacy, Up/Down/Enter/Tab/Esc, directories stay open for drill-in, off in remote mode. Textarea cursorOffset counts display cells, so text-offset.ts converts before slicing (docs/MENTIONS.md). - Composer shortcuts: Ctrl+V attaches a clipboard image (else pastes clipboard text), image paths typed or dropped into a prompt attach on send, Ctrl+X clears them, Ctrl+P toggles the palette, Tab/Ctrl+I opens the modes picker. Images go to the agent as --image and show as IMAGE rows (docs/ATTACHMENTS.md). Ctrl+B waits for the sidebar. - Mention state moves into mentions.ts to keep SessionController under the file size limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Move the crew task store reader out of the legacy TaskWidget into tui-core state/crew-tasks so the OpenTUI sidebar can use it: readCrewTaskSnapshot (async) and readCrewTaskSnapshotSync, plus tasksForSession, sessionDisplayNumbers, prioritizedTasks, taskLabel, and taskBlocked. Same store paths and CREWCODER_TASKS_ENABLED override as the agent. The legacy TaskWidget now only draws. - Add readGitLabelAsync so a UI can refresh the branch/dirty label after a run without blocking on git status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port more of the legacy UI (tracked in docs/PORT_LIST.md): - Right sidebar (Ctrl+B, /sidebar on|off|status): modified files (/file-changes on|off|status hides the list, tracking continues), live crew agents, this session's crew tasks, and the anchored <cwd>:<git> footer. Rows come from the pure sidebar-model.ts, sized in terminal cells and wrapped, never truncated. Starts closed, hides below 60 columns, and the divider drags to resize (18-60 columns). Tasks are polled only while open; the git label refreshes after each run. A list that does not fit always keeps its "... N more" row (legacy dropped it when items filled the budget). docs/SIDEBAR.md. - Remote target in state: --remote sets state.remoteTarget and the remote cwd, so the welcome screen and sidebar show <target>:<cwd>. Tasks and git are never read from the local disk for SSH workspaces. - Branching from /sessions: Tab forks the highlighted session and opens the fork with its history and saved settings, so the screen and new messages both belong to the branch (legacy's b only switched the id and left the old conversation on screen). /branch <id> does the same by id or prefix. Branching, including bare /branch, is refused during a run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the legacy theme loader into tui-core (theme/crewcoder-theme) so both UIs read the same built-in names and JSON files; the legacy theme module only re-exports it and keeps Gotham as its default. - Optional `syntax` and `markdown` blocks in theme files; every built-in carries full palettes. The legacy UI accepts them but does not use them yet. - New built-in `slate` (the OpenTUI default) and an `extends` field to pick the base theme (default `dark`, so existing files behave as before). - Named themes are found in $CREWCODER_HOME/themes, then in `extraDirs`. - listThemeFiles lists theme files with the reason a file is unusable. - Readable errors that name the file and the problem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --theme and CREWCODER_THEME, mapped from the shared theme tokens onto termcn tokens plus diff, syntax, and markdown colors (toAppTheme). Slate stays the default and keeps its previous colors. - /theme lists built-ins, your themes, and shipped examples (unusable files with the reason); the highlighted theme previews live, Enter applies and saves it to $CREWCODER_HOME/opentui.json, Esc keeps the applied one. Startup order: --theme > CREWCODER_THEME > saved pick > slate; a saved pick that broke falls back to slate with a warning. - Native syntax styles rebuild when the theme changes, so code, diffs, and replies already on screen recolor. - Theme `markdown` colors style replies and markdown source (.md reads, diffs, markdown fences) through one markup map covering every capture the grammar emits. - Read output is no longer concealed: a .md read shows its # and ** markers. - Shipped example theme: examples/themes/ember.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
message_end.durationMs timed the whole modelClient.complete() call. Claude Agent SDK and Codex run their own tool loop inside that call, so a turn that ran `npm test` for a minute reported a few tok/s for a model that streams at 80. GenerationClock now times the call minus everything that is not the provider producing output: provider-native tools (start to end, including their diff snapshot), CrewCoder tools run through executeTool with their approvals, requestQuestion waits, follow-up delivery, and usage pricing. Time to first token and reasoning tokens still count. If a provider tool never reports its end, durationMs is omitted instead of guessed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the reply throughput formatter from the legacy viewport into tui-core state/usage so the OpenTUI UI uses the same format (one decimal below 100, whole numbers above). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Sent and tool-result images draw inline through OpenTUI's native <image>: kitty graphics (kitty, Ghostty), sixel where reported, else half-block cells (always under tmux). Same size caps as legacy (80 columns, 35% of the screen between 4 and 18 rows), following resizes. Kitty placements are cropped at the transcript edge and sit below text. CREWCODER_TUI_IMAGE_PROTOCOL=kitty|sixel|blocks|none|auto overrides; remote mode draws no pixels. Sources are file: URLs so a path is never fetched; an undecodable file keeps the caption with a note. - CREW CODER shows the reply's generation speed (muted `42.3 tok/s`) once message_end reports it. - Live UI (contributes.liveUi[]) is skipped by owner decision; legacy keeps it. Transcript search moves to the end of the port order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t search Finishes the legacy -> OpenTUI port list (docs/PORT_LIST.md). - Live crews: /crew and /team stream through the bridge with worker-labelled transcript, AGENTS roster, workers' tasks in the sidebar, and approvals answered from the UI (agent crew commands attach the stdin control channel). Optional second UI in tmux via an owner-only handoff file. - tmux: startup note for missing settings, honest copy alerts. - Status panels for background jobs, validation, crews, goals, review summaries, /why, and checkpoints (block-panels.ts). - User messages draw a filled marker instead of a YOU row. - Welcome logo pulses like legacy (accent at half brightness to glow, frozen after 3 idle minutes, steady under reduced motion). - Transcript search: Ctrl+F or /find [text]. Jumps to the exact wrapped line through public OpenTUI renderables, expands collapsed output, marks the line, and shows the match line in the bar. No in-text highlight by owner decision. - Sending a message clears the saved composer text right away, so an overlay opening in the same instant no longer restores the sent text as a draft. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wrapped alerts Audit of legacy crewcoder-tui against OpenTUI found four gaps; three ported: - CrewCoder-mode plan and clarify view: crewcoder_propose_plan reads as Requirements / Investigation / File changes / Plan / Acceptance criteria with the /approve-plan hint, never collapsed; crewcoder_clarify lists its questions. Transcript search sees the same text. - Extension tool renderers: loaded with `crewcoder extension renderers --json` at startup and on /reload; matching tools draw from their template as markdown. Matching and templates moved to tui-core state/tool-renderers, shared with legacy. A renderer with an empty match now matches nothing (legacy matched every tool). - Bare /goal opens the preflight form (objective, max turns, check model, timeout) prefilled from config.goals, as in legacy. Token budget handoff stays open on the port list. Alerts wrap title and body to their real width instead of cutting at the border, keep indentation and hanging list items, and size the footer from the wrapped rows; the body cap is 16 wrapped rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI failed two status-line tests that passed locally: they expected the provider from the developer's CREWCODER_PROVIDER=claude, while CI gets the real default (codex-cli). A vitest setup file now gives every test file a private CREWCODER_HOME and clears CREWCODER_* variables, as the agent's test-home-setup does, and the two tests expect the real default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
codexCliStartFailure kept only the last three stderr lines. For a Node or Rust crash those are the stack tail (`requireStack: []`, `}`, `Node.js v22`) and the line naming the cause was dropped, so CI and users saw no reason. Keep the first error line as well as the tail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e test) - sdk-runtime: a caller's own modelClient (or the heuristic client) without an explicit provider ran in native tool mode, because providerId fell back to the env/config default (codex-cli). Native mode then dropped CrewCoder's read/write/edit/bash, so SDK embedders got "Tool not found: read". Such sessions now use CrewCoder tools; naming a provider keeps native mode. Documented in docs/SDK.md. - codex-approval-question test: run the fake Codex CLI as an executable, like codex-cli-provider.test.ts. main's question flag passes `-c ...` before `app-server`, which `node <script>` read as its own --check option. - opentui: wait on time, not 20 render passes, for the async image decode error, which timed out under CI load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the legacy
crewcoder-tuifeature set tocrewcoder-opentui, the OpenTUI + React UI that thecrewcoderumbrella launches. Shared runtime code (bridge, reducer, state, themes, tool renderers) moves intocrewcoder-tui-coreso both UIs use one copy. The legacy UI stays published and keeps working.The full feature-by-feature record, including owner decisions, is in
crewcoder-opentui/docs/PORT_LIST.md.OpenTUI
/why, and checkpoints.readoutput. Extra grammars are bundled locally, pinned and hashed, with no runtime downloads.@path suggestions, Ctrl+V clipboard images, image pixels inline (kitty/sixel/half-block).<cwd>:<git>./sessions./themepreviews live./crewand/teamstream through the bridge. Approvals are answered from the UI; review-mode crews used to auto-deny every gated tool, in legacy too. A crew can optionally run in tmux./find). It jumps to the exact wrapped line, expanding collapsed output, and marks it.tok/s), and the focus gate./goalpreflight form.Agent
file_diffevents from private workspace snapshots.GenerationClock).run-controlsmodule.tui-core
Shared theme loader, crew task reader, git labels, clipboard and image helpers,
formatTokensPerSecond, and extension tool renderer matching. The reducer gains crew session ids, worker tagging, andstopCrew.Behavior changes worth reviewing
matchsets no field now matches nothing. Legacy matched every tool, so one extension could redraw (and hide) all tool output. This affects both UIs./goalopens the preflight form instead of a menu.status,list, andlogsstill work when typed, and the form points to them.Not in this PR
contributes.liveUi[]) is skipped by owner decision; legacy keeps it.toolName: "bash"). It still can, as in legacy.Test plan
npm run typecheckfor crewcoder-opentui, crewcoder-tui, and crewcoder-agentnpm test -w @onpoint-dev-tools/crewcoder-opentui: 426 passednpm test -w @onpoint-dev-tools/crewcoder-tui-core: 121 passednpm test -w @onpoint-dev-tools/crewcoder-tui: 387 passedrun-controlstest passes. The full agent suite was not run in this session.CREWCODER_BIN): logo pulse colors, search jump and marker, plan/clarify/renderer views,/goalform, wrapped tmux alert/goal🤖 Generated with Claude Code