Skip to content

refactor: split remaining god files and unify the socket command catalog#129

Merged
arzafran merged 2 commits into
mainfrom
nuclear-review-splits
Jul 16, 2026
Merged

refactor: split remaining god files and unify the socket command catalog#129
arzafran merged 2 commits into
mainfrom
nuclear-review-splits

Conversation

@arzafran

Copy link
Copy Markdown
Member

One PR for the five open nuclear-review issues. Everything here is file reorganization plus the command-catalog dedup, no behavior change.

What moved

#94 ContentView.swift 7,913 -> 5,791 lines. Window chrome, the window overlay controllers, workspace mount presentation, the vertical tabs sidebar, shortcut hints, internal tab drag, and the sidebar resizer each got their own file (the resizer as a ContentView extension, same shape as the existing command palette extension). TabItemView was already out; it is untouched here.

#97 GhosttyTerminalView.swift 8,446 -> stub. GhosttyApp, TerminalSurface (with the registry and metal layer), GhosttyNSView, GhosttySurfaceScrollView (with its private helper views and the SurfaceSearchOverlay mount), copy-mode types, and shared support each moved to their own file, matching the +Suffix convention the module already used. TerminalWindowPortal.swift 2,079 -> 1,054 with the host view and cross-window registry extracted.

#98 Workspace.swift 5,660 -> 2,056. Sidebar and remote value types moved to model files; the theme, remote glue, surface creation, focus/geometry reconciliation, and sidebar telemetry member groups are now Workspace+X extension files. Sidebar telemetry has one mutation target, as the review asked. The remote-session controller split had already landed on main.

#99 browser trio 13,131 -> 6,139 across the three originals. Browser settings, the whole omnibar subsystem, toolbar views, six BrowserPanel+X concern extensions, and the host/slot/drop views split out. The per-file private helper extensions were kept per-file on purpose so nothing collides; the PageSession facade idea stays future work.

#87 one command catalog. v2Capabilities() now derives from a new V2CommandCatalog and the hand-maintained method array is gone. The 79 copy-pasted invalid-params guards across the TerminalController+* handlers collapsed onto one v2InvalidParam() helper. On the CLI side every per-command usage text moved into the CommandDescriptor table and the ~1,300-line subcommandUsage switch is deleted. The dispatch switch itself is untouched, as the review cleared it. The per-family usage helpers that already live next to their descriptors in CLI/CLI+*.swift were left alone.

Guardrails and verification

  • Typing-latency paths moved byte-for-byte: WindowTerminalHostView.hitTest() and TerminalSurface.forceRefresh() diff clean against main; key handling untouched.
  • App, CLI, and unit-test targets all build locally.
  • CLI top-level help and 27 sampled per-command --help outputs are byte-identical to the shipped release binary; help <cmd> rejects arguments exactly like before.
  • Capabilities JSON was already sorted before serialization, and the catalog carries the same method set including the DEBUG-only block.
  • Access-level flips (private/fileprivate -> internal) were made only where a file boundary now sits between a member and its callers; each agent's report lists them.

Closes #87
Closes #94
Closes #97
Closes #98
Closes #99
Closes #104

arzafran added 2 commits July 15, 2026 13:14
Nuclear-review restructuring pass (2026-07-09 audit, tracking issue #104):

- #94 ContentView.swift 7,913 -> 5,791 lines; window chrome, overlay
  controllers, workspace mount presentation, vertical tabs sidebar,
  shortcut hints, tab drag, and the sidebar resizer moved to their own
  files (resizer as a ContentView extension per existing convention).
- #97 GhosttyTerminalView.swift 8,446 -> stub; GhosttyApp,
  TerminalSurface (+registry/metal layer), GhosttyNSView,
  GhosttySurfaceScrollView, copy-mode types, and shared support split
  out. TerminalWindowPortal.swift 2,079 -> 1,054 with the host view and
  registry extracted. hitTest and forceRefresh moved byte-identical.
- #98 Workspace.swift 5,660 -> 2,056; sidebar/remote value types and
  the theme/remote/surfaces/focus-geometry/sidebar-telemetry member
  groups extracted as Workspace+X files.
- #99 browser trio 13,131 -> 6,139 across the three originals;
  settings, omnibar subsystem, toolbar views, BrowserPanel concern
  extensions, host/slot/drop views split out.
- #87 one command catalog: v2Capabilities() now derives from the new
  V2CommandCatalog (literal method array deleted), 79 duplicated
  invalid-params guards collapsed onto v2InvalidParam(), and per-command
  CLI usage text moved into the CommandDescriptor table (the ~1,300-line
  subcommandUsage switch is gone).

Pure moves plus the minimum private->internal flips the file boundaries
require; no logic changes. App, CLI, and unit-test targets build. CLI
top-level help and 27 sampled per-command helps are byte-identical to
the shipped binary; capabilities JSON is set-identical and was already
sorted before serialization.

Closes #87, closes #94, closes #97, closes #98, closes #99, closes #104.
…esses

The macos-26 runner image now ships two Xcodes (26.5 and 26.6). Setting
only DEVELOPER_DIR leaves the system selection on the other Xcode, and
/usr/bin/git shims spawned inside xcodebuild test processes exit 72 with
a dual Xcode3Core clash — compat-tests has failed on every PR since
2026-07-13 because of this (git-branch probe and SSH bootstrap tests).
Same fix ci.yml and release.yml already carry; applied to
ci-macos-compat, test-depot, and test-e2e.
@arzafran
arzafran merged commit 96353fb into main Jul 16, 2026
13 of 16 checks passed
@arzafran
arzafran deleted the nuclear-review-splits branch July 16, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment