@vllnt/next-llms 0.1.0-canary.bfc9152 → 0.1.0-canary.e0fc10f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -13
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +0 -35
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/index.test.ts +1 -52
- package/src/index.ts +0 -4
- package/src/types.ts +0 -38
- package/dist/llms-full.d.ts +0 -14
- package/dist/llms-full.d.ts.map +0 -1
- package/dist/llms-full.js +0 -31
- package/dist/llms-full.js.map +0 -1
- package/src/llms-full.ts +0 -34
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# @vllnt/next-llms
|
|
8
8
|
|
|
9
9
|
Make your Next.js site legible to AI agents — generate a spec-compliant
|
|
10
|
-
`llms.txt`
|
|
10
|
+
`llms.txt` manifest and serve any page as raw markdown.
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
13
|
// app/llms.txt/route.ts
|
|
@@ -30,18 +30,15 @@ export function GET() {
|
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Emit the `llms.txt` index and
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Remix, Hono, Deno, …).
|
|
33
|
+
Emit the `llms.txt` index and expose any page's markdown at `/path.md` so agents
|
|
34
|
+
skip HTML parsing. Zero runtime dependencies — pure Web-standard APIs that run
|
|
35
|
+
in any Next.js runtime (and Remix, Hono, Deno, …).
|
|
37
36
|
|
|
38
37
|
## Features
|
|
39
38
|
|
|
40
39
|
- **Spec-compliant `llms.txt`** — `generateLlmsText` emits the llmstxt.org
|
|
41
40
|
shape: an `#` title, a `>` blockquote, `## Section` link lists, and a
|
|
42
41
|
droppable `## Optional` section.
|
|
43
|
-
- **`llms-full.txt` companion** — `generateLlmsFullText` inlines every page's
|
|
44
|
-
full markdown so an agent reads the whole site in one request.
|
|
45
42
|
- **Raw-markdown routes** — `createMarkdownRoute` serves any page as
|
|
46
43
|
`text/markdown`, stripping a trailing `.md` and resolving the slug through
|
|
47
44
|
your own content source.
|
|
@@ -55,10 +52,15 @@ Remix, Hono, Deno, …).
|
|
|
55
52
|
## Installation
|
|
56
53
|
|
|
57
54
|
```bash
|
|
58
|
-
pnpm add @vllnt/next-llms
|
|
55
|
+
pnpm add @vllnt/next-llms@canary
|
|
59
56
|
```
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
Node.js `>=18`; no peer dependencies. This README follows current main and the
|
|
59
|
+
`canary` channel (`0.1.0-canary.3cfe2be` at this audit). npm `latest` also
|
|
60
|
+
points to a prerelease, but an older one (`0.1.0-canary.bca5ab7`), so an
|
|
61
|
+
untagged install does not select current main. There is no stable release on
|
|
62
|
+
`latest` yet. Pin the resolved prerelease and test upgrades. Current main
|
|
63
|
+
removed the older `generateLlmsFullText` API; use the two exports below.
|
|
62
64
|
|
|
63
65
|
## Usage
|
|
64
66
|
|
|
@@ -80,10 +82,11 @@ with `Content-Type: text/markdown`, or `404` when the resolver returns `null`.
|
|
|
80
82
|
| Export | Kind | Result |
|
|
81
83
|
| ----------------------------------------- | -------- | ----------------------------------------- |
|
|
82
84
|
| `generateLlmsText(config)` | function | `string` — the `llms.txt` index |
|
|
83
|
-
| `generateLlmsFullText(config)` | function | `string` — the `llms-full.txt` bundle |
|
|
84
85
|
| `createMarkdownRoute(resolver, options?)` | factory | `(request: Request) => Promise<Response>` |
|
|
85
86
|
|
|
86
|
-
Full reference: [docs/API.md](docs/API.md).
|
|
87
|
+
Full reference: [docs/API.md](docs/API.md). Also see the [LLM index](llms.txt),
|
|
88
|
+
[changelog](CHANGELOG.md), and
|
|
89
|
+
[issue tracker](https://github.com/vllnt/next-llms/issues).
|
|
87
90
|
|
|
88
91
|
## Security
|
|
89
92
|
|
|
@@ -91,9 +94,12 @@ Full reference: [docs/API.md](docs/API.md).
|
|
|
91
94
|
resolver returns.
|
|
92
95
|
- Your resolver is the boundary — validate and authorize the slug before
|
|
93
96
|
returning content.
|
|
94
|
-
-
|
|
97
|
+
- Successful responses default to **public caching** (one hour in browsers, one
|
|
98
|
+
day in shared caches). For private or personalized content, explicitly pass
|
|
99
|
+
`{ cacheControl: "private, no-store" }`; authorization alone does not disable
|
|
100
|
+
caching.
|
|
95
101
|
|
|
96
|
-
See [docs/API.md](docs/API.md).
|
|
102
|
+
See [docs/API.md](docs/API.md) and the [security reporting policy](SECURITY.md).
|
|
97
103
|
|
|
98
104
|
## Testing
|
|
99
105
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { generateLlmsFullText } from "./llms-full.js";
|
|
2
1
|
export { generateLlmsText } from "./llms-text.js";
|
|
3
2
|
export { createMarkdownRoute } from "./markdown-route.js";
|
|
4
|
-
export type { LlmsConfig,
|
|
3
|
+
export type { LlmsConfig, LlmsLink, LlmsSection, MarkdownResolver, MarkdownRouteOptions, } from "./types.js";
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -39,41 +39,6 @@ export type LlmsConfig = {
|
|
|
39
39
|
*/
|
|
40
40
|
optional?: LlmsLink[];
|
|
41
41
|
};
|
|
42
|
-
/**
|
|
43
|
-
* A page whose full markdown content goes inline into `llms-full.txt`.
|
|
44
|
-
*/
|
|
45
|
-
export type LlmsFullPage = {
|
|
46
|
-
/** Page title, rendered as a `### {title}` heading. */
|
|
47
|
-
title: string;
|
|
48
|
-
/** Optional source URL, rendered as a `Source: {url}` line under the title. */
|
|
49
|
-
url?: string;
|
|
50
|
-
/** The page's full markdown content. */
|
|
51
|
-
content: string;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* A named group of pages in `llms-full.txt`, rendered as a `## {title}` section.
|
|
55
|
-
*/
|
|
56
|
-
export type LlmsFullSection = {
|
|
57
|
-
/** Section heading, rendered as `## {title}`. */
|
|
58
|
-
title: string;
|
|
59
|
-
/** Pages whose content goes inline under the section. */
|
|
60
|
-
pages: LlmsFullPage[];
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Input for {@link generateLlmsFullText} — the expanded `llms-full.txt` manifest.
|
|
64
|
-
*
|
|
65
|
-
* @see https://llmstxt.org
|
|
66
|
-
*/
|
|
67
|
-
export type LlmsFullConfig = {
|
|
68
|
-
/** Site/project name, rendered as the `# {title}` H1. */
|
|
69
|
-
title: string;
|
|
70
|
-
/** One-line summary, rendered as a `> {summary}` blockquote. */
|
|
71
|
-
summary?: string;
|
|
72
|
-
/** Free-form markdown shown after the blockquote. */
|
|
73
|
-
details?: string;
|
|
74
|
-
/** Sections whose pages go inline in full. */
|
|
75
|
-
sections: LlmsFullSection[];
|
|
76
|
-
};
|
|
77
42
|
/**
|
|
78
43
|
* Maps a route slug to its markdown content, or `null` if there is no page for
|
|
79
44
|
* the slug. The slug is the path segments with any trailing `.md` stripped.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,MAAM,EAAE,KACX,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vllnt/next-llms",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
4
|
-
"description": "AI discoverability for Next.js sites — generate
|
|
3
|
+
"version": "0.1.0-canary.e0fc10f",
|
|
4
|
+
"description": "AI discoverability for Next.js sites — generate an llms.txt manifest and serve any page as raw markdown",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"packageManager": "pnpm@9.15.4",
|
|
@@ -29,15 +29,14 @@
|
|
|
29
29
|
"test": "vitest run --passWithNoTests",
|
|
30
30
|
"test:watch": "vitest --typecheck --clearScreen false",
|
|
31
31
|
"test:coverage": "vitest run --coverage --coverage.reporter=text",
|
|
32
|
-
"
|
|
33
|
-
"preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test:coverage && pnpm typecheck && pnpm generate:llms",
|
|
32
|
+
"preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test:coverage && pnpm typecheck",
|
|
34
33
|
"check:agents": "node -e \"const f=require('node:fs');if(!f.existsSync('AGENTS.md')||f.existsSync('CLAUDE.md')||f.existsSync('.claude'))process.exit(1)\""
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
36
|
"@types/node": "^20.0.0",
|
|
38
37
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
39
38
|
"@vitest/coverage-v8": "^4.1.8",
|
|
40
|
-
"@vllnt/eslint-config": "2.0.0
|
|
39
|
+
"@vllnt/eslint-config": "2.0.0",
|
|
41
40
|
"@vllnt/typescript": "2.0.0",
|
|
42
41
|
"eslint": "^9.0.0",
|
|
43
42
|
"prettier": "^3.4.0",
|
package/src/index.test.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
createMarkdownRoute,
|
|
5
|
-
generateLlmsFullText,
|
|
6
|
-
generateLlmsText,
|
|
7
|
-
} from "./index.js";
|
|
3
|
+
import { createMarkdownRoute, generateLlmsText } from "./index.js";
|
|
8
4
|
|
|
9
5
|
describe("generateLlmsText", () => {
|
|
10
6
|
it("renders a full manifest with summary, details, sections, and Optional", () => {
|
|
@@ -57,53 +53,6 @@ describe("generateLlmsText", () => {
|
|
|
57
53
|
});
|
|
58
54
|
});
|
|
59
55
|
|
|
60
|
-
describe("generateLlmsFullText", () => {
|
|
61
|
-
it("inlines page content under sections, with and without source URLs", () => {
|
|
62
|
-
const out = generateLlmsFullText({
|
|
63
|
-
title: "Acme",
|
|
64
|
-
summary: "Full text.",
|
|
65
|
-
details: "Intro.",
|
|
66
|
-
sections: [
|
|
67
|
-
{
|
|
68
|
-
title: "Docs",
|
|
69
|
-
pages: [
|
|
70
|
-
{
|
|
71
|
-
title: "Quickstart",
|
|
72
|
-
url: "/docs/quickstart",
|
|
73
|
-
content: "# QS\n\nDo this.",
|
|
74
|
-
},
|
|
75
|
-
{ title: "Reference", content: "# Ref\n\nDetails." },
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
expect(out).toBe(
|
|
82
|
-
[
|
|
83
|
-
"# Acme",
|
|
84
|
-
"> Full text.",
|
|
85
|
-
"Intro.",
|
|
86
|
-
"## Docs\n\n### Quickstart\n\nSource: /docs/quickstart\n\n# QS\n\nDo this.\n\n### Reference\n\n# Ref\n\nDetails.",
|
|
87
|
-
].join("\n\n"),
|
|
88
|
-
);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("renders a minimal full manifest (title + empty sections)", () => {
|
|
92
|
-
expect(generateLlmsFullText({ title: "Bare", sections: [] })).toBe(
|
|
93
|
-
"# Bare",
|
|
94
|
-
);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("renders a section heading with no pages when the page list is empty", () => {
|
|
98
|
-
expect(
|
|
99
|
-
generateLlmsFullText({
|
|
100
|
-
title: "T",
|
|
101
|
-
sections: [{ title: "Empty", pages: [] }],
|
|
102
|
-
}),
|
|
103
|
-
).toBe("# T\n\n## Empty");
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
56
|
describe("createMarkdownRoute", () => {
|
|
108
57
|
it("returns 200 markdown with default cache headers when the resolver resolves", async () => {
|
|
109
58
|
const handler = createMarkdownRoute(() => Promise.resolve("# Hello"));
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export { generateLlmsFullText } from "./llms-full.js";
|
|
2
1
|
export { generateLlmsText } from "./llms-text.js";
|
|
3
2
|
export { createMarkdownRoute } from "./markdown-route.js";
|
|
4
3
|
export type {
|
|
5
4
|
LlmsConfig,
|
|
6
|
-
LlmsFullConfig,
|
|
7
|
-
LlmsFullPage,
|
|
8
|
-
LlmsFullSection,
|
|
9
5
|
LlmsLink,
|
|
10
6
|
LlmsSection,
|
|
11
7
|
MarkdownResolver,
|
package/src/types.ts
CHANGED
|
@@ -42,44 +42,6 @@ export type LlmsConfig = {
|
|
|
42
42
|
optional?: LlmsLink[];
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* A page whose full markdown content goes inline into `llms-full.txt`.
|
|
47
|
-
*/
|
|
48
|
-
export type LlmsFullPage = {
|
|
49
|
-
/** Page title, rendered as a `### {title}` heading. */
|
|
50
|
-
title: string;
|
|
51
|
-
/** Optional source URL, rendered as a `Source: {url}` line under the title. */
|
|
52
|
-
url?: string;
|
|
53
|
-
/** The page's full markdown content. */
|
|
54
|
-
content: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A named group of pages in `llms-full.txt`, rendered as a `## {title}` section.
|
|
59
|
-
*/
|
|
60
|
-
export type LlmsFullSection = {
|
|
61
|
-
/** Section heading, rendered as `## {title}`. */
|
|
62
|
-
title: string;
|
|
63
|
-
/** Pages whose content goes inline under the section. */
|
|
64
|
-
pages: LlmsFullPage[];
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Input for {@link generateLlmsFullText} — the expanded `llms-full.txt` manifest.
|
|
69
|
-
*
|
|
70
|
-
* @see https://llmstxt.org
|
|
71
|
-
*/
|
|
72
|
-
export type LlmsFullConfig = {
|
|
73
|
-
/** Site/project name, rendered as the `# {title}` H1. */
|
|
74
|
-
title: string;
|
|
75
|
-
/** One-line summary, rendered as a `> {summary}` blockquote. */
|
|
76
|
-
summary?: string;
|
|
77
|
-
/** Free-form markdown shown after the blockquote. */
|
|
78
|
-
details?: string;
|
|
79
|
-
/** Sections whose pages go inline in full. */
|
|
80
|
-
sections: LlmsFullSection[];
|
|
81
|
-
};
|
|
82
|
-
|
|
83
45
|
/**
|
|
84
46
|
* Maps a route slug to its markdown content, or `null` if there is no page for
|
|
85
47
|
* the slug. The slug is the path segments with any trailing `.md` stripped.
|
package/dist/llms-full.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { LlmsFullConfig } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Generate an `llms-full.txt` manifest — the same header as `llms.txt` followed
|
|
4
|
-
* by every page's full markdown content inline, so an agent can read the whole
|
|
5
|
-
* site in a single request.
|
|
6
|
-
*
|
|
7
|
-
* Hierarchy: `# {title}` (site) → `## {section}` → `### {page}` + the page body.
|
|
8
|
-
*
|
|
9
|
-
* @param config - The manifest content with full page bodies.
|
|
10
|
-
* @returns The `llms-full.txt` file contents (no trailing newline).
|
|
11
|
-
* @see https://llmstxt.org
|
|
12
|
-
*/
|
|
13
|
-
export declare function generateLlmsFullText(config: LlmsFullConfig): string;
|
|
14
|
-
//# sourceMappingURL=llms-full.d.ts.map
|
package/dist/llms-full.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llms-full.d.ts","sourceRoot":"","sources":["../src/llms-full.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAiC,MAAM,YAAY,CAAC;AAehF;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAOnE"}
|
package/dist/llms-full.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
function renderPage(page) {
|
|
2
|
-
const head = page.url
|
|
3
|
-
? `### ${page.title}\n\nSource: ${page.url}`
|
|
4
|
-
: `### ${page.title}`;
|
|
5
|
-
return `${head}\n\n${page.content}`;
|
|
6
|
-
}
|
|
7
|
-
function renderFullSection(section) {
|
|
8
|
-
const heading = `## ${section.title}`;
|
|
9
|
-
const pages = section.pages.map(renderPage).join("\n\n");
|
|
10
|
-
return pages ? `${heading}\n\n${pages}` : heading;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Generate an `llms-full.txt` manifest — the same header as `llms.txt` followed
|
|
14
|
-
* by every page's full markdown content inline, so an agent can read the whole
|
|
15
|
-
* site in a single request.
|
|
16
|
-
*
|
|
17
|
-
* Hierarchy: `# {title}` (site) → `## {section}` → `### {page}` + the page body.
|
|
18
|
-
*
|
|
19
|
-
* @param config - The manifest content with full page bodies.
|
|
20
|
-
* @returns The `llms-full.txt` file contents (no trailing newline).
|
|
21
|
-
* @see https://llmstxt.org
|
|
22
|
-
*/
|
|
23
|
-
export function generateLlmsFullText(config) {
|
|
24
|
-
return [
|
|
25
|
-
`# ${config.title}`,
|
|
26
|
-
...(config.summary ? [`> ${config.summary}`] : []),
|
|
27
|
-
...(config.details ? [config.details] : []),
|
|
28
|
-
...config.sections.map(renderFullSection),
|
|
29
|
-
].join("\n\n");
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=llms-full.js.map
|
package/dist/llms-full.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llms-full.js","sourceRoot":"","sources":["../src/llms-full.ts"],"names":[],"mappings":"AAEA,SAAS,UAAU,CAAC,IAAkB;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG;QACnB,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,eAAe,IAAI,CAAC,GAAG,EAAE;QAC5C,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACxB,OAAO,GAAG,IAAI,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAwB;IACjD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACpD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,OAAO;QACL,KAAK,MAAM,CAAC,KAAK,EAAE;QACnB,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC;KAC1C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC"}
|
package/src/llms-full.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { LlmsFullConfig, LlmsFullPage, LlmsFullSection } from "./types.js";
|
|
2
|
-
|
|
3
|
-
function renderPage(page: LlmsFullPage): string {
|
|
4
|
-
const head = page.url
|
|
5
|
-
? `### ${page.title}\n\nSource: ${page.url}`
|
|
6
|
-
: `### ${page.title}`;
|
|
7
|
-
return `${head}\n\n${page.content}`;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function renderFullSection(section: LlmsFullSection): string {
|
|
11
|
-
const heading = `## ${section.title}`;
|
|
12
|
-
const pages = section.pages.map(renderPage).join("\n\n");
|
|
13
|
-
return pages ? `${heading}\n\n${pages}` : heading;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Generate an `llms-full.txt` manifest — the same header as `llms.txt` followed
|
|
18
|
-
* by every page's full markdown content inline, so an agent can read the whole
|
|
19
|
-
* site in a single request.
|
|
20
|
-
*
|
|
21
|
-
* Hierarchy: `# {title}` (site) → `## {section}` → `### {page}` + the page body.
|
|
22
|
-
*
|
|
23
|
-
* @param config - The manifest content with full page bodies.
|
|
24
|
-
* @returns The `llms-full.txt` file contents (no trailing newline).
|
|
25
|
-
* @see https://llmstxt.org
|
|
26
|
-
*/
|
|
27
|
-
export function generateLlmsFullText(config: LlmsFullConfig): string {
|
|
28
|
-
return [
|
|
29
|
-
`# ${config.title}`,
|
|
30
|
-
...(config.summary ? [`> ${config.summary}`] : []),
|
|
31
|
-
...(config.details ? [config.details] : []),
|
|
32
|
-
...config.sections.map(renderFullSection),
|
|
33
|
-
].join("\n\n");
|
|
34
|
-
}
|