Skip to main content

add_dep

Function add_dep 

Source
pub fn add_dep(
    mana_dir: &Path,
    from_id: &str,
    dep_id: &str,
) -> Result<DepAddResult, Error>
Expand description

Add a dependency: from_id depends on dep_id.

Validates both units exist, checks for self-dependency, detects cycles, and persists the change.

§Errors

  • anyhow::Error — unit not found, self-dependency, or cycle detected

§Example

use mana_core::api::add_dep;
use std::path::Path;

// Unit 3 now depends on unit 2
add_dep(Path::new("/project/.mana"), "3", "2").unwrap();