pub fn topological_sort(index: &Index) -> Result<Vec<String>, Error>Expand description
Topologically sort all units by dependency order.
Returns a list of unit IDs where each unit appears after all its dependencies. Units with no dependencies appear first.
§Errors
- Returns an error if a cycle is detected in the dependency graph.
§Example
use mana_core::api::{load_index, topological_sort};
use std::path::Path;
let mana_dir = Path::new("/project/.mana");
let index = load_index(mana_dir).unwrap();
let order = topological_sort(&index).unwrap();
println!("Execution order: {:?}", order);