mod internal;
use anyhow::Result;
use std::path::{Path, PathBuf};
pub use internal::{
AdaptersSection, CiSection, DevSection, EmbeddingsSection, EnvironmentSection, ProjectConfig,
ProjectSection, RetrievalSection, SearchSection, UpstreamSection,
};
pub fn is_patina_project(path: &Path) -> bool {
internal::is_patina_project(path)
}
pub fn has_legacy_config(path: &Path) -> bool {
internal::has_legacy_config(path)
}
pub fn load(project_path: &Path) -> Result<ProjectConfig> {
internal::load(project_path)
}
pub fn load_with_migration(project_path: &Path) -> Result<ProjectConfig> {
internal::load_with_migration(project_path)
}
pub fn migrate(project_path: &Path) -> Result<bool> {
internal::migrate_legacy_config(project_path)
}
pub fn save(project_path: &Path, config: &ProjectConfig) -> Result<()> {
internal::save(project_path, config)
}
pub fn patina_dir(project_path: &Path) -> PathBuf {
internal::patina_dir(project_path)
}
pub fn local_dir(project_path: &Path) -> PathBuf {
internal::local_dir(project_path)
}
pub fn backups_dir(project_path: &Path) -> PathBuf {
internal::backups_dir(project_path)
}
pub fn backup_file(project_path: &Path, file_path: &Path) -> Result<Option<PathBuf>> {
internal::backup_file(project_path, file_path)
}
pub fn create_uid_if_missing(project_path: &Path) -> Result<String> {
internal::create_uid_if_missing(project_path)
}
pub fn get_uid(project_path: &Path) -> Option<String> {
internal::get_uid(project_path)
}
pub fn uid_path(project_path: &Path) -> PathBuf {
internal::uid_path(project_path)
}
pub fn is_versioning_enabled(project_path: &Path) -> bool {
internal::is_versioning_enabled(project_path)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_patina_dir() {
let path = patina_dir(Path::new("/some/project"));
assert!(path.ends_with(".patina"));
}
}