sara_core/diff/
options.rs

1//! Diff options for comparing knowledge graphs.
2
3use std::path::PathBuf;
4
5/// Options for computing a diff between two graph states.
6#[derive(Debug, Clone)]
7pub struct DiffOptions {
8    /// First reference (baseline, e.g., "main", "HEAD~1", commit SHA).
9    pub ref1: String,
10    /// Second reference (target, e.g., "HEAD", branch name).
11    pub ref2: String,
12    /// Repository paths to compare.
13    pub repositories: Vec<PathBuf>,
14    /// Show summary statistics only.
15    pub stat: bool,
16}
17
18impl DiffOptions {
19    /// Creates new diff options.
20    pub fn new(ref1: impl Into<String>, ref2: impl Into<String>) -> Self {
21        Self {
22            ref1: ref1.into(),
23            ref2: ref2.into(),
24            repositories: Vec::new(),
25            stat: false,
26        }
27    }
28
29    /// Sets the repository paths.
30    pub fn with_repositories(mut self, repositories: Vec<PathBuf>) -> Self {
31        self.repositories = repositories;
32        self
33    }
34
35    /// Adds a repository path.
36    pub fn add_repository(mut self, path: PathBuf) -> Self {
37        self.repositories.push(path);
38        self
39    }
40
41    /// Sets whether to show only summary statistics.
42    pub fn with_stat(mut self, stat: bool) -> Self {
43        self.stat = stat;
44        self
45    }
46}