MCPcopy Create free account
hub / github.com/Drakkar-Software/OctoBot / processFile

Function processFile

docs/scripts/collect-tentacles.mjs:93–114  ·  view source on GitHub ↗
(filePath, category)

Source from the content-addressed store, hash-verified

91}
92
93async function processFile(filePath, category) {
94 const rawContent = await readFile(filePath, 'utf-8');
95 const name = basename(filePath, '.md');
96 const slug = toSlug(name);
97 const title = toTitle(name);
98 const content = stripFrontmatter(rawContent);
99
100 const description = extractDescription(content, `${title} - OctoBot tentacle documentation and configuration guide`);
101
102 const frontmatter = `---
103title: "${escapeYaml(title)}"
104description: "${escapeYaml(description)}"
105keywords: [${category.keywords.map(k => `"${k}"`).join(', ')}, "${slug}"]
106slug: /${category.slugBase}/${slug}
107format: md
108---`;
109
110 const output = `${frontmatter}\n\n${content}\n`;
111 const outputDir = join(CONTENT_DIR, category.audience, category.dir);
112 await mkdir(outputDir, {recursive: true});
113 await writeFile(join(outputDir, `${slug}.md`), output, 'utf-8');
114}
115
116async function writeCategoryJson(dir, label, position) {
117 await mkdir(dir, {recursive: true});

Callers 1

mainFunction · 0.85

Calls 8

toSlugFunction · 0.90
stripFrontmatterFunction · 0.90
extractDescriptionFunction · 0.90
escapeYamlFunction · 0.90
toTitleFunction · 0.85
joinFunction · 0.85
mapMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected