Skip to content

Commit 82fa33d

Browse files
authored
refactor: extract bootstrap/AppBuilder from main.rs (M24) (#425)
* refactor: extract bootstrap/AppBuilder from main.rs (#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 * fix: remove unused imports in main.rs tests * docs: update architecture docs, changelog, readme for AppBuilder extraction
1 parent 6408363 commit 82fa33d

File tree

10 files changed

+1785
-1528
lines changed

10 files changed

+1785
-1528
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
2525
- `full` feature flag enabling all optional features
2626

2727
### Changed
28+
- Extract bootstrap logic from main.rs into `zeph-core::bootstrap::AppBuilder` (#393): main.rs reduced from 2313 to 978 lines
29+
- `SecurityConfig` and `TimeoutConfig` gain `Clone + Copy`
2830
- `AnyChannel` moved from main.rs to zeph-channels crate
2931
- Default features reduced to minimal set (qdrant, self-learning, vault-age, compatible, index)
3032
- Skill matcher concurrency reduced from 50 to 20

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ repository.workspace = true
106106
default = ["compatible", "openai", "qdrant", "self-learning", "vault-age"]
107107
full = ["a2a", "compatible", "discord", "gateway", "index", "mcp", "openai", "orchestrator", "qdrant", "router", "self-learning", "slack", "tui", "vault-age"]
108108
a2a = ["dep:zeph-a2a", "zeph-a2a?/server"]
109-
compatible = ["zeph-llm/compatible"]
109+
compatible = ["zeph-llm/compatible", "zeph-core/compatible"]
110110
mcp = ["dep:zeph-mcp", "zeph-core/mcp"]
111-
qdrant = ["zeph-skills/qdrant", "zeph-mcp?/qdrant"]
112-
candle = ["zeph-llm/candle"]
113-
metal = ["zeph-llm/metal"]
114-
cuda = ["zeph-llm/cuda"]
115-
openai = ["zeph-llm/openai"]
116-
orchestrator = ["zeph-llm/orchestrator"]
117-
router = ["zeph-llm/router"]
111+
qdrant = ["zeph-skills/qdrant", "zeph-mcp?/qdrant", "zeph-core/qdrant"]
112+
candle = ["zeph-llm/candle", "zeph-core/candle"]
113+
metal = ["zeph-llm/metal", "zeph-core/metal"]
114+
cuda = ["zeph-llm/cuda", "zeph-core/cuda"]
115+
openai = ["zeph-llm/openai", "zeph-core/openai"]
116+
orchestrator = ["zeph-llm/orchestrator", "zeph-core/orchestrator"]
117+
router = ["zeph-llm/router", "zeph-core/router"]
118118
self-learning = ["zeph-core/self-learning"]
119119
tui = ["dep:zeph-tui"]
120120
discord = ["zeph-channels/discord"]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ cargo build --release --features tui
125125
## Architecture
126126

127127
```
128-
zeph (binary) — bootstrap, vault resolution (anyhow for top-level errors)
129-
├── zeph-core — Agent split into 7 submodules (context, streaming, persistence,
130-
│ learning, mcp, index), daemon supervisor, typed AgentError/ChannelError, config hot-reload
128+
zeph (binary) — thin CLI/channel dispatch (anyhow for top-level errors)
129+
├── zeph-core — bootstrap/AppBuilder, Agent split into 7 submodules (context, streaming,
130+
persistence, learning, mcp, index), daemon supervisor, typed AgentError/ChannelError, config hot-reload
131131
├── zeph-llm — LlmProvider: Ollama, Claude, OpenAI, Candle, Compatible, orchestrator,
132132
│ RouterProvider, native tool_use (Claude/OpenAI), typed LlmError
133133
├── zeph-skills — SKILL.md parser, embedding matcher, hot-reload, self-learning, typed SkillError

crates/zeph-core/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ repository.workspace = true
88

99
[features]
1010
default = []
11+
candle = ["zeph-llm/candle"]
12+
compatible = ["zeph-llm/compatible"]
13+
cuda = ["zeph-llm/cuda"]
14+
daemon = []
1115
index = ["dep:zeph-index"]
1216
mcp = ["dep:zeph-mcp"]
13-
daemon = []
17+
metal = ["zeph-llm/metal"]
18+
openai = ["zeph-llm/openai"]
19+
orchestrator = ["zeph-llm/orchestrator"]
20+
qdrant = ["zeph-skills/qdrant", "zeph-mcp?/qdrant"]
21+
router = ["zeph-llm/router"]
1422
self-learning = ["zeph-skills/self-learning"]
1523
vault-age = ["dep:age"]
1624

0 commit comments

Comments
 (0)