find_parent_resources

Function find_parent_resources 

Source
pub fn find_parent_resources(
    lockfile: &LockFile,
    resource_name: &str,
) -> Vec<String>
Expand description

Find parent resources that depend on the given resource.

This function searches through the lockfile to find resources that list the given resource name in their dependencies field. This is useful for error reporting to show which resources depend on a failing resource.

§Arguments

  • lockfile - The lockfile to search
  • resource_name - The canonical name of the resource to find parents for

§Returns

A vector of parent resource names (manifest aliases if available, otherwise canonical names) that directly depend on the given resource.

§Examples

use agpm_cli::lockfile::LockFile;
use agpm_cli::installer::find_parent_resources;

let lockfile = LockFile::default();
let parents = find_parent_resources(&lockfile, "agents/helper");
if !parents.is_empty() {
    println!("Resource is required by: {}", parents.join(", "));
}