Repository navigation
refactor(screens): extract 3 leaf components + median from god module REPL.tsx (audit 1.1.1 checkpoint) - #168
Merged
Conversation
… REPL.tsx (audit 1.1.1 checkpoint) Audit 1.1.1 flags src/screens/REPL.tsx as a 7096-LOC god module rendering tree + keybindings + task lists + compaction + tool permissions + session management in one file. This is the first surgical extraction checkpoint toward the multi-session split. Extracted (props-in / JSX-out, no REPL state closure): - AnimatedTerminalTitle.tsx — 960ms animation tick now re-renders only this leaf (returns null, pure side-effect) instead of the whole REPL tree. - TranscriptModeFooter.tsx — transcript-mode footer with dynamic keybinding hints. - TranscriptSearchBar.tsx — less-style / search bar. - median() -> src/utils/array.ts — pure fn for ttft/otps multi-request median. React-Compiler compiled form ($ = _c() memo cache, $[i] slot reads) preserved verbatim on the 2 compiled components; the source-style hand-written component stays hand-written. Removed 4 now-unused REPL.tsx imports: figures, useTerminalTitle, useShortcutDisplay, useSearchInput (sole consumers moved out). REPL.tsx 7096 -> 6811 LOC (-285). Byte-identical behavior: pure relocation + import wiring, no logic change. Gates: typecheck 0 errors, 704 tests pass, lint net-zero vs baseline (4601), build:dev passes. Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
….tsx (audit 1.1.1) (#171) Second surgical extraction from REPL.tsx (audit §1.1.1 god-module split, continues PR #168 checkpoint). Two pure useMemo derives — onlySleepToolActive and stopHookSpinnerSuffix — moved to src/utils/spinnerState.ts as pure functions taking their closure deps as args. REPL keeps thin useMemo cache wrappers. Zero closure mutation, zero behavior change. Removed 3 now-unused REPL imports (truncateToWidth, ProgressMessage, HookProgress) re-homed into spinnerState.ts. REPL.tsx 6811→6741 (−70 LOC). Gates: typecheck 0 / 704 tests pass / lint net-zero 4601 / build:dev 3756 modules. Co-authored-by: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
…sx (audit 1.1.1) (#172) Third surgical extraction in the REPL.tsx god-module split (audit §1.1.1). The three viewed-task derives (viewedTask / viewedTeammateTask / viewedAgentTask) move from inline in REPL.tsx to a pure-function selector module: src/tasks/viewedTaskSelector.ts. No React, no side effects — deps as args. - getViewedTask: raw record lookup by id - getViewedTeammateTask: teammate-only narrowed (in_progress_teammate) - getViewedAgentTask: teammate OR local_agent — drives downstream boolean checks REPL keeps the three const bindings as thin call wrappers (identical names, identical downstream usage) — pure relocation + import wiring, byte-identical behavior. Removed now-unused isInProcessTeammateTask guard import from REPL (sole call site moved out); kept InProcessTeammateTaskState type (still used at the panel helper) and isLocalAgentTask (two other call sites). REPL.tsx 6741 → 6732 LOC (-9). viewedTaskSelector.ts +36 LOC (new). Cohesion win: selector logic now reusable + unit-testable in isolation. Gates: typecheck 0 / 714 tests pass (+10 new) / lint net-zero vs 4601 baseline / build:dev 3757 modules. Follows PR #168 (leaf components, -285) + PR #171 (spinner derives, -70) in the multi-session split. Task #170 stays in_progress — full 4-6wk split continues in follow-up PRs. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 28, 2026
Merged
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
…State (audit 1.1.1) (#176) (#177) Sixth surgical extraction for audit §1.1.1 god-module split. Bundle 3 chained pure derives out of REPL.tsx (was 5748-5769): - usesSyncMessages (showStreamingText||!isLoading) - displayedMessages (agent view|sync|deferred, ref-preserving) - placeholderText (input-baseline gate) src/utils/messageDisplayState.ts NEW — deriveUsesSyncMessages + deriveDisplayedMessages + derivePlaceholderText + aggregate deriveMessageDisplayState. No React, no hooks, deps as args. Returns ORIGINAL array refs (no spread copy) — preserves ref-identity for Messages memo + length checks downstream. Byte-identical to inline. REPL keeps useDeferredValue(messages) + userInputBaselineRef ref; calls deriveMessageDisplayState once, destructures to SAME const names → downstream reads unchanged. Picked 7-dep bundle over survey #1 getFocusedInputDialog (90 LOC but 23 deps) — strategy = fewest-dep pure-helper = lowest byte-identical risk (per proven PR #174/#175 pattern). Tests: messageDisplayState.test.ts 19 tests — usesSyncMessages 3 arms, displayedMessages ref-identity + agent-override + empty-array, placeholderText baseline gate + agent suppress, aggregate 7 cases including ref-identity assertion (not a copy). REPL.tsx 6709 → 6696 (−13). Cumulative off 7096: #168(−285)+#171(−70)+#172(−9)+#174(−17)+#175(−6)+#176(−13) = −400 LOC. Gates: typecheck 0 / 769 tests (+19) / lint net-zero 4601 / build:dev 3764. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Aug 28, 2026
Merged
Merged
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
Audit §1.1.1 flags
src/screens/REPL.tsxas a 7096-LOC god module — render tree + keybindings + task lists + compaction + tool permissions + session management all in one file. This PR is the first surgical extraction checkpoint toward the multi-session split.Extracted (props-in / JSX-out, no REPL state closure)
src/components/AnimatedTerminalTitle.tsxnull(pure side-effect); tick now re-renders only this leaf, not the whole REPL treesrc/components/TranscriptModeFooter.tsxsrc/components/TranscriptSearchBar.tsx/search barmedian()→src/utils/array.tsDetails
$ = _c()memo cache,0slot reads) — shipped source style (Rule 11). The source-style hand-written component stays hand-written.figures,useTerminalTitle,useShortcutDisplay,useSearchInput. KeptuseTerminalFocus(still used at the focus-check site).Byte-identical behavior
Pure relocation + import wiring — no logic change. Animation behavior, footer rendering, search-bar behavior, and median computation are unchanged; same components render at the same usage sites.
Gates
bun run typecheck— 0 errorsbun test src/__tests__/— 704 pass / 0 failbun run lint— net-zero vs baseline (4601 errors, all pre-existing repo-wide)bun run build:dev— passes (built./fusion-code-dev)Scope note
This is a checkpoint, not the complete 1.1.1 fix. The 4-6 week full split (extracting cohesive subsystems from the giant
REPL()function, ctx seam decision 1.1.2, layer enforcement 1.1.3) continues in follow-up PRs. Each checkpoint is independently mergeable + verifiable (Rule 10).Co-Authored-By: Claude Fable 5 [email protected]