Skip to content

feat(tui): start a session from the composer and the navigator tab row - #701

Merged
mohitranka merged 1 commit into
mainfrom
feat/new-session-command
Sep 15, 2026
Merged

mohitranka merged 1 commit into
mainfrom
feat/new-session-command

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Why

Starting a session required knowing n while the navigator's Sessions tab already held the keyboard, or F3 then n. Nothing on screen said so, and the composer — one printable key from anywhere — had no create verb at all.

What

/new in the composer palette. A fresh session with no focus change needed: the composer is one printable key away from every block, and the verb works at any terminal width, including widths where the navigator has collapsed to the status-row chip.

A + cell on the navigator tab row. The row now has three stops instead of two:

╭──────────┬──────────────┬─╮
│ Sessions │    Files     │+│
├──────────┴──────────────┴─┤
  • ←/→ walk Sessions · Files · + and halt at each end rather than wrapping, so movement always matches what is drawn. ↑ still lands on the tab on screen, never on +.
  • Enter activates the stop: a tab steps back into its pane (unchanged), + creates a session. Resting on + moves nothing else — the active tab keeps its ground and the pane under the row keeps the keys.
  • The cell is clickable, hover takes the ground plus a weight step, and its glyph steps to accent + bold only while the row's cursor is on it.
  • Ctrl+1/Ctrl+2/Ctrl+E retarget the cursor with the tab they switch to, so it can never rest on a tab that is no longer the active one.

One create verb. n, +, and /new all run a single create_session_now, which replaced three copies of the same supervisor command. Creation stays prompt-less on purpose: a prompt is what parks creation on the trust modal, and the session is named from the first prompt submitted in its composer. Outside a repository, /new says /new needs a repository · /fork starts a separate conversation here instead of the generic Sessions are unavailable.

The one tradeoff

The cell's three columns come from the Files tab, the only elastic box on the row, so the needs-you badge needs three more columns before it reappears beside the cell — frames around 126–139 columns lose the badge while viewing Files. Frames ≥ 140 are unaffected. Below the width layout.rs lays the navigator out at, the cell is dropped and skipped as a cursor stop, so the frame and the keyboard cannot disagree.

Design doc

FORGE-DESIGN.md §7.7, the §8.3 binding table and prose, and §9.6 chrome describe the new stop, its focus treatment, and why the cell never takes the active-tab ground (the tab bar must keep showing which tab is active). README.md gains /new in the command list, the row's bindings in the key table, and a sentence in Sessions and resume.

Testing

9 new tests:

  • crates/forge-tui/src/widgets/navigator.rs — the cell is painted with its own frame and joints, never takes a tab's active ground, steps to accent only as the row's cursor, takes hover, and is dropped when the row is too narrow.
  • crates/forge-tui/src/app/tests/multi_task.rs — the keyboard ring and Enter, the click (which must beat the Files tab branch the cell sits inside), the chord retarget, and the drawn frame matching the pointer's hit target.
  • crates/forge-tui/src/app/tests/mouse.rs — a move over the cell sets the cell's hover and not the Files tab's.

Green locally: widgets:: 164, app::tests::multi_task:: 43, app::tests::mouse:: 28, app::tests::focus:: 36, app::tests::commands:: 70, plus theme/workspace/approval/explorer/questions/characterization. cargo fmt --all -- --check and cargo clippy -p forge-tui --all-targets --locked -- -D warnings clean.

Starting a session required knowing `n` while the Sessions tab held the
keyboard, or `F3` then `n`. Nothing on screen said so, and the composer —
one printable key from anywhere — had no create verb at all.

`/new` adds that verb to the palette. The navigator's tab row gains a `+`
cell as its third stop: `←`/`→` walk `Sessions · Files · +` and halt at each
end rather than wrapping, `Enter` activates the stop, and the cell is
clickable. It is not a tab — it never takes the active tab's ground, so the
tab bar keeps showing which tab is active, and the row's cursor is the only
thing that marks it.

All three surfaces run one `create_session_now`, which replaced three copies
of the same supervisor command. Creation stays prompt-less on purpose: a
prompt is what parks creation on the trust modal, and the session is named
from the first prompt submitted in its composer. Outside a repository
`/new` explains what to do instead of answering with the generic "Sessions
are unavailable".

The cell's three columns come from the `Files` tab, the only elastic box on
the row, so the needs-you badge needs three more columns before it
reappears beside it.
@mohitranka
mohitranka merged commit 96fa826 into main Sep 15, 2026
3 checks passed
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