committer

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package committer holds the deterministic checks of the committer role (roles/committer). The role's pre and post scripts call them through `workline builtin committer pre|post`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(message string, s Settings) ([]verdict.Finding, error)

Check returns what is wrong with a commit message. An empty result means it passes.

func Identity

func Identity(repo, rng string, s Settings) ([]verdict.Finding, error)

Identity checks the author and committer addresses git will record (rng empty), or those of every commit of rng. git var gives the effective identity, so an address given for one commit (-c user.email, --author) is caught too: the one that leaks is usually given on purpose.

func MessageLeaks

func MessageLeaks(repo string, messages []Message) ([]verdict.Finding, error)

MessageLeaks scans commit messages with gitleaks, with the same lists as Secrets: gitleaks reads what commits change, never what they say. All the messages go through one scan; each finding names its commit and line. Without gitleaks it finds nothing: Secrets already says so.

func Post

func Post(runDir, repo string) int

Post is the role's judge step: a rewritten message must pass the same checks, and carry no secret or term; with no rewrite, the original findings stand.

func Pre

func Pre(runDir, repo string) int

Pre is the role's prepare step: check the message; if it fails, ask the agent to rewrite it. Exit 10 when there is nothing to do.

func Secrets

func Secrets(repo, rng string) ([]verdict.Finding, error)

Secrets scans what a commit adds (rng empty: the staged changes) or every commit of rng with gitleaks: secrets, and the terms of the user's lists. gitleaks takes, first found: GITLEAKS_CONFIG, the repository's .gitleaks.toml — which may extend the common list — then the user's common list (<config folder>/workline/gitleaks.toml), then its own rules. Matches are never printed. Without gitleaks, it says the check did not run.

func Trailers

func Trailers(message string) []string

Trailers returns the trailer lines of a message (Refs:, Co-Authored-By:...).

Types

type Message

type Message struct{ Commit, Text string }

A Message is a commit message, and the commit it belongs to (empty for the one being written).

type Settings

type Settings struct {
	SubjectMax         int      `json:"subject-max"`
	BodyMaxLines       int      `json:"body-max-lines"`
	Types              []string `json:"types"`
	InternalCodes      []string `json:"internal-codes"`
	InternalCodesAllow []string `json:"internal-codes-allow"`
	InternalCodesMaybe []string `json:"internal-codes-maybe"`
	AllowedIdentities  []string `json:"allowed-identities"`
}

Settings are the role's settings, as merged by the engine.

Jump to

Keyboard shortcuts

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