Agents for developpement added + frontend add + backend added. Git viewer created + agent and template creator + layout and project creator
46 lines
1.3 KiB
Rust
46 lines
1.3 KiB
Rust
//! Git repository entity (domain state image).
|
|
//!
|
|
//! This is the *entity* describing the derived git state of a project. The
|
|
//! git **port** (operations) lives in [`crate::ports`].
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::ids::ProjectId;
|
|
use crate::project::ProjectPath;
|
|
|
|
/// Derived git state for a project, refreshed via the git port.
|
|
///
|
|
/// Invariant (operational, not enforced here): `root` contains — or will
|
|
/// contain after `init` — a `.git` directory. This is verified by the
|
|
/// infrastructure adapter, not by the pure domain.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct GitRepository {
|
|
/// Owning project.
|
|
pub project_id: ProjectId,
|
|
/// Repository root.
|
|
pub root: ProjectPath,
|
|
/// Current branch name, if the repo is on a branch.
|
|
pub current_branch: Option<String>,
|
|
/// Whether the working tree has uncommitted changes.
|
|
pub is_dirty: bool,
|
|
}
|
|
|
|
impl GitRepository {
|
|
/// Builds a git-state snapshot.
|
|
#[must_use]
|
|
pub fn new(
|
|
project_id: ProjectId,
|
|
root: ProjectPath,
|
|
current_branch: Option<String>,
|
|
is_dirty: bool,
|
|
) -> Self {
|
|
Self {
|
|
project_id,
|
|
root,
|
|
current_branch,
|
|
is_dirty,
|
|
}
|
|
}
|
|
}
|