pub struct Policy { /* private fields */ }Expand description
The classifier for one project.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn new(checks: &[Vec<String>], extra: &[Vec<String>]) -> Self
pub fn new(checks: &[Vec<String>], extra: &[Vec<String>]) -> Self
A policy allowing the command prefixes of checks (program and
subcommands, up to the first option) and the extra prefixes.
Paths git ignored when an in-place run started: the file tools refuse them, except the protected files (the intent stays readable).
Sourcepub fn in_place(self) -> Self
pub fn in_place(self) -> Self
An in-place attempt (run --in-place): the checkout is the
person’s, so git commands that move it are denied.
The planning profile: the format’s artifacts and scripts are the work; its machinery, verification inputs and secrets stay denied; anything else — source code included — needs approval.
Sourcepub fn rules(self, rules: &'static Rules) -> Self
pub fn rules(self, rules: &'static Rules) -> Self
The project’s format’s rules (intent, planning artifacts); the reference format’s by default.
Sourcepub fn with_network(self, allow: Vec<Vec<String>>) -> Self
pub fn with_network(self, allow: Vec<Vec<String>>) -> Self
[sandbox] network_allow: prefixes that get the network.
Sourcepub fn network_allowed(&self, argv: &[String]) -> bool
pub fn network_allowed(&self, argv: &[String]) -> bool
Whether argv gets the network without asking.
Sourcepub fn with_mcp(self, tools: impl IntoIterator<Item = (String, String)>) -> Self
pub fn with_mcp(self, tools: impl IntoIterator<Item = (String, String)>) -> Self
The project’s MCP tools and their configured decisions.
Sourcepub fn with_decisions(
self,
approved: Vec<Grant>,
rejected: Vec<Rejection>,
) -> Self
pub fn with_decisions( self, approved: Vec<Grant>, rejected: Vec<Rejection>, ) -> Self
A person’s decisions for this task: an approval turns a call that needs approval into an allowed one (never a denied one); a rejection turns it into a denial with the person’s reason.
Sourcepub fn with_frozen(self, frozen: impl IntoIterator<Item = String>) -> Self
pub fn with_frozen(self, frozen: impl IntoIterator<Item = String>) -> Self
Freezes these test files: writing them needs approval.
Sourcepub fn write_protected(&self, rel: &str) -> Option<Class>
pub fn write_protected(&self, rel: &str) -> Option<Class>
Whether this (resolved, workspace-relative) path is protected for writing under this policy: the authoring profile writes the format’s artifacts, nothing else of the protected set.