class

Smith::Tools::RuleSet

Inherits Reference < Object

The configured rules, consulted before anything is shown to the user.

Constructors

build(allow : Array(String) = [] of String, ask : Array(String) = [] of String, deny : Array(String) = [] of String, project_dir : String = Dir.current, warn_io : IO = STDERR) : RuleSet
Source
new(allow : Array(Rule) = [] of Rule, ask : Array(Rule) = [] of Rule, deny : Array(Rule) = [] of Rule, project_dir : String = Dir.current)
Source

Instance methods

decide(tool_name : String, args : JSON::Any) : Decision
Source
empty?
Source
governs?(tool_name : String) : Bool

Whether a call to this tool could be stopped by a rule. Kept to a set lookup so the common case โ€” no rules for read tools โ€” costs nothing.

Source
matching_deny(tool_name : String, args : JSON::Any) : String | Nil

Which deny rule stopped a call, so the model is told what to avoid.

Source
project_dir
Source
suggest(tool_name : String, args : JSON::Any) : String

The narrowest rule worth offering behind [a]lways โ€” narrower than "this tool, everywhere", which is what the old prompt remembered.

Source