chore: upgrade afdocs to ^0.17.1#14
Closed
SahilAujla wants to merge 1 commit intofern-api:mainfrom
Closed
Conversation
Brings in three afdocs minor versions of fixes since this repo last bumped to 0.14.0 in PR fern-api#2. The most user-visible change is that sites with both an apex llms.txt and a docs-section llms.txt now get the docs file picked as canonical (afdocs PR #54), so docs scores stop being polluted by marketing indexes. ## Code changes for v0.17.0 breaking API - `package.json`: `afdocs` `^0.14.0` → `^0.17.1` - `lib/scoring.ts`: extract a `normalizeCategoryScores()` helper that handles the new `CategoryScore.score: number | null` shape (null means the category had fewer than 5 sampleable pages so afdocs marks it `notApplicable`). Drops null categories from the flat numeric map so consumers fall back to local calculation, matching previous behavior. - `app/api/score/route.ts`, `scripts/score-single.ts`: switch the inline `Record<string, CategoryScore>` → `Record<string, number>` conversion to use the new helper. `score-single.ts` also picks up a small pre-existing fix: `computeScore()` now requires `specUrl` on its input, which the script wasn't passing (was uncaught because `scripts/` is excluded from the project tsconfig). ## Check ID renames (v0.17.0) `afdocs` v0.17.0 split `llms-txt-directive` into `llms-txt-directive-html` (High/7 weight, same as the old combined check) and `llms-txt-directive-md` (Medium/4), and renamed `llms-txt-freshness` → `llms-txt-coverage`. Updated in: - `scripts/debug-score.ts`: `WEIGHTS` reference map - `app/master-plan/page.tsx`: scoring methodology reference table. Rebalanced the simplified directive split (2 + 1) so the table still totals 100. - `app/page.tsx`: `Discoverability` method-cell card check count `1` → `2` ## Score effects on stored data Existing rows in Supabase still have `results` arrays with the old check IDs (`llms-txt-directive`, `llms-txt-freshness`). Until those companies are rescored, displayed `score`/`grade` will be slightly off because `computeScore` no longer recognizes the old IDs. Recommended follow-up after merge: npx tsx scripts/compare-scores.ts --changed # see deltas export $(grep -v '^#' .env.local | xargs) && \\ npx tsx scripts/rerun-all.ts # rescore everything Per the v0.17 migration guide, smoke testing showed sites moving by ±5 points on average with the new spec, mostly driven by the directive split (content-discoverability typically drops 3-14 points) offset by HTML page-size improvements (script/style elements now stripped before sizing). Sites that nest their llms.txt may see big jumps in coverage because the renamed `llms-txt-coverage` check correctly handles nested indexes via the new "omitted subtrees" feature. ## Verified - `npm run build` — succeeds; all 15 routes generate; tsc --noEmit passes - `npx tsx scripts/debug-score.ts https://www.alchemy.com/docs` — runs end-to-end, all 22 checks execute, new IDs appear in output, score 97/100 (A) - `tsc --noEmit` on lib/scoring.ts + the updated scripts — clean Pre-existing scripts/ type errors unrelated to afdocs (`dedup-supabase.ts`, `reclassify-categories.ts`, `migrate-to-supabase.ts`) are out of scope. Made-with: Cursor
|
@SahilAujla is attempting to deploy a commit to the fern Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
@kgowru could I get your eyes on this pls 🙏🏻 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR upgrades the
afdocsdependency from 0.14.0 → 0.17.1, incorporating three minor releases of fixes and adapting the codebase to the breaking API changes introduced in v0.17.0.It includes:
CategoryScore.scoreKey user-facing improvement:
Sites that have both an apex
llms.txtand a docs-specificllms.txt(e.g., Cloudflare, Supabase, Vercel, Resend, Pinecone, Clerk, Sentry, Datadog, MongoDB, Auth0, LaunchDarkly, etc.) will now correctly use the docs version as canonical. This comes from afdocs#54 and prevents scores from being skewed by marketing-site indexes.What Changed in
afdocsSince 0.14.0llms.txtselection (prefers most specific file). Adds--llms-txt-urlCLI flag andllmsTxtUrlconfig.CategoryScorebecomes an object instead of a number. Programmatic API improvements.llms-txt-freshness→llms-txt-coverage. Splitsllms-txt-directiveinto HTML + Markdown variants. Adds nested index handling, strips<script>/<style>before sizing, introduces nullableCategoryScore.score, and validates options increateContext()/runChecks(). See the migration guide.Code Changes in This PR
Scoring Core
lib/scoring.tsnormalizeCategoryScores()helperRecord<string, number | { score: number | null }>nullscores (new in v0.17 for low sample sizes), allowing fallback to existing local calculationsapp/api/score/route.tsandscripts/score-single.tsspecUrl: ''field to reports (now enforced bycomputeScore())Renamed / Split Check IDs
scripts/debug-score.tsUpdated
WEIGHTSmap:llms-txt-directive→llms-txt-directive-html(High / 7)llms-txt-directive-md(Medium / 4)llms-txt-freshness→llms-txt-coverageapp/master-plan/page.tsxDiscoverabilityweights (2 + 1) to maintain total = 100app/page.tsxDiscoverabilitycheck count: 1 → 2Dependency Updates
package.jsonafdocs:^0.14.0→^0.17.1package-lock.jsonafdocs@0.17.1Stored Data: Rescore Required
Existing Supabase rows still reference old check IDs:
llms-txt-directivellms-txt-freshnessAfter this upgrade:
computeScore()will ignore these outdated checksRecommended Post-Merge Steps
From the v0.17 migration guide:
Typical score movement: ±5 points
Directive split may reduce discoverability by 3–14 points
Gains often offset by:
llms.txtsetups)Net effect: generally small changes, with some significant upward movers.
Verification
npm installafdocs@0.17.1npm run buildtsc --noEmitlib/scoring.ts, updated scripts)npx tsx scripts/debug-score.ts https://www.alchemy.com/docsNote:
Pre-existing type errors in the following files are unrelated and out of scope:
scripts/dedup-supabase.tsscripts/reclassify-categories.tsscripts/migrate-to-supabase.ts