refactor: split oversized modules#1
Merged
Merged
Conversation
…nt in protocol mod
Split every source file exceeding 300 lines into focused submodules
and move inline #[cfg(test)] blocks into dedicated test files. The
LOC rule (200 = code smell, 300 = hard cap) is recorded in
.claude/rules/guardrails.md.
Module splits (non-test logic, tests moved to sibling files):
- main.rs -> cli, event_loop, key_dispatch, key_handlers, mouse,
paste, splash, app_init, main_tests/
- app.rs -> app/app_impl, app/log_nav, app/scroll, app/tree_nav,
app/file_view_load, app/commit_log_pagination, app/commit_log_apply
- config.rs -> config/{layout,log,panels,web}
- git/diff.rs -> git/diff/{types,snapshot,diff_load,commit_log}
- git/{path,tree}.rs -> git/{path,tree}/ directories
- runtime/terminal.rs -> runtime/terminal/{state,scroll,lifecycle,escape}
- runtime/emulator.rs -> runtime/emulator/{mod,view}
- input/mod.rs -> input/{routing,encode}
- web/server.rs -> web/server/{accept,http_routes,ws}
- web/protocol.rs -> web/protocol/{mod,decode}
- web/viewer/server.rs -> web/viewer/server/{dispatch,mutations,routes,handlers,http_util}
- web/viewer/{dto,terminal,catalog,runtime}.rs -> directories
- ui/mod.rs -> ui/{helpers,chrome,notice,hint_text,hint_bar,hit_test}
- ui/{diff_pane,diff_viewer,terminal_tab,project_tab,log_view,tree_view}.rs
-> directories
Also: CLAUDE.md -> AGENTS.md (symlink kept for compatibility),
docs/architecture.md module tree updated to match the new layout.
# Conflicts: # src/web/server.rs
Split App.tsx (2059→299), Terminal.tsx (616→273), api.ts (342→118) into hooks/, components/, api/ modules. Add LOC rule to guardrails.md.
# Conflicts: # src/web/viewer/catalog.rs # src/web/viewer/server.rs # viewer-ui/dist/assets/Markdown-CKSGxvDC.js # viewer-ui/dist/assets/Markdown-D7nyj2B6.js # viewer-ui/dist/assets/Markdown-FGllwLLF.js # viewer-ui/dist/index.html # viewer-ui/src/App.tsx # viewer-ui/src/Terminal.tsx # viewer-ui/src/paneOrder.ts
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\n- split oversized Rust modules into focused submodules\n- keep source files within the project size guideline\n\n## Verification\n- cargo build\n- cargo test\n- cargo clippy --all-targets --all-features -- -D warnings