capo_agent/skills/types.rs
1//! Skill data types loaded from `~/.capo/agent/skills/` and
2//! `<project>/.capo/skills/`. See design spec §5.4 and brief §2.
3
4use std::path::PathBuf;
5
6/// Where a skill was discovered. Used for diagnostics + project-overrides-global precedence.
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum SkillSource {
9 Global,
10 Project,
11}
12
13/// One loaded skill.
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct Skill {
16 /// Validated name (lowercase a-z, 0-9, hyphens only; ≤64 chars).
17 pub name: String,
18 /// Validated description (non-empty; ≤1024 chars).
19 pub description: String,
20 /// Absolute path to the markdown file. Sent to the LLM as `<location>`.
21 pub file_path: PathBuf,
22 /// Parent directory of `file_path`. Relative paths in the body resolve against this.
23 pub base_dir: PathBuf,
24 /// When true, omitted from `<available_skills>` and only invokable via `/skill:<name>`.
25 pub disable_model_invocation: bool,
26 /// Source bucket for diagnostics.
27 pub source: SkillSource,
28}
29
30/// Non-fatal load issue. Caller logs via `tracing::warn!` and continues.
31#[derive(Debug, Clone, PartialEq, Eq)]
32pub struct SkillDiagnostic {
33 pub file_path: PathBuf,
34 pub message: String,
35}
36
37/// Aggregated load result.
38#[derive(Debug, Default, Clone, PartialEq, Eq)]
39pub struct LoadSkillsResult {
40 pub skills: Vec<Skill>,
41 pub diagnostics: Vec<SkillDiagnostic>,
42}