feat: make llms text endpoints spec compliant

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>
This commit is contained in:
Devin AI 2026-07-18 23:42:55 +00:00
parent 0814755e88
commit d20adaeef5
3 changed files with 52 additions and 12 deletions

View File

@ -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'));
}

View File

@ -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}`);
}

View File

@ -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;