pub mod conflicts;
pub mod docs;
pub mod git;
pub mod governance;
pub mod intents;
pub mod learnings;
pub mod session;
pub mod source;
pub mod specs;
use std::path::{Path, PathBuf};
use std::time::{SystemTime, UNIX_EPOCH};
use crate::error::PawError;
#[must_use]
pub fn now_unix() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.map_or(0, |d| d.as_secs())
}
#[must_use]
pub fn resolve_under_root(repo_root: &Path, path: &Path) -> PathBuf {
if path.is_absolute() {
path.to_path_buf()
} else {
repo_root.join(path)
}
}
pub fn read_optional_doc(
repo_root: &Path,
configured: Option<&Path>,
) -> Result<Option<String>, PawError> {
let Some(rel) = configured else {
return Ok(None);
};
let path = resolve_under_root(repo_root, rel);
std::fs::read_to_string(&path).map(Some).map_err(|e| {
PawError::McpError(format!(
"configured governance path {} could not be read: {e}",
path.display()
))
})
}