Permission rule value struct.
Represents a single permission rule with a tool name and optional rule content that defines the permission pattern.
Examples
# Simple tool permission
RuleValue.new("Bash")
# Tool permission with pattern
RuleValue.new("Bash", "echo *")
# File write permission with path pattern
RuleValue.new("Write", "/tmp/**")
Summary
Types
Functions
Creates a new rule value.
Parameters
tool_name- Name of the tool this rule applies torule_content- Optional content pattern for the rule
Examples
iex> RuleValue.new("Bash")
%RuleValue{tool_name: "Bash", rule_content: nil}
iex> RuleValue.new("Bash", "echo *")
%RuleValue{tool_name: "Bash", rule_content: "echo *"}
@spec parse(map() | t()) :: {:ok, t()} | {:error, {:invalid_permission_rule_value, CliSubprocessCore.Schema.error_detail()}}
@spec schema() :: Zoi.schema()
Converts a rule value to a map for the control protocol.
Examples
iex> RuleValue.new("Bash", "echo *") |> RuleValue.to_map()
%{"toolName" => "Bash", "ruleContent" => "echo *"}
iex> RuleValue.new("Bash") |> RuleValue.to_map()
%{"toolName" => "Bash", "ruleContent" => nil}