Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSafetyBlocked = &SafetyError{ Message: "operation blocked by read-only mode", ExitCode: output.CodeSafetyBlocked, } ErrNeedsConfirm = &SafetyError{ Message: "operation requires --confirm", ExitCode: output.CodeSafetyBlocked, } )
Functions ¶
func FormatPreview ¶
FormatPreview renders a dry-run preview showing method, path, resource IDs, and a payload summary. The payload summary is truncated to 200 characters.
Types ¶
type Policy ¶
Policy holds the safety flags for a command invocation.
func (Policy) Check ¶
func (p Policy) Check(level SafetyLevel) error
Check verifies that the policy allows the operation at the given safety level. It returns nil if allowed, or a *SafetyError if blocked. --dry-run is always allowed; --read-only blocks all writes even with --confirm.
type SafetyError ¶
SafetyError is returned when a safety policy blocks an operation.
func (*SafetyError) Error ¶
func (e *SafetyError) Error() string
type SafetyLevel ¶
type SafetyLevel int
SafetyLevel represents the risk level of an operation.
const ( ReadLevel SafetyLevel = iota LowRiskWrite HighRiskWrite )
func (SafetyLevel) String ¶
func (l SafetyLevel) String() string
Click to show internal directories.
Click to hide internal directories.