pub fn apply_init(
target_dir: &Path,
force: bool,
) -> Result<ApplyResult, ApplyError>Expand description
Apply rust-bucket to a target directory for the first time.
This function implements the first-time flow as specified in ARCHITECTURE.md:
- Assert Cargo.toml exists (this is a Rust crate)
- Assert .git/ exists (git init was done)
- Check for conflicts using generator::check_conflicts()
- If conflicts exist and !force, fail with list of conflicts
- If conflicts exist and force, warn and continue
- Prompt for choices (test_timeout) using cli::prompt_test_timeout()
- Create Config with choices
- Write rust-bucket.toml using config.save()
- Extract templates to temp dir using templates::extract_to_temp()
- Render templates to target dir using generator::render()
- Run verification using verify::run_all()
- Return result
§Arguments
target_dir- The target directory to apply rust-bucket toforce- If true, overwrite existing managed files; if false, fail on conflicts
§Errors
Returns ApplyError if:
- The target is not a Rust crate (no Cargo.toml)
- The target is not a git repository (no .git/)
- Conflicting files exist and force is false
- Any step in the process fails (config save, template extraction, rendering, verification)