Skip to content

Commit 8d6ad2e

Browse files
hsnice16claude
andcommitted
Switch runtime from Bun to Node + tsx; swap bun:sqlite → better-sqlite3
Vercel's serverless functions run on Node, so `bun:sqlite` imports in lib/db.ts blocked deployment. Moves the codebase onto Node ≥20.9.0 as the runtime of record while keeping Bun available locally as a fast package manager (`bun install`, `bun run <script>`). Runtime + deps: - lib/db.ts now uses better-sqlite3 (12.9.0, pinned). Schema + prepared statements unchanged; only the import and construction differ. - package.json scripts invoke tsx directly (dev/build/start via next, score/seed/init-db via tsx). Added tsx@4.21.0 + @types/better-sqlite3. Scorer: - Normalise matchedPath to repo-relative via new toRelative() in scoring/scorer.ts so persisted/rendered paths never leak the scanner's absolute FS layout. Seeds: - Add two entries to scripts/seed.ts (openclaw, TwoFac) — 28 total. - seed.ts now calls `bun run score` rather than invoking the script file directly, so the script path lives in one place (package.json). Docs sync (same PR per CONTRIBUTING.md): - AGENTS.md Stack + Run-anything + Layout updated for Node/tsx/ better-sqlite3 + 28 seeds. README Stack-rationale table, Quickstart, and Layout mirror the same. CONTRIBUTING's Getting-started count bumped. tasks/0.1.0/03-ci.md and tasks/0.2.0/01-tests.md switched to `node --test`. tasks/0.2.0/02-self-score.md reflects self-seed. Contributor docs: - Add .github/PULL_REQUEST_TEMPLATE.md mirroring CONTRIBUTING's PR description spec so new PRs auto-populate. Cleanup: - Trim comments that restated the code or documented stdlib behaviour (Intl.NumberFormat, field-name JSDoc, a formula comment that duplicated its own implementation). Kept WHY comments — shallow-clone rationale, toRelative privacy note, SQL-whitelist invariant, the changelog discipline, and the pass: number; // 0..1 range constraint. Build artifact: - .gitignore permits committing data/rank.db; DB file included here as a seeded snapshot. WAL/SHM sidecars also present from local WAL-mode runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0c78c4a commit 8d6ad2e

21 files changed

