cimonitor

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cimonitor is the single source of truth for the CI monitor's human-facing log vocabulary and agent-facing monitoring state.

The CI step (internal/pipeline/steps) emits these exact log lines while it watches an open PR. Two very different consumers read them back: the TUI renders a live CI panel, and the agent-facing `axi` commands decide when to hand control back to the agent. Keeping the strings and the parser here means both consumers interpret a run identically and cannot drift apart.

Readiness ownership is split deliberately: the pipeline/config owner decides whether a trusted default-branch `no_ci: true` declaration applies, and this package combines that authoritative state with the activity log for consumers.

Index

Constants

View Source
const (
	// ChecksPassedMsg is logged when every CI check has passed but the PR is
	// not yet merged or closed, so the monitor keeps watching subject to its
	// configured timeout.
	ChecksPassedMsg = "all CI checks passed - still monitoring until merged or closed"
	// NoChecksPassedMsg is logged only when the trusted default-branch config
	// declares `no_ci: true` and the forge reports zero checks. The message
	// names the positive declaration so agents and operators can inspect the
	// evidence rather than treating every empty forge response as green. An
	// empty check list WITHOUT that declaration must never produce this line.
	NoChecksPassedMsg = "repository declares no CI (no_ci: true) - treating as all checks passed - still monitoring until merged or closed"
	// ChecksRunningMsg is logged when checks are (re-)running with no failures
	// yet, which clears any previous passed-checks state.
	ChecksRunningMsg = "CI checks running, waiting for results..."
)

Log messages the CI monitor emits. These are matched exactly (not by substring) when deriving the "checks passed" state, so the producer and the consumers must reference these constants rather than spelling out literals.

Variables

This section is empty.

Functions

func ChecksPassed

func ChecksPassed(logs []string) bool

ChecksPassed reports whether the CI monitor's latest state is "checks passed, PR ready to merge". It is the agent-facing summary of ParseActivity(logs).Ready. Ready covers both all-green checks and a trusted no_ci declaration with zero registered checks; use DeclaredNoCI to distinguish the two for help text.

func DeclaredNoCI

func DeclaredNoCI(logs []string) bool

DeclaredNoCI reports whether the latest ready state is backed by an explicit trusted no_ci declaration rather than observed green checks.

Types

type Activity

type Activity struct {
	CIFixes      int    // number of auto-fix attempts observed
	AutoFixing   bool   // an auto-fix is currently in progress
	Ready        bool   // checks have passed (or declared no-CI); PR ready to merge
	DeclaredNoCI bool   // Ready because of an explicit no_ci declaration, not green checks
	LastEvent    string // the most recent recognized log line
}

Activity summarizes what the CI step has been doing, derived from its logs.

func FromAuthoritative

func FromAuthoritative(ready, declaredNoCI bool, logs []string) Activity

FromAuthoritative combines pipeline-owned readiness with CI activity logs. Readiness fields from logs are treated as activity only and never override the persisted state supplied by the pipeline.

func ParseActivity

func ParseActivity(logs []string) Activity

ParseActivity extracts log-derived activity from CI messages. Its readiness fields reflect recognized log vocabulary only; consumers use FromAuthoritative for the persisted readiness state.

Jump to

Keyboard shortcuts

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