fix: make skill/template discovery dynamic

Replace hardcoded SKILL_FILES and TEMPLATES arrays in skill-check.ts,
gen-skill-docs.ts, and dev-skill.ts with a shared discover-skills.ts
utility that scans the filesystem. New skills are now picked up
automatically without updating three separate lists.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joshua O’Hanlon
2026-03-14 15:41:08 -07:00
parent 2aa745cb0e
commit 68ec3d05d3
4 changed files with 49 additions and 36 deletions
+3 -15
View File
@@ -9,6 +9,7 @@
*/
import { validateSkill } from '../test/helpers/skill-parser';
import { discoverTemplates, discoverSkillFiles } from './discover-skills';
import * as fs from 'fs';
import * as path from 'path';
import { execSync } from 'child_process';
@@ -16,17 +17,7 @@ import { execSync } from 'child_process';
const ROOT = path.resolve(import.meta.dir, '..');
// Find all SKILL.md files
const SKILL_FILES = [
'SKILL.md',
'browse/SKILL.md',
'qa/SKILL.md',
'ship/SKILL.md',
'review/SKILL.md',
'retro/SKILL.md',
'plan-ceo-review/SKILL.md',
'plan-eng-review/SKILL.md',
'setup-browser-cookies/SKILL.md',
].filter(f => fs.existsSync(path.join(ROOT, f)));
const SKILL_FILES = discoverSkillFiles(ROOT);
let hasErrors = false;
@@ -63,10 +54,7 @@ for (const file of SKILL_FILES) {
// ─── Templates ──────────────────────────────────────────────
console.log('\n Templates:');
const TEMPLATES = [
{ tmpl: 'SKILL.md.tmpl', output: 'SKILL.md' },
{ tmpl: 'browse/SKILL.md.tmpl', output: 'browse/SKILL.md' },
];
const TEMPLATES = discoverTemplates(ROOT);
for (const { tmpl, output } of TEMPLATES) {
const tmplPath = path.join(ROOT, tmpl);