Skip to content

Commit 045c435

Browse files
chore(metrics): use cumulative totals in snapshots, deltas for tweets (#19)
- Metrics JSON now stores cumulative totals (loc, files, prs, commits) with delta fields for daily change - Tweet drafter uses delta fields for progress tweets - cloc now includes supabase/migrations/ - Migrated 2026-04-14.json to new schema Co-authored-by: Ona <no-reply@ona.com>
1 parent 487bb34 commit 045c435

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

.ona/automations/daily-metrics.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ action:
1818
1919
## Data Collection (on latest main)
2020
21-
1. Lines of code: run `npx cloc src/ --json`. Extract total and by-language.
21+
1. Lines of code: run `npx cloc src/ supabase/migrations/ --json`. Extract total and by-language.
2222
2. File count: count files in src/ excluding node_modules, .next, test files.
2323
3. PRs today: use gh pr list to count opened and merged today, and currently open.
2424
4. Test coverage: run `pnpm test -- --coverage --reporter=json` and extract percentage.
@@ -34,17 +34,32 @@ action:
3434
Create `metrics/daily/YYYY-MM-DD.json`:
3535
{
3636
"date": "YYYY-MM-DD",
37+
"day_number": N,
3738
"loc": { "total": N, "delta": N, "by_language": { "TypeScript": N } },
3839
"files": { "total": N, "delta": N },
39-
"prs": { "opened_today": N, "merged_today": N, "currently_open": N },
40-
"commits_today": N,
40+
"prs": { "total": N, "delta": N, "currently_open": N },
41+
"commits": { "total": N, "delta": N },
4142
"test_coverage_pct": N,
4243
"ci_pass_rate_pct": N,
4344
"issues": { "backlog": N, "in_progress": N, "in_review": N, "done": N },
4445
"human_minutes": null,
4546
"agent_minutes": null
4647
}
4748
49+
Day 1 was 2026-04-13. Calculate day_number from that.
50+
51+
All top-level numeric fields are CUMULATIVE TOTALS, not daily counts:
52+
- loc.total: total lines of code in src/ right now
53+
- files.total: total files in src/ right now
54+
- prs.total: total PRs merged since project start (gh pr list --state merged --json mergedAt | count all)
55+
- commits.total: total commits on main (git rev-list --count HEAD)
56+
57+
The "delta" field is today's change vs yesterday's total:
58+
- loc.delta = loc.total - yesterday's loc.total
59+
- files.delta = files.total - yesterday's files.total
60+
- prs.delta = PRs merged today only
61+
- commits.delta = commits made today only
62+
4863
For delta fields, read yesterday's file from metrics/daily/. If none exists, delta = total.
4964
human_minutes and agent_minutes are null — filled manually.
5065

.ona/automations/tweet-drafter.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ action:
5050
5. Read previous tweets from metrics/daily/ (most recent *-tweet.md files) to avoid
5151
repeating the same phrasing or stats.
5252
53+
## Metrics usage in tweets
54+
55+
The metrics JSON contains both cumulative totals and daily deltas.
56+
In tweets, use the DAILY DELTA numbers (the "delta" fields) for progress updates:
57+
- prs.delta for "N PRs merged today"
58+
- commits.delta for "N commits today"
59+
- loc.delta for "N lines added today"
60+
61+
You may reference totals for milestone-style tweets (e.g., "500 total LOC"),
62+
but day-to-day progress tweets should use deltas.
63+
5364
## Day counting
5465
5566
Day 1 was 2026-04-13 (project setup). Calculate the current day number from that.

metrics/daily/2026-04-14.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"date": "2026-04-14",
3+
"day_number": 2,
34
"loc": { "total": 217, "delta": 217, "by_language": { "TypeScript": 212, "CSS": 5 } },
45
"files": { "total": 15, "delta": 15 },
5-
"prs": { "opened_today": 14, "merged_today": 14, "currently_open": 0 },
6-
"commits_today": 37,
6+
"prs": { "total": 14, "delta": 14, "currently_open": 0 },
7+
"commits": { "total": 37, "delta": 37 },
78
"test_coverage_pct": null,
89
"ci_pass_rate_pct": 100,
910
"issues": { "backlog": 0, "in_progress": 0, "in_review": 0, "done": 0 },

0 commit comments

Comments
 (0)