Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/website/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment thread
MaanilVerma marked this conversation as resolved.
Resolved
Comment thread
MaanilVerma marked this conversation as resolved.
Resolved
- 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

Expand All @@ -59,7 +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.
- [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`.
- [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 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.
Expand Down Expand Up @@ -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/): 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.
Expand Down
77 changes: 49 additions & 28 deletions apps/website/scripts/validate-llms-txt-links.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,64 @@
import { existsSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { existsSync, readFileSync, readdirSync } from 'node:fs'
import { join, relative, sep } from 'node:path'

import { findCanonicalDrift, parseLlmsTxtLinks } from '@/lib/llms-txt'
import {
findStaleLinks,
isLinkedFile,
isWorkflowsAppPath,
sectionLlmsFiles
} from '@/lib/llms-txt'

const DIST_DIR = join(process.cwd(), 'dist')
const CANONICAL_LINK = /<link\b[^>]*\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')
return isLinkedFile(trimmed)
? 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 = sectionLlmsFiles(
readdirSync(DIST_DIR, { recursive: true }).map(String),
sep
)
return ['llms.txt', 'llms-full.txt', ...sectionFiles].map((file) =>
join(DIST_DIR, file)
)
}

function main(): void {
if (!existsSync(DIST_DIR)) {
console.error(
Expand All @@ -43,27 +67,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`
)
}

Expand Down
39 changes: 9 additions & 30 deletions apps/website/src/config/llms-txt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
findRedirectedLinks,
internalLinks,
isLlmsTxtLinkLine,
isWorkflowsAppPath,
normalizePath,
parseLlmsTxtLinks
} from '@/lib/llms-txt'
Expand All @@ -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<string>(
(
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.
Expand Down Expand Up @@ -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<string>
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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([])
Expand Down
Loading
Loading