Add Daily briefing JSON generation

This commit is contained in:
2026-05-29 17:23:49 +00:00
parent caf21dfedd
commit cf8e1de3ff
9 changed files with 922 additions and 14 deletions

View File

@@ -1,8 +1,8 @@
# Weatherreporter CLI
`weatherreporter` currently resolves configuration, command requests, report
definitions, and valid periods, then returns a not-implemented error for report
generation and scheduled runs.
`weatherreporter generate daily` currently writes a Daily briefing JSON artifact.
Other report generation and scheduled runs still resolve configuration, report
definitions, and valid periods, then return a not-implemented error.
## Shortest Useful Command
@@ -10,8 +10,8 @@ generation and scheduled runs.
weatherreporter generate daily --date 2026-05-29 --out ./daily.md
```
The command parses flags, loads configuration, resolves report identity and the
valid period, and then stops before weather data fetching or report rendering.
The command parses flags, loads configuration, fetches weather data, builds a
Daily briefing, and writes the JSON artifact to `--out`.
## Command Overview
@@ -25,9 +25,9 @@ weatherreporter run morning
weatherreporter run evening
```
`generate` commands resolve one report request. `run` commands resolve a
scheduled batch request. All report and batch execution currently returns
`not implemented` after request resolution.
`generate daily` writes a briefing JSON artifact. Other `generate` commands
resolve one report request and stop before report generation. `run` commands
resolve a scheduled batch request and stop before execution.
## Flags
@@ -35,7 +35,7 @@ scheduled batch request. All report and batch execution currently returns
- `--config PATH`: load configuration from `PATH` instead of `/usr/local/etc/weatherreporter/config.yml`.
- `--units VALUE`: override configured Weather API units.
- `--tz NAME`: override configured Weather API timezone.
- `--out PATH`: override report output path or directory for `generate` commands.
- `--out PATH`: output path for `generate daily`; reserved for later generated report output on other `generate` commands.
- `--date YYYY-MM-DD`: optional date for `generate daily`; defaults to the current local date in the configured timezone.
- `--start TIME`: required start time for `generate storm`.
- `--end TIME`: required end time for `generate storm`.

59
docs/internal/briefing.md Normal file
View File

@@ -0,0 +1,59 @@
# Briefing Internals
This document describes the implemented briefing package boundary.
## Purpose
`internal/briefing` builds structured report-specific briefing packages from
forecast summaries and report metadata. The package currently implements the
Daily briefing only.
## Inputs and Outputs
Inputs:
- resolved report definition and valid period
- forecast bundle
- derived daily forecast summary
- configured units and timezone
Output:
- `briefing.Package` JSON containing common metadata and Daily briefing content
## Boundaries
- Briefings are structured weather facts and context for later prompt input.
- This package does not fetch weather data, compare prior snapshots, build
`scriptorium` data packages, or render final report prose.
## Behavior
- Common metadata includes schema version, RunID, report ID, variant, prompt ID,
generation time, units, timezone, valid period, source location, source
provenance, hashes, and source warnings.
- Daily content includes bottom-line inputs, daypart summaries, relevant alerts,
outdoor window inputs, narrative periods, discussion context, and weather
story context when available.
- Briefing JSON is written atomically by `briefing.Save`.
## Failure Behavior
- Daily briefing construction requires a Daily report definition and a derived
daily forecast summary.
- Save failures include path and operation context.
## Tests
Inspect:
- `internal/briefing/daily_test.go`
- `internal/app/app_test.go`
- `internal/cli/root_test.go`
## Invariants
- Weather facts come from normalized and derived source data.
- Briefing output remains JSON-inspectable.
- LLM prompt input packaging and `scriptorium` execution remain outside this
boundary.