experiments

package
v0.16.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchGuessRequest

type BatchGuessRequest struct {
	URL   string // GitHub URL
	Index int    // Original index for result mapping
}

BatchGuessRequest represents a single repository URL to check

type BatchGuessResult

type BatchGuessResult struct {
	Index  int          // Original index
	Result *GuessResult // Guess result (nil if failed)
	Error  error        // Error if the guess failed
}

BatchGuessResult represents the result of a batch guess operation

type GuessResult

type GuessResult struct {
	NPM *RepositoryInfo `json:"npm,omitempty"`
}

GuessResult contains the result of repository type guessing Only supports npm packages for GitHub repositories

type Guesser

type Guesser struct {
	// contains filtered or unexported fields
}

Guesser handles repository type detection using external APIs

func NewGuesser

func NewGuesser(cacheManager *cache.Manager, logger *zap.Logger) *Guesser

NewGuesser creates a new repository type guesser

func (*Guesser) GuessRepositoryType

func (g *Guesser) GuessRepositoryType(ctx context.Context, githubURL string) (*GuessResult, error)

GuessRepositoryType attempts to determine repository type from a GitHub URL Only handles GitHub URLs matching https://github.com/<author|org>/<repo> Only checks npm packages with @<author|org>/<repo> format

func (*Guesser) GuessRepositoryTypesBatch

func (g *Guesser) GuessRepositoryTypesBatch(ctx context.Context, githubURLs []string) []*GuessResult

GuessRepositoryTypesBatch processes multiple GitHub URLs in parallel with connection pooling Returns results in the same order as input URLs

type NPMPackageInfo

type NPMPackageInfo struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	DistTags    map[string]string      `json:"dist-tags"`
	Versions    map[string]interface{} `json:"versions"`
	Time        map[string]string      `json:"time"`
}

NPMPackageInfo represents npm package information from npm registry API

type RepositoryInfo

type RepositoryInfo struct {
	Type        RepositoryType `json:"type"`
	PackageName string         `json:"package_name,omitempty"`
	Version     string         `json:"version,omitempty"`
	Description string         `json:"description,omitempty"`
	InstallCmd  string         `json:"install_cmd,omitempty"`
	URL         string         `json:"url,omitempty"`
	Exists      bool           `json:"exists"`
	Error       string         `json:"error,omitempty"`
}

RepositoryInfo contains information about a detected repository

func (*RepositoryInfo) CacheKey

func (r *RepositoryInfo) CacheKey(packageName string) string

CacheKey generates a cache key for repository guessing

func (*RepositoryInfo) CacheTTL

func (r *RepositoryInfo) CacheTTL() time.Duration

CacheTTL returns the cache TTL for repository information

type RepositoryType

type RepositoryType string

RepositoryType represents the type of repository detected

const (
	RepoTypeUnknown RepositoryType = "unknown"
	RepoTypeNPM     RepositoryType = "npm"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL