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: add repo update helper
hugohe34bf0b724ee5c
diff --git a/README.md b/README.mdindex e569c9fe..6c85cfcc 100644--- a/README.md+++ b/README.md@@ -145,6 +145,26 @@ pip install -r requirements.txt> If you encounter permission issues, use `pip install --user -r requirements.txt` or install in a virtual environment.+### 2.1 Daily Update (Recommended)++If you only want to pull the latest code and sync Python dependencies, run:++```bash+python3 skills/ppt-master/scripts/update_repo.py+```++This command will:++- Run `git pull --ff-only`+- Run `pip install -r requirements.txt` only when `requirements.txt` changed+- Keep local ignored files such as `.env`++Notes:++- The script stops when tracked local changes are present, so local edits do not get mixed into the update flow+- System dependencies such as `Node.js` and `Pandoc` still need to be installed manually+- If you want to skip Python dependency sync, use `python3 skills/ppt-master/scripts/update_repo.py --skip-pip`+### 3. Open AI EditorRecommended AI editors:diff --git a/README_CN.md b/README_CN.mdindex 6198ce14..ae872370 100644--- a/README_CN.md+++ b/README_CN.md@@ -144,6 +144,26 @@ pip install -r requirements.txt> 如遇权限问题,可使用 `pip install --user -r requirements.txt` 或在虚拟环境中安装。+### 2.1 日常更新(推荐)++如果只是拉最新代码并同步 Python 依赖,直接运行:++```bash+python3 skills/ppt-master/scripts/update_repo.py+```++这个命令会:++- 执行 `git pull --ff-only`+- 仅在 `requirements.txt` 发生变化时执行 `pip install -r requirements.txt`+- 保留 `.env` 这类本地忽略文件++注意:++- 如果仓库里有未提交的已跟踪改动,脚本会停止,避免把本地修改和更新流程混在一起+- `Node.js`、`Pandoc` 这类系统依赖仍需手动安装+- 如需跳过 Python 依赖同步,可使用 `python3 skills/ppt-master/scripts/update_repo.py --skip-pip`+### 3. 打开 AI 编辑器推荐使用以下 AI 编辑器:diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex e1380b65..ae8ef64e 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -23,6 +23,12 @@ python3 scripts/finalize_svg.py <project_path>python3 scripts/svg_to_pptx.py <project_path> -s final```+Repository update:++```bash+python3 scripts/update_repo.py+```+## Script Index| Area | Primary scripts | Documentation |@@ -31,6 +37,7 @@ python3 scripts/svg_to_pptx.py <project_path> -s final| Project management | `project_manager.py`, `batch_validate.py`, `generate_examples_index.py`, `error_helper.py` | [docs/project.md](./docs/project.md) || SVG pipeline | `finalize_svg.py`, `svg_to_pptx.py`, `total_md_split.py`, `svg_quality_checker.py` | [docs/svg-pipeline.md](./docs/svg-pipeline.md) || Image tools | `image_gen.py`, `analyze_images.py`, `gemini_watermark_remover.py` | [docs/image.md](./docs/image.md) |+| Repo maintenance | `update_repo.py` | README install/update section || Troubleshooting | validation, preview, export, dependency issues | [docs/troubleshooting.md](./docs/troubleshooting.md) |## High-Frequency Commands@@ -59,6 +66,13 @@ python3 scripts/image_gen.py --list-backendspython3 scripts/analyze_images.py <project_path>/images```+Repository update:++```bash+python3 scripts/update_repo.py+python3 scripts/update_repo.py --skip-pip+```+## Recommendations- Keep new runnable scripts at the top level of `scripts/`diff --git a/skills/ppt-master/scripts/update_repo.py b/skills/ppt-master/scripts/update_repo.pynew file mode 100644index 00000000..237992a6--- /dev/null+++ b/skills/ppt-master/scripts/update_repo.py@@ -0,0 +1,142 @@+#!/usr/bin/env python3+"""Update the repository and sync Python dependencies when needed.++Usage:+ python3 skills/ppt-master/scripts/update_repo.py+ python3 skills/ppt-master/scripts/update_repo.py --skip-pip+"""++from __future__ import annotations++import argparse+import hashlib+import shutil+import subprocess+import sys+from pathlib import Path+++TOOLS_DIR = Path(__file__).resolve().parent+SKILL_DIR = TOOLS_DIR.parent+REPO_ROOT = SKILL_DIR.parent.parent+REQUIREMENTS_FILE = REPO_ROOT / "requirements.txt"+++def parse_args() -> argparse.Namespace:+ parser = argparse.ArgumentParser(+ description=(+ "Pull the latest repository changes and sync Python dependencies "+ "only when requirements.txt changes."+ )+ )+ parser.add_argument(+ "--skip-pip",+ action="store_true",+ help="Skip Python dependency sync even if requirements.txt changed.",+ )+ return parser.parse_args()+++def run_command(args: list[str], *, check: bool = True) -> subprocess.CompletedProcess[str]:+ return subprocess.run(+ args,+ cwd=REPO_ROOT,+ check=check,+ capture_output=True,+ text=True,+ encoding="utf-8",+ errors="replace",+ )+++def file_digest(path: Path) -> str | None:+ if not path.exists():+ return None++ digest = hashlib.sha256()+ with path.open("rb") as handle:+ for chunk in iter(lambda: handle.read(8192), b""):+ digest.update(chunk)+ return digest.hexdigest()+++def ensure_git_available() -> None:+ if shutil.which("git") is None:+ raise RuntimeError("Missing executable: git")+++def ensure_clean_tracked_worktree() -> None:+ status = run_command(["git", "status", "--porcelain", "--untracked-files=no"], check=False)+ if status.returncode != 0:+ details = (status.stderr or status.stdout or "").strip()+ raise RuntimeError(details or "Unable to inspect git status.")++ if status.stdout.strip():+ raise RuntimeError(+ "Tracked local changes detected. Please commit or stash them before running the update command."+ )+++def get_head_revision() -> str:+ result = run_command(["git", "rev-parse", "HEAD"])+ return result.stdout.strip()+++def sync_python_dependencies() -> None:+ if not REQUIREMENTS_FILE.exists():+ print("requirements.txt not found; skipping Python dependency sync.")+ return++ print("requirements.txt changed. Syncing Python dependencies...")+ result = run_command([sys.executable, "-m", "pip", "install", "-r", str(REQUIREMENTS_FILE)])+ if result.stdout.strip():+ print(result.stdout.strip())+ if result.stderr.strip():+ print(result.stderr.strip())+++def main() -> int:+ args = parse_args()++ try:+ ensure_git_available()+ ensure_clean_tracked_worktree()++ before_head = get_head_revision()+ before_requirements = file_digest(REQUIREMENTS_FILE)++ print(f"Repository: {REPO_ROOT}")+ pull_result = run_command(["git", "pull", "--ff-only"])+ if pull_result.stdout.strip():+ print(pull_result.stdout.strip())+ if pull_result.stderr.strip():+ print(pull_result.stderr.strip())++ after_head = get_head_revision()+ after_requirements = file_digest(REQUIREMENTS_FILE)++ if before_head == after_head:+ print("Repository is already up to date.")+ else:+ print(f"Updated from {before_head[:7]} to {after_head[:7]}.")++ if args.skip_pip:+ print("Skipped Python dependency sync (--skip-pip).")+ elif before_requirements != after_requirements:+ sync_python_dependencies()+ else:+ print("requirements.txt unchanged. Skipping Python dependency sync.")++ print("Note: system dependencies such as Node.js and Pandoc still need to be installed manually.")+ return 0+ except subprocess.CalledProcessError as exc:+ details = (exc.stderr or exc.stdout or "").strip()+ print(details or "Command failed.", file=sys.stderr)+ return exc.returncode or 1+ except RuntimeError as exc:+ print(str(exc), file=sys.stderr)+ return 1+++if __name__ == "__main__":+ raise SystemExit(main())