Documentation
¶
Overview ¶
Package github interacts with the GitHub API to search and fetch repositories.
Index ¶
- Constants
- func GetAPIBaseURL(repo config.Repo) string
- func GetTokenForRepo(repo config.Repo) string
- func ParseBrowserURL(url string) (repoURL, branch, subDir, skillName string, ok bool)
- func ParseRepoURL(url string) (owner, repo string, err error)
- type Client
- type Content
- type RepoInfo
- type Repository
- type SearchResult
Constants ¶
const ( // SkillTopic is the default topic to search for agent skills SkillTopic = "agent-skill" // APIURL is the GitHub API endpoint for searching repositories APIURL = "https://api.github.com/search/repositories" )
Variables ¶
This section is empty.
Functions ¶
func GetAPIBaseURL ¶ added in v1.7.6
GetAPIBaseURL returns the API base URL for a repo. Defaults to "https://api.github.com" if not specified.
func GetTokenForRepo ¶ added in v1.7.6
GetTokenForRepo returns the best available token for a given repo config. Priority: per-repo token → environment variable → empty string.
func ParseBrowserURL ¶ added in v1.3.3
ParseBrowserURL parses a GitHub browser URL and extracts components Input: https://github.com/owner/repo/tree/branch/path/to/skill Returns: repoURL, branch, subDir, skillName, ok
func ParseRepoURL ¶ added in v1.4.0
ParseRepoURL parses a GitHub repository URL to extract owner and repo name Supports formats: - owner/repo - https://github.com/owner/repo - https://github.com/owner/repo.git - git@github.com:owner/repo.git
Types ¶
type Client ¶ added in v1.7.8
type Client struct {
// contains filtered or unexported fields
}
Client provides GitHub API access
type Content ¶
type Content struct {
Name string `json:"name"`
Type string `json:"type"`
HTMLURL string `json:"html_url"`
}
Content represents a file or directory in a GitHub repository
type RepoInfo ¶ added in v1.7.8
type RepoInfo struct {
Stars int
Forks int
IsOrg bool
HasLicense bool
OwnerAge int // years since account creation
}
RepoInfo holds enriched repository metadata for scoring
type Repository ¶
type Repository struct {
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description"`
HTMLURL string `json:"html_url"`
StargazersCount int `json:"stargazers_count"`
CloneURL string `json:"clone_url"`
UpdatedAt time.Time `json:"updated_at"`
Source string `json:"-"` // Source name (e.g., "community", "anthropics")
Owner struct {
Login string `json:"login"`
} `json:"owner"`
}
Repository represents a GitHub repository structure
func FetchRepoDetails ¶ added in v0.7.2
func FetchRepoDetails(owner, repo string) (*Repository, error)
FetchRepoDetails fetches details of a GitHub repository including star count
func SearchDir ¶
func SearchDir(owner, repo, path string) ([]Repository, error)
SearchDir searches a specific directory in a GitHub repository for subdirectories (skills)
func SearchTopic ¶
func SearchTopic(topic, keyword string) ([]Repository, error)
SearchTopic searches GitHub for repositories with a specific topic and keyword
type SearchResult ¶
type SearchResult struct {
TotalCount int `json:"total_count"`
Items []Repository `json:"items"`
}
SearchResult represents the response from GitHub search API