Skip to content

Commit 0b107ad

Browse files
hsnice16claude
andcommitted
chore: add file-length pre-commit hook; sync docs; normalize Codex naming
Add a file-length lefthook pre-commit that blocks staged .ts/.tsx over 300 lines under app/, components/, or lib/. scripts/ is exempt (seed data lists). Sync AGENTS.md, README.md, and CONTRIBUTING.md with the 4-job hook, the 155-repo seed count, the new components in the Layout tree, and the file-length convention. Normalize 'Codex' -> 'GPT-5 Codex' in AGENTS.md line 3 and the 0.1.0 changelog bullet to match the UI, which has always used the full name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6f9155b commit 0b107ad

5 files changed

Lines changed: 18 additions & 10 deletions

File tree

AGENTS.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AGENTS.md
22

3-
Instructions for AI coding agents (Claude Code, Cursor, Codex, Devin, etc.) working on this repo.
3+
Instructions for AI coding agents (Claude Code, Cursor, Devin, GPT-5 Codex, etc.) working on this repo.
44

55
> `CLAUDE.md` is a one-line pointer to this file. AGENTS.md is the cross-agent standard; keeping one source of truth avoids drift.
66
>
@@ -27,9 +27,9 @@ See `README.md` for the full product narrative. See `tasks/` for per-version wor
2727

