Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoGitDetector ¶
type GoGitDetector struct{}
GoGitDetector implements RepoStateDetector using go-git.
type OperationType ¶
type OperationType int
OperationType classifies the caller's intended action.
const ( OpRead OperationType = iota // query commands OpDryRun // --dry-run / --diff OpWrite // apply mutation to disk OpWriteCommit // apply + git commit )
func (OperationType) String ¶
func (o OperationType) String() string
type PolicyChecker ¶
type PolicyChecker struct {
// contains filtered or unexported fields
}
PolicyChecker evaluates the git policy matrix.
func NewPolicyChecker ¶
func NewPolicyChecker(cfg vault.GitPolicyConfig) (*PolicyChecker, error)
NewPolicyChecker creates a PolicyChecker from config. Returns error if config contains invalid policy values or unknown rule names.
func (*PolicyChecker) Check ¶
func (pc *PolicyChecker) Check(state RepoState, op OperationType, targetPath string) PolicyResult
Check evaluates all policy rules for the given state and operation. targetPath identifies the file being mutated (empty for read-only operations).
type PolicyDecision ¶
type PolicyDecision int
PolicyDecision is the outcome of a policy rule evaluation.
const ( Allow PolicyDecision = iota Warn Refuse )
func ParsePolicyDecision ¶
func ParsePolicyDecision(s string) (PolicyDecision, error)
ParsePolicyDecision parses a string into a PolicyDecision.
func (PolicyDecision) String ¶
func (d PolicyDecision) String() string
type PolicyReason ¶
type PolicyReason struct {
Rule string // stable identifier: "dirty_target", "detached_head", etc.
Message string
}
PolicyReason describes one triggered policy rule.
type PolicyResult ¶
type PolicyResult struct {
Decision PolicyDecision
Reasons []PolicyReason
}
PolicyResult is the aggregate outcome of a policy check.
type RepoState ¶
type RepoState struct {
RepoDetected bool
Branch string
Detached bool
MergeInProgress bool
RebaseInProgress bool
WorkingTreeClean bool
StagedFiles []string
UnstagedFiles []string
UntrackedFiles []string
}
RepoState captures git repository state at a point in time.
type RepoStateDetector ¶
RepoStateDetector abstracts git state detection for dependency injection.