[object Object]

← back to build-pages

api: /api/fleet/today — calendar-day commit slice (different from rolling-24h since=) + 2 smoke

e0c1cd739398f4d8b50c2aed193a3b3a460e9aaf · 2026-05-13 20:03:55 -0700 · SteveStudio2

Files touched

Diff

commit e0c1cd739398f4d8b50c2aed193a3b3a460e9aaf
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 20:03:55 2026 -0700

    api: /api/fleet/today — calendar-day commit slice (different from rolling-24h since=) + 2 smoke
---
 server.js     | 28 ++++++++++++++++++++++++++++
 test/smoke.js |  5 +++++
 2 files changed, 33 insertions(+)

diff --git a/server.js b/server.js
index 41070e2..1da5964 100644
--- a/server.js
+++ b/server.js
@@ -735,6 +735,33 @@ app.get('/p/:slug/c/:hash', async (req, res, next) => {
   } catch (e) { next(e); }
 });
 
+// /api/fleet/today — every commit landed on the calendar date passed via
+// ?date=YYYY-MM-DD, or today (server-local) if omitted. Different from
+// /api/recent?since=24h because it's a calendar boundary, not rolling.
+app.get('/api/fleet/today', async (req, res, next) => {
+  const dateStr = (typeof req.query.date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(req.query.date))
+    ? req.query.date
+    : new Date().toISOString().slice(0, 10);
+  const start = new Date(dateStr + 'T00:00:00');
+  const end   = new Date(start.getTime() + 86400000);
+  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) {
+        const t = new Date(c.dateISO).getTime();
+        if (t >= start.getTime() && t < end.getTime()) {
+          all.push({ slug, project: p.name, hash: c.shortHash, date: c.dateISO, author: canonAuthor(c.author), subject: c.subject });
+        }
+      }
+    }
+    all.sort((a, b) => (b.date < a.date ? -1 : b.date > a.date ? 1 : 0));
+    res.setHeader('Cache-Control', 'public, max-age=30, stale-while-revalidate=60');
+    res.json({ date: dateStr, total: all.length, results: all });
+  } 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.
@@ -1205,6 +1232,7 @@ app.get('/api', (_req, res) => {
       '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/today':                  'Calendar-day commit slice (?date=YYYY-MM-DD or today) — different from /api/recent?since=24h (rolling window)',
       '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 9ef2bf6..cbf11f4 100644
--- a/test/smoke.js
+++ b/test/smoke.js
@@ -265,6 +265,11 @@ function check(name, cond, hint = '') {
   check('fleet/all: velocity',     /"velocity":/.test(r.body));
   check('fleet/all: top_skills',   /"top_skills":\[/.test(r.body));
 
+  // 13b2a. fleet/today — calendar-day commits
+  r = await fetch('/api/fleet/today');
+  check('fleet/today: 200',        r.status === 200);
+  check('fleet/today: date field', /"date":"\d{4}-\d{2}-\d{2}"/.test(r.body));
+
   // 13b2b. fleet/longest — design-rationale essays
   r = await fetch('/api/fleet/longest?limit=5');
   check('fleet/longest: 200',      r.status === 200);

← e19ef88 home: Deepest rationale rail (top 5 commits by body length)  ·  back to build-pages  ·  api/fleet/today: default to America/Los_Angeles (Steve's tz) 1db956d →