AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(svg-pipeline): enforce canonical compact SVG authoring
hugohe3d8b7b5eed31a
diff --git a/AGENTS.md b/AGENTS.mdindex ab580665..9b8b02aa 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -89,10 +89,9 @@ python3 skills/ppt-master/scripts/image_gen.py "prompt" --aspect_ratio 16:9 --im# Spot illustrations — slice one AI grid sheet into individual elements (see image-generator.md §4.3):python3 skills/ppt-master/scripts/slice_images.py <project_path>/images/<sheet>.png --grid RxC --names a,b,c --trim --alpha --bg KEY_HEX_FROM_PROMPT --strict-alphapython3 skills/ppt-master/scripts/svg_editor/server.py <project_path> --live --daemon-python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path>-# Shared create-template coordinate compaction before template validation-python3 skills/ppt-master/scripts/compact_svg_coordinates.py "<template_workspace>/templates" --inplace --keep-native-frames-python3 skills/ppt-master/scripts/compact_svg_styles.py "<template_workspace>/templates" --inplace+python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path> --canonical-authoring+# Canonical compact template validation (read-only)+python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode --canonical-authoring# Explicit create-template normalization: selected complex <g> -> one SVG picture asset / <image>python3 skills/ppt-master/scripts/extract_svg_pictures.py "<svg_file>" --select "<group_id>" --resource-root "<workspace>" --images-dir "<workspace>/picture-assets" --inplace# Type A create-template mirror: validated authoring IR -> deterministic structured template workspacediff --git a/docs/technical-design.md b/docs/technical-design.mdindex 71c0bdc9..10ad10f1 100644--- a/docs/technical-design.md+++ b/docs/technical-design.md@@ -810,19 +810,30 @@ These direct routes share some analysis primitives with the main pipeline, but a**Why PPTX round-trip uses a semantic workspace rather than a ZIP-shaped tree.** The editable page source is `authoring-svg-flat/`; PowerPoint image media, imported reusable vectors, cues, audio, video, notes, and opaque payloads live under `images/`, `icons/imported/`, `sounds/`, `audio/`, `video/`, `notes/`, and `native-payloads/`. The exact backing package stays at `sources/source.pptx`, structural and ownership contracts stay under `analysis/`, diagnostics stay under `validation/`, and published decks stay under `exports/`. This keeps authoring paths aligned with normal projects while `analysis/roundtrip_manifest.json` maps semantic files back to package ownership. Import and export use this one contract: root `source_template.pptx`, `native_structure.json`, `conversion-report.json`, and `assets/` are invalid rather than compatibility inputs.+**Why compact SVG expands into verbose PPTX.** Both direct generation and PPTX+import publish canonical SVG source from the start: standard SVG elements,+descriptive groups, readable semantic metadata, root typography defaults, and+group-local paint defaults. The source never uses CSS classes, private aliases,+encoded payloads, or lossy numeric shortening. The quality checker verifies+this form without rewriting it. During export, the compiler resolves inherited+values and expands semantic tables, shapes, and other supported objects in+memory into the repetitive DrawingML required by PowerPoint; that verbosity is+confined to the ZIP-compressed compiled artifact.+Supported imported native tables remain one semantic marker rather thanthousands of model-facing SVG nodes. Their `ppt-master.semantic-table.v2`payload factors repeated cell, paragraph, and run formatting into defaults andnamed cell styles; native export expands those values in memory. Exact browser-previews are hashed under `images/source-object-previews/`. Complex groups and-tables outside the closed semantic schema instead stay source-backed:-`authoring-svg-flat/` keeps one compact `native-restore` image proxy plus the-outer source reference. An unchanged proxy rehydrates the complete source-OOXML object; deleting a Slide-local proxy deletes that object. Inherited-Master/Layout proxies must remain because one flat page cannot delete shared-structure. Editing either the proxy or its preview fails closed because-silently compiling it as a picture or SVG-derived shapes would violate-round-trip intent.+previews are hashed under `images/source-object-previews/`. Meaning-bearing+groups and tables outside the closed semantic schema remain inline as readable+SVG and report an explicit conversion gap; they never hide behind an imported+asset. Only an unsupported, text-free, schema-free source ornament may stay+source-backed as one compact `native-restore` image proxy plus its outer source+reference. An unchanged proxy rehydrates the complete source OOXML object;+deleting a Slide-local proxy deletes that object. Inherited Master/Layout+proxies must remain because one flat page cannot delete shared structure.+Editing either the proxy or its preview fails closed because silently compiling+it as a picture or SVG-derived shapes would violate round-trip intent.**Why there is only one PPTX compiler route.** Native export reads authored SVGs and translates supported SVG elements into DrawingML shapes. The normal deck path reads `svg_output/`; when requested, create-template invokes the same structured compiler on validated template prototypes to produce `exports/<id>_template_preview.pptx` as review evidence. The project does not package whole-slide SVG media or alternate raster renderings into a second PPTX. `svg_final/` is still generated on every standard deck run, but it is only a derived visual-preview / SVG-picture artifact rather than a PPTX source; PowerPoint's manual Convert to Shape command remains outside the supported contract.diff --git a/docs/zh/technical-design.md b/docs/zh/technical-design.mdindex 14cd9b82..ed5e0160 100644--- a/docs/zh/technical-design.md+++ b/docs/zh/technical-design.md@@ -693,7 +693,9 @@ SVG 与 DrawingML 的表达模型并不等价,因此主编译路径不把“**为什么 PPTX 往返使用语义工作区,而不是照搬 ZIP 目录。** 可编辑页面源是 `authoring-svg-flat/`;PowerPoint 图片媒体、导入的可复用矢量、提示音、音频、视频、备注和不透明载荷分别位于 `images/`、`icons/imported/`、`sounds/`、`audio/`、`video/`、`notes/` 和 `native-payloads/`。精确来源包保存在 `sources/source.pptx`,结构与归属契约保存在 `analysis/`,诊断保存在 `validation/`,发布文件保存在 `exports/`。这样既让作者路径与普通项目一致,又由 `analysis/roundtrip_manifest.json` 把语义文件映射回 package 归属。导入与导出只接受这一份契约;根目录下的 `source_template.pptx`、`native_structure.json`、`conversion-report.json` 与 `assets/` 都不是兼容输入。-受支持的导入原生表格保持为一个语义 marker,而不是在模型可见 SVG 中展开成数千个节点。其 `ppt-master.semantic-table.v2` payload 会把重复的单元格、段落和 run 格式归纳成默认值及命名单元格样式,原生导出时再在内存中展开。精确浏览器预览以 hash 命名存放在 `images/source-object-previews/`。复杂组合及封闭语义 schema 以外的表格则继续由来源支撑:`authoring-svg-flat/` 只保留一个紧凑的 `native-restore` 图片代理和外层 source ref。未修改的代理会恢复完整来源 OOXML 对象;删除 Slide-local 代理会删除该对象。继承自 Master/Layout 的代理必须保留,因为单个 flat 页面不能删除共享结构。修改代理或预览会直接阻止导出,因为静默编译为图片或 SVG 派生形状会违背往返意图。+**为什么紧凑 SVG 可以展开为丰富 PPTX。** 无论直接生成还是从 PPTX 导入,第一次发布的作者源就必须是规范化紧凑 SVG:使用标准 SVG 元素、可读分组和语义 metadata,根节点只保存字体类默认值,颜色与线型放在语义组中。源码不使用 CSS class、私有缩写、编码载荷或有损精度裁剪,质量检查只读验证而不回写。导出时,编译器在内存中解析继承,并把语义表格、原生形状及其他受支持对象展开为 PowerPoint 需要的重复 DrawingML;冗余只存在于最终经 ZIP 压缩的编译产物中。++受支持的导入原生表格保持为一个语义 marker,而不是在模型可见 SVG 中展开成数千个节点。其 `ppt-master.semantic-table.v2` payload 会把重复的单元格、段落和 run 格式归纳成默认值及命名单元格样式,原生导出时再在内存中展开。精确浏览器预览以 hash 命名存放在 `images/source-object-previews/`。封闭语义 schema 以外但承载含义的组合、表格和图表继续以内联可读 SVG 表达,并显式记录转换缺口,不能藏进 imported。只有不含文字、没有语义 marker、schema 也无法识别的来源装饰,才允许在 `authoring-svg-flat/` 中成为一个紧凑的 `native-restore` 图片代理和外层 source ref。未修改的代理会恢复完整来源 OOXML 对象;删除 Slide-local 代理会删除该对象。继承自 Master/Layout 的代理必须保留,因为单个 flat 页面不能删除共享结构。修改代理或预览会直接阻止导出,因为静默编译为图片或 SVG 派生形状会违背往返意图。**为什么只有一条 PPTX 编译路线。** Native 导出把作者 SVG 中受支持的元素逐个翻译成 DrawingML 形状。常规 deck 路线读取 `svg_output/`;用户需要时,create-template 对通过校验的模板原型调用同一 structured 编译器,生成 `exports/<id>_template_preview.pptx` 作为审阅证据。项目不会把整页 SVG 媒体或另一套位图渲染打包成第二类 PPTX。`svg_final/` 仍由常规 deck 的强制后处理生成,但只承担派生视觉预览和 SVG 图片插入,不为 PowerPoint 手工“转换为形状”提供兼容兜底。diff --git a/skills/ppt-master/references/artifact-ownership.md b/skills/ppt-master/references/artifact-ownership.mdindex 8189eb3a..2c07f398 100644--- a/skills/ppt-master/references/artifact-ownership.md+++ b/skills/ppt-master/references/artifact-ownership.md@@ -47,7 +47,7 @@ history, or resumable planning state. Context loss restarts the Quick run.| `templates/template_execution_manifest.json` (`v1`) + `templates/template_execution/*.text-slots.json` (`v2-min`) | Derived template index | Compact prototype/source-import summary plus per-prototype text-slot diagnostics; the sidecar integrity hash is tool-only | Materialization may publish these deterministic records, but page-context does not inject or require them and models do not read them during page authoring. The complete prototype SVG is the sole visual/template authority; never author from either JSON artifact. || `<import_workspace>/svg/` | Imported native-payload backing | Complete PPTX-derived metadata, hidden carriers, fallback evidence, and source structure | Keep immutable; create-template materialization may resolve a validated source ref against these files, but models do not edit or bulk-read them || `<import_workspace>/svg-flat/` | Optional complete-page verification backing | Self-contained visual composition generated only by explicit `--inheritance-mode both` | Keep immutable when requested; never use as authoring or materialization input |-| `<import_workspace>/authoring-svg/` | Template-creation author source | Layered editable SVG IR for imported Master, Layout, and Slide objects | Template_Designer reads and edits this bundle; final template SVGs are materialized from it rather than copied from lossless backing |+| `<import_workspace>/authoring-svg/` | Template-creation author source | Canonical compact layered SVG IR for imported Master, Layout, and Slide objects | The PPTX import transaction publishes it already normalized and decoration-factored; Template_Designer reads and edits it, and final template SVGs are materialized from it rather than copied from lossless backing || `<import_workspace>/authoring-svg/authoring_summary.json` | Model-readable authoring index | Current SVG roster plus compact per-file canvas, size, text, image, vector, placeholder, and source-ref counts | Models read this before authoring SVGs; regenerate after direct IR edits || `<import_workspace>/authoring-svg/authoring_manifest.json` | Tool-only authoring provenance contract | Per-document source/authoring hashes and document-local source-ref paths | Generated atomically with the IR; materialization validates it before reusing native payload; never load it into model context or duplicate raw payload here || `<import_workspace>/authoring-svg-flat/` | Optional complete-page verification IR | Self-contained page composition view with its own summary and provenance manifest | Generate only from an explicitly requested `svg-flat/`; use to verify composition, while layered `authoring-svg/` remains the canonical editable source |@@ -60,7 +60,7 @@ history, or resumable planning state. Context loss restarts the Quick run.| `notes/slide_*.md` | Conditional split notes | Per-slide notes generated from `total.md` | Derived by `total_md_split.py` only when speaker notes are enabled || `svg_final/` | Default-only derived visual preview | Self-contained post-processed SVGs that may be opened directly or inserted as SVG pictures | Default rebuilds it from `svg_output/` with `finalize_svg.py`; Quick omits it. Never use it as a supported PPTX source. || `validation/workflow.log` | Cold workflow audit log | Append-only Python command envelopes, material tagged outcomes, bounded warning/OK/stderr samples, per-run omission counts, and selective manual entries for important details with no owning Python output | `project_manager.py init` creates the log and records its milestone. Later project-scoped Python tools find that existing log through the shared CLI bootstrap and record the bounded audit selection without a wrapper command; their full console output is not copied. A helper whose arguments/cwd do not identify the active project receives `PPT_MASTER_PROJECT_PATH=<project_path>` on the same Python command. A role may run `workflow_log.py` once for a material non-Python stage handoff or rework reason, user-approved exception, or manual recovery choice; never duplicate artifacts, routine progress, or private reasoning. Detached services retain detailed output in their component logs. Never read this log during normal generation/resume or use it as stage, artifact, or quality authority; inspect it only for an explicit user-requested run review. In Quick it remains an incomplete operational audit, not a design history or resume source. |-| `validation/svg_quality_report.json` | Final SVG quality provenance | Final SVG gate split into blocking / introduced / inherited / source-import categories, bound to the checked SVG bytes by SHA-256 | Default runs `svg_quality_checker.py --stage final --json`; Quick adds `--quick-generate` so the checker ignores Design Spec/lock and validates the lockless flat roster. Export links the report only when fingerprints match; Quick requires that link to pass before PPTX creation. |+| `validation/svg_quality_report.json` | Final SVG quality provenance | Final SVG gate split into blocking / introduced / inherited / source-import categories, bound to the checked SVG bytes by SHA-256 | Default runs `svg_quality_checker.py --canonical-authoring --stage final --json`; Quick adds `--quick-generate` so the checker ignores Design Spec/lock and validates the lockless flat roster. Export links the report only when fingerprints match; Quick requires that link to pass before PPTX creation. || `validation/<output_stem>.report.json` | Published-package audit | PPTX package/resource postflight status, part counts, and quality-gate linkage | Both Generate profiles write it and emit `[POSTFLIGHT]` after package validation. || `exports/` | Delivery artifacts | Native DrawingML PPTX and explicit native-object/narration variants | Default Step 7.3 or Quick direct export writes final deliverables from `svg_output/`. || `backup/<timestamp>/svg_output/` | Default-path frozen author-source archive | Re-export source without re-running LLM | Both Generate profiles write a snapshot for default-path exports; explicit `-o/--output` skips it. |@@ -111,7 +111,7 @@ contract.| `<import_workspace>/authoring-svg/authoring_summary.json` | Current authoring SVGs plus tool-only manifest roster | `python3 ${SKILL_DIR}/scripts/svg_authoring_view.py <import_workspace>/authoring-svg --refresh-summary`; in-place vector/picture extraction refreshes it automatically || `notes/slide_*.md` | `notes/total.md`, when speaker notes are enabled | `python3 ${SKILL_DIR}/scripts/total_md_split.py <project_path>` || `svg_final/` | `svg_output/` plus project assets | `python3 ${SKILL_DIR}/scripts/finalize_svg.py <project_path>` |-| `validation/svg_quality_report.json` | `svg_output/`, plus locks/template provenance in Default Generate | Default: `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --stage final --json`; Quick: append `--quick-generate` |+| `validation/svg_quality_report.json` | `svg_output/`, plus locks/template provenance in Default Generate | Default: `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --canonical-authoring --stage final --json`; Quick: append `--quick-generate` || Native PPTX + `validation/<output_stem>.report.json` | `svg_output/` plus notes/assets and final quality report | `python3 ${SKILL_DIR}/scripts/svg_to_pptx.py <project_path>` || Quick native PPTX | `svg_output/`, prepared resources, passing Quick final report | `python3 ${SKILL_DIR}/scripts/svg_to_pptx.py <project_path> --quick-generate` |diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.mdindex 28adf6fe..382a395f 100644--- a/skills/ppt-master/references/executor-base.md+++ b/skills/ppt-master/references/executor-base.md@@ -172,8 +172,8 @@ Before drawing each page, look up its entry in `page_rhythm` (key format `P<NN>`- **Reference — prefer semantic geometry over preset stacks**: for relationships such as ascending, converging, breaking through, or stacking, first compose faithful primitives and exact presets as one page geometry system; use a Boolean only when the contour itself must merge, open, or fragment. Only when neither construction works should one page-specific polygon/path replace a stack of generic arrows.- **Reference — create depth with restraint**: use rhythm, spacing, typography, accent bars, and subtle tints before shadows. Reserve lift for a few genuinely floating elements; keep peer grids, dividers, and ordinary body containers flat. When material layering itself is part of the resolved visual style, follow that style's hierarchy instead of flattening its body planes.- **Phased generation** (recommended):- 1. **Visual Construction Phase**: generate all SVG pages sequentially for visual consistency. Apply every triggered information-model branch while drawing. **MUST embed one object-scoped plot-area marker** per §IX-named or Quick-promoted value-driven chart object under [`executor-chart.md`](./executor-chart.md) §2; coordinate calibration is a post-generation step (see [`verify-charts`](../workflows/stages/verify-charts.md)). Write every `<object-key>=yes` native marker plus JSON metadata atomically under [`native-data-interface.md`](./native-data-interface.md) §2. **Reach for native presets** per §3.0 as you draw each page: a block arrow, chevron, banner/ribbon, callout, standard flowchart node, or star is authored through `preset_shape_svg.py` at draw time — decided by the object's intent as you create it, never by scanning finished paths, and never committed to a bare `<path>`/`<polygon>` when a preset expresses it (a gradient fill/stroke or a pattern fill is the one paint exception — keep those ordinary SVG; when justified, one registered [`svg-effects.md`](./svg-effects.md) §6.4 shadow/glow stays on the helper-authored shape). **First-page gate (Mandatory)**: after completing the first page, run `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --stage first-page --json` directly without output filtering. Review the whole P01 issue set, make one consolidated edit pass for every error and any selected warnings, then perform one verification rerun. If it still fails, treat that complete output as the next batch; never check between individual fixes. After it passes, draw P02 through the last page without checker calls.- 2. **Quality Check Gate**: only after every planned SVG exists, run `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --stage final --json` directly on `svg_output/` without `tail` / `head` / `grep` filtering. One run already reports all pages. Review its complete issue set, fix every `error` plus any selected advisory warnings in one consolidated edit pass, then perform one verification rerun. If it still fails, its complete output begins the next batch cycle; never use checker calls to discover or fix one next issue at a time. Every `warning` is advisory: it never sends the page back for required modification, never authorizes automatic rewriting of compatible user syntax, and needs no acknowledgement/disposition line. Recommendation warnings describe the generated-SVG default; fidelity/quality warnings may be surfaced when material, while the existing input remains releasable. Prototype-identical diagnostics are recorded as `inherited`, source conversion losses as `source-import`, changed/new advisories as `introduced`, and release failures as `blocking` in `validation/svg_quality_report.json`. If release truly depends on a condition, it belongs in `errors`. On success, use the exit status and terminal summary; do not open or `cat` the complete JSON into model context. If terminal output is truncated on failure, read only the relevant issue arrays from the report written by that same run. Do NOT defer error handling to after `finalize_svg.py` — finalize rewrites SVG and masks some violations.+ 1. **Visual Construction Phase**: generate all SVG pages sequentially for visual consistency. Apply every triggered information-model branch while drawing. **MUST embed one object-scoped plot-area marker** per §IX-named or Quick-promoted value-driven chart object under [`executor-chart.md`](./executor-chart.md) §2; coordinate calibration is a post-generation step (see [`verify-charts`](../workflows/stages/verify-charts.md)). Write every `<object-key>=yes` native marker plus JSON metadata atomically under [`native-data-interface.md`](./native-data-interface.md) §2. **Reach for native presets** per §3.0 as you draw each page: a block arrow, chevron, banner/ribbon, callout, standard flowchart node, or star is authored through `preset_shape_svg.py` at draw time — decided by the object's intent as you create it, never by scanning finished paths, and never committed to a bare `<path>`/`<polygon>` when a preset expresses it (a gradient fill/stroke or a pattern fill is the one paint exception — keep those ordinary SVG; when justified, one registered [`svg-effects.md`](./svg-effects.md) §6.4 shadow/glow stays on the helper-authored shape). **First-page gate (Mandatory)**: after completing the first page, run `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --canonical-authoring --stage first-page --json` directly without output filtering. Review the whole P01 issue set, make one consolidated edit pass for every error and any selected warnings, then perform one verification rerun. If it still fails, treat that complete output as the next batch; never check between individual fixes. After it passes, draw P02 through the last page without checker calls.+ 2. **Quality Check Gate**: only after every planned SVG exists, run `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --canonical-authoring --stage final --json` directly on `svg_output/` without `tail` / `head` / `grep` filtering. One run already reports all pages. Review its complete issue set, fix every `error` plus any selected advisory warnings in one consolidated edit pass, then perform one verification rerun. If it still fails, its complete output begins the next batch cycle; never use checker calls to discover or fix one next issue at a time. Every `warning` is advisory: it never sends the page back for required modification, never authorizes automatic rewriting of compatible user syntax, and needs no acknowledgement/disposition line. Recommendation warnings describe the generated-SVG default; fidelity/quality warnings may be surfaced when material, while the existing input remains releasable. Prototype-identical diagnostics are recorded as `inherited`, source conversion losses as `source-import`, changed/new advisories as `introduced`, and release failures as `blocking` in `validation/svg_quality_report.json`. If release truly depends on a condition, it belongs in `errors`. On success, use the exit status and terminal summary; do not open or `cat` the complete JSON into model context. If terminal output is truncated on failure, read only the relevant issue arrays from the report written by that same run. Do NOT defer error handling to after `finalize_svg.py` — finalize rewrites SVG and masks some violations.3. **Logic Construction Phase (conditional)**: after SVGs pass the quality check, batch-generate speaker notes for narrative continuity only when the effective Speaker Notes outcome is enabled.**Mandatory — final carrier-receipt review**: The final checker prints onediff --git a/skills/ppt-master/references/shared-standards-core.md b/skills/ppt-master/references/shared-standards-core.mdindex cc1e3cc9..c5fcd267 100644--- a/skills/ppt-master/references/shared-standards-core.md+++ b/skills/ppt-master/references/shared-standards-core.md@@ -140,17 +140,18 @@ text uses a non-empty `font-family`, a finite positive unitless-px `font-size`,underline/strike, text outline/alpha, gradient text, or text filter effects.Unknown or unmapped declarations fail Checker preflight and native export.-**Hard rule — compact inherited authoring**: Generated SVG expresses shared-presentation values once at the nearest useful common scope. Put the page's-common `font-family` on the root `<svg>`; a meaningful `<g>` may override a-shared value for its subtree. Descendant `<text>` / `<tspan>` and drawing-elements write only values that differ from their inherited effective value.-Do not repeat the same font, size, weight, paint, stroke, anchor, or spacing on-every child for self-containment: root/group inheritance is part of the native-export contract. Keep true exceptions explicit. Run `compact_svg_styles.py`-on generated or materialized SVG before its quality gate; this normalization-does not authorize CSS classes, embedded stylesheets, or any otherwise-unsupported property.+**Hard rule — compact inherited authoring**: Author canonical compact SVG on+first publish. Put common typography presentation attributes on `<svg>`, with a+direct `font-family` whenever text is visible; root paint/effects are forbidden.+Put shared typography or paint on the nearest meaningful `<g>` and keep true+child overrides explicit. Inheritance is part of native export, not a lossy+post-process.++The source stays valid, browser-visible, semantic, locally editable SVG;+meaning and deterministic export outrank bytes. Never use classes/stylesheets,+aliases/private keys, encoded payloads, precision loss, or unrelated+indirection. `--canonical-authoring` is its read-only gate;+`compact_svg_styles.py` is legacy migration/diagnosis only.> **`marker-start` / `marker-end` is conditional** — see §1.1.>@@ -324,46 +325,38 @@ one. This array is still diagnostic metadata, not an authoring surface.| Representation | Contract ||---|---|-| Lossless import SVG | Keep complete native payload, hidden carriers, and preview evidence in the temporary analysis workspace. It is immutable native-payload backing, not the editable template source. |-| Authoring IR bundle | Keep editable SVGs plus model-readable `authoring_summary.json` and tool-only `authoring_manifest.json`. Exclude opaque payload and duplicate hidden carriers from model context while retaining visible shape intent and a stable document-local `data-pptx-source-ref` on each imported logical object. Compact model-facing imported frames and safe transform page coordinates to at most two decimals before hashing the IR. The summary owns the compact current-file index; the manifest owns source paths and initial hashes and never enters model context. |-| `standard` / `fidelity` output | Use the compact authored-preset contract (§1.5) for newly authored stock shapes; do not transplant opaque import payload or source topology. |-| `mirror` output | Materialize from the edited authoring IR. Rehydrate supported imported metadata only when a Slide-local/slot object's source ref and initial authoring hash still match; otherwise keep the current SVG fallback. Expand fixed Master/Layout group wrappers into direct semantic atoms while preserving source ownership, paint order, and visible appearance. |+| Lossless import SVG | Immutable native payload and preview evidence in the temporary analysis workspace; never editable template source. |+| Authoring IR bundle | Editable SVG plus model-readable `authoring_summary.json` and tool-only `authoring_manifest.json`. Keep visible intent and document-local `data-pptx-source-ref`, but omit opaque/duplicate carriers. Before hashing, compact safe imported frame/transform coordinates to two decimals. Summary indexes current files; manifest owns source paths/hashes and stays outside model context. |+| `standard` / `fidelity` output | Use §1.5 compact presets; never transplant opaque payload or source topology. |+| `mirror` output | Materialize edited IR. Rehydrate supported metadata only for a matching Slide-local/slot ref and initial hash; otherwise keep SVG fallback. Expand fixed Master/Layout wrappers to direct semantic atoms without changing ownership, paint order, or appearance. |**Hard rule — model-facing page-coordinate precision**:| Surface | Precision contract ||---|---|-| Imported `data-pptx-frame` in authoring IR | At most two decimals. An unchanged mirror source ref recovers the exact lossless frame before tool-side native-record externalization. |+| Imported `data-pptx-frame` in authoring IR | At most two decimals; an unchanged mirror ref recovers the exact lossless frame before native-record externalization. || `data-pptx-bounds` in generated and final template SVG | At most two decimals. |-| `translate(...)`, `rotate(... cx cy)`, and `matrix(... e f)` | Translation values and rotation centers use at most two decimals. Keep the rotation angle and matrix `a b c d` coefficients unchanged. |-| Protected values | Do not apply this compaction to path/points geometry, normalized crop or nested `viewBox` ratios, gradient offsets, opacity, scale arguments, canonical authored-preset frames, or lossless/tool-side native frames. |--**Hard rule — authoring source refs**: `data-pptx-source-ref` is reserved for-the create-template authoring IR. Its value is unique within one authoring SVG,-not across the workspace, and must be resolved through that document's-`authoring_manifest.json` record by the owning tool. Models MUST NOT read that-machine manifest. Moving a referenced subtree into-`icons/imported/` for readability must preserve the attribute and record it in-the vector inventory; re-inlining re-establishes the same mapping. Final materialized-template SVGs and normal project `svg_output/` must not contain this attribute.--**Hard rule — round-trip decoration extraction**: move text-free-vector decorations from `authoring-svg-flat/` into `icons/imported/` and leave-a `<use data-icon="imported/...">` reference in the page. Retain refs-in the inventory. The live editor expands the reference; an unchanged asset-restores native source objects, while an edited asset is one page-local vector-edit unit.--**Hard rule — round-trip source proxy fallback**: represent a-semantic/native-payload object that cannot safely become an editable vector-asset as an atomic `<image data-pptx-source-proxy="native-restore">` whose-SVG preview lives under `images/source-object-previews/`. The page keeps only-the outer source ref; descendant identity remains in immutable backing. An-unchanged proxy restores the native object. Complete removal deletes a-Slide-local object; an inherited Master/Layout proxy must remain-because a flat page cannot delete shared structure. Proxy or preview edits must-fail export rather than downgrade the object. Both compactions are-round-trip-only and do not apply to layered create-template authoring IR.+| `translate(...)`, `rotate(... cx cy)`, and `matrix(... e f)` | Translation/center values use at most two decimals; keep angle and matrix `a b c d` unchanged. |+| Protected values | Never compact path/points geometry, crop/nested-`viewBox` ratios, gradient offsets, opacity, scale, canonical preset frames, or lossless/tool-side frames. |++**Hard rule — authoring source refs**: `data-pptx-source-ref` is create-template+IR-only and unique per document. Tools resolve it through that document's+`authoring_manifest.json`; models never read the manifest. Extract/re-inline+preserves the ref and vector inventory mapping. Final templates and+`svg_output/` contain no source refs.++**Hard rule — decoration extraction**: move text-free imported vectors to+`icons/imported/` and leave an inventoried `<use data-icon="imported/...">`.+The editor expands it; unchanged assets restore source objects and edited ones+become page-local vector units.++**Hard rule — imported source proxy fallback**: only unsupported, text-free,+schema-free, unmarked ornament may use an atomic+`<image data-pptx-source-proxy="native-restore">` preview under+`images/source-object-previews/`. Meaning-bearing content stays readable inline+or reports a conversion gap. Unchanged proxies restore; removing a Slide-local+proxy deletes it, while inherited proxies remain. Proxy edits fail export.+Extraction/proxies are import-time only, never free-authored `svg_output/`.**Hard rule — structural-layer boundary**: An unchanged imported logical objectmay keep currently supported metadata while it remains Slide-local or inside adiff --git a/skills/ppt-master/references/template-designer.md b/skills/ppt-master/references/template-designer.mdindex 96e3e28b..0a53ab8a 100644--- a/skills/ppt-master/references/template-designer.md+++ b/skills/ppt-master/references/template-designer.md@@ -32,7 +32,7 @@ When the workflow provides a PPTX reference source, the effective input package- `svg/slide_NN.svg` — immutable slide-local native-payload backing; do not bulk-read because opaque native payload is retained- `svg/inheritance.json` — which layout / master each slide consumes- optional `svg-flat/slide_NN.svg` — immutable complete-page verification backing generated only when explicitly requested; do not use it as the editable source-- `authoring-svg/` and optional `authoring-svg-flat/` — lightweight non-destructive IR bundles created by `svg_authoring_view.py`; each contains editable SVGs, model-readable `authoring_summary.json`, and tool-only `authoring_manifest.json`+- `authoring-svg/` and optional `authoring-svg-flat/` — lightweight non-destructive IR bundles published by `pptx_template_import.py` for Type A input or created by the standalone `svg_authoring_view.py` migration path; each contains editable SVGs, model-readable `authoring_summary.json`, and tool-only `authoring_manifest.json`- optional screenshots for visual cross-checkingPPTX import interpretation:@@ -465,7 +465,7 @@ Use clear placeholder markers for replaceable content:This is the **default vocabulary** used across template packages. Newly created templates SHOULD prefer these names so downstream projects find familiar slots; designers MAY substitute or extend them when a style genuinely needs different vocabulary (e.g. consulting decks lead with `{{KEY_MESSAGE}}` instead of `{{PAGE_TITLE}}`; a brand cover may need `{{BRAND_LOGO}}`).-`svg_quality_checker.py --template-mode` emits **advisory warnings** when a page lacks the conventional placeholder for its type. To silence those warnings — and document the template's actual contract — declare a `placeholders:` map in `<design_spec_path>` frontmatter:+`svg_quality_checker.py --template-mode --canonical-authoring` emits **advisory warnings** when a page lacks the conventional placeholder for its type. To silence those warnings — and document the template's actual contract — declare a `placeholders:` map in `<design_spec_path>` frontmatter:```yamlplaceholders:diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex 2c240a21..4d3b65ca 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -118,22 +118,25 @@ python3 scripts/pptx_template_import.py <template.pptx> --manifest-onlypython3 scripts/pptx_template_import.py <template.pptx> --inheritance-mode bothpython3 scripts/svg_authoring_view.py <imported-svg-or-dir> -o <output-dir> --projection-kind layeredpython3 scripts/svg_authoring_view.py <authoring-dir> --refresh-summary-python3 scripts/compact_svg_coordinates.py <template_workspace>/templates --inplace --keep-native-frames-python3 scripts/compact_svg_styles.py <template_workspace>/templates --inplace+python3 scripts/svg_quality_checker.py <template_workspace>/templates --template-mode --canonical-authoringpython3 scripts/mirror_template_materialize.py <import_workspace> <template_workspace>python3 scripts/svg_to_pptx.py <import_workspace> --roundtrippython3 scripts/template_preview_pptx.py <template_workspace>python3 scripts/template_preview_pptx.py <legacy_template_workspace> --visual-only```-Template import defaults to the canonical layered `svg/` tree. Use+Template import defaults to the canonical layered `svg/` backing tree and+creates compact `authoring-svg/` in the same transaction. Use`--inheritance-mode both` only when a separate self-contained `svg-flat/`-verification tree is required. No derived narrative digest is generated-because `analysis/manifest.json` already owns those facts.--`svg_authoring_view.py` creates a lightweight, non-destructive editable IR-bundle from PPTX-imported SVGs. Recognized native shapes become one visible-geometry carrier plus at most one structured text body; recognized tables keep+verification tree plus `authoring-svg-flat/` is required. No derived narrative+digest is generated because `analysis/manifest.json` already owns those facts.++`pptx_template_import.py` creates the lightweight authoring bundle in the same+transaction as its immutable backing. `svg_authoring_view.py` remains the+standalone projection entry point for external SVG and migrations. Before the+transaction publishes, it also factors eligible non-semantic decoration into+`icons/imported/`. Recognized native shapes become one visible geometry carrier+plus at most one structured text body; recognized tables keepone compact semantic JSON payload plus a preview cache. The projection removesduplicate render geometry and import-only identity/payload attributes whileretaining text, images, stable ids, root Master/Layout markers, native-shape@@ -144,8 +147,8 @@ Relative local image references are rewritten so the projected copy stillrenders from its new location. The bundle's `authoring_summary.json` is themodel-readable current-file index; `authoring_manifest.json` recordssource/authoring hashes and object paths for tools without duplicating opaque-payload and does not enter model context. Unsupported opaque source objects may-become compact `native-restore` image proxies whose+payload and does not enter model context. Only unsupported, text-free,+schema-free source ornaments may become compact `native-restore` image proxies whosehashed SVG previews live under `images/source-object-previews/`. Unchangedproxies restore the original native PowerPoint objects; complete removal deletesa Slide-local source object, while inherited-proxy removal and any proxy or@@ -296,20 +299,19 @@ result remains editable freeform geometry but is no longer editable text. See[`references/native-shape-authoring.md`](../references/native-shape-authoring.md)§6 for the closed operand and failure contract.-Create-template/source normalization (optional; never part of automatic export):+External-source migration and explicit picture normalization:```bashpython3 scripts/extract_svg_assets.py <layered_svg_dir> --icons-dir <icons_dir> --icon-namespace imported --inplace --id-prefix layeredpython3 scripts/extract_svg_assets.py <flat_svg_dir> --icons-dir <icons_dir> --icon-namespace imported --reuse-inventory <layered_inventory.json> --inplace --id-prefix flatpython3 scripts/extract_svg_pictures.py "<svg_file>" --select "<group_id>" --resource-root "<workspace>" --images-dir "<picture_assets_dir>" --inplace # optional create-template normalization: one selected group -> one SVG picture-python3 scripts/compact_svg_coordinates.py <template_workspace>/templates --inplace --keep-native-frames-python3 scripts/compact_svg_styles.py <template_workspace>/templates --inplace+python3 scripts/svg_quality_checker.py <template_workspace>/templates --template-mode --canonical-authoringpython3 scripts/mirror_template_materialize.py <import_workspace> <template_workspace> # Type A mirror only; destination owns no roster```-Round-trip import runs the flat vector extraction automatically after creating-`authoring-svg-flat/`; the manual two-pass commands above remain the-create-template path.+PPTX template import and round-trip import run vector readability extraction in+their staging transaction before the first authoring bundle is published. The+manual extraction commands above are only for external SVG/migration input.`extract_svg_assets.py` extracts only non-semantic decoration. Any subtree thatcontains a semantic object, text, table, chart, relationship, or otherdiff --git a/skills/ppt-master/scripts/compact_svg_coordinates.py b/skills/ppt-master/scripts/compact_svg_coordinates.pyindex cc3a5720..efc66e25 100644--- a/skills/ppt-master/scripts/compact_svg_coordinates.py+++ b/skills/ppt-master/scripts/compact_svg_coordinates.py@@ -1,15 +1,16 @@#!/usr/bin/env python3"""-PPT Master - SVG Coordinate Compactor+PPT Master - Legacy SVG Coordinate Migration-Compact model-facing page-space SVG coordinates to at most two decimal places-without rounding normalized crop ratios or transform linear coefficients.+Diagnose or migrate older model-facing page-space SVG coordinates without+rounding normalized crop ratios or transform linear coefficients. New+authoring code calls the tree-level implementation before its first write.Usage:python3 scripts/compact_svg_coordinates.py <svg-file-or-directory> [--inplace]Examples:- python3 scripts/compact_svg_coordinates.py projects/example/templates --inplace+ python3 scripts/compact_svg_coordinates.py imported/legacy-templates --inplacepython3 scripts/compact_svg_coordinates.py imported/authoring-svgDependencies:@@ -246,8 +247,8 @@ def _write_atomic(path: Path, payload: str) -> None:def build_parser() -> argparse.ArgumentParser:parser = argparse.ArgumentParser(description=(- "Compact safe page-space SVG coordinates to at most two decimal "- "places. Runs as a dry-run unless --inplace is supplied."+ "Diagnose or migrate older page-space SVG coordinates to at most "+ "two decimal places. Runs as a dry-run unless --inplace is supplied."),)parser.add_argument("input", type=Path, help="SVG file or directory")diff --git a/skills/ppt-master/scripts/compact_svg_styles.py b/skills/ppt-master/scripts/compact_svg_styles.pyindex d845f57f..a89eff5e 100644--- a/skills/ppt-master/scripts/compact_svg_styles.py+++ b/skills/ppt-master/scripts/compact_svg_styles.py@@ -1,10 +1,10 @@#!/usr/bin/env python3"""-PPT Master - SVG Inherited Style Compactor+PPT Master - Legacy SVG Inherited Style Migration-Normalize generated SVG authoring files to root/group defaults plus local-overrides. The compactor promotes one common page font to the SVG root and-removes presentation declarations that repeat an inherited value.+Diagnose or migrate older SVG authoring files to root/group defaults plus local+overrides. New authoring code calls the tree-level implementation before its+first write; the CLI is not a standard post-generation step.Usage:python3 scripts/compact_svg_styles.py <svg-file-or-directory> [--inplace]@@ -22,6 +22,7 @@ from __future__ import annotationsimport argparseimport jsonimport os+import reimport statimport sysimport tempfile@@ -49,6 +50,23 @@ _DEFINITION_SUBTREES = frozenset({"radialGradient","symbol",})+_UNSAFE_PRESENTATION_VALUE_TOKENS = (+ "!important",+ "var(",+)+_CSS_WIDE_VALUES = frozenset({+ "inherit",+ "initial",+ "revert",+ "revert-layer",+ "unset",+})+_CONTEXT_DEPENDENT_VALUES = frozenset({+ "context-fill",+ "context-stroke",+ "currentcolor",+})+_URL_FUNCTION_RE = re.compile(r"url\([^)]*\)", re.IGNORECASE)ET.register_namespace("", SVG_NS)@@ -59,6 +77,8 @@ class StyleCompactionStats:root_font_defaults: int = 0root_style_declarations_normalized: int = 0+ container_style_declarations_normalized: int = 0+ group_defaults_promoted: int = 0shadowed_attributes_removed: int = 0redundant_attributes_removed: int = 0redundant_style_declarations_removed: int = 0@@ -68,6 +88,8 @@ class StyleCompactionStats:return (self.root_font_defaults+ self.root_style_declarations_normalized+ + self.container_style_declarations_normalized+ + self.group_defaults_promoted+ self.shadowed_attributes_removed+ self.redundant_attributes_removed+ self.redundant_style_declarations_removed@@ -78,6 +100,10 @@ class StyleCompactionStats:self.root_style_declarations_normalized += (other.root_style_declarations_normalized)+ self.container_style_declarations_normalized += (+ other.container_style_declarations_normalized+ )+ self.group_defaults_promoted += other.group_defaults_promotedself.shadowed_attributes_removed += other.shadowed_attributes_removedself.redundant_attributes_removed += other.redundant_attributes_removedself.redundant_style_declarations_removed += (@@ -90,6 +116,10 @@ class StyleCompactionStats:"root_style_declarations_normalized": (self.root_style_declarations_normalized),+ "container_style_declarations_normalized": (+ self.container_style_declarations_normalized+ ),+ "group_defaults_promoted": self.group_defaults_promoted,"shadowed_attributes_removed": self.shadowed_attributes_removed,"redundant_attributes_removed": self.redundant_attributes_removed,"redundant_style_declarations_removed": (@@ -110,6 +140,32 @@ def _local_name(name: object) -> str:return name.rsplit("}", 1)[-1] if isinstance(name, str) else ""+def is_canonical_presentation_value(+ value: str,+ *,+ property_name: str | None = None,+) -> bool:+ """Return whether a value can move to a presentation attribute safely."""+ normalized = value.strip().lower()+ context_dependent = False+ if property_name in {"fill", "stroke"}:+ outside_urls = _URL_FUNCTION_RE.sub(" ", normalized)+ tokens = {+ token for token in re.split(r"[\s,]+", outside_urls)+ if token+ }+ context_dependent = bool(tokens & _CONTEXT_DEPENDENT_VALUES)+ return (+ bool(normalized)+ and normalized not in _CSS_WIDE_VALUES+ and not context_dependent+ and not any(+ token in normalized+ for token in _UNSAFE_PRESENTATION_VALUE_TOKENS+ )+ )++def _style_declarations(value: str | None) -> list[_StyleDeclaration] | None:if value is None:return []@@ -195,6 +251,11 @@ def _normalize_root_font_family(style_values = _style_values(declarations)style_family = style_values.get("font-family")if style_family is not None:+ if not is_canonical_presentation_value(+ style_family,+ property_name="font-family",+ ):+ returnroot.set("font-family", style_family)retained = [item for item in declarations@@ -212,20 +273,15 @@ def _normalize_root_font_family(for child in parent}- def inside_definition(element: ET.Element) -> bool:- current = parents.get(element)- while current is not None:- if _local_name(current.tag) in _DEFINITION_SUBTREES:- return True- current = parents.get(current)- return False-+ # Include definition text conservatively. A local <use> can make it+ # visible, and promoting a font while ignoring that text could change its+ # inherited rendering. Unused definitions are pruned by import projection;+ # legacy migration prefers no promotion over a visual change.text_elements = [elementfor element in root.iter()if _local_name(element.tag) == "text"and "".join(element.itertext()).strip()- and not inside_definition(element)]if not text_elements:return@@ -250,6 +306,98 @@ def _normalize_root_font_family(stats.root_font_defaults += 1+def _normalize_container_inherited_styles(+ root: ET.Element,+ stats: StyleCompactionStats,+) -> None:+ """Spell inherited root/group defaults as presentation attributes."""+ for element in root.iter():+ if _local_name(element.tag) not in {"svg", "g"}:+ continue+ declarations = _style_declarations(element.get("style"))+ if declarations is None:+ continue+ retained: list[_StyleDeclaration] = []+ for declaration in declarations:+ if (+ declaration.name not in INHERITABLE_ATTRIBUTES+ or not is_canonical_presentation_value(+ declaration.value,+ property_name=declaration.name,+ )+ ):+ retained.append(declaration)+ continue+ element.set(declaration.name, declaration.value)+ stats.container_style_declarations_normalized += 1+ _write_style(element, retained)+++def _promote_common_group_defaults(+ element: ET.Element,+ stats: StyleCompactionStats,+) -> None:+ """Factor proven direct-child repetition into an existing SVG group."""+ if _local_name(element.tag) in _DEFINITION_SUBTREES:+ return+ for child in element:+ _promote_common_group_defaults(child, stats)+ if _local_name(element.tag) != "g":+ return++ children = [+ child for child in element+ if isinstance(child.tag, str)+ and _local_name(child.tag) not in {+ "desc",+ "metadata",+ "title",+ }+ ]+ if len(children) < 2:+ return++ element_styles = _style_declarations(element.get("style"))+ if element_styles is None:+ return+ element_style_values = _style_values(element_styles)+ for name in INHERITABLE_ATTRIBUTES:+ if element.get(name) is not None or name in element_style_values:+ continue+ declarations_by_child: list[list[_StyleDeclaration]] = []+ values: list[str] = []+ for child in children:+ declarations = _style_declarations(child.get("style"))+ if declarations is None:+ break+ declarations_by_child.append(declarations)+ value = _style_values(declarations).get(name)+ if value is None:+ value = child.get(name)+ if value is None or not is_canonical_presentation_value(+ value,+ property_name=name,+ ):+ break+ values.append(value)+ if len(values) != len(children) or len(set(values)) != 1:+ continue++ element.set(name, values[0])+ stats.group_defaults_promoted += 1+ for child, declarations in zip(children, declarations_by_child):+ removed_style = sum(item.name == name for item in declarations)+ if removed_style:+ _write_style(+ child,+ [item for item in declarations if item.name != name],+ )+ stats.redundant_style_declarations_removed += removed_style+ if child.get(name) is not None:+ child.attrib.pop(name, None)+ stats.redundant_attributes_removed += 1++def _remove_redundant_inherited_styles(element: ET.Element,inherited: dict[str, str],@@ -271,7 +419,13 @@ def _remove_redundant_inherited_styles(if attribute_value is not None:element.attrib.pop(name, None)stats.shadowed_attributes_removed += 1- if style_value == inherited.get(name):+ if (+ style_value == inherited.get(name)+ and is_canonical_presentation_value(+ style_value,+ property_name=name,+ )+ ):remove_style_names.add(name)stats.redundant_style_declarations_removed += sum(item.name == name for item in declarations@@ -281,7 +435,13 @@ def _remove_redundant_inherited_styles(continueif attribute_value is None:continue- if attribute_value == inherited.get(name):+ if (+ attribute_value == inherited.get(name)+ and is_canonical_presentation_value(+ attribute_value,+ property_name=name,+ )+ ):element.attrib.pop(name, None)stats.redundant_attributes_removed += 1else:@@ -304,7 +464,9 @@ def compact_svg_style_tree(root: ET.Element) -> StyleCompactionStats:if _local_name(root.tag) != "svg":raise ValueError("Style compaction requires an SVG root element")stats = StyleCompactionStats()+ _normalize_container_inherited_styles(root, stats)_normalize_root_font_family(root, stats)+ _promote_common_group_defaults(root, stats)_remove_redundant_inherited_styles(root, {}, stats)return stats@@ -361,8 +523,8 @@ def _write_atomic(path: Path, payload: bytes) -> None:def build_parser() -> argparse.ArgumentParser:parser = argparse.ArgumentParser(description=(- "Promote a common page font and remove redundant inherited SVG "- "presentation declarations."+ "Diagnose or migrate older SVG by promoting a common page font "+ "and removing redundant inherited presentation declarations."),)parser.add_argument("input", type=Path, help="SVG file or directory")diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.mdindex ecc4f5bb..3a79164d 100644--- a/skills/ppt-master/scripts/docs/svg-pipeline.md+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md@@ -48,13 +48,14 @@ The projected copy:- compacts model-facing coordinates, promotes a common page font to the root,and removes descendant presentation declarations equal to inherited values.-Round-trip publication applies two object-level compactions after projection:+PPTX authoring publication applies two object-level reductions inside its+staging transaction, before the editable bundle first appears:- non-semantic vector decorations that cross the readability threshold maymove to `icons/imported/*.svg`; the asset, placeholder, and v2 inventory alldeclare the fixed `decoration` role. Any subtree containing semanticauthoring content remains inline;-- unsupported opaque source objects that do not yet have a closed semantic IR+- unsupported, text-free, schema-free source ornaments with no semantic markermay become`<image data-pptx-source-proxy="native-restore">` references whose hashed SVGpreviews live under `images/source-object-previews/`.@@ -79,7 +80,9 @@ The layered authoring bundle remains the editable source for template creation;the complete imported SVG remains immutable native-payload backing. Final`templates/*.svg` files are materialized and validated from that pair. Acomplete-page `authoring-svg-flat/` bundle is the user's editable source for an-imported-deck round-trip. `pptx_to_svg.py --roundtrip` places image media in+imported-deck round-trip. `pptx_template_import.py` publishes its compact+layered authoring bundle and decoration inventory in the same transaction as+its immutable backing. `pptx_to_svg.py --roundtrip` places image media in`images/`, decoration-only vectors in `icons/imported/`, cues/audio/video/notes in their nameddirectories, opaque payloads in `native-payloads/`, the source package in`sources/`, and tool-owned backing/contracts in `analysis/`; `assets/` is@@ -361,10 +364,8 @@ python3 scripts/compact_svg_coordinates.py <template-directory> \```The default run is a dry-run JSON report. `--inplace` atomically replaces only-changed SVG files. The shared create-template final pass uses-`--keep-native-frames`: it compacts `data-pptx-bounds`, translation values,-rotation centers, and-matrix `e/f`, while preserving canonical+changed legacy SVG files. `--keep-native-frames` compacts `data-pptx-bounds`,+translation values, rotation centers, and matrix `e/f`, while preserving canonicalauthored-preset or inline native frames. `svg_authoring_view.py` separatelycompacts imported model-facing frames because unchanged mirror refs can recovertheir exact coordinates from immutable lossless backing.@@ -372,13 +373,13 @@ their exact coordinates from immutable lossless backing.The compactor never rounds path/points geometry, normalized crop or nested`viewBox` ratios, gradient offsets, opacity, scale arguments, rotation angles,or matrix `a/b/c/d` coefficients. Type A mirror materialization invokes the-same compactor before native-record externalization; `standard` and `fidelity`-use the shared final pass before template validation.+same tree-level implementation before its first write. The CLI is a migration+and diagnostic tool; standard authoring is checked read-only.## `compact_svg_styles.py`-Normalize generated authoring SVG to shared root/group defaults plus local-overrides:+Diagnose or migrate older authoring SVG to shared root/group defaults plus+local overrides:```bashpython3 scripts/compact_svg_styles.py <svg-file-or-directory>@@ -393,12 +394,13 @@ exceptions. The same pass removes any supported inheritable presentationattribute or inline declaration that exactly repeats its effective parentvalue; it never invents a paint, size, weight, or other non-font default.-Default Generate runs it before the first-page and final checks, Quick runs it-before its final check, and Create Template runs it before structured-template-validation. PPTX import projections and mirror materialization call the same-tree-level implementation directly. SVG-to-PPTX continues to accept valid-explicit declarations; this is the canonical generated-authoring form, not a-compatibility restriction on external SVG input.+PPTX import projections and mirror materialization call the same tree-level+implementation before publishing their authoring SVG. Standard workflows do+not rewrite completed SVG: they pass `--canonical-authoring` to+`svg_quality_checker.py`, which reports any remaining deterministic change as a+blocking error. SVG-to-PPTX continues to accept valid explicit declarations;+canonical compact authoring is a generated-source contract, not a compatibility+restriction on external SVG input.## `extract_svg_assets.py`@@ -415,11 +417,12 @@ python3 scripts/extract_svg_assets.py <flat_svg_dir> \--inplace --id-prefix flat```-`pptx_to_svg.py --roundtrip` invokes the same extractor automatically for-`authoring-svg-flat/` after source-proxy projection. It uses the imported-namespace and records the thresholds in the adjacent vector inventory so-`svg_to_pptx.py --roundtrip` can regenerate the same baseline before comparing-edits.+`pptx_template_import.py` and `pptx_to_svg.py --roundtrip` invoke the same+extractor automatically inside their staging transactions. They use the+imported namespace and record thresholds in the adjacent vector inventory so+template materialization and round-trip export can regenerate the same+baseline before comparing edits. The CLI form is for external SVG and legacy+migration input, not a standard post-generation rewrite.The first pass records a source fingerprint before namespacing each extractedasset's internal ids. The second pass reuses a fingerprint-matched asset and@@ -827,6 +830,7 @@ python3 scripts/svg_quality_checker.py projects/project/svg_outputpython3 scripts/svg_quality_checker.py projects/projectpython3 scripts/svg_quality_checker.py projects/project --stage first-pagepython3 scripts/svg_quality_checker.py projects/project --stage final --json+python3 scripts/svg_quality_checker.py projects/project --canonical-authoring --stage final --jsonpython3 scripts/svg_quality_checker.py projects/project --format ppt169python3 scripts/svg_quality_checker.py --all projectspython3 scripts/svg_quality_checker.py projects/project --exportdiff --git a/skills/ppt-master/scripts/extract_svg_assets.py b/skills/ppt-master/scripts/extract_svg_assets.pyindex 6373050e..6bc3be5d 100644--- a/skills/ppt-master/scripts/extract_svg_assets.py+++ b/skills/ppt-master/scripts/extract_svg_assets.py@@ -55,12 +55,24 @@ from svg_authoring_view import (SEMANTIC_OBJECT_ATTRIBUTE,write_authoring_summary,)+from svg_authoring_contract import normalize_compact_authoring_treeconfigure_utf8_stdio()SVG_NS = "http://www.w3.org/2000/svg"DRAWABLE = {"path", "polygon", "polyline", "rect", "circle", "ellipse", "line"}SEMANTIC_CONTENT = {"text", "tspan", "foreignObject"}+SEMANTIC_MARKER_ATTRIBUTES = {+ "data-pptx-carrier",+ "data-pptx-inline-formula",+ "data-pptx-layer",+ "data-pptx-page-role",+ "data-pptx-placeholder",+ "data-pptx-replace-with",+ "data-pptx-role",+ "data-pptx-shape-hyperlink",+ SEMANTIC_OBJECT_ATTRIBUTE,+}DEFINITION_CONTAINERS = {"defs"}DEFAULT_MIN_DRAWABLES = 20DEFAULT_MIN_BYTES = 3000@@ -102,9 +114,15 @@ def _has_semantic_content(elem: ET.Element) -> bool:def _has_semantic_object(elem: ET.Element) -> bool:"""Semantic authoring objects must never move into imported decoration."""- return any(- item.get(SEMANTIC_OBJECT_ATTRIBUTE) is not None- for item in elem.iter()+ return any(_is_semantic_owner(item) for item in elem.iter())+++def _is_semantic_owner(elem: ET.Element) -> bool:+ if any(elem.get(name) is not None for name in SEMANTIC_MARKER_ATTRIBUTES):+ return True+ return (+ _local(elem.tag) == "metadata"+ and elem.get("type") == "application/json")@@ -350,7 +368,7 @@ def _find_extractable(root: ET.Element, min_drawables: int, min_bytes: int) -> ldef walk(elem: ET.Element) -> None:if (_local(elem.tag) in DEFINITION_CONTAINERS- or elem.get(SEMANTIC_OBJECT_ATTRIBUTE) is not None+ or _is_semantic_owner(elem)):returnfor child in list(elem):@@ -398,7 +416,7 @@ def _find_extractable_runs(def walk(elem: ET.Element) -> None:if (_local(elem.tag) in DEFINITION_CONTAINERS- or elem.get(SEMANTIC_OBJECT_ATTRIBUTE) is not None+ or _is_semantic_owner(elem)):returnrun: list[ET.Element] = []@@ -448,6 +466,7 @@ def _asset_svg(for dependency in dependencies:defs.append(dependency)svg.append(group)+ normalize_compact_authoring_tree(svg)return ET.tostring(svg, encoding="utf-8", xml_declaration=True)@@ -746,6 +765,20 @@ def _fresh_native_fallback_markers(root: ET.Element) -> set[ET.Element]:return fresh+def _normalize_authoring_tree(+ root: ET.Element,+ fresh_native_markers: set[ET.Element],+) -> None:+ """Normalize first, then hash the final visible native fallbacks."""+ normalize_compact_authoring_tree(root)+ live_elements = set(root.iter())+ for marker in fresh_native_markers & live_elements:+ marker.set(+ NATIVE_FALLBACK_SHA256_ATTR,+ svg_native_fallback_fingerprint(marker, document_root=root),+ )++def extract_file(svg_path: Path,icons_dir: Path,@@ -773,6 +806,7 @@ def extract_file(# progressively factoring their remaining parent/sibling geometry.if _has_namespace_placeholder(root, icon_namespace):if definitions_changed or not inplace:+ _normalize_authoring_tree(root, fresh_native_markers)rewritten = _rewritten_path(svg_path, rewritten_dir, inplace)rewritten.parent.mkdir(parents=True, exist_ok=True)tree.write(rewritten, encoding="utf-8", xml_declaration=True)@@ -807,6 +841,7 @@ def extract_file(if not targets:if definitions_changed or not inplace:+ _normalize_authoring_tree(root, fresh_native_markers)rewritten = _rewritten_path(svg_path, rewritten_dir, inplace)rewritten.parent.mkdir(parents=True, exist_ok=True)tree.write(rewritten, encoding="utf-8", xml_declaration=True)@@ -910,12 +945,7 @@ def extract_file(})_optimize_definitions(root)- live_elements = set(root.iter())- for marker in fresh_native_markers & live_elements:- marker.set(- NATIVE_FALLBACK_SHA256_ATTR,- svg_native_fallback_fingerprint(marker, document_root=root),- )+ _normalize_authoring_tree(root, fresh_native_markers)rewritten = _rewritten_path(svg_path, rewritten_dir, inplace)rewritten.parent.mkdir(parents=True, exist_ok=True)tree.write(rewritten, encoding="utf-8", xml_declaration=True)diff --git a/skills/ppt-master/scripts/mirror_template_materialize.py b/skills/ppt-master/scripts/mirror_template_materialize.pyindex 2fdd8acb..547e3b71 100644--- a/skills/ppt-master/scripts/mirror_template_materialize.py+++ b/skills/ppt-master/scripts/mirror_template_materialize.py@@ -133,6 +133,24 @@ _INHERITED_PRESENTATION_ATTRIBUTES = frozenset({"text-decoration","word-spacing",})+_ROOT_TYPOGRAPHY_ATTRIBUTES = (+ "font-family",+ "font-size",+ "font-style",+ "font-weight",+ "letter-spacing",+ "text-anchor",+ "text-decoration",+ "word-spacing",+)+_TEXT_PRESENTATION_ATTRIBUTES = frozenset(_ROOT_TYPOGRAPHY_ATTRIBUTES)+_TEXT_PRESENTATION_CONTAINERS = frozenset({+ "a",+ "g",+ "svg",+ "text",+ "tspan",+})_AGGREGATE_GROUP_ATTRIBUTES = frozenset({"clip-path","filter",@@ -1460,15 +1478,29 @@ def _visible_leaf(element: ET.Element) -> bool:def _merge_group_inheritance(parent: ET.Element, child: ET.Element) -> None:+ child_tag = _local_name(child.tag)for name in _INHERITED_PRESENTATION_ATTRIBUTES:+ if (+ name in _TEXT_PRESENTATION_ATTRIBUTES+ and child_tag not in _TEXT_PRESENTATION_CONTAINERS+ ):+ continueif parent.get(name) is not None and child.get(name) is None:child.set(name, parent.get(name, ""))parent_style = _parse_style(parent.get("style"))child_style = _parse_style(child.get("style"))if parent_style:- merged = dict(parent_style)+ merged = {+ name: value+ for name, value in parent_style.items()+ if (+ name not in _TEXT_PRESENTATION_ATTRIBUTES+ or child_tag in _TEXT_PRESENTATION_CONTAINERS+ )+ }merged.update(child_style)- child.set("style", _style_text(merged))+ if merged:+ child.set("style", _style_text(merged))parent_transform = (parent.get("transform") or "").strip()child_transform = (child.get("transform") or "").strip()if parent_transform:@@ -1559,13 +1591,15 @@ def _fixed_atoms(continueif not _visible_leaf(child):continue+ item = copy.deepcopy(child)+ _merge_group_inheritance(root, item)if tag == "g":expanded = _flatten_fixed_group(- child,+ item,context=f"{scope} {key} element {child.get('id') or '<g>'}",)else:- expanded = [copy.deepcopy(child)]+ expanded = [item]expanded = _flatten_fixed_text_atoms(expanded)source_ref = child.get(SOURCE_REF_ATTRIBUTE)source_token = source_ref.split(":", 1)[-1] if source_ref else str(serial + 1)@@ -2387,6 +2421,18 @@ def _compose_template(},)+ typography_roots = [+ candidate+ for candidate in (master_root, layout_root, slide_root)+ if candidate is not None+ ]+ for name in _ROOT_TYPOGRAPHY_ATTRIBUTES:+ for candidate in typography_roots:+ value = candidate.get(name)+ if value is not None:+ root.set(name, value)+ break+roots = [master_root, layout_root]if slide_root is not None:roots.append(slide_root)@@ -2427,9 +2473,12 @@ def _compose_template(continuesource_ref = child.get(SOURCE_REF_ATTRIBUTE)if source_ref in placeholder_refs:- source_placeholder_elements[source_ref] = child+ item = copy.deepcopy(child)+ _merge_group_inheritance(slide_root, item)+ source_placeholder_elements[source_ref] = itemcontinueitem = copy.deepcopy(child)+ _merge_group_inheritance(slide_root, item)if _is_full_canvas_rect(item, width, height):item.set("id", item.get("id") or f"slide-{slide['index']}-background")item.set("data-pptx-layer", "slide")diff --git a/skills/ppt-master/scripts/pptx_template_import.py b/skills/ppt-master/scripts/pptx_template_import.pyindex 4deb3ba0..017a84f8 100644--- a/skills/ppt-master/scripts/pptx_template_import.py+++ b/skills/ppt-master/scripts/pptx_template_import.py@@ -32,6 +32,8 @@ from zipfile import BadZipFilefrom console_encoding import configure_utf8_stdiofrom pptx_workspace import (+ AUTHORING_SVG_DIR,+ AUTHORING_SVG_FLAT_DIR,CONVERSION_REPORT_PATH,TEMPLATE_MANIFEST_PATH,reject_removed_workspace_layout,@@ -50,6 +52,53 @@ _MANIFEST_NAME = TEMPLATE_MANIFEST_PATH.as_posix()_CONVERSION_REPORT_NAME = CONVERSION_REPORT_PATH.as_posix()+def _project_authoring_directory(+ staged_dir: Path,+ *,+ source_dir: Path,+ output_dir: Path,+ projection_kind: str,+ id_prefix: str,+ reuse_inventory_path: Path | None = None,+) -> int:+ """Create one compact, readable authoring bundle in the transaction."""+ from extract_svg_assets import extract_directory+ from svg_authoring_view import project_svg_batch++ source_root = staged_dir / source_dir+ authoring_root = staged_dir / output_dir+ sources = sorted(source_root.rglob("*.svg"))+ if not sources:+ raise ValueError(f"No SVG files found under {source_root}")+ mapping = [+ (source, authoring_root / source.relative_to(source_root))+ for source in sources+ ]+ reports = project_svg_batch(+ mapping,+ source_root,+ authoring_root,+ force=False,+ projection_kind=projection_kind,+ source_proxy_dir=(+ staged_dir / "images" / "source-object-previews"+ ),+ )+ extract_directory(+ authoring_root,+ staged_dir / "icons",+ "imported",+ min_decoration_bytes=3000,+ inplace=True,+ id_prefix=id_prefix,+ inventory_path=(+ staged_dir / f"{output_dir.name}_vector_asset_inventory.json"+ ),+ reuse_inventory_path=reuse_inventory_path,+ )+ return len(reports)++def parse_args() -> argparse.Namespace:"""Build the CLI argument parser for the import entry point."""parser = argparse.ArgumentParser(@@ -211,6 +260,8 @@ def main() -> int:result = Nonetotal_bytes = 0+ authoring_files = 0+ flat_authoring_files = 0if not args.manifest_only:from pptx_to_svg import convert_pptx_to_svgfrom pptx_to_svg.converter import ConvertOptions@@ -234,6 +285,31 @@ def main() -> int:len(art.svg.encode("utf-8"))for art in result.slides)+ try:+ authoring_files = _project_authoring_directory(+ staged_dir,+ source_dir=Path("svg"),+ output_dir=AUTHORING_SVG_DIR,+ projection_kind=(+ "flat" if args.inheritance_mode == "flat" else "layered"+ ),+ id_prefix="layered",+ )+ if args.inheritance_mode == "both":+ flat_authoring_files = _project_authoring_directory(+ staged_dir,+ source_dir=Path("svg-flat"),+ output_dir=AUTHORING_SVG_FLAT_DIR,+ projection_kind="flat",+ id_prefix="flat",+ reuse_inventory_path=(+ staged_dir+ / f"{AUTHORING_SVG_DIR.name}_vector_asset_inventory.json"+ ),+ )+ except (ET.ParseError, OSError, RuntimeError, ValueError) as exc:+ print(f"Error: failed to create compact authoring SVG: {exc}")+ return 1from pptx_to_svg.converter import publish_staged_workspace@@ -274,12 +350,21 @@ def main() -> int:print(f"Inheritance mode: {args.inheritance_mode}")print(f"Exported SVG slides: {len(result.slides)}")+ print(+ f"Compact authoring files: {authoring_files} "+ f"({AUTHORING_SVG_DIR}/)"+ )if args.inheritance_mode in {"layered", "both"}:print(f"Exported masters: {len(result.masters)}")print(f"Exported layouts: {len(result.layouts)}")print("Inheritance graph: svg/inheritance.json")if result.flat_slides:print(f"Flat companion slides: {len(result.flat_slides)} (svg-flat/)")+ if flat_authoring_files:+ print(+ f"Flat compact authoring files: {flat_authoring_files} "+ f"({AUTHORING_SVG_FLAT_DIR}/)"+ )if result.diagnostics:print(f"Source recovery warnings: {len(result.diagnostics)} "diff --git a/skills/ppt-master/scripts/pptx_to_svg/converter.py b/skills/ppt-master/scripts/pptx_to_svg/converter.pyindex 51ca376c..dc452bff 100644--- a/skills/ppt-master/scripts/pptx_to_svg/converter.py+++ b/skills/ppt-master/scripts/pptx_to_svg/converter.py@@ -37,6 +37,7 @@ from pptx_embedded_fonts import (write_embedded_font_bundle,)from pptx_workspace import (+ AUTHORING_SVG_DIR,AUTHORING_SVG_FLAT_DIR,CONVERSION_REPORT_PATH,NATIVE_STRUCTURE_PATH,@@ -925,6 +926,7 @@ def _managed_svg_paths(output_dir: Path) -> list[Path]:(Path("svg-flat"), _MANAGED_FLAT_SVG_RE, False),(ROUNDTRIP_LAYERED_SVG_DIR, _MANAGED_PRIMARY_SVG_RE, True),(ROUNDTRIP_FLAT_SVG_DIR, _MANAGED_FLAT_SVG_RE, False),+ (AUTHORING_SVG_DIR, _MANAGED_PRIMARY_SVG_RE, False),(AUTHORING_SVG_FLAT_DIR, _MANAGED_FLAT_SVG_RE, False),):svg_dir = output_dir / relative_dir@@ -942,7 +944,7 @@ def _managed_svg_paths(output_dir: Path) -> list[Path]:inheritance = svg_dir / "inheritance.json"if carries_inheritance and _path_lexists(inheritance):managed.append(inheritance)- if relative_dir == AUTHORING_SVG_FLAT_DIR:+ if relative_dir in {AUTHORING_SVG_DIR, AUTHORING_SVG_FLAT_DIR}:for filename in ("authoring_manifest.json","authoring_summary.json",@@ -953,6 +955,66 @@ def _managed_svg_paths(output_dir: Path) -> list[Path]:return managed+def _managed_vector_asset_paths(output_dir: Path) -> set[Path]:+ """Return the previous converter-owned decoration inventory and assets."""+ managed: set[Path] = set()+ for authoring_dir in (AUTHORING_SVG_DIR, AUTHORING_SVG_FLAT_DIR):+ inventory_path = (+ output_dir / f"{authoring_dir.name}_vector_asset_inventory.json"+ )+ if not _path_lexists(inventory_path):+ continue+ managed.add(inventory_path)+ if inventory_path.is_symlink() or not inventory_path.is_file():+ continue+ try:+ payload = json.loads(inventory_path.read_text(encoding="utf-8"))+ except (OSError, UnicodeError, json.JSONDecodeError):+ continue+ icons_dir_value = (+ payload.get("icons_dir") if isinstance(payload, dict) else None+ )+ icons_dir = (+ Path(icons_dir_value)+ if isinstance(icons_dir_value, str) and icons_dir_value+ else Path("icons")+ )+ if (+ icons_dir.drive+ or icons_dir.anchor+ or icons_dir.is_absolute()+ or ".." in icons_dir.parts+ ):+ continue+ assets = payload.get("assets") if isinstance(payload, dict) else None+ if not isinstance(assets, list):+ continue+ for item in assets:+ value = item.get("asset") if isinstance(item, dict) else None+ if not isinstance(value, str):+ continue+ asset_path = Path(value)+ if (+ asset_path.drive+ or asset_path.anchor+ or asset_path.is_absolute()+ or ".." in asset_path.parts+ or not asset_path.parts+ ):+ continue+ path = (+ asset_path+ if asset_path.parts[0] == "icons"+ else icons_dir / asset_path+ )+ if not path.parts or path.parts[0] != "icons":+ continue+ target = output_dir / path+ if _path_lexists(target):+ managed.add(target)+ return managed++def _managed_report_artifact_paths(output_dir: Path) -> set[Path]:"""Return optional artifacts owned by the previous conversion report."""report_path = conversion_report_path(output_dir)@@ -1231,6 +1293,10 @@ def publish_staged_workspace(path.relative_to(output_dir)for path in managed_svg}+ relative_paths.update(+ path.relative_to(output_dir)+ for path in _managed_vector_asset_paths(output_dir)+ )relative_paths.update(_referenced_local_paths(output_dir, managed_svg))relative_paths.add(CONVERSION_REPORT_PATH)relative_paths.update(_managed_report_artifact_paths(output_dir))diff --git a/skills/ppt-master/scripts/pptx_workspace.py b/skills/ppt-master/scripts/pptx_workspace.pyindex c2dbff86..d0380402 100644--- a/skills/ppt-master/scripts/pptx_workspace.py+++ b/skills/ppt-master/scripts/pptx_workspace.py@@ -35,6 +35,7 @@ ROUNDTRIP_MANIFEST_PATH = Path("analysis/roundtrip_manifest.json")TEMPLATE_MANIFEST_PATH = Path("analysis/manifest.json")CONVERSION_REPORT_PATH = Path("validation/conversion-report.json")AUTHORING_SVG_FLAT_DIR = Path("authoring-svg-flat")+AUTHORING_SVG_DIR = Path("authoring-svg")ROUNDTRIP_SVG_ROOT = Path("analysis/roundtrip-svg")ROUNDTRIP_LAYERED_SVG_DIR = ROUNDTRIP_SVG_ROOT / "layered"ROUNDTRIP_FLAT_SVG_DIR = ROUNDTRIP_SVG_ROOT / "flat"diff --git a/skills/ppt-master/scripts/resource_paths.py b/skills/ppt-master/scripts/resource_paths.pyindex a0cdabc0..00fe7a26 100644--- a/skills/ppt-master/scripts/resource_paths.py+++ b/skills/ppt-master/scripts/resource_paths.py@@ -37,6 +37,9 @@ SVG_WORK_DIR_NAMES = frozenset({SVG_FINAL_CANDIDATE_PREFIX = '.svg_final.candidate-'TEMPLATE_SOURCE_DIR_NAME = 'templates'TEMPLATE_SPEC_FILENAME = 'design_spec.md'+_TEMPLATE_QUALIFIED_SPEC_RE = re.compile(+ r'design_spec\.(?:brand|style|layout|deck)\.[^/\\]+\.md'+)_SVG_NAMESPACE = 'http://www.w3.org/2000/svg'_SVG_URL_REFERENCE_RE = re.compile(r'url\(\s*([^)]+?)\s*\)', re.IGNORECASE)_SVG_CSS_URL_ATTRIBUTES = frozenset({@@ -78,7 +81,14 @@ def project_root_for_svg_path(svg_path: Path) -> Path:return base.parentif (base.name == TEMPLATE_SOURCE_DIR_NAME- and (base / TEMPLATE_SPEC_FILENAME).is_file()+ and (+ (base / TEMPLATE_SPEC_FILENAME).is_file()+ or any(+ path.is_file()+ and _TEMPLATE_QUALIFIED_SPEC_RE.fullmatch(path.name)+ for path in base.glob('design_spec.*.md')+ )+ )):return base.parentreturn basediff --git a/skills/ppt-master/scripts/svg_authoring_contract.py b/skills/ppt-master/scripts/svg_authoring_contract.pynew file mode 100644index 00000000..5cac93eb--- /dev/null+++ b/skills/ppt-master/scripts/svg_authoring_contract.py@@ -0,0 +1,399 @@+#!/usr/bin/env python3+"""Canonical compact SVG authoring contract.++The contract keeps authoring SVG as valid, readable XML. It removes only+provably redundant inherited declarations and safely canonicalizes page-space+metadata; it never encodes geometry or invents semantic grouping.+"""++from __future__ import annotations++import copy+from dataclasses import dataclass+from xml.etree import ElementTree as ET++from compact_svg_coordinates import (+ CoordinateCompactionStats,+ compact_svg_tree,+)+from compact_svg_styles import (+ INHERITABLE_ATTRIBUTES,+ StyleCompactionStats,+ compact_svg_style_tree,+ is_canonical_presentation_value,+)+++_DEFINITION_SUBTREES = frozenset({+ "clipPath",+ "defs",+ "filter",+ "linearGradient",+ "marker",+ "mask",+ "pattern",+ "radialGradient",+ "symbol",+})+_ROOT_PAINT_ATTRIBUTES = frozenset({+ "clip-path",+ "color",+ "fill",+ "fill-opacity",+ "fill-rule",+ "marker-end",+ "marker-mid",+ "marker-start",+ "mask",+ "opacity",+ "paint-order",+ "filter",+ "stroke",+ "stroke-dasharray",+ "stroke-linecap",+ "stroke-linejoin",+ "stroke-opacity",+ "stroke-width",+})+_SVG_NAMESPACE = "http://www.w3.org/2000/svg"+_COORDINATE_ATTRIBUTES = frozenset({+ "data-pptx-bounds",+ "data-pptx-frame",+ "transform",+})+++def _local_name(name: object) -> str:+ return name.rsplit("}", 1)[-1] if isinstance(name, str) else ""+++def _namespace(name: object) -> str | None:+ if not isinstance(name, str) or not name.startswith("{"):+ return None+ return name[1:].split("}", 1)[0]+++def _style_names(value: str | None) -> set[str]:+ if not value:+ return set()+ names: set[str] = set()+ for declaration in value.split(";"):+ if ":" not in declaration:+ continue+ name, _raw_value = declaration.split(":", 1)+ normalized = name.strip().lower()+ if normalized:+ names.add(normalized)+ return names+++def _style_value(value: str | None, name: str) -> str | None:+ if not value:+ return None+ resolved: str | None = None+ for declaration in value.split(";"):+ if ":" not in declaration:+ continue+ raw_name, raw_value = declaration.split(":", 1)+ if raw_name.strip().lower() == name:+ resolved = raw_value.strip().lower()+ return resolved+++def _href_target(element: ET.Element) -> str | None:+ for name, value in element.attrib.items():+ if _local_name(name) == "href" and value.startswith("#"):+ return value[1:]+ return None+++def _svg_namespace_errors(root: ET.Element) -> list[str]:+ errors: list[str] = []++ def visit(+ element: ET.Element,+ inside_metadata: bool,+ *,+ is_root: bool = False,+ ) -> None:+ if not isinstance(element.tag, str):+ return+ local = _local_name(element.tag)+ nested_metadata = inside_metadata or local == "metadata"+ if (+ not is_root+ and not inside_metadata+ and _namespace(element.tag) != _SVG_NAMESPACE+ ):+ errors.append(+ f"SVG element <{local}> exits the standard SVG namespace"+ )+ for child in element:+ visit(child, nested_metadata)++ visit(root, False, is_root=True)+ return errors+++def _attribute_change_examples(+ before: ET.Element,+ after: ET.Element,+ *,+ coordinate_changes: bool,+ limit: int = 3,+) -> list[str]:+ examples: list[str] = []+ for index, (source, candidate) in enumerate(+ zip(before.iter(), after.iter()),+ start=1,+ ):+ if not isinstance(source.tag, str):+ continue+ names = sorted(set(source.attrib) | set(candidate.attrib))+ for name in names:+ is_coordinate = name in _COORDINATE_ATTRIBUTES+ if is_coordinate != coordinate_changes:+ continue+ old = source.get(name)+ new = candidate.get(name)+ if old == new:+ continue+ label = source.get("id") or f"{_local_name(source.tag)}[{index}]"+ examples.append(+ f"{label}:{name} {old!r} -> {new!r}"+ )+ if len(examples) == limit:+ return examples+ return examples+++def _has_visible_text(root: ET.Element) -> bool:+ elements_by_id = {+ element_id: element+ for element in root.iter()+ if (element_id := element.get("id"))+ }++ def visit(+ element: ET.Element,+ *,+ inside_definition: bool,+ activated_reference: bool,+ display_hidden: bool,+ visibility: str,+ use_stack: frozenset[str],+ ) -> bool:+ local = _local_name(element.tag)+ display = _style_value(element.get("style"), "display")+ if display is None:+ display = (element.get("display") or "").strip().lower()+ nested_display_hidden = display_hidden or display == "none"++ own_visibility = _style_value(element.get("style"), "visibility")+ if own_visibility is None:+ own_visibility = (element.get("visibility") or "").strip().lower()+ nested_visibility = own_visibility or visibility++ nested_definition = inside_definition or (+ local in _DEFINITION_SUBTREES and not activated_reference+ )+ if (+ local == "text"+ and not nested_definition+ and not nested_display_hidden+ and nested_visibility not in {"hidden", "collapse"}+ and "".join(element.itertext()).strip()+ ):+ return True+ if local == "use" and not nested_display_hidden:+ target_id = _href_target(element)+ target = elements_by_id.get(target_id or "")+ if target is not None and target_id not in use_stack:+ if visit(+ target,+ inside_definition=False,+ activated_reference=True,+ display_hidden=False,+ visibility=nested_visibility,+ use_stack=use_stack | {target_id},+ ):+ return True+ return any(+ visit(+ child,+ inside_definition=nested_definition,+ activated_reference=False,+ display_hidden=nested_display_hidden,+ visibility=nested_visibility,+ use_stack=use_stack,+ )+ for child in element+ )++ return visit(+ root,+ inside_definition=False,+ activated_reference=False,+ display_hidden=False,+ visibility="visible",+ use_stack=frozenset(),+ )+++@dataclass+class AuthoringNormalizationStats:+ """Deterministic changes permitted before the first authoring write."""++ coordinates: CoordinateCompactionStats+ styles: StyleCompactionStats++ @property+ def changed_declarations(self) -> int:+ return (+ self.coordinates.changed_attributes+ + self.styles.changed_declarations+ )++ def as_dict(self) -> dict[str, dict[str, int] | int]:+ return {+ "coordinates": self.coordinates.as_dict(),+ "styles": self.styles.as_dict(),+ "changed_declarations": self.changed_declarations,+ }+++def normalize_compact_authoring_tree(+ root: ET.Element,+ *,+ compact_native_frames: bool = True,+) -> AuthoringNormalizationStats:+ """Normalize one in-memory authoring tree without changing its semantics."""+ if _local_name(root.tag) != "svg":+ raise ValueError("Compact authoring requires an SVG root element")+ coordinates = compact_svg_tree(+ root,+ compact_native_frames=compact_native_frames,+ )+ styles = compact_svg_style_tree(root)+ return AuthoringNormalizationStats(+ coordinates=coordinates,+ styles=styles,+ )+++def canonical_authoring_errors(+ root: ET.Element,+ *,+ compact_native_frames: bool = True,+) -> list[str]:+ """Return objective violations of the canonical compact authoring form."""+ if _local_name(root.tag) != "svg":+ return ["Canonical authoring requires an SVG root element"]++ errors: list[str] = []+ if _namespace(root.tag) != _SVG_NAMESPACE:+ errors.append(+ "Root SVG must use the standard http://www.w3.org/2000/svg "+ "namespace"+ )+ errors.extend(_svg_namespace_errors(root))++ style_elements = [+ element for element in root.iter()+ if _local_name(element.tag) == "style"+ ]+ if style_elements:+ errors.append(+ "Embedded <style> blocks are not canonical authoring; write "+ "supported values on the element or a meaningful ancestor"+ )+ class_elements = [+ element for element in root.iter()+ if element.get("class") is not None+ ]+ if class_elements:+ errors.append(+ "class selectors are not canonical authoring; keep explicit "+ "standard SVG presentation attributes"+ )++ unsafe_values = [+ (element.get("id") or _local_name(element.tag), name, value)+ for element in root.iter()+ for name in INHERITABLE_ATTRIBUTES+ if (value := element.get(name)) is not None+ and not is_canonical_presentation_value(+ value,+ property_name=name,+ )+ ]+ if unsafe_values:+ label, name, value = unsafe_values[0]+ errors.append(+ f"Element {label!r} has noncanonical {name}={value!r}; omit "+ "CSS-wide inheritance or resolve dynamic CSS before authoring"+ )++ root_style_names = _style_names(root.get("style"))+ root_paints = sorted(+ name+ for name in _ROOT_PAINT_ATTRIBUTES+ if root.get(name) is not None or name in root_style_names+ )+ if root_paints:+ errors.append(+ "Root SVG cannot declare shared paint values: "+ + ", ".join(root_paints)+ + "; put color and line defaults on meaningful groups"+ )++ for element in root.iter():+ if _local_name(element.tag) not in {"svg", "g"}:+ continue+ inherited_style_names = sorted(+ _style_names(element.get("style"))+ & set(INHERITABLE_ATTRIBUTES)+ )+ if inherited_style_names:+ label = element.get("id") or _local_name(element.tag)+ errors.append(+ f"Container {label!r} writes inherited defaults in inline "+ "style instead of presentation attributes: "+ + ", ".join(inherited_style_names)+ )++ if _has_visible_text(root) and not (root.get("font-family") or "").strip():+ errors.append(+ "Visible text requires one direct root font-family default; "+ "semantic groups and text elements keep only real overrides"+ )++ candidate = copy.deepcopy(root)+ stats = normalize_compact_authoring_tree(+ candidate,+ compact_native_frames=compact_native_frames,+ )+ if stats.styles.changed_declarations:+ examples = _attribute_change_examples(+ root,+ candidate,+ coordinate_changes=False,+ )+ errors.append(+ "Authoring SVG contains noncanonical or redundant inherited "+ f"style declarations ({stats.styles.changed_declarations} "+ "change(s)); examples: "+ + "; ".join(examples)+ )+ if stats.coordinates.changed_attributes:+ examples = _attribute_change_examples(+ root,+ candidate,+ coordinate_changes=True,+ )+ errors.append(+ "Authoring SVG contains safely compactable page-space metadata "+ f"({stats.coordinates.changed_attributes} attribute(s)); examples: "+ + "; ".join(examples)+ )+ return errorsdiff --git a/skills/ppt-master/scripts/svg_authoring_view.py b/skills/ppt-master/scripts/svg_authoring_view.pyindex ac653bbd..c439d82a 100644--- a/skills/ppt-master/scripts/svg_authoring_view.py+++ b/skills/ppt-master/scripts/svg_authoring_view.py@@ -51,13 +51,16 @@ from urllib.parse import urlsplit, urlunsplitfrom xml.etree import ElementTree as ETfrom compact_svg_coordinates import compact_svg_tree-from compact_svg_styles import compact_svg_style_treefrom console_encoding import configure_utf8_stdiofrom pptx_shapes import (NATIVE_FALLBACK_SHA256_ATTR,svg_native_fallback_fingerprint,)from svg_compatibility import normalize_single_child_group_filters+from svg_authoring_contract import (+ canonical_authoring_errors,+ normalize_compact_authoring_tree,+)configure_utf8_stdio()@@ -77,6 +80,15 @@ SEMANTIC_TABLE_KIND = "table"# that cannot move to an editable vector asset become atomic source proxies.SOURCE_PROXY_MIN_BYTES = 4096_SEMANTIC_CONTENT_TAGS = frozenset({"foreignObject", "text", "tspan"})+_SEMANTIC_AUTHORING_ATTRIBUTES = frozenset({+ "data-pptx-inline-formula",+ "data-pptx-page-role",+ "data-pptx-placeholder",+ "data-pptx-replace-with",+ "data-pptx-role",+ "data-pptx-shape-hyperlink",+ SEMANTIC_OBJECT_ATTRIBUTE,+})_DRAWABLE_TAGS = frozenset({"circle","ellipse",@@ -86,6 +98,12 @@ _DRAWABLE_TAGS = frozenset({"polyline","rect",})+_SEMANTIC_CARRIER_OWNER_ATTRIBUTES = frozenset({+ "data-pptx-frame",+ "data-pptx-geometry-kind",+ "data-pptx-object",+ "data-pptx-prst",+})_URL_ID_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"\s]+)\1\s*\)")_SHA256_RE = re.compile(r"^[0-9a-fA-F]{64}$")@@ -763,6 +781,19 @@ def _compact_semantic_shapes(root: ET.Element, stats: ProjectionStats) -> None:raise ValueError("Semantic shape requires exactly one geometry carrier")carrier = carriers[0]stats.compatibility_normalizations += _make_geometry_carrier_visible(carrier)+ for name in list(carrier.attrib):+ if (+ name not in _SEMANTIC_CARRIER_OWNER_ATTRIBUTES+ and not name.startswith("data-pptx-av-")+ ):+ continue+ owner_value = shape.get(name)+ if owner_value is None or owner_value != carrier.get(name):+ raise ValueError(+ f"Semantic shape owner/carrier values differ for {name}"+ )+ carrier.attrib.pop(name, None)+ stats.compatibility_normalizations += 1direct_texts = [child for child in shape@@ -1205,6 +1236,21 @@ def _prefer_editable_vector_asset(element: ET.Element) -> bool:)+def _contains_authoring_semantics(element: ET.Element) -> bool:+ """Keep meaning-bearing content inline and editable for the model."""+ for item in element.iter():+ if _local_name(item.tag) in _SEMANTIC_CONTENT_TAGS:+ return True+ if any(item.get(name) is not None for name in _SEMANTIC_AUTHORING_ATTRIBUTES):+ return True+ if (+ _local_name(item.tag) == "metadata"+ and item.get("type") == "application/json"+ ):+ return True+ return False++def _externalize_large_source_objects(root: ET.Element,references: list[SourceReference],@@ -1237,6 +1283,7 @@ def _externalize_large_source_objects(original_bytes = len(ET.tostring(element, encoding="utf-8"))if (original_bytes < SOURCE_PROXY_MIN_BYTES+ or _contains_authoring_semantics(element)or _prefer_editable_vector_asset(element)):continue@@ -1315,12 +1362,6 @@ def _render_projection()_strip_import_attributes(root, stats)_rewrite_asset_references(root, source.parent, output.parent, stats)- stats.coordinate_attributes_compacted = compact_svg_tree(- root,- ).changed_attributes- stats.style_declarations_compacted = compact_svg_style_tree(- root,- ).changed_declarationssource_proxy_assets: dict[Path, bytes] = {}if source_proxy_dir is not None:source_proxy_assets.update(_compact_semantic_tables(@@ -1337,6 +1378,13 @@ def _render_projection(source_proxy_dir,stats,))+ normalization = normalize_compact_authoring_tree(root)+ stats.coordinate_attributes_compacted = (+ normalization.coordinates.changed_attributes+ )+ stats.style_declarations_compacted = (+ normalization.styles.changed_declarations+ )live_elements = set(root.iter())for marker in fresh_native_markers & live_elements:if marker.get(SEMANTIC_OBJECT_ATTRIBUTE) == SEMANTIC_TABLE_KIND:@@ -1348,6 +1396,13 @@ def _render_projection()_index_initial_authoring_references(root, source_references)+ contract_errors = canonical_authoring_errors(root)+ if contract_errors:+ raise ValueError(+ "Canonical authoring projection failed: "+ + "; ".join(contract_errors)+ )+projected = ET.tostring(root, encoding="utf-8", xml_declaration=False)if not projected.endswith(b"\n"):projected += b"\n"diff --git a/skills/ppt-master/scripts/svg_quality/checker.py b/skills/ppt-master/scripts/svg_quality/checker.pyindex 2d5ea12b..f7f45fa9 100644--- a/skills/ppt-master/scripts/svg_quality/checker.py+++ b/skills/ppt-master/scripts/svg_quality/checker.py@@ -32,6 +32,7 @@ from pptx_workspace import (SOURCE_PPTX_PATH,)from slide_roster import discover_slide_svgs+from svg_authoring_contract import canonical_authoring_errorsfrom . import svg_contractsfrom .xml_support import (@@ -1105,9 +1106,11 @@ class SVGQualityChecker:*,template_mode: bool = False,quick_generate: bool = False,+ canonical_authoring: bool = False,):self.template_mode = template_modeself.quick_generate = quick_generate+ self.canonical_authoring = canonical_authoringself.results = []self.summary = {'total': 0,@@ -1232,6 +1235,7 @@ class SVGQualityChecker:# produce misleading errors on a broken document.root = self._parse_xml_root(content, result)if root is not None:+ self._check_canonical_authoring(root, result)try:hydrated_payloads = hydrate_native_payload_refs(root, svg_path)except NativePayloadError as exc:@@ -1391,6 +1395,27 @@ class SVGQualityChecker:self.results.append(result)return result+ def _check_canonical_authoring(+ self,+ root: ET.Element,+ result: Dict,+ ) -> None:+ """Fail standard generation when SVG was not compact when authored."""+ if not self.canonical_authoring:+ return+ errors = canonical_authoring_errors(+ root,+ # Authored-preset/native frames can intentionally retain the+ # helper's exact precision. Imported projections compact their+ # model-facing frames before publication, where provenance is+ # still known.+ compact_native_frames=False,+ )+ result['errors'].extend(+ f"Noncanonical compact authoring: {error}"+ for error in errors+ )+def _parse_xml_root(self, content: str, result: Dict) -> ET.Element | None:"""Parse the SVG content as well-formed XML.diff --git a/skills/ppt-master/scripts/svg_quality/cli.py b/skills/ppt-master/scripts/svg_quality/cli.pyindex 6326c1cf..a19a0d8c 100644--- a/skills/ppt-master/scripts/svg_quality/cli.py+++ b/skills/ppt-master/scripts/svg_quality/cli.py@@ -79,6 +79,8 @@ def print_usage() -> None:print(" --output <path> Override the plain-text report path")print(" --quick-generate Validate lockless flat Quick Generate SVGs;")print(" ignore design_spec.md and spec_lock.md.")+ print(" --canonical-authoring Require compact authoring syntax as written;")+ print(" the checker never rewrites source SVG.")print(" --template-mode Validate a template workspace's templates/ directory:")print(" Brand/Style validate their portable workspace contracts;")print(" Layout/Deck glob *.svg directly, skip spec_lock checks,")@@ -109,12 +111,14 @@ def main() -> None:template_mode = "--template-mode" in sys.argvquick_generate = "--quick-generate" in sys.argv+ canonical_authoring = "--canonical-authoring" in sys.argvif template_mode and quick_generate:print("[ERROR] --template-mode cannot be combined with --quick-generate")sys.exit(1)checker = SVGQualityChecker(template_mode=template_mode,quick_generate=quick_generate,+ canonical_authoring=canonical_authoring,)target = sys.argv[1]diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex 7774450a..3b784312 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -814,6 +814,17 @@ def _convert_semantic_shape()carrier = copy.deepcopy(carriers[0])_make_semantic_geometry_carrier_visible(carrier)+ for name, value in shape.attrib.items():+ if (+ name in {+ 'data-pptx-frame',+ 'data-pptx-geometry-kind',+ 'data-pptx-object',+ 'data-pptx-prst',+ }+ or name.startswith('data-pptx-av-')+ ) and carrier.get(name) is None:+ carrier.set(name, value)for name in ('data-pptx-shape-id','data-pptx-shape-name',@@ -1638,8 +1649,14 @@ def _geometry_trace_metadata(elem: ET.Element, result: ShapeResult) -> dict[str,elem,)source_custom = (- carrier.get('data-pptx-geometry-kind') == 'custom'- and carrier.get('data-pptx-frame') is not None+ (+ carrier.get('data-pptx-geometry-kind')+ or elem.get('data-pptx-geometry-kind')+ ) == 'custom'+ and (+ carrier.get('data-pptx-frame')+ or elem.get('data-pptx-frame')+ ) is not None)expected_hash = carrier.get('data-pptx-geometry-sha256')actual_hash = hashlib.sha256(diff --git a/skills/ppt-master/scripts/template_import/native_structure.py b/skills/ppt-master/scripts/template_import/native_structure.pyindex 1bbe603a..d5474671 100644--- a/skills/ppt-master/scripts/template_import/native_structure.py+++ b/skills/ppt-master/scripts/template_import/native_structure.py@@ -125,6 +125,7 @@ def build_native_structure("imageAssets": master.get("imageAssets", []),"shapeImageAssets": master.get("shapeImageAssets", []),"drawableShapeCount": master.get("drawableShapeCount", 0),+ "placeholders": master.get("placeholders", []),"layoutKeys": [layout_key_by_path[layout["path"]]for layout in layoutsdiff --git a/skills/ppt-master/templates/VISUALIZATION_TEMPLATE_AUTHORING.md b/skills/ppt-master/templates/VISUALIZATION_TEMPLATE_AUTHORING.mdindex 7658f58c..229e36ab 100644--- a/skills/ppt-master/templates/VISUALIZATION_TEMPLATE_AUTHORING.md+++ b/skills/ppt-master/templates/VISUALIZATION_TEMPLATE_AUTHORING.md@@ -170,11 +170,11 @@ family 与信息模型:Chart 的数值映射、Table 的行 × 列事实网格| 做法 | 要求 ||---|---|-| 字体继承 | 公共 `font-family` 放在根 `<svg>` 或清楚的父 `<g>` |-| 属性继承 | 同组重复的 `fill`、`stroke`、字号或锚点可提升到父组 |+| 字体继承 | 公共 `font-family` 放在根 `<svg>`;局部差异放在清楚的父 `<g>` |+| 属性继承 | 同组重复的 `fill`、`stroke`、字号或锚点提升到父组;根节点不放 paint || 注释 | 保留结构、语义和机器标记;删除色名、营销解释和重复说明 || 文本 | 普通单行直接写在 `<text>`;只有多 run/多行需要 `<tspan>` |-| 坐标 | 页面坐标使用必要精度;按上游合同运行 `compact_svg_coordinates.py` |+| 坐标 | 页面坐标从写入时就使用必要精度;质量检查只读验证,不在之后改写 || ID | 使用 `chart-area`、`series-1`、`card-1` 等结构名称,避免示例业务名 |### 4.2 禁止的压缩@@ -450,15 +450,14 @@ Table;日期或持续时间决定 `x`/`width` 的排期是 `chart/gantt_chart````bash# 单文件 SVG 合同python3 skills/ppt-master/scripts/svg_quality_checker.py \- skills/ppt-master/templates/<family-directory>/<key>.svg+ skills/ppt-master/templates/<family-directory>/<key>.svg \+ --canonical-authoring# Canonical family/keypython3 skills/ppt-master/scripts/visualization_recall.py validate \<family>/<key>-# 可安全压缩的页面坐标(默认 dry-run)-python3 skills/ppt-master/scripts/compact_svg_coordinates.py \- skills/ppt-master/templates/<family-directory>/<key>.svg+# 作者态必须已紧凑;Checker 只读验证,不在检查后重写```**验证**:修改后至少完成 XML 解析、独立 SVG 渲染、Checker、默认 Shape-first 导出,以及 marker 模板的 native Chart/Table 导出。diff --git a/skills/ppt-master/workflows/create-template.md b/skills/ppt-master/workflows/create-template.mdindex c7e1d8a8..ec28e852 100644--- a/skills/ppt-master/workflows/create-template.md+++ b/skills/ppt-master/workflows/create-template.md@@ -171,17 +171,13 @@ It is an analysis aid, not a final direct template conversion.**Lossless payload backing + editable authoring IR**:-Keep `<import_workspace>/svg/` unchanged as lossless native-payload backing. If the optional `<import_workspace>/svg-flat/` verification tree was requested, keep it unchanged too. Before the Template_Designer reads or edits any imported page SVG, create the canonical non-destructive authoring IR bundle:--```bash-python3 skills/ppt-master/scripts/svg_authoring_view.py "<import_workspace>/svg" -o "<import_workspace>/authoring-svg" --projection-kind layered-```--Only when the import explicitly used `--inheritance-mode both`, create the optional complete-page verification IR:--```bash-python3 skills/ppt-master/scripts/svg_authoring_view.py "<import_workspace>/svg-flat" -o "<import_workspace>/authoring-svg-flat" --projection-kind flat-```+Keep `<import_workspace>/svg/` unchanged as lossless native-payload backing. If+the optional `<import_workspace>/svg-flat/` verification tree was requested,+keep it unchanged too. The same `pptx_template_import.py` transaction writes+the canonical compact `authoring-svg/` bundle before publishing the workspace;+`--inheritance-mode both` also writes `authoring-svg-flat/`. A successful Type A+import therefore never requires a second compaction/projection command before+the Template_Designer reads the authoring IR.Each bundle contains editable SVGs, a model-readable `authoring_summary.json`, and a tool-only `authoring_manifest.json`. The projection removes opaque text payload, duplicate hidden geometry carriers, and import-only identity attributes while keeping visible shape intent, compact preset/frame metadata, structure markers, logical ids, valid asset references, and a reserved `data-pptx-source-ref` on each imported logical object. Model-facing `data-pptx-frame` values and safe transform page coordinates use at most two decimals; normalized crop ratios, path geometry, transform linear coefficients, and the immutable lossless source retain their required precision. The summary lists the current SVG roster plus per-file canvas, size, text, image, vector, placeholder, and source-ref counts. The machine manifest records relative source files, document hashes, source paths, and initial authoring-subtree hashes; it does not duplicate opaque payload and MUST NOT enter model context. Source refs are unique within one document and are interpreted by tools together with that document's manifest record.@@ -201,20 +197,30 @@ only after the confirmed IR edits and vector-readability pass described below.`standard` / `fidelity` remain newly authored Template_Designer output and donot use this compiler.-**Vector illustration readability pass**:--Factor only large non-semantic decorative vector groups out of the lightweight IR documents so the model-facing SVGs stay readable while export remains native shapes. Never run this in place on the lossless import SVGs:--```bash-# layered view — primary read surface and canonical extracted-vector inventory-python3 skills/ppt-master/scripts/extract_svg_assets.py "<import_workspace>/authoring-svg" --icons-dir "<import_workspace>/icons" --icon-namespace imported --inplace --id-prefix layered --min-decoration-bytes 3000 --clean-stale--# optional flat verification view — run only when authoring-svg-flat/ exists;-# reuse matching layered assets so only genuinely flat-only vectors create files-python3 skills/ppt-master/scripts/extract_svg_assets.py "<import_workspace>/authoring-svg-flat" --icons-dir "<import_workspace>/icons" --icon-namespace imported --reuse-inventory "<import_workspace>/authoring-svg_vector_asset_inventory.json" --inplace --id-prefix flat --min-decoration-bytes 3000 --clean-stale-```--The authoring SVGs in `<import_workspace>/authoring-svg/` and, when requested, `<import_workspace>/authoring-svg-flat/` are rewritten in place with compact `<use data-icon="imported/..." data-pptx-asset-role="decoration"/>` placeholders. Each in-place extraction refreshes that bundle's `authoring_summary.json` automatically. Extracted assets have one canonical copy under `<import_workspace>/icons/imported/`; never duplicate them under `templates/icons/`. The root `icons/` directory remains a namespace container and must not contain rewritten page SVGs or inventories. Every imported asset root, placeholder, and v2 inventory record declares the `decoration` role. Any subtree containing a semantic marker, text, table, chart, relationship, or other meaning-bearing content remains inline; extraction and both consumers fail closed if that boundary is crossed. Eligible decoration records may retain `data-pptx-source-ref`, so re-inlining re-establishes their object mapping before materialization. The existing icon embedding path re-inlines the extracted assets before final export, preserving multi-color artwork and non-square viewBox geometry as native SVG shapes. Extraction triggers on either many drawable elements or a large pure-vector XML block, so long single-path decorations are factored out too. Pure-vector decoration runs beside text use a lower size threshold without moving the text or its semantic ancestor. Referenced defs (`gradient` / `pattern` / `filter` / `clipPath` / `marker`) are copied into each asset and namespaced so the asset is self-contained after re-inline. If both layered and flat views are processed into the same icon namespace, keep distinct `--id-prefix` values to avoid asset ID collisions. `--clean-stale` removes only stale generated assets for the current SVG filenames and prefix inside the selected namespace; it is safe in this import workspace but should not be used against a shared hand-curated icon directory without a specific prefix.+**Creation-time vector readability**:++`pptx_template_import.py` factors only large non-semantic decorative vector+groups while the import workspace is still staged. The first published+`authoring-svg/` files therefore already contain compact+`<use data-icon="imported/..." data-pptx-asset-role="decoration"/>`+references; do not run a second in-place readability or compaction pass.+`--inheritance-mode both` reuses the layered inventory while creating the+optional flat view, so only genuinely flat-only vectors create another asset.++Extracted assets have one canonical copy under+`<import_workspace>/icons/imported/`; never duplicate them under+`templates/icons/`. The root `icons/` directory remains a namespace container+and must not contain rewritten page SVGs or inventories. Every imported asset+root, placeholder, and v2 inventory record declares the `decoration` role. Any+subtree containing a semantic marker, text, table, chart, relationship, or+other meaning-bearing content remains inline; extraction and both consumers+fail closed if that boundary is crossed. Eligible decoration records may+retain `data-pptx-source-ref`, so re-inlining re-establishes their object+mapping before materialization. The existing icon embedding path re-inlines+the extracted assets before final export, preserving multi-color artwork and+non-square viewBox geometry as native SVG shapes. Referenced defs (`gradient`+/ `pattern` / `filter` / `clipPath` / `marker`) are copied into each asset and+namespaced so the asset is self-contained after re-inline.The layered pass owns the canonical extracted-vector pool. Each new asset records a source fingerprint before generated ID namespacing. The flat pass MUST consume the layered inventory through `--reuse-inventory`: an exact fingerprint match writes only a `<use>` reference to the existing layered asset, while an unmatched flat-only subtree may create one new asset under the `flat` prefix. Do not independently extract the two views into parallel asset sets. With `--clean-stale`, a rerun also removes obsolete generated `flat_*` duplicates while retaining every reused layered reference.@@ -611,10 +617,12 @@ paint changes require a new helper render. When actual `standard` / `fidelity`construction needs a Boolean result over supported shape/text operands, Template_Designerdecides whether to use `shape_boolean_svg.py` under[`native-shape-authoring.md`](../references/native-shape-authoring.md) §6; a-brief/reference suggestion does not lock the operation. `mirror` preserves the expanded-lossless source contract in a new workspace and may only normalize transport details required by-the current compiler. Mirror never performs commonality extraction, semantic-synthesis, merge/split, promotion/demotion, renaming, or re-parenting.+brief/reference suggestion does not lock the operation. `mirror` preserves the+source structure ownership, visible result, and supported semantics in a new+workspace while spelling them in the same compact authoring contract used by+other modes. It may normalize equivalent inheritance, safe page-space metadata,+and compiler transport without changing object meaning. Mirror never performs+semantic synthesis, merge/split, promotion/demotion, renaming, or re-parenting.**Hard rule — multi-Master package boundary**: More than one Master is valid only when `mirror` preserves an existing source graph in the new workspace or an authored template intentionally defines distinct reusable design families. `standard` / `fidelity` must not create one Master per Layout or duplicate equivalent Masters merely for organization. Every declared Master must own at least one emitted Layout, and every declared Layout must be selected by at least one prototype SVG so the complete graph can be compiled and verified.@@ -696,7 +704,7 @@ becomes the prototype Slide placeholder, while**Create Brand branch**: run the child workflow's §4 checklist and the shared project-safe validator below in both scopes. It detects `kind: brand`, validates the identity-only frontmatter/sections/colors/provenance/asset references, and does not require an SVG roster or touch a global index. Any failure blocks completion.```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode+python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode --canonical-authoring```In `library` scope, additionally run the registrar dry-run so `brand_id` is checked against the library directory/index key:@@ -714,7 +722,7 @@ and fallback values, portable ID, and one-file roster-free package boundary.The child checklist remains authoritative for semantic scope and provenance.```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode+python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode --canonical-authoring```In `library` scope, additionally run the registrar dry-run so `style_id` is@@ -735,14 +743,14 @@ ls -la "<template_source>"ls -la "<authoring_workspace>/images" "<authoring_workspace>/icons"```-Compact safe page-space metadata, transform coordinates, and repeated inherited-presentation declarations, then run SVG validation on the template directory.-Keep canonical authored-preset and native record frames unchanged:+Run read-only SVG validation on the template directory. The Template Designer+must write canonical compact SVG directly; mirror materialization applies the+same normalization in memory before its first template write. Keep canonical+authored-preset and native record frames unchanged:```bash-python3 skills/ppt-master/scripts/compact_svg_coordinates.py "<template_source>" --inplace --keep-native-frames-python3 skills/ppt-master/scripts/compact_svg_styles.py "<template_source>" --inplace-python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_source>" --template-mode --format <canvas_format>+python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_source>" \+ --template-mode --canonical-authoring --format <canvas_format>````--template-mode` makes the checker:diff --git a/skills/ppt-master/workflows/create-template/create-brand.md b/skills/ppt-master/workflows/create-template/create-brand.mdindex abbbee33..11cf07f6 100644--- a/skills/ppt-master/workflows/create-template/create-brand.md+++ b/skills/ppt-master/workflows/create-template/create-brand.md@@ -143,7 +143,7 @@ Return these facts to Create Template:For both scopes, Create Template Step 5 validates the portable Brand contract without registration:```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode+python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode --canonical-authoring```For `library` scope, additionally validate the directory/index identity with:diff --git a/skills/ppt-master/workflows/create-template/create-style.md b/skills/ppt-master/workflows/create-template/create-style.mdindex 863c89f7..5c712eea 100644--- a/skills/ppt-master/workflows/create-template/create-style.md+++ b/skills/ppt-master/workflows/create-template/create-style.md@@ -175,7 +175,7 @@ Return these facts to Create Template:For both scopes, Create Template Step 5 validates the portable Style contract without registration:```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode+python3 skills/ppt-master/scripts/svg_quality_checker.py "<template_workspace>/templates" --template-mode --canonical-authoring```For `library` scope, additionally validate the directory/index identity with:diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.mdindex df2ace26..3d32c085 100644--- a/skills/ppt-master/workflows/generate-pptx.md+++ b/skills/ppt-master/workflows/generate-pptx.md@@ -710,8 +710,8 @@ Do not duplicate specialized identity with `data-pptx-role`. Add it only to stru**First-page gate (Mandatory)** — after the **first** SVG page, before drawing page 2:```bash-python3 ${SKILL_DIR}/scripts/compact_svg_styles.py <project_path>/svg_output --inplace-python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --stage first-page --json+python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> \+ --canonical-authoring --stage first-page --json```Run the command unfiltered—do not pipe it through `tail`, `head`, `grep`, or another output truncator. Review the complete P01 issue set from that one run before editing. Select any advisory warnings worth addressing, fix all blocking errors and selected warnings in one consolidated edit pass, then perform one verification rerun. Do not rerun merely to reveal the next issue. If verification still fails, treat its complete output as the next batch and repeat the same review → consolidated edit → single verification cycle; never check between individual fixes. If the terminal output itself is truncated, read only the relevant issue arrays from `validation/svg_quality_first_page_report.json`; do not launch another checker run for discovery. After the gate passes, draw P02 through the final page without checker calls.@@ -733,8 +733,8 @@ gate-signal: method=<rule resolved, or none> | page-local=<count> | not-exercise**Quality Check Gate (Mandatory)** — only after every planned SVG exists, BEFORE annotation handling and speaker notes:```bash-python3 ${SKILL_DIR}/scripts/compact_svg_styles.py <project_path>/svg_output --inplace-python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --stage final --json+python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> \+ --canonical-authoring --stage final --json```- **MUST**: Before this gate, every §IX `Native-ready` entry `<object-key>=yes` already has one matching draw-time marker group and JSON metadata child; `=no` and incidental microvisuals remain ordinary SVG. A legacy bare `yes|no` is readable only when that page has exactly one eligible object; it never derives from §VII.- Run the command unfiltered—do not pipe it through `tail`, `head`, `grep`, or another output truncator. One invocation already scans every page and reports the complete issue set.diff --git a/skills/ppt-master/workflows/profiles/quick-generate.md b/skills/ppt-master/workflows/profiles/quick-generate.mdindex c41442ea..a2d8dc59 100644--- a/skills/ppt-master/workflows/profiles/quick-generate.md+++ b/skills/ppt-master/workflows/profiles/quick-generate.md@@ -696,13 +696,12 @@ already present.After every page and required referenced resource exists, run the Quick branchof [`verify-charts`](../stages/verify-charts.md) when any data-driven chart was-authored. Complete all coordinate repairs first; then compact shared root/group-presentation values and run the one lockless final SVG check:+authored. Complete all coordinate repairs first, then use the one lockless+final check to prove the pages were authored in canonical compact form:```bash-python3 ${SKILL_DIR}/scripts/compact_svg_styles.py <project_path>/svg_output --inplacepython3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> \- --quick-generate --stage final --json+ --quick-generate --canonical-authoring --stage final --json```Fix every blocking error and rerun the same command.diff --git a/skills/ppt-master/workflows/stages/apply-template-workspace.md b/skills/ppt-master/workflows/stages/apply-template-workspace.mdindex 843d38c2..629d4a39 100644--- a/skills/ppt-master/workflows/stages/apply-template-workspace.md+++ b/skills/ppt-master/workflows/stages/apply-template-workspace.md@@ -65,7 +65,7 @@ registration: Brand/Style are roster-free, the active structure validates itsroster, and a shadowed Deck still validates its declared contract:```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py "<workspace_root>/templates" --template-mode+python3 skills/ppt-master/scripts/svg_quality_checker.py "<workspace_root>/templates" --template-mode --canonical-authoring```Any error blocks installation.diff --git a/skills/ppt-master/workflows/stages/customize-animations.md b/skills/ppt-master/workflows/stages/customize-animations.mdindex 74126e21..5cc9136f 100644--- a/skills/ppt-master/workflows/stages/customize-animations.md+++ b/skills/ppt-master/workflows/stages/customize-animations.md@@ -146,7 +146,7 @@ changed. Use the owning route's checker form; Quick Generate must add itslockless profile flag:```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path> --stage final --json+python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path> --canonical-authoring --stage final --json# Quick Generate: insert --quick-generate before --stage.```diff --git a/skills/ppt-master/workflows/stages/verify-charts.md b/skills/ppt-master/workflows/stages/verify-charts.mdindex a1d94049..559e20a2 100644--- a/skills/ppt-master/workflows/stages/verify-charts.md+++ b/skills/ppt-master/workflows/stages/verify-charts.md@@ -140,7 +140,7 @@ After updating any page, follow the active profile's checker order. Defaultreruns its quality checker to confirm nothing broke:```bash-python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path>+python3 skills/ppt-master/scripts/svg_quality_checker.py <project_path> --canonical-authoring```Quick completes every chart comparison/repair first, then returns to