fix: include subdirectory in reference paths in AGENTS.md

The build system now correctly preserves subdirectory paths when
generating the Available References section. For example, files in
references/db/ are now listed as references/db/file.md instead of
just references/file.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Pedro Rodrigues
2026-01-28 12:00:10 +00:00
parent 14ee65a982
commit 8248dcbcd9
2 changed files with 23 additions and 21 deletions

View File

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