Help us shape the future of Go! Take the 2026 Go Developer Survey

activity

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package activity is the root's own record of what has happened this session — every promotion started, landed, blocked or failed, every abandon, every browser-launch outcome — kept as an append-only, capped Log (AGENTS.md §4.8) rather than the single transient "notice" string app.Model carried before this package existed.

The old convention (app.Model.notice) showed exactly one message, cleared unconditionally on the operator's very next keypress — so a real refusal (an in-flight conflict, a missing repos[].github, a claim conflict) that arrived a beat before an unrelated "j" or "k" was simply gone, with no way to read it again short of re-running the equivalent command on the CLI (#164 was the first half of this; this package is the second). Log.Add never drops an entry on a keypress — only once the log's own cap (50) is exceeded, oldest first — and Model is the screen (l on the matrix, AGENTS.md §9 entry 10's own "one verb per concept" keymap) that reads every entry back in full, redacted and wrapped but never truncated.

app.Model's own bottom row (View, replacing the old notice rows) shows only the latest entry's text, one line, plus a "l: activity (N)" hint — not cleared by a keypress either, only ever replaced by a newer entry or dismissed by opening the log itself.

Index

Constants

View Source
const Cap = 50

Cap is the maximum number of entries Log keeps. Add drops the oldest once full.

Variables

This section is empty.

Functions

func Lines

func Lines(log Log, now func() time.Time, width int) []string

Lines renders every entry in log as plain wrapped text, oldest first — the activity screen's own derived data, with no terminal dependency (AGENTS.md §4.8: "a screen's derived data … lives in a file with no terminal dependency", the same split matrix/cells.go uses), so a test can assert an exact row count and which rows hold a given line without a viewport or a Frame in the way. Nothing here truncates: a long Detail (a full transport error) wraps onto as many rows as it needs — the screen scrolls, it never drops the tail (contrast ui.Frame's own section-trimming, AGENTS.md §9 entry 10, which is about a FIXED number of terminal rows, not this scrollable content inside one of them). now ages every entry (ui.Ago); a test pins it. Every string is redacted here, once, at this render boundary (pkg/redact), the same convention app.Model.View and flight.Model.View already use.

Types

type BackMsg

type BackMsg struct{}

BackMsg is emitted on esc; the root pops the screen (internal/app/app.go — l, handled generically for any keyed screen, is what pushes it: the same New-on-open, adapter-in-app.go shape every other read-only screen in this package uses, config.Model in particular).

type Entry

type Entry struct {
	At     time.Time
	Kind   Kind
	Text   string
	Detail string
	URL    string
}

Entry is one thing the session reported: a promotion started (naming its PR when one already exists), landed, blocked, failed or abandoned, or a browser-launch outcome. Text is the short summary the bottom row can show on one line; Detail is the full text a summary would otherwise lose — a complete transport error, in particular — shown only in the activity screen itself, wrapped but never truncated (AGENTS.md §8, "verify the output, not the instrument": a summary that silently ate the reason would be exactly the #164 shape this package exists to end). URL is set when the entry names a link (a PR) — both the bottom row and the activity screen show it. Every string here is redacted at render time (pkg/redact), never at construction, so Log.Add never has to know redaction happened.

type Kind

type Kind int

Kind classifies one Entry for the activity screen's own styling and the bottom row's own short summary — Err in the error color, OK in the success color, Info plain.

const (
	// Info is a plain, non-error entry — a promotion started, a PR opened, a URL shown.
	Info Kind = iota
	// OK marks a successful outcome — a promotion landed, an abandon completed.
	OK
	// Err marks a refusal or failure — a build error, a blocked step, a failed drive.
	Err
)

func (Kind) String

func (k Kind) String() string

String names a Kind for rendering — never used to decide anything.

type Log

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

Log is an append-only, capped history of Entry values (doc.go's own "Design" section) — a value type, copy-on-append like session.Controller (AGENTS.md §4.8): Add never mutates the receiver's backing array, so an older Log a screen still holds (Model.New takes one by value, doc comment) never observes a later Add.

func (Log) Add

func (l Log) Add(e Entry) Log

Add appends e and returns the updated Log, oldest entries dropped past Cap.

func (Log) Entries

func (l Log) Entries() []Entry

Entries returns every entry, oldest first. The caller must not mutate the result.

func (Log) Latest

func (l Log) Latest() (Entry, bool)

Latest returns the most recently added Entry, or false if the log is empty.

func (Log) Len

func (l Log) Len() int

Len reports how many entries the log holds.

type Model

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

Model is the activity log screen (l on the matrix and, per the proposed keymap, every other screen — docs/audit/2026-09-ux-arch-audit.md "Proposed keymap"). It shows every Entry the root's own activity.Log has recorded, oldest first, full text, redacted and wrapped but never truncated (Lines' own doc comment) — the operator's way to read a result or an error in full once the bottom row's own one-line summary is all that is left on screen. Value-typed like every other screen (AGENTS.md §4.8).

New takes a snapshot of the log as it stood when the operator pressed l, not a live feed: like config.Model's own already-marshalled text, what this screen shows is exactly what the root held at the moment it opened, never re-fetched or updated in place while it's open. An entry added while the log is open next shows the next time l is pressed.

func New

func New(log Log, now func() time.Time) Model

New builds the screen over log. now ages every entry (ui.Ago); nil defaults to time.Now, and every real caller (app.go) supplies one, mirroring every other relative-time screen's own convention (AGENTS.md §4.8).

func (Model) CapturesText

func (m Model) CapturesText() bool

CapturesText is false: no key on this screen is text.

func (Model) Init

func (m Model) Init() tea.Cmd

Init has nothing to fetch: everything the screen shows arrived in New.

func (Model) KeyScreen

func (m Model) KeyScreen() keys.Screen

KeyScreen implements the root's keyed interface (internal/app/screen.go).

func (Model) SetSize

func (m Model) SetSize(width, height int) Model

SetSize records the terminal size and sizes the viewport to what the frame leaves.

func (Model) SetStyles

func (m Model) SetStyles(s ui.Styles) Model

SetStyles applies the palette.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles esc (BackMsg) and forwards everything else to the viewport.

func (Model) View

func (m Model) View() string

View renders the frame: the title, the log in its viewport, and the footer.

Jump to

Keyboard shortcuts

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