Cargo Workspace Split
Status: Deferred — Phase 3 (trigger not yet met, but architecture is ready)
When to do this
Section titled “When to do this”jackin today is ~91K lines of production Rust (116 files in src/) — still below the ~150K threshold where a multi-crate Cargo workspace outweighs its overhead, but growing fast (was ~50K at original analysis — 82% growth). This item is not ready to execute. The trigger conditions are:
- LOC exceeds ~150K, or
- A sub-component needs external consumers for third-party agent manifest tooling, or
- Compile times on the CI
checkjob exceed 5 minutes cold cache
Target 6-crate structure
Section titled “Target 6-crate structure”Follows matklad’s virtual manifest + flat crates/ pattern:
jackin/├── Cargo.toml ← virtual workspace manifest (no [package])├── crates/│ ├── jackin-core/ ← Tier 0: workspace types, manifest, selector, paths, docker trait│ ├── jackin-config/ ← Tier 1: TOML persistence (AppConfig, ConfigEditor)│ ├── jackin-tui/ ← Tier 1: terminal output, animation, prompts│ ├── jackin-runtime/ ← Tier 2: container bootstrap pipeline│ ├── jackin-console/ ← Tier 3: workspace manager TUI + operator_env│ └── jackin-shell/ ← ShellRunner (concrete subprocess impl)├── src/ ← thin binary (CLI dispatch)└── validate/ ← jackin-validate binaryDependency tiers (verified)
Section titled “Dependency tiers (verified)”- Tier 0 (no cross-module deps):
workspace/,manifest/,docker.rs,paths.rs,selector.rs - Tier 1:
config/,tui/,instance/,env_resolver/ - Tier 2:
operator_env/,runtime/,repo/ - Tier 3:
console/— almost no import fromruntime/(2 call sites need fixing first)
Prerequisites before this phase
Section titled “Prerequisites before this phase”- Phase 2 file splits — establish clean internal module boundaries
- Phase 1.5 DRY extractions — reduce duplication that would otherwise be frozen into crate APIs
- Fix the 2 console→runtime dependencies —
register_agent_repoandRepoErrormust move to a shared module or through a trait
Related files
Section titled “Related files”Cargo.toml— target: convert to virtual workspace manifestsrc/console/manager/input/editor.rs— contains the 2 runtime dependencies that must be resolvedsrc/runtime/launch.rs— the runtime entry point (7575L)