ooai_skills.ingest_zip¶
GitHub ZIP (archive) ingestion for ooai_skills.
- Purpose:
Support “no-git” ingestion by downloading GitHub repository archives (ZIP) and mirroring any discovered skill folders (directories containing
SKILL.md) into MinIO/S3.- Design:
Downloads
https://github.com/<owner>/<repo>/archive/refs/heads/<ref>.zip.Extracts to a local working directory under
work_dir.Discovers skills via
discover_skills().Uploads each skill directory to stable prefixes:
packs/<owner>/<repo>/<skill_relpath>/....Updates
index/skills.json,index/sources.json,index/lint.json.
- Security:
This module only downloads and uploads files; it does not execute any content.
Examples
- ::
>>> >>> # ooai-skills ingest-github-zip openai/skills --ref main
Classes¶
A GitHub archive to download. |
Functions¶
|
Download a GitHub repo archive ZIP. |
|
Extract a ZIP and return the inferred root folder. |
|
Download+ingest a GitHub archive ZIP into MinIO/S3. |
Module Contents¶
- class ooai_skills.ingest_zip.GithubArchiveSpec¶
A GitHub archive to download.
- Parameters:
repo –
owner/name.ref – Branch/tag name or commit-ish.
kind – One of
headsortagsto construct the archive URL.
Notes
GitHub’s archive URL structure differs for heads vs tags.
- ooai_skills.ingest_zip.download_github_archive_zip(spec, *, dest_zip, token=None)¶
Download a GitHub repo archive ZIP.
- Parameters:
spec (GithubArchiveSpec) – GitHub archive spec.
dest_zip (pathlib.Path) – Destination zip path.
token (str | None) – Optional GitHub token to avoid rate limits.
- Returns:
Path to the downloaded ZIP file.
- Raises:
RuntimeError – If the download fails.
- Return type:
Examples
- ::
>>> >>> from pathlib import Path >>> p = download_github_archive_zip(GithubArchiveSpec("openai/skills"), dest_zip=Path("x.zip"))
- ooai_skills.ingest_zip.extract_zip(zip_path, dest_dir)¶
Extract a ZIP and return the inferred root folder.
- Parameters:
zip_path (pathlib.Path) – ZIP file path.
dest_dir (pathlib.Path) – Extraction directory.
- Returns:
Root folder path (best-effort).
- Raises:
FileNotFoundError – If ZIP doesn’t exist.
RuntimeError – If extraction fails.
- Return type:
Examples
- ::
>>> >>> from pathlib import Path >>> extract_zip(Path("repo.zip"), Path("./out"))
- ooai_skills.ingest_zip.ingest_github_archive_zip(repo, *, ref='main', kind='heads', settings, console=None, token=None)¶
Download+ingest a GitHub archive ZIP into MinIO/S3.
- Parameters:
repo (str) –
owner/name.ref (str) – Branch/tag name.
kind (str) –
headsortags.settings (ooai_skills.settings.OoaiSkillsSettings) – Settings.
console (rich.console.Console | None) – Optional Rich console.
token (str | None) – Optional GitHub token.
- Returns:
None.
- Raises:
RuntimeError – If download or upload fails.
- Return type:
None