Lines changed: 1803 additions & 46725 deletions

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!-- Replace the italic hints below with your content. See CONTRIBUTING.md for the full rules. -->
2+
3+
## Summary
4+
5+
_1–3 bullets. What changed, in product/capability terms — not a log of work done._
6+
7+
## Motivation
8+
9+
_Why this change. Link to the roadmap item or `tasks/<file>.md`. If it's a roadmap item, quote the task's Goal line._
10+
11+
## Changes
12+
13+
_Bulleted list of what this PR modifies. Keep it scoped to the summary._
14+
15+
## Testing
16+
17+
_How you verified this. Commands run (`bun run score <url>`, `bun x tsc --noEmit`, manual pass of specific pages). For UI changes: mobile + desktop, light + dark._
18+
19+
## Screenshots / screencasts
20+
21+
_Required for any UI change. Drag-and-drop into this description._
22+
23+
## Docs + roadmap sync
24+
25+
_Confirm one of:_
26+
27+
- _"Ships a roadmap item — removed from `lib/roadmap.ts`, added to `lib/changelog.ts` under the current release bucket."_
28+
- _"N/A — internal refactor / polish; no changelog entry."_
29+
30+
_Plus: "AGENTS.md / README.md updated if structure or conventions changed."_
31+
32+
## Risks / rollback
33+
34+
_What could break? How do we roll back? Leave blank if genuinely trivial._

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
node_modules/
22
.next/
3-
data/*.db
43
data/*.db-journal
4+
data/*.db-wal
5+
data/*.db-shm
56
tmp-clones/
67
.env
78
.env.local

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ See `README.md` for the full product narrative. See `tasks/` for per-version wor
1616

1717
- **Next.js 16** (App Router) — web UI + API routes.
1818
- **React 19** — server components by default; no client JS unless interactivity requires it.
19-
- **Bun** runtime — native TS for scripts; Next.js itself runs via `bun --bun next dev`.
19+
- **Node (≥20.9.0)** — runtime for Next.js and CLI scripts (via `tsx`). Matches Vercel's serverless runtime. Bun is supported as a faster local package manager (`bun install`) but not required.
2020
- **TypeScript** — strict mode.
2121
- **Tailwind CSS 4**`@theme` tokens in `app/globals.css`; no `tailwind.config.*` file.
2222
- **Phosphor Icons** (`@phosphor-icons/react`) — the only icon library. The `code-review` skill blocks non-Phosphor icons.
23-
- **`bun:sqlite`**built-in SQLite driver, single file at `data/rank.db`.
23+
- **`better-sqlite3`**Node-native SQLite driver, single file at `data/rank.db`. Swapped back from `bun:sqlite` because Vercel's serverless functions run on Node.
2424
- **`git` CLI** — shallow clones (`--depth 1 --single-branch`) via `node:child_process`.
2525

2626
## Run anything
@@ -29,7 +29,7 @@ See `README.md` for the full product narrative. See `tasks/` for per-version wor
2929
bun install
3030
bun run prepare-hooks # once — installs lefthook git hooks (Biome + tsc on pre-commit)
3131
bun run init-db # optional — auto-runs on first score
32-
bun run seed # score the curated set (~27 repos) across GH / GL / BB
32+
bun run seed # score the curated set (~28 repos) across GH / GL / BB
3333
bun run dev # http://localhost:3000
3434
bun run score <url> # score a single repo
3535
```
@@ -69,7 +69,7 @@ lib/
6969
scorer.ts # signals × weights, topImprovements
7070
clients/
7171
git.ts, github.ts
72-
db.ts # bun:sqlite schema + queries
72+
db.ts # better-sqlite3 schema + queries
7373
version.ts # APP_NAME, APP_VERSION, IS_PRE_RELEASE, APP_URL, APP_DESCRIPTION, REPO_URL
7474
changelog.ts # typed ChangelogEntry[]
7575
roadmap.ts # typed RoadmapVersion[]

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Read [AGENTS.md](./AGENTS.md) first — it's the source of truth for stack, conv
99
```bash
1010
bun install
1111
bun run prepare-hooks # once — installs lefthook pre-commit (Biome + tsc)
12-
bun run seed # optional: populate the DB with the curated set (~27 public repos)
12+
bun run seed # optional: populate the DB with the curated set (~28 public repos)
1313
bun run dev # http://localhost:3000
1414
```
1515

@@ -53,7 +53,7 @@ Open against `main`. Keep the branch rebased; avoid merge commits from `main` in
5353

5454
### PR description — required sections
5555

56-
Every PR description must include:
56+
New PRs auto-populate from [`.github/PULL_REQUEST_TEMPLATE.md`](./.github/PULL_REQUEST_TEMPLATE.md). The template mirrors the sections below; keep the two in sync when either changes. Every PR description must include:
5757

5858
```markdown
5959
## Summary

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
[![Release](https://img.shields.io/badge/release-0.1.0-blue?style=flat-square)](./lib/changelog.ts)
44
[![License: MIT](https://img.shields.io/badge/license-MIT-green?style=flat-square)](./LICENSE)
55
[![Next.js 16](https://img.shields.io/badge/Next.js-16-black?style=flat-square)](https://nextjs.org)
6-
[![Bun](https://img.shields.io/badge/runtime-Bun-%23000?style=flat-square)](https://bun.sh)
6+
[![Node ≥20.9](https://img.shields.io/badge/node-%E2%89%A520.9-43853d?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
77

88
**A public dashboard that ranks open-source repos by how friendly they are for AI coding agents — per model.**
99

10-
Next.js 16 + Bun + SQLite, styled with Tailwind CSS 4. Spans GitHub, GitLab, and Bitbucket out of the box. Current release: **0.1.0**.
10+
Next.js 16 + SQLite (`better-sqlite3`), styled with Tailwind CSS 4. Spans GitHub, GitLab, and Bitbucket out of the box. Current release: **0.1.0**.
1111

1212
![Agent Friendly Code — leaderboard](./public/demo/light.png)
1313

@@ -89,7 +89,7 @@ Auth and per-maintainer controls land with the opt-out / claim flow in v0.4.0.
8989
```bash
9090
bun install
9191
bun run prepare-hooks # once — installs lefthook pre-commit (Biome + tsc)
92-
bun run seed # score the curated set (~27 repos) across GH / GL / BB
92+
bun run seed # score the curated set (~28 repos) across GH / GL / BB
9393
bun run dev # http://localhost:3000
9494
```
9595

@@ -113,9 +113,9 @@ Optional: `GITHUB_TOKEN` / `GITLAB_TOKEN` in env to raise API rate limits.
113113
| Choice | Why | When we'd revisit |
114114
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
115115
| **Next.js 16 (App Router)** | Future features (filters, charts, auth, diff views) are React's territory. File-based routing + API routes replace hand-rolled HTTP cleanly. | Unlikely. The core scorer is stack-agnostic, only `app/` depends on this. |
116-
| **Bun runtime** | Native TS, built-in SQLite, fast install + cold boot. Huge npm compat. Faster than Node; better Node-compat than Deno. | If a Bun-specific incompatibility surfaces that's not worth working around. |
116+
| **Node runtime (with `tsx` for CLI scripts)** | Matches Vercel's serverless runtime — no Bun-only imports in prod. Bun still works locally as a fast package manager. | Unlikely — only if the deployment target changes. |
117117
| **Tailwind CSS 4** | Zero-config via `@theme` tokens, no `tailwind.config.*` needed. Tight bundle output. | Would only leave for something with a stronger design-system story. |
118-
| **`bun:sqlite`** | Zero deps, single file, inspectable. Avoids native-ABI drama (we tried `better-sqlite3` first and hit it). | Postgres when concurrent writers / access control arrive (`tasks/1.0.0/01-postgres-migration.md`). |
118+
| **`better-sqlite3`** | Single file, inspectable, zero ops overhead. Node-native so Vercel's serverless runtime can load it directly. | Postgres when concurrent writers / access control arrive (`tasks/1.0.0/01-postgres-migration.md`). |
119119
| **Server components + links, no client JS** | Cheap, fast, SEO-friendly. | When a feature genuinely needs interactivity — e.g. live filter combinators. |
120120
| **Shallow git clones** (`--depth 1 --single-branch`) | Bandwidth + speed. Current signals don't need history. | History-aware signals → host APIs or `--filter=blob:none` partial clones. |
121121
| **Exact-pinned deps** | Deterministic scoring across environments. | Never. |
@@ -147,14 +147,14 @@ lib/
147147
clients/ git clone, host API
148148
constants/ thresholds, host labels, sort keys
149149
utils/ format + score-tier helpers
150-
db.ts bun:sqlite schema + queries (all SQL lives here)
150+
db.ts better-sqlite3 schema + queries (all SQL lives here)
151151
version.ts APP_NAME, APP_VERSION, APP_URL, APP_DESCRIPTION, REPO_URL
152152
changelog.ts / roadmap.ts
153-
scripts/ Bun-run CLI entries — score, seed, init-db
153+
scripts/ CLI entries run via `tsx` (Node) — score, seed, init-db
154154
tasks/ Per-version task breakdown (agent-readable)
155155
public/ Static assets — demo/ screenshots used by the README + OG image
156156
.claude/ settings.json, hooks/ (Stop guard), skills/
157-
data/ SQLite database (gitignored)
157+
data/ rank.db (committed — shipped as a build artifact; rescoring runs locally)
158158
tmp-clones/ Shallow clones (gitignored)
159159
AGENTS.md Agent instructions (source of truth)
160160
CONTRIBUTING.md Human-contributor guide — PR workflow, review bar

0 commit comments

Comments
 (0)