88 lines
7.9 KiB
Markdown
88 lines
7.9 KiB
Markdown
# Development
|
|
|
|
This is the first-read guide for people and coding agents working on
|
|
Weatherreporter. It provides a concise repository orientation and routes each
|
|
kind of change to its canonical documentation.
|
|
|
|
Weatherreporter is a Go CLI that collects normalized weather data, derives
|
|
deterministic report facts and module snapshots, executes Promptkit for
|
|
single-report generated text, renders managed Markdown reports, and can upload completed
|
|
reports through Distributor. Start with the [README](../README.md) for product
|
|
context and the [architecture policy](policy/architecture.md) for system
|
|
boundaries and invariants.
|
|
|
|
## What To Read
|
|
|
|
| When working on | Read | Why |
|
|
| --- | --- | --- |
|
|
| Product behavior or the shortest useful workflow | [README](../README.md), [CLI reference](cli.md), and [operations guide](operations.md) | These own product orientation, invocation, and normal operation. |
|
|
| Application shape, package boundaries, dependency direction, safety properties, or architectural invariants | [Architecture policy](policy/architecture.md) and relevant ADRs under `docs/adr/`, when present | Architecture defines the intended system; ADRs preserve significant decision rationale. |
|
|
| Any documentation addition, revision, move, or removal | [Documentation policy](policy/documentation.md) | It defines canonical owners, audience boundaries, current-state rules, and document lifecycle. |
|
|
| Adding, changing, reviewing, or deleting tests | [Testing policy](policy/testing.md) and focused package tests | The policy defines risk-based sufficiency, durable test boundaries, doubles, and test-maintenance criteria. |
|
|
| CLI commands, flags, output, quiet mode, or command wiring | [CLI reference](cli.md) and [CLI internals](internal/cli.md) | The reference owns the user contract; the internal guide owns command composition and output flow. |
|
|
| Configuration fields, defaults, loading, overrides, validation, or secrets | [Configuration reference](config.md), [architecture policy](policy/architecture.md), and tests under `internal/config` | These separate the user-visible contract, architectural rules, and executable behavior. |
|
|
| Top-level generation, batch, collection, inspection, or notification workflow | [App orchestration internals](internal/app-orchestration.md) | It owns workflow ordering, persistence points, failure propagation, and orchestration invariants. |
|
|
| Weather API transport, source envelopes, source warnings, or collection | [Weather API integration](integrations/weatherapi.md), [weather-data internals](internal/weather-data.md), and [collection internals](internal/collect.md) | These separate the external contract, normalized source facts, and app-facing collection behavior. |
|
|
| Forecast periods, weather derivation, collected facts, or derived facts | [Forecast derivation internals](internal/forecast-derivation.md) and [fact contracts](internal/facts.md) | They own deterministic derivation and the fact boundaries used by reports. |
|
|
| Report definitions, valid periods, report IDs, output naming, or batch composition | [Report registry internals](internal/report-registry.md) and [app orchestration internals](internal/app-orchestration.md) | Report definitions own selection and period rules; orchestration owns execution. |
|
|
| Module IDs, module composition, briefing values, or prompt-facing exports | [Module contract internals](internal/module.md), [module builder internals](internal/briefing.md), and [prompt-input internals](internal/prompt-input.md) | These own module contracts, value construction, and the curated prompt-package boundary. |
|
|
| Recent Changes comparison | [Changes internals](internal/changes.md) and [operations guide](operations.md) | The internal guide owns structured comparison; operations owns user-visible artifact behavior. |
|
|
| Prompt execution, profiles, prompt inputs, or result handling | `internal/promptexec`, the Promptkit adapter, and [prompt-input internals](internal/prompt-input.md) | These separate the executor contract and input construction. |
|
|
| Generated-text schemas, validation, render contexts, templates, or Markdown rendering | [Generated-text internals](internal/generatedtext.md), [report-template internals](internal/reporttemplate.md), and [report template guide](templates.md) | These own structured text, renderer implementation, and the maintainer-facing template surface. |
|
|
| Workspace paths, metadata, atomic persistence, lookup, inspection, or recovery | [State internals](internal/state.md), [operations guide](operations.md), and [troubleshooting guide](troubleshooting.md) | These separate implementation, operator workflows, and symptom-based recovery. |
|
|
| Distributor bundles, uploads, notification artifacts, or failures | [Distributor adapter internals](internal/distributor-adapter.md), [Distributor integration contracts](integrations/distributor/), and [operations guide](operations.md) | These separate adapter behavior, external contracts, and operational lifecycle. |
|
|
| Maintained example configuration | [Configuration reference](config.md) and files under `examples/` | The reference owns field meaning; examples own complete copyable files. |
|
|
| Release preparation, tagging, publication, or verification | [Release procedure](release.md) | It owns version selection, release-note preparation, candidate validation, tag publication, CI behavior, and post-publication checks. |
|
|
| Proposed, deferred, or unimplemented work | Documents under `docs/roadmap/` | Future behavior and implementation status belong only in roadmaps until implemented. |
|
|
|
|
For an existing subsystem, inspect its focused internal document, package-local
|
|
types, and tests before changing behavior. Use the package boundaries already
|
|
present before introducing a new package or abstraction.
|
|
|
|
## Repository Map
|
|
|
|
| Area | Responsibility |
|
|
| --- | --- |
|
|
| `cmd/weatherreporter` | Binary entry point. |
|
|
| `internal/cli` | Command parsing, flags, help, output, and command wiring. |
|
|
| `internal/app` | Generation, batches, collection coordination, notification, and inspection orchestration. |
|
|
| `internal/config` | Configuration defaults, loading, precedence, secrets, and validation. |
|
|
| `internal/adapters` | Weather API, Promptkit, and Distributor boundaries. |
|
|
| `internal/weatherdata`, `internal/forecast`, `internal/facts` | Normalized source facts and deterministic derivation. |
|
|
| `internal/report`, `internal/module`, `internal/briefing`, `internal/changes` | Report registry, module contracts and values, and structured comparison. |
|
|
| `internal/promptinput`, `internal/generatedtext`, `internal/reporttemplate` | Prompt packages, generated-text validation, render contexts, and Markdown templates. |
|
|
| `internal/state`, `internal/fileutil`, `internal/timeutil` | Durable artifacts, atomic file operations, clocks, dates, timezones, and periods. |
|
|
| `docs` | User, operator, integration, internal, policy, and roadmap documentation. |
|
|
| `examples` | Maintained copyable configuration. |
|
|
|
|
The [architecture policy](policy/architecture.md) is authoritative for
|
|
normative boundaries. Focused documents under `docs/internal/` own detailed
|
|
implemented subsystem behavior.
|
|
|
|
## Contributor Workflow
|
|
|
|
1. Read the documents and focused tests identified by the task guide.
|
|
2. Use focused package checks while iterating.
|
|
3. Run `gofmt -w` on changed Go files.
|
|
4. Update the canonical documentation and maintained examples in the same
|
|
change when behavior changes.
|
|
5. Run repository-wide validation before considering the work complete.
|
|
|
|
Preserve actionable error context, keep secrets out of logs and fixtures, and
|
|
avoid validation that requires live Weather API, Promptkit providers, or Distributor
|
|
services. The architecture and testing policies own the detailed rules.
|
|
|
|
## Baseline Validation
|
|
|
|
Run:
|
|
|
|
```sh
|
|
go test ./...
|
|
go run ./cmd/weatherreporter --help
|
|
git diff --check
|
|
```
|
|
|
|
Use focused package tests during development and add broader or race-enabled
|
|
checks when required by the [testing policy](policy/testing.md) and the risks of
|
|
the change.
|