#!/usr/bin/env node // Generates web/catalog.html — a static, SEO-indexable catalog of every skill, // grouped by bundle, from web/skills.json. Server-rendered HTML so search engines // index each skill's name + description (the playground is client-rendered and // isn't crawlable). Run after web/build-skills.mjs. No dependencies. import { readFileSync, writeFileSync, existsSync } from 'node:fs'; import { join, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const root = join(__dirname, '..'); const skillsJson = join(root, 'web', 'skills.json'); const REPO = 'https://github.com/mohitagw15856/pm-claude-skills'; if (!existsSync(skillsJson)) { console.error('web/skills.json not found — run: node web/build-skills.mjs'); process.exit(1); } const { skills } = JSON.parse(readFileSync(skillsJson, 'utf8')); const esc = (s) => String(s || '').replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); const TIER = { production: ['🟢', 'Production-Ready'], stable: ['🔵', 'Stable'], experimental: ['🟡', 'Experimental'], }; // Group by bundle, sorted; skills sorted by title within. const byBundle = {}; for (const s of skills) (byBundle[s.plugin] ||= []).push(s); const bundles = Object.keys(byBundle).sort(); for (const b of bundles) byBundle[b].sort((a, b2) => a.title.localeCompare(b2.title)); const cards = (list) => list.map((s) => { const [dot, label] = TIER[s.tier] || TIER.stable; return `
${dot} ${label}${esc(s.plugin)}

${esc(s.title)}

${esc(s.description)}

`; }).join('\n'); const sections = bundles.map((b) => `
\n

${esc(b)} ${byBundle[b].length}

\n${cards(byBundle[b])}\n
` ).join('\n'); const html = ` Skill Catalog — ${skills.length} Agent Skills for Claude, ChatGPT, Gemini, Cursor & more

🧠 Skill Catalog — ${skills.length} professional Agent Skills

Structured SKILL.md skills for Claude, ChatGPT, Gemini, Cursor, Codex & Hermes. Install all with npx pm-claude-skills add --agent <tool>.

${sections}
`; writeFileSync(join(root, 'web', 'catalog.html'), html); console.log(`Wrote web/catalog.html — ${skills.length} skills across ${bundles.length} bundles.`);