pub struct CliContext {
pub json: bool,
pub quiet: bool,
pub role: Role,
}Expand description
Global CLI state: shared flags + a lazily-initialized Engine.
Fields§
§json: bool§quiet: boolUser asked for quiet stderr (--quiet). The CLI runs the
engine in-process and never installs a tracing_subscriber,
so the flag is informational.
role: RoleThe invocation-level declared role (--role, agent-trust
plan 13), already validated at parse time. Stamped onto every
engine this context constructs so mutations record it.
Implementations§
Source§impl CliContext
impl CliContext
Sourcepub fn workspace_shape(&self) -> Option<(WorkspaceShape, PathBuf)>
pub fn workspace_shape(&self) -> Option<(WorkspaceShape, PathBuf)>
Resolve the workspace flavour by walking up from cwd. Returns
None when no .memstead/workspace.toml is found in any ancestor.
Post-rebuild the marker is shape-neutral — the same
.memstead/workspace.toml carries both folder-only workspaces and
mem-repo workspaces. The flavour tag comes from whether the
workspace root also carries mem-repo/.git/ (mem-repo
flavour) or not (folder-only flavour). The lean CLI uses this
distinction to surface “this is the lean binary” when the
operator points it at a workspace with git-branch mounts.
Sourcepub fn cli_engine(&self) -> Result<CliEngine>
pub fn cli_engine(&self) -> Result<CliEngine>
Build a CliEngine from the current cwd. The workspace
marker .memstead/workspace.toml resolves either flavour; the
presence of mem-repo/.git/ switches the engine factory.
On the lean build (--no-default-features) the mem-repo
branch surfaces a clear “not built into this binary” error so
a user pointing the lean build at a mem-repo workspace
gets an actionable signal rather than a confusing “no
workspace” bail.
Sourcepub fn cli_engine_at(&self, root: &Path) -> Result<CliEngine>
pub fn cli_engine_at(&self, root: &Path) -> Result<CliEngine>
Build a CliEngine rooted at an explicit workspace directory,
skipping the cwd walk-up. The flavour is still derived from
whether <root>/mem-repo/.git/ is present, so callers that
already know the root (e.g. memstead publish --workspace) get
the same factory selection as Self::cli_engine. The split
also gives subcommands a chdir-free, unit-testable engine seam.
Sourcepub fn engine(&self) -> Result<BaseEngine>
pub fn engine(&self) -> Result<BaseEngine>
Build the unified memstead_base::Engine for a mem-repo-shaped
workspace. Delegates to engine_from_workspace_root which
handles layout detection, mount enumeration, schema resolution,
and readMems hydration in one pass.
Only compiled into the full build — the lean build never sees a
mem-repo workspace because cli_engine() rejects it before
reaching here.
Auto Trait Implementations§
impl Freeze for CliContext
impl RefUnwindSafe for CliContext
impl Send for CliContext
impl Sync for CliContext
impl Unpin for CliContext
impl UnsafeUnpin for CliContext
impl UnwindSafe for CliContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more