git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeMerkle

func ComputeMerkle(files []string, contents map[string][]byte) string

ComputeMerkle builds a Merkle tree from the provided files and their contents, returning the hex-encoded root hash. The same inputs always produce the same hash; changing any file path or its content produces a different hash. Returns an empty string when files is empty.

func InstallHook

func InstallHook(root string) error

InstallHook installs (or appends to) the post-commit git hook in root so that stacklit regenerates its output on every commit.

  • If .git/hooks/ does not exist, an error is returned.
  • If the hook already contains "stacklit", it is left unchanged.
  • If the hook exists but lacks "stacklit", the script is appended.
  • If the hook does not exist, it is created with mode 0755.

Types

type Activity

type Activity struct {
	HotFiles    []FileActivity `json:"hot_files"`
	RecentFiles []string       `json:"recent"`
	StableFiles []string       `json:"stable"`
}

Activity summarises recent git churn for a repository.

func GetActivity

func GetActivity(root string, days int) (*Activity, error)

GetActivity analyses git history in root over the last days days. If git is unavailable or root is not a git repository, it returns an empty Activity without an error.

type FileActivity

type FileActivity struct {
	Path       string `json:"path"`
	Commits90d int    `json:"commits_90d"`
}

FileActivity records how many commits touched a file in a time window.

Jump to

Keyboard shortcuts

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