trustresolver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package trustresolver resolves workspace trust decisions from policy inputs.

Index

Constants

View Source
const (
	PolicyAutoTrust       = "auto_trust"
	PolicyRequireApproval = "require_approval"
	PolicyDeny            = "deny"

	ResolutionAutoAllowlisted = "auto_allowlisted"
	ResolutionManualApproval  = "manual_approval"

	StatusNotRequired      = "not_required"
	StatusAutoTrusted      = "auto_trusted"
	StatusRequiresApproval = "requires_approval"
	StatusDenied           = "denied"
)

Variables

This section is empty.

Functions

func DetectManualApproval

func DetectManualApproval(screenText string) bool

func DetectTrustPrompt

func DetectTrustPrompt(screenText string) bool

func PathMatchesTrustedRoot

func PathMatchesTrustedRoot(cwd string, trustedRoot string) bool

func PatternMatches

func PatternMatches(pattern string, value string) bool

Types

type AllowlistEntry

type AllowlistEntry struct {
	Pattern         string `json:"pattern"`
	WorktreePattern string `json:"worktree_pattern,omitempty"`
	Description     string `json:"description,omitempty"`
}

type Config

type Config struct {
	Allowlisted []AllowlistEntry `json:"allowlisted,omitempty"`
	Denied      []string         `json:"denied,omitempty"`
	EmitEvents  bool             `json:"emit_events"`
}

type Decision

type Decision struct {
	Status         string  `json:"status"`
	PromptDetected bool    `json:"prompt_detected"`
	Trusted        bool    `json:"trusted"`
	Policy         string  `json:"policy,omitempty"`
	Resolution     string  `json:"resolution,omitempty"`
	MatchedPattern string  `json:"matched_pattern,omitempty"`
	Events         []Event `json:"events,omitempty"`
}

type Event

type Event struct {
	Type       string `json:"type"`
	CWD        string `json:"cwd"`
	Repo       string `json:"repo,omitempty"`
	Worktree   string `json:"worktree,omitempty"`
	Policy     string `json:"policy,omitempty"`
	Resolution string `json:"resolution,omitempty"`
	Reason     string `json:"reason,omitempty"`
}

type Resolver

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

func New

func New(config Config) Resolver

func NewWithoutEvents

func NewWithoutEvents(config Config) Resolver

func (Resolver) Resolve

func (r Resolver) Resolve(cwd string, worktree string, screenText string) Decision

func (Resolver) Trusts

func (r Resolver) Trusts(cwd string, worktree string) bool

Jump to

Keyboard shortcuts

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