# Contracts (v1, M0) Frozen implementation contracts for `dsh-ppt-fusion`, measured on this machine on 2026-09-22. Full `--help` snapshots live in `docs/help/`; this file records what the fusion code may rely on. ADRs referenced as `ADR-nnn` are in `decisions.md`. Paths: `MASTER` = `%DSH_HOME%\ppt-fusion\venvs\ppt-master-0.1.128\Scripts\ppt-master.exe`, `PPTWISE` = `\node_modules\@liustack\pptwise\dist\cli.js` (invoke as `node `), `PY` = the venv's `Scripts\python.exe`. --- ## 1. ppt-master (deep engine) ### 1.1 Invocation - Entry point `ppt-master = cli:main`, a dispatcher with 74 subcommands (`docs/help/ppt-master-help.txt`). - The fusion CLI registers only the subcommands it uses (ADR-013). Registration records: subcommand, accepted flags with their enumerations, and the output files the command is contracted to produce. - Every invocation sets `PYTHONIOENCODING=utf-8`, runs with `cwd` inside the deck workspace, and uses absolute paths for the executable (ADR-003, ADR-004). ### 1.2 Registered subcommands (v1) | Subcommand | Flags the fusion uses | Output contract | |---|---|---| | `project init [--format F] [--dir D]` | `--format {ppt169,ppt43,wechat,xiaohongshu,moments,story,banner,a4}` | creates `\__\` with `svg_output/`, `sources/`, `exports/`, `validation/`, … | | `svg-to-pptx [flags]` | `--quick-generate`, `--native-charts-and-tables`, `--with-notes`, `--recorded-narration `, `--use-narration-timings`, `-f`, `-o`, `-s`, `--pptx-structure {structured,flat,baseline,template,preserve,generated}`, `-t`, `-a`, `--animation-config`, `--animation-duration`, `--no-animations` | writes `-o` target (default `exports/…pptx`); always writes `validation/.report.json`; prints `[POSTFLIGHT] status=… quality_gate=… slides=N warning_categories=N` plus `[PPTX]`/`[REPORT]` lines | | `svg-quality-check [flags]` | `--stage {early,first-page,page,final}`, `--quick-generate`, `--canonical-authoring`, `--json`, `--roundtrip`, `--template-mode`, `--page` (required with `--stage page`) | writes `validation/svg_quality_report.json`; exit 0 = pass. `--json` output on stdout is **not** parseable (progress lines surround it) — read the file (ADR-009) | | `stamp-native-fallbacks [--write]` | `--write` to persist | rewrites marker `data-pptx-fallback-sha256` in place; prints a `Native fallback baselines:` receipt with `SVG-first=N` | | `pptx-delivery-check ` | — | delivery-risk findings; exit 0 = pass | | `prompt-audit [--json]` | `--json` | prompt-budget findings for the skill documents | | `pptx-to-svg [-o dir] [--inheritance-mode M] [--roundtrip] [--strict] [--keep-hidden]` | `--inheritance-mode {both,layered,flat}`; `--roundtrip` requires `both` | round-trip workspace with `authoring-svg-flat/`, `analysis/native_structure.json` and `sources/source.pptx` (M5 ✓, ADR-038) | | `pptx-template-import [-o dir] [--inheritance-mode M] [--embed-images]` | `--inheritance-mode {both,layered,flat}` | reference workspace (`svg/` + `inheritance.json`) that `mirror-template-materialize` publishes from (M5 ✓) | | `mirror-template-materialize [--kind deck\|layout]` | `--kind {deck,layout}` | deterministic mirror template: template SVGs, text-slot files, `template_execution_manifest.json`, `source_themes.json`, a Design Spec TODO (M5 ✓) | | `apply-template --root [--root …] [--dry-run]` | repeatable `--root`, one per kind | installs a template root into `templates/`; writes `template_install.json` and prints an `[OK] installed N file(s)` receipt (M5 ✓) | | `register-template [id] [--kind K] [--rebuild-all] [--dry-run]` | `--kind {brand,style,layout,deck}` | refreshes the template index under `templates//` (M5 ✓) | | `image-search [--provider …] [--strict-no-attribution] [--manifest F] [--save-candidates] [--from-url U]` | `--provider {openverse,wikimedia,pexels,pixabay}`, `--orientation`, `--filename`, `--min-width`, `--promise …` | downloads into `-o`, writes the attribution manifest (M5) | | `image-gen "" --backend {gemini,openai} [-o dir] [--filename F] [--aspect_ratio R] [--image_size S]` | `--backend`, `-o`, `--filename`, `--aspect_ratio`, `--image_size` | writes the image into `-o`; the fusion records `image_sources.json`. Reachable only with `DSH_PPT_ENABLE_IMAGE_GEN=1` and the provider key present (V7.2 B5.5, ADR-064) | | `source-to-md [-t type] [-o output] [--json]` (and the five `*-to-md` converters) | `-t {auto,pdf,doc,excel,pptx,web,markdown,text}`, `--images {all,filtered,none}`, `--no-images`, `--json` | Markdown into the chosen output; `web-to-md` accepts http(s) URLs only (M5) | | `notes-to-audio [--provider P] [--voice V] [--rate R] [--list-common-voices]` | `--provider {edge,elevenlabs,minimax,qwen,cosyvoice}` (default `edge`, no key) | per-slide audio into the project; `--list-common-voices` is offline (M5 ✓) | | `narration-sync {fingerprint,animations,subtitles} [flags] ` | `--pptx` (subtitles), `--audio-dir`, `--animation-config`, `--plan`, `-o`, `--force` | timing plan / merged SRT (M5) | Registered since M3, under the same rules (enum-validated flags, workspace-contained paths, contracted outputs): `notes-to-audio` (`--provider {edge,elevenlabs,minimax,qwen, cosyvoice}`, `--voice/--rate/--volume`), `narration-sync {fingerprint,animations, subtitles}` (`subtitles` requires `--pptx`), `image-search` (`--provider {openverse,wikimedia,pexels,pixabay}`, `--orientation`, `--strict-no-attribution`, `--min-width`), the five converters `pdf-to-md|doc-to-md|excel-to-md|ppt-to-md|web-to-md` (`--images {all,filtered,none}`, `--max-rows`), `mirror-template-materialize` (`--kind {deck,layout}`) and `pptx-to-svg` (`--inheritance-mode {both,layered,flat}`). `REGISTERED_ENGINE_COMMANDS` in `src/engine/contracts.ts` is the authority; a command absent from it is unreachable. Explicitly **not** registered: `powerpoint-video`, `video-motion-plan`, `video-sound-mix`, `video-subtitles`, `gemini-watermark-remove` (ADR-013). `image-gen` is registered but the command layer gates it behind `DSH_PPT_ENABLE_IMAGE_GEN=1` (ADR-064). ### 1.3 Deep page authoring contract (measured, ADR-007) A deep page is one SVG in `/svg_output/` (1280×720 for `ppt169`). Required: 1. Root: `data-pptx-page-role` ∈ `{cover, toc, section, content, ending}`. 2. Background/frame elements: `data-pptx-role` ∈ `{background, chrome, decoration, footer, header, logo, page-number, watermark}` **and** a stable `id`. 3. Content modules: root-level ``; zones of sibling modules may not overlap by more than 1 px; text inside must not exceed the zone by more than 5 % on either axis. 4. Text uses raw Unicode, escapes XML reserved characters, and uses PPT-safe fonts. Banned: `mask`, `