pub struct GuardSection {
pub engine: GuardEngine,
pub hooks_file: Option<String>,
pub matcher: Option<String>,
pub command_template: Option<String>,
pub hook_entry: Option<String>,
pub plugin_file: Option<String>,
pub verdict_template: String,
pub armed_message: String,
}Expand description
The write-guard data block: everything the guard engine ([super::guard])
needs to arm the hook surface and render a deny verdict. Which fields apply
depends on engine: the JSON-hooks four (hooks_file, matcher,
command_template, hook_entry) are required for json-hooks and barred
for opencode-plugin, which declares plugin_file instead — the schema’s
conditional-required gate plus load-time validation prove the shape, so the
engine unwraps with “proven at load”. Embedded built-in descriptors only —
the guard fails open, so layers::check_user_layer_restrictions bars user
layers from declaring it.
Fields§
§engine: GuardEngineInstall mechanism; absent means json-hooks.
hooks_file: Option<String>(json-hooks) Hook-config file the entry is merged into, /-separated
relative to the staged env root (e.g. .claude/settings.local.json).
matcher: Option<String>(json-hooks) Tool-name matcher the hook registers for; also the source of the matcher⊆vocabulary invariant.
command_template: Option<String>(json-hooks) Shell command the hook runs, with {exe} and {marker}
placeholders.
hook_entry: Option<String>(json-hooks) JSON template of the hook entry appended to the hook
config’s hooks.PreToolUse array, with {matcher} and {command}
placeholders in its string values. Authored key order is serialized
verbatim.
plugin_file: Option<String>(opencode-plugin) Plugin file staged from the embedded JS template
({exe}/{marker} substituted), /-separated relative to the staged
env root (e.g. .opencode/plugins/slow-powers-eval-guard.js).
verdict_template: StringJSON template of the deny verdict printed on stdout, with a {reason}
placeholder. Authored key order is the harness’s on-disk contract.
armed_message: StringBanner printed after --guard arms the hook.
Trait Implementations§
Source§impl Clone for GuardSection
impl Clone for GuardSection
Source§fn clone(&self) -> GuardSection
fn clone(&self) -> GuardSection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more