// 按名字挑出预设里的 block,打印正文(用于提炼自研预设) // 用法: node pick-blocks.mjs <每个最多打印字数> <名字片段1> [片段2...] import { readFileSync } from "node:fs"; const preset = JSON.parse(readFileSync(process.argv[2], "utf8")); const limit = Number(process.argv[3]); const keys = process.argv.slice(4); for (const p of preset.prompts || []) { const name = String(p.name || p.identifier || ""); if (!keys.some((k) => name.includes(k))) continue; const body = String(p.content || ""); console.log("\n===== " + name + " (" + body.length + " 字, role=" + (p.role || "system") + ") ====="); console.log(body.slice(0, limit)); if (body.length > limit) console.log("…(截断,余 " + (body.length - limit) + " 字)"); }