SkillKit.Kit.GitHub.Cache (SkillKit v0.1.0)

Copy Markdown View Source

Manages the local disk cache for downloaded GitHub repositories.

Tarballs are extracted to {cache_dir}/{owner}/{repo}/{ref}/. The top-level directory in the tarball (GitHub adds a owner-repo-sha/ prefix) is stripped so the contents are placed directly in the cache path.

Summary

Functions

exists?(ref, cache_dir)

@spec exists?(SkillKit.Kit.GitHub.Ref.t(), Path.t()) :: boolean()

extract(tarball_data, ref, cache_dir)

@spec extract(binary(), SkillKit.Kit.GitHub.Ref.t(), Path.t()) ::
  {:ok, Path.t()} | {:error, term()}

kit_dir(ref, cache_dir)

@spec kit_dir(SkillKit.Kit.GitHub.Ref.t(), Path.t()) :: Path.t()

list_cached(cache_dir)

@spec list_cached(Path.t()) :: [
  %{owner: String.t(), repo: String.t(), ref: String.t()}
]

remove(ref, cache_dir)

@spec remove(SkillKit.Kit.GitHub.Ref.t(), Path.t()) :: :ok