app

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 53 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, probe-confirmed data loss): 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 (
	SafetyNote = "Not a substitute for official warnings."
	SafetyNext = "For life safety: NOAA Weather Radio and WEA."
)

SafetyNote / SafetyNext are the R-13 safety framing (discover G-3b), two About lines: Watchpost shows what the sources publish, with the lag that implies — it is not a warning system. Named in the README too.

View Source
const UserAgent = "watchpost/0.9 (+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 (b1 red-team S-1, closed at the 0.9.0 exit).

Variables

This section is empty.

Functions

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 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