the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix(docs): apply llms patch during website builds
Ogulcan Celikb710176fd23f
diff --git a/website/bun.lock b/website/bun.lockindex 4255507b8..28bac73d1 100644--- a/website/bun.lock+++ b/website/bun.lock@@ -12,9 +12,6 @@},},},- "patchedDependencies": {- "[email protected]": "patches/[email protected]",- },"packages": {"@astrojs/compiler": ["@astrojs/[email protected]", "", {}, "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg=="],diff --git a/website/package.json b/website/package.jsonindex d3c35a890..d4474007c 100644--- a/website/package.json+++ b/website/package.json@@ -4,10 +4,11 @@"type": "module","scripts": {"prepare-docs": "node scripts/prepare-docs.mjs",- "dev": "node scripts/prepare-docs.mjs --draft && astro dev",+ "prepare-llms": "node scripts/patch-starlight-llms.mjs",+ "dev": "bun run prepare-llms && node scripts/prepare-docs.mjs --draft && astro dev","test": "bun test",- "build": "bun run test && node scripts/prepare-docs.mjs && astro build && node scripts/check-built-docs.mjs",- "build:draft": "node scripts/prepare-docs.mjs --draft && astro build && node scripts/check-built-docs.mjs",+ "build": "bun run test && bun run prepare-llms && node scripts/prepare-docs.mjs && astro build && node scripts/check-built-docs.mjs",+ "build:draft": "bun run prepare-llms && node scripts/prepare-docs.mjs --draft && astro build && node scripts/check-built-docs.mjs","preview": "astro preview"},"dependencies": {@@ -15,8 +16,5 @@"@astrojs/starlight": "^0.36.0","astro": "^5.0.0","starlight-llms-txt": "0.6.1"- },- "patchedDependencies": {- "[email protected]": "patches/[email protected]"}}diff --git a/website/patches/[email protected] b/website/patches/[email protected]deleted file mode 100644index b59049c06..000000000--- a/website/patches/[email protected]+++ /dev/null@@ -1,18 +0,0 @@-diff --git a/llms-full.txt.ts b/llms-full.txt.ts-index cdc3a34c0555c4a556224f63d937d976c669eef0..45d60f54994240e93277021cb649237c4874f4ce 100644---- a/llms-full.txt.ts-+++ b/llms-full.txt.ts-@@ -1,4 +1,5 @@- import type { APIRoute } from 'astro';-+import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context';- import { generateLlmsTxt } from './generator';- import { getSiteTitle } from './utils';--@@ -9,6 +10,7 @@ export const GET: APIRoute = async (context) => {- const body = await generateLlmsTxt(context, {- minify: false,- description: `This is the full developer documentation for ${getSiteTitle()}`,-+ exclude: starlightLllmsTxtContext.exclude,- });- return new Response(body);- };diff --git a/website/scripts/patch-starlight-llms.mjs b/website/scripts/patch-starlight-llms.mjsnew file mode 100644index 000000000..16d3ba9ba--- /dev/null+++ b/website/scripts/patch-starlight-llms.mjs@@ -0,0 +1,24 @@+import { readFile, writeFile } from 'node:fs/promises';+import { resolve } from 'node:path';++const path = resolve('node_modules/starlight-llms-txt/llms-full.txt.ts');+const original = await readFile(path, 'utf8');+const importLine = "import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context';";+const excludeLine = '\t\texclude: starlightLllmsTxtContext.exclude,';++if (original.includes(importLine) && original.includes(excludeLine)) process.exit(0);++const withImport = original.replace(+ "import { generateLlmsTxt } from './generator';",+ `${importLine}\nimport { generateLlmsTxt } from './generator';`,+);+const patched = withImport.replace(+ '\t\tdescription: `This is the full developer documentation for ${getSiteTitle()}`,',+ '\t\tdescription: `This is the full developer documentation for ${getSiteTitle()}`,\n' + excludeLine,+);++if (patched === original || !patched.includes(importLine) || !patched.includes(excludeLine)) {+ throw new Error('starlight-llms-txt changed: update the stable-only llms-full compatibility patch');+}++await writeFile(path, patched, 'utf8');