bookworm-smart-assistant/scripts/patches/patch-registry-hook-count-sync.js
Bookworm Admin b7a8e29d21 release: v6.7.0 - OTA E2E test release
- 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)
2026-04-27 17:59:44 +08:00

28 lines
1.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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');