← back to build-pages
api: /api/fleet/longest — top commits by body length (the design-rationale essays) + 2 smoke
5ffc20a64503eda2f463fee33b45676490bfd705 · 2026-05-13 19:56:54 -0700 · SteveStudio2
Files touched
M server.jsM test/smoke.js
Diff
commit 5ffc20a64503eda2f463fee33b45676490bfd705
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Wed May 13 19:56:54 2026 -0700
api: /api/fleet/longest — top commits by body length (the design-rationale essays) + 2 smoke
---
server.js | 26 ++++++++++++++++++++++++++
test/smoke.js | 5 +++++
2 files changed, 31 insertions(+)
diff --git a/server.js b/server.js
index 513bc32..a36887c 100644
--- a/server.js
+++ b/server.js
@@ -715,6 +715,31 @@ app.get('/p/:slug/c/:hash', async (req, res, next) => {
} catch (e) { next(e); }
});
+// /api/fleet/longest — commits with the largest body length across the fleet.
+// Long bodies are the "this is why we did it" essays — surfacing them as a
+// browsable list makes the design-rationale layer discoverable.
+app.get('/api/fleet/longest', async (req, res, next) => {
+ const limit = Math.min(Math.max(parseInt(req.query.limit, 10) || 20, 1), 100);
+ try {
+ const all = [];
+ for (const [slug, p] of Object.entries(PROJECTS)) {
+ const bundle = await getProjectBundle(slug, p).catch(() => null);
+ if (!bundle) continue;
+ for (const c of bundle.commits) {
+ if (c.body.length >= 200) {
+ all.push({
+ slug, project: p.name, hash: c.shortHash, date: c.dateISO.slice(0, 10),
+ subject: c.subject, body_len: c.body.length,
+ });
+ }
+ }
+ }
+ all.sort((a, b) => b.body_len - a.body_len);
+ res.setHeader('Cache-Control', 'public, max-age=60, stale-while-revalidate=120');
+ res.json({ limit, total: all.length, results: all.slice(0, limit) });
+ } catch (e) { next(e); }
+});
+
// /api/fleet/buckets — daily commit-count buckets for the last N days
// (?days=7, max 90), both per-project and fleet-wide. Useful for charting
// libraries that want raw counts rather than the ASCII sparkline. Each bucket
@@ -1159,6 +1184,7 @@ app.get('/api', (_req, res) => {
'GET /api/fleet/velocity': 'Commits-per-rolling-window across the fleet — last 24h + last 7d, with per-project breakdown',
'GET /api/fleet/authors': 'Fleet-wide author tallies (post-alias-normalization, so SteveStudio2/Steve/Steve Abrams collapse to one)',
'GET /api/fleet/buckets': 'Daily commit-count buckets for the last N days (?days=7, max 90) — fleet + per-project, with ISO date labels',
+ 'GET /api/fleet/longest': 'Top N commits by body length across the fleet (?limit=20) — the design-rationale essays',
'GET /api/fleet/all': 'One-shot dashboard aggregate — velocity + recent + top skills/agents + per-project counts',
'GET /p/:slug': 'Project journal HTML page (?q= deep-link supported)',
'GET /p/:slug/c/:hash': 'Commit detail page — full diff + body',
diff --git a/test/smoke.js b/test/smoke.js
index 64216a5..a3d0b91 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -264,6 +264,11 @@ function check(name, cond, hint = '') {
check('fleet/all: velocity', /"velocity":/.test(r.body));
check('fleet/all: top_skills', /"top_skills":\[/.test(r.body));
+ // 13b2b. fleet/longest — design-rationale essays
+ r = await fetch('/api/fleet/longest?limit=5');
+ check('fleet/longest: 200', r.status === 200);
+ check('fleet/longest: body_len', /"body_len":\d+/.test(r.body));
+
// 13b2c. fleet/buckets — daily counts for charts
r = await fetch('/api/fleet/buckets?days=7');
check('fleet/buckets: 200', r.status === 200);
← fafcc17 Makefile: add 'make stats' target — pretty-print fleet stats
·
back to build-pages
·
home: Deepest rationale rail (top 5 commits by body length) e19ef88 →