2.2 KiB
Application Orchestration Internals
internal/app owns top-level generation, batch, collection, inspection, and
notification ordering after the CLI has parsed arguments and loaded configuration.
Generation
GenerateDetailed resolves one of the four report definitions, initializes an
optional debug root, and inspects the exact Promptkit prompt/profile before it
collects weather or writes managed state. It then builds facts and modules,
saves the YAML data package, persists preparation metadata from the executor
callback, executes the prepared prompt, saves execution provenance and raw
output, validates generated text, renders Markdown, and optionally copies or
notifies from the managed report.
After a completed prompt run, each successfully written downstream artifact is atomically added to the execution record before the corresponding metadata rewrite. Later failures therefore leave the original Promptkit outcome and its last durable set of reached paths inspectable.
Failure results retain all safe paths reached so far. Validation rejection persists raw output and execution provenance but does not render a report.
Batches
RunBatchDetailed constructs a single debug writer and uses the request's
single executor. Before collection it inspects Today, Tomorrow, and Daily for
morning, or Tomorrow and Daily for evening, deduplicating effective profile
inspection. It then collects once, plans eligible Daily dates, and calls the
same prompt-generation core sequentially for each planned report. Per-report
notification is suppressed; a failed report does not stop later reports.
Batch notification is skipped when disabled or when any report failed. Successful notification uses the completed managed report paths only. Batch items retain preparation, execution, and optional debug paths when reached.
Inspection And Boundaries
Inspection loads persisted state only. It does not collect weather, invoke Promptkit, or upload reports. The app coordinates project-owned contracts but does not parse flags, load YAML, implement transport, construct provider SDKs, or define report-period policy.
Focused checks:
go test ./internal/app ./internal/collect