iter(g316): ua loop 给出下一个可用编号

This commit is contained in:
HIsheR
2026-10-27 00:47:18 +08:00
parent 0fe8a011c6
commit 6c733157a7
7 changed files with 19 additions and 9 deletions
+3 -2
View File
@@ -1770,8 +1770,9 @@ function cmdLoop(args) {
const items = Array.isArray(data) ? data : data.items;
const open = items.filter((i) => i.status === 'open');
const pending = open.filter((i) => i.domain === 'visual');
const nextId = `g${Math.max(0, ...items.map((i) => Number(String(i.id).replace(/^g/, '')) || 0)) + 1}`; // 下一条可用编号:自补条目直接照抄,省得撞号后回头 rebase
if (args.includes('--json')) {
const out = { now, lock, entries: lines.length, last, total: items.length, open: open.length, openVisual: pending.length };
const out = { now, lock, entries: lines.length, last, total: items.length, open: open.length, openVisual: pending.length, nextId };
console.log(JSON.stringify(out, null, 2));
return;
}
@@ -1781,7 +1782,7 @@ function cmdLoop(args) {
else console.log(`循环锁:心跳 ${lock.age} 秒前(≥ 15 分钟)→ 疑似中断,可删锁重新点火`);
console.log(last ? `上次留痕:${last.id} ${last.result} @ ${last.ts}(${last.commit})` : '上次留痕:无');
console.log(`累计留痕:${lines.length} 条|backlog:${items.length} 条,open ${open.length} 条(视觉欠账 ${pending.length} 条)`);
if (!open.length) console.log('选题:无 open 条目 → 本轮需按《选题规则》自补一条');
if (!open.length) console.log(`选题:无 open 条目 → 本轮需按《选题规则》自补一条(下一条可用编号 ${nextId})`);
else console.log(`选题:下一条取 ${pending[0]?.id ?? open[0].id}(${pending[0] ? '视觉欠账优先' : '按数组顺序'})`);
}