Documentation
¶
Index ¶
- type AuditEntry
- type CLIPrompter
- type CacheData
- type Checker
- type Config
- type Decision
- type Mode
- type PermissionCache
- func (c *PermissionCache) AddAllow(pattern string) error
- func (c *PermissionCache) AddDeny(pattern string) error
- func (c *PermissionCache) Clear() error
- func (c *PermissionCache) GetAllowList() []string
- func (c *PermissionCache) GetDenyList() []string
- func (c *PermissionCache) IsAllowed(toolName string) bool
- func (c *PermissionCache) IsDenied(toolName string) bool
- func (c *PermissionCache) RemoveAllow(pattern string) error
- func (c *PermissionCache) RemoveDeny(pattern string) error
- type PermissionSet
- type Prompter
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditEntry ¶
type AuditEntry struct {
Timestamp string `json:"timestamp"`
User string `json:"user,omitempty"`
SessionID string `json:"session_id,omitempty"`
Tool string `json:"tool"`
Params map[string]interface{} `json:"params"`
Permission string `json:"permission"` // allowed, denied, blocked
Result string `json:"result"` // success, failure
}
AuditEntry represents a single audit log entry.
type CLIPrompter ¶
type CLIPrompter struct {
// contains filtered or unexported fields
}
CLIPrompter implements Prompter using command-line prompts.
func NewCLIPrompterWithCache ¶
func NewCLIPrompterWithCache(cache *PermissionCache) *CLIPrompter
NewCLIPrompterWithCache creates a CLI prompter with persistent cache.
type CacheData ¶
type CacheData struct {
Permissions PermissionSet `json:"permissions"`
}
CacheData represents the structure of the permission cache file.
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker handles permission checking for tool execution.
func NewChecker ¶
NewChecker creates a new permission checker.
type Config ¶
type Config struct {
Mode Mode `yaml:"mode" json:"mode" mapstructure:"mode"`
AllowedTools []string `yaml:"allowed_tools" json:"allowed_tools" mapstructure:"allowed_tools"`
RestrictedTools []string `yaml:"restricted_tools" json:"restricted_tools" mapstructure:"restricted_tools"`
BlockedTools []string `yaml:"blocked_tools" json:"blocked_tools" mapstructure:"blocked_tools"`
YOLOMode bool `yaml:"yolo_mode" json:"yolo_mode" mapstructure:"yolo_mode"`
AuditEnabled bool `yaml:"audit_enabled" json:"audit_enabled" mapstructure:"audit_enabled"`
AuditPath string `yaml:"audit_path" json:"audit_path" mapstructure:"audit_path"`
}
Config holds permission configuration.
type Mode ¶
type Mode string
Mode represents the permission checking mode.
const ( // ModePrompt always prompts the user for permission. ModePrompt Mode = "prompt" // ModeAllow automatically allows all tools. ModeAllow Mode = "allow" // ModeDeny automatically denies all tools. ModeDeny Mode = "deny" // ModeYOLO bypasses all permission checks (dangerous). ModeYOLO Mode = "yolo" )
type PermissionCache ¶
type PermissionCache struct {
// contains filtered or unexported fields
}
PermissionCache stores persistent permission decisions.
func NewPermissionCache ¶
func NewPermissionCache(basePath string) (*PermissionCache, error)
NewPermissionCache creates a new permission cache.
func (*PermissionCache) AddAllow ¶
func (c *PermissionCache) AddAllow(pattern string) error
AddAllow adds a tool to the allow list and saves.
func (*PermissionCache) AddDeny ¶
func (c *PermissionCache) AddDeny(pattern string) error
AddDeny adds a tool to the deny list and saves.
func (*PermissionCache) Clear ¶
func (c *PermissionCache) Clear() error
Clear removes all cached permissions.
func (*PermissionCache) GetAllowList ¶
func (c *PermissionCache) GetAllowList() []string
GetAllowList returns a copy of the allow list.
func (*PermissionCache) GetDenyList ¶
func (c *PermissionCache) GetDenyList() []string
GetDenyList returns a copy of the deny list.
func (*PermissionCache) IsAllowed ¶
func (c *PermissionCache) IsAllowed(toolName string) bool
IsAllowed checks if a tool is in the allow list.
func (*PermissionCache) IsDenied ¶
func (c *PermissionCache) IsDenied(toolName string) bool
IsDenied checks if a tool is in the deny list.
func (*PermissionCache) RemoveAllow ¶
func (c *PermissionCache) RemoveAllow(pattern string) error
RemoveAllow removes a pattern from the allow list.
func (*PermissionCache) RemoveDeny ¶
func (c *PermissionCache) RemoveDeny(pattern string) error
RemoveDeny removes a pattern from the deny list.
type PermissionSet ¶
PermissionSet contains allow/deny lists similar to Claude Code's format.