Skip to content

Commit 4ecda11

Browse files
Link OpenAPI spec from llms.txt and robots.txt (#69)
- Add src/pages/openapi.yaml.ts endpoint to serve the raw spec at /openapi.yaml - Add optionalLinks to starlight-llms-txt config so llms.txt references the spec - Add Llms-Txt and OpenAPI directives to robots.txt Co-authored-by: Oz <oz-agent@warp.dev>
1 parent 64e82c6 commit 4ecda11

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

astro.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ export default defineConfig({
148148
// widely consumed by AI agents.
149149
starlightLlmsTxt({
150150
projectName: 'Warp',
151+
optionalLinks: [
152+
{
153+
label: 'Oz Agent API (OpenAPI spec)',
154+
url: 'https://docs.warp.dev/openapi.yaml',
155+
description: 'Machine-readable OpenAPI 3.0 specification for the Oz Agent API.',
156+
},
157+
],
151158
// Excludes pages that cause a stack overflow in hast-util-to-text
152159
// due to their size. The upstream plugin only applies `exclude` to
153160
// llms-small.txt; our patch (patches/starlight-llms-txt+0.8.1.patch)

public/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Disallow: /*?*ask=*
55
Content-Signal: ai-train=yes, search=yes, ai-input=yes
66

77
Sitemap: https://docs.warp.dev/sitemap-index.xml
8+
Llms-Txt: https://docs.warp.dev/llms.txt
9+
OpenAPI: https://docs.warp.dev/openapi.yaml

src/pages/openapi.yaml.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { APIRoute } from 'astro';
2+
import fs from 'node:fs';
3+
4+
export const prerender = true;
5+
6+
/**
7+
* Serves the raw Oz Agent API OpenAPI spec at /openapi.yaml so LLMs, crawlers,
8+
* and developer tooling can consume the machine-readable definition directly.
9+
*
10+
* The spec source of truth is `developers/agent-api-openapi.yaml` (same file
11+
* that `src/pages/api.astro` reads at build time for the Scalar reference).
12+
*/
13+
export const GET: APIRoute = async () => {
14+
const yaml = fs.readFileSync('developers/agent-api-openapi.yaml', 'utf-8');
15+
return new Response(yaml, {
16+
headers: { 'Content-Type': 'text/yaml; charset=utf-8' },
17+
});
18+
};

0 commit comments

Comments
 (0)