VibeGame / src /lib /server /documentation.ts
dylanebert's picture
improved prompting/UX
db9635c
raw
history blame contribute delete
645 Bytes
import { readFile } from "fs/promises";
import { join } from "path";
export class DocumentationService {
private cache: string | null = null;
private readonly docsPath: string;
constructor(filename: string = "llms.txt") {
this.docsPath = join(process.cwd(), filename);
}
async load(): Promise<string | null> {
if (this.cache !== null) {
return this.cache;
}
try {
this.cache = await readFile(this.docsPath, "utf-8");
return this.cache;
} catch {
return null;
}
}
clearCache(): void {
this.cache = null;
}
}
export const documentationService = new DocumentationService();