pub fn extract_resource_name(path: &Path) -> StringExpand description
Extracts a resource name from a file path.
This function determines an appropriate resource name by extracting the file stem (filename without extension) from the path. This is used when generating resource names for pattern-based dependencies.
§Arguments
path- The file path to extract a name from
§Returns
The file stem as a string, or “unknown” if the path has no filename.
§Examples
use agpm_cli::pattern::extract_resource_name;
use std::path::Path;
assert_eq!(extract_resource_name(Path::new("agents/helper.md")), "helper");
assert_eq!(extract_resource_name(Path::new("/path/to/script.py")), "script");
assert_eq!(extract_resource_name(Path::new("no-extension")), "no-extension");
assert_eq!(extract_resource_name(Path::new("/")), "unknown");