Skip to content

Commit 454b323

Browse files
committed
Update dev tooling and CI workflows
1 parent 0e9a407 commit 454b323

8 files changed

Lines changed: 2560 additions & 798 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
- name: Run typecheck
5454
run: npm run typecheck
5555

56+
- name: Audit responsive diagrams
57+
run: npm run audit:responsive-diagrams
58+
5659
- name: Refresh GitHub star counts
5760
# Unauthenticated (60 req/hr/IP). The fetcher merges per repo and keeps
5861
# the committed snapshot on failure, so a rate-limited deploy still

‎.github/workflows/pr.yml‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: PR checks
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: "pr-${{ github.event.pull_request.number }}"
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
# Fast gate (no browser-contract suite — that stays on deploy); bounded so
19+
# a hang fails fast instead of sitting out the platform default.
20+
timeout-minutes: 15
21+
defaults:
22+
run:
23+
working-directory: ./website
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 24
32+
cache: npm
33+
cache-dependency-path: ./website/package-lock.json
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Run tests
39+
run: npm test
40+
41+
- name: Run typecheck
42+
run: npm run typecheck
43+
44+
- name: Audit responsive diagrams
45+
run: npm run audit:responsive-diagrams

‎scripts/audit-responsive-diagrams.cjs‎

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,29 @@ const fs = require('node:fs');
22
const path = require('node:path');
33

44
const root = path.resolve(__dirname, '..', 'website', 'src', 'components', 'VisualElements');
5-
const names = [
6-
'AgentWorkStabilityDiagram',
7-
'ContextMechanismMap',
8-
'ContextWindowAnatomyDiagram',
9-
'ErrorReasonComparisonDiagram',
10-
'ExecutionPortfolioDiagram',
11-
'GroundingDistillationDiagram',
12-
'HarnessContextLoop',
13-
'HarnessDeltaExplorer',
14-
'HarnessLoopDiagram',
15-
'InstructionLayerAuthority',
16-
'InteractiveHarnessWorkbench',
17-
'LivingContextWindowStream',
18-
'LocalChoicesGlobalCoherenceDiagram',
19-
'LongContextBenchmarkExplorer',
20-
'ModelEncodingAtlas',
21-
'OperatorCycleDiagram',
22-
'OwnershipBoundaryDiagram',
23-
'PlanningContractCheckpointDiagram',
24-
'PostTrainingTuningBoard',
25-
'ProbabilityIsNotLogicDiagram',
26-
'SpecExecutionRunsDiagram',
27-
'SpeedAccuracyTradeoff',
28-
'StructuredControlPlaneWorkbench',
29-
'SubAgentFanoutDiagram',
30-
'TokenPredictionDiagram',
31-
'UShapeAttentionCurve',
32-
'ValidationClaimBenchDiagram',
33-
'ValidationEvidenceLifecycle',
34-
];
5+
6+
// Self-maintaining: any component that opts into ResponsiveDiagram joins the
7+
// audit, so a new paired diagram can never ship unlisted.
8+
const names = fs
9+
.readdirSync(root, { withFileTypes: true })
10+
.filter((entry) => entry.isFile() && entry.name.endsWith('.tsx'))
11+
.map((entry) => entry.name.replace(/\.tsx$/, ''))
12+
.filter((name) => name !== 'ResponsiveDiagram')
13+
.filter((name) =>
14+
fs.readFileSync(path.join(root, `${name}.tsx`), 'utf8').includes('ResponsiveDiagram')
15+
);
16+
3517
const variantSelector =
3618
/\.(?:desktopDiagram|mobileDiagram|desktop|mobile|operatorDesktop|operatorMobile|validationDesktop|validationMobile|desktopChart|mobileChart)\b/;
3719
const failures = [];
3820

