pub struct DependencyMetadata {
pub dependencies: Option<BTreeMap<String, Vec<DependencySpec>>>,
pub agpm: Option<AgpmMetadata>,
/* private fields */
}Expand description
Metadata extracted from resource files.
This structure represents the dependency information that can be embedded within resource files themselves, either as YAML frontmatter in Markdown files or as JSON fields in JSON configuration files.
Fields§
§dependencies: Option<BTreeMap<String, Vec<DependencySpec>>>Maps resource type to list of dependency specifications.
The keys are resource types: “agents”, “snippets”, “commands”, “scripts”, “hooks”, “mcp-servers”.
Example:
dependencies:
agents:
- path: agents/helper.md
version: v1.0.0
snippets:
- path: snippets/utils.mdagpm: Option<AgpmMetadata>AGPM-specific metadata wrapper supporting templating and nested dependencies.
Example with templating flag and nested dependencies:
agpm:
templating: true
dependencies:
snippets:
- path: snippets/utils.mdImplementations§
Source§impl DependencyMetadata
impl DependencyMetadata
Sourcepub fn new(
dependencies: Option<BTreeMap<String, Vec<DependencySpec>>>,
agpm: Option<AgpmMetadata>,
) -> Self
pub fn new( dependencies: Option<BTreeMap<String, Vec<DependencySpec>>>, agpm: Option<AgpmMetadata>, ) -> Self
Create a new DependencyMetadata with the given dependencies and agpm metadata.
Sourcepub fn get_dependencies(&self) -> Option<&BTreeMap<String, Vec<DependencySpec>>>
pub fn get_dependencies(&self) -> Option<&BTreeMap<String, Vec<DependencySpec>>>
Get merged dependencies from both nested and root-level locations.
Merges agpm.dependencies and dependencies into a unified view.
Root-level dependencies are added first, then nested dependencies.
Duplicates (same path and name) are removed, keeping the first occurrence.
Sourcepub fn get_dependencies_typed(
&self,
) -> Option<HashMap<ResourceType, Vec<DependencySpec>>>
pub fn get_dependencies_typed( &self, ) -> Option<HashMap<ResourceType, Vec<DependencySpec>>>
Get merged dependencies with ResourceType keys instead of strings.
This is a type-safe version of get_dependencies() that parses the
string keys into ResourceType enums. Invalid resource type strings are logged
and skipped.
§Returns
HashMap with ResourceType keys, or None if no valid dependencies
Sourcepub fn has_dependencies(&self) -> bool
pub fn has_dependencies(&self) -> bool
Check if metadata contains any non-empty dependencies.
Sourcepub fn dependency_count(&self) -> usize
pub fn dependency_count(&self) -> usize
Count total dependencies across all resource types.
Trait Implementations§
Source§impl Clone for DependencyMetadata
impl Clone for DependencyMetadata
Source§fn clone(&self) -> DependencyMetadata
fn clone(&self) -> DependencyMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DependencyMetadata
impl Debug for DependencyMetadata
Source§impl Default for DependencyMetadata
impl Default for DependencyMetadata
Source§fn default() -> DependencyMetadata
fn default() -> DependencyMetadata
Source§impl<'de> Deserialize<'de> for DependencyMetadata
impl<'de> Deserialize<'de> for DependencyMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DependencyMetadata
impl PartialEq for DependencyMetadata
Source§impl Serialize for DependencyMetadata
impl Serialize for DependencyMetadata
impl Eq for DependencyMetadata
impl StructuralPartialEq for DependencyMetadata
Auto Trait Implementations§
impl !Freeze for DependencyMetadata
impl !RefUnwindSafe for DependencyMetadata
impl Send for DependencyMetadata
impl !Sync for DependencyMetadata
impl Unpin for DependencyMetadata
impl UnwindSafe for DependencyMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more