Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const llmsTxtPlugin = require("./scripts/llms-txt-plugin");

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand All @@ -28,6 +29,7 @@ const config = {
includeParentCategoriesInPageTitle: true,
},
],
llmsTxtPlugin,
],
scripts: [
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"format": "npx prettier --write '**/*.{js,jsx,md,mdx,json,css}'",
"format-check": "npx prettier --check '**/*.{js,jsx,md,mdx,json,css}'"
"format-check": "npx prettier --check '**/*.{js,jsx,md,mdx,json,css}'",
"generate-llms": "node scripts/generate-llms-full.js"
},
"dependencies": {
"@cmfcmf/docusaurus-search-local": "^1.2.0",
Expand Down
39 changes: 39 additions & 0 deletions scripts/generate-llms-full.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env node

const path = require("path");
const fs = require("fs");
const { generateLlmsTxt, DEFAULT_HEADER_CONTENT } = require("./generate-llms-txt");

console.log("📝 Generating llms-full.txt file for LLM context...");

// Ensure the static directory exists
const staticDir = path.join(__dirname, "..", "static");
if (!fs.existsSync(staticDir)) {
fs.mkdirSync(staticDir, { recursive: true });
}

// Define paths
const docsDir = path.join(__dirname, "..", "docs");
const outputPath = path.join(staticDir, "llms-full.txt");

// Check if docs directory exists
if (!fs.existsSync(docsDir)) {
console.error(`❌ Error: Docs directory does not exist: ${docsDir}`);
process.exit(1);
}

// Generate the llms-full.txt file
generateLlmsTxt(docsDir, outputPath, DEFAULT_HEADER_CONTENT)
.then(() => {
// Verify the file was created
if (fs.existsSync(outputPath)) {
const stats = fs.statSync(outputPath);
console.log(`✅ Generated llms-full.txt (${Math.round(stats.size / 1024)} KB)`);
} else {
console.error(`❌ Failed to generate llms-full.txt`);
}
})
.catch(err => {
console.error("❌ Error generating llms-full.txt:", err.message);
process.exit(1);
});
Loading