devist 0.6.0

Project bootstrap CLI for AI-assisted development. Spin up new projects from templates, manage backends, and keep your codebase comprehensible.
use anyhow::{Context, Result};
use std::path::PathBuf;

pub fn home() -> Result<PathBuf> {
    dirs::home_dir().context("Could not determine home directory")
}

pub fn devist_root() -> Result<PathBuf> {
    Ok(home()?.join(".devist"))
}

pub fn config_file() -> Result<PathBuf> {
    Ok(devist_root()?.join("config.toml"))
}

pub fn registry_file() -> Result<PathBuf> {
    Ok(devist_root()?.join("registry.toml"))
}

pub fn templates_dir() -> Result<PathBuf> {
    Ok(devist_root()?.join("templates"))
}

#[allow(dead_code)]
pub fn cache_dir() -> Result<PathBuf> {
    Ok(devist_root()?.join("cache"))
}

pub fn worker_dir() -> Result<PathBuf> {
    Ok(devist_root()?.join("worker"))
}

pub fn worker_config_file() -> Result<PathBuf> {
    Ok(worker_dir()?.join("config.toml"))
}

pub fn worker_db_file() -> Result<PathBuf> {
    Ok(worker_dir()?.join("worker.db"))
}

pub fn worker_pid_file() -> Result<PathBuf> {
    Ok(worker_dir()?.join("worker.pid"))
}

pub fn worker_log_file() -> Result<PathBuf> {
    Ok(worker_dir()?.join("worker.log"))
}

pub fn worker_rules_file() -> Result<PathBuf> {
    Ok(worker_dir()?.join("rules.md"))
}