Skip to content

Commit fa96ccb

Browse files
feat: llm ready docs (#348)
* feat: add docusaurus-plugin-llms refactor: rename and import reusable markdowns using relative path chore: delete gitignored files from autogen directory refactor: rename table files in autogen dir as per docusaurus recommendation refactor: rename HardcodedDemonstration and move to snippets directory * docs: move comments around refactor: fix PluginOptions type refactor: smol wording changes * refactor: local environment markdowns refactor: replace bash content with CodeBlock in markdown files build: include patch number in llms plugin version * fix: use bun in docs --------- Co-authored-by: Paul Razvan Berg <[email protected]>
1 parent 716f5fc commit fa96ccb

File tree

72 files changed

+2262
-5559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2262
-5559
lines changed

bun.lock

Lines changed: 1718 additions & 2262 deletions
Large diffs are not rendered by default.

cli/helpers.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from "node:fs";
22
import * as path from "node:path";
3-
import _ from "lodash";
43
import type { Sablier } from "sablier";
54
import type { CliOptions } from "./types";
65

@@ -11,9 +10,9 @@ if (!fs.existsSync(path.join(ROOT_DIR, "package.json"))) {
1110

1211
export const autogenFilePaths = {
1312
deployments: (release: Sablier.Release) =>
14-
path.join(ROOT_DIR, "src", "autogen", release.protocol, `TableDeployments${_.capitalize(release.version)}.mdx`),
15-
envio: (protocol: Sablier.Protocol) => path.join(ROOT_DIR, "src", "autogen", protocol, "TableEnvio.mdx"),
16-
graph: (protocol: Sablier.Protocol) => path.join(ROOT_DIR, "src", "autogen", protocol, "TableTheGraph.mdx"),
13+
path.join(ROOT_DIR, "src", "autogen", release.protocol, `_table-deployments-${release.version}.mdx`),
14+
envio: (protocol: Sablier.Protocol) => path.join(ROOT_DIR, "src", "autogen", protocol, "_table-envio.mdx"),
15+
graph: (protocol: Sablier.Protocol) => path.join(ROOT_DIR, "src", "autogen", protocol, "_table-graph.mdx"),
1716
};
1817

1918
type FileWriteParams = {

config/plugins.ts

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Options as ClientRedirectsOptions } from "@docusaurus/plugin-clien
22
import type { Options as VercelAnalyticsOptions } from "@docusaurus/plugin-vercel-analytics";
33
import type { DocusaurusConfig, PluginOptions } from "@docusaurus/types";
44
import type { ConfigOptions, GraphQLMarkdownCliOptions, LoaderOption } from "@graphql-markdown/types";
5+
import type { PluginOptions as LlmPluginOptions } from "docusaurus-plugin-llms";
56
import { createRedirects, redirects } from "./redirects";
67

78
/* -------------------------------------------------------------------------- */
@@ -47,6 +48,106 @@ const graphqlMarkdown: [string, GraphQLMarkdownOptions] = [
4748
} satisfies ConfigOptions,
4849
];
4950

51+
/* -------------------------------------------------------------------------- */
52+
/* LLM PLUGIN */
53+
/* -------------------------------------------------------------------------- */
54+
55+
/**
56+
* The plugin follows llmstxt.org standards and generates the following files during the build process:
57+
* - llms.txt: Contains links to the markdown files of all sections.
58+
* - llms-airdrops.txt: Contains full content relevant to the Merkle Airdrops protocol.
59+
* - llms-flow.txt: Contains full content relevant to the Flow protocol.
60+
* - llms-lockup.txt: Contains full content relevant to the Lockup protocol.
61+
* - llms-training-data.txt: Contains full content of all markdown files.
62+
*
63+
* @see https://llmstxt.org
64+
* @see https://github.com/rachfop/docusaurus-plugin-llms
65+
*/
66+
const llmPlugin: [string, LlmPluginOptions & { [key: string]: unknown }] = [
67+
"docusaurus-plugin-llms",
68+
{
69+
// Protocol specific LLM files.
70+
customLLMFiles: [
71+
{
72+
description: "Merkle Airdrops is useful to distribute tokens to a large number of users efficiently.",
73+
filename: "llms-airdrops.txt",
74+
// Create a single markdown file with the full content of the section.
75+
fullContent: true,
76+
includePatterns: [
77+
"**/airdrops/**/*.md",
78+
"**/airdrops/**/*.mdx",
79+
"apps/features/01-airdrops.mdx",
80+
"apps/guides/*.md",
81+
"apps/guides/*.mdx",
82+
"concepts/05-merkle-airdrops.mdx",
83+
"support/*.md",
84+
"support/*.mdx",
85+
],
86+
title: "Sablier Merkle Airdrops Documentation",
87+
},
88+
{
89+
description: "Sablier Flow is useful for payroll, grants, insurance premiums, loans interest and ESOPs.",
90+
filename: "llms-flow.txt",
91+
// Create a single markdown file with the full content of the section.
92+
fullContent: true,
93+
includePatterns: [
94+
"**/flow/**/*.md",
95+
"**/flow/**/*.mdx",
96+
"apps/features/03-payments.mdx",
97+
"apps/guides/*.md",
98+
"apps/guides/*.mdx",
99+
"support/*.md",
100+
"support/*.mdx",
101+
],
102+
title: "Sablier Flow Documentation",
103+
},
104+
{
105+
description: "Sablier Lockup is useful for token vesting and airdrops.",
106+
filename: "llms-lockup.txt",
107+
// Create a single markdown file with the full content of the section.
108+
fullContent: true,
109+
includePatterns: [
110+
"**/lockup/**/*.md",
111+
"**/lockup/**/*.mdx",
112+
"apps/features/02-vesting.mdx",
113+
"apps/guides/*.md",
114+
"apps/guides/*.mdx",
115+
"support/*.md",
116+
"support/*.mdx",
117+
],
118+
title: "Sablier Lockup Documentation",
119+
},
120+
{
121+
// Useful to train or fine-tune an LLM on Sablier docs.
122+
filename: "llms-training-data.txt",
123+
fullContent: true,
124+
includePatterns: ["**/*.md", "**/*.mdx"],
125+
},
126+
],
127+
docsDir: "docs",
128+
// Remove imports from mdx files.
129+
excludeImports: true,
130+
generateLLMsFullTxt: false,
131+
// Generate index file linking to markdown files.
132+
generateLLMsTxt: true,
133+
// Generates individual markdown files and adds them to llms.txt.
134+
generateMarkdownFiles: true,
135+
// Ignore snippet files since they're already included via imports.
136+
ignoreFiles: ["snippets/**/*"],
137+
// Section ordering in the index file.
138+
includeOrder: ["concepts/*", "guides/*", "reference/*", "api/*", "apps/*", "support/*"],
139+
// Remove duplicate content matching headings.
140+
removeDuplicateHeadings: true,
141+
rootContent: `Sablier docs is optimized for LLMs and AI assistants. Navigation tips:
142+
- For subgraph APIs or Merkle APIs, use the "API" section.
143+
- For deployment addresses and examples on using the contracts, use the "Guides" section.
144+
- For contracts, use the "References" section.
145+
- For FAQs, use the "Support" section.
146+
`,
147+
title: "Sablier Docs",
148+
},
149+
];
150+
50151
/* -------------------------------------------------------------------------- */
51152
/* VERCEL ANALYTICS */
52153
/* -------------------------------------------------------------------------- */
@@ -58,4 +159,4 @@ const vercelAnalytics: [string, VercelAnalyticsOptions] = [
58159
},
59160
];
60161

