Skip to content

chore: provide smaller llms-small.txt #1321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 25, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { error } from '@sveltejs/kit';
import svelte from '../../../../llms-small.txt/content-svelte.md?raw';
import sveltekit from '../../../../llms-small.txt/content-sveltekit.md?raw';

export const prerender = true;

export function entries() {
return [
{ topic: 'svelte', path: '' },
{ topic: 'kit', path: '' }
];
}

export function GET({ params }) {
if ((params.topic !== 'svelte' && params.topic !== 'kit') || params.path) {
error(404, 'Not Found');
}

const content = params.topic === 'kit' ? sveltekit : svelte;

return new Response(content, {
status: 200,
headers: {
'Content-Type': 'text/plain; charset=utf-8',
'Cache-Control': 'public, max-age=3600'
}
});
}
16 changes: 13 additions & 3 deletions apps/svelte.dev/src/routes/docs/llms/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@
the CLI
</li>
<li>
<a href="/llms-small.txt">/llms-small.txt</a> — compressed documentation for use with smaller
<a href="/llms-medium.txt">/llms-medium.txt</a> — compressed documentation for use with medium
context windows
</li>
<li>
<a href="/llms-small.txt">/llms-small.txt</a> — highly compressed documentation for use with
smaller context windows
</li>
</ul>

<p>...and package-level documentation:</p>

<ul>
<li><a href="/docs/svelte/llms.txt">/docs/svelte/llms.txt</a></li>
<li><a href="/docs/kit/llms.txt">/docs/kit/llms.txt</a></li>
<li>
<a href="/docs/svelte/llms.txt">/docs/svelte/llms.txt</a> /
<a href="/docs/svelte/llms-small.txt">/docs/svelte/llms-small.txt</a>
</li>
<li>
<a href="/docs/kit/llms.txt">/docs/kit/llms.txt</a> /
<a href="/docs/kit/llms-small.txt">/docs/kit/llms-small.txt</a>
</li>
<li><a href="/docs/cli/llms.txt">/docs/cli/llms.txt</a></li>
</ul>
</Text>
Expand Down
47 changes: 47 additions & 0 deletions apps/svelte.dev/src/routes/llms-medium.txt/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { generate_llm_content, sections } from '$lib/server/llms';

export function GET() {
const main_content = generate_llm_content({
sections,
ignore: [
// Svelte ignores
'docs/svelte/legacy/**/*',
'docs/svelte/misc/custom-elements',
'docs/svelte/misc/v4-migration-guide',
'docs/svelte/misc/v5-migration-guide',
'docs/svelte/misc/faq',
'docs/svelte/reference/compiler-errors',
'docs/svelte/reference/compiler-warnings',
'docs/svelte/reference/runtime-errors',
'docs/svelte/reference/runtime-warnings',
'docs/svelte/reference/svelte-legacy',
'**/xx-*',

// SvelteKit ignores
'docs/kit/advanced/packaging',
'docs/kit/appendix/**/*',
'docs/kit/best-practices/performance',
'docs/kit/build-and-deploy/*adapter-*',
'docs/kit/build-and-deploy/writing-adapters'
],
minimize: {
remove_legacy: true,
remove_note_blocks: true,
remove_details_blocks: true,
remove_playground_links: true,
remove_prettier_ignore: true,
normalize_whitespace: true
}
});
const content = `<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n${main_content}`;

return new Response(content, {
status: 200,
headers: {
'Content-Type': 'text/plain; charset=utf-8',
'Cache-Control': 'public, max-age=3600'
}
});
}

export const prerender = true;
39 changes: 5 additions & 34 deletions apps/svelte.dev/src/routes/llms-small.txt/+server.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
import { generate_llm_content, sections } from '$lib/server/llms';
import svelte from './content-svelte.md?raw';
import sveltekit from './content-sveltekit.md?raw';

export function GET() {
const main_content = generate_llm_content({
sections,
ignore: [
// Svelte ignores
'docs/svelte/legacy/**/*',
'docs/svelte/misc/custom-elements',
'docs/svelte/misc/v4-migration-guide',
'docs/svelte/misc/v5-migration-guide',
'docs/svelte/misc/faq',
'docs/svelte/reference/compiler-errors',
'docs/svelte/reference/compiler-warnings',
'docs/svelte/reference/runtime-errors',
'docs/svelte/reference/runtime-warnings',
'docs/svelte/reference/svelte-legacy',
'**/xx-*',

// SvelteKit ignores
'docs/kit/advanced/packaging',
'docs/kit/appendix/**/*',
'docs/kit/best-practices/performance',
'docs/kit/build-and-deploy/*adapter-*',
'docs/kit/build-and-deploy/writing-adapters'
],
minimize: {
remove_legacy: true,
remove_note_blocks: true,
remove_details_blocks: true,
remove_playground_links: true,
remove_prettier_ignore: true,
normalize_whitespace: true
}
});
const content = `<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n${main_content}`;
const content =
'<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>\n\n' +
`# Svelte documentation\n\n${svelte}\n\n# SvelteKit documentation\n\n${sveltekit}`;

return new Response(content, {
status: 200,
Expand Down
Loading