diff --git a/docs/src/app/llms-full.txt/route.ts b/docs/src/app/llms-full.txt/route.ts new file mode 100644 index 000000000..efb8a431c --- /dev/null +++ b/docs/src/app/llms-full.txt/route.ts @@ -0,0 +1,20 @@ +import { getLLMText } from 'lib/get-llm-text'; +import { apiSource, source } from 'lib/source'; + +// cached forever +export const revalidate = false; + +export async function GET() { + const docsPages = source.getPages(); + const apiPages = apiSource.getPages(); + + const docsPromises = docsPages.map(getLLMText); + const apiPromises = apiPages.map(getLLMText); + + const [docsContent, apiContent] = await Promise.all([ + Promise.all(docsPromises), + Promise.all(apiPromises) + ]); + + return new Response([...docsContent, ...apiContent].join('\n\n')); +} diff --git a/docs/src/app/llms.txt/route.ts b/docs/src/app/llms.txt/route.ts index bb86882fb..c2e4a2c8e 100644 --- a/docs/src/app/llms.txt/route.ts +++ b/docs/src/app/llms.txt/route.ts @@ -1,25 +1,36 @@ -import { getLLMText } from 'lib/get-llm-text'; import { apiSource, source } from 'lib/source'; // cached forever export const revalidate = false; +function formatPageListItem(page: { + data: { + title: string; + description?: string; + }; + url: string; +}) { + const description = page.data.description?.trim(); + const notes = description ? `: ${description.replace(/\n+/g, ' ')}` : ''; + return `- [${page.data.title}](https://docs.hexclave.com${page.url}.md)${notes}`; +} + export async function GET() { - // Get all pages from both main docs and API docs const docsPages = source.getPages(); const apiPages = apiSource.getPages(); - // Process all pages - const docsPromises = docsPages.map(getLLMText); - const apiPromises = apiPages.map(getLLMText); + const docs = docsPages.map(formatPageListItem).join('\n'); + const api = apiPages.map(formatPageListItem).join('\n'); - const [docsContent, apiContent] = await Promise.all([ - Promise.all(docsPromises), - Promise.all(apiPromises) - ]); + return new Response(`# Hexclave - // Combine all content - const allContent = [...docsContent, ...apiContent]; +> Hexclave is an authentication and user management platform for SaaS apps, with teams, RBAC, payments, and analytics. Formerly Stack Auth. - return new Response(allContent.join('\n\n')); +## Docs + +${docs} + +## API Reference + +${api}`); } diff --git a/packages/shared/src/ai/llms/llms.ts b/packages/shared/src/ai/llms/llms.ts index 3b439586b..6fe86bd4d 100644 --- a/packages/shared/src/ai/llms/llms.ts +++ b/packages/shared/src/ai/llms/llms.ts @@ -6,7 +6,16 @@ import { buildSkillSitePrompt, skillSitePrompt } from "../unified-prompts/skill- export const llmsTxt = deindent` # Hexclave + > Hexclave is an authentication and user management platform for SaaS apps, with teams, RBAC, payments, and analytics. Formerly Stack Auth. + ${remindersPrompt} + + ## Docs + + - [Full documentation](https://skill.hexclave.com/full): LLM-optimized Hexclave documentation + - [Ask questions](https://skill.hexclave.com/ask): Q&A endpoint for Hexclave + - [Human documentation](https://docs.hexclave.com): Browse the docs, or add \`.md\` to a page URL for markdown + - [MCP server](https://mcp.hexclave.com): Hexclave documentation for MCP clients `; export const llmsFullTxt = skillSitePrompt;