Commit c98100a
fix(agent-score): directive placement, markdown parity, MCP endpoints (#8099)
* fix(agent-score): directive placement, markdown parity, MCP endpoints
Fixes the three regressing checks in the Mintlify/afdocs agent-readiness
audit and adds guards so they stay fixed:
Content Discoverability (directive buried past 50% of the HTML):
- Move the hidden llms.txt directive to the first child of <body> in the
docs root layout; the sidebar markup previously pushed it to 30-88% of
the body. Now sits at 0-1% on every page.
Markdown Content Parity (pages failing at 52-90% missing):
- Restore heading markers in getLLMText output from the page toc —
fumadocs' processed markdown emits headings as bare "Text [#anchor]"
lines, so "## 1. Set up your project" degraded to a stripped list item
on the markdown side.
- Convert <details>/<summary> to a bold summary + dedented body; the
serialized 2-space indent broke the code fences inside.
- Wrap the OpenAPI explorer (APIPage) in data-markdown-ignore; the
interactive reference has no markdown equivalent and the .md already
carries the generated API summary.
- Unescape remark escapes (\_, \{, \}) outside code so prose like
snake_case matches the rendered HTML.
MCP Server Discoverable (no server at expected endpoints):
- New /docs/mcp route proxies MCP protocol traffic to mcp.prisma.io/mcp
(browser GETs redirect to the /mcp marketing page).
- Header-matched beforeFiles rewrites on the site route MCP traffic on
www.prisma.io/mcp to the real server; browsers still get the page.
Guards: lint-agent-ready now checks directive-first-in-body, heading
markers across all pages, <details> leakage, the APIPage parity wrapper,
and both MCP endpoints. Skill docs updated with the new invariants and
an afdocs reproduction playbook.
Verified with the afdocs CLI against a local production build: directive
+ parity + markdown-url + content-negotiation all pass on the 20 pages
that previously failed or warned (avg 1% missing, was avg 8%).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(agent-score): address CodeRabbit review
- Hide the llms.txt directive from screen readers and the tab order
(aria-hidden + tabIndex={-1}); audits read raw HTML, not the a11y tree.
- Bound the /docs/mcp proxy: reject request bodies over 1 MiB (413, also
for chunked bodies without Content-Length) and abort the upstream fetch
if headers take more than 30s, while keeping SSE bodies streaming.
- lint-agent-ready now requires all three header-matched /mcp rewrites
(accept, content-type, mcp-session-id), not just one.
- Pin the afdocs version in the skill's reproduction commands.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(agent-score): scope MCP rewrite guard to single entries
The per-key regex could pair `source: "/mcp"` from one rewrite with a
header key from a neighbouring entry (and ast-grep flagged the variable
RegExp). Split the config into per-rewrite chunks at each `source:` and
require the header key and MCP destination together in the same chunk,
using static string matching. Verified the guard now fails when an entry
is dropped or a destination is changed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 04f5a0f commit c98100a
9 files changed
Lines changed: 479 additions & 54 deletions
File tree
- .claude/skills/docs-agent-ready
- apps
- docs
- scripts
- src
- app
- (docs)/(default)/[[...slug]]
- mcp
- components
- lib
- site
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | | - | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
| 56 | + | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
171 | 194 | | |
172 | 195 | | |
173 | 196 | | |
| |||
192 | 215 | | |
193 | 216 | | |
194 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
195 | 240 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
210 | 250 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
216 | 258 | | |
217 | | - | |
218 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
219 | 271 | | |
220 | 272 | | |
221 | | - | |
| 273 | + | |
222 | 274 | | |
223 | 275 | | |
224 | | - | |
| 276 | + | |
225 | 277 | | |
226 | 278 | | |
227 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
228 | 300 | | |
229 | 301 | | |
230 | 302 | | |
| |||
369 | 441 | | |
370 | 442 | | |
371 | 443 | | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
372 | 501 | | |
373 | 502 | | |
374 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | 34 | | |
37 | 35 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
57 | 39 | | |
58 | 40 | | |
59 | 41 | | |
| |||
0 commit comments