fix(skill-check): honor primary host skipSkills in Templates check

When `hosts/claude.ts` has `generation.skipSkills: ['claude']` (the existing
config — the /claude outside-voice skill is intentionally for non-Claude hosts),
`bun run gen:skill-docs` correctly skips generating `claude/SKILL.md`. But
`scripts/skill-check.ts` Templates section still flags it as ` generated file
missing!` and the script exits 1.

Fix: mirror the same `skipSkills` filter that `gen-skill-docs.ts` already uses
(see `scripts/gen-skill-docs.ts:510-516`). Read the primary host's skipSkills
once, then in the Templates loop, if the output file is missing AND the skill
dir is in skipSkills, log it as `- skipped per <host> host config` and skip
the error flag instead of marking it missing.

Impact: `bun run skill:check` now exits 0 for any host config that uses
`skipSkills`. No behavior change when skipSkills is empty (default for most
hosts) or when the skipped skill's output is in fact missing for some other
reason.

Test plan: configure `skipSkills: ['claude']` (default `hosts/claude.ts`),
run `bun run gen:skill-docs`, confirm `claude/SKILL.md` is not generated, then
`bun run skill:check` — before the patch, exit=1 with ` claude/SKILL.md —
generated file missing!`; after the patch, exit=0 with `- claude/SKILL.md —
skipped per claude host config`.
This commit is contained in:
EricXu-0805 2026-05-11 11:32:57 -05:00
parent 49cc4ff9c9
commit 3a19c0b615
1 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,7 @@
import { validateSkill } from '../test/helpers/skill-parser'; import { validateSkill } from '../test/helpers/skill-parser';
import { discoverTemplates, discoverSkillFiles } from './discover-skills'; import { discoverTemplates, discoverSkillFiles } from './discover-skills';
import { claude as PRIMARY_HOST } from '../hosts/index';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import { execSync } from 'child_process'; import { execSync } from 'child_process';
@ -64,15 +65,25 @@ for (const file of SKILL_FILES) {
console.log('\n Templates:'); console.log('\n Templates:');
const TEMPLATES = discoverTemplates(ROOT); const TEMPLATES = discoverTemplates(ROOT);
// Repo-root SKILL.md outputs reflect what the primary host (claude) generates.
// If a skill is in claude's skipSkills (e.g. the `/claude` outside-voice skill
// is intentionally not bundled into the Claude host), its generated file is
// expected to be absent — flagging it as missing here is a false positive.
const PRIMARY_SKIP_SKILLS = new Set(PRIMARY_HOST.generation?.skipSkills ?? []);
for (const { tmpl, output } of TEMPLATES) { for (const { tmpl, output } of TEMPLATES) {
const tmplPath = path.join(ROOT, tmpl); const tmplPath = path.join(ROOT, tmpl);
const outPath = path.join(ROOT, output); const outPath = path.join(ROOT, output);
const skillDir = output.includes('/') ? output.split('/')[0] : '';
if (!fs.existsSync(tmplPath)) { if (!fs.existsSync(tmplPath)) {
console.log(` \u26a0\ufe0f ${output.padEnd(30)} — no template`); console.log(` \u26a0\ufe0f ${output.padEnd(30)} — no template`);
continue; continue;
} }
if (!fs.existsSync(outPath)) { if (!fs.existsSync(outPath)) {
if (skillDir && PRIMARY_SKIP_SKILLS.has(skillDir)) {
console.log(` - ${output.padEnd(30)} — skipped per ${PRIMARY_HOST.name} host config`);
continue;
}
hasErrors = true; hasErrors = true;
console.log(` \u274c ${output.padEnd(30)} — generated file missing! Run: bun run gen:skill-docs`); console.log(` \u274c ${output.padEnd(30)} — generated file missing! Run: bun run gen:skill-docs`);
continue; continue;