Skip to main content

Workspace

Struct Workspace 

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

Workspace runtime state. Shared across MCP request clones via Arc.

Implementations§

Source§

impl Workspace

Source

pub fn open( workspace_dir: PathBuf, stale_after_days: u32, post_activate: Option<PostActivateHook>, ) -> Result<Self>

Open a github-flavoured workspace (clone + track flow).

Source

pub fn open_local( root: PathBuf, post_activate: Option<PostActivateHook>, ) -> Result<Self>

Open a local-directory workspace.

Binds root as the active source root immediately and fires the post-activate hook (subject to last-built-sha gating). inventory.json is kept under <root>/.mcp-workspace/ so the local mode mirrors the same gating / fingerprinting infra without polluting the user’s tree with a repos/ directory.

Source

pub fn kind(&self) -> WorkspaceKind

Source

pub fn workspace_dir(&self) -> &Path

Source

pub fn repos_dir(&self) -> PathBuf

Source

pub fn active_repo_name(&self) -> Option<String>

Active repo’s full org/repo name, or None if nothing is active.

Source

pub fn active_repo_path(&self) -> Option<PathBuf>

Active repo’s filesystem path, or None.

Source

pub fn last_built_sha(&self, name: &str) -> Option<String>

Read the SHA recorded after the last successful post-activate hook for the named repo. None if the repo was never built (or the hook last failed). Useful for downstream consumers gating “is the active graph up to date with the repo HEAD?” checks.

Source

pub fn repo_management( &self, name: Option<&str>, delete: bool, update: bool, force_rebuild: bool, ) -> String

Public entry for the repo_management MCP tool.

  • name: org/repo to activate (None = list / refresh mode).
  • delete: remove the named repo + inventory entry. Github only.
  • update: refresh the active repo (auto-rebuild gated).
  • force_rebuild: with update=true (or initial activation), re-run the post-activate hook even when the HEAD SHA matches last_built_sha. Useful after the builder itself has been upgraded.

Local mode behaviour: name and delete are rejected; pass update=true (or no args after the initial activation) to re-fingerprint the root and rebuild if anything changed.

Source

pub fn set_root_dir(&self, new_root: &Path) -> String

Swap the active root (local mode only). Re-fires the post-activate hook against the new root. Errors if the workspace is github-flavoured.

Trait Implementations§

Source§

impl Clone for Workspace

Source§

fn clone(&self) -> Workspace

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
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