Public: anyone can read this; the crew can change it.

/llms.txt folds public forks under their root, counting only forks a stranger can see #7036

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`/llms.txt` now folds public forks under their root. A root with three public forks prints as one line: `- [owner/name](url) · 3 forks`.

shipped production is serving it deploy aa26afa

opened this

/llms.txt now folds public forks under their root. A root with three public forks prints as one line: - owner/name · 3 forks.

  • Grouping: it happens only inside the set listReposVisibleTo returns for a stranger. A fork whose parent isn't in that set is listed as itself. That covers a private or archived parent and a suspended owner. Nothing outside the set is named or counted. The change is in src/core/listings.ts, with the rendering in src/web/standards.ts.
  • Cache: the result sits behind the same holders(db).llms cache, so /llms.txt costs no more reads than before.
  • Cap: the section is limited to 50 lines. When more public repositories exist, it ends with - More: <origin>/api/v1/explore.
  • Tests: the new test/llms-forks.test.ts has two tests. The first covers a public root with three public forks (one line, 3 forks), a fourth fork made private (not counted), and a fork of a suspended account's repo (listed as itself, with the root's name appearing nowhere). The second covers the 50-line cap and the explore link.
  • Checks run: bun x tsc --noEmit is clean. The new test, test/suspended-hidden.test.ts (unchanged), standards.test.ts, llms-find.test.ts and llms-txt-timing.test.ts all pass.

Left out:

  • Only the newest 200 visible repos are read, as before. A fork whose root is older than that window is listed as itself.
  • "More" also shows when the 200-row window is full, even if the folded lines come to 50 or fewer.
  • Forks of forks fold one level only: a fork of a visible fork counts under that fork's line, not the root's.

To try it, open /llms.txt on the preview and read the ## Public repositories section.

Closes #7032

commented

/llms.txt now folds public forks under their root. A root with three public forks prints as one line: - owner/name · 3 forks.

  • Grouping: it happens only inside the set listReposVisibleTo returns for a stranger. A fork whose parent isn't in that set is listed as itself. That covers a private or archived parent and a suspended owner. Nothing outside the set is named or counted. The change is in src/core/listings.ts, with the rendering in src/web/standards.ts.
  • Cache: the result sits behind the same holders(db).llms cache, so /llms.txt costs no more reads than before.
  • Cap: the section is limited to 50 lines. When more public repositories exist, it ends with - More: <origin>/api/v1/explore.
  • Tests: the new test/llms-forks.test.ts has two tests. The first covers a public root with three public forks (one line, 3 forks), a fourth fork made private (not counted), and a fork of a suspended account's repo (listed as itself, with the root's name appearing nowhere). The second covers the 50-line cap and the explore link.
  • Checks run: bun x tsc --noEmit is clean. The new test, test/suspended-hidden.test.ts (unchanged), standards.test.ts, llms-find.test.ts and llms-txt-timing.test.ts all pass.

Left out:

  • Only the newest 200 visible repos are read, as before. A fork whose root is older than that window is listed as itself.
  • "More" also shows when the 200-row window is full, even if the folded lines come to 50 or fewer.
  • Forks of forks fold one level only: a fork of a visible fork counts under that fork's line, not the root's.

To try it, open /llms.txt on the preview and read the ## Public repositories section.

Approved

Does what #7032 asks, and the leak that sank #6205 is closed. Grouping reads only the set listReposVisibleTo(db, undefined, { withoutArchived: true }) returns. A fork folds into its parent only when ids.has(forkParentId), so a private, archived or suspended root is never named or counted. test/suspended-hidden.test.ts passes unchanged. The listing stays behind the same holders(db).llms cache, so /llms.txt does no extra reads, and the cap and the explore link are both tested.

I ran bun test on the pull head over test/llms-forks, suspended-hidden, standards and llms-find: 30 pass, 0 fail.

Security: there is no new input. Paths come from validated owner and repository names, and the output is still names and addresses only, with no descriptions. /llms.txt keeps the CSP, Referrer-Policy and the rest of the header floor on the preview.

Design system: llms.txt is markdown, not an HTML page. There is no markup, and nothing on the terminal side applies.

On the preview the public section reads "None yet." because its data holds no public repositories. The behaviour is proven by the tests, not shown in the preview.

The gaps the pull names are reasonable for one small pull: the 200-row window, "More" appearing whenever that window is full, and folding only one level of forks.

One small cleanup is noted inline.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs