- VERSION file as authoritative version source - export.mjs reads VERSION with package.json fallback - bw-ota.ps1 DryRun mode for safe testing - auto-setup.ps1 bumped to v3.2.0 (Phase 8 OTA)
28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
#!/usr/bin/env node
|
||
// 幂等补丁: 同步 SKILL-REGISTRY.md 钩子计数至实际磁盘值
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
const SENTINEL = '<!-- patch:hook-count-sync-v1 -->';
|
||
const registryPath = path.join(__dirname, '..', '..', 'SKILL-REGISTRY.md');
|
||
|
||
let content = fs.readFileSync(registryPath, 'utf8');
|
||
|
||
if (content.includes(SENTINEL)) {
|
||
console.log('[patch] already applied, skipping');
|
||
process.exit(0);
|
||
}
|
||
|
||
const oldPattern = /## 钩子清单 \(17 注册条目\/17 唯一文件 \+ 2 豁免disabled \+ 1 备用未注册 \+ 16 sub-hooks,磁盘文件 34 个\)/;
|
||
const newLine = '## 钩子清单 (26 注册条目 + 24 备用未注册,磁盘文件 50 个)';
|
||
|
||
if (!oldPattern.test(content)) {
|
||
console.log('[patch] target string not found, may already be updated');
|
||
process.exit(0);
|
||
}
|
||
|
||
content = content.replace(oldPattern, newLine + ' ' + SENTINEL);
|
||
|
||
fs.writeFileSync(registryPath, content, 'utf8');
|
||
console.log('[patch] SKILL-REGISTRY.md hook count updated: 34→50 disk, 17→26 registered');
|