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>,
pub project_id: Option<String>,
pub project_name: 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>LEGACY: a project name. Never written by this CLI any more (VIS-1256)
and never used for capture — resolving a name would cost a network call
per hook event. It is read only so init and sync can migrate it to
project_id + project_name
(see commands::migrate), and so project status can flag a config
that has not been migrated yet.
project_id: Option<String>The project every session under this directory is attributed to (a
server UUID), written by tracevault init --workspace --project <name>
or by the default_project migration. The workspace tier of the
capture chain (resolution::capture_project_binding): below a
session’s own project switch, above the user-level default. Read
locally, so the per-event hook needs no network call for it.
project_name: Option<String>Display-only name of project_id, recorded when
it was resolved. Never used to resolve anything.
Implementations§
Source§impl TracevaultConfig
impl TracevaultConfig
Sourcepub fn config_dir(project_root: &Path) -> PathBuf
pub fn config_dir(project_root: &Path) -> PathBuf
<project_root>/.visdom: where this CLI writes.
Sourcepub fn config_path(project_root: &Path) -> PathBuf
pub fn config_path(project_root: &Path) -> PathBuf
Where the tracing config is written: .visdom/tracing.toml.
Sourcepub fn existing_config_path(project_root: &Path) -> PathBuf
pub fn existing_config_path(project_root: &Path) -> PathBuf
The tracing config to read: config_path,
else the .tracevault/config.toml an earlier release wrote.
Sourcepub fn ensure_gitignore(config_dir: &Path) -> Result<()>
pub fn ensure_gitignore(config_dir: &Path) -> Result<()>
Ensure a .gitignore exists inside config_dir (a .visdom/ dir)
so runtime artifacts are ignored no matter where the directory was
created — including the per-subproject .visdom/ 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.