Skip to content

Commit 18187fb

Browse files
committed
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
1 parent 716f5fc commit 18187fb

File tree

62 files changed

+1959
-4468
lines changed

Some content is hidden

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

62 files changed

+1959
-4468
lines changed

bun.lock

Lines changed: 1780 additions & 1727 deletions
Large diffs are not rendered by default.

cli/helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ if (!fs.existsSync(path.join(ROOT_DIR, "package.json"))) {
1111

1212
export const autogenFilePaths = {
1313
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"),
14+
path.join(ROOT_DIR, "src", "autogen", release.protocol, `_table-deployments-${release.version}.mdx`),
15+
envio: (protocol: Sablier.Protocol) => path.join(ROOT_DIR, "src", "autogen", protocol, "_table-envio.mdx"),
16+
graph: (protocol: Sablier.Protocol) => path.join(ROOT_DIR, "src", "autogen", protocol, "_table-graph.mdx"),
1717
};
1818

1919
type FileWriteParams = {

config/plugins.ts

Lines changed: 105 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,103 @@ const graphqlMarkdown: [string, GraphQLMarkdownOptions] = [
4748
} satisfies ConfigOptions,
4849
];
4950

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

61-
export const plugins: DocusaurusConfig["plugins"] = [clientRedirects, graphqlMarkdown, vercelAnalytics];
159+
export const plugins: DocusaurusConfig["plugins"] = [
160+
clientRedirects,
161+
graphqlMarkdown,
162+
// biome-ignore lint/suspicious/noExplicitAny: required for llm plugin.
163+
llmPlugin as any,
164+
vercelAnalytics,
165+
];

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)