Skip to main content

ProductionContext

Struct ProductionContext 

Source
pub struct ProductionContext { /* private fields */ }
Expand description

Owns the production gateway implementations and the resolved paths.

Constructed once per process via from_env and kept alive for the duration of the call — the AppContext it vends borrows from it.

Implementations§

Source§

impl ProductionContext

Source

pub fn claude() -> Result<Self>

Build a production context bound to the Claude platform.

This is the one-call default for tools that target Claude Code. It is equivalent to from_env(Platform::Claude).

The platform binding determines which lock file and install directory are used as the default for path resolution. It does not determine which platforms a skill installs to — installation targets are resolved from the cmx config and existing lock files at plan time.

Source

pub fn from_env(default_platform: Platform) -> Result<Self>

Build a production context from the real environment for the given platform binding.

default_platform controls the default lock file name and install directory used for path resolution (e.g. which cmx-lock*.json file is the primary one). It does not set the config root directory — that is always $HOME/.config/context-mixer — and it does not determine which platforms a skill installs to. Installation targets come from the plan (resolved from the cmx config and existing lock files).

For Claude Code tools, prefer claude() over calling this directly.

Source

pub fn ctx(&self) -> AppContext<'_>

Borrow an AppContext for a single library call.

The returned context does not include an LLM client — embedding tools do not need LLM-powered analysis.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.