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

GithubArchiveSpec

A GitHub archive to download.

Functions

download_github_archive_zip(spec, *, dest_zip[, token])

Download a GitHub repo archive ZIP.

extract_zip(zip_path, dest_dir)

Extract a ZIP and return the inferred root folder.

ingest_github_archive_zip(repo, *[, ref, kind, ...])

Download+ingest a GitHub archive ZIP into MinIO/S3.

Module Contents

class ooai_skills.ingest_zip.GithubArchiveSpec

A GitHub archive to download.

Parameters:
  • repoowner/name.

  • ref – Branch/tag name or commit-ish.

  • kind – One of heads or tags to construct the archive URL.

Notes

GitHub’s archive URL structure differs for heads vs tags.

repo: str
ref: str = 'main'
kind: str = 'heads'
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:

pathlib.Path

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:
Returns:

Root folder path (best-effort).

Raises:
Return type:

pathlib.Path

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) – heads or tags.

  • 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