Add screenshot capture tool and dev setup docs

This commit is contained in:
Ian Gulliver
2026-08-15 13:16:05 -07:00
parent 80b274c544
commit 20c89a61d9
8 changed files with 117 additions and 1 deletions
+3
View File
@@ -1,5 +1,7 @@
# Local development
Toolchain prerequisites: see [setup.md](setup.md).
## Run
go run .
@@ -16,3 +18,4 @@ The server reads local data from `sampledata/`, mirroring the production Sheets
- `internal/data` — data source interface and the CSV sample-data implementation
- `internal/directory` — directory app handlers
- `web/directory` — directory app page templates and static assets
- `tools/screenshot` — dev-site page capture, see [screenshots.md](screenshots.md)
+1 -1
View File
@@ -19,7 +19,7 @@
- One command starts the local server.
- Templates, static assets, and content reload on change without restarting the server.
- A local data mode serves generated, non-production sample data so contributors never need real community data to develop or test.
- A documented screenshot mechanism captures pages from the local dev server, so agents (and humans) can verify visual changes. See `docs/screenshots.md` once it exists.
- A documented screenshot mechanism captures pages from the local dev server, so agents (and humans) can verify visual changes. See `docs/screenshots.md`.
## Directory app
+27
View File
@@ -0,0 +1,27 @@
# Screenshots
`tools/screenshot` captures pages from the local dev server as PNGs, so humans and agents can verify visual changes. It drives a locally installed Chrome (or Chromium) headless via chromedp; no other browser tooling is required.
## Usage
With the server running:
go run ./tools/screenshot -url http://localhost:8080/directory/ -out screenshots/directory.png -wait header
Flags:
- `-url` — page to capture (default `http://localhost:8080/directory/`)
- `-out` — output PNG path (default `screenshots/capture.png`); `screenshots/` is gitignored
- `-wait` — CSS selector that must be visible before capture (default `body`); pass a selector the page's JavaScript renders (for example `.card`) to capture after data loads
The capture is a full-page screenshot at a 1280×800 viewport.
## Agent recipe
One self-contained command that starts the server, captures, and shuts down:
go run . &
go run ./tools/screenshot -out screenshots/directory.png -wait header
kill $(lsof -ti :8080)
Then read `screenshots/directory.png` to inspect the result.
+11
View File
@@ -0,0 +1,11 @@
# Dev environment setup
Development happens on macOS. Two Homebrew installs, and everything in `docs/dev.md` and `docs/screenshots.md` works:
brew install go
brew install --cask google-chrome
- **Go** 1.26 or later — builds and runs the server and all tooling (`go run`, `go vet`).
- **Google Chrome** — launched headless by the screenshot tool; never needs to be opened by hand. The tool finds it in its standard install location automatically.
No Node, no Docker, and no cloud credentials are needed for local development.