pub struct TracevaultConfig {
pub agent: String,
pub server_url: Option<String>,
pub api_key: Option<String>,
pub org_slug: Option<String>,
pub repo_id: Option<String>,
pub user_context: Option<UserContext>,
}Fields§
§agent: String§server_url: Option<String>§api_key: Option<String>§org_slug: Option<String>§repo_id: Option<String>§user_context: Option<UserContext>Implementations§
Source§impl TracevaultConfig
impl TracevaultConfig
pub fn config_dir(project_root: &Path) -> PathBuf
pub fn config_path(project_root: &Path) -> PathBuf
Sourcepub fn ensure_gitignore(config_dir: &Path) -> Result<()>
pub fn ensure_gitignore(config_dir: &Path) -> Result<()>
Ensure a .gitignore exists inside config_dir (a .tracevault/ dir)
so runtime artifacts are ignored no matter where the directory was
created — including the per-subproject .tracevault/ dirs the stream
hook may create from a nested working directory. Idempotent: an existing
.gitignore is never overwritten. Best-effort; callers may ignore the
result (a failure must never break the hook).
pub fn to_toml(&self) -> String
Sourcepub fn try_load(project_root: &Path) -> Result<Option<Self>, String>
pub fn try_load(project_root: &Path) -> Result<Option<Self>, String>
Load config.toml, distinguishing a missing file (Ok(None)) from a
present-but-malformed one (Err(message)). Callers that need to react
differently to those two cases (e.g. to avoid silently writing to a
default path when a configured one failed to parse) should use this.
Only a genuine “not found” counts as missing; any other IO error (e.g.
permission denied) is surfaced as Err with the path, rather than being
masked as an absent config.