pub struct Config {
pub default_action: Option<Decision>,
pub log_file: Option<PathBuf>,
pub log_full: bool,
pub tracking_db: Option<PathBuf>,
pub self_protect: bool,
pub trust_project_configs: bool,
pub cd_allowed_dirs: Vec<PathBuf>,
pub active_package: Option<Package>,
/* private fields */
}Expand description
Loaded and merged configuration with rules partitioned by type.
Fields§
§default_action: Option<Decision>§log_file: Option<PathBuf>§log_full: bool§tracking_db: Option<PathBuf>§self_protect: bool§trust_project_configs: boolWhether to auto-trust all project configs without checking the trust DB.
cd_allowed_dirs: Vec<PathBuf>Extra directories that cd is allowed to navigate to (beyond the project root).
active_package: Option<Package>The active safety package (if any).
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_from_str(
content: &str,
format: ConfigFormat,
) -> Result<Self, RippyError>
pub fn load_from_str( content: &str, format: ConfigFormat, ) -> Result<Self, RippyError>
Parse a config string directly into a Config, without touching the filesystem.
§Errors
Returns RippyError::Config if content contains invalid syntax.
The error’s path field is set to the sentinel <memory> so callers
can distinguish in-memory parses from file-based ones.
Source§impl Config
impl Config
Sourcepub fn load(cwd: &Path, env_config: Option<&Path>) -> Result<Self, RippyError>
pub fn load(cwd: &Path, env_config: Option<&Path>) -> Result<Self, RippyError>
Load config from the three-tier system: global, project, env override.
§Errors
Returns RippyError::Config if a config file exists but contains invalid syntax.
Sourcepub fn load_with_home(
cwd: &Path,
env_config: Option<&Path>,
home: Option<PathBuf>,
) -> Result<Self, RippyError>
pub fn load_with_home( cwd: &Path, env_config: Option<&Path>, home: Option<PathBuf>, ) -> Result<Self, RippyError>
Load config with an explicit home directory instead of reading $HOME.
Pass None to skip global config loading (useful for tests).
§Errors
Returns RippyError::Config if a config file exists but contains invalid syntax.
pub fn empty() -> Self
Sourcepub fn weakening_suffix(&self) -> &str
pub fn weakening_suffix(&self) -> &str
Return the pre-formatted weakening suffix for verdict annotation.
Sourcepub fn match_command(
&self,
command: &str,
ctx: Option<&MatchContext<'_>>,
) -> Option<Verdict>
pub fn match_command( &self, command: &str, ctx: Option<&MatchContext<'_>>, ) -> Option<Verdict>
Match a command string against command rules (last-match-wins).
Sourcepub fn match_redirect(
&self,
path: &str,
ctx: Option<&MatchContext<'_>>,
) -> Option<Verdict>
pub fn match_redirect( &self, path: &str, ctx: Option<&MatchContext<'_>>, ) -> Option<Verdict>
Match a redirect target path against redirect rules.
Sourcepub fn match_mcp(&self, tool_name: &str) -> Option<Verdict>
pub fn match_mcp(&self, tool_name: &str) -> Option<Verdict>
Match an MCP tool name against MCP rules.
Sourcepub fn match_file_read(
&self,
path: &str,
ctx: Option<&MatchContext<'_>>,
) -> Option<Verdict>
pub fn match_file_read( &self, path: &str, ctx: Option<&MatchContext<'_>>, ) -> Option<Verdict>
Match a file path against file-read rules.
Sourcepub fn match_file_write(
&self,
path: &str,
ctx: Option<&MatchContext<'_>>,
) -> Option<Verdict>
pub fn match_file_write( &self, path: &str, ctx: Option<&MatchContext<'_>>, ) -> Option<Verdict>
Match a file path against file-write rules.
Sourcepub fn match_file_edit(
&self,
path: &str,
ctx: Option<&MatchContext<'_>>,
) -> Option<Verdict>
pub fn match_file_edit( &self, path: &str, ctx: Option<&MatchContext<'_>>, ) -> Option<Verdict>
Match a file path against file-edit rules.
Sourcepub fn match_after(&self, command: &str) -> Option<String>
pub fn match_after(&self, command: &str) -> Option<String>
Match a command for after rules (post-execution feedback).
Sourcepub fn resolve_alias<'a>(&'a self, command: &'a str) -> &'a str
pub fn resolve_alias<'a>(&'a self, command: &'a str) -> &'a str
Resolve aliases for a command name. Returns the target if aliased.
Sourcepub fn from_directives(directives: Vec<ConfigDirective>) -> Self
pub fn from_directives(directives: Vec<ConfigDirective>) -> Self
Build a Config from a list of directives.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.