Repository navigation
refactor(terminal): move the chat lens's terminal logic into hooks - #1767
Conversation
The peek-return block, the chat callbacks and the key-bar/stop callbacks move verbatim into usePeekReturn, useChatCallbacks and useTypedKeys. The first two are called where their blocks stood, useTypedKeys where the stop block stood (pressKey/toggleModifier have no effects, so creating them later is neutral). PART_FILES gains the files with t() keys. Plan: .omo/plans/paneterminal-split.md PR 3.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Merge pass: PaneTerminal split, PR 3 of 3. It merges on its checks as a move-only PR, without waiting for a CodeRabbit review, as AGENTS.md allows. One relocation. Diff. A line-multiset comparison differs only in:
Gate review (on a different model than the author's):
Tests at this head:
Overlap. Outside contributor #1639 touches All required checks are green and no review thread is open. |
PR 3 of 3 of the PaneTerminal.tsx split. The plan is
.omo/plans/paneterminal-split.mdin the maintainer's workspace, and plan-reviewer approved it. It follows PR #1758 and PR #1764.This PR moves the chat lens's terminal logic out of
src/components/PaneTerminal.tsxinto three hooks. Each block moves as one unchanged span. Effects keep their dependency lists, and callbacks keep theiruseCallbackdependencies.src/components/PaneTerminal.tsxgoes from 1,477 to 1,174 lines. Over the three PRs it went from 3,665.What moves
src/lib/usePeekReturn.tssrc/lib/useChatCallbacks.tsusePeekReturnsrc/lib/useTypedKeys.tspressKeyandtoggleModifier(30 lines), and Hermes' one-Ctrl+C stop guard withabortTurn(34 lines)pressKey,toggleModifier,abortTurnHook and effect order
useTypedKeys: the key-bar callbacks used to sit about 15 lines above the stop block. They have no effects, and only JSX reads them, so creating them a few hooks later changes nothing. Nothing between the two old positions reads them.usePeekReturnanduseChatCallbacks: each sits exactly where its block was, so their effects run in the same order as before.Other changes
StillOpen: this was a local type alias inside the component. Two hooks now use it, so it moves tosrc/lib/paneTerminalShared.tsas an exported type. Types have no runtime effect.src/lib/i18n.test.ts:PART_FILES.terminalgainslib/usePeekReturn.tsandlib/useTypedKeys.ts, because theirt()keys belong to the terminal part.PaneTerminal.tsxdrops the imports only the moved code used.Checks
--color-moved:git diff --color-moved=plain --color-moved-ws=allow-indentation-change origin/main...HEADshows 629 lines as moved. The other 116 lines are:PaneTerminal.tsx's narrowed imports, the three new imports and the three calls;Depsinterfaces (57 field lines), signatures, destructuring lines and returns;StillOpentype's move;PART_FILESentries.PaneTerminal.tsxon2fa93ab49appear byte for byte in their hooks. Lines 493-645 do too, apart from the oneStillOpenline.bun run typecheckpasses.HERDR_TEST_MODE=unit bun test src/conventions.test.ts src/lib/i18n.test.ts src/lib/settings.test.ts scripts/conventions.test.ts src/lib/terminalPeek.test.ts src/lib/keyBar.test.ts src/lib/hermesStop.test.ts: 163 pass, 0 fail.bun run check fast: passes after the rebase (unit 6253 pass, 0 fail, 13 skip in 443 files, 8 at a time, 57.5s)bun run check integration browser: the browser lane exits 0 (every browser script passed, 1895 s), run on this commit before its rebase onto the latest main (which changed onlysrc/App.tsx,src/app-hooks.test.ts,src/lib/useSidebarLayout.tsand server files). The integration lane's only failure isserver/api.contract.test.ts"creates, edits, searches, inspects, and closes an owned workspace" (line 1540,/api/pane/filesreturns[]), which fails the same way on unchangedorigin/mainon this PC. CI runs the integration lane in its own environment.Outside PRs that touch the same files
No other maintainer PR touches these files. One outside contributor's PR touches
src/components/PaneTerminal.tsx: #1639. It already conflicts with main (src/lib/i18n.ja.ts,src/lib/i18n.ko.ts,src/lib/i18n.zh.ts) and needs a rebase either way; against this branch it conflicts insrc/components/PaneTerminal.tsx,src/lib/i18n.ja.ts,src/lib/i18n.ko.ts,src/lib/i18n.zh.ts.The moved blocks include the queued-input stop path, Hermes' stop guard and the peek's auto-return. A code-review agent's stand-in review may be wanted before the merge.
Move-only: moved blocks plus imports, deps interfaces, three calls, one shared type and two
PART_FILESentries. No changelog fragment: users see no change.