fix: revert build.ts to flat structure version

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Pedro Rodrigues
2026-01-30 14:20:50 +00:00
parent c677664561
commit 7a37c51fee

View File

@@ -8,7 +8,7 @@ import {
unlinkSync, unlinkSync,
writeFileSync, writeFileSync,
} from "node:fs"; } from "node:fs";
import { basename, join, relative } from "node:path"; import { basename, join } from "node:path";
import { import {
discoverSkills, discoverSkills,
getSkillPaths, getSkillPaths,
@@ -327,10 +327,8 @@ function buildSkill(paths: SkillPaths): void {
for (const file of referenceFiles) { for (const file of referenceFiles) {
const name = basename(file, ".md"); const name = basename(file, ".md");
const prefix = name.split("-")[0]; const prefix = name.split("-")[0];
// Compute relative path from references directory
const relativePath = relative(paths.referencesDir, file);
const group = grouped.get(prefix) || []; const group = grouped.get(prefix) || [];
group.push(relativePath); group.push(name);
grouped.set(prefix, group); grouped.set(prefix, group);
} }
@@ -339,7 +337,7 @@ function buildSkill(paths: SkillPaths): void {
const title = section ? section.title : prefix; const title = section ? section.title : prefix;
output.push(`**${title}** (\`${prefix}-\`):`); output.push(`**${title}** (\`${prefix}-\`):`);
for (const file of files.sort()) { for (const file of files.sort()) {
output.push(`- \`references/${file}\``); output.push(`- \`references/${file}.md\``);
} }
output.push(""); output.push("");
} }