feat(MCN工作台): 数据功能页+图标扁平化+多项UI优化
- 工作台大版本升级: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)、弹窗关闭、外链新标签打开等
This commit is contained in:
1 parent
f025ad3b86
commit
5f5b4f1cb7
120 files changed
+44528
-1
No files matched your search
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env node
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { resolveProjectRoot } from './context.mjs';
|
||||
import {
|
||||
listSurfaceBriefs,
|
||||
resolveSurfaceBrief,
|
||||
surfaceBriefPathForTarget,
|
||||
writeSurfaceBrief,
|
||||
} from './lib/surface-briefs.mjs';
|
||||
|
||||
function summary(brief, projectRoot) {
|
||||
return {
|
||||
slug: brief.slug,
|
||||
path: path.relative(projectRoot, brief.path).split(path.sep).join('/'),
|
||||
primaryTarget: brief.primaryTarget,
|
||||
relatedTargets: brief.relatedTargets,
|
||||
};
|
||||
}
|
||||
|
||||
function main(argv) {
|
||||
const [command, target, bodyFile, ...relatedTargets] = argv;
|
||||
const projectRoot = resolveProjectRoot(process.cwd(), target ? { targetPath: target } : {});
|
||||
if (command === 'path') {
|
||||
const filePath = surfaceBriefPathForTarget(target, { projectRoot });
|
||||
if (!filePath) throw new Error('surface brief path requires a concrete target');
|
||||
process.stdout.write(`${path.relative(process.cwd(), filePath) || filePath}\n`);
|
||||
return;
|
||||
}
|
||||
if (command === 'list') {
|
||||
process.stdout.write(`${JSON.stringify(listSurfaceBriefs(projectRoot).map((brief) => summary(brief, projectRoot)), null, 2)}\n`);
|
||||
return;
|
||||
}
|
||||
if (command === 'read') {
|
||||
const result = resolveSurfaceBrief(projectRoot, target || null);
|
||||
if (result.brief) {
|
||||
process.stdout.write(result.brief.text);
|
||||
return;
|
||||
}
|
||||
if (result.candidates.length) process.stderr.write(`${JSON.stringify(result.candidates.map((brief) => summary(brief, projectRoot)), null, 2)}\n`);
|
||||
process.exit(2);
|
||||
}
|
||||
if (command === 'write') {
|
||||
if (!target || !bodyFile) throw new Error('usage: surface-brief.mjs write <primary-target> <body-file>');
|
||||
const filePath = writeSurfaceBrief({
|
||||
projectRoot,
|
||||
primaryTarget: target,
|
||||
relatedTargets,
|
||||
body: fs.readFileSync(bodyFile, 'utf-8'),
|
||||
});
|
||||
process.stdout.write(`${path.relative(process.cwd(), filePath) || filePath}\n`);
|
||||
return;
|
||||
}
|
||||
throw new Error('usage: surface-brief.mjs <path|list|read|write> [target] [body-file] [related-target ...]');
|
||||
}
|
||||
|
||||
function isMainModule() {
|
||||
if (!process.argv[1]) return false;
|
||||
try {
|
||||
return fs.realpathSync(fileURLToPath(import.meta.url)) === fs.realpathSync(process.argv[1]);
|
||||
} catch {
|
||||
return import.meta.url === pathToFileURL(process.argv[1]).href;
|
||||
}
|
||||
}
|
||||
|
||||
if (isMainModule()) {
|
||||
try {
|
||||
main(process.argv.slice(2));
|
||||
} catch (error) {
|
||||
process.stderr.write(`${error?.message || error}\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user