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(tooling): close remaining false-success and concurrency gaps
hugohe3a2d15842d61b
diff --git a/skills/ppt-master/scripts/animation_config.py b/skills/ppt-master/scripts/animation_config.pyindex e350dc42..0b556d04 100644--- a/skills/ppt-master/scripts/animation_config.py+++ b/skills/ppt-master/scripts/animation_config.py@@ -115,7 +115,7 @@ def main(argv: list[str] | None = None) -> int:except Exception as exc:print(f'Error: {exc}', file=sys.stderr)return 1- if not config:+ if config is None:print('No animations.json found; default animation policy will be used.')return 0errors = list(dict.fromkeys(diff --git a/skills/ppt-master/scripts/batch_validate.py b/skills/ppt-master/scripts/batch_validate.pyindex 29aaeb36..0981fe57 100644--- a/skills/ppt-master/scripts/batch_validate.py+++ b/skills/ppt-master/scripts/batch_validate.py@@ -296,7 +296,11 @@ def main(argv: list[str] | None = None) -> int:if not directories:parser.print_help()- return 0+ print(+ "\n[ERROR] Provide at least one directory or pass --all.",+ file=sys.stderr,+ )+ return 1# Validate each directoryfor directory in directories:@@ -305,6 +309,13 @@ def main(argv: list[str] | None = None) -> int:else:print(f"[WARN] Skipping non-existent directory: {directory}\n")+ if validator.summary['total'] == 0:+ print(+ "[ERROR] No projects were found in the requested directories.",+ file=sys.stderr,+ )+ return 1+# Print summaryvalidator.print_summary()diff --git a/skills/ppt-master/scripts/pptx_intake.py b/skills/ppt-master/scripts/pptx_intake.pyindex 97abd1a5..63610b03 100644--- a/skills/ppt-master/scripts/pptx_intake.py+++ b/skills/ppt-master/scripts/pptx_intake.py@@ -20,11 +20,24 @@ Dependencies:from __future__ import annotationsimport argparse+from contextlib import contextmanagerimport json-import sys+import osfrom pathlib import Path+import sys+import tempfilefrom typing import Any+try:+ import fcntl+except ImportError: # pragma: no cover - Windows+ fcntl = None++try:+ import msvcrt+except ImportError: # pragma: no cover - POSIX+ msvcrt = None+_SCRIPTS_DIR = Path(__file__).resolve().parentif str(_SCRIPTS_DIR) not in sys.path:sys.path.insert(0, str(_SCRIPTS_DIR))@@ -38,7 +51,22 @@ configure_utf8_stdio()def _write_json(path: Path, payload: dict[str, Any]) -> None:path.parent.mkdir(parents=True, exist_ok=True)- path.write_text(json.dumps(payload, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")+ fd, temp_name = tempfile.mkstemp(+ prefix=f".{path.name}.",+ suffix=".tmp",+ dir=str(path.parent),+ )+ try:+ with os.fdopen(fd, "w", encoding="utf-8") as handle:+ json.dump(payload, handle, ensure_ascii=False, indent=2)+ handle.write("\n")+ os.replace(temp_name, path)+ except Exception:+ try:+ os.unlink(temp_name)+ except OSError:+ pass+ raisedef _chart_summary(slide_library: dict[str, Any]) -> dict[str, Any]:@@ -200,6 +228,39 @@ def build_source_profile(SOURCE_INDEX_NAME = "source_profile.json"+@contextmanager+def _source_index_lock(output_dir: Path):+ """Serialize source-index bundle publication with a persistent lock file."""+ output_dir.mkdir(parents=True, exist_ok=True)+ lock_path = output_dir / f"{SOURCE_INDEX_NAME}.lock"+ with lock_path.open("a+b") as lock_file:+ if fcntl is not None:+ fcntl.flock(lock_file.fileno(), fcntl.LOCK_EX)+ try:+ yield+ finally:+ fcntl.flock(lock_file.fileno(), fcntl.LOCK_UN)+ return++ if msvcrt is not None:+ lock_file.seek(0, os.SEEK_END)+ if lock_file.tell() == 0:+ lock_file.write(b"\0")+ lock_file.flush()+ lock_file.seek(0)+ msvcrt.locking(lock_file.fileno(), msvcrt.LK_LOCK, 1)+ try:+ yield+ finally:+ lock_file.seek(0)+ msvcrt.locking(lock_file.fileno(), msvcrt.LK_UNLCK, 1)+ return++ raise RuntimeError(+ "Cannot safely update source_profile.json: no supported file-lock API"+ )++def _load_source_index(index_path: Path) -> dict[str, Any]:"""Load and validate an existing multi-deck source index."""if not index_path.exists():@@ -230,14 +291,10 @@ def _load_source_index(index_path: Path) -> dict[str, Any]:return loaded-def upsert_source_index(output_dir: Path, digest: dict[str, Any]) -> Path:- """Merge one deck's digest into the single multi-deck index `source_profile.json`.-- The index stays the single must-read entry for the Strategist: it inlines every- deck's digest under `decks[]`, so a one-deck project is a one-entry index and a- multi-deck project lists each source deck self-containedly. Re-importing a deck- with the same stem replaces its entry in place.- """+def _upsert_source_index_unlocked(+ output_dir: Path,+ digest: dict[str, Any],+) -> Path:index_path = output_dir / SOURCE_INDEX_NAMEindex = _load_source_index(index_path)stem = digest.get("stem")@@ -253,6 +310,18 @@ def upsert_source_index(output_dir: Path, digest: dict[str, Any]) -> Path:return index_path+def upsert_source_index(output_dir: Path, digest: dict[str, Any]) -> Path:+ """Merge one deck digest into the serialized multi-deck source index.++ The index stays the single must-read entry for the Strategist: it inlines every+ deck's digest under `decks[]`, so a one-deck project is a one-entry index and a+ multi-deck project lists each source deck self-containedly. Re-importing a deck+ with the same stem replaces its entry in place.+ """+ with _source_index_lock(output_dir):+ return _upsert_source_index_unlocked(output_dir, digest)++def run_intake(pptx_path: Path, output_dir: Path) -> dict[str, Path]:"""Write `<stem>.identity.json`, `<stem>.slide_library.json`, and merge thedeck's digest into the single multi-deck index `source_profile.json`."""@@ -264,9 +333,10 @@ def run_intake(pptx_path: Path, output_dir: Path) -> dict[str, Path]:identity_path = output_dir / f"{stem}.identity.json"slide_library_path = output_dir / f"{stem}.slide_library.json"- _write_json(identity_path, identity)- _write_json(slide_library_path, slide_library)- profile_path = upsert_source_index(output_dir, digest)+ with _source_index_lock(output_dir):+ _write_json(identity_path, identity)+ _write_json(slide_library_path, slide_library)+ profile_path = _upsert_source_index_unlocked(output_dir, digest)return {"identity": identity_path,"slide_library": slide_library_path,diff --git a/skills/ppt-master/scripts/project_manager.py b/skills/ppt-master/scripts/project_manager.pyindex bd042df8..f7b56b02 100644--- a/skills/ppt-master/scripts/project_manager.py+++ b/skills/ppt-master/scripts/project_manager.py@@ -198,6 +198,14 @@ def is_within_path(path: Path, parent: Path) -> bool:return False+def _has_usable_import(summary: dict[str, list[str]]) -> bool:+ """Return whether import-sources produced at least one usable source artifact."""+ return any(+ summary.get(key)+ for key in ("archived", "markdown", "assets", "images", "analysis")+ )++class ProjectManager:"""Create, inspect, validate, and populate project folders."""@@ -727,6 +735,7 @@ class ProjectManager:sources_dir = self._source_dir(project_dir)summary: dict[str, list[str]] = {"archived": [],+ "url_records": [],"markdown": [],"assets": [],"images": [],@@ -775,14 +784,14 @@ class ProjectManager:self._import_url(item, markdown_path)except Exception as exc: # pragma: no cover - summary patharchived = self._archive_url_record(sources_dir, item)- summary["archived"].append(str(archived))+ summary["url_records"].append(str(archived))summary["skipped"].append(f"{item}: {exc}")continueif not self._is_valid_imported_url_markdown(markdown_path):markdown_path.unlink(missing_ok=True)archived = self._archive_url_record(sources_dir, item)- summary["archived"].append(str(archived))+ summary["url_records"].append(str(archived))summary["skipped"].append(f"{item}: URL conversion produced no usable Markdown")continue@@ -1138,11 +1147,22 @@ def main(argv: list[str] | None = None) -> int:move=args.move,copy=args.copy,)- print(f"[OK] Imported sources into: {args.project_path}")+ has_usable_import = _has_usable_import(summary)+ if has_usable_import:+ print(f"[OK] Imported sources into: {args.project_path}")+ else:+ print(+ f"[ERROR] No usable sources imported into: {args.project_path}",+ file=sys.stderr,+ )if summary["archived"]:- print("\nArchived originals / URL records:")+ print("\nArchived originals:")for item in summary["archived"]:print(f" - {item}")+ if summary["url_records"]:+ print("\nArchived URL records:")+ for item in summary["url_records"]:+ print(f" - {item}")if summary["markdown"]:print("\nNormalized markdown:")for item in summary["markdown"]:@@ -1167,7 +1187,7 @@ def main(argv: list[str] | None = None) -> int:print("\nSkipped:")for item in summary["skipped"]:print(f" - {item}")- return 0+ return 0 if has_usable_import else 1if args.command == "scaffold-spec":artifact_path = manager.scaffold_artifact(args.project_path, "design_spec")diff --git a/skills/ppt-master/scripts/svg_to_pptx/animation_config.py b/skills/ppt-master/scripts/svg_to_pptx/animation_config.pyindex 6c5f1556..6c39c51c 100644--- a/skills/ppt-master/scripts/svg_to_pptx/animation_config.py+++ b/skills/ppt-master/scripts/svg_to_pptx/animation_config.py@@ -174,15 +174,21 @@ def _require_unique_target_ids(raise ValueError(_duplicate_target_error(slide_name, duplicates))-def scan_project_targets(project_path: Path) -> tuple[dict[str, list[GroupTarget]], list[str]]:- """Scan ``svg_output/*.svg`` for animation targets."""- svg_dir = project_path / 'svg_output'+def scan_project_targets(+ project_path: Path,+ *,+ svg_files: list[Path] | None = None,+) -> tuple[dict[str, list[GroupTarget]], list[str]]:+ """Scan selected SVG files, defaulting to ``svg_output/*.svg``."""targets_by_slide: dict[str, list[GroupTarget]] = {}anonymous_groups: list[str] = []- if not svg_dir.is_dir():- return targets_by_slide, [f'svg_output directory not found: {svg_dir}']+ if svg_files is None:+ svg_dir = project_path / 'svg_output'+ if not svg_dir.is_dir():+ return targets_by_slide, [f'svg_output directory not found: {svg_dir}']+ svg_files = sorted(svg_dir.glob('*.svg'))- for svg_path in sorted(svg_dir.glob('*.svg')):+ for svg_path in svg_files:targets, anonymous = scan_svg_targets(svg_path)targets_by_slide[svg_path.stem] = targetsanonymous_groups.extend(anonymous)@@ -195,14 +201,18 @@ def default_config_path(project_path: Path) -> Path:def load_animation_config(project_path: Path, config_path: str | None = None) -> dict[str, Any] | None:- """Load optional animation config; return ``None`` when absent."""- if config_path:+ """Load animation config; only an absent default sidecar is optional."""+ if config_path is not None:+ if not config_path.strip():+ raise ValueError('Animation config path must be non-empty')path = Path(config_path)else:path = default_config_path(project_path)- if config_path and not path.is_absolute():+ if config_path is not None and not path.is_absolute():path = project_path / pathif not path.exists():+ if config_path is not None:+ raise FileNotFoundError(f'Animation config does not exist: {path}')return Nonewith open(path, 'r', encoding='utf-8') as f:@@ -1108,8 +1118,10 @@ def validate_animation_config(project_path: Path,config: dict[str, Any] | None = None,config_path: str | None = None,+ *,+ svg_files: list[Path] | None = None,) -> list[str]:- """Return sidecar-reference diagnostics for ``svg_output``.+ """Return sidecar-reference diagnostics for the selected SVG slides.Fatal field/type/value checks are owned by:func:`validate_animation_config_errors`. Anonymous groups are warnings;@@ -1123,7 +1135,10 @@ def validate_animation_config(return []warnings = _animation_sound_path_errors(project_path, config)- targets_by_slide, anonymous_groups = scan_project_targets(project_path)+ targets_by_slide, anonymous_groups = scan_project_targets(+ project_path,+ svg_files=svg_files,+ )for item in anonymous_groups:warnings.append(f'{item} has no id and cannot be customized in animations.json')diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.pyindex 41a7fe46..0e98c431 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py@@ -962,6 +962,12 @@ Recorded narration:'--native-charts-and-tables.',file=sys.stderr,)+ if args.animation_config is not None and not args.animation_config.strip():+ print(+ 'Error: --animation-config must be a non-empty file path',+ file=sys.stderr,+ )+ return 1if args.quick_test:conflicts: list[str] = []@@ -1127,10 +1133,22 @@ Recorded narration:# Native DrawingML is the only PPTX product. ``-s`` remains an explicit# diagnostic source override; standard export always reads svg_output/.native_source = args.source or 'output'- native_files, native_source_dir = find_svg_files(project_path, native_source)+ native_files, native_source_dir = find_svg_files(+ project_path,+ native_source,+ allow_fallback=args.source is None,+ )ref_files = native_filesif not native_files:- print("Error: No SVG files found")+ if args.source is not None:+ requested_dir = project_path / native_source_dir+ print(+ "Error: No SVG files found in explicitly requested source: "+ f"{requested_dir}",+ file=sys.stderr,+ )+ else:+ print("Error: No SVG files found", file=sys.stderr)return 1# Compatibility kwargs remain until the builder's old baseline-specific@@ -1391,7 +1409,11 @@ Recorded narration:config_warnings: list[str] = []if animation_config:- reference_messages = validate_animation_config(project_path, animation_config)+ reference_messages = validate_animation_config(+ project_path,+ animation_config,+ svg_files=native_files,+ )config_warnings = [message for message in reference_messagesif ' has no id and cannot be customized in animations.json' in messagediff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/discovery.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/discovery.pyindex fd590de6..85838a52 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/discovery.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/discovery.py@@ -13,6 +13,8 @@ class NotesFileReadError(RuntimeError):def find_svg_files(project_path: Path,source: str = 'output',+ *,+ allow_fallback: bool = True,) -> tuple[list[Path], str]:"""Find SVG files in the project.@@ -22,6 +24,8 @@ def find_svg_files(- 'output': svg_output (hand-authored source; native default)- 'final': svg_final (post-processed preview; diagnostic input)- or any subdirectory name+ allow_fallback: Try svg_output and then the project root when the+ requested directory is missing.Returns:(list_of_svg_files, actual_directory_name) tuple.@@ -35,6 +39,8 @@ def find_svg_files(svg_dir = project_path / dir_nameif not svg_dir.exists():+ if not allow_fallback:+ return [], dir_nameprint(f" Warning: {dir_name} directory does not exist, trying svg_output")dir_name = 'svg_output'svg_dir = project_path / dir_name