MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / readMetaFromFile

Function readMetaFromFile

showcase/shell-docs/src/lib/llm-text.ts:236–256  ·  view source on GitHub ↗
(absPath: string)

Source from the content-addressed store, hash-verified

234}
235
236function readMetaFromFile(absPath: string): {
237 title?: string;
238 description?: string;
239} {
240 try {
241 const raw = fs.readFileSync(absPath, "utf-8");
242 const { data } = matter(raw);
243 return {
244 title: typeof data.title === "string" ? data.title : undefined,
245 description:
246 typeof data.description === "string" ? data.description : undefined,
247 };
248 } catch (err) {
249 // Log so an author whose page has malformed YAML / unreadable file
250 // can correlate "my page appears bare in /llms.txt" with the
251 // underlying cause. Empty meta is still returned so the rest of the
252 // index render keeps going.
253 console.error("[llm-text] failed to read meta", absPath, err);
254 return {};
255 }
256}
257
258// -----------------------------------------------------------------------
259// Snippet resolution

Callers 1

getAllLlmPagesFunction · 0.85

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…