← back to build-pages
home: pull counts from shared bundle cache + show fleet totals (projects/commits/ideas)
822388fc450fa59338d1fa92bd32233027a4d5f3 · 2026-05-13 13:08:58 -0700 · SteveStudio2
Files touched
Diff
commit 822388fc450fa59338d1fa92bd32233027a4d5f3
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Wed May 13 13:08:58 2026 -0700
home: pull counts from shared bundle cache + show fleet totals (projects/commits/ideas)
---
server.js | 46 ++++++++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/server.js b/server.js
index 9b59f67..5de7c65 100644
--- a/server.js
+++ b/server.js
@@ -241,26 +241,32 @@ app.get('/api/version', (_req, res) => {
});
});
-// Index — all projects.
-app.get('/', (_req, res) => {
- const rows = Object.entries(PROJECTS).map(([slug, p]) => {
- let count = 0, latest = '';
- try {
- const out = require('child_process').execSync('git rev-list --count HEAD', { cwd: p.repo }).toString().trim();
- count = parseInt(out, 10);
- latest = require('child_process').execSync('git log -1 --pretty=%ai', { cwd: p.repo }).toString().trim();
- } catch (_) {}
- return `<li class="bp-card">
- <a href="/p/${esc(slug)}"><h2>${esc(p.name)}</h2></a>
- <p>${esc(p.blurb)}</p>
- <p class="bp-meta">${count} commits · latest ${esc(latest.slice(0, 10))}</p>
- </li>`;
- }).join('\n');
- res.send(shell('build-pages — all projects', `
- <h1>build journals</h1>
- <p class="bp-lede">Every build, every commit, every line. Click into a project to see how it actually got made.</p>
- <ul class="bp-cards">${rows}</ul>
- `));
+// Index — all projects. Pulls counts from the per-repo bundle cache (shared
+// with /p/:slug), so a warm index hit is one HEAD-probe per repo, not a full
+// git rev-list scan each.
+app.get('/', async (_req, res, next) => {
+ try {
+ const entries = await Promise.all(Object.entries(PROJECTS).map(async ([slug, p]) => {
+ const bundle = await getProjectBundle(slug, p).catch(() => null);
+ const count = bundle ? bundle.commits.length : 0;
+ const latest = bundle && bundle.commits[0] ? bundle.commits[0].dateISO.slice(0, 10) : '';
+ const ideas = bundle ? bundle.facets.ideas.length : 0;
+ return { slug, p, count, latest, ideas };
+ }));
+ const totalCommits = entries.reduce((a, e) => a + e.count, 0);
+ const totalIdeas = entries.reduce((a, e) => a + e.ideas, 0);
+ const rows = entries.map(({ slug, p, count, latest, ideas }) => `<li class="bp-card">
+ <a href="/p/${esc(slug)}"><h2>${esc(p.name)}</h2></a>
+ <p>${esc(p.blurb)}</p>
+ <p class="bp-meta">${count} commits · ${ideas} ideas · latest ${esc(latest)}</p>
+ </li>`).join('\n');
+ res.send(shell('build-pages — all projects', `
+ <h1>build journals</h1>
+ <p class="bp-lede">Every build, every commit, every line. Click into a project to see how it actually got made.</p>
+ <p class="bp-meta">${entries.length} projects · ${totalCommits} commits · ${totalIdeas} design-rationale ideas surfaced</p>
+ <ul class="bp-cards">${rows}</ul>
+ `));
+ } catch (e) { next(e); }
});
// Project page — commits + facets + search + file tree.
← 5273463 api: /api/projects/:slug detail endpoint (commit count, top
·
back to build-pages
·
smoke: assert home renders fleet totals line e8ee572 →