Documentation
¶
Overview ¶
Package gates implements the git hooks and CI gate (docs/spec/integrations.md, Gates).
Index ¶
- Variables
- func AddTrailers(root, msgFile, taskID, tool string) error
- func DefaultBase(root, defaultBranch string) string
- func HooksDir(root string) (string, error)
- func Install(root string) ([]string, error)
- func MessageHeader(msg string) string
- func Uninstall(root string) ([]string, error)
- type Violation
Constants ¶
This section is empty.
Variables ¶
var ConventionalRe = regexp.MustCompile(`^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([^()\r\n]+\))?!?: \S.*$`)
ConventionalRe matches a Conventional Commits 1.0 header.
var Hooks = []string{"pre-commit", "commit-msg", "pre-push"}
Hooks managed by aitk.
Functions ¶
func AddTrailers ¶
AddTrailers appends AI-Task / AI-Tool trailers to the message file when not already present.
func DefaultBase ¶
DefaultBase picks the CI comparison base: GITHUB_BASE_REF / CI_MERGE_REQUEST_TARGET_BRANCH_NAME, else the merge base with origin/<default branch>, else "" (nothing to compare).
func Install ¶
Install adds aitk's block to each hook. Shell hooks get the block after their shebang; hooks in other languages are kept as <hook>.aitk-user and run by a small shell wrapper, so existing hooks always keep working.
func MessageHeader ¶ added in v2.5.1
MessageHeader is the first non-empty line of a commit message as git will record it: comment lines dropped, and nothing below the scissors line of ` + "`git commit -v`" + `.
Types ¶
type Violation ¶
type Violation struct {
Gate string `json:"gate"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Detail string `json:"detail"`
}
Violation is one gate failure.
func CheckMessage ¶
CheckMessage validates a commit message header. Merge, revert, fixup, and squash commits pass.