Skip to main content

mars_agents/target/
agents.rs

1/// `.agents` target adapter — deprecated full-fidelity legacy output.
2///
3/// This is the primary target that Meridian reads at runtime. It emits:
4/// - `agents/<name>.md` — full-fidelity agent markdown with frontmatter preserved
5/// - `skills/<name>/` — portable skill trees also consumed by external harnesses
6///
7/// See `design/spec/agents-target-adapter.md` for the V0 contract. The key
8/// point: NO field stripping — all agent frontmatter fields needed by Meridian
9/// are preserved.
10use crate::lock::ItemKind;
11use crate::types::DestPath;
12
13use super::TargetAdapter;
14
15#[derive(Debug)]
16pub struct AgentsAdapter;
17
18impl TargetAdapter for AgentsAdapter {
19    fn name(&self) -> &str {
20        ".agents"
21    }
22
23    fn skill_variant_key(&self) -> Option<&str> {
24        None
25    }
26
27    fn default_dest_path(&self, kind: ItemKind, name: &str) -> Option<DestPath> {
28        let path = match kind {
29            ItemKind::Agent => format!("agents/{name}.md"),
30            ItemKind::Skill => format!("skills/{name}"),
31            ItemKind::Hook => format!("hooks/{name}"),
32            ItemKind::McpServer => format!("mcp/{name}"),
33            ItemKind::BootstrapDoc => format!("bootstrap/{name}/BOOTSTRAP.md"),
34        };
35        Some(DestPath::from(path.as_str()))
36    }
37}