📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -20,16 +20,20 @@ A.y < B.y + B.h AND B.y < A.y + A.h
|
||||
For each text object estimate whether its text fits within its bbox.
|
||||
|
||||
Rough capacity (Latin):
|
||||
- Characters per line ≈ `(bbox.w × 72) / (font_size × 0.5)`, using `0.5 em` as an average Latin glyph-width factor
|
||||
- Characters per line ≈ `(bbox.w × 72) / (font_size × 0.5)`, using `0.5 em`
|
||||
as an average Latin glyph-width factor
|
||||
- Lines available ≈ `(bbox.h × 72) / (font_size × 1.2)`
|
||||
_(bbox in inches, font_size in pt)_
|
||||
|
||||
Adjustments:
|
||||
- **CJK / full-width text:** use a glyph-width factor near `1.0 em` instead of `0.5 em`. The extractor reports `non_ascii_text` — use it to flag CJK-heavy slides.
|
||||
- **CJK / full-width text:** halve the characters-per-line value (full-width glyphs ≈ 2× Latin advance). The extractor reports `non_ascii_text` — use it to flag CJK-heavy slides.
|
||||
- **Text on a shape/card:** subtract ≈0.1 in of inner padding from each side of the shape before computing capacity; the text occupies the inset inner area, not the full shape.
|
||||
|
||||
- **Pass:** estimated text volume ≤ available capacity.
|
||||
- **Warning:** likely overflow → inspect the generated PPTX or rendered preview, then shorten bullets, enlarge the bbox, or split the slide when clipping is confirmed. This estimate is a triage heuristic, not a deterministic failure by itself.
|
||||
- **Warning:** likely overflow → inspect the generated PPTX or rendered preview,
|
||||
then shorten bullets, enlarge the bbox, or split the slide when clipping is
|
||||
confirmed. This estimate is a triage heuristic, not a deterministic failure
|
||||
by itself.
|
||||
**Never set `font_size` below 9 pt for `classification: "content"` objects.**
|
||||
|
||||
## 3. Font Size Minimums
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
# OOXML Parsing Reference
|
||||
|
||||
A `.pptx` is an Open Packaging Conventions ZIP archive. Inspect it read-only
|
||||
by resolving its relationship graph; do not assume sequential filenames or
|
||||
copy package parts into a generated deck.
|
||||
|
||||
## Package-Part Map
|
||||
|
||||
| Need | Parts |
|
||||
| --- | --- |
|
||||
| Slide order | `ppt/presentation.xml`, `ppt/_rels/presentation.xml.rels` |
|
||||
| Slide text and shapes | Slide parts resolved from presentation relationships (commonly `ppt/slides/slideN.xml`) |
|
||||
| Layout, notes, images, charts | The slide's relationship part (commonly `ppt/slides/_rels/slideN.xml.rels`) |
|
||||
| Template geometry | `ppt/slideLayouts/`, `ppt/slideMasters/` |
|
||||
| Colors and fonts | Theme parts resolved from presentation/master relationships (commonly under `ppt/theme/`) |
|
||||
| Notes and comments | `ppt/notesSlides/`, `ppt/comments/` |
|
||||
| Media and embeddings | `ppt/media/`, `ppt/embeddings/` |
|
||||
|
||||
## Relationship Resolution
|
||||
|
||||
1. Start with `ppt/presentation.xml`; use its slide ID list and
|
||||
`ppt/_rels/presentation.xml.rels` to resolve slides in presentation order.
|
||||
2. For every part that needs linked content, resolve targets from that part's
|
||||
`.rels` file relative to the owning part rather than from a hard-coded path.
|
||||
3. Retain the relationship ID, type, resolved target, and any unreadable or
|
||||
missing target in the analysis result.
|
||||
4. Treat raw element ordering as evidence for rendering, not as a reason to
|
||||
reproduce a source slide or its package XML.
|
||||
|
||||
## Namespaces
|
||||
|
||||
- PresentationML: `http://schemas.openxmlformats.org/presentationml/2006/main`
|
||||
- DrawingML: `http://schemas.openxmlformats.org/drawingml/2006/main`
|
||||
- Office relationships: `http://schemas.openxmlformats.org/officeDocument/2006/relationships`
|
||||
- Package relationships: `http://schemas.openxmlformats.org/package/2006/relationships`
|
||||
|
||||
## Analysis Output Guidance
|
||||
|
||||
For a read-only extraction, retain the slide number, resolved relationship
|
||||
target, concatenated text, shape counts, notes, relationship types, and
|
||||
OOXML-only markers such as animations, comments, transitions, unsupported
|
||||
shapes, and non-modeled formatting. For design context, retain theme
|
||||
color/font tokens without inventing an RGB value when a scheme or system color
|
||||
cannot be fully resolved.
|
||||
|
||||
Record the input deck path, inspected parts, relationship-resolution errors,
|
||||
and unreadable XML in the analysis manifest. Keep the result limited to the
|
||||
evidence needed for the requested analysis.
|
||||
|
||||
## Secure, Read-Only Handling
|
||||
|
||||
- Treat a source deck as untrusted input. Reject path traversal, symlinks,
|
||||
oversized members, and compressed archive bombs before reading ZIP members.
|
||||
- Parse XML with a secure parser. Disable DTD loading, entity expansion, and
|
||||
network access.
|
||||
- Preserve `xml:space="preserve"` semantics when collecting text.
|
||||
- Do not modify the source archive, overwrite it, or blindly copy XML, media,
|
||||
fonts, images, or embedded files into a new deck.
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# PPTX Python Snippets
|
||||
# Reference-Deck Analysis Patterns
|
||||
|
||||
It describes how to approach PPTX extraction and style analysis with `python-pptx`, using short illustrative
|
||||
snippets — not a packaged module to copy wholesale.
|
||||
+30
-8
@@ -6,8 +6,9 @@ This file is static guidance for inspecting existing `.pptx` files and defining
|
||||
|
||||
- Keep only static guidance for reference-deck prompt context, extraction, folder analysis, and style-master inspection.
|
||||
- Do not place runtime scripts, model assets, importable Python modules, or generated artifacts here.
|
||||
- This skill ships no importable code; implement the extraction/style-analysis contract on demand with `python-pptx`.
|
||||
- `python-snippets.md` holds documentation-only `python-pptx` guidance — approach notes plus short illustrative snippets. Do not import from it or recreate packaged `.py` resources from it.
|
||||
- This skill ships no importable code; implement the extraction/style-analysis and read-only OOXML inspection contracts on demand with `python-pptx`, `zipfile`, and a secure XML parser.
|
||||
- `reference-deck-analysis-patterns.md` holds documentation-only `python-pptx` guidance — approach notes plus short illustrative snippets. Do not import from it or recreate packaged `.py` resources from it.
|
||||
- `ooxml-parsing.md` holds documentation-only package-part, relationship, namespace, and security guidance. It is not a runtime dependency or script template.
|
||||
|
||||
## Analysis Recipes
|
||||
|
||||
@@ -28,15 +29,34 @@ Produce a full JSON extraction including:
|
||||
- `summary` complexity metrics
|
||||
- `slides[*].layout_tree` with groups/objects
|
||||
- `ooxml_elements` for render-aware inspection
|
||||
- resolved package relationships, OOXML-only markers, and parsing exceptions
|
||||
|
||||
### 3. Folder Batch Recipe
|
||||
### 3. OOXML Package Inspection Recipe
|
||||
|
||||
Use read-only package inspection when high-level APIs do not expose the needed
|
||||
evidence: slide order, theme tokens, masters/layouts, notes, comments,
|
||||
animations, media, charts, or non-modeled formatting.
|
||||
|
||||
- Resolve slide order from `ppt/presentation.xml` and its relationship part.
|
||||
Do not derive it from `slideN.xml` filenames.
|
||||
- Resolve every relationship target relative to its owning source part, not its
|
||||
`.rels` part. Retain the relationship type, target, and unreadable XML errors
|
||||
in the result.
|
||||
- Preserve theme colors and fonts as tokens when they cannot be reliably
|
||||
resolved to RGB values.
|
||||
- Parse untrusted XML with a secure parser; do not enable DTDs, entity
|
||||
expansion, or network access.
|
||||
- Keep the source package read-only and never copy its XML parts into a new
|
||||
deck.
|
||||
|
||||
### 4. Folder Batch Recipe
|
||||
|
||||
Process a folder of decks to produce:
|
||||
|
||||
- One `.pptx-spec.json` file per deck
|
||||
- A `manifest.json` to track outputs
|
||||
|
||||
### 4. Style Master Recipe
|
||||
### 5. Style Master Recipe
|
||||
|
||||
Run style-only analysis when you need design lock signals:
|
||||
|
||||
@@ -44,7 +64,7 @@ Run style-only analysis when you need design lock signals:
|
||||
- Typography and font-size distribution
|
||||
- Master/layout usage and flow patterns
|
||||
|
||||
### 5. Reference Template Catalog Recipe
|
||||
### 6. Reference Template Catalog Recipe
|
||||
|
||||
When a reference deck should inform a new deck's layout rhythm, produce a
|
||||
human-readable catalog from the existing prompt-context, extraction, and
|
||||
@@ -83,9 +103,11 @@ Suggested catalog shape:
|
||||
## Related Responsibilities
|
||||
|
||||
This reference covers PPTX prompt context, extraction, folder batch analysis,
|
||||
style-master inspection, and the derived reference-template catalog only.
|
||||
style-master inspection, read-only OOXML package inspection, and the derived
|
||||
reference-template catalog only. See [OOXML parsing guidance](ooxml-parsing.md)
|
||||
for the package-part map and parser safety rules.
|
||||
|
||||
- Use the parent `pptx-deck-creation` workflow for narrative/source preparation,
|
||||
together with [design profiles](design-profiles.md) for profile selection.
|
||||
together with [design profiles](design-profiles.md) for profile selection.
|
||||
- Use [visual asset guidelines](visual-asset-adapters.md) for acquiring and
|
||||
placing icons, images, SVGs, and infographics.
|
||||
placing icons, images, SVGs, and infographics.
|
||||
|
||||
+23
-13
@@ -19,9 +19,9 @@ Shared rules:
|
||||
- On failure, write a failure manifest; never substitute a placeholder and call it generated.
|
||||
- Never request secrets in chat or a prompt dialog. For cloud auth use `.env` or `az login`.
|
||||
- Before a billable generation call or any request that sends user-provided or
|
||||
source material to a third party, disclose the provider/model, the material
|
||||
that will leave the machine, likely cost, and output path. Obtain explicit
|
||||
confirmation unless the user already authorized that exact operation.
|
||||
source material to a third party, disclose the provider/model, the material
|
||||
that will leave the machine, likely cost, and output path. Obtain explicit
|
||||
confirmation unless the user already authorized that exact operation.
|
||||
|
||||
---
|
||||
|
||||
@@ -62,7 +62,7 @@ def icon_search(query, limit=8, prefix=None, color=None, out_dir="assets/icons")
|
||||
|
||||
## 2. Web Image Search
|
||||
|
||||
Prefer the browsing or image-search capability available in the current client.
|
||||
Prefer the VS Code fetch tools (`fetch_webpage`) or an MCP image-search tool you have available.
|
||||
When you already have a direct image URL (from search results or the user), download it locally:
|
||||
|
||||
```python
|
||||
@@ -102,8 +102,9 @@ Generate through a user-managed provider (OpenAI or Azure OpenAI). Read credenti
|
||||
never accept secrets via chat.
|
||||
|
||||
Before running the snippet, obtain the external-call confirmation described in
|
||||
the shared rules. If `output_path` already exists, choose a new path or obtain
|
||||
separate overwrite confirmation; do not silently replace it.
|
||||
the shared rules. If `output_path` or its manifest already exists, choose a new
|
||||
path or obtain separate explicit overwrite confirmation; do not silently
|
||||
replace either file.
|
||||
|
||||
```python
|
||||
import base64, json, os
|
||||
@@ -111,15 +112,20 @@ from pathlib import Path
|
||||
from openai import OpenAI, AzureOpenAI # provided by the user's environment
|
||||
|
||||
def text_to_infographic(prompt, output_path, provider="openai",
|
||||
model_or_deployment="gpt-image-1", size="1024x1024"):
|
||||
model_or_deployment="gpt-image-1", size="1024x1024",
|
||||
confirmed=False, allow_overwrite=False):
|
||||
output = Path(output_path)
|
||||
manifest_path = output.with_suffix(".manifest.json")
|
||||
existing = [path for path in (output, manifest_path) if path.exists()]
|
||||
if existing:
|
||||
if existing and not allow_overwrite:
|
||||
raise FileExistsError(f"Refusing to overwrite existing paths: {existing}")
|
||||
manifest_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
manifest = {"provider": provider, "model_or_deployment": model_or_deployment,
|
||||
"output_path": output_path}
|
||||
if not confirmed:
|
||||
manifest.update(status="cancelled", error="External generation was not confirmed")
|
||||
manifest_path.write_text(json.dumps(manifest, indent=2), encoding="utf-8")
|
||||
return manifest
|
||||
try:
|
||||
if provider == "azure-openai":
|
||||
client = AzureOpenAI(
|
||||
@@ -130,17 +136,20 @@ def text_to_infographic(prompt, output_path, provider="openai",
|
||||
else:
|
||||
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
||||
result = client.images.generate(model=model_or_deployment, prompt=prompt, size=size)
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_bytes(base64.b64decode(result.data[0].b64_json))
|
||||
manifest["status"] = "ok"
|
||||
except Exception as exc: # report, never fake-generate
|
||||
manifest.update(status="error", error=str(exc))
|
||||
manifest_path.write_text(json.dumps(manifest, indent=2))
|
||||
manifest_path.write_text(json.dumps(manifest, indent=2), encoding="utf-8")
|
||||
return manifest
|
||||
```
|
||||
|
||||
- Ask the user for any missing non-secret values: provider, prompt,
|
||||
model/deployment, size, and output path.
|
||||
- Collect missing values via `vscode_askQuestions`: provider, prompt, model/deployment, size, output path.
|
||||
- Before calling the function, disclose the provider/model, material leaving
|
||||
the machine, likely cost, and output path. Set `confirmed=True` only after
|
||||
the user explicitly authorizes that exact external request. Set
|
||||
`allow_overwrite=True` only after separate explicit approval to replace every
|
||||
existing output or manifest path.
|
||||
- Use `.env` or `az login` for auth; never ask for keys/tokens in chat or the dialog.
|
||||
- Use generated art as a supporting visual. Recreate essential text, labels,
|
||||
metrics, and steps with native PowerPoint objects. Add a vector asset only
|
||||
@@ -155,4 +164,5 @@ NotebookLM has no public generation API, so treat this as an optional, user-conf
|
||||
- If the user has a NotebookLM/MCP bridge tool configured, call it with `source_refs` + `prompt`,
|
||||
then save the returned image locally and record provenance.
|
||||
- If no bridge is configured, **fall back to Text → Infographic (section 4)** or omit the asset.
|
||||
- Apply the same provenance and failure-manifest rules as the other generation guidelines.
|
||||
- Apply the same confirmation, overwrite, provenance, and failure-manifest
|
||||
rules as the other generation guidelines.
|
||||
|
||||
Reference in New Issue
Block a user