Skip to main content

TracevaultConfig

Struct TracevaultConfig 

Source
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

Source

pub fn config_dir(project_root: &Path) -> PathBuf

<project_root>/.visdom: where this CLI writes.

Source

pub fn config_path(project_root: &Path) -> PathBuf

Where the tracing config is written: .visdom/tracing.toml.

Source

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.

Source

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).

Source

pub fn to_toml(&self) -> String

Source

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.

Source

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.

Source

pub fn load(project_root: &Path) -> Option<Self>

Lenient load: a missing or malformed config.toml yields None, with a warning printed for the malformed case. Kept for callers that treat “no usable config” uniformly; prefer try_load when the missing/malformed distinction matters.

Trait Implementations§

Source§

impl Debug for TracevaultConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TracevaultConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TracevaultConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TracevaultConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more