#!/usr/bin/env node /** * Audit Fix: SKILL-REGISTRY.md metadata drift * W2: stable count 58→59 * W3: orchestrator model opus→sonnet * W4: MCP count 22→14 * Idempotent: checks each value before replacing */ 'use strict'; const fs = require('fs'); const path = require('path'); const TARGET = path.resolve(__dirname, '..', '..', 'SKILL-REGISTRY.md'); if (!fs.existsSync(TARGET)) { process.stderr.write('[SKIP] SKILL-REGISTRY.md not found\n'); process.exit(0); } let src = fs.readFileSync(TARGET, 'utf8'); fs.writeFileSync(TARGET + '.bak-audit.' + Date.now(), src); let fixes = 0; // W2: stable count if (src.includes('58 stable')) { src = src.replace('58 stable', '59 stable'); fixes++; process.stderr.write('[FIX] W2: stable count 58→59\n'); } // W3: orchestrator model if (src.includes('| orchestrator | opus |')) { src = src.replace('| orchestrator | opus |', '| orchestrator | sonnet |'); fixes++; process.stderr.write('[FIX] W3: orchestrator opus→sonnet\n'); } // W4: MCP count if (src.includes('mcpServers, 22')) { src = src.replace('mcpServers, 22', 'mcpServers, 14'); fixes++; process.stderr.write('[FIX] W4: MCP count 22→14\n'); } if (fixes === 0) { process.stderr.write('[SKIP] no drift found\n'); process.exit(0); } const tmp = TARGET + '.tmp.' + process.pid; fs.writeFileSync(tmp, src, 'utf8'); fs.renameSync(tmp, TARGET); process.stderr.write('[DONE] ' + fixes + ' fixes applied to SKILL-REGISTRY.md\n');