#!/usr/bin/env node // Bump version from v6.6.0-phase1-B to v6.6.1 across all files const fs = require('fs'); const path = require('path'); const ROOT = path.resolve(__dirname, '../..'); const OLD = 'v6.6.0-phase1-B'; const NEW = 'v6.6.1'; const SENTINEL = ''; const targets = [ { file: 'CLAUDE.md', pattern: OLD }, { file: 'SKILL-REGISTRY.md', pattern: OLD }, ]; let changed = 0; for (const t of targets) { const fp = path.join(ROOT, t.file); if (!fs.existsSync(fp)) { console.log(`SKIP ${t.file} (not found)`); continue; } let content = fs.readFileSync(fp, 'utf8'); if (content.includes(SENTINEL)) { console.log(`SKIP ${t.file} (already patched)`); continue; } // BOM strip if (content.charCodeAt(0) === 0xFEFF) content = content.slice(1); const before = content; content = content.replaceAll(t.pattern, NEW); if (content !== before) { // Backup fs.copyFileSync(fp, fp + '.bak'); fs.writeFileSync(fp, content, 'utf8'); console.log(`PATCHED ${t.file}: ${OLD} -> ${NEW}`); changed++; } else { console.log(`SKIP ${t.file} (pattern not found)`); } } // Also fix SKILL-REGISTRY footer date if still old const regPath = path.join(ROOT, 'SKILL-REGISTRY.md'); if (fs.existsSync(regPath)) { let reg = fs.readFileSync(regPath, 'utf8'); reg = reg.replace(/\*最后更新: 2026-04-27\b/, '*最后更新: 2026-04-27 (v6.6.1)'); fs.writeFileSync(regPath, reg, 'utf8'); } console.log(`Done. ${changed} files patched.`);