patina-ai 0.23.0

Context orchestration for AI development - captures and evolves patterns over time
Documentation
//! Domain types for forge abstraction.
//!
//! Platform-agnostic types for issues, pull requests, and forge metadata.
//! Used by ForgeReader implementations (GitHub, Gitea, etc.)

use serde::{Deserialize, Serialize};

/// Detected forge information from remote URL.
#[derive(Debug, Clone)]
pub struct Forge {
    pub kind: ForgeKind,
    pub owner: String,
    pub repo: String,
    pub host: String, // "github.com", "codeberg.org", etc.
}

/// Supported forge platforms.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ForgeKind {
    GitHub,
    Gitea, // Covers Gitea, Codeberg, Forgejo
    None,  // Local-only repo, no forge
}

/// Issue from any forge platform.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Issue {
    pub number: i64,
    pub title: String,
    pub body: Option<String>,
    pub state: IssueState,
    pub author: String,
    pub labels: Vec<String>,
    pub created_at: String,
    pub updated_at: String,
    pub url: String,
}

/// Pull/Merge Request from any forge platform.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PullRequest {
    pub number: i64,
    pub title: String,
    pub body: Option<String>,
    pub state: PrState,
    pub author: String,
    pub labels: Vec<String>,
    pub created_at: String,
    pub merged_at: Option<String>,
    pub url: String,
    // The valuable context
    pub linked_issues: Vec<i64>,
    pub comments: Vec<Comment>,
    pub approvals: i32,
}

/// Comment on an issue or PR.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Comment {
    pub author: String,
    pub body: String,
    pub created_at: String,
}

/// Issue state (platform-agnostic).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum IssueState {
    Open,
    Closed,
}

/// Pull request state (platform-agnostic).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PrState {
    Open,
    Merged,
    Closed,
}