app

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 81 Imported by: 0

Documentation

Overview

Package app is the composition root (Option C): the ONLY place that wires domains, platform, and modes together. cmd/watchpost stays thin.

RunDashboard wires the live pipeline (B3): config locations → NWS provider → tiered scheduler → published snapshots streamed into the TTY dashboard. M1 instrumentation: the time from start to the first fully-populated snapshot is logged to stderr on exit when WATCHPOST_DEBUG_TIMING=1.

Setup (UAT 100, HUM LEAD 2026-08-25): the first-run questions live in a window over the dashboard like every other modal (modes/tty setupLines); this file is the app side — the type-ahead hook and the persist step. Re-runs never destroy customizations (B2 red-team #2): the existing config is loaded and only what setup owns is touched — the default location and, when given, the FIRMS key.

Index

Constants

View Source
const UserAgent = "watchpost (+https://github.com/branden-thompson/watchpost)"

UserAgent identifies watchpost to providers (AI-1: NWS requires contact info; a reachable project URL satisfies it). The tree is public, so no personal address rides here.

NO VERSION. A version in the header is a fact about this machine that no provider asks for, and one more thing to keep in step with the build — it read 0.9 for five releases. The project URL is the contact NWS wants.

Variables

This section is empty.

Functions

func RenderCast added in v0.14.0

func RenderCast(ctx context.Context) string

RenderCast is `watchpost report --verbose`'s cast block: who reads what on this machine and why, and the tone state — the same answers [S] gives, with no deck and no dashboard (Task 4.8).

A config that will not load is reported as such rather than skipped: a listener running --verbose because something is wrong needs to be told when the file itself is the something.

func ReportOnce

func ReportOnce(ctx context.Context, query string) (*snapshot.Snapshot, error)

ReportOnce runs the one-shot fetch pipeline for `watchpost report <query>`: resolve the location, fetch obs+forecast+alerts from NWS, and return the published snapshot (B1a scope; scheduler-driven live mode arrives B1b/B3).

func ReportOnceWithStats added in v0.9.5

func ReportOnceWithStats(ctx context.Context, query string) (*snapshot.Snapshot, httpx.RequestStats, error)

ReportOnceWithStats is ReportOnce plus the request counters of the clients the run used (`report --verbose`, quality pass Q0).

func RunDashboard

func RunDashboard(version string, opt Options) error

RunDashboard starts the live TUI. Returns after the user quits.

Types

type CastReport added in v0.14.0

type CastReport struct {
	Rows     []CastRow
	ToneMode string
	Muted    []string
	Problems []cast.Problem
}

CastReport is the whole answer — the cast rows, the tone state and the problems — built from a config and a host, with no deck anywhere.

func (CastReport) ToneSummary added in v0.14.0

func (r CastReport) ToneSummary() string

ToneSummary words the tone state for a listener: "all tones on", "muted", or "muted: watches, advisories".

type CastRow added in v0.14.0

type CastRow struct {
	Role       string
	Requested  string
	Spoken     string
	Link       string
	Reason     string
	Installing bool // a named Piper key that is not on disk yet
}

CastRow is one role's answer, ready to print: who was asked for, who speaks, which link won, and why the requested one lost.

type Gauge added in v0.9.5

type Gauge struct {
	Name  string `json:"name"`
	Len   int    `json:"len"`
	Bytes int64  `json:"bytes"`
}

Gauge is one structure's size at a point in time. Len counts items; Bytes is the payload size when the owner can say it cheaply, else 0.

type Options added in v0.9.6

type Options struct {
	OpenSetup bool // open the Setup window at once (`watchpost setup`); it also opens itself on a first run or an empty watchlist (UAT 100)
	ASCII     bool // --ascii: row marks and legend in their ASCII forms (A11-10)
}

Options are the dashboard's launch switches.

type SourceHealth added in v0.13.0

type SourceHealth struct {
	Name      string
	OK        bool
	FetchedAt time.Time // the last successful fetch; zero = never
}

SourceHealth is one feed's last outcome, for the window's "Updated" stamp and its source line: a dead source must show, and the stamp is the newest successful fetch — dataAsOf — never the publish time.

Jump to

Keyboard shortcuts

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