// 看预设里某条目的正文开头与宏统计。用法: node peek-entry.mjs [字数] import { readFileSync } from "node:fs"; const [file, id, n] = process.argv.slice(2); const raw = JSON.parse(readFileSync(file, "utf8")); const p = (raw.prompts || []).find((x) => x.identifier === id); if (!p) { console.log("没有这个 identifier: " + id); process.exit(1); } const text = p.content || ""; console.log("name=" + p.name + " role=" + p.role + " 字数=" + text.length); const macros = text.match(/\{\{[^}]*\}\}/g) || []; console.log("宏 " + macros.length + " 个: " + macros.slice(0, 12).join(" ")); console.log("开头: " + text.slice(0, Number(n || 300))); console.log("结尾: " + text.slice(-200));