Documentation
¶
Overview ¶
Package github is a slim GitHub REST client for the skills.sh / `adept skill install` flow. We avoid the official go-github dep — we only need three operations:
- Resolve a branch/tag to a commit SHA (skill install)
- Fetch a tarball of the repo at a specific SHA (skill install)
- Read repo metadata (stars, license, default) (skill info)
All calls are unauthenticated by default. When $GITHUB_TOKEN is set we include it as a bearer header so private repos and higher rate limits just work without explicit adept config.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractSkillDir ¶
func ExtractSkillDir(r io.Reader, skillName string, candidatePaths []string) (files map[string][]byte, matchedPath string, err error)
ExtractSkillDir scans a gzipped GitHub tarball for the requested skill directory. GitHub wraps the repo content in a top-level directory like `vercel-labs-skills-abc1234/`, so we strip the first segment and then match against either:
- <skillPath>/... (when skillPath is the full path inside the repo)
- <skillName>/... (legacy)
- skills/<skillName>/... (common convention in catalog repos)
The first matching layout wins. The function returns a map keyed by path-inside-skill (e.g. "SKILL.md", "references/api.md") so the caller can write files relative to <project>/.adeptability/skills/<id>/.
Types ¶
type Client ¶
type Client interface {
// ResolveRef returns the commit SHA the branch/tag/full-sha currently
// points to. An empty ref defaults to the repo's default branch.
ResolveRef(ctx context.Context, owner, repo, ref string) (sha string, err error)
// FetchTarball returns the gzipped tar payload of the repo at sha.
// The caller is responsible for closing the returned ReadCloser.
FetchTarball(ctx context.Context, owner, repo, sha string) (io.ReadCloser, error)
// RepoInfo returns metadata used by `skill info`.
RepoInfo(ctx context.Context, owner, repo string) (RepoMeta, error)
}
Client wraps the small surface of the GitHub REST API we need.
type RepoMeta ¶
type RepoMeta struct {
FullName string `json:"full_name"`
HTMLURL string `json:"html_url"`
Description string `json:"description"`
DefaultBranch string `json:"default_branch"`
Stars int `json:"stargazers_count"`
Forks int `json:"forks_count"`
OpenIssues int `json:"open_issues_count"`
License string `json:"-"`
PushedAt time.Time `json:"pushed_at"`
}
RepoMeta is the subset of GitHub repo metadata adept surfaces in `skill info` / `skill install` previews. All fields are best-effort — a missing field stays at its zero value rather than erroring the whole request.