Add Agent-Friendly Docs rules, skill, and CI - #2944
Conversation
Introduce Agent-Friendly Docs enforcement: add .cursor/rules/agent-friendly-docs.mdc (AFDocs conventions and checks), .cursor/skills/agent-friendly-docs/SKILL.md (PR review checklist/skill for reviewers), and a GitHub Actions workflow .github/workflows/afdocs-check.yml. The workflow enforces llms.txt size, .md parity, and alternate-link injection at build-time (Tier 1 via scripts/verify-llms-output.js) and runs an advisory afdocs check against Vercel preview deployments (Tier 2). These additions codify AFDocs/SEO/orphan-route rules and provide automated reviewer guidance to prevent regressions in agent discoverability.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
AFDocs Agent Score (preview) |
Introduce a dedicated, lockfile-pinned AFDocs install under .github/afdocs and update CI to install and invoke the local binary (avoiding npx/unpinned installs). Update the afdocs-check workflow to pin Node 22 for the advisory job, run the pinned runner, and treat the verify script as a hard gate for build-time invariants. Enhance scripts/verify-llms-output.js to a two-part verifier: a generator sanity check (copies/validates static/llms.txt) and a production build gate that asserts llms.txt size (50k char threshold), per-page .md parity, and alternate-link/body directive injection; failures produce non-zero exit. Also add .github/afdocs/package.json (and lockfile), ignore the runner node_modules in .gitignore, and include small .tmp-fakebuild fixtures used by the verifier.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
AFDocs Agent Score (preview) |
Prefer github.event.deployment_status.environment_url when determining the preview URL for the AFDocs check, falling back to target_url only if environment_url is empty. This avoids pointing AFDocs at Vercel's log/target_url (which GitHub may map to log_url), passes the values via environment variables to prevent shell injection, and exits with a clear error if no preview URL is available.
AFDocs Agent Score (preview) |
Add /.tmp-* to .gitignore and remove throwaway .tmp-fakebuild fixtures. Update scripts/verify-llms-output.js: rename articlePages to contentPages, update console output, and change the page detection to validate pages that use <article> or fall back to <main>, with updated comments to mirror the injector's html-to-markdown fallback.
AFDocs Agent Score (preview) |
1 similar comment
AFDocs Agent Score (preview) |
Improve the AFDocs GitHub Actions reporting by producing a richer, upsertable scorecard comment. Adds a hidden marker so the workflow updates a single comment instead of posting new ones, surfaces the pinned afdocs CLI version, and uses icons and formatted text for the summary. Parses afdocs-report.json more robustly and links to the job log on parse failure. Includes a details table of failing/warning/error checks (omitting skips) and reuses an existing comment when present (lists comments with per_page=100 and updates the matching comment), returning early if no PR is associated with the deployment.
…tamask-docs into feat-afdocs-skill-ci
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2bc30a7. Configure here.
| exit 1 | ||
| fi | ||
| echo "Checking $PREVIEW_URL" | ||
| .github/afdocs/node_modules/.bin/afdocs check "$PREVIEW_URL" --format json --verbose | tee afdocs-report.json |
There was a problem hiding this comment.
Pipe masks afdocs exit code
Medium Severity
The Tier 2 step runs afdocs check through a pipe into tee without pipefail, so the step’s exit status comes from tee, not afdocs. When the CLI exits non-zero, the Actions step can still succeed, hiding failures until someone reads the PR comment or log.
Reviewed by Cursor Bugbot for commit 2bc30a7. Configure here.
AFDocs Agent Score (preview)Checked ❌ 10/21 checks passed — ✅ 10 passed · Checks needing attention
Run against the Vercel preview deployment. Skipped checks are unimplemented in afdocs@0.4.0 (not doc problems). Full output in the job log. |


Description
Introduce Agent-Friendly Docs enforcement: add .cursor/rules/agent-friendly-docs.mdc (AFDocs conventions and checks), .cursor/skills/agent-friendly-docs/SKILL.md (PR review checklist/skill for reviewers), and a GitHub Actions workflow .github/workflows/afdocs-check.yml. The workflow enforces llms.txt size, .md parity, and alternate-link injection at build-time (Tier 1 via scripts/verify-llms-output.js) and runs an advisory afdocs check against Vercel preview deployments (Tier 2). These additions codify AFDocs/SEO/orphan-route rules and provide automated reviewer guidance to prevent regressions in agent discoverability.
Issue(s) fixed
Fixes #
Preview
Checklist
External contributor checklist
Note
Low Risk
Changes are limited to Cursor docs, CI, and the verify script; they do not alter runtime site behavior, though Tier 1 can block PRs if build output fails the new invariants.
Overview
Adds Agent-Friendly Docs (AFDocs) guardrails for authors and reviewers, plus two-tier CI so agent/SEO invariants are enforced without changing the live docs build.
Authoring & review: A new always-on Cursor rule (
.cursor/rules/agent-friendly-docs.mdc) documents invariants forllms.txt, markdown parity, routing/orphans, and chain-page URL formatting. A matching review skill (.cursor/skills/agent-friendly-docs/SKILL.md) gives reviewers a structured checklist aligned with prior AFDocs work (#2926/#2929).CI:
.github/workflows/afdocs-check.ymlruns Tier 1 on every PR tomain:npm run buildthennode scripts/verify-llms-output.jsas a blocking gate. Tier 2 runs on successful Vercel Previewdeployment_status, executing pinnedafdocs@0.4.0from an isolated.github/afdocs/install (Node 22, lockfile, nonpx) and upserting an AFDocs scorecard PR comment; Tier 2 is advisory (continue-on-error) until the CLI stabilizes.Verification script:
scripts/verify-llms-output.jsis expanded from a dev sanity check into the advertised hard gate: Part 1 still regenerates LLM artifacts from source; Part 2 walksbuild/for rootllms.txtsize, per-page.mdsiblings, and injector markers (data-llms-md-alt,data-llms-directive), exiting non-zero on violations (skipping Part 2 locally ifbuild/is missing)..gitignoreignores.github/afdocs/node_modulesand.tmp-*.Reviewed by Cursor Bugbot for commit 2bc30a7. Bugbot is set up for automated code reviews on this repo. Configure here.