Skip to content

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

fix(svg-editor): edit project in place, drop auto-derivation

hugohe3d4bbbdf04ffa
diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.md
index 08b0ce28..23eeb793 100644
--- a/skills/ppt-master/SKILL.md
+++ b/skills/ppt-master/SKILL.md
@@ -342,31 +342,30 @@ This step is **OPTIONAL**. Do **NOT** run it as part of the default flow. Run it
When such an intent is detected, ask the user (in their language) whether they want to launch the visual editor.
-If the user confirms, start the editor. The server will automatically derive a `<project>_revised_<timestamp>/` copy beside the original project, so the original is preserved untouched:
+If the user confirms, start the editor. The editor edits the project's `svg_output/` in place; `svg_to_pptx` already snapshots it into `backup/<timestamp>/` on every export, so prior versions are recoverable from there:
```bash
python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
```
-Read the printed `Derived revised project: <revised_path>` line, then inform the user (in their language) that:
+Inform the user (in their language) that:
- the editor is running at `http://localhost:5050`
- they should click an element in the browser, add an annotation, and save when done
-- changes will be written to the derived copy `<revised_path>`, not the original
**Edit Loop (Triggered After User Submits Annotations):**
When the user indicates (in any wording) that they have submitted annotations and want the AI to apply them:
1. The server will have auto-shut down after the user saved (port is released). If it's still running, kill it.
-2. Run `python3 ${SKILL_DIR}/scripts/check_annotations.py <revised_project_path>` to discover annotations
+2. Run `python3 ${SKILL_DIR}/scripts/check_annotations.py <project_path>` to discover annotations
3. If no annotations found, inform the user and stop
-4. Read each annotated SVG file from `<revised_project_path>/svg_output/`
+4. Read each annotated SVG file from `<project_path>/svg_output/`
5. For each annotation: modify the target SVG element per the user's instruction
6. Remove `data-edit-target` and `data-edit-annotation` attributes from modified elements
-7. Re-run Step 7 post-processing on the revised project: `finalize_svg.py` → `svg_to_pptx.py`
-8. Re-start the SVG editor server pointing at the **same** revised project (it already contains `_revised_` in the name, so no further derivation happens):
+7. Re-run Step 7 post-processing: `finalize_svg.py` → `svg_to_pptx.py`
+8. Re-start the SVG editor server:
```bash
- python3 ${SKILL_DIR}/scripts/svg_editor/server.py <revised_project_path> --no-browser
+ python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
```
9. Inform the user (in their language) that annotations have been applied, the PPT has been updated, and the editor is running again at `http://localhost:5050`.
10. Wait for the user's next message. If they indicate they are done, the editing loop ends. If they submit more annotations, return to step 1.
diff --git a/skills/ppt-master/scripts/svg_editor/server.py b/skills/ppt-master/scripts/svg_editor/server.py
index be654415..0b6c85b9 100644
--- a/skills/ppt-master/scripts/svg_editor/server.py
+++ b/skills/ppt-master/scripts/svg_editor/server.py
@@ -19,13 +19,11 @@ Dependencies:
import argparse
import os
import re
-import shutil
import sys
import threading
import time
import webbrowser
import xml.etree.ElementTree as ET
-from datetime import datetime
from pathlib import Path
from typing import Optional
@@ -94,9 +92,15 @@ def _inline_icons(content: str) -> str:
def derive_revised_project(source: Path) -> Path:
"""Create a `<name>_revised_<timestamp>/` sibling and copy required subdirs.
- Idempotent: if `source` already looks like a revised copy, returns it as-is.
+ Reserved for callers that explicitly want a derived copy. Not invoked by the
+ default editor flow — `svg_to_pptx` already snapshots `svg_output` into
+ `backup/<timestamp>/` on every export, which is enough for rollback.
+
+ Idempotent: returns `source` unchanged if it already looks like a revised copy.
Copies svg_output/ (required) and images/, sources/, metadata.json if present.
"""
+ import shutil
+ from datetime import datetime
if '_revised_' in source.name:
return source
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
@@ -365,11 +369,6 @@ def build_parser() -> argparse.ArgumentParser:
parser.add_argument('--port', type=int, default=5050, help='Port to listen on (default: 5050)')
parser.add_argument('--no-browser', action='store_true', help='Do not auto-open browser')
parser.add_argument('--timeout', type=int, default=900, help='Idle timeout in seconds (default: 900 = 15min)')
- parser.add_argument(
- '--no-derive',
- action='store_true',
- help='Edit svg_output in place instead of deriving a `<name>_revised_<timestamp>/` copy',
- )
return parser
@@ -382,12 +381,6 @@ def main(argv: Optional[list[str]] = None) -> int:
print(f"Error: {project_path / 'svg_output'} does not exist", file=sys.stderr)
return 1
- if not args.no_derive:
- derived = derive_revised_project(project_path)
- if derived != project_path:
- print(f"Derived revised project: {derived}")
- project_path = derived
-
app = create_app(str(project_path), idle_timeout=args.timeout)
url = f'http://localhost:{args.port}'