permission

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	Allow Action = "allow"
	Deny  Action = "deny"
	Ask   Action = "ask"
)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages pending permission requests.

func NewManager

func NewManager() *Manager

func (*Manager) Create

func (m *Manager) Create(req Request) *PendingRequest

func (*Manager) Get

func (m *Manager) Get(id PermissionID) *PendingRequest

func (*Manager) Reply

func (m *Manager) Reply(id PermissionID, response string) bool

type PendingRequest

type PendingRequest struct {
	Request Request
	ReplyCh chan string // "once", "always", "reject"
}

PendingRequest holds a permission request awaiting user reply.

type PermissionID

type PermissionID = id.PermissionID

func NewPermissionID

func NewPermissionID() PermissionID

type Request

type Request struct {
	ID        PermissionID
	SessionID string
	Tool      string
	Input     string
	Patterns  []string
}

type Rule

type Rule struct {
	Permission string `json:"permission"` // tool name or "edit", "*"
	Pattern    string `json:"pattern"`    // glob pattern
	Action     Action `json:"action"`
}

type Ruleset

type Ruleset []Rule

func DefaultRuleset

func DefaultRuleset() Ruleset

DefaultRuleset returns the default permission rules for the build agent.

func (Ruleset) Evaluate

func (rs Ruleset) Evaluate(toolName, path string) Action

Evaluate checks the ruleset and returns the action for the given tool and path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL