Skip to content

Commit 448eac0

Browse files
committed
fix(llm-docs): rename llms_full.txt to llms-full.txt
Use hyphenated naming convention (llms-full.txt) to match the community standard used by Anthropic, GitBook, Fern, and others.
1 parent 456017b commit 448eac0

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

scripts/smoke-test-llm-docs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Smoke test all llm-docs routes (llms.txt, llms_full.txt, .md)
3+
# Smoke test all llm-docs routes (llms.txt, llms-full.txt, .md)
44
# Usage: ./scripts/smoke-test-llm-docs.sh http://localhost:3333
55

66
set -euo pipefail
@@ -33,24 +33,24 @@ check "Root llms.txt" "$BASE/llms.txt"
3333
echo ""
3434
echo "=== Unscoped package (latest) ==="
3535
check "llms.txt" "$BASE/package/nuxt/llms.txt"
36-
check "llms_full.txt" "$BASE/package/nuxt/llms_full.txt"
36+
check "llms-full.txt" "$BASE/package/nuxt/llms-full.txt"
3737
check ".md" "$BASE/package/nuxt.md"
3838

3939
echo ""
4040
echo "=== Unscoped package (versioned) ==="
4141
check "llms.txt" "$BASE/package/nuxt/v/3.16.2/llms.txt"
42-
check "llms_full.txt" "$BASE/package/nuxt/v/3.16.2/llms_full.txt"
42+
check "llms-full.txt" "$BASE/package/nuxt/v/3.16.2/llms-full.txt"
4343

4444
echo ""
4545
echo "=== Scoped package (latest) ==="
4646
check "llms.txt" "$BASE/package/@nuxt/kit/llms.txt"
47-
check "llms_full.txt" "$BASE/package/@nuxt/kit/llms_full.txt"
47+
check "llms-full.txt" "$BASE/package/@nuxt/kit/llms-full.txt"
4848
check ".md" "$BASE/package/@nuxt/kit.md"
4949

5050
echo ""
5151
echo "=== Scoped package (versioned) ==="
5252
check "llms.txt" "$BASE/package/@nuxt/kit/v/4.3.1/llms.txt"
53-
check "llms_full.txt" "$BASE/package/@nuxt/kit/v/4.3.1/llms_full.txt"
53+
check "llms-full.txt" "$BASE/package/@nuxt/kit/v/4.3.1/llms-full.txt"
5454

5555
echo ""
5656
echo "=== Org-level ==="

server/middleware/canonical-redirects.global.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export default defineEventHandler(async event => {
5656
}
5757

5858
// /@org/pkg or /pkg → /package/org/pkg or /package/pkg
59-
// Also handles trailing /llms.txt or /llms_full.txt suffixes
59+
// Also handles trailing /llms.txt or /llms-full.txt suffixes
6060
let pkgMatch = path.match(
61-
/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+?)(?<suffix>\.md|\/(?:llms\.txt|llms_full\.txt))?$/,
61+
/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+?)(?<suffix>\.md|\/(?:llms\.txt|llms-full\.txt))?$/,
6262
)
6363
if (pkgMatch?.groups) {
6464
const args = [pkgMatch.groups.org, pkgMatch.groups.name].filter(Boolean).join('/')
@@ -69,13 +69,13 @@ export default defineEventHandler(async event => {
6969

7070
// /@org/pkg/v/version or /@org/pkg@version → /package/org/pkg/v/version
7171
// /pkg/v/version or /pkg@version → /package/pkg/v/version
72-
// Also handles trailing /llms.txt or /llms_full.txt suffixes
72+
// Also handles trailing /llms.txt or /llms-full.txt suffixes
7373
const pkgVersionMatch =
7474
path.match(
75-
/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+)\/v\/(?<version>[^/]+)(?<suffix>\/(?:llms\.txt|llms_full\.txt))?$/,
75+
/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+)\/v\/(?<version>[^/]+)(?<suffix>\/(?:llms\.txt|llms-full\.txt))?$/,
7676
) ||
7777
path.match(
78-
/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+)@(?<version>[^/]+)(?<suffix>\/(?:llms\.txt|llms_full\.txt))?$/,
78+
/^\/(?:(?<org>@[^/]+)\/)?(?<name>[^/@]+)@(?<version>[^/]+)(?<suffix>\/(?:llms\.txt|llms-full\.txt))?$/,
7979
)
8080

