Documentation
¶
Index ¶
- func APIBaseFromEnv() string
- func DisplayOwners(repos []Repo) []string
- func DisplayTarget(path string) string
- func DisplayTargets(inputs []string) ([]string, error)
- func IsAuditRef(input string) bool
- func IsExplicitAuditRef(input string) bool
- func ParallelWorkers(token string) int
- func RepoSkipReason(err error) string
- func TokenFromEnv() string
- type APIError
- type Client
- func (c *Client) AuthenticatedLogin(ctx context.Context) (string, error)
- func (c *Client) FetchLockfiles(ctx context.Context, repo Repo, opts FetchOptions) ([]string, error)
- func (c *Client) FetchSBOM(ctx context.Context, repo Repo, opts FetchOptions) (string, error)
- func (c *Client) ListAccessibleRepos(ctx context.Context, limit int) ([]Repo, error)
- func (c *Client) ListOwnerRepos(ctx context.Context, owner string, limit int) ([]Repo, error)
- func (c *Client) ResolveRepos(ctx context.Context, inputs []string, limit int) ([]Repo, error)
- func (c *Client) ResolveSources(ctx context.Context, repo Repo, opts FetchOptions) ([]string, error)
- type FetchOptions
- type Repo
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIBaseFromEnv ¶
func APIBaseFromEnv() string
func DisplayOwners ¶
DisplayOwners returns sorted github.com/owner labels for unique repository owners.
func DisplayTarget ¶
DisplayTarget returns a user-facing label for an audit path.
func DisplayTargets ¶
DisplayTargets returns user-facing labels for github subcommand inputs.
func IsAuditRef ¶
IsAuditRef reports whether input resolves to a single repository (not org-wide).
func IsExplicitAuditRef ¶
IsExplicitAuditRef reports whether input is an explicit GitHub repository reference (github:/gh: prefix or github.com URL), not a bare owner/repo slug that could be mistaken for a local path.
func ParallelWorkers ¶
ParallelWorkers returns a safe concurrency limit for GitHub API fetches. Unauthenticated access is capped lower to avoid exhausting the ~60 req/hr budget.
func RepoSkipReason ¶
RepoSkipReason returns a short human-readable reason for repository resolution failure.
func TokenFromEnv ¶
func TokenFromEnv() string
Types ¶
type APIError ¶
type APIError struct {
StatusCode int
Endpoint string
Body string
RateLimited bool
RateLimit rateLimitInfo
}
APIError is returned for non-success GitHub REST responses.
func AsAPIError ¶
func (*APIError) IsRateLimited ¶
type Client ¶
type Client struct {
HTTPClient *http.Client
APIBase string
Token string
UserAgent string
CacheTTL time.Duration
PollEvery time.Duration
}
Client fetches dependency-graph SBOM exports from GitHub.
func (*Client) AuthenticatedLogin ¶
AuthenticatedLogin returns the GitHub username for the configured token.
func (*Client) FetchLockfiles ¶
func (*Client) FetchSBOM ¶
FetchSBOM returns a cached or freshly downloaded SPDX JSON path for the repo.
func (*Client) ListAccessibleRepos ¶
ListAccessibleRepos lists repositories the authenticated token can access.
func (*Client) ListOwnerRepos ¶
ListOwnerRepos lists repositories for a GitHub org or user.
func (*Client) ResolveRepos ¶
ResolveRepos expands github subcommand targets into concrete repositories. With no inputs and an authenticated client, lists repositories the token can access.
func (*Client) ResolveSources ¶
func (c *Client) ResolveSources(ctx context.Context, repo Repo, opts FetchOptions) ([]string, error)
ResolveSources returns local scan paths for a repo: SBOM when available, otherwise lockfiles discovered in the repository tree.
type FetchOptions ¶
type Repo ¶
Repo identifies a GitHub repository for dependency graph SBOM export.
func ParseRepo ¶
ParseRepo parses a single repository reference. Returns false for org-only targets.
func (Repo) DisplayTarget ¶
DisplayTarget returns a schema-less GitHub label for results output.
type Target ¶
Target is a GitHub repository or an org/user to expand into repositories.
func ParseTarget ¶
ParseTarget parses github subcommand inputs:
- https://github.com/owner/repo(.git)
- https://github.com/owner (org or user — lists repositories)
- github.com/owner/repo
- github:owner/repo / gh:owner/repo
- owner/repo
- owner (org or user — lists repositories)