dsh-ppt 0.29.1 → 0.31.0
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 +18 -0
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/docs/USAGE.en.md +2 -0
- package/docs/USAGE.md +2 -0
- package/docs/VALIDATION.md +8 -0
- package/lib/client.js +12 -3
- package/lib/execution.d.ts +2 -1
- package/lib/execution.js +3 -1
- package/lib/tools.js +13 -7
- package/lib/types.d.ts +5 -2
- package/lib/workbench.js +2 -0
- package/package.json +1 -1
- package/skills/dsh-ppt/SKILL.md +1 -1
- package/skills/dsh-ppt/package.json +1 -1
- package/skills/dsh-ppt/references/exemplars.md +31 -6
- package/skills/dsh-ppt/scripts/build-deck.mjs +4 -0
- package/skills/dsh-ppt/scripts/deck-absorb.mjs +22 -8
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +48 -7
- package/skills/dsh-ppt/scripts/deck-exemplars-corpus.mjs +1239 -0
- package/skills/dsh-ppt/scripts/deck-exemplars.mjs +32 -8
- package/skills/dsh-ppt/scripts/deck-upgrader.mjs +862 -48
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
# 标杆范本库与槽位填空契约(Curated Exemplar Corpus & Weak-LLM Compensator)
|
|
2
2
|
|
|
3
3
|
本参考面向两类高频需求:
|
|
4
|
-
1. **将自由规划降维为「槽位填空(Slot-Filling)」**:直接按内置 **
|
|
4
|
+
1. **将自由规划降维为「槽位填空(Slot-Filling)」**:直接按内置 **20 套满分标杆范本**(或工作区批量吸收的优质 `.pptx` 范本)逐页填空,让任意能力层级的模型稳定产出麦肯锡 / 红杉 / Stripe / 投行研报 / 临床医学级排版。
|
|
5
5
|
2. **向工作区投喂外部优质 PPT 语料**:把本地或开源社区收集的高颜值 `.pptx` 目录批量吸收为持久化范本库(`.dsh-ppt/exemplars.json` + `.dsh-ppt/taste-recipes.json`),零额外运行时依赖、100% 离线提取且自动过滤隐藏说明页。
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
## 1. 内置 8
|
|
9
|
+
## 1. 内置 20 套标杆范本速查表(8 套核心场景 + 12 套 GitHub 开源优质 `.pptx` 蒸馏)
|
|
10
|
+
|
|
11
|
+
> 支持传入 `exemplar: "auto"` 自动根据标题与正文字面语义路由到最佳标杆范本;调 `ppt_templates({ exemplarId })` 同步返回逐页槽位契约、满分标题示范与 **Few-Shot JSON 填空样板**。
|
|
12
|
+
|
|
13
|
+
### A. 8 套核心场景标杆
|
|
10
14
|
|
|
11
15
|
| Exemplar ID | 场景名称 | 继承主题 | 继承品味配方 | 骨架 | 页数与版式节奏 |
|
|
12
16
|
| --- | --- | --- | --- | --- | --- |
|
|
@@ -19,6 +23,23 @@
|
|
|
19
23
|
| `enterprise-proposal` | 政企大客户解决方案与竞标提案 | `bcg-emerald` | `mckinsey-partner` | `consulting-classic` | 9 页:architectural 封面 → 价值摘要 → 痛点对策 → 私有化部署架构 → 哈维球盲测 → ROI 指标 → 12 周甘特 → SLA 团队 → POC 行动卡 |
|
|
20
24
|
| `gov-institutional` | 现代东方政务述职与年度工作报告 | `exec-jilan` | `oriental-zen` | `gov-ceremonial` | 8 页:inverted 封面 → spotlight KPI → 重点成果卡片 → 区域热力图 → 阶段推进时间轴 → 问题与整改 → 下阶段部署甘特 → 结语 |
|
|
21
25
|
|
|
26
|
+
### B. 12 套 GitHub 开源优质 `.pptx` 实机甄选蒸馏标杆(Apache-2.0 / MIT / CC-BY-4.0)
|
|
27
|
+
|
|
28
|
+
| Exemplar ID | 场景名称 | 视觉 DNA(实测提取) | 开源溯源 | 协议 |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| `mckinsey-evolution` | 麦肯锡阶梯演进与宏观趋势诊断 | `#FFFFFF` 底 + `#062337` 深墨蓝 + `#C0504D` 批注红 · `editorial-rule` | `likaku/Mck-ppt-design-skill` | Apache-2.0 |
|
|
31
|
+
| `luxury-budget-review` | 黑金高管财务预算与资金复盘 | `#080A0E` 曜石黑 + `#C9A84C` 香槟金 + `#5A9E48` 翡翠绿 · `glass` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
|
|
32
|
+
| `swiss-bauhaus-workshop` | 瑞士包豪斯设计评审与创新工作坊 | `#E63322` 包豪斯红 + `#E6B319` 明黄 · `editorial-folio` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
|
|
33
|
+
| `dark-stage-investor` | 暗夜舞台 Demo Day 高张力融资路演 | `#0A0A12` 深空蓝黑 + `#E94560` 珊瑚红 + `#3B82F6` 电光蓝 · `glass` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
|
|
34
|
+
| `blueprint-ai-factory` | 工程蓝图网格 AI 基础设施与智能体平台 | `#090E13` 工程深蓝 + `#4A90D9` 蓝图青 + `#E97E35` 警示橙 · `grid` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
|
|
35
|
+
| `warm-brand-story` | 暖宣纸撞色品牌焕新与市场增长提案 | `#F6F2EA` 暖宣纸 + `#101B3B` 藏青 + `#EC7442` 珊瑚橘 · `editorial-rule` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
|
|
36
|
+
| `ted-storytelling-keynote` | 暗夜极简主题演讲与观点叙事 | `#090C13` 剧场黑 + `#2BE4A8` 薄荷青 + `#E9A936` 琥珀金 · `glass` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
|
|
37
|
+
| `msft-enterprise-discovery` | 微软企业级 AI 场景发现与价值评估工作坊 | `#FFFFFF` 白底 + `#1376C0` Azure 蓝 + `#0E7490` · 哈维球 + 四象限 | `microsoft/dstoolkit-DiscoveryEnvisioning` | MIT |
|
|
38
|
+
| `daylight-earnings-research` | 浅色投行研报与上市公司财报 | `#FAF9F6` 暖米纸 + `#1D6E6B` 机构深青 + `#9B4E23` 铜褐 · `editorial-rule` | `hustcer/pptx-nova` (`clear-value`) | Apache-2.0 |
|
|
39
|
+
| `okr-performance-review` | 中文大厂述职与 OKR 季度复盘 | `#FFFFFF` 极净白 + `#1277BA` 航标蓝 + `#137B43` 达标绿 · 目标实际表 | `hustcer/pptx-nova` (`sky-compass`) | Apache-2.0 |
|
|
40
|
+
| `quiet-canvas-keynote` | 极简静谧画布与浅色设计发布会 | `#EBE8E2` 暖宣麻 + `#AA6E53` 陶土红 + `#587F8A` 灰石蓝 · 54% 高留白 | `hustcer/pptx-nova` (`D1-Quiet-Canvas`) | Apache-2.0 |
|
|
41
|
+
| `medical-clinical-course` | 医学临床汇报与循证科研课件 | `#F1F0EC` 暖临床石 + `#0B6A48` 医学深绿 + `#EA613E` 珊瑚标 · 队列三线表 | `grotyx/medical-ppt-design` & `hustcer/pptx-nova` | CC-BY-4.0 / Apache-2.0 |
|
|
42
|
+
|
|
22
43
|
---
|
|
23
44
|
|
|
24
45
|
## 2. 弱/中等模型标准两步出稿法(推荐)
|
|
@@ -110,7 +131,11 @@ node skills/dsh-ppt/scripts/build-deck.mjs --title "2026 Q1 汇报" --exemplar c
|
|
|
110
131
|
- 单页 `>6` 条 bullets 自动拆分为两页(`(续)` / `(Cont.)`),杜绝挤压溢出;
|
|
111
132
|
- 连续 `>=2` 页 `bullets` 自动打断为 `cards` / `comparison` / `process`;
|
|
112
133
|
- 无加粗引导词的长要点自动切分加粗 `**主语**:说明`,提升扫视效率。
|
|
113
|
-
4.
|
|
114
|
-
-
|
|
115
|
-
- 自动补齐有意义的章节面包屑 `kicker`;
|
|
116
|
-
- 仅写「谢谢 / Thank you
|
|
134
|
+
4. **证据锚定 Action-Title 与结尾兜底(`SLOP-01 / 02 / 09 / 10`)**:
|
|
135
|
+
- 「财务数据 / 工作总结 / 核心指标 / 市场分析 / 性能提升 / Financials / Key Metrics」等空洞标签按各版式原生数据(KPI 数值、哑铃最大改善项、图表峰值/涨幅、表格领跑行)100% 依据原文提炼控宽 Action Title,绝不编造数字、绝不篡改 `{{metricId}}` 绑定;
|
|
136
|
+
- 自动补齐有意义的章节面包屑 `kicker` 与图表/哑铃页底部量化 `takeaway`;
|
|
137
|
+
- 仅写「谢谢 / Thank you」的裸结尾自动补齐 3 卡片行动封底 `closing[cta-cards]`。
|
|
138
|
+
5. **标杆叙事弧线自动重排(`alignOrder: true` / CLI `--align-order`)**:
|
|
139
|
+
- 当草稿页序散乱(如把甘特排期塞在开篇、把核心 KPI 放到末尾)时,传 `alignOrder: true` 自动按标杆范本经典弧线(封面 → 核心判断 → 关键 KPI → 痛点对比 → 方案图谱 → 量化证明 → 排期路线 → 行动封底)确定性重排,完整保留显式 `section` 分章边界。
|
|
140
|
+
6. **零模型落盘前自检修复闭环(`selfRepairDeck`)**:
|
|
141
|
+
- 渲染落盘前自动执行最多 2 轮 `checkManifest` + `SLOP-01..12` 复检与无损修复:自动拆分超长标题至 `subtitle`、无损分页 `kpi(>4)` / `cards(>6)` / `table(>9行)` 与长文本墙、把 >6 扇区碎块饼图转为聚光灯横向 `bar`、为单系列长柱图补聚光灯焦点、打破连续方框疲劳并净化高饱和/低对比画布,确保落盘即零告警成品(传 `--no-self-repair` 或 `autoUpgrade: false` 可关闭)。
|
|
@@ -104,7 +104,9 @@ export function parseArgv(argv) {
|
|
|
104
104
|
else if (key === '--exemplar') args.exemplar = nextValue()
|
|
105
105
|
else if (key === '--ingest-exemplars') args.ingestExemplars = nextValue()
|
|
106
106
|
else if (key === '--save-exemplar') args.saveExemplar = nextValue()
|
|
107
|
+
else if (key === '--align-order') args.alignOrder = true
|
|
107
108
|
else if (key === '--no-auto-upgrade') args.autoUpgrade = false
|
|
109
|
+
else if (key === '--no-self-repair') args.selfRepair = false
|
|
108
110
|
else if (key === '--overwrite') args.overwrite = true
|
|
109
111
|
else if (key === '--smart-layout') args.smartLayout = true
|
|
110
112
|
else if (key === '--no-smart-layout') args.smartLayout = false
|
|
@@ -288,7 +290,9 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
288
290
|
theme: args.theme,
|
|
289
291
|
...(args.taste ? { taste: args.taste } : {}),
|
|
290
292
|
...(args.exemplar ? { exemplar: args.exemplar } : {}),
|
|
293
|
+
...(args.alignOrder ? { alignOrder: true } : {}),
|
|
291
294
|
...(args.autoUpgrade !== undefined ? { autoUpgrade: args.autoUpgrade } : {}),
|
|
295
|
+
...(args.selfRepair !== undefined ? { selfRepair: args.selfRepair } : {}),
|
|
292
296
|
persona: args.persona,
|
|
293
297
|
referencePptx: args.referencePptx,
|
|
294
298
|
cloneStructure: args.cloneStructure,
|
|
@@ -540,10 +540,10 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
|
|
|
540
540
|
let largeCardShapes = 0
|
|
541
541
|
let numericKpiShapes = 0
|
|
542
542
|
let harveyCells = tableMeta.hasHarvey
|
|
543
|
-
|
|
543
|
+
const harveyDotCoords = []
|
|
544
544
|
let waterfallBars = 0
|
|
545
545
|
let chevronShapes = 0
|
|
546
|
-
|
|
546
|
+
const ellipseCircles = []
|
|
547
547
|
let diamondShapes = 0
|
|
548
548
|
let connectorShapes = 0
|
|
549
549
|
let horizontalAxisLines = 0
|
|
@@ -579,8 +579,12 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
|
|
|
579
579
|
if (name.startsWith('harvey ')) {
|
|
580
580
|
harveyCells = true
|
|
581
581
|
} else if (bounds && (preset === 'pie' || preset === 'ellipse') && (bounds.w / slideW) >= 0.01 && (bounds.w / slideW) <= 0.045 && Math.abs(bounds.w - bounds.h) <= bounds.w * 0.18) {
|
|
582
|
-
|
|
583
|
-
|
|
582
|
+
const rx = bounds.x / slideW
|
|
583
|
+
const ry = bounds.y / slideH
|
|
584
|
+
// Ignore decorative vertical dot margins (left/right edges) — Harvey matrices sit inside the body grid
|
|
585
|
+
if (rx >= 0.18 && rx <= 0.92 && ry >= 0.20 && ry <= 0.88) {
|
|
586
|
+
harveyDotCoords.push({ x: rx, y: ry })
|
|
587
|
+
}
|
|
584
588
|
}
|
|
585
589
|
if (kind === 'connector' || preset.includes('connector') || preset === 'line') {
|
|
586
590
|
const inBodyZone = bounds && (bounds.y / slideH) > 0.22 && (bounds.y / slideH) < 0.86 && !/rule|folio|divider|header|footer|takeaway/i.test(name)
|
|
@@ -647,7 +651,7 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
|
|
|
647
651
|
if (preset === 'chevron' || preset === 'homeplate' || preset === 'pentagon') {
|
|
648
652
|
chevronShapes += 1
|
|
649
653
|
} else if (preset === 'ellipse' && relW >= 0.12 && relH >= 0.16 && Math.abs(bounds.w - bounds.h) <= Math.max(bounds.w, bounds.h) * 0.45) {
|
|
650
|
-
ellipseCircles
|
|
654
|
+
ellipseCircles.push({ cx: relX + relW / 2, cy: relY + relH / 2, r: (relW + relH) / 4 })
|
|
651
655
|
} else if (preset === 'diamond' && relW <= 0.08 && relH <= 0.12) {
|
|
652
656
|
diamondShapes += 1
|
|
653
657
|
}
|
|
@@ -697,6 +701,14 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
|
|
|
697
701
|
const hasTopSummaryBanner = cardRects.some((r) => r.w >= 0.68 && r.h <= 0.26 && r.y <= 0.38)
|
|
698
702
|
const lowerPillars = cardRects.filter((r) => r.w <= 0.42 && r.y >= 0.34)
|
|
699
703
|
|
|
704
|
+
if (!harveyCells && harveyDotCoords.length >= 4) {
|
|
705
|
+
const distinctCols = new Set(harveyDotCoords.map((p) => Math.round(p.x * 16))).size
|
|
706
|
+
const distinctRows = new Set(harveyDotCoords.map((p) => Math.round(p.y * 12))).size
|
|
707
|
+
if (distinctCols >= 2 && distinctRows >= 2) harveyCells = true
|
|
708
|
+
}
|
|
709
|
+
const hasConcentricCircles = ellipseCircles.length >= 2 && ellipseCircles.some((a, ai) =>
|
|
710
|
+
ellipseCircles.some((b, bi) => bi > ai && Math.hypot(a.cx - b.cx, a.cy - b.cy) <= 0.16 && Math.abs(a.r - b.r) >= 0.04))
|
|
711
|
+
|
|
700
712
|
// Priority order: rich native charts/tables/diagrams -> media -> framing -> structured layouts
|
|
701
713
|
if (waterfallBars >= 3 || isWaterfallChart) {
|
|
702
714
|
result.inferredLayout = 'waterfall'
|
|
@@ -707,7 +719,7 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
|
|
|
707
719
|
} else if (hasTable) {
|
|
708
720
|
result.inferredLayout = 'table'
|
|
709
721
|
if (tableMeta.styleHint) result.tableStyle = tableMeta.styleHint
|
|
710
|
-
} else if (ellipseCircles >= 2 && (
|
|
722
|
+
} else if (ellipseCircles.length >= 2 && (tamTextHits >= 2 || /市场规模|市场空间|\bTAM\b|\bSAM\b|\bSOM\b/i.test(combinedSignal) || (ellipseCircles.length >= 3 && hasConcentricCircles))) {
|
|
711
723
|
result.inferredLayout = 'tam'
|
|
712
724
|
result.variant = 'concentric'
|
|
713
725
|
} else if (chevronShapes >= 3) {
|
|
@@ -1225,9 +1237,11 @@ export async function absorbPptx(options = {}) {
|
|
|
1225
1237
|
}
|
|
1226
1238
|
|
|
1227
1239
|
let coreTitle = ''
|
|
1240
|
+
const isGenericDeckTitle = (t) =>
|
|
1241
|
+
/^(?:PowerPoint\s*(?:Presentation|演示文稿)|Microsoft\s+PowerPoint(?:\s+Presentation)?|Presentation\s*\d*|Slide\s*Deck|Untitled(?:\s+Presentation)?|Default\s+Presentation|演示文稿\s*\d*|幻灯片\s*\d*|新建\s*Microsoft\s*PowerPoint\s*演示文稿|WPS\s*演示)$/i.test(t)
|
|
1228
1242
|
try {
|
|
1229
1243
|
const props = lib.getCoreProperties(pres)
|
|
1230
|
-
if (typeof props?.title === 'string' && props.title.trim() &&
|
|
1244
|
+
if (typeof props?.title === 'string' && props.title.trim() && !isGenericDeckTitle(props.title.trim())) {
|
|
1231
1245
|
coreTitle = props.title.trim().slice(0, 100)
|
|
1232
1246
|
}
|
|
1233
1247
|
} catch { /* ignore */ }
|
|
@@ -1238,7 +1252,7 @@ export async function absorbPptx(options = {}) {
|
|
|
1238
1252
|
...(logoDataUri ? { logo: logoDataUri } : {}),
|
|
1239
1253
|
}
|
|
1240
1254
|
const isOfficeDefaultFont = (f) =>
|
|
1241
|
-
/^(?:SimSun|NSimSun|宋体|新宋体|FangSong|仿宋|Impact|Comic Sans MS)$/i.test(f) ||
|
|
1255
|
+
/^(?:SimSun|NSimSun|宋体|新宋体|FangSong|仿宋|Impact|Comic Sans MS|Songti SC|PingFang SC|Hiragino Sans GB|STSong|STHeiti|STFangsong|STKaiti|Arial Unicode MS|Apple SD Gothic Neo|Pretendard|Menlo|SF Pro(?: Display| Text)?|Helvetica Neue|Playfair Display)$/i.test(f) ||
|
|
1242
1256
|
(/^(?:Calibri|Calibri Light|Aptos|Aptos Display)$/i.test(f) &&
|
|
1243
1257
|
!extractedFonts.majorEastAsian &&
|
|
1244
1258
|
!extractedFonts.minorEastAsian)
|
|
@@ -26,6 +26,8 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
CURATED_EXEMPLARS,
|
|
28
28
|
CURATED_EXEMPLAR_IDS,
|
|
29
|
+
GITHUB_DISTILLED_EXEMPLARS,
|
|
30
|
+
getExemplarFewShotSlides,
|
|
29
31
|
listCuratedExemplars,
|
|
30
32
|
resolveExemplar,
|
|
31
33
|
loadWorkspaceExemplars,
|
|
@@ -35,7 +37,7 @@ import {
|
|
|
35
37
|
matchBestExemplar,
|
|
36
38
|
renderExemplarPromptGuide,
|
|
37
39
|
} from './deck-exemplars.mjs'
|
|
38
|
-
import { upgradeWeakDeck } from './deck-upgrader.mjs'
|
|
40
|
+
import { upgradeWeakDeck, resequenceSlidesToExemplar, selfRepairDeck, synthesizeActionTitle } from './deck-upgrader.mjs'
|
|
39
41
|
export { readRenderReceipt } from './deck-render.mjs'
|
|
40
42
|
export { dataNotes, dataReport } from './deck-data.mjs'
|
|
41
43
|
export { buildDeck, resolveLanguage } from './deck-core.mjs'
|
|
@@ -49,6 +51,8 @@ export { listAllTasteRecipes, listCuratedTasteRecipes, loadWorkspaceTasteRecipes
|
|
|
49
51
|
export {
|
|
50
52
|
CURATED_EXEMPLARS,
|
|
51
53
|
CURATED_EXEMPLAR_IDS,
|
|
54
|
+
GITHUB_DISTILLED_EXEMPLARS,
|
|
55
|
+
getExemplarFewShotSlides,
|
|
52
56
|
listCuratedExemplars,
|
|
53
57
|
resolveExemplar,
|
|
54
58
|
loadWorkspaceExemplars,
|
|
@@ -58,7 +62,7 @@ export {
|
|
|
58
62
|
matchBestExemplar,
|
|
59
63
|
renderExemplarPromptGuide,
|
|
60
64
|
} from './deck-exemplars.mjs'
|
|
61
|
-
export { upgradeWeakDeck } from './deck-upgrader.mjs'
|
|
65
|
+
export { upgradeWeakDeck, resequenceSlidesToExemplar, selfRepairDeck, synthesizeActionTitle } from './deck-upgrader.mjs'
|
|
62
66
|
|
|
63
67
|
export async function ingestExemplarCorpus(options = {}) {
|
|
64
68
|
return ingestExemplarDirectory({
|
|
@@ -672,9 +676,17 @@ export async function buildDeckAsync(options = {}) {
|
|
|
672
676
|
}
|
|
673
677
|
|
|
674
678
|
const workspaceExemplars = loadWorkspaceExemplars(cwd)
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
679
|
+
const rawExemplarStr = typeof options.exemplar === 'string' ? options.exemplar.trim() : ''
|
|
680
|
+
const resolvedExemplar = rawExemplarStr.toLowerCase() === 'auto'
|
|
681
|
+
? matchBestExemplar({
|
|
682
|
+
title: options.title,
|
|
683
|
+
content: options.content || (Array.isArray(options.slides) ? options.slides.map((s) => `${s?.title || ''} ${(s?.bullets || []).join(' ')}`).join(' ') : ''),
|
|
684
|
+
persona: options.persona,
|
|
685
|
+
template: scenario?.id,
|
|
686
|
+
}, workspaceExemplars)
|
|
687
|
+
: (options.exemplar !== undefined && options.exemplar !== null && options.exemplar !== ''
|
|
688
|
+
? resolveExemplar(options.exemplar, workspaceExemplars)
|
|
689
|
+
: null)
|
|
678
690
|
if (options.exemplar !== undefined && options.exemplar !== null && options.exemplar !== '' && !resolvedExemplar) {
|
|
679
691
|
fail('未知标杆范本 exemplar:' + String(options.exemplar))
|
|
680
692
|
}
|
|
@@ -748,6 +760,7 @@ export async function buildDeckAsync(options = {}) {
|
|
|
748
760
|
exemplar: resolvedExemplar,
|
|
749
761
|
lang: langId,
|
|
750
762
|
allowSplit: !fromMarkdown || normalized.deck.slides.length <= 24,
|
|
763
|
+
alignOrder: options.alignOrder === true,
|
|
751
764
|
})
|
|
752
765
|
normalized.deck.slides = upgraded.slides
|
|
753
766
|
if (upgraded.report.applied) upgradeReport = upgraded.report
|
|
@@ -816,7 +829,35 @@ export async function buildDeckAsync(options = {}) {
|
|
|
816
829
|
history: [],
|
|
817
830
|
slides: embedSlides(normalized.deck.slides, assets, cwd).map(s => ({ ...s, id: randomUUID() })),
|
|
818
831
|
}
|
|
819
|
-
|
|
832
|
+
let activeManifest = manifest
|
|
833
|
+
const hasUnfilledDraft = Boolean(scenario && !options.content?.trim() && !options.slides?.length)
|
|
834
|
+
const shouldSelfRepair = !dataModel && !hasUnfilledDraft && options.autoUpgrade !== false && options.selfRepair !== false && options.smartLayout !== false && (
|
|
835
|
+
options.selfRepair === true ||
|
|
836
|
+
shouldAutoUpgrade ||
|
|
837
|
+
Boolean(resolvedExemplar) ||
|
|
838
|
+
fromMarkdown
|
|
839
|
+
)
|
|
840
|
+
if (shouldSelfRepair) {
|
|
841
|
+
const repaired = selfRepairDeck(manifest, {
|
|
842
|
+
checkFn: checkManifest,
|
|
843
|
+
maxPasses: 2,
|
|
844
|
+
maxSlides: normalized.maxSlides || options.maxSlides || 60,
|
|
845
|
+
lang: langId,
|
|
846
|
+
allowSplit: !fromMarkdown || manifest.slides.length <= 24,
|
|
847
|
+
})
|
|
848
|
+
if (repaired.report.repairs.length > 0) {
|
|
849
|
+
repaired.manifest.slides = repaired.manifest.slides.map((s) => (s && !s.id ? { ...s, id: randomUUID() } : s))
|
|
850
|
+
activeManifest = repaired.manifest
|
|
851
|
+
upgradeReport = {
|
|
852
|
+
...(upgradeReport || { applied: true, exemplarId: resolvedExemplar?.id || null, resequenced: false, upgradeCount: 0, promotedCount: 0, splitCount: 0, brokenStreaks: 0, rescuedTitles: 0, upgrades: [] }),
|
|
853
|
+
applied: true,
|
|
854
|
+
selfRepair: repaired.report,
|
|
855
|
+
}
|
|
856
|
+
} else if (upgradeReport) {
|
|
857
|
+
upgradeReport = { ...upgradeReport, selfRepair: repaired.report }
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
const data = await generate(activeManifest, options.signal)
|
|
820
861
|
mkdirSync(normalized.outputDir, { recursive: true })
|
|
821
862
|
// Resolve collisions after asynchronous rendering; an earlier call may have committed meanwhile.
|
|
822
863
|
const file = resolveDeckFileName(normalized.outputDir, normalized.fileName, normalized.overwrite)
|
|
@@ -824,7 +865,7 @@ export async function buildDeckAsync(options = {}) {
|
|
|
824
865
|
const writeHandout = options.handout === true
|
|
825
866
|
const writeOnePager = options.onePager === true
|
|
826
867
|
withLock(paths.json, () => { abort(options.signal); commit(paths, data, writeHandout, writeOnePager) })
|
|
827
|
-
const builtResult = result(
|
|
868
|
+
const builtResult = result(activeManifest, paths, writeHandout, writeOnePager)
|
|
828
869
|
return upgradeReport ? { ...builtResult, upgradeReport } : builtResult
|
|
829
870
|
}
|
|
830
871
|
|