pub struct JcliConfig {
pub permissions: PermissionConfig,
}Expand description
.jcli/ 目录权限配置
Fields§
§permissions: PermissionConfigImplementations§
Source§impl JcliConfig
impl JcliConfig
Sourcepub fn find_config_dir() -> Option<PathBuf>
pub fn find_config_dir() -> Option<PathBuf>
从当前目录向上查找 .jcli/ 目录
Sourcepub fn ensure_config_dir() -> Option<PathBuf>
pub fn ensure_config_dir() -> Option<PathBuf>
确保 cwd 下存在 .jcli/ 目录,返回该目录路径
Sourcepub fn is_allowed(&self, tool_name: &str, arguments: &str) -> bool
pub fn is_allowed(&self, tool_name: &str, arguments: &str) -> bool
检查某个工具调用是否被自动允许(跳过确认)
- tool_name: “Shell”, “Read”, “Write” 等
- arguments: JSON 字符串(用于提取 command/path 等)
返回 true 表示该调用无需用户确认
Sourcepub fn is_denied(&self, tool_name: &str, arguments: &str) -> bool
pub fn is_denied(&self, tool_name: &str, arguments: &str) -> bool
检查是否被 deny 列表拦截(deny 中匹配则直接拒绝执行)
Sourcepub fn add_allow_rule(&mut self, rule: &str)
pub fn add_allow_rule(&mut self, rule: &str)
将一条 allow 规则追加到 .jcli/permissions.yaml(若目录/文件不存在则创建) 去重:如果 allow 列表已包含该规则则不重复添加
Trait Implementations§
Source§impl Clone for JcliConfig
impl Clone for JcliConfig
Source§fn clone(&self) -> JcliConfig
fn clone(&self) -> JcliConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JcliConfig
impl Debug for JcliConfig
Source§impl Default for JcliConfig
impl Default for JcliConfig
Source§fn default() -> JcliConfig
fn default() -> JcliConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for JcliConfig
impl<'de> Deserialize<'de> for JcliConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JcliConfig
impl RefUnwindSafe for JcliConfig
impl Send for JcliConfig
impl Sync for JcliConfig
impl Unpin for JcliConfig
impl UnsafeUnpin for JcliConfig
impl UnwindSafe for JcliConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.