pub struct MarkdownMetadata {
pub title: Option<String>,
pub description: Option<String>,
pub version: Option<String>,
pub author: Option<String>,
pub tags: Vec<String>,
pub resource_type: Option<String>,
pub dependencies: Option<BTreeMap<String, Vec<DependencySpec>>>,
pub extra: BTreeMap<String, Value>,
}Expand description
Structured metadata extracted from Markdown frontmatter.
This struct represents all the metadata that can be parsed from YAML or TOML frontmatter in Markdown files. It follows a flexible schema that accommodates both standard AGPM fields and custom extensions.
§Standard Fields
The following fields have special meaning in AGPM:
title: Human-readable name for the resourcedescription: Brief explanation of what the resource doesversion: Version identifier (semantic versioning recommended)author: Creator or maintainer informationresource_type: Type classification (“agent” or “snippet”)tags: Categorization labels for filtering and discoverydependencies: Structured dependencies for transitive resolution
§Custom Fields
Additional fields are preserved in the extra map, allowing resource
authors to include custom metadata without breaking compatibility.
§Serialization
The struct uses Serde for serialization with skip-if-empty optimizations to keep generated frontmatter clean. Empty collections and None values are omitted from the output.
§Example
let mut metadata = MarkdownMetadata::default();
metadata.title = Some("Python Linter".to_string());
metadata.version = Some("2.0.1".to_string());
metadata.tags = vec!["python".to_string(), "linting".to_string()];
// Dependencies can be set as a JSON value for the structured format
// This is typically parsed from frontmatter rather than set programmatically
// Custom fields via extra map
let mut extra = BTreeMap::new();
extra.insert("license".to_string(), "MIT".into());
extra.insert("min_python".to_string(), "3.8".into());
metadata.extra = extra;Fields§
§title: Option<String>Human-readable title of the resource.
This is displayed in listings and used for resource identification. If not provided, the title may be extracted from the first heading in the Markdown content.
description: Option<String>Brief description explaining what the resource does.
Used for documentation and resource discovery. If not provided, the description may be extracted from the first paragraph in the Markdown content.
version: Option<String>Version identifier for the resource.
Semantic versioning (e.g., “1.2.3”) is recommended for compatibility with dependency resolution, but any string format is accepted.
Author or maintainer information.
Can be a name, organization, or contact information. Free-form text.
Classification tags for categorization and filtering.
Tags help with resource discovery and organization. Common patterns:
- Language-specific: “python”, “javascript”, “rust”
- Functionality: “linting”, “testing”, “documentation”
- Domain: “web-dev”, “data-science”, “devops”
resource_type: Option<String>Resource type classification.
Currently supported types:
- “agent”: Interactive Claude Code agents
- “snippet”: Code snippets and templates
This field uses rename = "type" to match the frontmatter format
while avoiding Rust’s type keyword.
dependencies: Option<BTreeMap<String, Vec<DependencySpec>>>Dependencies for this resource.
This field uses the structured transitive dependency format where dependencies are organized by resource type (agents, snippets, etc.). Each resource type maps to a list of dependency specifications.
Example:
dependencies:
agents:
- path: agents/helper.md
version: v1.0.0
snippets:
- path: snippets/utils.mdextra: BTreeMap<String, Value>Additional custom metadata fields.
Any frontmatter fields not recognized by the standard schema are preserved here. This allows resource authors to include custom metadata without breaking compatibility with AGPM.
Values are stored as serde_json::Value to handle mixed types
(strings, numbers, arrays, objects).
Uses BTreeMap for deterministic serialization order.
Implementations§
Source§impl MarkdownMetadata
impl MarkdownMetadata
Sourcepub fn get_agpm_metadata(&self) -> Option<AgpmMetadata>
pub fn get_agpm_metadata(&self) -> Option<AgpmMetadata>
Get AGPM-specific metadata from the extra fields.
Extracts the agpm section from the frontmatter if present,
which may contain templating flags and nested dependencies.
Trait Implementations§
Source§impl Clone for MarkdownMetadata
impl Clone for MarkdownMetadata
Source§fn clone(&self) -> MarkdownMetadata
fn clone(&self) -> MarkdownMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MarkdownMetadata
impl Debug for MarkdownMetadata
Source§impl Default for MarkdownMetadata
impl Default for MarkdownMetadata
Source§fn default() -> MarkdownMetadata
fn default() -> MarkdownMetadata
Source§impl<'de> Deserialize<'de> for MarkdownMetadata
impl<'de> Deserialize<'de> for MarkdownMetadata
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>,
Auto Trait Implementations§
impl Freeze for MarkdownMetadata
impl RefUnwindSafe for MarkdownMetadata
impl Send for MarkdownMetadata
impl Sync for MarkdownMetadata
impl Unpin for MarkdownMetadata
impl UnwindSafe for MarkdownMetadata
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<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