dsh-ppt 0.28.0 → 0.29.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/lib/tools.js CHANGED
@@ -112,28 +112,45 @@ function renderThemes(value) {
112
112
  return oneText(summary + '\n\n想要并排对比:ppt_themes { preview: true, outputDir: "..." } 会生成 themes-preview.html 和每套主题的 SVG 色板卡。');
113
113
  }
114
114
  function renderAbsorb(value) {
115
+ if (value.dirPath && typeof value.ingestedCount === 'number') {
116
+ const items = Array.isArray(value.exemplars) ? value.exemplars : [];
117
+ const lines = [
118
+ 'dsh-ppt 已批量扫描并吸收优质 PPTX 语料目录:' + value.dirPath + '(扫描 ' + (value.scanned ?? 0) + ' 份,成功吸收 ' + value.ingestedCount + ' 份' + (value.failedCount ? ',跳过 ' + value.failedCount + ' 份' : '') + ')',
119
+ ...items.slice(0, 12).map((item) => `- ${item.id}(${item.file}):${item.slotCount} 页槽位 | 主题 ${item.theme} | 骨架 ${item.chromeStyle}${item.rhythmScore !== null && item.rhythmScore !== undefined ? ` | 节奏分 ${item.rhythmScore}` : ''}`),
120
+ ...(items.length > 12 ? ['…其余范本已写入工作区 .dsh-ppt/exemplars.json'] : []),
121
+ ...(items[0]?.id ? ['可直接调用 ppt_templates { exemplarId: ' + JSON.stringify(items[0].id) + ' } 查看逐页槽位契约,或 ppt_create { title: "...", content: "...", exemplar: ' + JSON.stringify(items[0].id) + ' } 一键按范本出稿。'] : []),
122
+ ];
123
+ return oneText(lines.join('\n'));
124
+ }
115
125
  const brand = value.sanitizedBrand ?? {};
116
126
  const profile = value.narrativeProfile;
117
127
  const parts = [
118
- 'dsh-ppt 已解析参考演示文稿' + (value.pptxPath ? ':' + value.pptxPath : '') + '(共 ' + value.slideCount + ' 页)',
119
- '推荐内置主题:' + value.recommendedTheme + (value.recommendedChrome ? ' | 推荐母版骨架:' + value.recommendedChrome : '') + (value.recommendedTableStyle ? ' | 推荐表格规范:' + value.recommendedTableStyle : ''),
128
+ 'dsh-ppt 已解析参考演示文稿' + (value.pptxPath ? ':' + value.pptxPath : '') + '(共 ' + (value.slideCount ?? 0) + ' 页)',
129
+ '推荐内置主题:' + (value.recommendedTheme || 'consulting') + (value.recommendedChrome ? ' | 推荐母版骨架:' + value.recommendedChrome : '') + (value.recommendedTableStyle ? ' | 推荐表格规范:' + value.recommendedTableStyle : ''),
120
130
  '净化后品牌色板:主色 ' + (brand.primaryColor || '—') + (brand.secondaryColor ? ' | 辅色 ' + brand.secondaryColor : '') + ' | 背景 ' + (brand.backgroundColor || '—') + ' | 文字 ' + (brand.textColor || '—') +
121
131
  (brand.fontFamily ? ' | 正文字体 ' + brand.fontFamily : '') + (brand.headingFont ? ' | 标题字体 ' + brand.headingFont : '') +
122
132
  (brand.coverMode === 'inverted-accent' ? ' | 深色反白封面 (' + (brand.coverBg || brand.primaryColor || '') + ')' : '') +
123
133
  (brand.chromeStyle ? ' | 骨架 ' + brand.chromeStyle : '') + (brand.logo ? ' | 已提取母版 Logo' : ''),
124
134
  ...(value.slideSkeleton?.length ? ['提取页面骨架:' + value.slideSkeleton.slice(0, 8).map(s => `P${s.slideNumber}:${s.inferredLayout}${s.variant ? `[${s.variant}]` : ''}`).join(' → ') + (value.slideSkeleton.length > 8 ? ' …' : '')] : []),
125
135
  ...(typeof profile?.diagramRatio === 'number' ? ['专业图示页占比:' + Math.round(Number(profile.diagramRatio) * 100) + '%'] : []),
136
+ ...(value.savedTastePath ? ['已持久化审美配方:' + value.savedTastePath] : []),
137
+ ...(value.savedExemplarPath ? ['已持久化标杆范本契约:' + value.savedExemplarPath + (value.exemplar?.id ? '(exemplar: "' + value.exemplar.id + '")' : '')] : []),
126
138
  '可直接调用 ppt_create { title: "...", content: "...", referencePptx: ' + JSON.stringify(value.pptxPath || '<参考文件.pptx>') + ', cloneStructure: true } 自动套用净化后的色板、母版骨架与版式序列。',
127
139
  ];
128
140
  return oneText(parts.join('\n'));
129
141
  }
130
142
  function renderCreate(value) {
143
+ const up = value.upgradeReport;
144
+ const upgradeLine = up && (Number(up.promotedCount || 0) > 0 || Number(up.splitCount || 0) > 0 || Number(up.rescuedTitles || 0) > 0 || Number(up.brokenStreaks || 0) > 0)
145
+ ? '\n智能升维补偿:版式升维 ' + (up.promotedCount ?? 0) + ' 页 · 拆分长文本墙 ' + (up.splitCount ?? 0) + ' 页 · 打断单调连页 ' + (up.brokenStreaks ?? 0) + ' 处 · 提炼结论标题 ' + (up.rescuedTitles ?? 0) + ' 页' + (value.exemplar ? '(范本契约:' + value.exemplar + ')' : '')
146
+ : (value.exemplar ? '\n标杆范本契约:' + value.exemplar : '');
131
147
  return oneText('dsh-ppt 已生成 ' + value.slideCount + ' 页' + (value.deliveryStatus === 'draft' ? '草稿(还有待填写内容,不能作为成品交付)' : '演示文稿') + '(主题 ' + value.theme + ',语言 ' + value.language + '):\n' +
132
148
  '打开演示文稿:' + value.htmlPath + '\n' +
133
149
  '可直接修改的 PPTX:' + value.pptxPath + '\n' +
134
150
  '可继续编辑的项目:' + value.jsonPath + '\n' +
135
151
  (value.handoutPath ? '演讲讲义:' + value.handoutPath + '\n' : '') +
136
152
  'HTML 双击即可放映;可点击上一页/下一页、输入页码,以及“检查与导出”定位问题或下载 PPTX。PPTX 可用 PowerPoint / WPS / Keynote 直接编辑。' +
153
+ upgradeLine +
137
154
  (value.revision !== undefined ? '\n修订号:' + value.revision + ';可撤销修改:' + value.undoAvailable + '。用 ppt_edit 修改指定页,ppt_undo 撤销。' : '') +
138
155
  (value.quality ? '\n\n' + qualityText(value.quality) : ''));
139
156
  }
@@ -399,12 +416,16 @@ export function buildPptTools(config) {
399
416
  },
