bookworm-smart-assistant/scripts/patches/patch-route-precision-10x-evo-log.js

38 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

#!/usr/bin/env node
/**
* patch-route-precision-10x-evo-log.js
* 路由精度10项改进 追加 evolution-log 条目 (seq 120)
*/
'use strict';
const fs = require('fs');
const path = require('path');
const CLAUDE_ROOT = path.join(require('os').homedir(), '.claude');
const DEBUG_DIR = path.join(CLAUDE_ROOT, 'debug');
const EVO_LOG = path.join(DEBUG_DIR, 'evolution-log.jsonl');
const ENTRY = {
seq: 120,
ts: '2026-04-27',
version: 'v6.6.1',
trigger: 'route-precision-10x',
summary: '路由精度10项改进: 置信度上限/图片继承链/R27去bookworm/R90-R93新增/R58补boost/确认词继承/fusion-learner激活',
fix_count: 10,
tags: ['route-engine', 'disambiguation', 'confidence', 'inheritance', 'fusion-weights'],
};
// 幂等: 检查 seq=120 是否已存在
if (fs.existsSync(EVO_LOG)) {
const lines = fs.readFileSync(EVO_LOG, 'utf8').split('\n').filter(Boolean);
if (lines.some(l => { try { return JSON.parse(l).seq === 120; } catch { return false; } })) {
console.log('[SKIP] seq=120 already exists in evolution-log.jsonl');
process.exit(0);
}
}
if (!fs.existsSync(DEBUG_DIR)) fs.mkdirSync(DEBUG_DIR, { recursive: true });
fs.appendFileSync(EVO_LOG, JSON.stringify(ENTRY) + '\n', 'utf8');
console.log('[DONE] Appended seq=120 to evolution-log.jsonl');