feat: migrate to nuxt-agent-discovery - #40
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
◈ PR Lens
Architecture 11 components touched across 6 lanes. Inside the changed components — 2 viewsComponent view — Agent Discovery Pipeline Consolidates markdown negotiation, raw mirrors, skills catalog, and OpenAPI spec generation into nuxt-agent-discovery, replacing custom handlers. Component view — MCP & Assistant Tooling Refactors the assistant endpoint and MCP tools (get-page, list-pages) to use getAgentDocument and listAgentPages from nuxt-agent-discovery. Data flow
The other flows — 1 sequence
Drill down
|
Documentation previews📚 Preview all documentation changes (follows new pushes) Pinned to the current head: |
commit: |
nuxt-agent-discovery
Replaces the hand-rolled markdown negotiation and agent discovery layer with nuxt-agent-discovery 0.5.0, the same shape as nuxt/ui#6883, nuxt/nuxt.com#2407 and nuxt-content/docus#1435.
@nuxtjs/robotsand@nuxtjs/sitemapwere already in the layer, so the module hooks into both: agentAllowgroups andContent-Signalthroughrobots:config, raw twins filtered out ofsitemap.xml.Deleted
modules/markdown-rewrite.ts,utils/markdown-rewrite.tsand their test: the Vercel 307 routes now come from the module's vercel presetserver/routes/raw/[...slug].md.get.ts,server/utils/markdown.ts,server/utils/not-found.ts: the raw route, the markdown pipeline and the markdown 404 bodymodules/skills/: the skills scanner and the/.well-known/skills/routesserver/plugins/llms.ts: link rewriting to raw twins, thellms-full.txtbuilder and the prerender hintsConfiguration
agentDiscoveryin the layer'snuxt.config.ts: acreateComarkSource()adapter overgetProdContent(),excludePrefixesfor/tree,/blob,/prand/logos, and the discovery links for/openapi.jsonand the RSS feed.modules/config.tsseeds what only the layer knows, like docus does: the MCP server card from the mcp-toolkit options, andcomarkDocs.skillsforwarded toagentDiscovery.skillsas a deprecated alias with a warning. It also adds/sitemap.mdto the ISR rules and the webhook purge list.One thing worth knowing for review: Nuxt queues a layer's
modulesarray before its auto-scannedmodules/dir, so until nowmodules/config.tsran after every module in the array and could not seed options a module reads at setup (the existingmcpseeding was affected too). The layer's own modules are now listed first innuxt.config.ts, with their.tsextension, which is what makes the scan dedupe them instead of installing them a second time.Kept in the layer
modules/runtime/server/plugins/llms.ts: thellms.txtsections built from the content navigation, plusdocs.llms.links. Registered from config.ts so it runs ahead of the module's bridge, which rewrites the page links to raw twins and rendersllms-full.txtfrom the same adapter.get_pageread throughgetAgentDocument()/listAgentPages(), so they return the same bytes as/raw/**.get-pagegained asectionsargument.New
/openapi.json(prerendered): the discovery layer fromagentDiscoveryOpenApi(), advertised in theLinkheader and the api-catalog, versioned from the app'spackage.json@nuxtjs/sitemapruns withexcludeAppSources: true, soserver/api/__sitemap__/urls.get.tsis the only source and the prerendered skill files stay outrawPrefixinstead of hardcoding/rawWhat changes for agents
Accept: text/markdown,.mdtwin URLs and the 26 agent user agents from ai.robots.txt (it wasAcceptandcurl/*before), and it works in dev/answers the landing page as markdown with a "Resources for Agents" block instead of redirecting to/llms.txtVary: Accept, User-Agenton both halves of every page, a discoveryLinkheader on/, canonical/alternateLinkon the twins/openapi.json,/sitemap.md,/.well-known/api-catalog,/.well-known/mcp/server-card.json, agent groups andContent-Signalinrobots.txttitle,descriptionandcanonical_urlfrontmatter and every link is absolute. Components render as HTML tags (markdown/html) instead of comark syntaxllms-full.txtnow includes the landing pageBreaking
comarkDocs.skills.dirstill works but warns, useagentDiscovery.skills.dir.nitro.experimental.asyncContextis now on, the MCP tools reach the request throughuseEvent().Checks
pnpm lint,pnpm test,pnpm typecheckandNITRO_PRESET=vercel pnpm buildpass locally (openapi.jsonand the 5 skill files prerendered, 24 redirects and 2 rewrites injected). Every probe from the migration skill was run againstpnpm dev: page negotiation,VaryandLink, the resources block on/,sitemap.md,sitemap.xml, the api-catalog, the server card,openapi.json, skills, section redirects, markdown 404s, excluded previews,llms.txtordering and both MCP tools. The preview (https://comark-docs-layer-qnm7ic5yd-nuxtlabs.vercel.app) is behind Vercel SSO, so the deployed-site checks (VaryandLinkoff the CDN, the edge rewrites and redirects) still have to run with a protection bypass token.