audit

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package audit provides append-only audit logging for Governator v2 runs.

Index

Constants

View Source
const (
	// EventWorktreeCreate records worktree creation.
	EventWorktreeCreate = "worktree.create"
	// EventWorktreeDelete records worktree deletion.
	EventWorktreeDelete = "worktree.delete"
	// EventBranchCreate records branch creation.
	EventBranchCreate = "branch.create"
	// EventBranchDelete records branch deletion.
	EventBranchDelete = "branch.delete"
	// EventTaskTransition records task lifecycle transitions.
	EventTaskTransition = "task.transition"
	// EventAgentInvoke records agent invocation.
	EventAgentInvoke = "agent.invoke"
	// EventAgentOutcome records agent completion.
	EventAgentOutcome = "agent.outcome"
	// EventWorkerTimeout records worker process timeout.
	EventWorkerTimeout = "worker.timeout"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	TaskID string
	Role   string
	Event  string
	Fields []Field
}

Entry captures the required audit log fields and any optional fields.

type Field

type Field struct {
	Key   string
	Value string
}

Field represents a logfmt key/value pair.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger appends audit entries to a log file.

func NewLogger

func NewLogger(repoRoot string, warnings io.Writer) (*Logger, error)

NewLogger builds an audit logger rooted at the provided repo.

func (*Logger) Log

func (logger *Logger) Log(entry Entry) error

Log writes a generic audit entry to the log file.

func (*Logger) LogAgentInvoke

func (logger *Logger) LogAgentInvoke(taskID string, role string, agent string, attempt int) error

LogAgentInvoke records an agent invocation event.

func (*Logger) LogAgentOutcome

func (logger *Logger) LogAgentOutcome(taskID string, role string, agent string, status string, exitCode int) error

LogAgentOutcome records an agent outcome event.

func (*Logger) LogBranchCreate

func (logger *Logger) LogBranchCreate(taskID string, role string, branch string, base string) error

LogBranchCreate records a branch creation event.

func (*Logger) LogBranchDelete

func (logger *Logger) LogBranchDelete(taskID string, role string, branch string) error

LogBranchDelete records a branch deletion event.

func (*Logger) LogTaskTransition

func (logger *Logger) LogTaskTransition(taskID string, role string, from string, to string) error

LogTaskTransition records a task lifecycle state transition.

func (*Logger) LogWorkerTimeout

func (logger *Logger) LogWorkerTimeout(taskID string, role string, timeoutSecs int, worktreePath string) error

LogWorkerTimeout records a worker timeout event.

func (*Logger) LogWorktreeCreate

func (logger *Logger) LogWorktreeCreate(taskID string, role string, path string, branch string) error

LogWorktreeCreate records a worktree creation event.

func (*Logger) LogWorktreeDelete

func (logger *Logger) LogWorktreeDelete(taskID string, role string, path string, branch string) error

LogWorktreeDelete records a worktree deletion event.

Jump to

Keyboard shortcuts

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