Parse model annotations from skill frontmatter (#38467)

## What changed

- Add an optional `model` field to parsed and loaded skill metadata.
- Recognize `model: luna` while ignoring unsupported model values without
  preventing the rest of the skill metadata from loading.

## Testing

- Cover supported, absent, unsupported, and repaired frontmatter model values.

GitOrigin-RevId: 376b65555e81d29a5eae93cc4c2633aacf7cd7c8
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-14 00:54:45 +00:00
1 parent c6dee5f49f
commit 3711943d11
17 files changed
+122 -1

No files matched your search

+11
View File
@@ -1,3 +1,4 @@
use crate::SkillModel;
use serde::Deserialize;
use thiserror::Error;
@@ -10,6 +11,8 @@ struct SkillFrontmatter {
#[serde(default)]
description: Option<String>,
#[serde(default)]
model: Option<serde_yaml::Value>,
#[serde(default)]
metadata: SkillFrontmatterMetadata,
}
@@ -25,6 +28,7 @@ pub struct ParsedSkillFrontmatter {
pub name: String,
pub description: String,
pub short_description: Option<String>,
pub model: Option<SkillModel>,
}
/// Error produced while parsing or validating `SKILL.md` metadata.
@@ -88,6 +92,13 @@ pub fn parse_skill_frontmatter_metadata(
name,
description,
short_description,
model: parsed.model.and_then(|model| {
serde_yaml::from_value(model)
.inspect_err(|error| {
tracing::warn!(%error, "ignoring invalid skill model annotation");
})
.ok()
}),
})
}