Phase 4 part 6: the dashboard, CSV exports and an open metrics page

The MRR page adds churn, CLV, CAC and CLV:CAC. Eight tables download as
CSV (MRR, NRR and revenue cohorts, CAC by month and channel, spend,
products, customers). Metrics → Publish builds an open metrics page from
chosen totals only (never a customer) and opens a pull request that adds
or updates it on the site, checked with a Hugo build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 13:28:50 -07:00
co-authored by Claude Opus 5.5
parent 23f765159f
commit 152c14b580
18 changed files with 637 additions and 5 deletions
+17
View File
@@ -534,3 +534,20 @@ func BuiltFile(outDir, rel string) (string, error) {
raw, err := os.ReadFile(filepath.Join(outDir, rel))
return string(raw), err
}
// UpsertPage writes a content file, or, if it exists, replaces its body and
// sets the given front matter fields.
func (r *Repo) UpsertPage(rel string, fields []Field, body string) error {
if !r.Exists(rel) {
return r.NewPage(rel, fields, body)
}
if err := r.ReplaceBody(rel, body); err != nil {
return err
}
for _, f := range fields {
if err := r.SetFrontMatter(rel, f.Key, f.Value); err != nil {
return err
}
}
return nil
}