agileplus-domain 0.3.0

Typed intent graphs for engineering work — convert prompts into validated DAGs of intents, features, tasks, tests, and edges, then store, query, and serve them from Rust, HTTP, or MCP.
Documentation
//! `MetaBuilder` — constructs `agileplus_domain::intent_graph::Meta` records.

use crate::intent_graph::Meta;

/// Builder for the `Meta` struct attached to every node and edge.
#[derive(Debug, Default)]
pub struct MetaBuilder {
    confidence: Option<f64>,
    source: Option<String>,
    timestamp: Option<String>,
    agent_id: Option<String>,
}

impl MetaBuilder {
    pub fn new() -> Self {
        Self::default()
    }

    pub fn confidence(mut self, c: f64) -> Self {
        self.confidence = Some(c);
        self
    }

    pub fn source(mut self, s: impl Into<String>) -> Self {
        self.source = Some(s.into());
        self
    }

    pub fn timestamp(mut self, t: impl Into<String>) -> Self {
        self.timestamp = Some(t.into());
        self
    }

    pub fn now(mut self) -> Self {
        self.timestamp = Some(chrono::Utc::now().to_rfc3339());
        self
    }

    pub fn agent_id(mut self, a: impl Into<String>) -> Self {
        self.agent_id = Some(a.into());
        self
    }

    pub fn build(self) -> Result<Meta, String> {
        Ok(Meta {
            confidence: self.confidence,
            source: self.source.ok_or("source is required")?,
            timestamp: self.timestamp.ok_or("timestamp is required")?,
            agent_id: self.agent_id,
        })
    }
}