permissions

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy string

Policy represents a tool-approval policy.

const (
	PolicyAllow Policy = "allow"
	PolicyAsk   Policy = "ask"
	PolicyDeny  Policy = "deny"
)

type PolicyManager

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

PolicyManager evaluates per-tool permission policies.

func LoadPolicies

func LoadPolicies(workDir string) (*PolicyManager, error)

LoadPolicies builds a PolicyManager by reading permissions YAML files. It checks the repo-level file (.polycode/permissions.yaml in workDir) first, then the user-level file (~/.config/polycode/permissions.yaml). Repo-level policies take precedence over user-level policies.

func (*PolicyManager) Check

func (p *PolicyManager) Check(toolName string) Policy

Check returns the policy for the given tool name. Evaluation order:

  1. Exact match in the policies map.
  2. Glob/pattern match (entries containing "*").
  3. Default: PolicyAsk.

Jump to

Keyboard shortcuts

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