pub struct TracevaultConfig {
pub agent: String,
pub server_url: Option<String>,
pub api_key: Option<String>,
pub repo_id: Option<String>,
pub user_context: Option<UserContext>,
pub remote_id: Option<String>,
pub codebase_name: Option<String>,
pub default_project: Option<String>,
}Fields§
§agent: String§server_url: Option<String>§api_key: Option<String>Never persisted by this CLI (skip_serializing), but read back when a
hand-authored file supplies one: resolve_credentials uses it as the
lowest-precedence credential source. Not guarded by the server-URL
scoping there, since committing a key next to this config’s own
server_url is a deliberate act.
repo_id: Option<String>§user_context: Option<UserContext>§remote_id: Option<String>The remote (codebase)’s server-side id, resolved by init (best-effort)
via resolve_remote. Display-only today — repo_id stays authoritative
for ingest — but recorded so a future caller doesn’t have to re-resolve.
codebase_name: Option<String>The codebase’s registered name, resolved by init alongside remote_id.
Display-only — lets bound-mode status print the codebase without an
extra network round-trip.
default_project: Option<String>Client-side default project name for this repo (no server counterpart). Resolution precedence rung 3; resolved to an id at use time.
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 save(&self, project_root: &Path) -> Result<()>
pub fn save(&self, project_root: &Path) -> Result<()>
Write this config to project_root’s config.toml. Unlike a plain
to_toml rewrite, it keeps what the struct cannot
carry through a round trip (VIS-1046): the api_key it was loaded with
(otherwise never serialized, see the field) and keys this CLI version
does not know. Every other key follows the struct, so a None field
removes it, but a field this config holds unchanged keeps the file’s
own spelling (e.g. unknown keys inside [user_context]). The file’s key
order is kept. An unreadable or malformed file is replaced.
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.