refactor(tauri): split lib.rs into commands/ submodule (Phase 4)#52
Merged
jamesbrink merged 1 commit intomainfrom May 4, 2026
Merged
refactor(tauri): split lib.rs into commands/ submodule (Phase 4)#52jamesbrink merged 1 commit intomainfrom
jamesbrink merged 1 commit intomainfrom
Conversation
Carve the 2,438-line lib.rs into a commands/ submodule grouped by concern, mirroring the shell/ submodule split that landed in #49. lib.rs shrinks to 755 lines and now holds only what the agent process supervisor + tauri::Builder actually need: agent IPC commands, paste persistence, tracing init, run(). - commands/config.rs — read/write_state, read/write_config, aethon_home_dir, aethon_state_path - commands/session.rs — search_sessions, delete_session, export_chat_markdown + snippet helpers - commands/extensions.rs — ExtensionMenuItem/Store, native menu + tray rebuild, AgentWatcher, watch/unwatch_project_extensions, install_aethon_extension - commands/git.rs — git_status, pick_project_directory - commands/window.rs — toggle_fullscreen, toggle_devtools, updater_available + pubkey gate sanitize_filename_segment moves to helpers.rs since both save_paste_image (lib.rs) and export_chat_markdown (session.rs) need it. Tray idempotency tests travel with their code into commands/extensions.rs; lib.rs keeps a smaller test pinning the invoke_handler wiring contract. All IPC command names preserved — search_sessions stays as-is so the frontend invoke surface (search-panel.tsx, App.tsx) keeps resolving. Visibility for AgentProcess / AgentReloadFlag / agent_reload_in_progress / project_root / resolved_login_path widened to pub(crate) so the watcher debounce worker and install_aethon_extension can reach them from the new module. Closes #41
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
src-tauri/src/lib.rsinto acommands/submodule grouped by concern, mirroring theshell/submodule split from refactor(tauri): split shell.rs into shell/ submodule (Phase 5) #49 (Phase 5).lib.rsshrinks to 755 lines (-69%) and now holds only the agent supervisor, agent IPC, paste persistence, tracing init, andrun().invoke()callers don't need to change.invoke_handlerwiring contract.Closes #41.
New layout
lib.rsstart_agent,send_message,agent_command,force_restart_agent,dispatch_a2ui_event),save_paste_image, logging,run()commands/config.rsread_state,write_state,read_config,write_config,aethon_home_dir,aethon_state_pathcommands/session.rssearch_sessions,delete_session,export_chat_markdown+ snippet helperscommands/extensions.rsExtensionMenuItem/Store,set_extension_menu_items,install_app_menu/install_tray/TRAY_ID,AgentWatcher,watch/unwatch_project_extensions,install_aethon_extensioncommands/git.rsgit_status,pick_project_directorycommands/window.rstoggle_fullscreen,toggle_devtools,updater_available+ pubkey gatecommands/mod.rsNotes
sanitize_filename_segmentmoved tohelpers.rssince bothsave_paste_image(lib.rs) andexport_chat_markdown(session.rs) need it.install_app_menu/install_tray/TRAY_IDbundled intoextensions.rsrather than left in lib.rs — the menu rebuild is driven by extension menu deltas, so cohesion lives there. Keeping them in lib.rs would have forced apub(crate)purely forset_extension_menu_itemsto reach them.AgentProcess,AgentReloadFlag,agent_reload_in_progress,project_root,resolved_login_path(nowpub(crate)) so the watcher debounce worker andinstall_aethon_extensioncan reach them from the new module.search_sessions_by_keywordfor the session command; kept the existing IPC namesearch_sessionsto avoid breakingsrc/skills/default-layout/search-panel.tsx:178andsrc/App.tsx:3663.Test plan
cargo clippy --all-targets -- -D warnings— cleancargo test --lib— 74 passed (3 in the relocatedcommands::extensions::tests)bunx vitest run— 305 passed across 30 filesbunx tsc -b --noEmit+bunx eslint .— cleancheckgate end-to-end — passes.aethon/extensions/, toggle fullscreen/devtools — all IPC paths resolve from the frontend.