pub fn create_unit(
mana_dir: &Path,
params: CreateParams,
) -> Result<CreateResult, Error>Expand description
Create a new unit.
Assigns the next sequential ID (or child ID if params.parent is set),
writes the unit file, and rebuilds the index.
§Errors
anyhow::Error— validation failure, I/O error, or hook rejection
§Example
use mana_core::api::create_unit;
use mana_core::ops::create::CreateParams;
use std::path::Path;
let result = create_unit(Path::new("/project/.mana"), CreateParams {
title: "Fix the login bug".to_string(),
verify: Some("cargo test --test login".to_string()),
..Default::default()
}).unwrap();
println!("Created unit {}", result.unit.id);