Add Daily prompt input preflight
This commit is contained in:
22
docs/cli.md
22
docs/cli.md
@@ -1,17 +1,19 @@
|
||||
# Weatherreporter CLI
|
||||
|
||||
`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.
|
||||
`weatherreporter generate daily` currently writes a Daily prompt input data
|
||||
package and runs `scriptorium render` as a preflight check. Other report
|
||||
generation and scheduled runs still resolve configuration, report definitions,
|
||||
and valid periods, then return a not-implemented error.
|
||||
|
||||
## Shortest Useful Command
|
||||
|
||||
```sh
|
||||
weatherreporter generate daily --date 2026-05-29 --out ./daily.md
|
||||
weatherreporter generate daily --date 2026-05-29 --out ./daily.data_package.json
|
||||
```
|
||||
|
||||
The command parses flags, loads configuration, fetches weather data, builds a
|
||||
Daily briefing, and writes the JSON artifact to `--out`.
|
||||
Daily briefing, writes the `data_package` JSON artifact to `--out`, and invokes
|
||||
`scriptorium render --input data_package=<path> --format json`.
|
||||
|
||||
## Command Overview
|
||||
|
||||
@@ -25,9 +27,11 @@ weatherreporter run morning
|
||||
weatherreporter run evening
|
||||
```
|
||||
|
||||
`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.
|
||||
`generate daily` writes a data package JSON artifact, writes the Daily briefing
|
||||
snapshot under the configured workspace, and writes the render preflight output
|
||||
under the configured workspace. 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 +39,7 @@ resolve a scheduled batch request and stop before execution.
|
||||
- `--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`: output path for `generate daily`; reserved for later generated report output on other `generate` commands.
|
||||
- `--out PATH`: data package 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`.
|
||||
|
||||
52
docs/internal/prompt-input.md
Normal file
52
docs/internal/prompt-input.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Prompt Input Internals
|
||||
|
||||
This document describes the implemented prompt input package boundary.
|
||||
|
||||
## Purpose
|
||||
|
||||
`internal/promptinput` converts a structured briefing package into the
|
||||
`data_package` JSON file passed to `scriptorium` prompts.
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
Input:
|
||||
|
||||
- `briefing.Package`
|
||||
|
||||
Output:
|
||||
|
||||
- `promptinput.Package` JSON with report metadata, briefing content, source
|
||||
warnings, RunID, and an empty Recent Changes section.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- This package owns the prompt input schema and required-field validation.
|
||||
- It does not fetch weather data, compute forecast summaries, compare prior
|
||||
snapshots, or invoke `scriptorium`.
|
||||
|
||||
## Behavior
|
||||
|
||||
- `promptinput.Build` copies report metadata from the briefing package.
|
||||
- `promptinput.Validate` rejects missing or inconsistent required fields before
|
||||
render preflight.
|
||||
- `promptinput.Save` writes JSON atomically where practical.
|
||||
- Recent Changes is present as an empty `items` list until structured comparison
|
||||
is implemented.
|
||||
|
||||
## Failure Behavior
|
||||
|
||||
Validation errors name the missing or inconsistent field. Save failures include
|
||||
the filesystem operation and path context.
|
||||
|
||||
## Tests
|
||||
|
||||
Inspect:
|
||||
|
||||
- `internal/promptinput/package_test.go`
|
||||
- `internal/app/app_test.go`
|
||||
|
||||
## Invariants
|
||||
|
||||
- Prompt input data remains structured JSON.
|
||||
- Briefing metadata and top-level report metadata must agree.
|
||||
- Recent Changes is not inferred from rendered report text.
|
||||
63
docs/internal/scriptorium-adapter.md
Normal file
63
docs/internal/scriptorium-adapter.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# Scriptorium Adapter Internals
|
||||
|
||||
This document describes the implemented `scriptorium` subprocess adapter.
|
||||
|
||||
## Purpose
|
||||
|
||||
`internal/adapters/scriptorium` runs `scriptorium render` to preflight prompt
|
||||
wiring without LLM generation.
|
||||
|
||||
## Inputs and Outputs
|
||||
|
||||
Input:
|
||||
|
||||
- prompt ID
|
||||
- prompt input data package path
|
||||
- configured binary, config path, profile, timeout, and extra arguments
|
||||
|
||||
Output:
|
||||
|
||||
- captured stdout
|
||||
- captured stderr
|
||||
- exit code
|
||||
- full argv used for inspection
|
||||
|
||||
## Boundaries
|
||||
|
||||
- This adapter owns `scriptorium` CLI flag construction and subprocess
|
||||
execution.
|
||||
- It does not choose report types, build prompt input, fetch weather data, or
|
||||
decide workflow order.
|
||||
|
||||
## Behavior
|
||||
|
||||
The render invocation shape is:
|
||||
|
||||
```text
|
||||
scriptorium render --prompt <prompt_id> --input data_package=<path> --format json
|
||||
```
|
||||
|
||||
Configured `--config` and `--profile` values are added when present. Arguments
|
||||
are passed directly as argv, not through a shell. Stdout and stderr are captured
|
||||
separately. `SaveRenderResult` writes the captured result as JSON for inspection.
|
||||
|
||||
## Failure Behavior
|
||||
|
||||
Nonzero render exits return both the captured result and an error containing
|
||||
the exit code and stderr. Command execution respects context cancellation and
|
||||
the configured timeout.
|
||||
|
||||
## Tests
|
||||
|
||||
Inspect:
|
||||
|
||||
- `internal/adapters/scriptorium/runner_test.go`
|
||||
- `internal/app/app_test.go`
|
||||
- `internal/cli/root_test.go`
|
||||
|
||||
## Invariants
|
||||
|
||||
- `scriptorium` details stay inside the adapter package.
|
||||
- The input name for prompt packages is always `data_package`.
|
||||
- Render preflight is orchestration behavior; final report generation is not
|
||||
implemented in this adapter yet.
|
||||
Reference in New Issue
Block a user