refactor(binary): split main.rs and bootstrap.rs into focused modules#906
Merged
refactor(binary): split main.rs and bootstrap.rs into focused modules#906
Conversation
Split 3177-line main.rs into thin orchestrator (26 LOC) + focused modules: - src/runner.rs: dispatch logic for all run modes (acp, tui, cli, daemon) - src/agent_setup.rs: tool executor, MCP setup, feature-gated agent extensions - src/agent_setup.rs: apply_code_index, apply_candle_stt, apply_whisper_stt helpers - src/tests.rs: unit tests extracted from main.rs - src/tracing_init.rs: init_file_logger() deduplicates 4 identical tracing setups - src/tui_bridge.rs: run_tui_agent() and TUI event forwarding - src/channel.rs: build_cli_history() and channel creation - src/cli.rs, acp.rs, daemon.rs, scheduler.rs, commands/: pre-existing splits Split 1791-line bootstrap.rs into focused submodules under bootstrap/: - bootstrap/config.rs: config path resolution, vault arg parsing - bootstrap/health.rs: health check and provider warmup - bootstrap/mcp.rs: MCP manager and registry creation - bootstrap/provider.rs: provider factory functions - bootstrap/skills.rs: skill matcher and embedding model helpers - bootstrap/tests.rs: unit tests extracted from bootstrap/mod.rs - bootstrap/mod.rs: AppBuilder struct (278 LOC, was 1791) Closes #839, #840
…ucturing - CHANGELOG.md: add [Unreleased] entries for #839, #840 - docs/src/architecture/crates.md: document new zeph binary modules and bootstrap submodules - docs/src/architecture/overview.md: update bootstrap and binary structure design decisions - crates/zeph-core/README.md: update bootstrap module table to reflect submodule split - src/agent_setup.rs: add unit tests for apply_cost_tracker, apply_summary_provider, apply_response_cache
This was
linked to
issues
Feb 25, 2026
- Replace unused LlmProvider import with IndexConfig in agent_setup.rs - Change apply_code_index provider param from impl LlmProvider to AnyProvider - Add LlmProvider trait import under index cfg gate in runner.rs - Replace generic P: LlmProvider in TuiRunParams/run_tui_agent with AnyProvider - Box::pin large futures in main.rs and runner.rs to satisfy clippy::large_futures
- Remove bootstrap.rs (replaced by bootstrap/ submodule directory); apply vault() doc comment from #902 to bootstrap/mod.rs - Update CHANGELOG.md combining #839/#840 and #848/#849/#850 entries - Fix src/commands/skill.rs: use SourceKind enum from zeph_memory::sqlite instead of stringly-typed source_kind values
bug-ops
added a commit
that referenced
this pull request
Feb 25, 2026
- Resolve modify/delete conflict: bootstrap.rs refactored into bootstrap/ module (#906) - Resolve content conflict: main.rs tests extracted to src/tests.rs (#906) - Apply #[allow(unsafe_code)] to std::env tests in bootstrap/tests.rs and src/commands/vault.rs - Add 4 BTreeMap coverage tests to vault.rs (deterministic order, save/load roundtrip, into_iter regression)
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
Implements epic #831 — binary crate restructuring (closes #839, #840).
src/main.rsreduced from 3177 to 26 LOC — thin orchestrator delegating torunner::run()crates/zeph-core/src/bootstrap/mod.rsreduced from 1791 to 278 LOC —AppBuilderonlyChanges
Binary crate (
zeph):src/runner.rs— dispatch logic for all run modes (acp, tui-remote, tui, cli, daemon)src/agent_setup.rs— tool executor + MCP setup, feature-gated extensions (index, candle-stt, whisper-stt)src/tracing_init.rs—init_file_logger()deduplicates 4 identical tracing init blockssrc/tui_bridge.rs—run_tui_agent()extracted from main()src/channel.rs—build_cli_history()extracted from main()src/tests.rs— unit tests moved from main.rszeph-corebootstrap:bootstrap/config.rs— config path resolution, vault arg parsingbootstrap/health.rs— health check and provider warmupbootstrap/mcp.rs— MCP manager and registry creationbootstrap/provider.rs— provider factory functionsbootstrap/skills.rs— skill matcher and embedding model helpersbootstrap/tests.rs— unit tests moved from bootstrap/mod.rsTest plan
cargo buildpassescargo clippy --workspace -- -D warnings— zero warningscargo +nightly fmt --check— cleancargo nextest run --workspace --lib --bins— 2693 passed, 9 skipped