61-
export const plugins: DocusaurusConfig["plugins"] = [clientRedirects, graphqlMarkdown, vercelAnalytics];
162+
export const plugins: DocusaurusConfig["plugins"] = [clientRedirects, graphqlMarkdown, llmPlugin, vercelAnalytics];

docs/api/07-legacy.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 7
44
title: "Legacy"
55
---
66

7-
import ExplainerTheGraph from "@site/src/snippets/ExplainerTheGraph.mdx";
7+
import ExplainerTheGraph from "../../src/snippets/_explainer-graph.mdx";
88

99
# Sablier Legacy
1010

docs/api/airdrops/01-indexers.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ sidebar_position: 1
44
title: "Indexers"
55
---
66

7-
import TableEnvio from "@site/src/autogen/airdrops/TableEnvio.mdx";
8-
import TableTheGraph from "@site/src/autogen/airdrops/TableTheGraph.mdx";
97
import LinkPreviewIndexers from "@site/src/components/molecules/link-previews/Indexers";
10-
import ExplainerEnvio from "@site/src/snippets/ExplainerEnvio.mdx";
11-
import ExplainerTheGraph from "@site/src/snippets/ExplainerTheGraph.mdx";
8+
import TableEnvio from "../../../src/autogen/airdrops/_table-envio.mdx";
9+
import TableTheGraph from "../../../src/autogen/airdrops/_table-graph.mdx";
10+
import ExplainerEnvio from "../../../src/snippets/_explainer-envio.mdx";
11+
import ExplainerTheGraph from "../../../src/snippets/_explainer-graph.mdx";
1212

