refactor: extract bootstrap/AppBuilder from main.rs (M24)#425
Merged
Conversation
Move 16 initialization functions from main.rs into crates/zeph-core/src/bootstrap.rs with AppBuilder struct. AppBuilder::from_env() resolves config, vault, and secrets. Build methods: build_provider(), build_memory(), build_skill_matcher(), build_registry(), build_tool_executor(), build_watchers(), build_shutdown(), build_summary_provider(). main.rs reduced from 2313 to 978 lines. Remaining: CLI parsing, channel creation, TUI wiring, A2A server, agent run loop. Add feature forwarding in zeph-core (candle, compatible, cuda, metal, openai, orchestrator, qdrant, router). Add Clone+Copy to SecurityConfig and TimeoutConfig. Resolves #393
1301784 to
85274fb
Compare
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
Extract initialization logic from the 2300-line main.rs into a structured
AppBuilderinzeph-core::bootstrap, reducing main.rs to ~980 lines.New module:
crates/zeph-core/src/bootstrap.rsAppBuilderprovides a structured bootstrap API:from_env()— resolve config path, load config, create vault, resolve secretsbuild_provider()— create AnyProvider with health check and context window detectionbuild_memory()— SemanticMemory setup with embed_missing backfillbuild_skill_matcher()— Qdrant or in-memory skill matching backendbuild_registry()— SkillRegistry with hot-reloadbuild_tool_executor()— CompositeExecutor with shell, scrape, MCP toolsbuild_watchers()— skill and config file watchersbuild_shutdown()— graceful shutdown signal handlerbuild_summary_provider()— optional summarization providerWhat stays in main.rs
Other changes
SecurityConfigandTimeoutConfiggainClone + CopyStats
Test plan
Resolves #393