forked from denoland/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_llms_gen.ts
More file actions
38 lines (29 loc) · 1.16 KB
/
Copy pathtest_llms_gen.ts
File metadata and controls
38 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env -S deno run --allow-read --allow-write --allow-env
/**
* This script tests the LLMs file generation directly
*/
import { join } from "@std/path";
import { log } from "lume/core/utils/log.ts";
// Mock site.dest function
const site = {
dest: (path: string) => join(Deno.cwd(), "_site", path),
};
async function testLlmsGeneration() {
log.info("Testing LLM-friendly documentation files generation...");
// Import and call the LLMs generation function directly
const { default: generateModule } = await import("./generate_llms_files.ts");
const { collectFiles, generateLlmsTxt, generateLlmsFullTxt } = generateModule;
const files = await collectFiles();
log.info(`Collected ${files.length} documentation files for LLMs`);
// Generate llms.txt
const llmsTxt = generateLlmsTxt(files);
await Deno.writeTextFile(site.dest("llms.txt"), llmsTxt);
log.info("Generated llms.txt in site root");
// Generate llms-full.txt
const llmsFullTxt = generateLlmsFullTxt(files);
await Deno.writeTextFile(site.dest("llms-full.txt"), llmsFullTxt);
log.info("Generated llms-full.txt in site root");
log.info("Done!");
}
// Run the test
testLlmsGeneration();