Skip to content

Cargo Workspace Split

Status: Deferred — Phase 3 (trigger not yet met, but architecture is ready)

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 check job exceed 5 minutes cold cache

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 binary
  • 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 from runtime/ (2 call sites need fixing first)
  1. Phase 2 file splits — establish clean internal module boundaries
  2. Phase 1.5 DRY extractions — reduce duplication that would otherwise be frozen into crate APIs
  3. Fix the 2 console→runtime dependenciesregister_agent_repo and RepoError must move to a shared module or through a trait