Files
UI/.ua/log-one.mjs
T
2026-10-26 15:18:37 +08:00

14 lines
729 B
JavaScript
Raw 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.
import { readFileSync, writeFileSync, appendFileSync } from 'node:fs';
// 用法:node .ua/log-one.mjs <id> <commit> <result> <summary> <ts>
const [id, commit, result, summary, ts] = process.argv.slice(2);
const b = JSON.parse(readFileSync('.ua/backlog.json', 'utf8'));
const item = b.items.find((i) => i.id === id);
if (item) item.status = result === 'done' ? 'done' : 'open'; // 失败保持 open
writeFileSync('.ua/backlog.json', JSON.stringify(b, null, 2) + '\n', 'utf8');
// 留痕行:字段顺序固定 ts/id/result/commit/summary,ts 由 date 命令实测传入
appendFileSync('.ua/iterations.log', JSON.stringify({ ts, id, result, commit, summary }) + '\n', 'utf8');
console.log('logged', id, result, commit, ts);