400
417
  {
401
418
  name: 'ppt_absorb',
402
- description: 'Inspect a local reference .pptx file (read-only, offline via @office-kit/pptx) to absorb its theme palette (including lumMod/tint/shade modifiers), Latin/East-Asian fonts, master logo, chrome skeleton geometry (extractedSkeleton, recommendedChrome), and per-slide layout sequence (slideSkeleton[]), returning WCAG-sanitized brand & semantic tokens for ppt_create. 中文:只读深度解析本地参考 .pptx 母版骨架、修饰色值、字体、Logo 与逐页版式序列,自动执行 WCAG 净化后供 ppt_create (referencePptx / cloneStructure) 或 ppt_edit 直接吸收复用。',
419
+ description: 'Inspect a local reference .pptx file OR batch-ingest a whole folder of curated/GitHub/corporate .pptx decks (corpusDir) offline via @office-kit/pptx. Extracts theme palette, fonts, master logo, chrome skeleton geometry, deep Taste Recipe, and reusable Slot-Filling Exemplar contracts (saved to .dsh-ppt/exemplars.json and .dsh-ppt/taste-recipes.json). 中文:只读深度吸收单份参考 .pptx 或批量投喂整个优质 .pptx 目录(corpusDir),自动过滤隐藏说明页、完成 WCAG 对比度净化,并沉淀为可复用的标杆范本契约与审美配方。',
403
420
  parameters: compileParameters({
404
- pptxPath: { type: 'string', required: true, description: 'Local reference .pptx path, relative to session cwd or absolute. Read-only.' },
421
+ pptxPath: { type: 'string', required: true, description: 'Local reference .pptx file path OR local directory of .pptx files to batch-ingest (relative to session cwd or absolute; read-only).' },
422
+ corpusDir: { type: 'string', description: 'Optional explicit directory path of curated/GitHub/corporate .pptx files to batch-ingest into .dsh-ppt/exemplars.json & .dsh-ppt/taste-recipes.json (you may also pass a directory directly via pptxPath).' },
423
+ limit: { type: 'integer', description: 'Max number of .pptx files to ingest when batch-ingesting a directory (default 20, max 40).' },
405
424
  extractLogo: { type: 'boolean', description: 'Extract embedded master/cover logo as a PNG/JPEG data URI into sanitizedBrand.logo when present (default true).' },
406
425
  saveTasteAs: { type: 'string', description: 'Optional ID to save the absorbed deep aesthetic StyleRecipe into workspace .dsh-ppt/taste-recipes.json for one-click reuse via taste.' },
407
426
  tasteName: { type: 'string', description: 'Optional display name when saving the absorbed StyleRecipe.' },
427
+ saveExemplarAs: { type: 'string', description: 'Optional ID to save the absorbed slide skeleton & brand DNA as a reusable Slot-Filling Exemplar in workspace .dsh-ppt/exemplars.json (reusable via exemplar).' },
428
+ exemplarName: { type: 'string', description: 'Optional display name when saving the absorbed Exemplar.' },
408
429
  }),
409
430
  output: {
410
431
  schema: { type: 'object', additionalProperties: true },
@@ -414,20 +435,22 @@ export function buildPptTools(config) {
414
435
  },
415
436
  {
416
437
  name: 'ppt_create',
417
- description: 'Generate a standalone HTML slideshow, editable 16:9 PPTX and JSON project from prepared Markdown or structured slides. Supports 24 themes, 6 distinct master chrome skeletons, Scenario Auto-Director (theme: "auto"), 24+ native editable layouts & pro diagrams (KPI, Bento/pillar cards, comparison, 2x2 matrix, process/timeline/flywheel/chevron, gantt roadmaps, layered architecture, Harvey-ball matrices, concentric TAM/SAM/SOM, org/team charts, academic booktabs 3-line tables, chart-split, waterfall bridges), 20 industry blueprints, deep reference .pptx skeleton absorption (cloneStructure), and shared branding. 中文:先组织事实与内容,再生成可直接放映和继续编辑的三件套;内置 24 套大师主题、6 套差异化母版骨架、24+ 种原生可编辑版式与专业图示、20 套行业蓝图、13 类出版级图表与外部 PPTX 深度骨架吸收。',
438
+ description: 'Generate a standalone HTML slideshow, editable 16:9 PPTX and JSON project from prepared Markdown or structured slides. Supports 24 themes, 6 master chrome skeletons, 8 Curated Gold Exemplars (exemplar: mckinsey-strategy | sequoia-pitch | stripe-product-launch | quarterly-exec-review | tech-arch-rfc | academic-defense | enterprise-proposal | gov-institutional + workspace absorbed exemplars), Deterministic Weak-LLM Compensator & Anti-Slop Upgrader (autoUpgrade), 30+ native editable layouts & pro diagrams (KPI, Bento, mockup, syntax-highlighted code, Magic Quadrant, radar, dumbbell, heatmap, Marimekko, Sankey, SWOT, Porter value chain, Gantt, architecture, Harvey balls, TAM, org, Mermaid, booktabs), and deep .pptx absorption. 中文:先按标杆范本(exemplar)槽位组织内容或传入粗纲,由确定性升维器自动打破纯文字墙与平庸标题,输出可直接放映与编辑的三件套。',
418
439
  parameters: compileParameters({
419
440
  title: { type: 'string', required: true, description: 'Deck title (used for the cover and file names).' },
420
441
  content: { type: 'string', description: 'Markdown content: # cover title, ## slides, -/* bullets (supports **bold** lead-ins), | ... | tables, > quotes, > [!TAKEAWAY] bottom summary bar, ::: kpi|cards|comparison|process|matrix|callout|gantt|architecture|harvey|tam|org blocks, and <!-- 备注: ... --> speaker notes. Required unless slides or template is provided.' },
421
442
  theme: { type: 'string', description: 'Visual theme id: auto (default: Scenario Auto-Director picks optimal theme & chrome) or ' + ALLOWED_THEME_IDS.join(' / ') + '. See ppt_themes.' },
422
443
  taste: { type: 'string', description: 'Curated Aesthetic Taste Recipe ID (mckinsey-partner | apple-keynote-dark | apple-keynote-light | swiss-editorial | linear-craft | ft-data-journal | nature-academic | oriental-zen) or a workspace-absorbed custom recipe ID.' },
444
+ exemplar: { type: 'string', description: 'Curated Gold Exemplar ID (mckinsey-strategy | sequoia-pitch | stripe-product-launch | quarterly-exec-review | tech-arch-rfc | academic-defense | enterprise-proposal | gov-institutional) or workspace-absorbed exemplar ID from .dsh-ppt/exemplars.json. Inherits optimal theme/taste and projects slides onto proven visual cadence.' },
445
+ autoUpgrade: { type: 'boolean', description: 'Run deterministic Weak-LLM Compensator & Anti-Slop Upgrader (promotes buried metrics/before-after/radar/quadrant/heatmap/code/mockup, auto-splits >6-bullet walls, breaks monotonous bullet streaks, rescues generic titles & bare closings). Default true; set false to preserve raw slides verbatim.' },
423
446
  persona: { type: 'string', enum: ['auto', 'consulting', 'tech-pitch', 'academic', 'gov-exec', 'education', 'editorial'], description: 'Optional scenario/audience persona for Auto-Art-Direction, layout rhythm promotion, and table/chart styling. Default auto.' },
424
447
  referencePptx: { type: 'string', description: 'Optional local reference .pptx path; absorbs its sanitized palette, CJK/Latin fonts, chrome skeleton, and master logo before applying explicit brand overrides.' },
425
448
  cloneStructure: { type: 'boolean', description: 'When referencePptx is provided, align generated slide archetypes and master chrome skeleton with the absorbed reference slideSkeleton[] where compatible (default false).' },
426
449
  smartLayout: { type: 'boolean', description: 'Enable or disable automatic multi-archetype Markdown layout promotion on >=4-section decks. Default true in async tool mode.' },
427
450
  lang: { type: 'string', description: 'UI language of the generated player: zh (default), en, or bilingual. Content language is whatever you write.' },
428
451
  motion: { type: 'string', enum: ['on', 'off'], description: 'Slide transitions plus bullet entrance animations: on (default) or off for a fully static deck.' },
429
- slides: { type: 'array', items: { type: 'object', properties: slideProperties, additionalProperties: true }, description: 'Structured slides across 24 native layouts & pro diagrams (cover, agenda, section, bullets, kpi, cards, comparison, matrix, process, callout, gantt, architecture, harvey, tam, org, statement, quote, table, chart, chart-split, waterfall, image, image-left, image-right, closing) with items[], columns[], takeaway, source, chrome, tableStyle (consulting|booktabs|minimal|banded|harvey), local images, and 13 chart kinds.' },
430
- template: { type: 'string', enum: templateIds, description: 'Industry blueprint from ppt_templates (16 blueprints). Provide finished content/slides following its outline; template alone creates an unfilled draft.' },
452
+ slides: { type: 'array', items: { type: 'object', properties: slideProperties, additionalProperties: true }, description: 'Structured slides across 30+ native layouts & pro diagrams (cover, agenda, section, bullets, kpi, cards, comparison, matrix, process, callout, gantt, architecture, harvey, tam, org, marimekko, sankey, swot, value-chain, mockup, code, quadrant, radar, dumbbell, heatmap, mermaid, statement, quote, table, chart, chart-split, waterfall, image, image-left, image-right, closing) with items[], columns[], takeaway, source, chrome, tableStyle (consulting|booktabs|minimal|banded|harvey), local images, and 13 chart kinds.' },
453
+ template: { type: 'string', enum: templateIds, description: 'Industry blueprint from ppt_templates (20 blueprints). Provide finished content/slides following its outline; template alone creates an unfilled draft.' },
431
454
  brand: { type: 'object', properties: brandProperties, additionalProperties: false, description: 'Shared brand: #RRGGBB primary/background/text colors, fontFamily, logo, footer, and chromeStyle (' + ALLOWED_CHROME_STYLES.join('|') + '). Applied to HTML and PPTX.' },
432
455
  targetMinutes: { type: 'number', description: 'Optional target speaking duration in minutes for pace budgeting.' },
433
456
  dataModel: { type: 'object', properties: { schemaVersion: { type: 'integer', enum: [1] }, sources: { type: 'array', items: { type: 'object', properties: sourceProperties, required: ['id'] } }, metrics: { type: 'array', items: { type: 'object', properties: metricProperties, required: ['id', 'kind'] } } }, additionalProperties: false, description: 'Optional explicit lineage and what-if model. Use with structured slides containing {{metricId}} in text/items/takeaway/tables or an exact token as chart values. Source facts reference a real cell or text line; assumptions require value/min/max/step. Formulas compute derived metrics. HTML offers live sliders; PPTX includes confirmed static values, formulas and assumptions in speaker notes. Leave absent for ordinary finished decks.' },
@@ -443,9 +466,21 @@ export function buildPptTools(config) {
443
466
  },
444
467
  {
445
468
  name: 'ppt_templates',
446
- description: 'List all 20 industry scenario blueprints (weekly, defense, project, pitch, consulting, keynote, gov-report, workshop, architecture-review, financial-earnings, medical-case, postmortem, marketing-campaign, promotion-review, legal-compliance, creative-lookbook, quarterly-okr, product-prd, vc-daylight, industry-research) with recommended themes, chrome skeletons, and multi-archetype slide outlines. 中文:查看全部 20 套行业场景蓝图(含推荐主题、母版骨架与专业图示大纲),组织真实内容后再调用 ppt_create 交付成品。',
447
- parameters: compileParameters({ lang: { type: 'string', description: 'zh / en / bilingual, default zh.' } }),
448
- output: { schema: { type: 'object', additionalProperties: true }, render: (_args, value) => oneText(JSON.stringify(value, null, 2)) },
469
+ description: 'List all 20 industry scenario blueprints AND 8 Curated Gold Exemplars (+ any workspace-absorbed .pptx exemplars). Pass exemplarId to retrieve the exact per-slide Slot-Filling Contract and gold Action-Title examples so any model can deterministically fill a publication-grade deck without inventing layout design from scratch. 中文:查看 20 套行业蓝图与 8 套内置标杆范本(含工作区吸收范本);传入 exemplarId 直接获取逐页槽位填空契约与满分标题示范,显著提升中弱模型成稿稳定性。',
470
+ parameters: compileParameters({
471
+ lang: { type: 'string', description: 'zh / en / bilingual, default zh.' },
472
+ exemplarId: { type: 'string', description: 'Optional curated or workspace exemplar ID (e.g. mckinsey-strategy, sequoia-pitch, stripe-product-launch, quarterly-exec-review, tech-arch-rfc, academic-defense, enterprise-proposal, gov-institutional) to return its exact per-slide slot-filling contract & promptGuide.' },
473
+ }),
474
+ output: {
475
+ schema: { type: 'object', additionalProperties: true },
476
+ render: (_args, value) => {
477
+ const rec = (value && typeof value === 'object') ? value : {};
478
+ if (typeof rec.promptGuide === 'string' && rec.promptGuide.trim()) {
479
+ return oneText(rec.promptGuide + '\n\n' + JSON.stringify({ exemplar: rec.exemplar }, null, 2));
480
+ }
481
+ return oneText(JSON.stringify(value, null, 2));
482
+ },
483
+ },
449
484
  execute: executors.templates,
450
485
  },
451
486
  {
package/lib/types.d.ts CHANGED
@@ -280,6 +280,10 @@ export interface PptCreateArgs {
280
280
  slides?: PptSlideSpec[];
281
281
  theme?: string;
282
282
  taste?: PptTasteRecipeId | string | PptTasteRecipe;
283
+ /** Curated exemplar ID (8 built-in) or workspace absorbed exemplar ID for slot-filling & auto-upgrade. */
284
+ exemplar?: string;
285
+ /** Deterministic weak-LLM compensator & anti-slop upgrader (default true in async mode; set false to keep raw slides verbatim). */
286
+ autoUpgrade?: boolean;
283
287
  persona?: PptPersonaId | string;
284
288
  referencePptx?: string;
285
289
  cloneStructure?: boolean;
@@ -330,13 +334,33 @@ export interface PptThemesResult {
330
334
  }
331
335
  export interface PptAbsorbArgs {
332
336
  pptxPath?: string;
337
+ corpusDir?: string;
338
+ limit?: number;
333
339
  bytes?: Uint8Array | Buffer;
334
340
  cwd?: string;
335
341
  extractLogo?: boolean;
336
342
  saveTasteAs?: string;
337
343
  tasteName?: string;
344
+ saveExemplarAs?: string;
345
+ exemplarName?: string;
338
346
  signal?: AbortSignal;
339
347
  }
348
+ export interface PptExemplarSummary {
349
+ id: string;
350
+ name: string;
351
+ enName?: string;
352
+ persona?: string;
353
+ theme?: string;
354
+ taste?: string;
355
+ chromeStyle?: string;
356
+ slideCount: number;
357
+ description?: string;
358
+ enDescription?: string;
359
+ source?: 'curated' | 'workspace';
360
+ sourceFile?: string;
361
+ layoutCadence?: string[];
362
+ slots?: Array<Record<string, unknown>>;
363
+ }
340
364
  export interface PptAbsorbSkeleton {
341
365
  cornerStyle?: string;
342
366
  hasTopBanner?: boolean;
@@ -353,7 +377,16 @@ export interface PptAbsorbSlideSkeleton {
353
377
  export interface PptAbsorbResult {
354
378
  ok: boolean;
355
379
  pptxPath?: string;
356
- slideCount: number;
380
+ dirPath?: string;
381
+ scanned?: number;
382
+ ingestedCount?: number;
383
+ failedCount?: number;
384
+ exemplars?: Array<Record<string, unknown>>;
385
+ failed?: Array<{
386
+ file: string;
387
+ error: string;
388
+ }>;
389
+ slideCount?: number;
357
390
  slideSize?: {
358
391
  width: number;
359
392
  height: number;
@@ -364,14 +397,16 @@ export interface PptAbsorbResult {
364
397
  extractedPalette?: Record<string, string>;
365
398
  extractedFonts?: Record<string, string>;
366
399
  extractedSkeleton?: PptAbsorbSkeleton;
367
- sanitizedBrand: PptBrand;
368
- sanitizedTokens: Record<string, unknown>;
369
- recommendedTheme: string;
400
+ sanitizedBrand?: PptBrand;
401
+ sanitizedTokens?: Record<string, unknown>;
402
+ recommendedTheme?: string;
370
403
  recommendedChrome?: PptChromeStyle | string;
371
404
  recommendedTableStyle?: PptTableStyle | string;
372
405
  narrativeProfile?: Record<string, unknown>;
373
406
  styleRecipe?: PptTasteRecipe;
374
407
  savedTastePath?: string;
408
+ savedExemplarPath?: string;
409
+ exemplar?: PptExemplarSummary;
375
410
  slideSkeleton?: PptAbsorbSlideSkeleton[];
376
411
  layoutSummary?: Record<string, unknown>;
377
412
  }
@@ -457,12 +492,24 @@ export interface PptCreateResult {
457
492
  deliveryStatus?: 'draft' | 'ready-for-review';
458
493
  importedFrom?: string;
459
494
  syncedProject?: boolean;
495
+ exemplar?: string;
496
+ upgradeReport?: Record<string, unknown>;
460
497
  quality?: PptQualityResult;
461
498
  verification?: PptVerification;
462
499
  }
463
500
  /** Shared generator and optional renderer exposed to the plugin. */
464
501
  export interface DeckEngine {
465
502
  absorbPptx(options: Record<string, unknown>): Promise<PptAbsorbResult>;
503
+ ingestExemplarCorpus?(options: Record<string, unknown>): Promise<PptAbsorbResult>;
504
+ listCuratedExemplars?(workspaceExemplars?: Record<string, unknown>): PptExemplarSummary[];
505
+ loadWorkspaceExemplars?(cwd?: string): Record<string, PptExemplarSummary>;
506
+ saveWorkspaceExemplar?(cwd: string, exemplar: Record<string, unknown>): {
507
+ exemplar: PptExemplarSummary;
508
+ path: string;
509
+ };
510
+ resolveExemplar?(idOrObj: unknown, workspaceExemplars?: Record<string, unknown>): PptExemplarSummary | null;
511
+ renderExemplarPromptGuide?(exemplar: unknown, lang?: string): string;
512
+ extractExemplarFromAbsorbed?(absorbed: unknown, options?: Record<string, unknown>): Record<string, unknown>;
466
513
  importPptxDeck(options: Record<string, unknown>): Promise<PptCreateResult>;
467
514
  importOfficeDeck?(options: Record<string, unknown>): Promise<PptCreateResult>;
468
515
  repairDeckVisual(options: Record<string, unknown>): Promise<PptCreateResult>;
package/lib/workbench.js CHANGED
@@ -1043,11 +1043,14 @@ export class PptWorkbench {
1043
1043
  const engine = await this.loadEngine();
1044
1044
  signal?.throwIfAborted();
1045
1045
  const langCode = body.lang === 'en' ? 'en' : 'zh';
1046
+ const storeDir = dirname(this.catalogPath);
1047
+ const workspaceExemplars = typeof engine.loadWorkspaceExemplars === 'function' ? engine.loadWorkspaceExemplars(storeDir) : {};
1046
1048
  return {
1047
1049
  ok: true,
1048
1050
  themes: typeof engine.listThemes === 'function' ? engine.listThemes(langCode) : [],
1049
1051
  presets: typeof engine.listMasterPresets === 'function' ? engine.listMasterPresets(langCode) : [],
1050
- tasteRecipes: typeof engine.listAllTasteRecipes === 'function' ? engine.listAllTasteRecipes(dirname(this.catalogPath)) : [],
1052
+ tasteRecipes: typeof engine.listAllTasteRecipes === 'function' ? engine.listAllTasteRecipes(storeDir) : [],
1053
+ exemplars: typeof engine.listCuratedExemplars === 'function' ? engine.listCuratedExemplars(workspaceExemplars) : [],
1051
1054
  templates: typeof engine.listTemplates === 'function' ? engine.listTemplates(langCode) : [],
1052
1055
  };
1053
1056
  }
@@ -1065,11 +1068,20 @@ export class PptWorkbench {
1065
1068
  const lang = body.lang === 'en' || body.lang === 'bilingual' ? body.lang : 'zh';
1066
1069
  const theme = typeof body.theme === 'string' && body.theme.trim() ? (body.theme.trim() === 'auto' ? 'auto' : this.themeId(body.theme)) : 'auto';
1067
1070
  const template = typeof body.template === 'string' && body.template.trim() ? body.template.trim() : undefined;
1071
+ let exemplar;
1072
+ if (body.exemplar !== undefined && body.exemplar !== null && body.exemplar !== '') {
1073
+ if (typeof body.exemplar !== 'string' || !/^[a-z0-9\u4e00-\u9fff-]{1,64}$/i.test(body.exemplar.trim())) {
1074
+ throw new Error('标杆范本 ID 无效');
1075
+ }
1076
+ exemplar = body.exemplar.trim();
1077
+ }
1078
+ const autoUpgrade = typeof body.autoUpgrade === 'boolean' ? body.autoUpgrade : undefined;
1068
1079
  const brand = body.brand !== undefined ? this.brandPatch(body.brand) : undefined;
1069
1080
  const cloneStructure = body.cloneStructure === true;
1070
1081
  const engine = await this.loadEngine();
1071
1082
  signal?.throwIfAborted();
1072
- const decksDir = join(dirname(this.catalogPath), 'workbench-decks');
1083
+ const storeDir = dirname(this.catalogPath);
1084
+ const decksDir = join(storeDir, 'workbench-decks');
1073
1085
  mkdirSync(decksDir, { recursive: true });
1074
1086
  let tmpRefPath;
1075
1087
  let skeletonSlides;
@@ -1114,12 +1126,14 @@ export class PptWorkbench {
1114
1126
  ...(skeletonSlides ? { slides: skeletonSlides } : {}),
1115
1127
  ...(fallbackContent ? { content: fallbackContent } : {}),
1116
1128
  ...(template ? { template } : {}),
1129
+ ...(exemplar ? { exemplar } : {}),
1130
+ ...(autoUpgrade !== undefined ? { autoUpgrade } : {}),
1117
1131
  theme,
1118
1132
  lang,
1119
1133
  ...(tmpRefPath ? { referencePptx: tmpRefPath, cloneStructure } : {}),
1120
1134
  ...(brand ? { brand } : {}),
1121
1135
  outputDir: decksDir,
1122
- cwd: decksDir,
1136
+ cwd: storeDir,
1123
1137
  signal,
1124
1138
  });
1125
1139
  await this.remember(created, {});
@@ -1315,7 +1329,19 @@ export class PptWorkbench {
1315
1329
  if (typeof engine.absorbPptx !== 'function')
1316
1330
  throw new Error('当前引擎版本暂不支持参考 PPTX 吸收');
1317
1331
  const bytes = this.pptxBytes(body.data);
1318
- const absorbed = await engine.absorbPptx({ bytes, extractLogo: body.extractLogo !== false, signal });
1332
+ const saveExemplarAs = typeof body.saveExemplarAs === 'string' && /^[a-z0-9\u4e00-\u9fff-]{1,64}$/i.test(body.saveExemplarAs.trim())
1333
+ ? body.saveExemplarAs.trim()
1334
+ : undefined;
1335
+ const exemplarName = typeof body.exemplarName === 'string' && body.exemplarName.trim()
1336
+ ? body.exemplarName.trim().slice(0, 80)
1337
+ : undefined;
1338
+ const storeDir = dirname(this.catalogPath);
1339
+ const absorbed = await engine.absorbPptx({
1340
+ bytes,
1341
+ extractLogo: body.extractLogo !== false,
1342
+ ...(saveExemplarAs ? { saveExemplarAs, ...(exemplarName ? { exemplarName } : {}), cwd: storeDir } : {}),
1343
+ signal,
1344
+ });
1319
1345
  return {
1320
1346
  ok: true,
1321
1347
  absorbed: {
@@ -1331,6 +1357,8 @@ export class PptWorkbench {
1331
1357
  recommendedTableStyle: absorbed?.recommendedTableStyle ?? null,
1332
1358
  narrativeProfile: absorbed?.narrativeProfile ?? null,
1333
1359
  styleRecipe: absorbed?.styleRecipe ?? null,
1360
+ savedExemplarPath: absorbed?.savedExemplarPath ?? null,
1361
+ exemplar: absorbed?.exemplar ?? null,
1334
1362
  warnings: absorbed?.warnings ?? [],
1335
1363
  slideSkeleton: absorbed?.slideSkeleton ?? null,
1336
1364
  layoutSummary: absorbed?.layoutSummary ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ppt",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "DeepSeek Harness 演示文稿生成与编辑工作台:输入材料即可导出离线 HTML 放映、可编辑 PPTX 与工程包,支持按页编辑、数据推演与预审演练,以及原生清透 / 米白纸感 / Claude 暖书卷 / 8-Bit 像素 / 晴空薄荷五套明亮工作台主题。欢迎提交 issues 和 PR。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: dsh-ppt
3
- description: "Turn one sentence, a Markdown document, structured slides, Office files (.xlsx/.csv/.docx), or a benchmark .pptx into a world-class presentation deck: standalone HTML web slideshow (with Dual-Screen Presenter Console & Executive One-Pager) + 100% native-editable PPTX (with 8 Curated Taste Recipes, 4 poster covers + Hero Photo Split + coverPattern, 61 native <a:custGeom> vector icons, glass/frameless/editorial materiality, device mockups, 9-language syntax-highlighted code terminals, Magic Quadrant, Radar, Dumbbell, Heatmap, native <m:oMath> formulas, Mermaid flowcharts/sequences, Marimekko, Sankey, Porter Value Chain, SWOT) + project manifest + Speaker Handout. Features Zero-Question Scenario Auto-Direction (theme: auto), 24 curated themes, 8 Taste Recipes & benchmark .pptx aesthetic DNA learning (.dsh-ppt/taste-recipes.json), 6 Master Chrome Skeletons, 35+ native-editable layouts, 20 industry blueprints, 13 publication-grade charts with spotlight/referenceLine/growth callouts, and bilingual ZH/EN support. 中文:把一句话、文档、表格或标杆 PPTX 变成大师级演示文稿,内置 8 套大师品味配方(Taste Recipes)、设备原型 mockup、9 语言语法高亮代码窗 code、魔力象限/雷达图/哑铃图/热力图与 61 枚原生矢量图标、35+ 原生可编辑版式与标杆 PPTX 审美 DNA 持久化复用。"
3
+ description: "Turn one sentence, a Markdown document, structured slides, Office files (.xlsx/.csv/.docx), or a benchmark .pptx corpus into a world-class presentation deck: standalone HTML web slideshow (with Dual-Screen Presenter Console & Executive One-Pager) + 100% native-editable PPTX (with 8 Curated Gold Exemplars & Slot-Filling Contracts, Deterministic Weak-LLM Compensator & Anti-Slop Upgrader, 8 Curated Taste Recipes, 4 poster covers + Hero Photo Split + coverPattern, 61 native <a:custGeom> vector icons, glass/frameless/editorial materiality, device mockups, 9-language syntax-highlighted code terminals, Magic Quadrant, Radar, Dumbbell, Heatmap, native <m:oMath> formulas, Mermaid flowcharts/sequences, Marimekko, Sankey, Porter Value Chain, SWOT) + project manifest + Speaker Handout. Supports batch .pptx exemplar ingestion (.dsh-ppt/exemplars.json), Zero-Question Scenario Auto-Direction (theme: auto), 24 curated themes, 6 Master Chrome Skeletons, 35+ native-editable layouts, 20 industry blueprints, 13 publication-grade charts, and bilingual ZH/EN support. 中文:内置 8 套标杆范本槽位契约、确定性防退化升维器(专治中弱模型文字墙与平庸标题)与批量优质 .pptx 目录吸收引擎,让任意模型稳定输出麦肯锡/红杉/Stripe 级可编辑演示文稿。"
4
4
  compatibility: "Node ^22.19.0 or >=24.0.0. Images/charts/PPTX absorption use @office-kit/pptx@0.21.0; optional data models use jsep@1.4.0 and csv-parse@6.1.0. Optional PNG/PDF renderer: @deepseek-ai/libreoffice-kit@0.2.3 (bundled by DSH 0.2.2+; 0.1.5 also supported). Cross-harness: copy the full directory and run npm install --ignore-scripts there."
5
5
  allowed-tools: "Bash, Read, Write, Edit"
6
6
  ---
@@ -21,7 +21,8 @@ allowed-tools: "Bash, Read, Write, Edit"
21
21
  2. **结论先行(Action Titles)**:除封面、目录与章节页外,每页标题必须是**完整的结论判断句**(如「异步评审将工程师周均例会耗时压缩 75%」),严禁使用「项目背景」「数据分析」「周末到馆人次」等空洞名词标签。
22
22
  3. **版式节奏与反要点墙(Anti-Bullet-Wall)**:优先传**结构化 `slides`**(或使用 `::: kpi / cards / comparison / process / chevron / matrix / callout / gantt / architecture / harvey / tam / org` 指令)充分利用 **24+ 套原生版式与专业图示**。**整套文稿严禁连续超过 2 页使用普通 `bullets` 要点列表**;8 页以上文稿须有节奏地交替视觉密度(指标用 `kpi`、端到端价值链用 `chevron`、排期用 `gantt`、系统分层用 `architecture`、竞品能力用 `harvey`、市场空间用 `tam`、组织团队用 `org`、并列支柱用 `cards[pillars/bento]`、痛点整改用 `comparison[issue-action]`、演进/闭环用 `process[timeline/steps/flywheel/funnel]`、四象限用 `matrix`、数据配洞察用 `chart-split`、学术对比用 `table[booktabs]` 三线表)。
23
23
  4. **出版级图表与三线表**:单系列图表自动隐藏冗余图例,使用 `spotlight: true` / `highlight: 'max' | 'last'` 突出焦点色柱、其余灰阶退后,按需叠加 `referenceLine` 基准虚线与 `showGrowthCallout: true` 麦肯锡增长飞线批注,左下角附 `source` 数据来源;学术与严谨数据对比使用无竖线的 `booktabs` 三线表。
24
- 5. **双轨深层吸收优质 PPT 与 8 套大师品味配方(Taste Recipes)**:无外部模板时直接按场景选用内置 **8 套大师审美配方**(`taste: 'mckinsey-partner' | 'apple-keynote-dark' | 'apple-keynote-light' | 'swiss-editorial' | 'linear-craft' | 'ft-data-journal' | 'nature-academic' | 'oriental-zen'`),协同驱动 4 套海报封面(`keynote-glow` / `editorial-grid` / `architectural` / `split-bleed`)、`section[agenda]` 实时章节进度、4 种卡片材质(`solid` / `frameless` / `glass` / `editorial-rule`)、`kpi[spotlight]` / `cards[bento-hero]` 非对称主次布局与 **61 枚原生 `<a:custGeom>` 矢量图标**;用户提供标杆 `.pptx` 时调 `ppt_absorb`(传 `saveTasteAs` / CLI `--save-taste`)提取留白率/材质/字阶比/节奏分生成 `styleRecipe` 持久化至 `.dsh-ppt/taste-recipes.json`,后续新稿直接用 `taste: "<savedId>"` 复用,或传 `referencePptx` + `cloneStructure: true` 直接映射逐页版式序列与母版骨架!
24
+ 5. **标杆范本槽位填空(Slot-Filling)+ 确定性防退化升维器**:不要从零发明排版!优先从内置 **8 套标杆范本**(`exemplar: 'mckinsey-strategy' | 'sequoia-pitch' | 'stripe-product-launch' | 'quarterly-exec-review' | 'tech-arch-rfc' | 'academic-defense' | 'enterprise-proposal' | 'gov-institutional'`)或工作区已吸收范本中择一,先调 `ppt_templates({ exemplarId })` 获取逐页槽位契约与满分标题示范,再按槽位调用 `ppt_create({ exemplar, ... })`;引擎内置 **确定性弱模型补偿器(`autoUpgrade`,默认开启)**,即使输入为粗糙 `bullets` 也能以 0 额外模型开销自动升格 `kpi / dumbbell / radar / quadrant / heatmap / code / mockup`、拆分超长要点墙并抢救平庸标题与裸结尾。用户手头有优质 GitHub / 企业 `.pptx` 目录时,直接调 `ppt_absorb({ corpusDir })`(或 CLI `--ingest-exemplars <dir>`)批量投喂至 `.dsh-ppt/exemplars.json` 与 `.dsh-ppt/taste-recipes.json` 持久化复用。
25
+ 6. **8 套大师品味配方(Taste Recipes)与单份母版吸收**:无外部模板时也可独立选用 `taste: 'mckinsey-partner' | 'apple-keynote-dark' | 'apple-keynote-light' | 'swiss-editorial' | 'linear-craft' | 'ft-data-journal' | 'nature-academic' | 'oriental-zen'` 驱动 4 套海报封面、4 种卡片材质与 61 枚原生矢量图标;单份标杆 `.pptx` 用 `ppt_absorb`(`saveTasteAs` / `saveExemplarAs`)或 `referencePptx` + `cloneStructure: true` 吸收。
25
26
 
26
27
  ## 执行纪律(每次都要遵守)
27
28
 
@@ -48,6 +49,7 @@ allowed-tools: "Bash, Read, Write, Edit"
48
49
 
49
50
  | 何时必读 | 参考文件 | 核心内容 |
50
51
  | --- | --- | --- |
52
+ | 按标杆范本槽位填空或批量投喂 `.pptx` 语料 | `references/exemplars.md` | 8 套标杆范本槽位契约、`ppt_templates(exemplarId)`、批量 `--ingest-exemplars` 与弱模型升维补偿器 |
51
53
  | 写大纲、标题与正文前 | `references/copywriting.md` | 六大画像叙事骨架、Action Title 写法、字数预算、反空话与双语规范 |
52
54
  | 选主题、配色、骨架或吸收母版 | `references/themes.md` | 18 套大师主题色板(12 浅 6 深)、6 套母版骨架(Chrome)、18 语义 Token、六大画像选型树 |
53
55
  | 写结构化 `slides` 或扩展 Markdown | `references/syntax.md` | 24 套原生版式与专业图示 + `variant`、统一 `items` 结构、`:::` 容器指令、三线表与 `takeaway` |
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ppt-skill",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Standalone dsh-ppt skill dependencies for image/chart export",
@@ -0,0 +1,116 @@
1
+ # 标杆范本库与槽位填空契约(Curated Exemplar Corpus & Weak-LLM Compensator)
2
+
3
+ 本参考面向两类高频需求:
4
+ 1. **将自由规划降维为「槽位填空(Slot-Filling)」**:直接按内置 **8 套满分标杆范本**(或工作区批量吸收的优质 `.pptx` 范本)逐页填空,让任意能力层级的模型稳定产出麦肯锡 / 红杉 / Stripe / Nature 级排版。
5
+ 2. **向工作区投喂外部优质 PPT 语料**:把本地或开源社区收集的高颜值 `.pptx` 目录批量吸收为持久化范本库(`.dsh-ppt/exemplars.json` + `.dsh-ppt/taste-recipes.json`),零额外运行时依赖、100% 离线提取且自动过滤隐藏说明页。
6
+
7
+ ---
8
+
9
+ ## 1. 内置 8 套标杆范本速查表
10
+
11
+ | Exemplar ID | 场景名称 | 继承主题 | 继承品味配方 | 骨架 | 页数与版式节奏 |
12
+ | --- | --- | --- | --- | --- | --- |
13
+ | `mckinsey-strategy` | 麦肯锡战略诊断与破局报告 | `consulting` | `mckinsey-partner` | `consulting-classic` | 10 页:architectural 封面 → exec-summary → spotlight KPI → agenda → Marimekko → 魔力象限 → agenda → 哑铃跃迁 → 甘特图 → cta-cards |
14
+ | `sequoia-pitch` | 红杉 / YC 创投融资路演 BP | `venture-daylight` | `apple-keynote-light` | `keynote-spatial` | 10 页:keynote-glow 封面 → 金句宣言 → 痛点对比 → browser 原型 → spotlight KPI → TAM 同心圆 → 魔力象限 → 桑基盈利流 → 团队图谱 → cta-cards |
15
+ | `stripe-product-launch` | Stripe / Apple 科技产品与开发者发布 | `stripe-craft` | `linear-craft` | `saas-bento` | 10 页:grid 光晕封面 → 无框大数字 → bento-hero → browser 原型 → mobile 原型 → 语法高亮代码 → 6 维雷达图 → 哑铃提速 → 甘特图 → cta-cards |
16
+ | `quarterly-exec-review` | 季度经营复盘与董事会汇报 | `financial-ft` | `ft-data-journal` | `editorial-folio` | 9 页:editorial-grid 封面 → spotlight KPI → 区域热力图 → 瀑布利润桥 → 桑基资金流 → 价值链箭头 → 痛点对策 → 甘特图 → cta-cards |
17
+ | `tech-arch-rfc` | 核心技术架构评审与系统重构 RFC | `stripe-craft` | `linear-craft` | `saas-bento` | 9 页:grid 光晕封面 → 新旧对比 → 分层拓扑 → Mermaid 流程图 → Mermaid 时序图 → 语法高亮代码 → 6 维权衡雷达 → 灰度甘特 → 准出清单 |
18
+ | `academic-defense` | Nature / 顶会学术答辩与实验报告 | `academic` | `nature-academic` | `academic-minimal` | 9 页:editorial-grid 封面 → 动机与贡献 → 原生公式定理框 → 方法流程图 → booktabs 三线表 → 消融哑铃图 → 泛化热力图 → 边界对比 → 总结致谢 |
19
+ | `enterprise-proposal` | 政企大客户解决方案与竞标提案 | `bcg-emerald` | `mckinsey-partner` | `consulting-classic` | 9 页:architectural 封面 → 价值摘要 → 痛点对策 → 私有化部署架构 → 哈维球盲测 → ROI 指标 → 12 周甘特 → SLA 团队 → POC 行动卡 |
20
+ | `gov-institutional` | 现代东方政务述职与年度工作报告 | `exec-jilan` | `oriental-zen` | `gov-ceremonial` | 8 页:inverted 封面 → spotlight KPI → 重点成果卡片 → 区域热力图 → 阶段推进时间轴 → 问题与整改 → 下阶段部署甘特 → 结语 |
21
+
22
+ ---
23
+
24
+ ## 2. 弱/中等模型标准两步出稿法(推荐)
25
+
26
+ ### Step 1:拉取目标范本的逐页槽位契约
27
+
28
+ ```json
29
+ // Agent 工具调用:
30
+ ppt_templates({ "exemplarId": "mckinsey-strategy", "lang": "zh" })
31
+ ```
32
+
33
+ 或 CLI 查看全部范本:
34
+
35
+ ```bash
36
+ node skills/dsh-ppt/scripts/build-deck.mjs --list-exemplars
37
+ ```
38
+
39
+ ### Step 2:按槽位填空并传 `exemplar` 生成
40
+
41
+ ```json
42
+ // Agent 工具调用(传结构化 slides 或粗纲 Markdown 均可):
43
+ ppt_create({
44
+ "title": "2026 华东区企业级增长破局战略",
45
+ "exemplar": "mckinsey-strategy",
46
+ "content": "# 2026 华东区企业级增长破局战略\n..."
47
+ })
48
+ ```
49
+
50
+ 或 CLI:
51
+
52
+ ```bash
53
+ node skills/dsh-ppt/scripts/build-deck.mjs \
54
+ --title "2026 华东区企业级增长破局战略" \
55
+ --exemplar mckinsey-strategy \
56
+ --content @notes.md \
57
+ --out dist
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 3. 批量向工作区投喂外部优质 `.pptx`(如开源 GitHub / 企业模板)
63
+
64
+ 把你收集的优质 `.pptx`(例如 MIT / CC0 开源模板或公司设计部标准模板)放入任意本地目录,一条命令或工具调用即可批量扫描、过滤隐藏说明页、提取色板/双字体/母版骨架/逐页版式序列,自动持久化至 `.dsh-ppt/exemplars.json` 与 `.dsh-ppt/taste-recipes.json`:
65
+
66
+ ### Agent 工具(`ppt_absorb`)
67
+
68
+ ```json
69
+ // 批量吸收整个文件夹(最多 40 份)
70
+ ppt_absorb({ "corpusDir": "./my-reference-decks", "limit": 20 })
71
+
72
+ // 或单份深度吸收并保存为可复用范本
73
+ ppt_absorb({
74
+ "pptxPath": "./company-q4-master.pptx",
75
+ "saveTasteAs": "corp-master",
76
+ "saveExemplarAs": "corp-q4",
77
+ "exemplarName": "公司 Q4 经营汇报标杆"
78
+ })
79
+ ```
80
+
81
+ ### CLI 命令
82
+
83
+ ```bash
84
+ # 批量吸收目录
85
+ node skills/dsh-ppt/scripts/build-deck.mjs --ingest-exemplars ./my-reference-decks
86
+
87
+ # 单份吸收并存为范本
88
+ node skills/dsh-ppt/scripts/build-deck.mjs --absorb ./company-q4-master.pptx --save-exemplar corp-q4
89
+
90
+ # 立即使用刚吸收的范本生成新文稿
91
+ node skills/dsh-ppt/scripts/build-deck.mjs --title "2026 Q1 汇报" --exemplar corp-q4 --content @notes.md --out dist
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 4. 确定性防退化升维器(Weak-LLM Compensator,`autoUpgrade`)
97
+
98
+ 即使模型输出了粗糙的连续 `bullets` 文字墙或平庸标题,只要未显式设置 `autoUpgrade: false`(或 CLI `--no-auto-upgrade`),引擎会在落盘前以 **0 额外模型调用、100% 文本无损** 确定性执行四重修复:
99
+
100
+ 1. **高阶视觉语义自动升维**:
101
+ - 含代码块/函数声明 → 自动升格 `code[split]` 语法高亮代码页;
102
+ - 含多组「旧值 → 新值 / 改造前→后」数值跃迁 → 自动升格 `dumbbell` 哑铃图;
103
+ - 含 4–6 维评分(如「性能 94 vs 行业 70」)→ 自动升格 `radar` 多维雷达图;
104
+ - 含坐标/象限分布信号 → 自动升格 `quadrant` 魔力象限;
105
+ - 含区域/季度纯数值矩阵表 → 自动升格 `heatmap` 热力图;
106
+ - 含 URL / Web / App 界面特性 → 自动升格 `mockup[browser|mobile]` 设备原型;
107
+ - 含 3+ 核心指标大数字 → 自动升格 `kpi[spotlight]` 聚光灯指标卡。
108
+ 2. **范本槽位节奏投影**:传 `exemplar` 时,把兼容的普通 `bullets` 页按标杆范本对应页序投影为 `cards[exec-summary/bento-hero]`、`comparison[issue-action]`、`process[steps/chevron]`、`closing[cta-cards]`,继承封面/章节变体。
109
+ 3. **防文字墙与防单调连页**:
110
+ - 单页 `>6` 条 bullets 自动拆分为两页(`(续)` / `(Cont.)`),杜绝挤压溢出;
111
+ - 连续 `>=2` 页 `bullets` 自动打断为 `cards` / `comparison` / `process`;
112
+ - 无加粗引导词的长要点自动切分加粗 `**主语**:说明`,提升扫视效率。
113
+ 4. **反 AI 土味标题与结尾兜底(`SLOP-01 / 02 / 09`)**:
114
+ - 「项目背景 / 核心指标 / 竞品分析 / 性能提升 / 总结」等空洞标签自动结合正文首条核心结论提炼为 Action Title;
115
+ - 自动补齐有意义的章节面包屑 `kicker`;
116
+ - 仅写「谢谢 / Thank you」的裸结尾自动补齐可执行行动副标题与下一步指引。
@@ -17,7 +17,7 @@ import { resolve as resolvePath } from 'node:path'
17
17
  import { pathToFileURL } from 'node:url'
18
18
  import { listThemes, THEME_IDS, DEFAULT_THEME } from './deck-themes.mjs'
19
19
  import { CHROME_STYLE_IDS } from './deck-absorb.mjs'
20
- import { buildDeckAsync, listTemplates, editDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx, importPptxDeck, importOfficeDeck, listAllTasteRecipes } from './deck-advanced.mjs'
20
+ import { buildDeckAsync, listTemplates, editDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx, importPptxDeck, importOfficeDeck, listAllTasteRecipes, listCuratedExemplars, loadWorkspaceExemplars, ingestExemplarCorpus } from './deck-advanced.mjs'
21
21
 
22
22
  const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导出
23
23
 
@@ -34,6 +34,11 @@ const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导
34
34
  --clone-structure 配合 --reference-pptx 使用,克隆参考文稿的逐页版式骨架与母版 chrome
35
35
  --chrome <style> 母版骨架风格:${CHROME_STYLE_IDS.join(' / ')}
36
36
  --taste <id> 大师审美配方 ID(mckinsey-partner / apple-keynote-dark / apple-keynote-light / swiss-editorial / linear-craft / ft-data-journal / nature-academic / oriental-zen 或已吸收自定义 ID)
37
+ --exemplar <id> 标杆范本槽位契约 ID(8 套内置满分范本或 .dsh-ppt/exemplars.json 已吸收范本,锁定叙事节奏与版式升维)
38
+ --list-exemplars 列出内置 8 套满分标杆范本及工作区已吸收的标杆 .pptx 范本
39
+ --ingest-exemplars <dir> 批量吸收目录下所有优质 .pptx 语料并持久化至 .dsh-ppt/exemplars.json 与 taste-recipes.json
40
+ --save-exemplar <id> 配合 --absorb 将单份标杆 .pptx 同步保存为可复用范本契约
41
+ --no-auto-upgrade 关闭弱模型自动兜底升维与反文字墙拆分
37
42
  --save-taste <id> 配合 --absorb 将标杆 .pptx 深度提炼并保存为可复用品味配方
38
43
  --list-tastes 列出内置 8 套大师审美配方及当前工作区已吸收的标杆配方
39
44
  --absorb <deck.pptx> 只读检查并输出参考 .pptx 的净化主题、推荐内置主题/骨架、深度审美配方 styleRecipe 与逐页分布 JSON
@@ -95,6 +100,11 @@ export function parseArgv(argv) {
95
100
  else if (key === '--list-themes') args.listThemes = true
96
101
  else if (key === '--list-templates') args.listTemplates = true
97
102
  else if (key === '--list-tastes') args.listTastes = true
103
+ else if (key === '--list-exemplars') args.listExemplars = true
104
+ else if (key === '--exemplar') args.exemplar = nextValue()
105
+ else if (key === '--ingest-exemplars') args.ingestExemplars = nextValue()
106
+ else if (key === '--save-exemplar') args.saveExemplar = nextValue()
107
+ else if (key === '--no-auto-upgrade') args.autoUpgrade = false
98
108
  else if (key === '--overwrite') args.overwrite = true
99
109
  else if (key === '--smart-layout') args.smartLayout = true
100
110
  else if (key === '--no-smart-layout') args.smartLayout = false
@@ -166,6 +176,12 @@ export async function main(argv = process.argv.slice(2), io = {}) {
166
176
  }
167
177
  if (args.listTemplates) { log(JSON.stringify({ templates: listTemplates(args.lang) }, null, 2)); return 0 }
168
178
  if (args.listTastes) { log(JSON.stringify({ tasteRecipes: listAllTasteRecipes(process.cwd()) }, null, 2)); return 0 }
179
+ if (args.listExemplars) { log(JSON.stringify({ exemplars: listCuratedExemplars(loadWorkspaceExemplars(process.cwd())) }, null, 2)); return 0 }
180
+ if (args.ingestExemplars) {
181
+ const report = await ingestExemplarCorpus({ dirPath: args.ingestExemplars, cwd: process.cwd() })
182
+ log(JSON.stringify(report, null, 2))
183
+ return 0
184
+ }
169
185
  if ([args.edit && !args.syncPptx ? args.edit : null, args.undo, args.check, args.render, args.absorb, args.importPptx, args.syncPptx, args.fromOffice].filter(Boolean).length > 1) {
170
186
  throw new Error('dsh-ppt CLI:--edit / --undo / --check / --render / --absorb / --import-pptx / --sync-pptx / --from-office 只能选择一项')
171
187
  }
@@ -219,6 +235,7 @@ export async function main(argv = process.argv.slice(2), io = {}) {
219
235
  const absorbed = await absorbPptx({
220
236
  pptxPath: args.absorb,
221
237
  ...(args.saveTaste ? { saveTasteAs: args.saveTaste } : {}),
238
+ ...(args.saveExemplar ? { saveExemplarAs: args.saveExemplar } : {}),
222
239
  })
223
240
  log(JSON.stringify(absorbed, null, 2))
224
241
  return 0
@@ -270,6 +287,8 @@ export async function main(argv = process.argv.slice(2), io = {}) {
270
287
  slides,
271
288
  theme: args.theme,
272
289
  ...(args.taste ? { taste: args.taste } : {}),
290
+ ...(args.exemplar ? { exemplar: args.exemplar } : {}),
291
+ ...(args.autoUpgrade !== undefined ? { autoUpgrade: args.autoUpgrade } : {}),
273
292
  persona: args.persona,
274
293
  referencePptx: args.referencePptx,
275
294
  cloneStructure: args.cloneStructure,
@@ -18,6 +18,7 @@ import { basename, resolve } from 'node:path'
18
18
  import { inflateSync } from 'node:zlib'
19
19
  import { sanitizeAbsorbedTheme, normalizeHex, hexToHsl, relativeLuminance } from './deck-themes.mjs'
20
20
  import { sanitizeCustomTasteRecipe, saveWorkspaceTasteRecipe } from './deck-taste.mjs'
21
+ import { extractExemplarFromAbsorbed, saveWorkspaceExemplar } from './deck-exemplars.mjs'
21
22
 
22
23
  const MAX_PPTX_BYTES = 64 * 1024 * 1024
23
24
  const MAX_LOGO_BYTES = 2 * 1024 * 1024
@@ -498,6 +499,8 @@ function inspectTableForHarveyAndStyle(lib, tables) {
498
499
  function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH) {
499
500
  const result = { slideNumber: slideIndex + 1, inferredLayout: 'bullets' }
500
501
  try {
502
+ const slideXmlStr = typeof slide?.xml === 'string' ? slide.xml : ''
503
+ if (/<p:sld\b[^>]*\bshow="0"/.test(slideXmlStr)) result.hidden = true
501
504
  const rawShapes = lib.getSlideShapes(slide) ?? []
502
505
  const shapes = flattenShapes(lib, rawShapes)
503
506
  let layoutType = ''
@@ -1427,9 +1430,9 @@ export async function absorbPptx(options = {}) {
1427
1430
  savedTastePath = saved.path
1428
1431
  }
1429
1432
 
1430
- return {
1433
+ const baseResult = {
1431
1434
  ok: true,
1432
- ...(resolvedPath ? { pptxPath: resolvedPath } : {}),
1435
+ ...(resolvedPath ? { pptxPath: resolvedPath, sourceFile: basename(resolvedPath) } : {}),
1433
1436
  slideCount,
1434
1437
  slideSize,
1435
1438
  extractedPalette,
@@ -1446,6 +1449,27 @@ export async function absorbPptx(options = {}) {
1446
1449
  warnings: sanitized.warnings,
1447
1450
  layoutSummary,
1448
1451
  extractedSkeleton,
1449
- slideSkeleton,
1452
+ slideSkeleton: slideSkeleton.map((entry) => (
1453
+ entry.titleSample && /\(hidden\)|模板说明|使用说明|template\s+instructions/i.test(entry.titleSample)
1454
+ ? { ...entry, hidden: true }
1455
+ : entry
1456
+ )),
1457
+ }
1458
+
1459
+ let savedExemplarPath
1460
+ let exemplar
1461
+ if (typeof options.saveExemplarAs === 'string' && options.saveExemplarAs.trim()) {
1462
+ const extracted = extractExemplarFromAbsorbed(baseResult, {
1463
+ id: options.saveExemplarAs.trim(),
1464
+ name: options.tasteName || options.exemplarName,
1465
+ })
1466
+ const savedEx = saveWorkspaceExemplar(cwd, extracted)
1467
+ savedExemplarPath = savedEx.path
1468
+ exemplar = savedEx.exemplar
1469
+ }
1470
+
1471
+ return {
1472
+ ...baseResult,
1473
+ ...(savedExemplarPath ? { savedExemplarPath, exemplar } : {}),
1450
1474
  }
1451
1475
  }