- 工作台大版本升级:hash 路由 + 6 数据功能页(周榜/热门账号/账号详情/视频详情/AI写脚本/AI写作复盘),只读复用 dsh 库副本 + 抖音榜单 JSON - 数据库隔离:复制 dsh 库到 mcn-work-shop/,与 dsh 原库各访问各的(已 gitignore) - 图标全面扁平化:Lucide 线性 SVG,功能图标亮色区分,文字标题去图标 - 首页重构:功能入口卡 + AI写剧本快捷卡片(2列/8个/5行预览) + 独立帮助页 + header 精简 - 新增设计技能 impeccable + taste-skill(生成网页时参考) - 修复:fmtTime 跨 script 全局冲突(P0)、弹窗关闭、外链新标签打开等
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* CLI helper: discard pending manual edits from the buffer without applying.
|
|
*
|
|
* Reads .impeccable/live/pending-manual-edits.json, drops entries, writes back.
|
|
* No source-file writes. Use this when the user wants to throw away unsaved
|
|
* manual edits.
|
|
*
|
|
* Trigger: only when the user explicitly asks the AI to discard / throw away /
|
|
* clear pending manual edits.
|
|
*
|
|
* Usage:
|
|
* node live-discard-manual-edits.mjs # discard all pending
|
|
* node live-discard-manual-edits.mjs --page-url=/ # discard only entries for "/"
|
|
*
|
|
* Output JSON: { discarded: N, entries: [...discardedEntries], totalCount: N }
|
|
*/
|
|
|
|
import { readBuffer, removeEntries, truncateBuffer } from './live/manual-edits-buffer.mjs';
|
|
|
|
function argVal(args, name) {
|
|
const prefix = name + '=';
|
|
for (const a of args) {
|
|
if (a === name) return true;
|
|
if (a.startsWith(prefix)) return a.slice(prefix.length);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
const args = process.argv.slice(2);
|
|
if (args.includes('--help') || args.includes('-h')) {
|
|
console.log('Usage: node live-discard-manual-edits.mjs [--page-url=<url>]');
|
|
process.exit(0);
|
|
}
|
|
|
|
const pageUrlFilter = argVal(args, '--page-url');
|
|
const cwd = process.cwd();
|
|
|
|
let discarded;
|
|
let entries;
|
|
const buffer = readBuffer(cwd);
|
|
if (pageUrlFilter) {
|
|
entries = buffer.entries.filter((entry) => entry.pageUrl === pageUrlFilter);
|
|
discarded = removeEntries(cwd, (entry) => entry.pageUrl === pageUrlFilter);
|
|
} else {
|
|
entries = buffer.entries;
|
|
discarded = truncateBuffer(cwd);
|
|
}
|
|
|
|
const remaining = readBuffer(cwd).entries.reduce((n, e) => n + e.ops.length, 0);
|
|
console.log(JSON.stringify({ discarded, entries, totalCount: remaining }));
|