Problem
AppDelegate.swift (941 LOC) defines ~20 RPC command handlers as inline closures within startSocketServer() (lines 387–941). Each handler contains parameter validation, state mutation, store persistence, and response construction — all nested inside a dictionary literal. This makes AppDelegate the single hardest file to navigate and test.
Proposed Improvement
Extract each handler (or group of related handlers) into a dedicated RPCHandlers/ directory with focused structs/functions. The handlers for sessions, worktrees, terminals, links, and hooks would each get their own file.
Effort
Medium (2–3 hours). The handlers are already self-contained closures — extraction is mostly mechanical cut-and-paste with parameter threading.
Files Affected
Sources/Crow/App/AppDelegate.swift (shrinks by ~550 LOC)
- New:
Sources/Crow/App/RPCHandlers/SessionHandlers.swift
- New:
Sources/Crow/App/RPCHandlers/TerminalHandlers.swift
- New:
Sources/Crow/App/RPCHandlers/WorktreeHandlers.swift
- New:
Sources/Crow/App/RPCHandlers/LinkHandlers.swift
- New:
Sources/Crow/App/RPCHandlers/HookHandlers.swift
Priority: 1/10
Problem
AppDelegate.swift(941 LOC) defines ~20 RPC command handlers as inline closures withinstartSocketServer()(lines 387–941). Each handler contains parameter validation, state mutation, store persistence, and response construction — all nested inside a dictionary literal. This makes AppDelegate the single hardest file to navigate and test.Proposed Improvement
Extract each handler (or group of related handlers) into a dedicated
RPCHandlers/directory with focused structs/functions. The handlers for sessions, worktrees, terminals, links, and hooks would each get their own file.Effort
Medium (2–3 hours). The handlers are already self-contained closures — extraction is mostly mechanical cut-and-paste with parameter threading.
Files Affected
Sources/Crow/App/AppDelegate.swift(shrinks by ~550 LOC)Sources/Crow/App/RPCHandlers/SessionHandlers.swiftSources/Crow/App/RPCHandlers/TerminalHandlers.swiftSources/Crow/App/RPCHandlers/WorktreeHandlers.swiftSources/Crow/App/RPCHandlers/LinkHandlers.swiftSources/Crow/App/RPCHandlers/HookHandlers.swiftPriority: 1/10