releaseemail

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package releaseemail renders the release-notes email (card 43, card 73): the Markdown an agent drafted and the gate approved, laid out as the HTML an inbox shows. The Markdown is a small, fixed subset — the shape `.claude/agents/release-notes-email.md` asks the writer for — and anything outside it is refused with its line number rather than guessed at, so the lint can hand the finding back to the writer's fix cycle.

The package is DEV-ONLY: cmd/brigade-release-email links it; bin/brigade never does. It has no dependency outside the standard library on purpose (`make deps-check` guards the shipped binary, and a Markdown library would be one more module to pin for one email a week).

Index

Constants

View Source
const (
	// ImageWidth is the width every picture has, in pixels: twice the 520 px column the email shows it in, so
	// it is crisp on a dense screen. `make email-picture` resamples to it.
	ImageWidth = 1040
	// ImageMinHeight and ImageMaxHeight bound the height: a strip too thin to read, or a column taller than
	// the card is wide, is not a picture of one change.
	ImageMinHeight = 200
	ImageMaxHeight = 1040
	// ImageMaxBytes bounds the file: a reader on a phone fetches every picture of the email.
	ImageMaxBytes = 300 * 1024
)

The rules of docs/email/, the pictures a release may show under a change in the email. They are written out in docs/email/README.md; this file is the half of them a program can check. The lint cannot look at a picture, so what a picture shows -- no address, no person, no secret -- stays the maker's duty.

View Source
const MaxBytes = 100 * 1024

MaxBytes is the size above which the HTML is refused: Gmail clips a message over 102 KB and shows the rest behind a "View entire message" link, footer included.

Variables

This section is empty.

Functions

func Check

func Check(src, root string) error

Check parses a DRAFT — the writer's notes.md, without the footer — and returns every finding, or nil when the draft renders. root is the checkout, where an image's file must exist.

func Render

func Render(src string, o Options) ([]byte, error)

Render renders the finished email — the draft with the footer under it — into the HTML the mail step sends. The returned error is a Findings when the Markdown is at fault.

func Run

func Run(args []string, stderr io.Writer) int

Run is the command: it renders a finished email, or with -check reads a draft and reports every finding. Diagnostics go to stderr, one finding a line; nothing goes to stdout. It returns 0 when the Markdown renders, 1 when it does not or a file cannot be read or written, 2 for a usage error.

brigade-release-email -in email.md -window window.txt -out email.html -repo owner/name -server https://github.com -commit <sha> [-date YYYY-MM-DD]
brigade-release-email -check -in notes.md [-root <checkout>]
brigade-release-email -images [-root <checkout>]

Types

type Finding

type Finding struct {
	Line int
	Msg  string
}

Finding is one thing wrong with the draft, at a line.

func (Finding) Error

func (f Finding) Error() string

type Findings

type Findings []Finding

Findings is every finding of one parse or render, so the writer's fix cycle reads them all at once.

func CheckImages

func CheckImages(root string) Findings

CheckImages reads docs/email/ and CHANGELOG.md of a checkout and returns every finding against the rules: a file is `<version>-<slug>.png`, a PNG, ImageWidth wide, between ImageMinHeight and ImageMaxHeight tall, at most ImageMaxBytes, and named by a picture line in the CHANGELOG section of its version; every picture line in the CHANGELOG has alt text and points at a file that exists, in the section its name says. A line number is the CHANGELOG's; a file's finding has none.

func (Findings) Error

func (fs Findings) Error() string

type Options

type Options struct {
	Repo   string    // owner/name
	Server string    // the GitHub server, https://github.com in production
	Commit string    // the commit the images are pinned to (GITHUB_SHA): an email never changes under its reader
	Date   time.Time // the masthead's date; zero leaves it out
	Window []string  // the tags the email covers, oldest first; a ### heading's version links to its release
	Root   string    // the checkout, where an image's file must exist; empty skips the check
}

Options drive one render.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL