audit

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package audit reports workflow-conformance findings over a branch's git history. The range rules are advisory (ADR-0017): standalone, never wired into the gate. The shared CheckConventionalCommit rule is the exception - it is also consumed at commit time by `awf check staged commit` and at plan time by `awf check` (ADR-0111). Most rules are pure over the commit range; the uncommitted-changes rule (ADR-0025) additionally inspects the live working tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConventionalCommitDocument added in v0.30.0

func ConventionalCommitDocument(findings []Finding) (presentation.Document, error)

ConventionalCommitDocument maps conventional-commit findings for the commit gate.

func Report added in v0.30.0

func Report(findings []Finding, commits int, base, head string) (presentation.Report, error)

Report maps audit-owned findings into the shared representation without changing rank tokens or evaluation order.

Types

type Finding

type Finding struct {
	Severity severity.Rank
	Rule     string
	Commit   string // short hash, "" for a branch-level finding
	Subject  string
	Detail   string
}

Finding is one reported conformance issue.

func CheckConventionalCommit added in v0.3.0

func CheckConventionalCommit(c awfgit.Commit, s Settings) []Finding

CheckConventionalCommit validates one commit's subject against the Conventional Commits settings and returns any violations. It is the single definition of the rule - consumed by the audit range loop above, by the blocking `awf check staged commit` command (ADR-0036), and by the plan-time planned-subject check (CheckPlannedSubject, ADR-0111) - so none re-implements the regex, the type/scope allow-lists, or the subject-length limit. Merge commits are exempt. touches-state: tooling/audit-and-snapshots:commit-gate-shared-rule - shared conventional-commit rule consumed by check staged commit; proof in commitgate_test.go

func CheckPlannedSubject added in v0.18.0

func CheckPlannedSubject(subject string, s Settings) []Finding

CheckPlannedSubject validates a commit subject a plan proposes with the shared policy.

func Run

func Run(ctx context.Context, repoRoot, base, head string, in Inputs) ([]Finding, int, error)

Run collects the caller-supplied commit range and evaluates the rules. The range arrives as parameters rather than Inputs fields because no config key supplies it (ADR-0127 Decision 3). It also returns the number of commits the range resolved to, so the caller can report the scope it evaluated rather than a bare verdict (ADR-0127 Decision 9).

type Inputs

type Inputs struct {
	Settings
	GeneratedPaths map[string]bool
	ADRDir         string // e.g. "docs/decisions"
	DocsDir        string // e.g. "docs"; the authored-prose root (ADRDir and PlansDir sit under it)
	IndexMd        string // e.g. "docs/decisions/INDEX.md"
	PlansDir       string // e.g. "docs/plans"
}

Inputs are the resolved audit settings plus the project-derived layout the rules need. The embedded Settings carries the repository's allowed scope vocabulary.

type Settings

type Settings struct {
	AllowedScopes []config.ScopeSpec
}

Settings is the fixed audit policy plus the repository's scope vocabulary.

func Resolve

func Resolve(scopes []config.ScopeSpec) Settings

Resolve preserves the one repository-specific audit fact: allowed scopes.

func (Settings) ScopeNames added in v0.8.0

func (s Settings) ScopeNames() []string

ScopeNames returns just the allowed scope names, for gate matching.

Jump to

Keyboard shortcuts

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