feat: add main features
Agents for developpement added + frontend add + backend added. Git viewer created + agent and template creator + layout and project creator
This commit is contained in:
45
crates/domain/src/git.rs
Normal file
45
crates/domain/src/git.rs
Normal file
@ -0,0 +1,45 @@
|
||||
//! 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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user