hooks

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hooks provides a middleware system for CM operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHook

type ErrorHook interface {
	Hook
	OnError(ctx *HookContext) error
}

ErrorHook executes when an operation fails.

type Hook

type Hook interface {
	Name() string
	Priority() int
	Execute(ctx *HookContext) error
}

Hook defines the interface for all hooks.

type HookContext

type HookContext struct {
	OperationName string
	Parameters    map[string]interface{}
	Results       map[string]interface{}
	Error         error
	Metadata      map[string]interface{}
}

HookContext provides context for hook execution.

type HookManager

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

HookManager manages hook registration and execution.

func (*HookManager) ExecuteErrorHooks

func (hm *HookManager) ExecuteErrorHooks(operation string, ctx *HookContext) error

ExecuteErrorHooks executes all error-hooks for a specific operation.

func (*HookManager) ExecutePostHooks

func (hm *HookManager) ExecutePostHooks(operation string, ctx *HookContext) error

ExecutePostHooks executes all post-hooks for a specific operation.

func (*HookManager) ExecutePostWorktreeCheckoutHooks added in v0.29.0

func (hm *HookManager) ExecutePostWorktreeCheckoutHooks(operation string, ctx *HookContext) error

ExecutePostWorktreeCheckoutHooks executes all post-worktree checkout hooks for a specific operation.

func (*HookManager) ExecutePreHooks

func (hm *HookManager) ExecutePreHooks(operation string, ctx *HookContext) error

ExecutePreHooks executes all pre-hooks for a specific operation.

func (*HookManager) ExecutePreWorktreeCreationHooks added in v0.29.0

func (hm *HookManager) ExecutePreWorktreeCreationHooks(operation string, ctx *HookContext) error

ExecutePreWorktreeCreationHooks executes all pre-worktree creation hooks for a specific operation.

func (*HookManager) RegisterPostHook

func (hm *HookManager) RegisterPostHook(operation string, hook PostHook) error

RegisterPostHook registers a post-hook for a specific operation.

func (*HookManager) RegisterPostWorktreeCheckoutHook added in v0.29.0

func (hm *HookManager) RegisterPostWorktreeCheckoutHook(operation string, hook PostWorktreeCheckoutHook) error

RegisterPostWorktreeCheckoutHook registers a post-worktree checkout hook for a specific operation.

func (*HookManager) RegisterPreWorktreeCreationHook added in v0.29.0

func (hm *HookManager) RegisterPreWorktreeCreationHook(operation string, hook PreWorktreeCreationHook) error

RegisterPreWorktreeCreationHook registers a pre-worktree creation hook for a specific operation.

type HookManagerInterface

type HookManagerInterface interface {
	// Hook registration.
	RegisterPostHook(operation string, hook PostHook) error
	RegisterPostWorktreeCheckoutHook(operation string, hook PostWorktreeCheckoutHook) error
	RegisterPreWorktreeCreationHook(operation string, hook PreWorktreeCreationHook) error

	// Hook execution.
	ExecutePreHooks(operation string, ctx *HookContext) error
	ExecutePostHooks(operation string, ctx *HookContext) error
	ExecuteErrorHooks(operation string, ctx *HookContext) error
	ExecutePostWorktreeCheckoutHooks(operation string, ctx *HookContext) error
	ExecutePreWorktreeCreationHooks(operation string, ctx *HookContext) error
}

HookManagerInterface defines the interface for hook management.

func NewHookManager

func NewHookManager() HookManagerInterface

NewHookManager creates a new HookManager instance.

type PostHook

type PostHook interface {
	Hook
	PostExecute(ctx *HookContext) error
}

PostHook executes after an operation.

type PostWorktreeCheckoutHook added in v0.29.0

type PostWorktreeCheckoutHook interface {
	Hook
	OnPostWorktreeCheckout(ctx *HookContext) error
}

PostWorktreeCheckoutHook executes between worktree creation and checkout.

type PreHook

type PreHook interface {
	Hook
	PreExecute(ctx *HookContext) error
}

PreHook executes before an operation.

type PreWorktreeCreationHook added in v0.29.0

type PreWorktreeCreationHook interface {
	Hook
	OnPreWorktreeCreation(ctx *HookContext) error
}

PreWorktreeCreationHook executes before worktree creation for detection/configuration.

Directories

Path Synopsis
Package defaulthooks provides default hook implementations for the code manager.
Package defaulthooks provides default hook implementations for the code manager.
Package devcontainer provides devcontainer detection functionality for worktree operations.
Package devcontainer provides devcontainer detection functionality for worktree operations.
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
Package gitcrypt provides git-crypt functionality as a hook for worktree operations.
ide
Package ide provides IDE opening functionality through hooks.
Package ide provides IDE opening functionality through hooks.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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