narrate

package
v0.167.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package narrate renders the one console line the hub writes for every event it handles, whether the event arrived by webhook or was produced by the poller.

The operator who runs `wb daemon serve` in a terminal wants to see the hub work without opening the dashboard, so the format is fixed-column and readable at a glance rather than structured for machines:

14:02:11 push            github.com/sneat-dev/wb          default branch main -> 3f1c2a9; queued for laptop
14:06:30 poll            github.com/sneat-dev/wb          no change
15:00:00 redeliver       push github.com                  redelivered (attempt 1 of 3)

Columns are local time, the event name as GitHub names it ("poll" for the poller, "redeliver" for the missed-webhook recovery sweep), the organisation or repository the event is about, and the action taken in plain words.

A Line carries only metadata the repository-event contract already treats as publishable. Callers must never put a token, a webhook secret, or a payload body into one: the daemon's console is echoed into the log file a detached daemon writes, and that file is routinely pasted into issues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	// At is the moment the hub decided what to do with the event. It is
	// rendered in the location it carries, so a caller that wants local time
	// passes local time.
	At time.Time
	// Event is the event name as GitHub names it: "push", "repository",
	// "installation", "poll" for the polling ingester, or "redeliver" for the
	// missed-webhook recovery sweep.
	Event string
	// Subject is the organisation or repository the event is about.
	Subject string
	// Action is what the hub did, in plain words.
	Action string
}

Line is one narrated event.

func (Line) String

func (line Line) String() string

String renders the line without a trailing newline.

type Writer

type Writer struct {
	Out   io.Writer
	Quiet bool
}

Writer sends narrated lines to the daemon's console. The zero value discards them, so a caller that has nowhere to write needs no branch.

Quiet is what `wb daemon serve --quiet` sets. It silences the console only: a detached daemon started by `wb daemon start` never passes --quiet, so the log file it writes keeps every line.

func (Writer) Write

func (writer Writer) Write(line Line)

Write renders one line. It is deliberately best-effort: a console that cannot be written to must never take the hub down, and there is nowhere useful to report the failure to.

Jump to

Keyboard shortcuts

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