From c081ea327144db1eafc657114d2a6c852feb7272 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Mon, 5 Oct 2026 20:34:03 +0530 Subject: [PATCH 1/9] fix(website): check every built llms.txt for redirected and missing links --- .../scripts/validate-llms-txt-links.ts | 73 +++++++---- apps/website/src/config/llms-txt.test.ts | 39 ++---- apps/website/src/lib/llms-txt.test.ts | 120 ++++++++++++++++-- apps/website/src/lib/llms-txt.ts | 80 +++++++++++- 4 files changed, 243 insertions(+), 69 deletions(-) diff --git a/apps/website/scripts/validate-llms-txt-links.ts b/apps/website/scripts/validate-llms-txt-links.ts index 480b4eff96e..e59a470976d 100644 --- a/apps/website/scripts/validate-llms-txt-links.ts +++ b/apps/website/scripts/validate-llms-txt-links.ts @@ -1,40 +1,60 @@ -import { existsSync, readFileSync } from 'node:fs' -import { join } from 'node:path' +import { existsSync, readFileSync, readdirSync } from 'node:fs' +import { join, relative } from 'node:path' -import { findCanonicalDrift, parseLlmsTxtLinks } from '@/lib/llms-txt' +import { findStaleLinks, isWorkflowsAppPath } from '@/lib/llms-txt' const DIST_DIR = join(process.cwd(), 'dist') const CANONICAL_LINK = /]*\brel=["']canonical["'][^>]*>/i const HREF_ATTRIBUTE = /\bhref=["']([^"']+)["']/i -/** `/download/` -> `dist/download/index.html`, `/` -> `dist/index.html`. */ +/** `/download` -> `dist/download/index.html`, `/hub/models.md` -> `dist/hub/models.md`. */ function distFileFor(pathname: string): string { const trimmed = pathname.replace(/^\/|\/$/g, '') - return join(DIST_DIR, trimmed, 'index.html') + const isFile = /\.[a-z]+$/i.test(trimmed) + return isFile + ? join(DIST_DIR, trimmed) + : join(DIST_DIR, trimmed, 'index.html') } -/** The built page's own `rel="canonical"` href, or undefined if it wasn't built. */ +/** The built page's own `rel="canonical"` href, or undefined for a file or an unbuilt path. */ function canonicalFor(pathname: string): string | undefined { - let html: string - try { - html = readFileSync(distFileFor(pathname), 'utf8') - } catch { - return undefined - } + const file = distFileFor(pathname) + if (!file.endsWith('.html') || !existsSync(file)) return undefined + const html = readFileSync(file, 'utf8') const canonicalTag = CANONICAL_LINK.exec(html)?.[0] const canonical = canonicalTag === undefined ? undefined : HREF_ATTRIBUTE.exec(canonicalTag)?.[1] if (canonical === undefined) { - throw new Error( - `Built page ${distFileFor(pathname)} has no canonical link.` - ) + throw new Error(`Built page ${file} has no canonical link.`) } return canonical } +function isServed(pathname: string): boolean { + return isWorkflowsAppPath(pathname) || existsSync(distFileFor(pathname)) +} + +function redirectSources(): string[] { + const vercel = JSON.parse( + readFileSync(join(process.cwd(), 'vercel.json'), 'utf8') + ) as { redirects: { source: string }[] } + return vercel.redirects.map(({ source }) => source) +} + +/** `dist/llms-full.txt` plus every `llms.txt` the build wrote, root first. */ +function builtLlmsFiles(): string[] { + const sectionFiles = readdirSync(DIST_DIR, { recursive: true }) + .map(String) + .filter((file) => file.endsWith('/llms.txt')) + .sort() + return ['llms.txt', 'llms-full.txt', ...sectionFiles].map((file) => + join(DIST_DIR, file) + ) +} + function main(): void { if (!existsSync(DIST_DIR)) { console.error( @@ -43,27 +63,24 @@ function main(): void { process.exit(1) } - const llmsTxt = readFileSync( - join(process.cwd(), 'public', 'llms.txt'), - 'utf8' + const checks = { redirectSources: redirectSources(), isServed, canonicalFor } + const files = builtLlmsFiles() + const failures = files.flatMap((file) => + findStaleLinks(readFileSync(file, 'utf8'), checks).map( + (problem) => ` ${relative(process.cwd(), file)}: ${problem}` + ) ) - const links = parseLlmsTxtLinks(llmsTxt) - const drift = findCanonicalDrift(links, canonicalFor) - if (drift.length > 0) { + if (failures.length > 0) { console.error( - `llms.txt link validation failed (${drift.length} stale link(s)):` + `llms.txt link validation failed (${failures.length} stale link(s)):` ) - for (const { link, canonical } of drift) { - console.error( - ` [${link.title}](${link.url}) now canonicalizes to ${canonical}` - ) - } + for (const failure of failures) console.error(failure) process.exit(1) } process.stdout.write( - `llms.txt link validation passed for ${links.length} link(s).\n` + `llms.txt link validation passed for ${files.length} file(s).\n` ) } diff --git a/apps/website/src/config/llms-txt.test.ts b/apps/website/src/config/llms-txt.test.ts index 955b1fc7ece..0bbb8831016 100644 --- a/apps/website/src/config/llms-txt.test.ts +++ b/apps/website/src/config/llms-txt.test.ts @@ -6,6 +6,7 @@ import { findRedirectedLinks, internalLinks, isLlmsTxtLinkLine, + isWorkflowsAppPath, normalizePath, parseLlmsTxtLinks } from '@/lib/llms-txt' @@ -18,13 +19,11 @@ import { workshopPagePaths } from './workshop-page-content' const llmsTxt = readFileSync(join(websiteRoot, 'public', 'llms.txt'), 'utf8') const pagesDir = join(websiteRoot, 'src', 'pages') -const vercelRedirectSources = new Set( - ( - JSON.parse(readFileSync(join(websiteRoot, 'vercel.json'), 'utf8')) as { - redirects: { source: string }[] - } - ).redirects.map((redirect) => normalizePath(redirect.source)) -) +const vercelRedirectSources = ( + JSON.parse(readFileSync(join(websiteRoot, 'vercel.json'), 'utf8')) as { + redirects: { source: string }[] + } +).redirects.map((redirect) => redirect.source) /** * Pages that exist in src/pages but are deliberately kept out of llms.txt. @@ -79,20 +78,6 @@ function isExcludedPage(page: string): boolean { */ const BUILD_ARTIFACTS = new Set(['/sitemap-index.xml', '/llms-full.txt']) -/** - * Route shapes of the Comfy Workflows app, which lives in another repo and is - * served behind the comfy.org router. Only these shapes may be linked; the - * slugs themselves are verified against the live site, not here. - */ -const WORKFLOW_APP_ROUTES = [ - /^\/workflows$/, - /^\/workflows\/creators$/, - /^\/workflows\/category\/[a-z0-9-]+$/, - /^\/workflows\/model(\/[a-z0-9-]+)?$/, - /^\/workflows\/use-cases(\/[a-z0-9-]+)?$/, - /^\/[a-z]{2}(-[A-Za-z]{2})?\/workflows$/ -] - /** Turn `src/pages/learning/[category]/[slug].astro` into a matcher for `/learning/x/y`. */ function pageMatchers(root: string): { static: Set @@ -166,13 +151,14 @@ describe('llms.txt', () => { }) it('only links comfy.org paths that this site (or the workflows app) serves', () => { - const unknown = internalPaths.filter((path) => { + const unknown = internalPaths.filter((linked) => { + const path = linked.replace(/\.md$/, '') if (BUILD_ARTIFACTS.has(path) || modelsPages.has(path)) return false if ( path.startsWith('/workflows') || /^\/[a-z]{2}(-[A-Za-z]{2})?\/workflows/.test(path) ) { - return !WORKFLOW_APP_ROUTES.some((route) => route.test(path)) + return !isWorkflowsAppPath(path) } if (path.startsWith('/zh-CN')) { const base = normalizePath(path.slice('/zh-CN'.length)) @@ -209,13 +195,6 @@ describe('llms.txt', () => { expect(listedButExcluded).toEqual([]) }) - it('uses only literal redirect sources for stale link checks', () => { - const patternedSources = [...vercelRedirectSources].filter((source) => - /[:*(]/.test(source) - ) - expect(patternedSources).toEqual([]) - }) - it('links a redirect destination rather than its stale source', () => { const redirected = findRedirectedLinks(links, vercelRedirectSources) expect(redirected).toEqual([]) diff --git a/apps/website/src/lib/llms-txt.test.ts b/apps/website/src/lib/llms-txt.test.ts index 62a1c95bf7f..0d007c087e0 100644 --- a/apps/website/src/lib/llms-txt.test.ts +++ b/apps/website/src/lib/llms-txt.test.ts @@ -3,9 +3,12 @@ import { describe, expect, it } from 'vitest' import { findCanonicalDrift, findRedirectedLinks, + findStaleLinks, internalLinks, + isWorkflowsAppPath, normalizePath, - parseLlmsTxtLinks + parseLlmsTxtLinks, + redirectSourcePattern } from './llms-txt' describe('parseLlmsTxtLinks', () => { @@ -74,9 +77,7 @@ describe('findRedirectedLinks', () => { } ] - expect(findRedirectedLinks(links, new Set(['/cloud/enterprise']))).toEqual( - links - ) + expect(findRedirectedLinks(links, ['/cloud/enterprise'])).toEqual(links) }) it('leaves a link that is not a redirect source alone', () => { @@ -88,9 +89,7 @@ describe('findRedirectedLinks', () => { } ] - expect(findRedirectedLinks(links, new Set(['/cloud/enterprise']))).toEqual( - [] - ) + expect(findRedirectedLinks(links, ['/cloud/enterprise'])).toEqual([]) }) it('ignores external links even if their path matches a redirect source', () => { @@ -98,7 +97,112 @@ describe('findRedirectedLinks', () => { { title: 'Docs', url: 'https://docs.comfy.org/pricing', description: '' } ] - expect(findRedirectedLinks(links, new Set(['/pricing']))).toEqual([]) + expect(findRedirectedLinks(links, ['/pricing'])).toEqual([]) + }) +}) + +describe('redirectSourcePattern', () => { + it.for([ + ['/cloud/enterprise', '/cloud/enterprise', true], + ['/cloud/enterprise/', '/cloud/enterprise', true], + ['/cloud/enterprise', '/cloud/enterprise-plans', false], + ['/p/supported-models/:slug', '/p/supported-models/flux1-dev-fp8', true], + ['/p/supported-models/:slug', '/p/supported-models', false], + ['/p/supported-models/:slug', '/p/supported-models/a/b', false], + ['/models/:path*', '/models', true], + ['/models/:path*', '/models/a/b.md', true], + ['/models/:path*', '/models-v2', false], + ['/models/:path+', '/models', false], + ['/models/:path+', '/models/a/b', true], + ['/hub/models.md', '/hub/modelsxmd', false] + ] as const)('%s matches %s: %s', ([source, path, matches]) => { + expect(redirectSourcePattern(source).test(path)).toBe(matches) + }) +}) + +describe('isWorkflowsAppPath', () => { + it.for([ + ['/workflows', true], + ['/workflows/use-cases/image-to-3d', true], + ['/ja/workflows', true], + ['/hub/workflows/flux', false], + ['/workflows/unknown/shape', false] + ] as const)('%s: %s', ([path, expected]) => { + expect(isWorkflowsAppPath(path)).toBe(expected) + }) +}) + +describe('findStaleLinks', () => { + const sectionFile = (url: string) => + [ + '# Supported models in ComfyUI', + '', + '## Models', + '', + `- [FLUX.1 Dev](${url}): Open model`, + '- [Docs](https://docs.comfy.org/p/supported-models/gone): External' + ].join('\n') + const builtPages = new Set([ + '/p/supported-models/flux-1-dev', + '/p/supported-models/flux-1-dev.md' + ]) + const checks = { + redirectSources: ['/models/:path*', '/cloud/enterprise'], + isServed: (path: string) => builtPages.has(path), + canonicalFor: () => undefined + } + + it('fails a link that matches a pattern redirect source', () => { + expect( + findStaleLinks( + sectionFile('https://comfy.org/models/flux-1-dev.md'), + checks + ) + ).toEqual([ + '[FLUX.1 Dev](https://comfy.org/models/flux-1-dev.md) is a redirect source' + ]) + }) + + it('fails a link that matches a literal redirect source', () => { + expect( + findStaleLinks(sectionFile('https://comfy.org/cloud/enterprise/'), checks) + ).toEqual([ + '[FLUX.1 Dev](https://comfy.org/cloud/enterprise/) is a redirect source' + ]) + }) + + it('fails a link the build did not produce', () => { + expect( + findStaleLinks( + sectionFile('https://comfy.org/p/supported-models/removed.md'), + { ...checks, redirectSources: [] } + ) + ).toEqual([ + '[FLUX.1 Dev](https://comfy.org/p/supported-models/removed.md) is not in the build' + ]) + }) + + it('fails a built page that canonicalizes elsewhere', () => { + expect( + findStaleLinks( + sectionFile('https://comfy.org/p/supported-models/flux-1-dev/'), + { + ...checks, + canonicalFor: () => 'https://comfy.org/hub/models/flux-1-dev/' + } + ) + ).toEqual([ + '[FLUX.1 Dev](https://comfy.org/p/supported-models/flux-1-dev/) now canonicalizes to https://comfy.org/hub/models/flux-1-dev/' + ]) + }) + + it('passes once the link points at the live page', () => { + expect( + findStaleLinks( + sectionFile('https://comfy.org/p/supported-models/flux-1-dev.md'), + checks + ) + ).toEqual([]) }) }) diff --git a/apps/website/src/lib/llms-txt.ts b/apps/website/src/lib/llms-txt.ts index 2dd8cfe3f71..8399dd855c3 100644 --- a/apps/website/src/lib/llms-txt.ts +++ b/apps/website/src/lib/llms-txt.ts @@ -42,17 +42,64 @@ export function internalLinks( } /** - * llms.txt links whose path is itself a redirect source (e.g. a Vercel edge + * A Vercel redirect source as a matcher for a normalized pathname: literal + * sources plus the `:slug`, `:path+` and `/:path*` params Vercel accepts. + */ +export function redirectSourcePattern(source: string): RegExp { + const pattern = normalizePath(source) + .split(/(\/:\w+\*|:\w+\+|:\w+)/) + .map((part, index) => { + if (index % 2 === 0) return part.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + if (part.endsWith('*')) return '(?:/.*)?' + if (part.endsWith('+')) return '.+' + return '[^/]+' + }) + .join('') + return new RegExp(`^${pattern}$`) +} + +/** + * llms.txt links whose path matches a redirect source (e.g. a Vercel edge * redirect). Linking a redirect source instead of its destination means an * agent following the link pays an extra hop, and the description sitting * next to it describes whatever page the redirect used to point at. */ export function findRedirectedLinks( links: LlmsTxtLink[], - redirectSources: ReadonlySet + redirectSources: readonly string[] ): LlmsTxtLink[] { + const patterns = redirectSources.map(redirectSourcePattern) return internalLinks(links) - .filter(({ path }) => redirectSources.has(path)) + .filter(({ path }) => patterns.some((pattern) => pattern.test(path))) + .map(({ link }) => link) +} + +/** + * Route shapes of the Comfy Workflows app, which lives in another repo and is + * served behind the comfy.org router. Only these shapes may be linked; the + * slugs themselves are verified against the live site, not here. + */ +const WORKFLOWS_APP_ROUTES = [ + /^\/workflows$/, + /^\/workflows\/creators$/, + /^\/workflows\/category\/[a-z0-9-]+$/, + /^\/workflows\/model(\/[a-z0-9-]+)?$/, + /^\/workflows\/use-cases(\/[a-z0-9-]+)?$/, + /^\/[a-z]{2}(-[A-Za-z]{2})?\/workflows$/ +] + +/** Whether a normalized pathname is a Comfy Workflows app page, not this site's. */ +export function isWorkflowsAppPath(path: string): boolean { + return WORKFLOWS_APP_ROUTES.some((route) => route.test(path)) +} + +/** comfy.org links whose path neither the build nor another app behind the router serves. */ +export function findMissingLinks( + links: LlmsTxtLink[], + isServed: (path: string) => boolean +): LlmsTxtLink[] { + return internalLinks(links) + .filter(({ path }) => !isServed(path)) .map(({ link }) => link) } @@ -88,3 +135,30 @@ export function findCanonicalDrift( } return drift } + +export interface LlmsTxtChecks { + redirectSources: readonly string[] + isServed: (path: string) => boolean + canonicalFor: (path: string) => string | undefined +} + +/** Every stale link in one llms.txt body, one readable line per problem. */ +export function findStaleLinks( + llmsTxt: string, + { redirectSources, isServed, canonicalFor }: LlmsTxtChecks +): string[] { + const links = parseLlmsTxtLinks(llmsTxt) + const redirected = findRedirectedLinks(links, redirectSources) + const live = links.filter((link) => !redirected.includes(link)) + const missing = findMissingLinks(live, isServed) + const built = live.filter((link) => !missing.includes(link)) + const describe = (link: LlmsTxtLink) => `[${link.title}](${link.url})` + return [ + ...redirected.map((link) => `${describe(link)} is a redirect source`), + ...missing.map((link) => `${describe(link)} is not in the build`), + ...findCanonicalDrift(built, canonicalFor).map( + ({ link, canonical }) => + `${describe(link)} now canonicalizes to ${canonical}` + ) + ] +} From f8a66ca389d30d472c14cf6de3a8d912b8404aec Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Mon, 5 Oct 2026 20:36:22 +0530 Subject: [PATCH 2/9] feat(website): point llms.txt at /hub/models and the Comfy Router docs --- apps/website/public/llms.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/website/public/llms.txt b/apps/website/public/llms.txt index dc3d14057eb..32c90df130f 100644 --- a/apps/website/public/llms.txt +++ b/apps/website/public/llms.txt @@ -44,9 +44,10 @@ Languages: comfy.org is published in English and Simplified Chinese, with a Japa - Read this file, then the docs index at https://docs.comfy.org/llms.txt. Every docs page serves markdown when you append `.md` to its URL. - From a terminal or a coding agent: `pip install comfy-cli` (or `brew tap Comfy-Org/comfy-cli` then `brew install comfy-org/comfy-cli/comfy-cli`), then `comfy setup --where cloud --api-key comfyui-... --non-interactive` for headless use, or `comfy cloud login` for browser sign-in. `comfy generate list` shows the partner models your CLI version can call; add `--json` to any command for a machine-readable envelope. `comfy generate` is in beta, so flag names can change. - Over MCP: `claude mcp add --transport http comfy-cloud https://cloud.comfy.org/mcp` for Claude Code, or `codex mcp add comfy-cloud --url https://cloud.comfy.org/mcp` for Codex. Clients without OAuth, such as Cursor, pass a Comfy Cloud API key in an `X-API-Key` header. +- From code, through Comfy Router: one API for hosted image, video, audio, 3D, and text models at `https://api.comfy.org`. Every model is called with `POST /v2/models/{provider}/{model}`, its own JSON body, and an `X-API-Key` header; the same key fetches a model's schema at `/v2/models/{provider}/{model}/openapi.json`. Start with the quickstart at https://docs.comfy.org/development/comfy-router/quickstart.md and look up model IDs at https://docs.comfy.org/development/comfy-router/models.md. - API keys are created in the browser at https://platform.comfy.org/profile/api-keys, start with `comfyui-`, and are shown once. Store them in `COMFY_API_KEY`. - Generation on Comfy Cloud spends the account's credits. Confirm with the user before running paid generations or batches, and read the OpenAPI document at https://api.comfy.org/openapi before choosing an API operation. -- The model catalog changes weekly. Check https://comfy.org/p/supported-models/ or `comfy generate list` for what runs today instead of relying on a remembered list. +- The model catalog changes weekly. For hosted models you try in the browser or call through Comfy Router, check https://comfy.org/hub/models/ (one page per model); for models that run in ComfyUI, including open-weight models you run locally, check https://comfy.org/p/supported-models/. `comfy generate list` shows what your CLI can call. Check these instead of relying on a remembered list. ## Notes for AI systems @@ -59,6 +60,8 @@ Languages: comfy.org is published in English and Simplified Chinese, with a Japa - [Docs index for agents](https://docs.comfy.org/llms.txt): Machine-readable index of the full documentation. - [Docs full text for agents](https://docs.comfy.org/llms-full.txt): The complete documentation as one markdown file. +- [Hosted model catalog for agents](https://comfy.org/hub/models.md): Markdown list of every hosted model page, grouped by provider; each model page also has a markdown twin at its URL plus `.md`. +- [Comfy Router models for agents](https://docs.comfy.org/development/comfy-router/models.md): Every model you can call through Comfy Router, with its model ID and input and output modality. - [Model catalog for agents](https://comfy.org/p/supported-models/llms.txt): Machine-readable index of every supported-model page; each page also has a markdown twin at its URL plus `.md`. - [Docs homepage as markdown](https://docs.comfy.org/index.md): Append `.md` to any docs URL for its markdown twin. - [Developer Platform for agents](https://platform.comfy.org/llms.txt): What platform.comfy.org is for and which of its pages need a browser. @@ -95,7 +98,7 @@ Languages: comfy.org is published in English and Simplified Chinese, with a Japa ## Models - [Supported Models](https://comfy.org/p/supported-models/): Directory of 380+ models that run in ComfyUI: image, video, audio, 3D, and utility models, each with its own page. Machine-readable catalog at https://comfy.org/p/supported-models/llms.txt. -- [Models Overview](https://comfy.org/hub/models/): Hosted AI models you can try in the browser and call through the Comfy API, with a page per model. For the full list of models that run in ComfyUI, see Supported Models above. +- [Models Overview](https://comfy.org/hub/models/): Every hosted model you can run in the browser or call through Comfy Router, one page per model. Markdown version at https://comfy.org/hub/models.md. For the full list of models that run in ComfyUI, see Supported Models above. - [ChatGPT Images 2.5 (OpenAI, image model)](https://comfy.org/chatgpt-image-2.5/): Generate new images, edit existing visuals, and direct results with reference images in repeatable ComfyUI workflows through Partner Nodes. - [Qwen-Image 2.1 (Alibaba Qwen, image model)](https://comfy.org/qwen-image-2.1/): Open-weights 7B image model that generates and edits in one checkpoint, with native 2K output, RGBA transparency, and accurate English and Chinese text rendering. - [Flux 3 (Black Forest Labs, video model)](https://comfy.org/flux-3/): Multimodal model: video with native audio, up to 20 seconds per generation, from text, image, video, or keyframes. From 0c4c1465cc3c261be1f8ccc078afe6eb5e638dbb Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Mon, 5 Oct 2026 20:37:24 +0530 Subject: [PATCH 3/9] fix(website): treat the markdown twin of a redirected page as redirected --- apps/website/src/lib/llms-txt.test.ts | 11 +++++++++++ apps/website/src/lib/llms-txt.ts | 10 +++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/website/src/lib/llms-txt.test.ts b/apps/website/src/lib/llms-txt.test.ts index 0d007c087e0..3b4df16f99d 100644 --- a/apps/website/src/lib/llms-txt.test.ts +++ b/apps/website/src/lib/llms-txt.test.ts @@ -163,6 +163,17 @@ describe('findStaleLinks', () => { ]) }) + it('fails the markdown twin of a redirected page', () => { + expect( + findStaleLinks( + sectionFile('https://comfy.org/cloud/enterprise.md'), + checks + ) + ).toEqual([ + '[FLUX.1 Dev](https://comfy.org/cloud/enterprise.md) is a redirect source' + ]) + }) + it('fails a link that matches a literal redirect source', () => { expect( findStaleLinks(sectionFile('https://comfy.org/cloud/enterprise/'), checks) diff --git a/apps/website/src/lib/llms-txt.ts b/apps/website/src/lib/llms-txt.ts index 8399dd855c3..c6bbb985825 100644 --- a/apps/website/src/lib/llms-txt.ts +++ b/apps/website/src/lib/llms-txt.ts @@ -59,8 +59,8 @@ export function redirectSourcePattern(source: string): RegExp { } /** - * llms.txt links whose path matches a redirect source (e.g. a Vercel edge - * redirect). Linking a redirect source instead of its destination means an + * llms.txt links whose path, or the page a `.md` twin copies, matches a + * redirect source (e.g. a Vercel edge redirect). Linking a redirect source instead of its destination means an * agent following the link pays an extra hop, and the description sitting * next to it describes whatever page the redirect used to point at. */ @@ -70,7 +70,11 @@ export function findRedirectedLinks( ): LlmsTxtLink[] { const patterns = redirectSources.map(redirectSourcePattern) return internalLinks(links) - .filter(({ path }) => patterns.some((pattern) => pattern.test(path))) + .filter(({ path }) => + [path, path.replace(/\.md$/, '')].some((candidate) => + patterns.some((pattern) => pattern.test(candidate)) + ) + ) .map(({ link }) => link) } From ccfe2c1317db7a725e9f22850b7e1b0ef18af6a3 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Mon, 5 Oct 2026 20:41:49 +0530 Subject: [PATCH 4/9] fix(website): describe /hub/models without claiming every Router model --- apps/website/public/llms.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/website/public/llms.txt b/apps/website/public/llms.txt index 32c90df130f..e61df1af607 100644 --- a/apps/website/public/llms.txt +++ b/apps/website/public/llms.txt @@ -60,7 +60,7 @@ Languages: comfy.org is published in English and Simplified Chinese, with a Japa - [Docs index for agents](https://docs.comfy.org/llms.txt): Machine-readable index of the full documentation. - [Docs full text for agents](https://docs.comfy.org/llms-full.txt): The complete documentation as one markdown file. -- [Hosted model catalog for agents](https://comfy.org/hub/models.md): Markdown list of every hosted model page, grouped by provider; each model page also has a markdown twin at its URL plus `.md`. +- [Hosted model catalog for agents](https://comfy.org/hub/models.md): Markdown list of the hosted model pages, grouped by provider; each model page also has a markdown twin at its URL plus `.md`. - [Comfy Router models for agents](https://docs.comfy.org/development/comfy-router/models.md): Every model you can call through Comfy Router, with its model ID and input and output modality. - [Model catalog for agents](https://comfy.org/p/supported-models/llms.txt): Machine-readable index of every supported-model page; each page also has a markdown twin at its URL plus `.md`. - [Docs homepage as markdown](https://docs.comfy.org/index.md): Append `.md` to any docs URL for its markdown twin. @@ -98,7 +98,7 @@ Languages: comfy.org is published in English and Simplified Chinese, with a Japa ## Models - [Supported Models](https://comfy.org/p/supported-models/): Directory of 380+ models that run in ComfyUI: image, video, audio, 3D, and utility models, each with its own page. Machine-readable catalog at https://comfy.org/p/supported-models/llms.txt. -- [Models Overview](https://comfy.org/hub/models/): Every hosted model you can run in the browser or call through Comfy Router, one page per model. Markdown version at https://comfy.org/hub/models.md. For the full list of models that run in ComfyUI, see Supported Models above. +- [Models Overview](https://comfy.org/hub/models/): Hosted models you can run in the browser and call through Comfy Router, one page per model. Markdown version at https://comfy.org/hub/models.md. For the full list of models that run in ComfyUI, see Supported Models above. - [ChatGPT Images 2.5 (OpenAI, image model)](https://comfy.org/chatgpt-image-2.5/): Generate new images, edit existing visuals, and direct results with reference images in repeatable ComfyUI workflows through Partner Nodes. - [Qwen-Image 2.1 (Alibaba Qwen, image model)](https://comfy.org/qwen-image-2.1/): Open-weights 7B image model that generates and edits in one checkpoint, with native 2K output, RGBA transparency, and accurate English and Chinese text rendering. - [Flux 3 (Black Forest Labs, video model)](https://comfy.org/flux-3/): Multimodal model: video with native audio, up to 20 seconds per generation, from text, image, video, or keyframes. From c8c9494e85ae89b54e8094a1f8ca62f02975b8b7 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Mon, 5 Oct 2026 20:42:52 +0530 Subject: [PATCH 5/9] refactor(website): keep the missing-link helper private --- apps/website/src/lib/llms-txt.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/website/src/lib/llms-txt.ts b/apps/website/src/lib/llms-txt.ts index c6bbb985825..46798a3b8b8 100644 --- a/apps/website/src/lib/llms-txt.ts +++ b/apps/website/src/lib/llms-txt.ts @@ -60,9 +60,10 @@ export function redirectSourcePattern(source: string): RegExp { /** * llms.txt links whose path, or the page a `.md` twin copies, matches a - * redirect source (e.g. a Vercel edge redirect). Linking a redirect source instead of its destination means an - * agent following the link pays an extra hop, and the description sitting - * next to it describes whatever page the redirect used to point at. + * redirect source (e.g. a Vercel edge redirect). Linking a redirect source + * instead of its destination means an agent following the link pays an extra + * hop, and the description sitting next to it describes whatever page the + * redirect used to point at. */ export function findRedirectedLinks( links: LlmsTxtLink[], @@ -98,7 +99,7 @@ export function isWorkflowsAppPath(path: string): boolean { } /** comfy.org links whose path neither the build nor another app behind the router serves. */ -export function findMissingLinks( +function findMissingLinks( links: LlmsTxtLink[], isServed: (path: string) => boolean ): LlmsTxtLink[] { From 20ae4d2a9416661e45768a334ab58651080c0260 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 6 Oct 2026 09:42:48 +0530 Subject: [PATCH 6/9] fix(website): match regex-constrained params in redirect sources redirectSourcePattern treated `:slug(a|b)` as `:slug` followed by a literal `(a|b)`, so a source such as `/p/supported-models/:slug(4x-ultrasharp|flux1-dev-fp8).md` matched no path and a stale llms.txt link to an old file URL passed silently. A constrained param now compiles to an alternation of its escaped literal values, so only the listed slugs match, with or without the trailing slash or `.md` suffix. Redirect sources stay case-sensitive, as Vercel documents. Any other path-to-regexp syntax (a regex constraint, an unnamed group, a modifier) throws instead of matching nothing. This makes #20198 compatible with the grouped redirect sources that #20291 adds to vercel.json. --- apps/website/src/lib/llms-txt.test.ts | 45 ++++++++++++++++++++++++++- apps/website/src/lib/llms-txt.ts | 32 ++++++++++++++++--- 2 files changed, 72 insertions(+), 5 deletions(-) diff --git a/apps/website/src/lib/llms-txt.test.ts b/apps/website/src/lib/llms-txt.test.ts index 3b4df16f99d..2249810dd8a 100644 --- a/apps/website/src/lib/llms-txt.test.ts +++ b/apps/website/src/lib/llms-txt.test.ts @@ -101,6 +101,8 @@ describe('findRedirectedLinks', () => { }) }) +const groupedSource = '/p/supported-models/:slug(4x-ultrasharp|flux1-dev-fp8)' + describe('redirectSourcePattern', () => { it.for([ ['/cloud/enterprise', '/cloud/enterprise', true], @@ -114,10 +116,51 @@ describe('redirectSourcePattern', () => { ['/models/:path*', '/models-v2', false], ['/models/:path+', '/models', false], ['/models/:path+', '/models/a/b', true], - ['/hub/models.md', '/hub/modelsxmd', false] + ['/hub/models.md', '/hub/modelsxmd', false], + [`${groupedSource}.md`, '/p/supported-models/flux1-dev-fp8.md', true], + [`${groupedSource}.md/`, '/p/supported-models/4x-ultrasharp.md', true], + [`${groupedSource}.md`, '/p/supported-models/flux1-dev-fp8', false], + [groupedSource, '/p/supported-models/flux1-dev-fp8-extra', false], + [groupedSource, '/p/supported-models/xflux1-dev-fp8', false], + [groupedSource, '/p/supported-models/flux1-dev-fp8/a', false] ] as const)('%s matches %s: %s', ([source, path, matches]) => { expect(redirectSourcePattern(source).test(path)).toBe(matches) }) + + it.for([ + '/posts/:id(\\d+)', + '/payment/(.*)', + '/p/:slug(a|b)?', + '/p/:slug(a|(b))' + ])('rejects unsupported source syntax %s', (source) => { + expect(() => redirectSourcePattern(source)).toThrow(/Unsupported/) + }) +}) + +describe('findRedirectedLinks with constrained slug sources', () => { + const link = (path: string) => ({ + title: 'FLUX.1 Dev fp8', + url: `https://comfy.org${path}`, + description: '' + }) + + it.for([ + [groupedSource, '/p/supported-models/flux1-dev-fp8/', true], + [groupedSource, '/p/supported-models/flux1-dev-fp8', true], + [groupedSource, '/p/supported-models/flux1-dev-fp8.md', true], + [`${groupedSource}/`, '/p/supported-models/flux1-dev-fp8/', true], + [`${groupedSource}/`, '/p/supported-models/4x-ultrasharp', true], + [`${groupedSource}.md`, '/p/supported-models/flux1-dev-fp8.md', true], + [groupedSource, '/p/supported-models/flux-1-dev/', false], + [`${groupedSource}/`, '/p/supported-models/flux-1-dev', false], + [`${groupedSource}.md`, '/p/supported-models/flux-1-dev.md', false], + ['/p/supported-models/:slug', '/p/supported-models/flux-1-dev.md', true], + ['/cloud/enterprise', '/cloud/enterprise/', true] + ] as const)('source %s flags %s: %s', ([source, path, flagged]) => { + expect(findRedirectedLinks([link(path)], [source])).toEqual( + flagged ? [link(path)] : [] + ) + }) }) describe('isWorkflowsAppPath', () => { diff --git a/apps/website/src/lib/llms-txt.ts b/apps/website/src/lib/llms-txt.ts index 46798a3b8b8..9695eb65b64 100644 --- a/apps/website/src/lib/llms-txt.ts +++ b/apps/website/src/lib/llms-txt.ts @@ -41,15 +41,39 @@ export function internalLinks( .map(({ link, url }) => ({ path: normalizePath(url.pathname), link })) } +const SOURCE_PARAM = /(\/:\w+\*|:\w+\+|:\w+\([^()]*\)|:\w+)/ +const LITERAL_ALTERNATIVE = /^[\w.~-]+$/ +const UNSUPPORTED_SOURCE_SYNTAX = /[()?*+]/ + +function escapeRegExp(text: string): string { + return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +} + +function constrainedParamPattern(param: string): string { + const alternatives = param.slice(param.indexOf('(') + 1, -1).split('|') + if ( + !alternatives.every((alternative) => LITERAL_ALTERNATIVE.test(alternative)) + ) + throw new Error(`Unsupported redirect source constraint: ${param}`) + return `(?:${alternatives.map(escapeRegExp).join('|')})` +} + /** - * A Vercel redirect source as a matcher for a normalized pathname: literal - * sources plus the `:slug`, `:path+` and `/:path*` params Vercel accepts. + * A Vercel redirect source as a case-sensitive matcher for a normalized + * pathname: literal sources plus the `:slug`, `:slug(a|b)`, `:path+` and + * `/:path*` params Vercel accepts. Other path-to-regexp syntax throws rather + * than silently matching nothing. */ export function redirectSourcePattern(source: string): RegExp { const pattern = normalizePath(source) - .split(/(\/:\w+\*|:\w+\+|:\w+)/) + .split(SOURCE_PARAM) .map((part, index) => { - if (index % 2 === 0) return part.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + if (index % 2 === 0) { + if (UNSUPPORTED_SOURCE_SYNTAX.test(part)) + throw new Error(`Unsupported redirect source syntax: ${source}`) + return escapeRegExp(part) + } + if (part.endsWith(')')) return constrainedParamPattern(part) if (part.endsWith('*')) return '(?:/.*)?' if (part.endsWith('+')) return '.+' return '[^/]+' From 0af523145a9fba416266efe1de5cd9de6bd03d4f Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 6 Oct 2026 10:07:07 +0530 Subject: [PATCH 7/9] fix(website): say markdown twins replace the trailing slash with .md in llms.txt --- apps/website/public/llms.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/website/public/llms.txt b/apps/website/public/llms.txt index e61df1af607..bb8c98ca30b 100644 --- a/apps/website/public/llms.txt +++ b/apps/website/public/llms.txt @@ -60,9 +60,9 @@ Languages: comfy.org is published in English and Simplified Chinese, with a Japa - [Docs index for agents](https://docs.comfy.org/llms.txt): Machine-readable index of the full documentation. - [Docs full text for agents](https://docs.comfy.org/llms-full.txt): The complete documentation as one markdown file. -- [Hosted model catalog for agents](https://comfy.org/hub/models.md): Markdown list of the hosted model pages, grouped by provider; each model page also has a markdown twin at its URL plus `.md`. +- [Hosted model catalog for agents](https://comfy.org/hub/models.md): Markdown list of the hosted model pages, grouped by provider; each model page also has a markdown twin at its URL with the trailing slash replaced by `.md`. - [Comfy Router models for agents](https://docs.comfy.org/development/comfy-router/models.md): Every model you can call through Comfy Router, with its model ID and input and output modality. -- [Model catalog for agents](https://comfy.org/p/supported-models/llms.txt): Machine-readable index of every supported-model page; each page also has a markdown twin at its URL plus `.md`. +- [Model catalog for agents](https://comfy.org/p/supported-models/llms.txt): Machine-readable index of every supported-model page; each page also has a markdown twin at its URL with the trailing slash replaced by `.md`. - [Docs homepage as markdown](https://docs.comfy.org/index.md): Append `.md` to any docs URL for its markdown twin. - [Developer Platform for agents](https://platform.comfy.org/llms.txt): What platform.comfy.org is for and which of its pages need a browser. - [Comfy API OpenAPI document](https://api.comfy.org/openapi): OpenAPI specification for api.comfy.org. From 7c8fa379a3a0ff237ee7953fa7bc3b789685ee57 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Tue, 6 Oct 2026 16:16:26 +0530 Subject: [PATCH 8/9] fix(website): harden the llms.txt link check for Windows paths, dotted slugs and brace sources --- .../scripts/validate-llms-txt-links.ts | 20 ++++++----- apps/website/src/lib/llms-txt.test.ts | 36 +++++++++++++++++-- apps/website/src/lib/llms-txt.ts | 20 ++++++++++- 3 files changed, 65 insertions(+), 11 deletions(-) diff --git a/apps/website/scripts/validate-llms-txt-links.ts b/apps/website/scripts/validate-llms-txt-links.ts index e59a470976d..d358d84ad2f 100644 --- a/apps/website/scripts/validate-llms-txt-links.ts +++ b/apps/website/scripts/validate-llms-txt-links.ts @@ -1,7 +1,12 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs' -import { join, relative } from 'node:path' +import { join, relative, sep } from 'node:path' -import { findStaleLinks, isWorkflowsAppPath } from '@/lib/llms-txt' +import { + findStaleLinks, + isLinkedFile, + isWorkflowsAppPath, + sectionLlmsFiles +} from '@/lib/llms-txt' const DIST_DIR = join(process.cwd(), 'dist') const CANONICAL_LINK = /]*\brel=["']canonical["'][^>]*>/i @@ -10,8 +15,7 @@ const HREF_ATTRIBUTE = /\bhref=["']([^"']+)["']/i /** `/download` -> `dist/download/index.html`, `/hub/models.md` -> `dist/hub/models.md`. */ function distFileFor(pathname: string): string { const trimmed = pathname.replace(/^\/|\/$/g, '') - const isFile = /\.[a-z]+$/i.test(trimmed) - return isFile + return isLinkedFile(trimmed) ? join(DIST_DIR, trimmed) : join(DIST_DIR, trimmed, 'index.html') } @@ -46,10 +50,10 @@ function redirectSources(): string[] { /** `dist/llms-full.txt` plus every `llms.txt` the build wrote, root first. */ function builtLlmsFiles(): string[] { - const sectionFiles = readdirSync(DIST_DIR, { recursive: true }) - .map(String) - .filter((file) => file.endsWith('/llms.txt')) - .sort() + const sectionFiles = sectionLlmsFiles( + readdirSync(DIST_DIR, { recursive: true }).map(String), + sep + ) return ['llms.txt', 'llms-full.txt', ...sectionFiles].map((file) => join(DIST_DIR, file) ) diff --git a/apps/website/src/lib/llms-txt.test.ts b/apps/website/src/lib/llms-txt.test.ts index 2249810dd8a..39bf76eff1d 100644 --- a/apps/website/src/lib/llms-txt.test.ts +++ b/apps/website/src/lib/llms-txt.test.ts @@ -5,10 +5,12 @@ import { findRedirectedLinks, findStaleLinks, internalLinks, + isLinkedFile, isWorkflowsAppPath, normalizePath, parseLlmsTxtLinks, - redirectSourcePattern + redirectSourcePattern, + sectionLlmsFiles } from './llms-txt' describe('parseLlmsTxtLinks', () => { @@ -131,7 +133,9 @@ describe('redirectSourcePattern', () => { '/posts/:id(\\d+)', '/payment/(.*)', '/p/:slug(a|b)?', - '/p/:slug(a|(b))' + '/p/:slug(a|(b))', + '/cloud{/enterprise}', + '/docs\\.md' ])('rejects unsupported source syntax %s', (source) => { expect(() => redirectSourcePattern(source)).toThrow(/Unsupported/) }) @@ -330,3 +334,31 @@ describe('findCanonicalDrift', () => { ]) }) }) + +describe('isLinkedFile', () => { + it.for([ + ['/hub/models.md', true], + ['/hub/models/local/llms.txt', true], + ['/sitemap-index.xml', true], + ['/models/catalogue.json', true], + ['/models/flux.dev', false], + ['/models/ltx-2.5', false] + ] as const)('%s is a file: %s', ([pathname, isFile]) => { + expect(isLinkedFile(pathname)).toBe(isFile) + }) +}) + +describe('sectionLlmsFiles', () => { + it.for([ + ['/', ['llms.txt', 'p/models/llms.txt', 'p/models', 'hub/llms.txt']], + ['\\', ['llms.txt', 'p\\models\\llms.txt', 'p\\models', 'hub\\llms.txt']] + ] as const)( + 'finds the section files with separator %s', + ([separator, entries]) => { + expect(sectionLlmsFiles(entries, separator)).toEqual([ + 'hub/llms.txt', + 'p/models/llms.txt' + ]) + } + ) +}) diff --git a/apps/website/src/lib/llms-txt.ts b/apps/website/src/lib/llms-txt.ts index 9695eb65b64..aaa37dad600 100644 --- a/apps/website/src/lib/llms-txt.ts +++ b/apps/website/src/lib/llms-txt.ts @@ -24,6 +24,24 @@ export function isLlmsTxtLinkLine(line: string): boolean { return LINK_LINE.test(line) } +const LINKED_FILE = /\.(md|txt|xml|json)$/i + +/** Whether a linked pathname is a file (`/hub/models.md`), not a page such as `/models/flux.dev`. */ +export function isLinkedFile(pathname: string): boolean { + return LINKED_FILE.test(pathname) +} + +/** The section `llms.txt` files among `readdirSync` entries, with `/` separators on every OS. */ +export function sectionLlmsFiles( + entries: readonly string[], + separator: string +): string[] { + return entries + .map((entry) => entry.split(separator).join('/')) + .filter((file) => file.endsWith('/llms.txt')) + .sort() +} + /** Drop a trailing slash so `/foo/` and `/foo` compare equal; keep `/` as `/`. */ export function normalizePath(path: string): string { const trimmed = path.replace(/\/+$/, '') @@ -43,7 +61,7 @@ export function internalLinks( const SOURCE_PARAM = /(\/:\w+\*|:\w+\+|:\w+\([^()]*\)|:\w+)/ const LITERAL_ALTERNATIVE = /^[\w.~-]+$/ -const UNSUPPORTED_SOURCE_SYNTAX = /[()?*+]/ +const UNSUPPORTED_SOURCE_SYNTAX = /[(){}?*+\\]/ function escapeRegExp(text: string): string { return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') From 2d1fab831678b21628a247784ecdb8ddb99098d7 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 6 Oct 2026 10:56:15 +0000 Subject: [PATCH 9/9] [automated] Apply ESLint and Oxfmt fixes --- src/components/common/WorkflowActionsList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/WorkflowActionsList.vue b/src/components/common/WorkflowActionsList.vue index 03b67459709..66249f6632b 100644 --- a/src/components/common/WorkflowActionsList.vue +++ b/src/components/common/WorkflowActionsList.vue @@ -44,7 +44,7 @@ const { {{ item.label }} {{ item.badge }}