brief

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package brief computes the morning "what to fix" digest: the pulse (last N days vs the N before), the per-product portfolio split, and the verdict engine's findings. One struct feeds the CLI text, JSON, webhook, and the cloud's email renderings, so they can never disagree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(b Brief) string

Format renders the digest as plain text — no ANSI, short lines — so it reads the same in a terminal, an email body, or a Slack message.

Types

type Brief

type Brief struct {
	GeneratedAt   time.Time         `json:"generated_at"`
	Days          int               `json:"days"`
	Visitors      int               `json:"visitors"`
	Events        int               `json:"events"`
	PriorVisitors int               `json:"prior_visitors"`
	PriorEvents   int               `json:"prior_events"`
	Sites         []SiteLine        `json:"sites,omitempty"`
	Findings      []insight.Finding `json:"findings"`
}

Brief is the computed digest.

func Build

func Build(evs []event.Event, days int, now time.Time) Brief

Build computes the pulse windows ([now-N, now) vs [now-2N, now-N)) and runs the verdict engine. The findings see the FULL history — same as the dashboard — so week-over-week and retention reads stay correct even when days narrows the pulse.

type SiteLine

type SiteLine struct {
	Site          string `json:"site"`
	Visitors      int    `json:"visitors"`
	Events        int    `json:"events"`
	PriorVisitors int    `json:"prior_visitors"`
	PriorEvents   int    `json:"prior_events"`
}

SiteLine is one product's slice of the pulse. The SDK stamps every event's `site` (hostname) — the same key the dashboard's site selector filters on — so one instance carrying several products splits cleanly per site.

Jump to

Keyboard shortcuts

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