Skip to content

Commit 6eaa83d

Browse files
author
Addison Schultz
committed
Publish generated skill pages to public-docs as hidden
Marks the router (skill.md) and per-skill pages with hidden: true so they're excluded from public-docs' published TOC while staying reachable via direct link, MCP, and llms-full.txt, per GitBook's page visibility docs.
1 parent 8eee78d commit 6eaa83d

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

scripts/build-skill.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ function wrapFolded(text, indent = " ", width = 100) {
100100
return lines.map((l) => indent + l).join("\n");
101101
}
102102

103+
// GitBook Git Sync hides a page from the published table of contents when
104+
// its frontmatter includes `hidden: true`. These pages are mirrors of the
105+
// SKILL.md files (an agent-facing router, not end-user docs), so they're
106+
// published hidden — reachable via direct link / MCP / llms-full.txt, but
107+
// kept out of the public-docs nav. Injected here at publish time rather
108+
// than in the source SKILL.md files, since `hidden` is a GitBook concern,
109+
// not part of the Agent Skill spec those files also have to satisfy.
110+
function withHiddenFrontmatter(raw) {
111+
return raw.replace(/^(---\r?\n)/, "$1hidden: true\n");
112+
}
113+
103114
function parseSkillFile(dir) {
104115
const filePath = path.join(SKILLS_DIR, dir, "SKILL.md");
105116
const raw = fs.readFileSync(filePath, "utf8");
@@ -125,8 +136,9 @@ function main() {
125136
fs.mkdirSync(SKILLS_OUT_DIR, { recursive: true });
126137
for (const s of parsed) {
127138
const outPath = path.join(SKILLS_OUT_DIR, `${s.dir}.md`);
128-
fs.writeFileSync(outPath, s.raw);
129-
const lines = s.raw.split("\n").length;
139+
const published = withHiddenFrontmatter(s.raw);
140+
fs.writeFileSync(outPath, published);
141+
const lines = published.split("\n").length;
130142
if (lines > RECOMMENDED_MAX_LINES) {
131143
console.warn(
132144
`Warning: skills/${s.dir}/SKILL.md is ${lines} lines, over the spec's recommended ${RECOMMENDED_MAX_LINES}-line ceiling`
@@ -142,6 +154,7 @@ function main() {
142154
.join("\n\n");
143155

144156
const routerOut = `---
157+
hidden: true
145158
name: gitbook
146159
description: >-
147160
${wrapFolded(UMBRELLA_DESCRIPTION)}

0 commit comments

Comments
 (0)