dsh-ppt 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.en.md +18 -17
- package/README.md +16 -15
- package/docs/COACHING.md +14 -13
- package/docs/DATA.md +8 -8
- package/docs/REFERENCE.en.md +17 -19
- package/docs/REFERENCE.zh.md +16 -18
- package/docs/USAGE.en.md +107 -60
- package/docs/USAGE.md +115 -84
- package/docs/VALIDATION.md +2 -0
- package/docs/VISUAL.md +27 -20
- package/docs/WORKBENCH.md +17 -6
- package/docs/assets/intro/screen-en.webp +0 -0
- package/docs/assets/intro/screen-zh.webp +0 -0
- package/lib/client.js +941 -132
- package/lib/coaching.d.ts +1 -1
- package/lib/coaching.js +25 -12
- package/lib/config.d.ts +2 -0
- package/lib/config.js +30 -2
- package/lib/execution.d.ts +2 -1
- package/lib/execution.js +21 -1
- package/lib/tools.d.ts +1 -1
- package/lib/tools.js +151 -24
- package/lib/types.d.ts +108 -8
- package/lib/visual.d.ts +3 -1
- package/lib/visual.js +40 -13
- package/lib/workbench-language.js +45 -9
- package/lib/workbench.d.ts +5 -0
- package/lib/workbench.js +485 -9
- package/package.json +9 -4
- package/skills/dsh-ppt/SKILL.md +56 -54
- package/skills/dsh-ppt/package.json +1 -1
- package/skills/dsh-ppt/references/advanced.md +122 -41
- package/skills/dsh-ppt/references/copywriting.md +63 -41
- package/skills/dsh-ppt/references/data.md +83 -36
- package/skills/dsh-ppt/references/syntax.md +157 -28
- package/skills/dsh-ppt/references/themes.md +90 -41
- package/skills/dsh-ppt/references/troubleshooting.md +21 -16
- package/skills/dsh-ppt/scripts/build-deck.mjs +67 -28
- package/skills/dsh-ppt/scripts/deck-absorb.mjs +1029 -0
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +406 -99
- package/skills/dsh-ppt/scripts/deck-core.mjs +568 -717
- package/skills/dsh-ppt/scripts/deck-data-view.mjs +30 -11
- package/skills/dsh-ppt/scripts/deck-data.mjs +35 -5
- package/skills/dsh-ppt/scripts/deck-director.mjs +1717 -0
- package/skills/dsh-ppt/scripts/deck-layouts.mjs +4557 -0
- package/skills/dsh-ppt/scripts/deck-media.mjs +1408 -86
- package/skills/dsh-ppt/scripts/deck-themes.mjs +1503 -0
- package/skills/dsh-ppt/scripts/deck-visual.mjs +133 -31
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
* Claude Code / Cursor / Gemini CLI / Codex 等 agent 时,用本脚本生成三件套。
|
|
7
7
|
*
|
|
8
8
|
* 示例:
|
|
9
|
-
* node build-deck.mjs --title "
|
|
10
|
-
* node build-deck.mjs --title "
|
|
9
|
+
* node build-deck.mjs --title "Q3 经营复盘" --content "deck.md" --theme auto --lang zh --out dist/deck
|
|
10
|
+
* node build-deck.mjs --title "年度工作汇报" --content "deck.md" --reference-pptx "corp-template.pptx"
|
|
11
|
+
* node build-deck.mjs --absorb "corp-template.pptx"
|
|
11
12
|
* node build-deck.mjs --list-themes
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import { existsSync, readFileSync } from 'node:fs'
|
|
15
16
|
import { resolve as resolvePath } from 'node:path'
|
|
16
17
|
import { pathToFileURL } from 'node:url'
|
|
17
|
-
import { listThemes, THEME_IDS, DEFAULT_THEME } from './deck-
|
|
18
|
-
import {
|
|
18
|
+
import { listThemes, THEME_IDS, DEFAULT_THEME } from './deck-themes.mjs'
|
|
19
|
+
import { CHROME_STYLE_IDS } from './deck-absorb.mjs'
|
|
20
|
+
import { buildDeckAsync, listTemplates, editDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx } from './deck-advanced.mjs'
|
|
19
21
|
|
|
20
22
|
const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导出
|
|
21
23
|
|
|
@@ -23,30 +25,37 @@ const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导
|
|
|
23
25
|
node build-deck.mjs --title <标题> --content <Markdown 或文件路径> [选项]
|
|
24
26
|
|
|
25
27
|
选项:
|
|
26
|
-
--title <text>
|
|
28
|
+
--title <text> 演示文稿标题(必填)
|
|
27
29
|
--content <text|@path> Markdown 正文;或文件路径(自动读取);或 @- 从 stdin 读
|
|
28
|
-
--slides <json>
|
|
29
|
-
--template <id>
|
|
30
|
-
--
|
|
30
|
+
--slides <json> 结构化 slides JSON(可选,与 --content 二选一)
|
|
31
|
+
--template <id> 16 套行业结构蓝图 ID(可用 --list-templates 查看全部)
|
|
32
|
+
--persona <id> auto / consulting / tech-pitch / academic / gov-exec / education / editorial
|
|
33
|
+
--reference-pptx <path> 只读吸收本地参考 .pptx 的净化色板、字体、母版 Logo 与骨架
|
|
34
|
+
--clone-structure 配合 --reference-pptx 使用,克隆参考文稿的逐页版式骨架与母版 chrome
|
|
35
|
+
--chrome <style> 母版骨架风格:${CHROME_STYLE_IDS.join(' / ')}
|
|
36
|
+
--absorb <deck.pptx> 只读检查并输出参考 .pptx 的净化主题、推荐内置主题/骨架与逐页分布 JSON
|
|
37
|
+
--smart-layout 显式开启多版式叙事节奏自动升维(配合 --no-smart-layout 可关闭)
|
|
38
|
+
--brand <json|@path> 品牌颜色、字体、Logo、页脚、chromeStyle
|
|
31
39
|
--data-model <json|@path> 可选数字来源、公式与推演假设;配合 --slides
|
|
32
|
-
--edit <deck.json>
|
|
33
|
-
--
|
|
34
|
-
--
|
|
35
|
-
--
|
|
40
|
+
--edit <deck.json> 修改指定页或整套换肤,配合 --edits / --theme / --reference-pptx / --brand
|
|
41
|
+
--edits <json|@path> 页面修改指令数组
|
|
42
|
+
--undo <deck.json> 撤销最近一次修改
|
|
43
|
+
--check <deck.json> 查看质量报告和页码 / ID
|
|
44
|
+
--render <deck.pptx> 用可选官方引擎生成逐页 PNG / PDF
|
|
36
45
|
--format <png|pdf|both> 渲染格式,默认 png
|
|
37
|
-
--width <n>
|
|
38
|
-
--timeout <ms>
|
|
46
|
+
--width <n> PNG 目标宽度,默认 1440
|
|
47
|
+
--timeout <ms> 渲染整体期限,默认 120000 毫秒
|
|
39
48
|
--render-receipt <path> 配合 --check 核验当前渲染收据
|
|
40
|
-
--revision <n>
|
|
41
|
-
--list-templates
|
|
42
|
-
--theme <id>
|
|
43
|
-
--lang <id>
|
|
44
|
-
--motion <on|off>
|
|
45
|
-
--out <dir>
|
|
46
|
-
--file <name>
|
|
47
|
-
--overwrite
|
|
48
|
-
--list-themes
|
|
49
|
-
--help
|
|
49
|
+
--revision <n> 编辑 / 撤销预期修订号,防止覆盖他人修改
|
|
50
|
+
--list-templates 列出 16 套行业结构蓝图
|
|
51
|
+
--theme <id> 视觉主题:auto / ${THEME_IDS.join(' / ')}(裸 CLI 缺省为 ${DEFAULT_THEME},推荐显式传 auto)
|
|
52
|
+
--lang <id> 界面语言:zh / en / bilingual(默认 zh)
|
|
53
|
+
--motion <on|off> 页间转场与要点入场动画(默认 on;off 产出纯静态)
|
|
54
|
+
--out <dir> 输出目录(默认当前目录)
|
|
55
|
+
--file <name> 文件名前缀(默认取标题)
|
|
56
|
+
--overwrite 显式覆盖同名三件套(默认自动追加 -1/-2…)
|
|
57
|
+
--list-themes 列出内置主题
|
|
58
|
+
--help 显示本帮助
|
|
50
59
|
|
|
51
60
|
输出:
|
|
52
61
|
<file>.html 独立网页放映(无外链,可直接双击打开)
|
|
@@ -72,10 +81,17 @@ export function parseArgv(argv) {
|
|
|
72
81
|
else if (key === '--list-themes') args.listThemes = true
|
|
73
82
|
else if (key === '--list-templates') args.listTemplates = true
|
|
74
83
|
else if (key === '--overwrite') args.overwrite = true
|
|
84
|
+
else if (key === '--smart-layout') args.smartLayout = true
|
|
85
|
+
else if (key === '--no-smart-layout') args.smartLayout = false
|
|
86
|
+
else if (key === '--clone-structure') args.cloneStructure = true
|
|
87
|
+
else if (key === '--chrome') args.chrome = nextValue()
|
|
75
88
|
else if (key === '--title') args.title = nextValue()
|
|
76
89
|
else if (key === '--content') args.content = nextValue()
|
|
77
90
|
else if (key === '--slides') args.slides = readJson(nextValue())
|
|
78
91
|
else if (key === '--template') args.template = nextValue()
|
|
92
|
+
else if (key === '--persona') args.persona = nextValue()
|
|
93
|
+
else if (key === '--reference-pptx') args.referencePptx = nextValue()
|
|
94
|
+
else if (key === '--absorb') args.absorb = nextValue()
|
|
79
95
|
else if (key === '--brand') args.brand = readJson(nextValue())
|
|
80
96
|
else if (key === '--data-model') args.dataModel = readJson(nextValue())
|
|
81
97
|
else if (key === '--edit') args.edit = nextValue()
|
|
@@ -118,14 +134,21 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
118
134
|
}
|
|
119
135
|
if (args.listThemes) {
|
|
120
136
|
for (const theme of listThemes('zh')) {
|
|
121
|
-
log('- ' + theme.id.padEnd(
|
|
137
|
+
log('- ' + theme.id.padEnd(18) + theme.name + '|' + theme.mood + '|适合:' + theme.bestFor)
|
|
122
138
|
}
|
|
123
139
|
return 0
|
|
124
140
|
}
|
|
125
141
|
if (args.listTemplates) { log(JSON.stringify({ templates: listTemplates(args.lang) }, null, 2)); return 0 }
|
|
126
|
-
if ([args.edit, args.undo, args.check, args.render].filter(Boolean).length > 1)
|
|
142
|
+
if ([args.edit, args.undo, args.check, args.render, args.absorb].filter(Boolean).length > 1) {
|
|
143
|
+
throw new Error('dsh-ppt CLI:--edit / --undo / --check / --render / --absorb 只能选择一项')
|
|
144
|
+
}
|
|
127
145
|
if (args.renderReceipt !== undefined && !args.check) throw new Error('dsh-ppt CLI:--render-receipt 需配合 --check')
|
|
128
146
|
if (!args.render && [args.format, args.width, args.timeoutMs].some(v => v !== undefined)) throw new Error('dsh-ppt CLI:--format / --width / --timeout 需配合 --render')
|
|
147
|
+
if (args.absorb) {
|
|
148
|
+
const absorbed = await absorbPptx({ pptxPath: args.absorb })
|
|
149
|
+
log(JSON.stringify(absorbed, null, 2))
|
|
150
|
+
return 0
|
|
151
|
+
}
|
|
129
152
|
if (args.check) {
|
|
130
153
|
const report = await checkDeckAsync({ deckPath: args.check, renderReceipt: args.renderReceipt })
|
|
131
154
|
log(JSON.stringify(report, null, 2)); return report.ok && (args.renderReceipt === undefined || report.render?.status === 'rendered') ? 0 : 1
|
|
@@ -134,8 +157,20 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
134
157
|
const rendered = await (io.renderDeck ?? renderDeck)({ pptxPath: args.render, ...(args.explicitOut ? { outputDir: args.out } : {}), format: args.format, width: args.width, timeoutMs: args.timeoutMs })
|
|
135
158
|
log(JSON.stringify(rendered, null, 2)); return rendered.ok ? 0 : 1
|
|
136
159
|
}
|
|
160
|
+
const effectiveBrand = args.chrome
|
|
161
|
+
? { ...(args.brand && typeof args.brand === 'object' ? args.brand : {}), chromeStyle: args.chrome }
|
|
162
|
+
: args.brand
|
|
163
|
+
|
|
137
164
|
if (args.edit || args.undo) {
|
|
138
|
-
const result = args.edit
|
|
165
|
+
const result = args.edit
|
|
166
|
+
? await editDeck({
|
|
167
|
+
deckPath: args.edit,
|
|
168
|
+
edits: args.edits,
|
|
169
|
+
theme: args.theme,
|
|
170
|
+
referencePptx: args.referencePptx,
|
|
171
|
+
brand: effectiveBrand,
|
|
172
|
+
expectedRevision: args.revision,
|
|
173
|
+
})
|
|
139
174
|
: await undoDeck({ deckPath: args.undo, expectedRevision: args.revision })
|
|
140
175
|
log(JSON.stringify(result, null, 2)); return 0
|
|
141
176
|
}
|
|
@@ -158,13 +193,17 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
158
193
|
content,
|
|
159
194
|
slides,
|
|
160
195
|
theme: args.theme,
|
|
196
|
+
persona: args.persona,
|
|
197
|
+
referencePptx: args.referencePptx,
|
|
198
|
+
cloneStructure: args.cloneStructure,
|
|
199
|
+
smartLayout: args.smartLayout,
|
|
161
200
|
lang: args.lang,
|
|
162
201
|
motion: args.motion,
|
|
163
202
|
outputDir: resolvePath(args.out || '.'),
|
|
164
203
|
fileName: args.file,
|
|
165
204
|
overwrite: args.overwrite,
|
|
166
205
|
template: args.template,
|
|
167
|
-
brand:
|
|
206
|
+
brand: effectiveBrand,
|
|
168
207
|
dataModel: args.dataModel,
|
|
169
208
|
}
|
|
170
209
|
const result = await buildDeckAsync(options)
|