blodemd 0.0.15 → 0.2.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/README.md +26 -1
- package/dist/cli.mjs +217 -217
- package/dist/cli.mjs.map +1 -1
- package/package.json +3 -36
- package/dev-server/app/[[...slug]]/page.tsx +0 -140
- package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
- package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
- package/dev-server/app/blodemd-dev/version/route.ts +0 -14
- package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
- package/dev-server/app/error.tsx +0 -24
- package/dev-server/app/favicon.ico +0 -0
- package/dev-server/app/globals.css +0 -4
- package/dev-server/app/layout.tsx +0 -38
- package/dev-server/app/not-found.tsx +0 -18
- package/dev-server/app/search/route.ts +0 -17
- package/dev-server/components/dev-reload-script.tsx +0 -86
- package/dev-server/components/providers.tsx +0 -15
- package/dev-server/lib/dev-state.ts +0 -8
- package/dev-server/lib/local-content-source.ts +0 -103
- package/dev-server/lib/local-runtime.tsx +0 -555
- package/dev-server/next-env.d.ts +0 -5
- package/dev-server/next.config.js +0 -54
- package/dev-server/package.json +0 -61
- package/dev-server/postcss.config.mjs +0 -7
- package/dev-server/public/glide-variable.woff2 +0 -0
- package/dev-server/tsconfig.json +0 -50
- package/docs/app/globals.css +0 -471
- package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
- package/docs/components/api/api-playground.tsx +0 -467
- package/docs/components/api/api-reference.tsx +0 -157
- package/docs/components/content/collection-index.tsx +0 -114
- package/docs/components/docs/contextual-menu.tsx +0 -495
- package/docs/components/docs/copy-page-menu.tsx +0 -364
- package/docs/components/docs/doc-header.tsx +0 -223
- package/docs/components/docs/doc-shell.tsx +0 -355
- package/docs/components/docs/doc-sidebar.tsx +0 -256
- package/docs/components/docs/doc-toc.tsx +0 -46
- package/docs/components/docs/mobile-nav.tsx +0 -195
- package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
- package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
- package/docs/components/git/repo-picker.tsx +0 -529
- package/docs/components/icons/doc-icon.tsx +0 -96
- package/docs/components/mdx/accordion.tsx +0 -83
- package/docs/components/mdx/agent-instructions.tsx +0 -17
- package/docs/components/mdx/badge.tsx +0 -79
- package/docs/components/mdx/callout.tsx +0 -88
- package/docs/components/mdx/card.tsx +0 -110
- package/docs/components/mdx/code-block.tsx +0 -80
- package/docs/components/mdx/code-group.tsx +0 -203
- package/docs/components/mdx/color.tsx +0 -87
- package/docs/components/mdx/columns.tsx +0 -25
- package/docs/components/mdx/expandable.tsx +0 -45
- package/docs/components/mdx/field-layout.tsx +0 -77
- package/docs/components/mdx/frame.tsx +0 -23
- package/docs/components/mdx/get-text-content.ts +0 -18
- package/docs/components/mdx/icon.tsx +0 -12
- package/docs/components/mdx/iframe.tsx +0 -62
- package/docs/components/mdx/index.tsx +0 -121
- package/docs/components/mdx/installer.tsx +0 -20
- package/docs/components/mdx/panel.tsx +0 -11
- package/docs/components/mdx/param-field.tsx +0 -56
- package/docs/components/mdx/preview.tsx +0 -36
- package/docs/components/mdx/prompt.tsx +0 -63
- package/docs/components/mdx/request-example.tsx +0 -27
- package/docs/components/mdx/response-field.tsx +0 -42
- package/docs/components/mdx/steps.tsx +0 -92
- package/docs/components/mdx/tabs.tsx +0 -193
- package/docs/components/mdx/tile.tsx +0 -43
- package/docs/components/mdx/tooltip.tsx +0 -71
- package/docs/components/mdx/tree.tsx +0 -120
- package/docs/components/mdx/type-table.tsx +0 -71
- package/docs/components/mdx/update.tsx +0 -44
- package/docs/components/mdx/video.tsx +0 -45
- package/docs/components/mdx/view.tsx +0 -66
- package/docs/components/posthog-provider.tsx +0 -42
- package/docs/components/providers.tsx +0 -15
- package/docs/components/tenant-analytics.tsx +0 -49
- package/docs/components/third-parties.tsx +0 -32
- package/docs/components/ui/badge.tsx +0 -61
- package/docs/components/ui/breadcrumb.tsx +0 -112
- package/docs/components/ui/button-group.tsx +0 -83
- package/docs/components/ui/button.tsx +0 -65
- package/docs/components/ui/card.tsx +0 -92
- package/docs/components/ui/command.tsx +0 -167
- package/docs/components/ui/copy-button.tsx +0 -129
- package/docs/components/ui/dialog.tsx +0 -146
- package/docs/components/ui/field.tsx +0 -237
- package/docs/components/ui/input.tsx +0 -23
- package/docs/components/ui/kbd.tsx +0 -98
- package/docs/components/ui/label.tsx +0 -22
- package/docs/components/ui/morph-icon.tsx +0 -79
- package/docs/components/ui/popover.tsx +0 -267
- package/docs/components/ui/search-dialog.tsx +0 -431
- package/docs/components/ui/search.tsx +0 -101
- package/docs/components/ui/separator.tsx +0 -26
- package/docs/components/ui/sheet.tsx +0 -133
- package/docs/components/ui/sidebar.tsx +0 -758
- package/docs/components/ui/skeleton.tsx +0 -11
- package/docs/components/ui/switch.tsx +0 -32
- package/docs/components/ui/tabs.tsx +0 -138
- package/docs/components/ui/theme-toggle.tsx +0 -62
- package/docs/components/ui/tooltip.tsx +0 -53
- package/docs/components/web-mcp.tsx +0 -115
- package/docs/lib/agent-skills.ts +0 -48
- package/docs/lib/api-client.ts +0 -72
- package/docs/lib/config.ts +0 -6
- package/docs/lib/content-root.ts +0 -33
- package/docs/lib/content-source.ts +0 -70
- package/docs/lib/contextual-options.ts +0 -222
- package/docs/lib/dashboard-session.ts +0 -167
- package/docs/lib/db.ts +0 -13
- package/docs/lib/docs-collection.ts +0 -7
- package/docs/lib/docs-runtime.tsx +0 -745
- package/docs/lib/edge-config.ts +0 -95
- package/docs/lib/env.ts +0 -23
- package/docs/lib/etag.ts +0 -22
- package/docs/lib/github-install.ts +0 -33
- package/docs/lib/llms-full.ts +0 -82
- package/docs/lib/marketing-markdown.ts +0 -79
- package/docs/lib/marketing-site.ts +0 -31
- package/docs/lib/mdx.ts +0 -98
- package/docs/lib/navigation.ts +0 -288
- package/docs/lib/openapi-proxy.ts +0 -88
- package/docs/lib/openapi.ts +0 -158
- package/docs/lib/platform-config.ts +0 -6
- package/docs/lib/project-authz.ts +0 -46
- package/docs/lib/routes.ts +0 -103
- package/docs/lib/server-cache.ts +0 -83
- package/docs/lib/shiki.ts +0 -44
- package/docs/lib/supabase.ts +0 -37
- package/docs/lib/tenancy.ts +0 -364
- package/docs/lib/tenant-headers.ts +0 -43
- package/docs/lib/tenant-static.ts +0 -705
- package/docs/lib/tenant-utility-context.ts +0 -62
- package/docs/lib/tenants.ts +0 -72
- package/docs/lib/theme.ts +0 -29
- package/docs/lib/time-ago.ts +0 -24
- package/docs/lib/toc.ts +0 -2
- package/docs/lib/use-mobile.ts +0 -19
- package/docs/lib/use-tab-observer.ts +0 -71
- package/docs/lib/utils.ts +0 -5
- package/packages/@repo/common/dist/index.d.ts +0 -16
- package/packages/@repo/common/dist/index.d.ts.map +0 -1
- package/packages/@repo/common/dist/index.js +0 -84
- package/packages/@repo/common/package.json +0 -34
- package/packages/@repo/common/src/index.ts +0 -101
- package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
- package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/analytics.js +0 -18
- package/packages/@repo/contracts/dist/dates.d.ts +0 -4
- package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/dates.js +0 -2
- package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
- package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/deployment.js +0 -46
- package/packages/@repo/contracts/dist/domain.d.ts +0 -94
- package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/domain.js +0 -36
- package/packages/@repo/contracts/dist/git.d.ts +0 -28
- package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/git.js +0 -24
- package/packages/@repo/contracts/dist/ids.d.ts +0 -14
- package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/ids.js +0 -11
- package/packages/@repo/contracts/dist/index.d.ts +0 -11
- package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/index.js +0 -12
- package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
- package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/pagination.js +0 -15
- package/packages/@repo/contracts/dist/project.d.ts +0 -42
- package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/project.js +0 -25
- package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
- package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/tenant.js +0 -58
- package/packages/@repo/contracts/dist/user.d.ts +0 -9
- package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/user.js +0 -9
- package/packages/@repo/contracts/package.json +0 -37
- package/packages/@repo/contracts/src/analytics.ts +0 -33
- package/packages/@repo/contracts/src/dates.ts +0 -4
- package/packages/@repo/contracts/src/deployment.ts +0 -73
- package/packages/@repo/contracts/src/domain.ts +0 -51
- package/packages/@repo/contracts/src/git.ts +0 -31
- package/packages/@repo/contracts/src/ids.ts +0 -23
- package/packages/@repo/contracts/src/index.ts +0 -12
- package/packages/@repo/contracts/src/pagination.ts +0 -21
- package/packages/@repo/contracts/src/project.ts +0 -32
- package/packages/@repo/contracts/src/tenant.ts +0 -94
- package/packages/@repo/contracts/src/user.ts +0 -12
- package/packages/@repo/models/dist/docs-config.d.ts +0 -961
- package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
- package/packages/@repo/models/dist/docs-config.js +0 -531
- package/packages/@repo/models/dist/index.d.ts +0 -3
- package/packages/@repo/models/dist/index.d.ts.map +0 -1
- package/packages/@repo/models/dist/index.js +0 -3
- package/packages/@repo/models/dist/tenant.d.ts +0 -37
- package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
- package/packages/@repo/models/dist/tenant.js +0 -1
- package/packages/@repo/models/package.json +0 -37
- package/packages/@repo/models/src/docs-config.ts +0 -629
- package/packages/@repo/models/src/index.ts +0 -3
- package/packages/@repo/models/src/tenant.ts +0 -44
- package/packages/@repo/prebuild/dist/index.d.ts +0 -2
- package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
- package/packages/@repo/prebuild/dist/index.js +0 -2
- package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
- package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
- package/packages/@repo/prebuild/dist/openapi.js +0 -86
- package/packages/@repo/prebuild/package.json +0 -39
- package/packages/@repo/prebuild/src/index.ts +0 -2
- package/packages/@repo/prebuild/src/openapi.ts +0 -154
- package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
- package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/blob-source.js +0 -128
- package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
- package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/config-loader.js +0 -231
- package/packages/@repo/previewing/dist/constants.d.ts +0 -15
- package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/constants.js +0 -14
- package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
- package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/content-index.js +0 -291
- package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
- package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/content-source.js +0 -1
- package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
- package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/fs-source.js +0 -71
- package/packages/@repo/previewing/dist/index.d.ts +0 -16
- package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/index.js +0 -13
- package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
- package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
- package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
- package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/format.js +0 -43
- package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
- package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/links.js +0 -31
- package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
- package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
- package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
- package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/search-index.js +0 -23
- package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
- package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/serialization.js +0 -108
- package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
- package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/toc-index.js +0 -53
- package/packages/@repo/previewing/dist/types.d.ts +0 -92
- package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/types.js +0 -1
- package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
- package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/utility-index.js +0 -201
- package/packages/@repo/previewing/package.json +0 -41
- package/packages/@repo/previewing/src/blob-source.ts +0 -185
- package/packages/@repo/previewing/src/config-loader.ts +0 -316
- package/packages/@repo/previewing/src/constants.ts +0 -16
- package/packages/@repo/previewing/src/content-index.ts +0 -384
- package/packages/@repo/previewing/src/content-source.ts +0 -12
- package/packages/@repo/previewing/src/fs-source.ts +0 -103
- package/packages/@repo/previewing/src/index.ts +0 -71
- package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
- package/packages/@repo/previewing/src/markdown/format.ts +0 -63
- package/packages/@repo/previewing/src/markdown/links.ts +0 -46
- package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
- package/packages/@repo/previewing/src/search-index.ts +0 -38
- package/packages/@repo/previewing/src/serialization.ts +0 -191
- package/packages/@repo/previewing/src/toc-index.ts +0 -72
- package/packages/@repo/previewing/src/types.ts +0 -105
- package/packages/@repo/previewing/src/utility-index.ts +0 -304
- package/packages/@repo/validation/dist/index.d.ts +0 -12
- package/packages/@repo/validation/dist/index.d.ts.map +0 -1
- package/packages/@repo/validation/dist/index.js +0 -30
- package/packages/@repo/validation/package.json +0 -38
- package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
- package/packages/@repo/validation/src/index.ts +0 -59
- package/scripts/prepare-package.mjs +0 -53
- package/scripts/repo-packages.mjs +0 -8
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { SiteConfig } from "@repo/models";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
buildPageMetadataMap,
|
|
5
|
-
shouldIncludeSearchEntry,
|
|
6
|
-
} from "./content-index.js";
|
|
7
|
-
import type { ContentIndex, SearchIndexItem, UtilityIndex } from "./types.js";
|
|
8
|
-
|
|
9
|
-
export const buildSearchIndex = (
|
|
10
|
-
index: ContentIndex,
|
|
11
|
-
config: SiteConfig,
|
|
12
|
-
utilityIndex?: UtilityIndex
|
|
13
|
-
): SearchIndexItem[] => {
|
|
14
|
-
const pageMetadataMap = buildPageMetadataMap(index);
|
|
15
|
-
const items = new Map<string, SearchIndexItem>();
|
|
16
|
-
|
|
17
|
-
for (const page of utilityIndex?.pages ?? []) {
|
|
18
|
-
items.set(page.slug, {
|
|
19
|
-
path: page.slug,
|
|
20
|
-
title: page.title,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
for (const entry of index.entries) {
|
|
25
|
-
if (!shouldIncludeSearchEntry(entry, pageMetadataMap, config)) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const pageMeta = pageMetadataMap.get(entry.slug);
|
|
30
|
-
items.set(entry.slug, {
|
|
31
|
-
href: pageMeta?.url,
|
|
32
|
-
path: entry.slug,
|
|
33
|
-
title: pageMeta?.sidebarTitle ?? entry.title,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return [...items.values()];
|
|
38
|
-
};
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PREBUILT_INDEX_PATH,
|
|
3
|
-
PREBUILT_OPENAPI_INDEX_PATH,
|
|
4
|
-
PREBUILT_SEARCH_INDEX_PATH,
|
|
5
|
-
PREBUILT_TOC_INDEX_PATH,
|
|
6
|
-
PREBUILT_UTILITY_INDEX_PATH,
|
|
7
|
-
} from "./constants.js";
|
|
8
|
-
import type { ContentSource } from "./content-source.js";
|
|
9
|
-
import type {
|
|
10
|
-
ContentEntry,
|
|
11
|
-
ContentIndex,
|
|
12
|
-
PrebuiltOpenApiEntry,
|
|
13
|
-
SearchIndexItem,
|
|
14
|
-
TocItem,
|
|
15
|
-
UtilityIndex,
|
|
16
|
-
UtilityPage,
|
|
17
|
-
UtilitySegment,
|
|
18
|
-
} from "./types.js";
|
|
19
|
-
|
|
20
|
-
interface SerializedContentIndex {
|
|
21
|
-
version: 1;
|
|
22
|
-
entries: ContentEntry[];
|
|
23
|
-
collections: Record<string, ContentEntry[]>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface SerializedOpenApiIndex {
|
|
27
|
-
entries: PrebuiltOpenApiEntry[];
|
|
28
|
-
version: 1;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface SerializedSearchIndex {
|
|
32
|
-
items: SearchIndexItem[];
|
|
33
|
-
version: 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface SerializedTocIndex {
|
|
37
|
-
itemsBySlug: Record<string, TocItem[]>;
|
|
38
|
-
version: 1;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface SerializedUtilityIndex {
|
|
42
|
-
description?: string;
|
|
43
|
-
name: string;
|
|
44
|
-
pages: UtilityPage[];
|
|
45
|
-
segments?: UtilitySegment[];
|
|
46
|
-
slug?: string;
|
|
47
|
-
version: 1;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const serializeContentIndex = (index: ContentIndex): string =>
|
|
51
|
-
JSON.stringify({
|
|
52
|
-
collections: Object.fromEntries(index.byCollection),
|
|
53
|
-
entries: index.entries,
|
|
54
|
-
version: 1,
|
|
55
|
-
} satisfies SerializedContentIndex);
|
|
56
|
-
|
|
57
|
-
export const serializeOpenApiIndex = (
|
|
58
|
-
entries: PrebuiltOpenApiEntry[]
|
|
59
|
-
): string =>
|
|
60
|
-
JSON.stringify({
|
|
61
|
-
entries,
|
|
62
|
-
version: 1,
|
|
63
|
-
} satisfies SerializedOpenApiIndex);
|
|
64
|
-
|
|
65
|
-
export const loadPrebuiltContentIndex = async (
|
|
66
|
-
source: ContentSource
|
|
67
|
-
): Promise<ContentIndex | null> => {
|
|
68
|
-
try {
|
|
69
|
-
const raw = await source.readFile(PREBUILT_INDEX_PATH);
|
|
70
|
-
const data = JSON.parse(raw) as SerializedContentIndex;
|
|
71
|
-
if (data.version !== 1 || !Array.isArray(data.entries)) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const bySlug = new Map<string, ContentEntry>();
|
|
76
|
-
const byCollection = new Map<string, ContentEntry[]>();
|
|
77
|
-
|
|
78
|
-
for (const entry of data.entries) {
|
|
79
|
-
bySlug.set(entry.slug, entry);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
for (const [collectionId, entries] of Object.entries(
|
|
83
|
-
data.collections ?? {}
|
|
84
|
-
)) {
|
|
85
|
-
byCollection.set(collectionId, entries);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
byCollection,
|
|
90
|
-
bySlug,
|
|
91
|
-
entries: data.entries,
|
|
92
|
-
errors: [],
|
|
93
|
-
};
|
|
94
|
-
} catch {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const loadPrebuiltOpenApiIndex = async (
|
|
100
|
-
source: ContentSource
|
|
101
|
-
): Promise<PrebuiltOpenApiEntry[] | null> => {
|
|
102
|
-
try {
|
|
103
|
-
const raw = await source.readFile(PREBUILT_OPENAPI_INDEX_PATH);
|
|
104
|
-
const data = JSON.parse(raw) as SerializedOpenApiIndex;
|
|
105
|
-
if (data.version !== 1 || !Array.isArray(data.entries)) {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return data.entries;
|
|
110
|
-
} catch {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const serializeSearchIndex = (items: SearchIndexItem[]): string =>
|
|
116
|
-
JSON.stringify({
|
|
117
|
-
items,
|
|
118
|
-
version: 1,
|
|
119
|
-
} satisfies SerializedSearchIndex);
|
|
120
|
-
|
|
121
|
-
export const loadPrebuiltSearchIndex = async (
|
|
122
|
-
source: ContentSource
|
|
123
|
-
): Promise<SearchIndexItem[] | null> => {
|
|
124
|
-
try {
|
|
125
|
-
const raw = await source.readFile(PREBUILT_SEARCH_INDEX_PATH);
|
|
126
|
-
const data = JSON.parse(raw) as SerializedSearchIndex;
|
|
127
|
-
if (data.version !== 1 || !Array.isArray(data.items)) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return data.items;
|
|
132
|
-
} catch {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export const serializeTocIndex = (
|
|
138
|
-
itemsBySlug: Map<string, TocItem[]>
|
|
139
|
-
): string =>
|
|
140
|
-
JSON.stringify({
|
|
141
|
-
itemsBySlug: Object.fromEntries(itemsBySlug),
|
|
142
|
-
version: 1,
|
|
143
|
-
} satisfies SerializedTocIndex);
|
|
144
|
-
|
|
145
|
-
export const loadPrebuiltTocIndex = async (
|
|
146
|
-
source: ContentSource
|
|
147
|
-
): Promise<Map<string, TocItem[]> | null> => {
|
|
148
|
-
try {
|
|
149
|
-
const raw = await source.readFile(PREBUILT_TOC_INDEX_PATH);
|
|
150
|
-
const data = JSON.parse(raw) as SerializedTocIndex;
|
|
151
|
-
if (data.version !== 1 || typeof data.itemsBySlug !== "object") {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return new Map(Object.entries(data.itemsBySlug ?? {}));
|
|
156
|
-
} catch {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
export const serializeUtilityIndex = (index: UtilityIndex): string =>
|
|
162
|
-
JSON.stringify({
|
|
163
|
-
...index,
|
|
164
|
-
version: 1,
|
|
165
|
-
} satisfies SerializedUtilityIndex);
|
|
166
|
-
|
|
167
|
-
export const loadPrebuiltUtilityIndex = async (
|
|
168
|
-
source: ContentSource
|
|
169
|
-
): Promise<UtilityIndex | null> => {
|
|
170
|
-
try {
|
|
171
|
-
const raw = await source.readFile(PREBUILT_UTILITY_INDEX_PATH);
|
|
172
|
-
const data = JSON.parse(raw) as SerializedUtilityIndex;
|
|
173
|
-
if (
|
|
174
|
-
data.version !== 1 ||
|
|
175
|
-
typeof data.name !== "string" ||
|
|
176
|
-
!Array.isArray(data.pages)
|
|
177
|
-
) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
description: data.description,
|
|
183
|
-
name: data.name,
|
|
184
|
-
pages: data.pages,
|
|
185
|
-
segments: Array.isArray(data.segments) ? data.segments : undefined,
|
|
186
|
-
slug: data.slug,
|
|
187
|
-
};
|
|
188
|
-
} catch {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { slugify } from "@repo/common";
|
|
2
|
-
|
|
3
|
-
import { NEWLINE_REGEX } from "./constants.js";
|
|
4
|
-
import type { ContentSource } from "./content-source.js";
|
|
5
|
-
import type { ContentIndex, TocItem } from "./types.js";
|
|
6
|
-
|
|
7
|
-
const HEADING_REGEX = /^(#{2,4})\s+(.*)$/;
|
|
8
|
-
// Matches ``` and ~~~ fenced blocks, requiring the same fence to close them.
|
|
9
|
-
const TOC_FENCE_REGEX = /(`{3,}|~{3,})[\s\S]*?\1/g;
|
|
10
|
-
|
|
11
|
-
export const extractToc = (source: string): TocItem[] => {
|
|
12
|
-
const withoutCode = source.replaceAll(TOC_FENCE_REGEX, "");
|
|
13
|
-
const lines = withoutCode.split(NEWLINE_REGEX);
|
|
14
|
-
const toc: TocItem[] = [];
|
|
15
|
-
const emitted = new Set<string>();
|
|
16
|
-
|
|
17
|
-
for (const line of lines) {
|
|
18
|
-
const match = HEADING_REGEX.exec(line.trim());
|
|
19
|
-
if (!match) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const [, hashes = "", heading = ""] = match;
|
|
24
|
-
if (!(hashes && heading)) {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const baseId = slugify(heading.trim());
|
|
29
|
-
// Increment until the id is unique among the ids we have already emitted,
|
|
30
|
-
// so a suffixed id never collides with an explicit "foo-1" heading.
|
|
31
|
-
let id = baseId;
|
|
32
|
-
let count = 1;
|
|
33
|
-
while (emitted.has(id)) {
|
|
34
|
-
id = `${baseId}-${count}`;
|
|
35
|
-
count += 1;
|
|
36
|
-
}
|
|
37
|
-
emitted.add(id);
|
|
38
|
-
|
|
39
|
-
toc.push({
|
|
40
|
-
id,
|
|
41
|
-
level: hashes.length,
|
|
42
|
-
title: heading.trim(),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return toc;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const buildTocIndex = async (
|
|
50
|
-
index: ContentIndex,
|
|
51
|
-
source: ContentSource
|
|
52
|
-
): Promise<Map<string, TocItem[]>> => {
|
|
53
|
-
const itemsBySlug = new Map<string, TocItem[]>();
|
|
54
|
-
|
|
55
|
-
const results = await Promise.all(
|
|
56
|
-
index.entries.map(async (entry) => {
|
|
57
|
-
if (entry.kind !== "entry") {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
const rawContent = await source.readFile(entry.relativePath);
|
|
61
|
-
return { slug: entry.slug, toc: extractToc(rawContent) };
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
for (const result of results) {
|
|
66
|
-
if (result) {
|
|
67
|
-
itemsBySlug.set(result.slug, result.toc);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return itemsBySlug;
|
|
72
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ContentType,
|
|
3
|
-
DocsOpenApiSource,
|
|
4
|
-
FrontmatterByType,
|
|
5
|
-
PageMode,
|
|
6
|
-
SiteConfig,
|
|
7
|
-
} from "@repo/models";
|
|
8
|
-
import type { OpenApiOperation, OpenApiSpec } from "@repo/prebuild";
|
|
9
|
-
|
|
10
|
-
export type SiteConfigResult =
|
|
11
|
-
| { ok: true; config: SiteConfig; warnings: string[] }
|
|
12
|
-
| { ok: false; errors: string[] };
|
|
13
|
-
|
|
14
|
-
export type ContentEntry =
|
|
15
|
-
| {
|
|
16
|
-
kind: "entry";
|
|
17
|
-
slug: string;
|
|
18
|
-
title: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
hidden?: boolean;
|
|
21
|
-
type: ContentType;
|
|
22
|
-
collectionId: string;
|
|
23
|
-
sourcePath: string;
|
|
24
|
-
relativePath: string;
|
|
25
|
-
frontmatter: FrontmatterByType[ContentType];
|
|
26
|
-
}
|
|
27
|
-
| {
|
|
28
|
-
kind: "index";
|
|
29
|
-
slug: string;
|
|
30
|
-
title: string;
|
|
31
|
-
description?: string;
|
|
32
|
-
type: ContentType;
|
|
33
|
-
collectionId: string;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export interface ContentIndex {
|
|
37
|
-
entries: ContentEntry[];
|
|
38
|
-
bySlug: Map<string, ContentEntry>;
|
|
39
|
-
byCollection: Map<string, ContentEntry[]>;
|
|
40
|
-
errors: string[];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface PageMetadata {
|
|
44
|
-
title?: string;
|
|
45
|
-
sidebarTitle?: string;
|
|
46
|
-
icon?: string;
|
|
47
|
-
iconType?: string;
|
|
48
|
-
tag?: string;
|
|
49
|
-
hidden?: boolean;
|
|
50
|
-
deprecated?: boolean;
|
|
51
|
-
url?: string;
|
|
52
|
-
mode?: PageMode;
|
|
53
|
-
noindex?: boolean;
|
|
54
|
-
hideFooterPagination?: boolean;
|
|
55
|
-
hideApiMarker?: boolean;
|
|
56
|
-
keywords?: string[];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface SearchIndexItem {
|
|
60
|
-
href?: string;
|
|
61
|
-
title: string;
|
|
62
|
-
path: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface TocItem {
|
|
66
|
-
id: string;
|
|
67
|
-
level: number;
|
|
68
|
-
title: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface UtilityPage {
|
|
72
|
-
content: string;
|
|
73
|
-
description?: string;
|
|
74
|
-
slug: string;
|
|
75
|
-
title: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface UtilitySegment {
|
|
79
|
-
pageSlugs: string[];
|
|
80
|
-
slug: string;
|
|
81
|
-
title: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface UtilityIndex {
|
|
85
|
-
description?: string;
|
|
86
|
-
name: string;
|
|
87
|
-
pages: UtilityPage[];
|
|
88
|
-
segments?: UtilitySegment[];
|
|
89
|
-
slug?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface UtilityArtifact {
|
|
93
|
-
content: string;
|
|
94
|
-
contentType: string;
|
|
95
|
-
path: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface PrebuiltOpenApiEntry {
|
|
99
|
-
identifier: string;
|
|
100
|
-
operation: OpenApiOperation;
|
|
101
|
-
slug: string;
|
|
102
|
-
source: DocsOpenApiSource;
|
|
103
|
-
sourceKey: string;
|
|
104
|
-
spec: OpenApiSpec;
|
|
105
|
-
}
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import { normalizePath, slugify } from "@repo/common";
|
|
2
|
-
import type { SiteConfig } from "@repo/models";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
getDocsCollectionWithNavigation,
|
|
6
|
-
getDocsNavigation,
|
|
7
|
-
} from "./config-loader.js";
|
|
8
|
-
import {
|
|
9
|
-
PREBUILT_UTILITY_LLMS_FULL_PATH,
|
|
10
|
-
PREBUILT_UTILITY_LLMS_PATH,
|
|
11
|
-
PREBUILT_UTILITY_LLMS_SEGMENT_PREFIX,
|
|
12
|
-
PREBUILT_UTILITY_SITEMAP_PATH,
|
|
13
|
-
PREBUILT_UTILITY_SKILLS_INDEX_PATH,
|
|
14
|
-
PREBUILT_UTILITY_SKILLS_MD_PREFIX,
|
|
15
|
-
UTILITY_DOCS_ROOT_TOKEN,
|
|
16
|
-
} from "./constants.js";
|
|
17
|
-
import {
|
|
18
|
-
buildPageMetadataMap,
|
|
19
|
-
shouldIncludeSearchEntry,
|
|
20
|
-
} from "./content-index.js";
|
|
21
|
-
import type { ContentSource } from "./content-source.js";
|
|
22
|
-
import {
|
|
23
|
-
prepareLlmsFullContent,
|
|
24
|
-
toAgentMarkdown,
|
|
25
|
-
} from "./markdown/agent-markdown.js";
|
|
26
|
-
import {
|
|
27
|
-
formatMarkdownPage,
|
|
28
|
-
formatMarkdownPageSection,
|
|
29
|
-
stripFrontmatter,
|
|
30
|
-
} from "./markdown/format.js";
|
|
31
|
-
import { buildUtilityOpenApiPages } from "./openapi-pages.js";
|
|
32
|
-
import type {
|
|
33
|
-
ContentIndex,
|
|
34
|
-
UtilityArtifact,
|
|
35
|
-
UtilityIndex,
|
|
36
|
-
UtilityPage,
|
|
37
|
-
UtilitySegment,
|
|
38
|
-
} from "./types.js";
|
|
39
|
-
|
|
40
|
-
const collectUtilitySegments = (
|
|
41
|
-
config: SiteConfig,
|
|
42
|
-
pages: Map<string, UtilityPage>
|
|
43
|
-
): UtilitySegment[] => {
|
|
44
|
-
const segments = new Map<string, UtilitySegment>();
|
|
45
|
-
const addGroup = (group: {
|
|
46
|
-
group?: string;
|
|
47
|
-
hidden?: boolean;
|
|
48
|
-
pages?: string[];
|
|
49
|
-
}) => {
|
|
50
|
-
if (group.hidden || !group.group) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const pageSlugs = (group.pages ?? []).filter((page) => pages.has(page));
|
|
54
|
-
if (pageSlugs.length === 0) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const slug = slugify(group.group);
|
|
58
|
-
segments.set(slug, { pageSlugs, slug, title: group.group });
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const navigation = getDocsNavigation(config);
|
|
62
|
-
for (const group of navigation?.groups ?? []) {
|
|
63
|
-
addGroup(group);
|
|
64
|
-
}
|
|
65
|
-
for (const tab of navigation?.tabs ?? []) {
|
|
66
|
-
for (const group of tab.groups ?? []) {
|
|
67
|
-
addGroup(group);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return [...segments.values()];
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const buildUtilityIndex = async (
|
|
75
|
-
index: ContentIndex,
|
|
76
|
-
source: ContentSource,
|
|
77
|
-
config: SiteConfig
|
|
78
|
-
): Promise<UtilityIndex> => {
|
|
79
|
-
const pageMetadataMap = buildPageMetadataMap(index);
|
|
80
|
-
const pages = new Map<string, UtilityPage>();
|
|
81
|
-
|
|
82
|
-
const contentPages = await Promise.all(
|
|
83
|
-
index.entries.map(async (entry) => {
|
|
84
|
-
if (entry.kind !== "entry") {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
if (!shouldIncludeSearchEntry(entry, pageMetadataMap, config)) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
const rawContent = await source.readFile(entry.relativePath);
|
|
91
|
-
return {
|
|
92
|
-
content: stripFrontmatter(rawContent),
|
|
93
|
-
description: entry.description,
|
|
94
|
-
slug: entry.slug,
|
|
95
|
-
title: entry.title,
|
|
96
|
-
} satisfies UtilityPage;
|
|
97
|
-
})
|
|
98
|
-
);
|
|
99
|
-
for (const page of contentPages) {
|
|
100
|
-
if (page) {
|
|
101
|
-
pages.set(page.slug, page);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
for (const page of await buildUtilityOpenApiPages(
|
|
106
|
-
config,
|
|
107
|
-
getDocsCollectionWithNavigation(config),
|
|
108
|
-
source
|
|
109
|
-
)) {
|
|
110
|
-
pages.set(page.slug, page);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const sortedPages = [...pages.values()];
|
|
114
|
-
// oxlint-disable-next-line eslint-plugin-unicorn/no-array-sort
|
|
115
|
-
sortedPages.sort((left, right) => left.slug.localeCompare(right.slug));
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
description: config.description,
|
|
119
|
-
name: config.name,
|
|
120
|
-
pages: sortedPages,
|
|
121
|
-
segments: collectUtilitySegments(config, pages),
|
|
122
|
-
slug: config.slug,
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const toUtilityDocPath = (value: string) => {
|
|
127
|
-
const clean = normalizePath(value);
|
|
128
|
-
if (!clean || clean === "index") {
|
|
129
|
-
return "/";
|
|
130
|
-
}
|
|
131
|
-
return `/${clean}`;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const toUtilityTemplatedDocUrl = (value: string) =>
|
|
135
|
-
`${UTILITY_DOCS_ROOT_TOKEN}${toUtilityDocPath(value)}`;
|
|
136
|
-
|
|
137
|
-
const toUtilityTemplatedMarkdownDocUrl = (value: string) => {
|
|
138
|
-
const clean = normalizePath(value);
|
|
139
|
-
if (!clean || clean === "index") {
|
|
140
|
-
return `${UTILITY_DOCS_ROOT_TOKEN}/index.md`;
|
|
141
|
-
}
|
|
142
|
-
return `${UTILITY_DOCS_ROOT_TOKEN}/${clean}.md`;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export const getPrebuiltUtilityLlmPagePath = (slug: string) => {
|
|
146
|
-
const normalized = normalizePath(slug);
|
|
147
|
-
return `_utility/llms-pages/${normalized || "index"}.mdx`;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export const buildUtilityArtifacts = (
|
|
151
|
-
index: UtilityIndex
|
|
152
|
-
): UtilityArtifact[] => {
|
|
153
|
-
const segments = index.segments ?? [];
|
|
154
|
-
const segmentLines =
|
|
155
|
-
segments.length > 0
|
|
156
|
-
? [
|
|
157
|
-
"",
|
|
158
|
-
"## Segments",
|
|
159
|
-
...segments.map(
|
|
160
|
-
(segment) =>
|
|
161
|
-
`- [${segment.title}](${UTILITY_DOCS_ROOT_TOKEN}/llms/${segment.slug}.txt)`
|
|
162
|
-
),
|
|
163
|
-
]
|
|
164
|
-
: [];
|
|
165
|
-
const llmsLines = [
|
|
166
|
-
`# ${index.name}`,
|
|
167
|
-
index.description ? `> ${index.description}` : null,
|
|
168
|
-
"",
|
|
169
|
-
`Sitemap: ${toUtilityTemplatedDocUrl("sitemap.xml")}`,
|
|
170
|
-
`Full content: ${UTILITY_DOCS_ROOT_TOKEN}/llms-full.txt`,
|
|
171
|
-
`Skills: ${UTILITY_DOCS_ROOT_TOKEN}/.well-known/skills/index.json`,
|
|
172
|
-
...segmentLines,
|
|
173
|
-
"",
|
|
174
|
-
"## Docs",
|
|
175
|
-
...index.pages.map((page) => {
|
|
176
|
-
const description = page.description ? `: ${page.description}` : "";
|
|
177
|
-
return `- [${page.title}](${toUtilityTemplatedMarkdownDocUrl(page.slug)})${description}`;
|
|
178
|
-
}),
|
|
179
|
-
];
|
|
180
|
-
|
|
181
|
-
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
|
|
182
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
183
|
-
${index.pages
|
|
184
|
-
.map(
|
|
185
|
-
(page) => ` <url><loc>${toUtilityTemplatedDocUrl(page.slug)}</loc></url>`
|
|
186
|
-
)
|
|
187
|
-
.join("\n")}
|
|
188
|
-
</urlset>`;
|
|
189
|
-
|
|
190
|
-
const llmsFull = index.pages
|
|
191
|
-
.map((page) =>
|
|
192
|
-
formatMarkdownPageSection(
|
|
193
|
-
page.title,
|
|
194
|
-
toUtilityTemplatedDocUrl(page.slug),
|
|
195
|
-
prepareLlmsFullContent(page.content, UTILITY_DOCS_ROOT_TOKEN, ""),
|
|
196
|
-
page.description
|
|
197
|
-
)
|
|
198
|
-
)
|
|
199
|
-
.join("\n\n");
|
|
200
|
-
|
|
201
|
-
const skillSlug = index.slug ?? slugify(index.name);
|
|
202
|
-
const skillDescription =
|
|
203
|
-
`${index.name} documentation. ${index.description ?? ""}`.trim();
|
|
204
|
-
const skillsIndex = JSON.stringify(
|
|
205
|
-
{
|
|
206
|
-
skills: [
|
|
207
|
-
{
|
|
208
|
-
description: skillDescription,
|
|
209
|
-
files: ["SKILL.md"],
|
|
210
|
-
name: skillSlug,
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
},
|
|
214
|
-
null,
|
|
215
|
-
2
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
const topPages = index.pages.slice(0, 20);
|
|
219
|
-
const skillMdLines = [
|
|
220
|
-
"---",
|
|
221
|
-
`name: ${skillSlug}`,
|
|
222
|
-
`description: ${skillDescription} Use when working with ${index.name}, answering questions about its features, or helping users follow its guides.`,
|
|
223
|
-
"---",
|
|
224
|
-
"",
|
|
225
|
-
`# ${index.name}`,
|
|
226
|
-
"",
|
|
227
|
-
index.description ? `${index.description}\n` : "",
|
|
228
|
-
"## Documentation",
|
|
229
|
-
"",
|
|
230
|
-
`- Full docs index: ${UTILITY_DOCS_ROOT_TOKEN}/llms.txt`,
|
|
231
|
-
`- Complete docs content: ${UTILITY_DOCS_ROOT_TOKEN}/llms-full.txt`,
|
|
232
|
-
"- Append `.md` to any page URL for raw markdown",
|
|
233
|
-
"",
|
|
234
|
-
"## Key Pages",
|
|
235
|
-
"",
|
|
236
|
-
...topPages.map((page) => {
|
|
237
|
-
const desc = page.description ? ` - ${page.description}` : "";
|
|
238
|
-
return `- [${page.title}](${toUtilityTemplatedMarkdownDocUrl(
|
|
239
|
-
page.slug
|
|
240
|
-
)})${desc}`;
|
|
241
|
-
}),
|
|
242
|
-
];
|
|
243
|
-
|
|
244
|
-
return [
|
|
245
|
-
{
|
|
246
|
-
content: sitemap,
|
|
247
|
-
contentType: "application/xml; charset=utf-8",
|
|
248
|
-
path: PREBUILT_UTILITY_SITEMAP_PATH,
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
content: llmsLines.filter((line) => line !== null).join("\n"),
|
|
252
|
-
contentType: "text/plain; charset=utf-8",
|
|
253
|
-
path: PREBUILT_UTILITY_LLMS_PATH,
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
content: llmsFull,
|
|
257
|
-
contentType: "text/plain; charset=utf-8",
|
|
258
|
-
path: PREBUILT_UTILITY_LLMS_FULL_PATH,
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
content: skillsIndex,
|
|
262
|
-
contentType: "application/json; charset=utf-8",
|
|
263
|
-
path: PREBUILT_UTILITY_SKILLS_INDEX_PATH,
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
content: skillMdLines.filter((line) => line !== null).join("\n"),
|
|
267
|
-
contentType: "text/markdown; charset=utf-8",
|
|
268
|
-
path: `${PREBUILT_UTILITY_SKILLS_MD_PREFIX}${skillSlug}/SKILL.md`,
|
|
269
|
-
},
|
|
270
|
-
...segments.map((segment) => {
|
|
271
|
-
const segmentPages = index.pages.filter((page) =>
|
|
272
|
-
segment.pageSlugs.includes(page.slug)
|
|
273
|
-
);
|
|
274
|
-
const content = [
|
|
275
|
-
`# ${index.name} - ${segment.title}`,
|
|
276
|
-
`> Segment of ${UTILITY_DOCS_ROOT_TOKEN}/llms-full.txt`,
|
|
277
|
-
"",
|
|
278
|
-
...segmentPages.map((page) =>
|
|
279
|
-
formatMarkdownPageSection(
|
|
280
|
-
page.title,
|
|
281
|
-
toUtilityTemplatedDocUrl(page.slug),
|
|
282
|
-
prepareLlmsFullContent(page.content, UTILITY_DOCS_ROOT_TOKEN, ""),
|
|
283
|
-
page.description
|
|
284
|
-
)
|
|
285
|
-
),
|
|
286
|
-
].join("\n\n");
|
|
287
|
-
|
|
288
|
-
return {
|
|
289
|
-
content,
|
|
290
|
-
contentType: "text/plain; charset=utf-8",
|
|
291
|
-
path: `${PREBUILT_UTILITY_LLMS_SEGMENT_PREFIX}${segment.slug}.txt`,
|
|
292
|
-
};
|
|
293
|
-
}),
|
|
294
|
-
...index.pages.map((page) => ({
|
|
295
|
-
content: formatMarkdownPage(
|
|
296
|
-
page.title,
|
|
297
|
-
toAgentMarkdown(page.content),
|
|
298
|
-
page.description
|
|
299
|
-
),
|
|
300
|
-
contentType: "text/markdown; charset=utf-8",
|
|
301
|
-
path: getPrebuiltUtilityLlmPagePath(page.slug),
|
|
302
|
-
})),
|
|
303
|
-
];
|
|
304
|
-
};
|