Skip to content

Add TUI status and Ctrl+Y fast toggle - #2

Open
MAakber wants to merge 5 commits into
Tarquinen:mainfrom
MAakber:tui-fast-toggle
Open

Add TUI status and Ctrl+Y fast toggle#2
MAakber wants to merge 5 commits into
Tarquinen:mainfrom
MAakber:tui-fast-toggle

Conversation

@MAakber

@MAakber MAakber commented Jul 15, 2026

Copy link
Copy Markdown

The /fast command works as a server plugin in both OpenCode Desktop and the terminal client. This PR adds a separate terminal TUI entry point that displays fast beside both the home and session prompts and binds Ctrl+Y in base mode to toggle it. The status indicator and keybinding are terminal-only because Desktop does not host the TUI plugin runtime.

The server and TUI use the same opencodex-fast.jsonc state file. The server rereads it before matching Codex requests, so changes made through /fast or Ctrl+Y take effect without restarting OpenCode. Non-Codex requests are unchanged.

The existing root entry remains available for server installations. Explicit ./server and ./tui exports support the separate OpenCode plugin loaders. The TUI integration requires OpenCode 1.18.1 or newer.

The shared state reader accepts JSONC comments and trailing commas while ignoring transient read failures. Toggle writes use a unique temporary file followed by atomic rename, with failed-write cleanup. The README documents Desktop/server support and the optional terminal TUI setup.

Tested with:

  • npm run build
  • npm pack --dry-run --json
  • Root, ./server, and ./tui entry-point imports
  • Bun/OpenTUI renderer checks for home and session prompt indicators across enabled, disabled, and re-enabled states
  • Three consecutive state toggles on Windows, including replacement of an existing destination and verification that no temporary file remained
  • OpenCode 1.18.1 startup with the packaged TUI entry enabled

Copilot AI review requested due to automatic review settings July 15, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a TUI integration for the existing /fast server plugin by displaying a fast status indicator in the session prompt and introducing a Ctrl+Y toggle that updates the shared opencodex-fast.jsonc state file.

Changes:

  • Introduces a new TUI entry point (tui.tsx) that polls and renders the fast-mode status and registers a base-mode Ctrl+Y keybinding.
  • Adds shared JSONC state parsing + polling (fast-status-state.ts) and persisted toggle logic (fast-toggle.ts), along with Node test coverage.
  • Updates packaging/configuration (exports, deps, TSX config) and documents TUI setup in the README.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tui.tsx New TUI plugin entry that displays fast and binds Ctrl+Y via a keymap layer.
fast-status-state.ts Adds JSONC-capable state parsing and a polling monitor abstraction.
fast-toggle.ts Implements persisted on-disk toggle and exposes a keymap layer/command.
fast-status-state.test.ts Adds tests for parsing and monitor polling/edge cases.
fast-toggle.test.ts Adds tests for toggle behavior and keymap layer registration.
index.ts Server plugin now uses shared JSONC state parsing and re-reads state before Codex matching and command handling.
tsconfig.json Enables TSX compilation and includes new source/test files in the TS build.
package.json Adds ./server and ./tui exports, dependencies, and updates scripts for build+test.
package-lock.json Locks added dependencies and updated dev dependencies.
README.md Documents TUI entry-point usage and the Ctrl+Y toggle behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fast-toggle.ts Outdated
Comment thread fast-toggle.ts Outdated
Comment thread fast-toggle.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants