1.8 KiB
Prompt Input Internals
This document describes prompt input data package construction.
Purpose
internal/promptinput converts report metadata, module snapshots, and optional
Recent Changes into the YAML data_package passed to Scriptorium prompts.
Inputs And Outputs
Inputs:
- report metadata
module.Snapshot- optional
[]changes.Change
Outputs:
promptinput.Packagecontaining schema version, RunID, report metadata, named module stanzas underbriefing, Recent Changes, and source warnings.- report metadata includes
currentLocalDate, the generation date formatted asYYYY-MM-DDin the effective report timezone. - optional YAML file written by
promptinput.Save
Boundaries
- This package owns the prompt input schema and validation.
- It does not fetch weather data, derive forecast summaries, find prior snapshots, compare changes, or invoke Scriptorium.
Config Fields Used
None directly. Config-derived values, including timezone and prompt location context, are already present in report metadata and module stanzas before this package runs.
External Adapters Used
None.
State Or Manifest Behavior
promptinput.Save writes YAML atomically. Managed workspace paths are owned by
internal/state.
Skip And Resume Behavior
None. Recent Changes is always present as an items list and may be empty.
Failure Behavior
Validation fails before render preflight when required top-level fields are missing or inconsistent, or when no named module stanzas are present. Save failures include filesystem operation and path context.
Tests
Inspect:
internal/promptinput/package_test.gointernal/app/app_test.go
Invariants
- Scriptorium receives structured
data_packageYAML. - Module stanza order is deterministic for generated snapshots.
- Recent Changes are not inferred from rendered report text.