Skip to content

feat: add interactive terminal UI (ai -i) - #114

Draft
lahfir wants to merge 4 commits into
mainfrom
laf/interactive-mode
Draft

lahfir wants to merge 4 commits into
mainfrom
laf/interactive-mode

Conversation

@lahfir

@lahfir lahfir commented Oct 28, 2026

Copy link
Copy Markdown
Contributor
  1. ai-cli only had one-shot commands, so trying prompts, models and settings meant retyping long command lines.
  2. ai -i opens an interactive terminal UI where you type the prompt and pick everything else, with thumbnails, a click-to-open slider and @last chaining.
  3. Related: fix(image): support --n for generateText image models #113 lets Gemini image models use the count setting.

Demo

A text reply, then two images with settings picked by Tab, and a click on a thumbnail that opens it full screen (played at 2x).

demo.mp4

ai -i opens a full-width TUI. You type the prompt; mode, model, count,
aspect ratio and duration are picked from the footer with the keyboard,
or with / commands. Images and video frames show as thumbnails, clicking
one opens a full-screen slider, and @last feeds the last output into the
next prompt.

- Bare ai and every one-shot command behave as before.
- text errors now throw instead of calling process.exit, so they can run
  in-process.
- The Gateway model catalog is cached per URL and headers, so image and
  video commands stop refetching it on every call.
- Split interactive.ts into input, settings, rendering, terminal and
  formatting modules; behavior is unchanged.
- Tab and Shift+Tab now step through the setting chips and wrap back to
  the prompt.
- Tests drive real key sequences through the TUI and pin the one-shot
  Kitty preview bytes.
- Document ai -i in the README, a new website page, the agent skill and
  the changelog.
- Restore mouse mode, cursor and raw mode on SIGINT, SIGTERM and SIGHUP,
  and close the gallery cleanly when an image file cannot be read.
- Show every failure from a turn, not only lines that mention errors.
- Keep the gallery and clicks closed until a turn has fully rendered.
- Fit live lines to the terminal width so redraws and thumbnail click
  positions stay aligned on narrow windows.
- Buffer mouse reports split across reads, clamp the slash menu
  selection, and edit emoji as whole characters.
- Keep the indentation of code in text replies.
- Load the model list from the same Gateway URL and team as generation.
- @last now always points at the last image.
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ai-cli Ready Ready Preview, v0 Oct 28, 2026 10:16pm UTC

- Strip control characters from model text, errors and notes before
  printing, so a reply cannot clear the screen or write the clipboard.
- Keep the full wrap width for every line of a reply.
- Show a clear error when the model list cannot load instead of
  "No matches".
- Name the model that actually ran in the result line.
- Keep a /image, /video or /text prompt typed mid-turn in the prompt bar.
- Cut the loading area to the terminal height.
- Edit emoji, flags and accents as whole characters.
- ai -i now needs stdin, stdout and stderr to be terminals, and says when
  it is given extra arguments.
- Test the TUI against the real image, video and text flag definitions,
  the result path and @last, plus the catalog cache keys.

This branch was successfully deployed

1 active deployment
Preview — b9e6d39e Deployed Oct 28, 2026 by vercel[bot]
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.

1 participant