1313
# Sablier Airdrops
1414

docs/api/airdrops/05-previous-indexers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 5
44
title: "Previous Indexers"
55
---
66

7-
import DeprecatedIndexers from "@site/src/snippets/DeprecatedIndexers.mdx";
7+
import DeprecatedIndexers from "../../../src/snippets/_deprecated-indexers.mdx";
88

99
<DeprecatedIndexers />
1010

docs/api/flow/01-indexers.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ sidebar_position: 1
44
title: "Indexers"
55
---
66

7-
import TableEnvio from "@site/src/autogen/flow/TableEnvio.mdx";
8-
import TableTheGraph from "@site/src/autogen/flow/TableTheGraph.mdx";
97
import LinkPreviewIndexers from "@site/src/components/molecules/link-previews/Indexers";
10-
import ExplainerEnvio from "@site/src/snippets/ExplainerEnvio.mdx";
11-
import ExplainerTheGraph from "@site/src/snippets/ExplainerTheGraph.mdx";
8+
import TableEnvio from "../../../src/autogen/flow/_table-envio.mdx";
9+
import TableTheGraph from "../../../src/autogen/flow/_table-graph.mdx";
10+
import ExplainerEnvio from "../../../src/snippets/_explainer-envio.mdx";
11+
import ExplainerTheGraph from "../../../src/snippets/_explainer-graph.mdx";
1212

1313
# Sablier Flow
1414

docs/api/flow/03-previous-indexers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 3
44
title: "Previous Indexers"
55
---
66

7-
import DeprecatedIndexers from "@site/src/snippets/DeprecatedIndexers.mdx";
7+
import DeprecatedIndexers from "../../../src/snippets/_deprecated-indexers.mdx";
88

99
<DeprecatedIndexers />
1010

docs/api/lockup/01-indexers.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ sidebar_position: 1
44
title: "Indexers"
55
---
66

7-
import TableEnvio from "@site/src/autogen/lockup/TableEnvio.mdx";
8-
import TableTheGraph from "@site/src/autogen/lockup/TableTheGraph.mdx";
97
import LinkPreviewIndexers from "@site/src/components/molecules/link-previews/Indexers";
10-
import ExplainerEnvio from "@site/src/snippets/ExplainerEnvio.mdx";
11-
import ExplainerTheGraph from "@site/src/snippets/ExplainerTheGraph.mdx";
8+
import TableEnvio from "../../../src/autogen/lockup/_table-envio.mdx";
9+
import TableTheGraph from "../../../src/autogen/lockup/_table-graph.mdx";
10+
import ExplainerEnvio from "../../../src/snippets/_explainer-envio.mdx";
11+
import ExplainerTheGraph from "../../../src/snippets/_explainer-graph.mdx";
1212

1313
# Sablier Lockup
1414

docs/api/lockup/03-previous-indexers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 3
44
title: "Previous Indexers"
55
---
66

7-
import DeprecatedIndexers from "@site/src/snippets/DeprecatedIndexers.mdx";
7+
import DeprecatedIndexers from "../../../src/snippets/_deprecated-indexers.mdx";
88

99
<DeprecatedIndexers />
1010

0 commit comments

Comments
 (0)