Skip to content

Comments

refactor: extract bootstrap/AppBuilder from main.rs (M24)#425

Merged
bug-ops merged 3 commits intomainfrom
feat/m24/app-builder
Feb 17, 2026
Merged

refactor: extract bootstrap/AppBuilder from main.rs (M24)#425
bug-ops merged 3 commits intomainfrom
feat/m24/app-builder

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 17, 2026

Summary

Extract initialization logic from the 2300-line main.rs into a structured AppBuilder in zeph-core::bootstrap, reducing main.rs to ~980 lines.

New module: crates/zeph-core/src/bootstrap.rs

AppBuilder provides a structured bootstrap API:

  • from_env() — resolve config path, load config, create vault, resolve secrets
  • build_provider() — create AnyProvider with health check and context window detection
  • build_memory() — SemanticMemory setup with embed_missing backfill
  • build_skill_matcher() — Qdrant or in-memory skill matching backend
  • build_registry() — SkillRegistry with hot-reload
  • build_tool_executor() — CompositeExecutor with shell, scrape, MCP tools
  • build_watchers() — skill and config file watchers
  • build_shutdown() — graceful shutdown signal handler
  • build_summary_provider() — optional summarization provider

What stays in main.rs

  • CLI argument parsing (clap)
  • Channel creation (AnyChannel dispatch)
  • TUI-specific wiring (AppChannel, TuiHandle)
  • A2A/Gateway server spawning
  • Agent builder chain and run loop

Other changes

  • Feature forwarding from root Cargo.toml to zeph-core (candle, compatible, cuda, metal, openai, orchestrator, qdrant, router)
  • SecurityConfig and TimeoutConfig gain Clone + Copy

Stats

  • 6 files changed, +1777 / -1522
  • main.rs: 2313 -> 978 lines
  • 1533 tests pass, 0 failures
  • Clippy clean, fmt clean

Test plan

  • cargo nextest run --workspace --lib --bins --features full,mock (1533 pass)
  • cargo clippy --workspace --features full,mock -- -D warnings (clean)
  • Code review approved
  • CI gate passes

Resolves #393

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
@bug-ops bug-ops force-pushed the feat/m24/app-builder branch from 1301784 to 85274fb Compare February 17, 2026 03:19
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 17, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 17, 2026 03:31
@bug-ops bug-ops merged commit 82fa33d into main Feb 17, 2026
20 checks passed
@bug-ops bug-ops deleted the feat/m24/app-builder branch February 17, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract bootstrap/AppBuilder from main.rs

1 participant