approval

package
v0.2.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Action      string
	Input       string
	Risk        RiskLevel
	Description string
	Preview     string
}

type Decision

type Decision string
const (
	DecisionYes     Decision = "yes"
	DecisionSession Decision = "session"
	DecisionNo      Decision = "no"
	DecisionEdit    Decision = "edit"
	DecisionPreview Decision = "preview"
)

type Manager

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

func NewManager

func NewManager(logger *observability.Logger) *Manager

func (*Manager) IsRequired

func (m *Manager) IsRequired(action string) bool

func (*Manager) Request

func (m *Manager) Request(card Card) (Decision, string, error)

func (*Manager) RiskOf

func (m *Manager) RiskOf(action string) RiskLevel

func (*Manager) SetAuto

func (m *Manager) SetAuto(v bool)

func (*Manager) SetUI

func (m *Manager) SetUI(u UI)

type RiskLevel

type RiskLevel int
const (
	READ RiskLevel = iota
	ADVISE
	PROPOSE
	EXECUTE
)

func (RiskLevel) String

func (r RiskLevel) String() string

type TerminalUI

type TerminalUI struct {
	In  io.Reader
	Out io.Writer
}

func (*TerminalUI) Prompt

func (t *TerminalUI) Prompt(card Card) (Decision, string, error)

type UI

type UI interface {
	Prompt(card Card) (Decision, string, error)
}

Jump to

Keyboard shortcuts

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