cartulary 0.3.0-alpha.1

The knowledge layer of your project — decisions, issues, docs, all in one place.
Documentation
use super::event::RawEvent;

/// A link entry as it appears in the `links:` YAML block.
#[derive(Debug, serde::Deserialize)]
pub struct RawLinkEntry {
    pub id: String,
    pub relationship: String,
}

/// Raw frontmatter for an issue `index.md`, as deserialised by `serde_yaml`.
///
/// All fields are `Option` or have defaults — missing optional keys yield
/// `None`/empty rather than a parse error. Mandatory fields (`id`, `title`,
/// `status`, `date`) are validated after deserialisation.
///
/// Legacy v2 scalar fields (`type`, `priority`, `size`) are accepted by the
/// deserializer (so unmigrated files still parse) but ignored by the
/// repository — the data lives in `tags` (`flow:*`, `priority:*`, `size:*`)
/// since ADR-0021. `cartu migrate` rewrites old files to v3.
#[derive(Debug, serde::Deserialize)]
pub struct RawIssueFrontmatter {
    pub id: Option<String>,
    pub title: Option<String>,
    pub description: Option<String>,
    #[serde(rename = "type", default)]
    pub _legacy_type: Option<serde_yaml::Value>,
    pub status: Option<String>,
    pub date: Option<String>,
    #[serde(default)]
    pub _legacy_priority: Option<serde_yaml::Value>,
    #[serde(default)]
    pub _legacy_size: Option<serde_yaml::Value>,
    pub assignee: Option<String>,
    pub due_date: Option<String>,
    pub tracker: Option<String>,
    #[serde(default)]
    pub tags: Vec<String>,
    /// Forwarding identifiers (ADR-0022). Empty for records that have not
    /// been migrated or renamed yet.
    #[serde(default)]
    pub aliases: Vec<String>,
    #[serde(default)]
    pub links: Vec<RawLinkEntry>,
    /// Cross-kind "see also" pointers — flat list of entity refs, distinct
    /// from typed `links:`. See DDR-018QWJVHRH35B and ISSUE-018P03NSC7VNQ.
    #[serde(default)]
    pub relates: Vec<String>,
    #[serde(default)]
    pub events: Vec<RawEvent>,
}

/// Raw frontmatter for a decision record `.md` file.
#[derive(Debug, serde::Deserialize)]
pub struct RawDrFrontmatter {
    pub id: Option<String>,
    pub title: Option<String>,
    pub description: Option<String>,
    pub status: Option<String>,
    pub date: Option<String>,
    #[serde(default)]
    pub tags: Vec<String>,
    /// Forwarding identifiers (ADR-0022). Empty for records that have not
    /// been migrated or renamed yet.
    #[serde(default)]
    pub aliases: Vec<String>,
    #[serde(default)]
    pub links: Vec<RawLinkEntry>,
    /// Cross-kind "see also" pointers — flat list of entity refs, distinct
    /// from typed `links:`. See DDR-018QWJVHRH35B and ISSUE-018P03NSC7VNQ.
    #[serde(default)]
    pub relates: Vec<String>,
    #[serde(default)]
    pub events: Vec<RawEvent>,
}