@se-studio/markdown-renderer 2.0.15 → 2.1.0
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/CHANGELOG.md +27 -0
- package/README.md +4 -0
- package/dist/siteFiles/handlers.d.ts +29 -0
- package/dist/siteFiles/handlers.d.ts.map +1 -0
- package/dist/siteFiles/handlers.js +80 -0
- package/dist/siteFiles/handlers.js.map +1 -0
- package/dist/siteFiles/helpers.d.ts +53 -0
- package/dist/siteFiles/helpers.d.ts.map +1 -0
- package/dist/siteFiles/helpers.js +114 -0
- package/dist/siteFiles/helpers.js.map +1 -0
- package/dist/siteFiles/index.d.ts +8 -0
- package/dist/siteFiles/index.d.ts.map +1 -0
- package/dist/siteFiles/index.js +8 -0
- package/dist/siteFiles/index.js.map +1 -0
- package/dist/siteFiles/llmsFull.d.ts +37 -0
- package/dist/siteFiles/llmsFull.d.ts.map +1 -0
- package/dist/siteFiles/llmsFull.js +82 -0
- package/dist/siteFiles/llmsFull.js.map +1 -0
- package/dist/siteFiles/llmsTxt.d.ts +49 -0
- package/dist/siteFiles/llmsTxt.d.ts.map +1 -0
- package/dist/siteFiles/llmsTxt.js +73 -0
- package/dist/siteFiles/llmsTxt.js.map +1 -0
- package/dist/siteFiles/markdownIndex.d.ts +14 -0
- package/dist/siteFiles/markdownIndex.d.ts.map +1 -0
- package/dist/siteFiles/markdownIndex.js +28 -0
- package/dist/siteFiles/markdownIndex.js.map +1 -0
- package/dist/siteFiles/siteInfo.d.ts +60 -0
- package/dist/siteFiles/siteInfo.d.ts.map +1 -0
- package/dist/siteFiles/siteInfo.js +251 -0
- package/dist/siteFiles/siteInfo.js.map +1 -0
- package/dist/siteFiles/types.d.ts +100 -0
- package/dist/siteFiles/types.d.ts.map +1 -0
- package/dist/siteFiles/types.js +2 -0
- package/dist/siteFiles/types.js.map +1 -0
- package/docs/llms.md +37 -1
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @se-studio/markdown-renderer
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8e93a52: Config-driven site files, step 3: `llms.txt`, `llms-full.txt`, `site-info.md`, `markdown-index.txt`.
|
|
8
|
+
|
|
9
|
+
- `markdown-renderer`: new `@se-studio/markdown-renderer/site-files` entry with pure builders and `Response` handler factories (`createSiteLlmsTxtHandler`, `createLlmsFullTxtHandler`, `createSiteInfoHandler`, `createMarkdownIndexHandler`), the shared `SiteContent` description, and the generic helpers `selectKeyPages`, `selectLatestArticles`, `oneLine`, `isSitePath`, `countArticles`, `buildMarkdownUrlPattern`. `llms-full.txt` is opt-in and bounded.
|
|
10
|
+
- `core-ui`: `SiteFilesConfig` gains `content`, `llms`, `llmsFull`, `siteInfo` and `markdownIndex`; new route factories `llmsTxtRoute`, `llmsFullTxtRoute`, `siteInfoRoute`, `markdownIndexRoute`. A missing section answers 404 and never throws at import. New dependency on `@se-studio/markdown-renderer`.
|
|
11
|
+
- `project-build`: `generate-marketing-routes --write` also writes the four discovery routes (with a literal `revalidate = 3600`) for a site that has `src/lib/site-files.config.ts`.
|
|
12
|
+
|
|
13
|
+
The template app's `llms.txt`, `site-info.md` and `markdown-index.txt` now come from these factories, so their output changes (latest articles, documents hook and fuller site-info) compared with the old hand-written template routes.
|
|
14
|
+
|
|
15
|
+
## 2.0.17
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [c749645]
|
|
20
|
+
- @se-studio/contentful-rest-api@2.10.0
|
|
21
|
+
|
|
22
|
+
## 2.0.16
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [1b8c130]
|
|
27
|
+
- @se-studio/core-data-types@2.3.0
|
|
28
|
+
- @se-studio/contentful-rest-api@2.9.5
|
|
29
|
+
|
|
3
30
|
## 2.0.15
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -90,6 +90,10 @@ Options:
|
|
|
90
90
|
|
|
91
91
|
Sites that serve those indexes pass the same slugs to `buildMarkdownLinksFromAppLinks` as `personTypeLinks` (href from `urlCalculators.personType`, title from the type). `generateMarkdownIndex` then appends each internal href as a `.md` URL. Omit the option, or pass no links, and the index is unchanged.
|
|
92
92
|
|
|
93
|
+
### Site files (`@se-studio/markdown-renderer/site-files`)
|
|
94
|
+
|
|
95
|
+
Config-driven `llms.txt`, `llms-full.txt` (opt-in), `site-info.md` and `markdown-index.txt` as pure builders and `Response` handlers: `createSiteLlmsTxtHandler`, `createLlmsFullTxtHandler`, `createSiteInfoHandler`, `createMarkdownIndexHandler`, fed by one `SiteContent` object. See [docs/llms.md](docs/llms.md#site-files-se-studiomarkdown-renderersite-files).
|
|
96
|
+
|
|
93
97
|
### Custom hero converters
|
|
94
98
|
|
|
95
99
|
`Article hero`, `Person hero`, and `Person bio` are not built-in exports. A site owns those three types by registering a `markdownConverter` on the component registration and passing `customConverters` to `MarkdownConverter.convert` and search indexing. Without a converter they use the generic component renderer (component heading, copy, and visual only). Apps with other custom hero components (e.g. `Publications Hero`, `News Hero`) do the same.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type LlmsFullSettings } from './llmsFull';
|
|
2
|
+
import { type LlmsTxtSettings } from './llmsTxt';
|
|
3
|
+
import { type MarkdownIndexSettings } from './markdownIndex';
|
|
4
|
+
import { type SiteInfoSettings } from './siteInfo';
|
|
5
|
+
import type { SiteContent } from './types';
|
|
6
|
+
/** The inputs every site-file handler needs: the site's absolute base URL and its content description. */
|
|
7
|
+
export interface SiteFileHandlerOptions {
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
content: SiteContent;
|
|
10
|
+
}
|
|
11
|
+
/** A route handler: a standard `Response`, so it works as a Next.js `GET` without importing `next`. */
|
|
12
|
+
export type SiteFileHandler = () => Promise<Response>;
|
|
13
|
+
/** `llms.txt`: key pages, latest articles, optional documents, markdown URL pattern and Optional links. */
|
|
14
|
+
export declare function createSiteLlmsTxtHandler(options: SiteFileHandlerOptions & {
|
|
15
|
+
settings?: LlmsTxtSettings;
|
|
16
|
+
}): SiteFileHandler;
|
|
17
|
+
/** `llms-full.txt`: the llms.txt header and the full markdown of the key pages and latest articles. */
|
|
18
|
+
export declare function createLlmsFullTxtHandler(options: SiteFileHandlerOptions & {
|
|
19
|
+
settings: LlmsFullSettings;
|
|
20
|
+
}): SiteFileHandler;
|
|
21
|
+
/** `site-info.md`: counts and lists of the site's content; the clock is injectable through `settings.now`. */
|
|
22
|
+
export declare function createSiteInfoHandler(options: SiteFileHandlerOptions & {
|
|
23
|
+
settings?: SiteInfoSettings;
|
|
24
|
+
}): SiteFileHandler;
|
|
25
|
+
/** `markdown-index.txt`: the absolute `.md` URL of every page, article and optional section. */
|
|
26
|
+
export declare function createMarkdownIndexHandler(options: SiteFileHandlerOptions & {
|
|
27
|
+
settings?: MarkdownIndexSettings;
|
|
28
|
+
}): SiteFileHandler;
|
|
29
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/siteFiles/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAC;AAI9D,0GAA0G;AAC1G,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,uGAAuG;AACvG,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;AAUtD,2GAA2G;AAC3G,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAE,GAC/D,eAAe,CAmBjB;AAED,uGAAuG;AACvG,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,sBAAsB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,CAAA;CAAE,GAC/D,eAAe,CAejB;AAED,8GAA8G;AAC9G,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAAE,GAChE,eAAe,CAwBjB;AAED,gGAAgG;AAChG,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,qBAAqB,CAAA;CAAE,GACrE,eAAe,CAKjB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { buildLlmsFullTxt } from './llmsFull';
|
|
2
|
+
import { buildSiteLlmsTxt } from './llmsTxt';
|
|
3
|
+
import { buildSiteMarkdownIndex, fetchMarkdownIndexLinks, } from './markdownIndex';
|
|
4
|
+
import { buildSiteInfoMarkdown } from './siteInfo';
|
|
5
|
+
const PLAIN_TEXT = 'text/plain; charset=utf-8';
|
|
6
|
+
function plainResponse(body, contentType = PLAIN_TEXT, extraHeaders) {
|
|
7
|
+
return new Response(body, { headers: { 'Content-Type': contentType, ...extraHeaders } });
|
|
8
|
+
}
|
|
9
|
+
/** `llms.txt`: key pages, latest articles, optional documents, markdown URL pattern and Optional links. */
|
|
10
|
+
export function createSiteLlmsTxtHandler(options) {
|
|
11
|
+
return async () => {
|
|
12
|
+
const [pageRes, articleRes] = await Promise.all([
|
|
13
|
+
options.content.getAllPageLinks(),
|
|
14
|
+
options.content.getAllArticleLinks(),
|
|
15
|
+
]);
|
|
16
|
+
const discovery = options.settings?.getPageDiscovery
|
|
17
|
+
? await options.settings.getPageDiscovery(pageRes.data)
|
|
18
|
+
: undefined;
|
|
19
|
+
const body = buildSiteLlmsTxt({
|
|
20
|
+
baseUrl: options.baseUrl,
|
|
21
|
+
content: options.content,
|
|
22
|
+
pages: pageRes.data,
|
|
23
|
+
articles: articleRes.data,
|
|
24
|
+
...(discovery ? { discovery } : {}),
|
|
25
|
+
...(options.settings ? { settings: options.settings } : {}),
|
|
26
|
+
});
|
|
27
|
+
return plainResponse(body);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** `llms-full.txt`: the llms.txt header and the full markdown of the key pages and latest articles. */
|
|
31
|
+
export function createLlmsFullTxtHandler(options) {
|
|
32
|
+
return async () => {
|
|
33
|
+
const [pageRes, articleRes] = await Promise.all([
|
|
34
|
+
options.content.getAllPageLinks(),
|
|
35
|
+
options.content.getAllArticleLinks(),
|
|
36
|
+
]);
|
|
37
|
+
const body = await buildLlmsFullTxt({
|
|
38
|
+
baseUrl: options.baseUrl,
|
|
39
|
+
content: options.content,
|
|
40
|
+
pages: pageRes.data,
|
|
41
|
+
articles: articleRes.data,
|
|
42
|
+
settings: options.settings,
|
|
43
|
+
});
|
|
44
|
+
return plainResponse(body);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** `site-info.md`: counts and lists of the site's content; the clock is injectable through `settings.now`. */
|
|
48
|
+
export function createSiteInfoHandler(options) {
|
|
49
|
+
return async () => {
|
|
50
|
+
const { content } = options;
|
|
51
|
+
const empty = { data: [] };
|
|
52
|
+
const [pageRes, articleRes, personRes, tagRes] = await Promise.all([
|
|
53
|
+
content.getAllPageLinks(),
|
|
54
|
+
content.getAllArticleLinks(),
|
|
55
|
+
content.enablePerson && content.getAllPersonLinks ? content.getAllPersonLinks() : empty,
|
|
56
|
+
content.enableTag && content.getAllTagLinks ? content.getAllTagLinks() : empty,
|
|
57
|
+
]);
|
|
58
|
+
const body = buildSiteInfoMarkdown({
|
|
59
|
+
baseUrl: options.baseUrl,
|
|
60
|
+
content,
|
|
61
|
+
pages: pageRes.data ?? [],
|
|
62
|
+
articles: articleRes.data ?? [],
|
|
63
|
+
persons: personRes.data ?? [],
|
|
64
|
+
tagLinks: tagRes.data ?? [],
|
|
65
|
+
...(options.settings ? { settings: options.settings } : {}),
|
|
66
|
+
now: (options.settings?.now ?? (() => new Date()))(),
|
|
67
|
+
});
|
|
68
|
+
return plainResponse(body, 'text/markdown; charset=utf-8', {
|
|
69
|
+
'Cache-Control': 'public, s-maxage=3600, stale-while-revalidate',
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** `markdown-index.txt`: the absolute `.md` URL of every page, article and optional section. */
|
|
74
|
+
export function createMarkdownIndexHandler(options) {
|
|
75
|
+
return async () => {
|
|
76
|
+
const links = await fetchMarkdownIndexLinks(options.content);
|
|
77
|
+
return plainResponse(buildSiteMarkdownIndex(links, options.baseUrl, options.settings));
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/siteFiles/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAwB,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GAExB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAyB,MAAM,YAAY,CAAC;AAG1E,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAW/C,SAAS,aAAa,CACpB,IAAY,EACZ,WAAW,GAAG,UAAU,EACxB,YAAqC;IAErC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,YAAY,EAAE,EAAE,CAAC,CAAC;AAC3F,CAAC;AAED,2G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AC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE;SACrD,CAAC,CAAC;QACH,OAAO,aAAa,CAAC,IAAI,EAAE,8BAA8B,EAAE;YACzD,eAAe,EAAE,+CAA+C;SACjE,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,0BAA0B,CACxC,OAAsE;IAEtE,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,KAAK,GAAG,MAAM,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7D,OAAO,aAAa,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { SiteArticleLink, SiteArticleTypeRoute, SiteContent, SitePageLink } from './types';
|
|
2
|
+
/** True for a path on this site; false for an absolute URL to another host. */
|
|
3
|
+
export declare function isSitePath(href: string | undefined | null): href is string;
|
|
4
|
+
/** One line, no markdown breakers, for a description after a link. */
|
|
5
|
+
export declare function oneLine(text: string | null | undefined): string | undefined;
|
|
6
|
+
/** On-site pages that are meant to be indexed, home first, then CMS order. */
|
|
7
|
+
export declare function selectKeyPages<T extends SitePageLink>(pages: readonly T[]): T[];
|
|
8
|
+
/** Newest first. Only articles with an on-site page that are not excluded from indexing. */
|
|
9
|
+
export declare function selectLatestArticles<T extends SiteArticleLink>(articles: readonly T[], limit: number): T[];
|
|
10
|
+
/** Article counts used by `site-info.md`. */
|
|
11
|
+
export interface SiteArticleCounts {
|
|
12
|
+
total: number;
|
|
13
|
+
onSite: number;
|
|
14
|
+
externalOnly: number;
|
|
15
|
+
withDownload: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Counts for `site-info.md`. A download does not make an article download-only: an article can have an
|
|
19
|
+
* on-site page and a file.
|
|
20
|
+
*/
|
|
21
|
+
export declare function countArticles(articles: readonly SiteArticleLink[]): SiteArticleCounts;
|
|
22
|
+
/** The routing facts the markdown URL pattern sentence is built from. */
|
|
23
|
+
export interface MarkdownUrlPatternInput {
|
|
24
|
+
enableArticleTypeIndex?: boolean;
|
|
25
|
+
enablePrimaryTagPartOfSlug?: boolean;
|
|
26
|
+
enablePerson?: boolean;
|
|
27
|
+
articlesSlug?: string;
|
|
28
|
+
articleTypeRoutes?: readonly SiteArticleTypeRoute[];
|
|
29
|
+
peopleSlug?: string;
|
|
30
|
+
personTypeSlugs?: readonly string[];
|
|
31
|
+
tagsSlug?: string;
|
|
32
|
+
tagTypeSlugs?: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The "Append .md to any page URL..." sentence for the Markdown access section of `llms.txt`. It lists the
|
|
36
|
+
* page, article, team and tag URL shapes the site really has, including the `{topic}` segment when the
|
|
37
|
+
* primary tag is part of the article slug.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildMarkdownUrlPattern(input: MarkdownUrlPatternInput): string;
|
|
40
|
+
/** Default `articleIndexPath`: the type's route index, else under the articles base, else `/{type}/`. */
|
|
41
|
+
export declare function defaultArticleIndexPath(content: SiteContent, articleTypeSlug: string): string;
|
|
42
|
+
/** Default `teamIndexPath`: the people base, else the only person type, else the site root. */
|
|
43
|
+
export declare function defaultTeamIndexPath(content: SiteContent): string;
|
|
44
|
+
/** Default `tagUrl`: under the tags base when the site has one, else `/{tag}/`. */
|
|
45
|
+
export declare function defaultTagUrl(content: SiteContent, tagSlug: string): string;
|
|
46
|
+
/** Resolved URL helpers for a site: its own when configured, else the defaults. */
|
|
47
|
+
export declare function resolveSiteUrls(content: SiteContent): {
|
|
48
|
+
articleIndexPath: (articleTypeSlug: string) => string;
|
|
49
|
+
teamIndexPath: () => string;
|
|
50
|
+
tagUrl: (tagSlug: string) => string;
|
|
51
|
+
tagsBase: string;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/siteFiles/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEhG,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,IAAI,MAAM,CAE1E;AAED,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG3E;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAO/E;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,eAAe,EAC5D,QAAQ,EAAE,SAAS,CAAC,EAAE,EACtB,KAAK,EAAE,MAAM,GACZ,CAAC,EAAE,CAKL;AAED,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,iBAAiB,CAQrF;AAED,yEAAyE;AACzE,MAAM,WAAW,uBAAuB;IACtC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,MAAM,CAmC9E;AAMD,yGAAyG;AACzG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAO7F;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAOjE;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG;IACrD,gBAAgB,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAQA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/** True for a path on this site; false for an absolute URL to another host. */
|
|
2
|
+
export function isSitePath(href) {
|
|
3
|
+
return typeof href === 'string' && href.startsWith('/') && !href.startsWith('//');
|
|
4
|
+
}
|
|
5
|
+
/** One line, no markdown breakers, for a description after a link. */
|
|
6
|
+
export function oneLine(text) {
|
|
7
|
+
const value = text?.replace(/\s+/g, ' ').trim();
|
|
8
|
+
return value ? value : undefined;
|
|
9
|
+
}
|
|
10
|
+
/** On-site pages that are meant to be indexed, home first, then CMS order. */
|
|
11
|
+
export function selectKeyPages(pages) {
|
|
12
|
+
const eligible = pages.filter((page) => isSitePath(page.href) && page.indexed !== false && page.hidden !== true);
|
|
13
|
+
const home = eligible.filter((page) => page.href === '/');
|
|
14
|
+
const rest = eligible.filter((page) => page.href !== '/');
|
|
15
|
+
return [...home, ...rest];
|
|
16
|
+
}
|
|
17
|
+
/** Newest first. Only articles with an on-site page that are not excluded from indexing. */
|
|
18
|
+
export function selectLatestArticles(articles, limit) {
|
|
19
|
+
return articles
|
|
20
|
+
.filter((article) => isSitePath(article.href) && article.indexed !== false)
|
|
21
|
+
.sort((a, b) => Date.parse(b.date ?? '') - Date.parse(a.date ?? '') || 0)
|
|
22
|
+
.slice(0, limit);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Counts for `site-info.md`. A download does not make an article download-only: an article can have an
|
|
26
|
+
* on-site page and a file.
|
|
27
|
+
*/
|
|
28
|
+
export function countArticles(articles) {
|
|
29
|
+
const onSite = articles.filter((article) => isSitePath(article.href)).length;
|
|
30
|
+
return {
|
|
31
|
+
total: articles.length,
|
|
32
|
+
onSite,
|
|
33
|
+
externalOnly: articles.length - onSite,
|
|
34
|
+
withDownload: articles.filter((article) => Boolean(article.download)).length,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The "Append .md to any page URL..." sentence for the Markdown access section of `llms.txt`. It lists the
|
|
39
|
+
* page, article, team and tag URL shapes the site really has, including the `{topic}` segment when the
|
|
40
|
+
* primary tag is part of the article slug.
|
|
41
|
+
*/
|
|
42
|
+
export function buildMarkdownUrlPattern(input) {
|
|
43
|
+
const routes = input.articleTypeRoutes ?? [];
|
|
44
|
+
const personTypeSlugs = input.personTypeSlugs ?? [];
|
|
45
|
+
const topic = input.enablePrimaryTagPartOfSlug;
|
|
46
|
+
const articlesSlug = input.articlesSlug ?? '';
|
|
47
|
+
const articlePatterns = input.enableArticleTypeIndex && routes.length > 0
|
|
48
|
+
? routes.map((route) => {
|
|
49
|
+
const base = route.articlePath.replace(/\/$/, '');
|
|
50
|
+
const pattern = topic ? `\`${base}/{topic}/{slug}.md\`` : `\`${base}/{slug}.md\``;
|
|
51
|
+
return `Articles (${route.slug}): ${pattern}`;
|
|
52
|
+
})
|
|
53
|
+
: [
|
|
54
|
+
input.enableArticleTypeIndex
|
|
55
|
+
? topic
|
|
56
|
+
? `Articles: \`/${articlesSlug}/{type}/{topic}/{slug}.md\``
|
|
57
|
+
: `Articles: \`/${articlesSlug}/{type}/{slug}.md\``
|
|
58
|
+
: 'Articles: append .md to article URLs',
|
|
59
|
+
];
|
|
60
|
+
const parts = ['Pages: `/{slug}.md`', ...articlePatterns];
|
|
61
|
+
if (input.enablePerson && input.peopleSlug) {
|
|
62
|
+
parts.push(`Team: \`/${input.peopleSlug}/{slug}.md\``);
|
|
63
|
+
if (personTypeSlugs.length > 0) {
|
|
64
|
+
parts.push(`Team types: \`/${input.peopleSlug}/{type}/{slug}.md\``);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (input.enablePerson) {
|
|
68
|
+
for (const type of personTypeSlugs) {
|
|
69
|
+
parts.push(`Team (${type}): \`/${type}/{slug}.md\``);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const type of input.tagTypeSlugs ?? []) {
|
|
73
|
+
const prefix = input.tagsSlug ? `/${input.tagsSlug}/${type}` : `/${type}`;
|
|
74
|
+
parts.push(`Tags (${type}): \`${prefix}/{slug}.md\``);
|
|
75
|
+
}
|
|
76
|
+
return `Append .md to any page URL for a markdown version. ${parts.join('; ')}.`;
|
|
77
|
+
}
|
|
78
|
+
function basePath(slug, base) {
|
|
79
|
+
return base ?? (slug ? `/${slug}` : '');
|
|
80
|
+
}
|
|
81
|
+
/** Default `articleIndexPath`: the type's route index, else under the articles base, else `/{type}/`. */
|
|
82
|
+
export function defaultArticleIndexPath(content, articleTypeSlug) {
|
|
83
|
+
const route = content.articleTypeRoutes?.find((item) => item.slug === articleTypeSlug);
|
|
84
|
+
if (route) {
|
|
85
|
+
return route.indexPath;
|
|
86
|
+
}
|
|
87
|
+
const base = basePath(content.articlesSlug, content.articlesBase);
|
|
88
|
+
return base ? `${base}/${articleTypeSlug}/` : `/${articleTypeSlug}/`;
|
|
89
|
+
}
|
|
90
|
+
/** Default `teamIndexPath`: the people base, else the only person type, else the site root. */
|
|
91
|
+
export function defaultTeamIndexPath(content) {
|
|
92
|
+
if (content.peopleSlug) {
|
|
93
|
+
return `${basePath(content.peopleSlug, content.peopleBase)}/`;
|
|
94
|
+
}
|
|
95
|
+
const types = content.personTypeSlugs ?? [];
|
|
96
|
+
const onlyType = types.length === 1 ? types[0] : undefined;
|
|
97
|
+
return onlyType ? `/${onlyType}/` : '/';
|
|
98
|
+
}
|
|
99
|
+
/** Default `tagUrl`: under the tags base when the site has one, else `/{tag}/`. */
|
|
100
|
+
export function defaultTagUrl(content, tagSlug) {
|
|
101
|
+
return content.tagsSlug
|
|
102
|
+
? `${basePath(content.tagsSlug, content.tagsBase)}/${tagSlug}/`
|
|
103
|
+
: `/${tagSlug}/`;
|
|
104
|
+
}
|
|
105
|
+
/** Resolved URL helpers for a site: its own when configured, else the defaults. */
|
|
106
|
+
export function resolveSiteUrls(content) {
|
|
107
|
+
return {
|
|
108
|
+
articleIndexPath: content.articleIndexPath ?? ((slug) => defaultArticleIndexPath(content, slug)),
|
|
109
|
+
teamIndexPath: content.teamIndexPath ?? (() => defaultTeamIndexPath(content)),
|
|
110
|
+
tagUrl: content.tagUrl ?? ((slug) => defaultTagUrl(content, slug)),
|
|
111
|
+
tagsBase: basePath(content.tagsSlug, content.tagsBase),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/siteFiles/helpers.ts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C1C,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,OAAoB,EAAE,OAAe;IACjE,OAAO,OAAO,CAAC,QAAQ;QACrB,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,GAAG;QAC/D,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC;AACrB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,eAAe,CAAC,OAAoB;IAMlD,OAAO;QACL,gBAAgB,EACd,OAAO,CAAC,gBAAgB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChF,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC7E,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/siteFiles/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/siteFiles/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type LlmsTxtSettings } from './llmsTxt';
|
|
2
|
+
import type { SiteArticleLink, SiteContent, SitePageLink } from './types';
|
|
3
|
+
/** Default cap on the number of documents in `llms-full.txt`. */
|
|
4
|
+
export declare const DEFAULT_LLMS_FULL_MAX_DOCUMENTS = 25;
|
|
5
|
+
/** Default cap on the size of `llms-full.txt` (UTF-8 bytes). */
|
|
6
|
+
export declare const DEFAULT_LLMS_FULL_MAX_BYTES: number;
|
|
7
|
+
/**
|
|
8
|
+
* Options for `llms-full.txt`, which is off unless a site supplies them. It writes the `llms.txt` header and
|
|
9
|
+
* then the full markdown of every key page and latest article, so an agent can read the site in one request.
|
|
10
|
+
*
|
|
11
|
+
* `getMarkdown(href)` returns the markdown for a site path such as `/about/`, or null when there is none;
|
|
12
|
+
* a rejected call skips that document. `maxDocuments` (default 25) and `maxBytes` (default 512 KiB) bound
|
|
13
|
+
* the output: documents are added in order (key pages first) until either limit would be exceeded, and the
|
|
14
|
+
* rest are left out. `stripFrontmatter` (default true) removes the leading YAML block from each document.
|
|
15
|
+
* The selection options of `LlmsTxtSettings` apply, so the key pages and latest articles match `llms.txt`.
|
|
16
|
+
*/
|
|
17
|
+
export interface LlmsFullSettings extends Pick<LlmsTxtSettings, 'latestArticlesLimit' | 'selectKeyPages' | 'selectLatestArticles' | 'details' | 'customBlocks'> {
|
|
18
|
+
getMarkdown: (href: string) => Promise<string | null | undefined>;
|
|
19
|
+
maxDocuments?: number;
|
|
20
|
+
maxBytes?: number;
|
|
21
|
+
stripFrontmatter?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** The data `buildLlmsFullTxt` formats. */
|
|
24
|
+
export interface LlmsFullInput {
|
|
25
|
+
baseUrl: string;
|
|
26
|
+
content: SiteContent;
|
|
27
|
+
pages: readonly SitePageLink[];
|
|
28
|
+
articles: readonly SiteArticleLink[];
|
|
29
|
+
settings: LlmsFullSettings;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Builds `llms-full.txt`. The header is the `llms.txt` title and summary (plus `details` and
|
|
33
|
+
* `customBlocks`), followed by a Key pages and a Latest articles section; each document is introduced by its
|
|
34
|
+
* title and markdown URL.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildLlmsFullTxt(input: LlmsFullInput): Promise<string>;
|
|
37
|
+
//# sourceMappingURL=llmsFull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmsFull.d.ts","sourceRoot":"","sources":["../../src/siteFiles/llmsFull.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,WAAW,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1E,iEAAiE;AACjE,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,gEAAgE;AAChE,eAAO,MAAM,2BAA2B,QAAa,CAAC;AAItD;;;;;;;;;GASG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CACV,eAAe,EACf,qBAAqB,GAAG,gBAAgB,GAAG,sBAAsB,GAAG,SAAS,GAAG,cAAc,CAC/F;IACD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,2CAA2C;AAC3C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAiCD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA+C5E"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { generateLlmsTxt, toMarkdownUrl } from '../llmsTxt';
|
|
2
|
+
import { selectLlmsEntries } from './llmsTxt';
|
|
3
|
+
/** Default cap on the number of documents in `llms-full.txt`. */
|
|
4
|
+
export const DEFAULT_LLMS_FULL_MAX_DOCUMENTS = 25;
|
|
5
|
+
/** Default cap on the size of `llms-full.txt` (UTF-8 bytes). */
|
|
6
|
+
export const DEFAULT_LLMS_FULL_MAX_BYTES = 512 * 1024;
|
|
7
|
+
const FETCH_BATCH_SIZE = 5;
|
|
8
|
+
const FRONTMATTER = /^---\r?\n[\s\S]*?\r?\n---\r?\n+/;
|
|
9
|
+
function byteLength(value) {
|
|
10
|
+
return new TextEncoder().encode(value).byteLength;
|
|
11
|
+
}
|
|
12
|
+
async function loadDocuments(entries, settings) {
|
|
13
|
+
const out = [];
|
|
14
|
+
for (let start = 0; start < entries.length; start += FETCH_BATCH_SIZE) {
|
|
15
|
+
const batch = entries.slice(start, start + FETCH_BATCH_SIZE);
|
|
16
|
+
const loaded = await Promise.all(batch.map(async (entry) => {
|
|
17
|
+
try {
|
|
18
|
+
const raw = await settings.getMarkdown(entry.href);
|
|
19
|
+
const body = (settings.stripFrontmatter === false ? raw : raw?.replace(FRONTMATTER, ''))?.trim();
|
|
20
|
+
return body ? { ...entry, body } : null;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
out.push(...loaded);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds `llms-full.txt`. The header is the `llms.txt` title and summary (plus `details` and
|
|
32
|
+
* `customBlocks`), followed by a Key pages and a Latest articles section; each document is introduced by its
|
|
33
|
+
* title and markdown URL.
|
|
34
|
+
*/
|
|
35
|
+
export async function buildLlmsFullTxt(input) {
|
|
36
|
+
const { baseUrl, content, settings } = input;
|
|
37
|
+
const { keyPages, latestArticles } = selectLlmsEntries({
|
|
38
|
+
pages: input.pages,
|
|
39
|
+
articles: input.articles,
|
|
40
|
+
settings,
|
|
41
|
+
});
|
|
42
|
+
const toEntry = (link) => ({
|
|
43
|
+
href: link.href ?? '',
|
|
44
|
+
title: link.title ?? link.slug ?? 'Untitled',
|
|
45
|
+
});
|
|
46
|
+
const onSite = (entry) => Boolean(toMarkdownUrl(entry.href));
|
|
47
|
+
const keyEntries = keyPages.map(toEntry).filter(onSite);
|
|
48
|
+
const latestEntries = latestArticles.map(toEntry).filter(onSite);
|
|
49
|
+
const maxDocuments = settings.maxDocuments ?? DEFAULT_LLMS_FULL_MAX_DOCUMENTS;
|
|
50
|
+
const wanted = [
|
|
51
|
+
...keyEntries.map((entry) => ({ ...entry, section: 'Key pages' })),
|
|
52
|
+
...latestEntries.map((entry) => ({ ...entry, section: 'Latest articles' })),
|
|
53
|
+
].slice(0, Math.max(0, maxDocuments));
|
|
54
|
+
const loaded = await loadDocuments(wanted, settings);
|
|
55
|
+
const header = generateLlmsTxt({
|
|
56
|
+
siteName: content.customerName,
|
|
57
|
+
summary: content.siteDescription,
|
|
58
|
+
...(settings.details ? { details: settings.details } : {}),
|
|
59
|
+
...(settings.customBlocks ? { customBlocks: settings.customBlocks } : {}),
|
|
60
|
+
});
|
|
61
|
+
const maxBytes = settings.maxBytes ?? DEFAULT_LLMS_FULL_MAX_BYTES;
|
|
62
|
+
const parts = [header];
|
|
63
|
+
let bytes = byteLength(header);
|
|
64
|
+
let currentSection = '';
|
|
65
|
+
for (const [index, document] of loaded.entries()) {
|
|
66
|
+
const section = wanted[index]?.section ?? '';
|
|
67
|
+
if (!document) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const heading = section === currentSection ? '' : `## ${section}\n\n`;
|
|
71
|
+
const block = `${heading}### ${document.title}\n\nSource: ${baseUrl}${toMarkdownUrl(document.href)}\n\n${document.body}`;
|
|
72
|
+
const nextBytes = bytes + byteLength(block) + 2;
|
|
73
|
+
if (nextBytes > maxBytes) {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
parts.push(block);
|
|
77
|
+
bytes = nextBytes;
|
|
78
|
+
currentSection = section;
|
|
79
|
+
}
|
|
80
|
+
return `${parts.join('\n\n')}\n`;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=llmsFull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmsFull.js","sourceRoot":"","sources":["../../src/siteFiles/llmsFull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAwB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGpE,iEAAiE;AACjE,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAElD,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,GAAG,IAAI,CAAC;AAEtD,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAgC3B,MAAM,WAAW,GAAG,iCAAiC,CAAC;AAEtD,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;AACpD,CAAC;AAED,KAAK,UAAU,aAAa,CAC1B,OAAmD,EACnD,QAA0B;IAE1B,MAAM,GAAG,GAA6D,EAAE,CAAC;IACzE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,gBAAgB,EAAE,CAAC;QACtE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,K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CAAC;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,IAAI,2BAA2B,CAAC;IAClE,MAAM,KAAK,GAAa,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,SAAS;QACX,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,KAAK,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC;QACtE,MAAM,KAAK,GAAG,GAAG,OAAO,OAAO,QAAQ,CAAC,KAAK,eAAe,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzH,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;YACzB,MAAM;QACR,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,GAAG,SAAS,CAAC;QAClB,cAAc,GAAG,OAAO,CAAC;IAC3B,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type LlmsTxtCustomBlock, type LlmsTxtSection } from '../llmsTxt';
|
|
2
|
+
import type { SiteArticleLink, SiteContent, SitePageDiscovery, SitePageLink } from './types';
|
|
3
|
+
type LlmsItem = LlmsTxtSection['items'][number];
|
|
4
|
+
/** Default number of latest articles listed in `llms.txt`. */
|
|
5
|
+
export declare const DEFAULT_LATEST_ARTICLES_LIMIT = 5;
|
|
6
|
+
/**
|
|
7
|
+
* Per-site options for `llms.txt` (every one is optional and defaults to the standard behaviour).
|
|
8
|
+
*
|
|
9
|
+
* `latestArticlesLimit` caps the Latest articles section (default 5). `selectKeyPages` and
|
|
10
|
+
* `selectLatestArticles` replace the default selection (on-site, indexed pages with the home page first;
|
|
11
|
+
* newest on-site articles). `getPageDiscovery` is the site-side hook that reads each key page once and returns
|
|
12
|
+
* a description per page slug and the documents found in page content (the Documents section is omitted
|
|
13
|
+
* without it). `markdownUrlPattern` replaces the generated "Append .md" sentence, either as text or as a
|
|
14
|
+
* function that receives the generated one. `details` and `customBlocks` are passed to the underlying
|
|
15
|
+
* generator. `optionalLinks` replaces the default Optional links (markdown index and site information);
|
|
16
|
+
* an empty array drops the section.
|
|
17
|
+
*/
|
|
18
|
+
export interface LlmsTxtSettings {
|
|
19
|
+
latestArticlesLimit?: number;
|
|
20
|
+
selectKeyPages?: (pages: readonly SitePageLink[]) => SitePageLink[];
|
|
21
|
+
selectLatestArticles?: (articles: readonly SiteArticleLink[], limit: number) => SiteArticleLink[];
|
|
22
|
+
getPageDiscovery?: (pages: readonly SitePageLink[]) => Promise<SitePageDiscovery>;
|
|
23
|
+
markdownUrlPattern?: string | ((generated: string) => string);
|
|
24
|
+
details?: string;
|
|
25
|
+
customBlocks?: readonly LlmsTxtCustomBlock[];
|
|
26
|
+
optionalLinks?: readonly LlmsItem[];
|
|
27
|
+
}
|
|
28
|
+
/** The data `buildSiteLlmsTxt` formats. */
|
|
29
|
+
export interface SiteLlmsTxtInput {
|
|
30
|
+
baseUrl: string;
|
|
31
|
+
content: SiteContent;
|
|
32
|
+
pages: readonly SitePageLink[];
|
|
33
|
+
articles: readonly SiteArticleLink[];
|
|
34
|
+
discovery?: SitePageDiscovery;
|
|
35
|
+
settings?: LlmsTxtSettings;
|
|
36
|
+
}
|
|
37
|
+
/** The key pages and latest articles that `llms.txt` and `llms-full.txt` both list. */
|
|
38
|
+
export declare function selectLlmsEntries(input: {
|
|
39
|
+
pages: readonly SitePageLink[];
|
|
40
|
+
articles: readonly SiteArticleLink[];
|
|
41
|
+
settings?: LlmsTxtSettings;
|
|
42
|
+
}): {
|
|
43
|
+
keyPages: SitePageLink[];
|
|
44
|
+
latestArticles: SiteArticleLink[];
|
|
45
|
+
};
|
|
46
|
+
/** Pure `llms.txt` builder: same output as the route handler for the same data. */
|
|
47
|
+
export declare function buildSiteLlmsTxt(input: SiteLlmsTxtInput): string;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=llmsTxt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmsTxt.d.ts","sourceRoot":"","sources":["../../src/siteFiles/llmsTxt.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEpB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7F,KAAK,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,8DAA8D;AAC9D,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,KAAK,YAAY,EAAE,CAAC;IACpE,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,KAAK,eAAe,EAAE,CAAC;IAClG,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,KAAK,OAAO,CAAC,iBAAiB,CAAC,C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