Add landing page + Starlight docs site (#375)

* udpated matrix

* feat(site): add landing page + Starlight docs site

Astro + Starlight site in site/ — a flat/paper editorial landing page
plus 18 docs pages seeded from the README. Monochrome theme, hairline
rules, square corners, live GitHub star count, light default + dark
toggle. Deploys to GitHub Pages via .github/workflows/deploy-site.yml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-05-24 13:21:25 -05:00
committed by GitHub
co-authored by Claude Opus 4.7
parent 1f3625a3e9
commit 4509b45dd5
34 changed files with 8032 additions and 67 deletions
+42
View File
@@ -0,0 +1,42 @@
/**
* Build-time GitHub star count. Fetched once when the site is built (the GitHub
* Actions runner has network); falls back to a constant locally / offline so a
* build never hangs or fails on the network. The result is memoized for the
* lifetime of the build process, so rendering it on every page is a single API
* call, not one per page.
*/
function format(n: number): string {
if (n >= 1000) {
const k = n / 1000;
const rounded = k >= 10 ? Math.round(k) : Math.round(k * 10) / 10;
return `${String(rounded).replace(/\.0$/, '')}k`;
}
return String(n);
}
async function fetchStars(fallback: string): Promise<string> {
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 3000);
const res = await fetch('https://api.github.com/repos/colbymchenry/codegraph', {
headers: {
Accept: 'application/vnd.github+json',
'User-Agent': 'codegraph-site',
},
signal: controller.signal,
});
clearTimeout(timeout);
if (!res.ok) return fallback;
const data = (await res.json()) as { stargazers_count?: number };
return typeof data.stargazers_count === 'number' ? format(data.stargazers_count) : fallback;
} catch {
return fallback;
}
}
let cached: Promise<string> | null = null;
export function getStarsLabel(fallback = '22k'): Promise<string> {
cached ??= fetchStars(fallback);
return cached;
}