3921
for (const name of names) {
40-
const tsxPath = path.join(root, `${name}.tsx`);
4122
const cssPath = path.join(root, `${name}.module.css`);
42-
const tsx = fs.readFileSync(tsxPath, 'utf8');
43-
const css = fs.readFileSync(cssPath, 'utf8');
44-
45-
if (!tsx.includes('ResponsiveDiagram')) {
46-
failures.push(`${name}: paired diagram does not use ResponsiveDiagram`);
23+
if (!fs.existsSync(cssPath)) {
24+
failures.push(`${name}: missing paired stylesheet ${name}.module.css`);
25+
continue;
4726
}
27+
const css = fs.readFileSync(cssPath, 'utf8');
4828

4929
for (const match of css.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
5030
const selector = match[1];
@@ -76,4 +56,5 @@ if (failures.length) {
7656
process.exitCode = 1;
7757
} else {
7858
console.log(`responsive diagram audit passed (${names.length} paired diagrams)`);
59+
console.log(names.map((name) => `- ${name}`).join('\n'));
7960
}

‎scripts/fetch-github-stars.js‎

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const SNAPSHOT_PATH = fileURLToPath(
1818
new URL('../website/src/generated/github-stars.json', import.meta.url)
1919
);
2020

21+
const INTRO_MDX_PATH = fileURLToPath(
22+
new URL('../website/docs/intro.mdx', import.meta.url)
23+
);
24+
2125
async function readSnapshot() {
2226
try {
2327
return JSON.parse(await readFile(SNAPSHOT_PATH, 'utf8'));
@@ -42,17 +46,22 @@ async function fetchStars(repo) {
4246
}
4347
}
4448

45-
// Per-repo merge: a failed repo keeps its previous entry — including its own
46-
// fetchedAt — so a timestamp always describes the number it sits next to. An
47-
// unchanged count is also left as-is, so a no-op refresh dirties nothing.
49+
// Per-repo merge. Two independent concerns:
50+
// - stars/fetchedAt are fetched data: a failed fetch keeps the prior pair, so
51+
// a timestamp always describes the number it sits next to;
52+
// - name is not fetched — it comes from PROJECTS — so a rename applies even
53+
// when the network is down.
54+
// A fully unchanged entry is returned as-is, so a no-op refresh dirties nothing.
4855
function mergeProjects(previous, results) {
4956
const previousByRepo = new Map(previous.map((project) => [project.repo, project]));
5057
return results.flatMap(({ repo, stars }) => {
5158
const prior = previousByRepo.get(repo);
52-
if (stars === null) return prior ? [prior] : [];
53-
if (prior && prior.stars === stars) return [prior];
5459
const { name } = PROJECTS.find((project) => project.repo === repo);
55-
return [{ name, repo, stars, fetchedAt: new Date().toISOString() }];
60+
if (stars === null) return prior ? [{ ...prior, name }] : [];
61+
if (prior && prior.stars === stars && prior.name === name) return [prior];
62+
const fetchedAt =
63+
prior && prior.stars === stars ? prior.fetchedAt : new Date().toISOString();
64+
return [{ name, repo, stars, fetchedAt }];
5665
});
5766
}
5867

@@ -62,14 +71,32 @@ function serialize(projects) {
6271
return `${JSON.stringify({ projects }, null, 2)}\n`;
6372
}
6473

74+
// PROJECTS is the fetcher's source of truth, but the homepage renders its own
75+
// list from intro.mdx. A slug the page references but the snapshot lacks throws
76+
// at render time, so name it here instead of reporting a misleading "unchanged".
77+
async function warnMissingIntroRepos(projects) {
78+
const known = new Set(projects.map((project) => project.repo));
79+
for (const [, repo] of (await readFile(INTRO_MDX_PATH, 'utf8')).matchAll(
80+
/repo="([^"]+)"/g
81+
)) {
82+
if (!known.has(repo))
83+
console.warn(
84+
`[stars] ${repo}: referenced in intro.mdx but absent from PROJECTS (scripts/github-stars.js)`
85+
);
86+
}
87+
}
88+
6589
async function main() {
6690
const { projects: previous = [] } = await readSnapshot();
6791
const results = await Promise.all(PROJECTS.map(({ repo }) => fetchStars(repo)));
6892
for (const { repo, reason } of results.filter(({ stars }) => stars === null)) {
6993
console.warn(`[stars] ${repo}: ${reason} — keeping last known value`);
7094
}
7195

72-
const next = serialize(mergeProjects(previous, results));
96+
const merged = mergeProjects(previous, results);
97+
await warnMissingIntroRepos(merged);
98+
99+
const next = serialize(merged);
73100
if (next === serialize(previous)) {
74101
console.log('[stars] snapshot unchanged');
75102
return;

‎scripts/github-stars.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
export const PROJECTS = [
99
{ name: 'Book source', repo: 'agenticoding/agenticoding.github.io' },
1010
{ name: 'ChunkHound', repo: 'chunkhound/chunkhound' },
11-
{ name: 'Pi agenticoding extension', repo: 'agenticoding/pi-agenticoding' },
11+
{ name: 'Pi Schematic', repo: 'chunkhound/pi-schematic' },
1212
];
1313

1414
// A star count is trustworthy only as a non-negative safe integer; the /repos

0 commit comments

Comments
 (0)