hooks

package
v1.222.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package hooks implements Atmos-managed Git hook shims: writing shim scripts into .git/hooks that delegate to `atmos git hooks run`, removing them, and executing the configured command for a named hook.

Index

Constants

View Source
const (
	// ShimMarker is the unique string embedded in generated shim files.
	// Its presence identifies a file as Atmos-managed.
	ShimMarker = "# Generated by Atmos. Do not edit."
)

Variables

This section is empty.

Functions

func Install

func Install(ctx context.Context, cfg *schema.GitConfig, names []string, force bool) error

Install writes shim scripts into .git/hooks for the named hooks (all configured hooks when names is empty). Existing non-Atmos files are only overwritten when force is set.

func NotConfiguredError

func NotConfiguredError(hookName string, hooks map[string]schema.GitHookEntry) error

NotConfiguredError builds an ErrGitHookNotConfigured error with a hint listing configured hook names.

func Run

func Run(cfg *schema.GitConfig, hookName string, hookArgs []string) error

Run executes the configured command for the named hook, forwarding the hook arguments and stdin.

func ShimContent

func ShimContent(hookName string) string

ShimContent returns the generated shim content for a given hook name.

func SortedNames

func SortedNames(m map[string]schema.GitHookEntry) []string

SortedNames returns the configured hook names in ascending order.

func Uninstall

func Uninstall(ctx context.Context, cfg *schema.GitConfig, names []string) error

Uninstall removes Atmos-generated shims from .git/hooks for the named hooks (all configured hooks when names is empty). User-authored hooks are never deleted; a warning is emitted instead.

func ValidateShimName

func ValidateShimName(hookName string) error

ValidateShimName rejects hook names that could escape .git/hooks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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