8181
if (pkgVersionMatch?.groups) {

server/middleware/llm-docs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
const CACHE_HEADER = 's-maxage=3600, stale-while-revalidate=86400'
1212

1313
/**
14-
* Middleware to handle ALL llms.txt / llms_full.txt / .md routes.
14+
* Middleware to handle ALL llms.txt / llms-full.txt / .md routes.
1515
*
1616
* All llms.txt handling lives here rather than in file-based routes because
1717
* Vercel's ISR route rules with glob patterns (e.g. `/package/ ** /llms.txt`)
@@ -24,13 +24,13 @@ const CACHE_HEADER = 's-maxage=3600, stale-while-revalidate=86400'
2424
* - /package/@:org/:name.md (scoped, latest, raw README)
2525
* - /package/@:org/llms.txt (org package listing)
2626
* - /package/:name/llms.txt (unscoped, latest)
27-
* - /package/:name/llms_full.txt (unscoped, latest, full)
27+
* - /package/:name/llms-full.txt (unscoped, latest, full)
2828
* - /package/@:org/:name/llms.txt (scoped, latest)
29-
* - /package/@:org/:name/llms_full.txt (scoped, latest, full)
29+
* - /package/@:org/:name/llms-full.txt (scoped, latest, full)
3030
* - /package/:name/v/:version/llms.txt (unscoped, versioned)
31-
* - /package/:name/v/:version/llms_full.txt (unscoped, versioned, full)
31+
* - /package/:name/v/:version/llms-full.txt (unscoped, versioned, full)
3232
* - /package/@:org/:name/v/:version/llms.txt (scoped, versioned)
33-
* - /package/@:org/:name/v/:version/llms_full.txt (scoped, versioned, full)
33+
* - /package/@:org/:name/v/:version/llms-full.txt (scoped, versioned, full)
3434
*/
3535
export default defineEventHandler(async event => {
3636
const path = event.path.split('?')[0] ?? '/'
@@ -58,10 +58,10 @@ export default defineEventHandler(async event => {
5858
}
5959
}
6060

61-
if (!path.endsWith('/llms.txt') && !path.endsWith('/llms_full.txt')) return
61+
if (!path.endsWith('/llms.txt') && !path.endsWith('/llms-full.txt')) return
6262

63-
const full = path.endsWith('/llms_full.txt')
64-
const suffix = full ? '/llms_full.txt' : '/llms.txt'
63+
const full = path.endsWith('/llms-full.txt')
64+
const suffix = full ? '/llms-full.txt' : '/llms.txt'
6565

6666
// Root /llms.txt
6767
if (path === '/llms.txt') {
@@ -129,7 +129,7 @@ export default defineEventHandler(async event => {
129129
} catch (error: unknown) {
130130
handleApiError(error, {
131131
statusCode: 502,
132-
message: `Failed to generate ${full ? 'llms_full.txt' : 'llms.txt'}.`,
132+
message: `Failed to generate ${full ? 'llms-full.txt' : 'llms.txt'}.`,
133133
})
134134
}
135135
})

server/utils/llm-docs.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function parseRepoUrl(
210210
*
211211
* When `includeAgentFiles` is false (default, for llms.txt), skips the file tree
212212
* fetch and agent file discovery entirely — only returns README + metadata.
213-
* When true (for llms_full.txt), includes agent instruction files.
213+
* When true (for llms-full.txt), includes agent instruction files.
214214
*/
215215
export async function handleLlmsTxt(
216216
packageName: string,
@@ -358,21 +358,21 @@ export function generateRootLlmsTxt(baseUrl: string): string {
358358
`- \`${baseUrl}/package/@<org>/<name>/v/<version>/llms.txt\` — scoped package (specific version)`,
359359
)
360360
lines.push('')
361-
lines.push('### Full Package Documentation (llms_full.txt)')
361+
lines.push('### Full Package Documentation (llms-full.txt)')
362362
lines.push('')
363363
lines.push(
364364
'README, package metadata, and agent instruction files (CLAUDE.md, .cursorrules, etc.).',
365365
)
366366
lines.push('')
367-
lines.push(`- \`${baseUrl}/package/<name>/llms_full.txt\` — unscoped package (latest version)`)
367+
lines.push(`- \`${baseUrl}/package/<name>/llms-full.txt\` — unscoped package (latest version)`)
368368
lines.push(
369-
`- \`${baseUrl}/package/<name>/v/<version>/llms_full.txt\` — unscoped package (specific version)`,
369+
`- \`${baseUrl}/package/<name>/v/<version>/llms-full.txt\` — unscoped package (specific version)`,
370370
)
371371
lines.push(
372-
`- \`${baseUrl}/package/@<org>/<name>/llms_full.txt\` — scoped package (latest version)`,
372+
`- \`${baseUrl}/package/@<org>/<name>/llms-full.txt\` — scoped package (latest version)`,
373373
)
374374
lines.push(
375-
`- \`${baseUrl}/package/@<org>/<name>/v/<version>/llms_full.txt\` — scoped package (specific version)`,
375+
`- \`${baseUrl}/package/@<org>/<name>/v/<version>/llms-full.txt\` — scoped package (specific version)`,
376376
)
377377
lines.push('')
378378
lines.push('### Organization Packages (llms.txt)')
@@ -391,7 +391,7 @@ export function generateRootLlmsTxt(baseUrl: string): string {
391391
lines.push('## Examples')
392392
lines.push('')
393393
lines.push(`- [nuxt llms.txt](${baseUrl}/package/nuxt/llms.txt)`)
394-
lines.push(`- [nuxt llms_full.txt](${baseUrl}/package/nuxt/llms_full.txt)`)
394+
lines.push(`- [nuxt llms-full.txt](${baseUrl}/package/nuxt/llms-full.txt)`)
395395
lines.push(`- [@nuxt/kit llms.txt](${baseUrl}/package/@nuxt/kit/llms.txt)`)
396396
lines.push(`- [@nuxt org packages](${baseUrl}/package/@nuxt/llms.txt)`)
397397
lines.push(`- [nuxt README](${baseUrl}/package/nuxt.md)`)

test/unit/server/utils/llm-docs.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ describe('generateRootLlmsTxt', () => {
310310
expect(output).toContain('https://npmx.dev/package/<name>/v/<version>/llms.txt')
311311
expect(output).toContain('https://npmx.dev/package/@<org>/<name>/llms.txt')
312312
expect(output).toContain('https://npmx.dev/package/@<org>/<name>/v/<version>/llms.txt')
313-
expect(output).toContain('https://npmx.dev/package/<name>/llms_full.txt')
313+
expect(output).toContain('https://npmx.dev/package/<name>/llms-full.txt')
314314
expect(output).toContain('https://npmx.dev/package/@<org>/llms.txt')
315315
})
316316

0 commit comments

Comments
 (0)