hooks

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Command      string
	Module       string
	Modules      []string
	ModuleDir    string
	ModuleDirs   []string
	ModuleCount  int
	Workspace    string
	UpdateStatus string
	UpdatedCount int
	TidyRan      bool
	TidyCount    int
	TidyFailed   bool
	Env          map[string]string
}

type DisabledRule

type DisabledRule struct {
	Name       string
	Source     RuleSource
	DisabledBy RuleSource
}

type LocalUpdatePlan

type LocalUpdatePlan struct {
	AfterSuccess  []config.HookConfig
	AfterFailure  []config.HookConfig
	Always        []config.HookConfig
	MatchedRules  []MatchedRule
	SkippedRules  []RuleMatch
	DisabledRules []DisabledRule
}

func NormalizeLocalUpdate

func NormalizeLocalUpdate(in config.LocalUpdateHooksConfig) LocalUpdatePlan

NormalizeLocalUpdate treats hooks.update.local.after as an alias for after_success. Alias entries run before explicit after_success entries.

func ResolveLocalUpdatePlan

func ResolveLocalUpdatePlan(local config.LocalUpdateHooksConfig, hookCtx Context, layers []config.ConfigLayer) LocalUpdatePlan

ResolveLocalUpdatePlan builds the local update hook execution plan from unconditional merged hooks plus named rules from ordered file layers.

func (LocalUpdatePlan) Empty

func (p LocalUpdatePlan) Empty() bool

func (LocalUpdatePlan) SelectedPhases

func (p LocalUpdatePlan) SelectedPhases(updateSucceeded bool) []PhaseHooks

type MatchedRule

type MatchedRule struct {
	Name         string
	Source       RuleSource
	AfterSuccess []config.HookConfig
	AfterFailure []config.HookConfig
	Always       []config.HookConfig
}

type Phase

type Phase string
const (
	PhaseAfterSuccess Phase = "after_success"
	PhaseAfterFailure Phase = "after_failure"
	PhaseAlways       Phase = "always"
)

type PhaseHooks

type PhaseHooks struct {
	Phase Phase
	Hooks []config.HookConfig
}

type Result

type Result struct {
	Phase    Phase
	Hook     config.HookConfig
	Name     string
	Command  string
	Dir      string
	Output   string
	ExitCode int
	Duration time.Duration
	Err      error
	Timeout  bool
}

func (Result) DisplayName

func (r Result) DisplayName() string

func (Result) Failed

func (r Result) Failed() bool

type Results

type Results []Result

func (Results) Err

func (r Results) Err() error

func (Results) Failed

func (r Results) Failed() bool

type RuleMatch

type RuleMatch struct {
	Name   string
	Source RuleSource
	Reason string
}

type RuleSource

type RuleSource struct {
	Scope   config.ConfigLayerScope
	Path    string
	BaseDir string
	Order   int
}

type Runner

type Runner struct {
	DefaultTimeout time.Duration
}

func NewRunner

func NewRunner(defaultTimeout time.Duration) Runner

func (Runner) Run

func (r Runner) Run(ctx context.Context, phases []PhaseHooks, hookCtx Context) (Results, error)

Jump to

Keyboard shortcuts

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