blue/crates/blue-core/src/realm/mod.rs
Eric Garcia 6ff8ba706c feat: RFC 0038 SDLC workflow discipline implementation
- Add `blue guard` CLI command for PreToolUse hook integration
  - Allowlist patterns for .blue/docs/, .claude/, /tmp/, root *.md
  - Worktree detection and RFC branch validation
  - Audit logging for bypass tracking
- Add PreToolUse hook in .claude/settings.json
- Add produces_rfcs field to Spike struct for multi-RFC tracking
- Implement spike auto-close when RFC transitions to implemented
- Add ADR suggestions when RFC transitions to in-progress
- Add LocalRealmDependencies for .blue/realm.toml parsing
- Add blue_rfc_validate_realm tool for cross-repo RFC validation
- Add toml dependency for realm.toml parsing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 08:59:20 -05:00

79 lines
2.1 KiB
Rust

//! Realm data model for cross-repo coordination
//!
//! This module defines the data structures for:
//! - Realms (groups of coordinated repos)
//! - Domains (coordination contexts between repos)
//! - Contracts (schemas defining shared data)
//! - Bindings (export/import declarations)
//!
//! See RFC 0001: Cross-Repo Coordination with Realms
mod config;
mod contract;
mod domain;
mod repo;
mod service;
pub use config::{
AdmissionPolicy, BreakingChangePolicy, Governance, RealmConfig, TrustConfig, TrustMode,
};
pub use contract::{
Compatibility, Contract, ContractValue, EvolutionEntry, ValidationConfig,
};
pub use domain::{Binding, BindingRole, Domain, ExportBinding, ImportBinding, ImportStatus};
pub use repo::{
LocalRealmDependencies, LocalRealmMembership, LocalRepoConfig, RealmRef, RepoConfig,
RfcDependencies,
};
pub use service::{
CheckIssue, CheckIssueKind, CheckResult, DomainDetails, RealmDetails, RealmInfo,
RealmService, RealmSyncStatus, SyncResult, WorktreeInfo, WorktreePrStatus,
};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RealmError {
#[error("Failed to read file {path}: {source}")]
ReadFile {
path: String,
source: std::io::Error,
},
#[error("Failed to write file {path}: {source}")]
WriteFile {
path: String,
source: std::io::Error,
},
#[error("Failed to parse YAML: {0}")]
YamlParse(#[from] serde_yaml::Error),
#[error("Failed to parse JSON: {0}")]
JsonParse(#[from] serde_json::Error),
#[error("Invalid semver version: {0}")]
InvalidVersion(#[from] semver::Error),
#[error("Contract not found: {0}")]
ContractNotFound(String),
#[error("Domain not found: {0}")]
DomainNotFound(String),
#[error("Repo not found: {0}")]
RepoNotFound(String),
#[error("Validation failed: {0}")]
ValidationFailed(String),
#[error("Ownership violation: {contract} is owned by {owner}, not {attempted}")]
OwnershipViolation {
contract: String,
owner: String,
attempted: String,
},
#[error("Cycle detected: {0}")]
CycleDetected(String),
}