2828
```bash
2929
bun install
30-
bun run prepare-hooks # once — installs lefthook git hooks (Biome + tsc + test on pre-commit)
30+
bun run prepare-hooks # once — installs lefthook git hooks (Biome + tsc + test + file-length on pre-commit)
3131
bun run init-db # optional — auto-runs on first score
32-
bun run seed # score the curated set (124 repos) across GH / GL / BB
32+
bun run seed # score the curated set (155 repos) across GH / GL / BB
3333
bun run dev # http://localhost:3000
3434
bun run score <url> # score a single repo
3535
bun run test # unit tests (node --test + tsx) — requires Node ≥20.9.0
@@ -55,6 +55,7 @@ components/ # Tailwind-styled React components
5555
HostPill.tsx, HostSelect.tsx, Medal.tsx, ModelPills.tsx,
5656
MobileNav.tsx, Pagination.tsx, SearchBar.tsx, SelectMenu.tsx, SortSelect.tsx,
5757
SignalRow.tsx, SuggestionItem.tsx, VersionPill.tsx,
58+
RepoHero.tsx, SignalListCard.tsx, ModelSuggestions.tsx, PerModelScores.tsx,
5859
BackToTop.tsx, GoogleAnalytics.tsx
5960
lib/
6061
constants/
@@ -75,7 +76,7 @@ lib/
7576
changelog.ts # typed ChangelogEntry[]
7677
roadmap.ts # typed RoadmapVersion[]
7778
scripts/
78-
init-db.ts, score.ts, seed.ts
79+
init-db.ts, score.ts, seed.ts, seed-list.ts
7980
tests/
8081
_helpers.ts # makeFixture / removeFixture build synthetic trees under os.tmpdir()
8182
format.test.ts # compactStars, relativeTime, hostLabel
@@ -120,6 +121,7 @@ Keep it that way when adding features. If a component needs data, fetch in the p
120121
- **Brand on UI**: "Agent Friendly Code" (no hyphen). Repo/package slug + GitHub `User-Agent` string: `agent-friendly-code`.
121122
- **Version**: `APP_VERSION` in `lib/version.ts` and `package.json`'s `version` carry the current release number. Bump both (and add a new bucket in `lib/changelog.ts`) only when cutting a release — never when merging intermediate work.
122123
- **Versioning + changelog**: bumps on `lib/version.ts` + `package.json` `version` happen only on a real release, coordinated with a new bucket in `lib/changelog.ts`. The changelog is a **user-facing capability log** — every bullet describes something a dashboard visitor or API caller can see, click, or call. Codebase hygiene (CI, linters, pre-commit, tests), pure internal refactors, dep bumps, and contributor-facing docs (CONTRIBUTING, PR templates) do **not** earn a changelog line — they stay in `tasks/` and the PR description. When a roadmap item ships, remove it from `lib/roadmap.ts` in the same PR — moved, not duplicated.
124+
- **File length**: `.ts` / `.tsx` under `app/`, `components/`, `lib/` stay ≤ 300 lines — enforced by the `file-length` pre-commit job in `lefthook.yml`. Near the cap, split into subcomponents or extract helpers to `lib/utils/`. `scripts/` is exempt (seed data lists).
123125

124126
## Adding a signal
125127

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Read [AGENTS.md](./AGENTS.md) first — it's the source of truth for stack, conv
88

99
```bash
1010
bun install
11-
bun run prepare-hooks # once — installs lefthook pre-commit (Biome + tsc + test)
12-
bun run seed # optional: populate the DB with the curated set (124 public repos)
11+
bun run prepare-hooks # once — installs lefthook pre-commit (Biome + tsc + test + file-length)
12+
bun run seed # optional: populate the DB with the curated set (155 public repos)
1313
bun run dev # http://localhost:3000
1414
bun run test # unit tests (node --test + tsx) — requires Node ≥20.9.0
1515
```
@@ -41,11 +41,12 @@ Don't squash-amend published commits. Don't skip hooks (`--no-verify`); if a hoo
4141

4242
## Pre-commit hook
4343

44-
`lefthook` runs three jobs on every commit:
44+
`lefthook` runs four jobs on every commit:
4545

4646
1. **Biome**`check --write` on staged JS/TS/JSON/CSS. Fixes and re-stages.
4747
2. **tsc**`--noEmit` on `*.{ts,tsx}`. Blocks commits that don't typecheck.
4848
3. **test**`bun run test` when any `*.{ts,tsx}` file is staged. Runs the full `node --test` suite (~1–2 s); blocks on regressions.
49+
4. **file-length** — blocks staged `.ts`/`.tsx` under `app/`, `components/`, `lib/` that exceed 300 lines. Split into subcomponents or pull helpers into `lib/utils/`. `scripts/` is exempt.
4950

5051
Run `bun run prepare-hooks` once after cloning. CI (`.github/workflows/`) runs the same checks on PR for belt-and-braces.
5152

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ Auth and per-maintainer controls land with the opt-out / claim flow in v0.4.0.
8888

8989
```bash
9090
bun install
91-
bun run prepare-hooks # once — installs lefthook pre-commit (Biome + tsc + test)
92-
bun run seed # score the curated set (124 repos) across GH / GL / BB
91+
bun run prepare-hooks # once — installs lefthook pre-commit (Biome + tsc + test + file-length)
92+
bun run seed # score the curated set (155 repos) across GH / GL / BB
9393
bun run dev # http://localhost:3000
9494
```
9595

lefthook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ pre-commit:
1717
- name: test
1818
glob: "*.{ts,tsx}"
1919
run: bun run test
20+
21+
- name: file-length
22+
glob: "{app,components,lib}/**/*.{ts,tsx}"
23+
run: |
24+
wc -l {staged_files} | awk '$2 != "total" && $1 > 300 { printf "✗ %s: %d lines (cap: 300)\n", $2, $1; bad=1 } END { exit bad+0 }'

lib/changelog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const CHANGELOG: ChangelogEntry[] = [
3838
title: "First public release",
3939
highlights: [
4040
"Public leaderboard ranking open-source repos by agent-friendliness across GitHub, GitLab, and Bitbucket.",
41-
"Per-model scoring — separate ranking for Claude Code, Cursor, Devin, and Codex, each with its own signal weights.",
41+
"Per-model scoring — separate ranking for Claude Code, Cursor, Devin, and GPT-5 Codex, each with its own signal weights.",
4242
"Repo detail page — score breakdown per signal and the top improvements ranked by score-gain for the selected model.",
4343
"Methodology page explaining what's measured today and what isn't.",
4444
"Leaderboard controls — live search, host filter (GitHub / GitLab / Bitbucket), rank + stars sort, paginated results.",

0 commit comments

Comments
 (0)