skillmarket

package
v0.0.0-...-8acab51 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDBFilename = "blue.db"

	DefaultPageSize    = 20
	DefaultSearchLimit = 100

	DefaultDiscoverTimeout     = 8 * time.Minute
	DefaultDiscoverStepTimeout = 90 * time.Second

	RiskLow      = "low"
	RiskMedium   = "medium"
	RiskHigh     = "high"
	RiskCritical = "critical"

	BadgeGreen  = "green"
	BadgeYellow = "yellow"
	BadgeRed    = "red"

	InstallTypeBuiltinCommands = "builtin_commands"
	InstallTypeRawSkill        = "raw_skill"
	InstallTypeGitRepo         = "git_repo"
	InstallTypeSourceArchive   = "source_archive"
	InstallTypeScriptPackage   = "script_package"
	InstallTypeBinaryPackage   = "binary_package"
	InstallTypeManualExternal  = "manual_external"

	ArtifactKindOpenSource   = "open_source"
	ArtifactKindClosedBinary = "closed_binary"
	ArtifactKindMixed        = "mixed"
	ArtifactKindUnknown      = "unknown"

	VulnerabilityStatusNone          = "none"
	VulnerabilityStatusUnknown       = "unknown"
	VulnerabilityStatusSuspected     = "suspected"
	VulnerabilityStatusDetected      = "detected"
	VulnerabilityStatusNotApplicable = "not_applicable"

	ScannerVersion = "skillmarket-detector-v2"

	GitHubAwesomeSkillsSourceID    = "github-awesome-skills"
	GitHubAwesomeSkillsSourceName  = "GitHub Awesome Skills"
	GitHubAwesomeSkillsSourceGroup = "github-awesome-skills"
)

Variables

This section is empty.

Functions

func DefaultDBPath

func DefaultDBPath(dataDir string) string

func MarketplaceCategoryOrder

func MarketplaceCategoryOrder(category string) int

func NormalizeMarketplaceCategory

func NormalizeMarketplaceCategory(raw, content string, tags []string) string

func NormalizeSkillID

func NormalizeSkillID(raw string) string

NormalizeSkillID converts a human-provided skill identifier into a safe slug.

func ValidateSkillID

func ValidateSkillID(raw string) (string, error)

ValidateSkillID rejects identifiers that could escape installation roots or create ambiguous paths.

Types

type AdditionalSeed

type AdditionalSeed struct {
	ID          string `yaml:"id" json:"id"`
	Type        string `yaml:"type" json:"type"`
	Value       string `yaml:"value" json:"value"`
	DisplayName string `yaml:"display_name" json:"display_name"`
	SourceGroup string `yaml:"source_group" json:"source_group"`
	OriginName  string `yaml:"origin_name" json:"origin_name"`
}

type AvailableUpdate

type AvailableUpdate struct {
	SkillID         string    `json:"skill_id"`
	CurrentVersion  string    `json:"current_version"`
	LatestVersion   string    `json:"latest_version"`
	CurrentChecksum string    `json:"current_checksum"`
	LatestChecksum  string    `json:"latest_checksum"`
	Action          string    `json:"action"`
	CheckedAt       time.Time `json:"checked_at"`
}

type Classifier

type Classifier interface {
	Classify(ctx context.Context, content string) (string, string, error)
}

type Config

type Config struct {
	Enabled                    bool
	DBPath                     string
	GitHubToken                string
	GitHubAPIBaseURL           string
	ClawHubBaseURL             string
	ClawHubMirrorBaseURLs      []string
	TencentSkillHubAPIBaseURL  string
	SkillHubBaseURL            string
	SkillHubAPIKey             string
	LLMSkillsBaseURL           string
	DiscoveryPageURLs          []string
	CrawlIncrementalInterval   time.Duration
	CrawlFullInterval          time.Duration
	UpdateCheckInterval        time.Duration
	TelemetryRollupInterval    time.Duration
	SemanticRatio              float64
	SearchCandidateLimit       int
	CacheRoot                  string
	ActiveSkillsDir            string
	CuratedConfigPath          string
	CuratedConfigURLs          []string
	LightmakePageSize          int
	GitHubSearchPageSize       int
	IngestBatchSize            int
	HTMLCatalogCrawlBatchPages int
	HTMLCatalogCrawlMaxPages   int
	SeedPageMaxConcurrency     int
	DiscoverTimeout            time.Duration
	DiscoverStepTimeout        time.Duration
}

func DefaultConfig

func DefaultConfig(dataDir, activeSkillsDir string) Config

type CrawlRun

type CrawlRun struct {
	ID         string    `json:"id"`
	SourceID   string    `json:"source_id"`
	Status     string    `json:"status"`
	Discovered int       `json:"discovered"`
	Updated    int       `json:"updated"`
	Failed     int       `json:"failed"`
	StartedAt  time.Time `json:"started_at"`
	FinishedAt time.Time `json:"finished_at"`
	ErrorText  string    `json:"error_text,omitempty"`
}

type CuratedConfig

type CuratedConfig struct {
	Version         string           `yaml:"version" json:"version"`
	Featured        []CurationEntry  `yaml:"featured" json:"featured"`
	Boosts          []CurationEntry  `yaml:"boosts" json:"boosts"`
	Hidden          []string         `yaml:"hidden" json:"hidden"`
	AdditionalSeeds []AdditionalSeed `yaml:"additional_seeds" json:"additional_seeds"`
}

type CurationEntry

type CurationEntry struct {
	SkillID string  `yaml:"skill_id" json:"skill_id"`
	Rank    int     `yaml:"rank" json:"rank,omitempty"`
	Label   string  `yaml:"label" json:"label,omitempty"`
	Reason  string  `yaml:"reason" json:"reason,omitempty"`
	Weight  float64 `yaml:"weight" json:"weight,omitempty"`
}

type CurationSyncState

type CurationSyncState struct {
	ID            string    `json:"id"`
	SourceURL     string    `json:"source_url,omitempty"`
	Checksum      string    `json:"checksum,omitempty"`
	LastSuccessAt time.Time `json:"last_success_at"`
	LastError     string    `json:"last_error,omitempty"`
	UpdatedAt     time.Time `json:"updated_at"`
}

type DiscoverProgressEvent

type DiscoverProgressEvent struct {
	Running           bool                   `json:"running"`
	StartedAt         time.Time              `json:"started_at,omitempty"`
	FinishedAt        time.Time              `json:"finished_at,omitempty"`
	LastError         string                 `json:"last_error,omitempty"`
	TotalSources      int                    `json:"total_sources,omitempty"`
	ProcessedSources  int                    `json:"processed_sources,omitempty"`
	CurrentSourceID   string                 `json:"current_source_id,omitempty"`
	CurrentSourceName string                 `json:"current_source_name,omitempty"`
	SourceResults     []DiscoverSourceResult `json:"source_results,omitempty"`
	Result            *DiscoverResult        `json:"result,omitempty"`
	BatchInserted     int                    `json:"batch_inserted,omitempty"`
	BatchUpdated      int                    `json:"batch_updated,omitempty"`
	BatchFailed       int                    `json:"batch_failed,omitempty"`
	Phase             string                 `json:"phase,omitempty"`
}

type DiscoverResult

type DiscoverResult struct {
	SourcesProcessed int                    `json:"sources_processed"`
	Discovered       int                    `json:"discovered"`
	Updated          int                    `json:"updated"`
	Failed           int                    `json:"failed"`
	SourceResults    []DiscoverSourceResult `json:"source_results,omitempty"`
}

type DiscoverSourceResult

type DiscoverSourceResult struct {
	SourceID   string   `json:"source_id"`
	Status     string   `json:"status"`
	Partial    bool     `json:"partial,omitempty"`
	Discovered int      `json:"discovered"`
	Updated    int      `json:"updated"`
	Failed     int      `json:"failed"`
	Warnings   []string `json:"warnings,omitempty"`
	Pages      int      `json:"pages,omitempty"`
	Requests   int      `json:"requests,omitempty"`
}

type DiscoverStatus

type DiscoverStatus struct {
	Running           bool                   `json:"running"`
	StartedAt         time.Time              `json:"started_at,omitempty"`
	FinishedAt        time.Time              `json:"finished_at,omitempty"`
	LastError         string                 `json:"last_error,omitempty"`
	TotalSources      int                    `json:"total_sources,omitempty"`
	ProcessedSources  int                    `json:"processed_sources,omitempty"`
	CurrentSourceID   string                 `json:"current_source_id,omitempty"`
	CurrentSourceName string                 `json:"current_source_name,omitempty"`
	SourceResults     []DiscoverSourceResult `json:"source_results,omitempty"`
	Result            *DiscoverResult        `json:"result,omitempty"`
}

type EmbeddingProgressEvent

type EmbeddingProgressEvent struct {
	Running          bool      `json:"running"`
	StartedAt        time.Time `json:"started_at,omitempty"`
	FinishedAt       time.Time `json:"finished_at,omitempty"`
	LastError        string    `json:"last_error,omitempty"`
	TotalSkills      int       `json:"total_skills,omitempty"`
	ProcessedSkills  int       `json:"processed_skills,omitempty"`
	EmbeddedSkills   int       `json:"embedded_skills,omitempty"`
	FailedSkills     int       `json:"failed_skills,omitempty"`
	CurrentSkillID   string    `json:"current_skill_id,omitempty"`
	CurrentSkillName string    `json:"current_skill_name,omitempty"`
	Phase            string    `json:"phase,omitempty"`
}

type EmbeddingStatus

type EmbeddingStatus struct {
	Running          bool      `json:"running"`
	StartedAt        time.Time `json:"started_at,omitempty"`
	FinishedAt       time.Time `json:"finished_at,omitempty"`
	LastError        string    `json:"last_error,omitempty"`
	TotalSkills      int       `json:"total_skills,omitempty"`
	ProcessedSkills  int       `json:"processed_skills,omitempty"`
	EmbeddedSkills   int       `json:"embedded_skills,omitempty"`
	FailedSkills     int       `json:"failed_skills,omitempty"`
	CurrentSkillID   string    `json:"current_skill_id,omitempty"`
	CurrentSkillName string    `json:"current_skill_name,omitempty"`
	Phase            string    `json:"phase,omitempty"`
}

type FilterOption

type FilterOption struct {
	Value string `json:"value"`
	Label string `json:"label"`
	Count int    `json:"count"`
}

type InstallRequest

type InstallRequest struct {
	ID           string `json:"id,omitempty"`
	Version      string `json:"version,omitempty"`
	GitHub       string `json:"github,omitempty"`
	AckRisk      bool   `json:"ack_risk,omitempty"`
	ForceInstall bool   `json:"force_install,omitempty"`
}

type InstallResult

type InstallResult struct {
	SkillID     string          `json:"skill_id"`
	Version     string          `json:"version"`
	Path        string          `json:"path"`
	CachePath   string          `json:"cache_path"`
	Warnings    []string        `json:"warnings,omitempty"`
	Security    *SecurityReport `json:"security,omitempty"`
	InstalledAt time.Time       `json:"installed_at"`
}

type InstallSurface

type InstallSurface struct {
	InstallType         string   `json:"install_type"`
	ArtifactKind        string   `json:"artifact_kind"`
	Installable         bool     `json:"installable"`
	HasBinary           bool     `json:"has_binary"`
	HasScripts          bool     `json:"has_scripts"`
	DependencyManifests []string `json:"dependency_manifests,omitempty"`
}

type InstalledSkill

type InstalledSkill struct {
	SkillID            string    `json:"skill_id"`
	Name               string    `json:"name,omitempty"`
	InstalledVersion   string    `json:"installed_version"`
	Checksum           string    `json:"checksum"`
	SourceURL          string    `json:"source_url,omitempty"`
	Enabled            bool      `json:"enabled"`
	AutoUpdate         bool      `json:"auto_update"`
	InstalledAt        time.Time `json:"installed_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	LastSecurityScore  int       `json:"last_security_score"`
	LatestVersion      string    `json:"latest_version,omitempty"`
	UpdateAvailable    bool      `json:"update_available"`
	LatestChecksum     string    `json:"latest_checksum,omitempty"`
	PendingUpdateState string    `json:"pending_update_state,omitempty"`
	SecurityBadge      string    `json:"security_badge,omitempty"`
}

type LLMClassifier

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

func NewLLMClassifier

func NewLLMClassifier(registry *llm.ProviderRegistry, provider, model string) *LLMClassifier

func (*LLMClassifier) Classify

func (c *LLMClassifier) Classify(ctx context.Context, content string) (string, string, error)

type NoopVulnProvider

type NoopVulnProvider struct{}

func (NoopVulnProvider) Analyze

func (NoopVulnProvider) Analyze(_ context.Context, surface InstallSurface) (string, []string, error)

type Options

type Options struct {
	Config                   Config
	Logger                   *zap.Logger
	Registry                 *skill.Registry
	LocalScanner             *skillstore.LocalSkillScanner
	EmbeddingProvider        embedding.Provider
	HTTPClient               *http.Client
	RemoteReader             RemoteReader
	Scanner                  *Scanner
	DiscoverEventBroadcaster func(eventType string, data any)
}

type RemoteCrawlCheckpoint

type RemoteCrawlCheckpoint struct {
	Pending   []RemoteCrawlQueueItem `json:"pending,omitempty"`
	Seen      []string               `json:"seen,omitempty"`
	Completed int                    `json:"completed,omitempty"`
	CreatedAt string                 `json:"created_at,omitempty"`
}

type RemoteCrawlFailure

type RemoteCrawlFailure struct {
	URL       string `json:"url"`
	Depth     int    `json:"depth"`
	Code      string `json:"code"`
	Message   string `json:"message"`
	Retryable bool   `json:"retryable,omitempty"`
}

type RemoteCrawlPage

type RemoteCrawlPage struct {
	URL                 string   `json:"url"`
	FinalURL            string   `json:"final_url,omitempty"`
	Title               string   `json:"title,omitempty"`
	Depth               int      `json:"depth"`
	StatusCode          int      `json:"status_code,omitempty"`
	Content             string   `json:"content,omitempty"`
	Source              string   `json:"source,omitempty"`
	Warnings            []string `json:"warnings,omitempty"`
	InteractiveRequired bool     `json:"interactive_required,omitempty"`
	Links               []string `json:"links,omitempty"`
	Truncated           bool     `json:"truncated,omitempty"`
	RawHTML             string   `json:"raw_html,omitempty"`
	ContentType         string   `json:"content_type,omitempty"`
}

type RemoteCrawlQueueItem

type RemoteCrawlQueueItem struct {
	URL      string `json:"url"`
	Depth    int    `json:"depth"`
	Attempts int    `json:"attempts,omitempty"`
}

type RemoteCrawlRequest

type RemoteCrawlRequest struct {
	Seeds        []string
	AllowedHosts []string
	Headers      map[string]string
	MaxDepth     int
	MaxPages     int
	MaxRetries   int
	PageMaxChars int
	Checkpoint   *RemoteCrawlCheckpoint
}

type RemoteCrawlResult

type RemoteCrawlResult struct {
	Pages      []RemoteCrawlPage     `json:"pages,omitempty"`
	Failures   []RemoteCrawlFailure  `json:"failures,omitempty"`
	Checkpoint RemoteCrawlCheckpoint `json:"checkpoint"`
	Stats      map[string]int        `json:"stats,omitempty"`
	Warnings   []string              `json:"warnings,omitempty"`
}

type RemoteReadRequest

type RemoteReadRequest struct {
	URL         string
	Headers     map[string]string
	Format      string
	MaxChars    int
	WantRawHTML bool
}

type RemoteReadResult

type RemoteReadResult struct {
	URL                 string   `json:"url,omitempty"`
	FinalURL            string   `json:"final_url,omitempty"`
	Title               string   `json:"title,omitempty"`
	Content             string   `json:"content,omitempty"`
	Source              string   `json:"source,omitempty"`
	Warnings            []string `json:"warnings,omitempty"`
	InteractiveRequired bool     `json:"interactive_required,omitempty"`
	StatusCode          int      `json:"status_code,omitempty"`
	Links               []string `json:"links,omitempty"`
	ContentType         string   `json:"content_type,omitempty"`
	RawHTML             string   `json:"raw_html,omitempty"`
	Truncated           bool     `json:"truncated,omitempty"`
}

type RemoteReader

type RemoteReader interface {
	ReadURL(ctx context.Context, req RemoteReadRequest) (*RemoteReadResult, error)
	CrawlSite(ctx context.Context, req RemoteCrawlRequest) (*RemoteCrawlResult, error)
}

type Scanner

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

func NewScanner

func NewScanner(classifier Classifier) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context, skillID, version, content string, declaredPermissions []string) *SecurityReport

func (*Scanner) ScanWithSurface

func (s *Scanner) ScanWithSurface(ctx context.Context, skillID, version, content string, declaredPermissions []string, surface InstallSurface) *SecurityReport

type SearchQuery

type SearchQuery struct {
	Query               string
	Category            string
	Categories          []string
	Sources             []string
	RiskBadges          []string
	InstallTypes        []string
	ArtifactKinds       []string
	Sort                string
	Page                int
	PageSize            int
	Semantic            bool
	Installable         *bool
	Curated             *bool
	OpenSourceOnly      bool
	HasVulnerabilities  *bool
	HasPromptInjection  *bool
	HasShellInjection   *bool
	HasDataExfiltration *bool
}

type SearchResponse

type SearchResponse struct {
	Skills     []SearchResult `json:"skills"`
	Total      int            `json:"total"`
	Page       int            `json:"page"`
	PageSize   int            `json:"page_size"`
	TotalPages int            `json:"total_pages"`
}

type SearchResult

type SearchResult struct {
	Skill         SkillDocument `json:"skill"`
	Score         float64       `json:"score"`
	KeywordScore  float64       `json:"keyword_score,omitempty"`
	SemanticScore float64       `json:"semantic_score,omitempty"`
	MatchSource   string        `json:"match_source,omitempty"`
}

type SecurityEvidence

type SecurityEvidence struct {
	Type        string `json:"type"`
	Severity    string `json:"severity"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Value       string `json:"value,omitempty"`
}

type SecurityFinding

type SecurityFinding struct {
	Type       string `json:"type"`
	Severity   string `json:"severity"`
	Pattern    string `json:"pattern,omitempty"`
	Message    string `json:"message"`
	Command    string `json:"command,omitempty"`
	Permission string `json:"permission,omitempty"`
}

type SecurityReport

type SecurityReport struct {
	ID                  string             `json:"id"`
	SkillVersionID      string             `json:"skill_version_id"`
	SkillID             string             `json:"skill_id"`
	Version             string             `json:"version"`
	Score               int                `json:"score"`
	RiskLevel           string             `json:"risk_level"`
	SecurityBadge       string             `json:"security_badge"`
	VulnerabilityStatus string             `json:"vulnerability_status"`
	Risks               []SecurityFinding  `json:"risks"`
	Permissions         []string           `json:"permissions"`
	Secrets             []string           `json:"secrets"`
	Vulnerabilities     []string           `json:"vulnerabilities,omitempty"`
	InstallSurface      InstallSurface     `json:"install_surface"`
	Evidence            []SecurityEvidence `json:"evidence,omitempty"`
	HasVulnerabilities  bool               `json:"has_vulnerabilities"`
	HasPromptInjection  bool               `json:"has_prompt_injection"`
	HasShellInjection   bool               `json:"has_shell_injection"`
	HasDataExfiltration bool               `json:"has_data_exfiltration"`
	HasBinary           bool               `json:"has_binary"`
	ScannerVersion      string             `json:"scanner_version"`
	LLMStatus           string             `json:"llm_status"`
	LLMVerdictJSON      string             `json:"llm_verdict_json,omitempty"`
	CreatedAt           time.Time          `json:"created_at"`
	UpdatedAt           time.Time          `json:"updated_at"`
}

type Service

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

func NewService

func NewService(db *sql.DB, opts Options) (*Service, error)

func NewServiceWithDBPath

func NewServiceWithDBPath(dbPath string, opts Options) (*Service, error)

func NewServiceWithReadDB

func NewServiceWithReadDB(writeDB, readDB *sql.DB, opts Options) (*Service, error)

func (*Service) CheckForUpdates

func (s *Service) CheckForUpdates(ctx context.Context, apply bool) ([]AvailableUpdate, error)

func (*Service) Close

func (s *Service) Close() error

func (*Service) Discover

func (s *Service) Discover(ctx context.Context) (*DiscoverResult, error)

func (*Service) Featured

func (s *Service) Featured(ctx context.Context, category, source string, limit int) ([]SkillDocument, error)

func (*Service) Filters

func (s *Service) Filters(ctx context.Context) (*SkillFilters, error)

func (*Service) GetDiscoverStatus

func (s *Service) GetDiscoverStatus() DiscoverStatus

func (*Service) GetEmbeddingStatus

func (s *Service) GetEmbeddingStatus() EmbeddingStatus

func (*Service) GetSecurity

func (s *Service) GetSecurity(ctx context.Context, id, version string) (*SecurityReport, error)

func (*Service) GetSkill

func (s *Service) GetSkill(ctx context.Context, id string) (*SkillDetail, error)

func (*Service) Install

func (s *Service) Install(ctx context.Context, req InstallRequest) (*InstallResult, error)

func (*Service) ListInstalled

func (s *Service) ListInstalled(ctx context.Context) ([]InstalledSkill, error)

func (*Service) ListUpdates

func (s *Service) ListUpdates(ctx context.Context) ([]AvailableUpdate, error)

func (*Service) Search

func (s *Service) Search(ctx context.Context, query SearchQuery) (*SearchResponse, error)

func (*Service) Start

func (s *Service) Start(ctx context.Context)

func (*Service) StartDiscoverAsync

func (s *Service) StartDiscoverAsync() (DiscoverStatus, bool)

func (*Service) Stop

func (s *Service) Stop()

func (*Service) Store

func (s *Service) Store() *Store

func (*Service) Trending

func (s *Service) Trending(ctx context.Context, category string, limit int) ([]SkillDocument, error)

func (*Service) Uninstall

func (s *Service) Uninstall(ctx context.Context, skillID string) error

func (*Service) Update

func (s *Service) Update(ctx context.Context, skillID string) (*InstallResult, error)

type SkillBatchUpsertResult

type SkillBatchUpsertResult struct {
	Inserted int
	Updated  int
	Skipped  int
}

type SkillCuration

type SkillCuration struct {
	ID           string    `json:"id"`
	SkillID      string    `json:"skill_id"`
	Hidden       bool      `json:"hidden"`
	FeaturedRank int       `json:"featured_rank"`
	BoostWeight  float64   `json:"boost_weight"`
	Label        string    `json:"label,omitempty"`
	Reason       string    `json:"reason,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type SkillDetail

type SkillDetail struct {
	Skill     SkillDocument   `json:"skill"`
	Version   *SkillVersion   `json:"version,omitempty"`
	Security  *SecurityReport `json:"security,omitempty"`
	Installed bool            `json:"installed"`
	Enabled   bool            `json:"enabled"`
}

type SkillDocument

type SkillDocument struct {
	ID                  string    `json:"id"`
	Slug                string    `json:"slug"`
	Name                string    `json:"name"`
	Description         string    `json:"description"`
	Author              string    `json:"author,omitempty"`
	RepoURL             string    `json:"repo_url,omitempty"`
	Homepage            string    `json:"homepage,omitempty"`
	DownloadURL         string    `json:"download_url,omitempty"`
	Stars               int       `json:"stars"`
	Downloads           int       `json:"downloads"`
	Tags                []string  `json:"tags,omitempty"`
	Category            string    `json:"category,omitempty"`
	SecurityScore       int       `json:"security_score"`
	Permissions         []string  `json:"permissions,omitempty"`
	LatestVersion       string    `json:"latest_version,omitempty"`
	RiskLevel           string    `json:"risk_level"`
	SecurityBadge       string    `json:"security_badge"`
	Installable         bool      `json:"installable"`
	InstallType         string    `json:"install_type,omitempty"`
	ArtifactKind        string    `json:"artifact_kind,omitempty"`
	VulnerabilityStatus string    `json:"vulnerability_status"`
	HasVulnerabilities  bool      `json:"has_vulnerabilities"`
	HasPromptInjection  bool      `json:"has_prompt_injection"`
	HasShellInjection   bool      `json:"has_shell_injection"`
	HasDataExfiltration bool      `json:"has_data_exfiltration"`
	HasBinary           bool      `json:"has_binary"`
	HasScripts          bool      `json:"has_scripts"`
	PopularityScore     float64   `json:"popularity_score"`
	TrendingScore       float64   `json:"trending_score"`
	ScanStatus          string    `json:"scan_status,omitempty"`
	ContentSHA256       string    `json:"content_sha256,omitempty"`
	Published           bool      `json:"published"`
	SourceID            string    `json:"source_id,omitempty"`
	SourceName          string    `json:"source_name,omitempty"`
	SourceGroup         string    `json:"source_group,omitempty"`
	OriginSourceID      string    `json:"origin_source_id,omitempty"`
	OriginSourceName    string    `json:"origin_source_name,omitempty"`
	OriginSourceURL     string    `json:"origin_source_url,omitempty"`
	SourceType          string    `json:"source_type,omitempty"`
	SkillPath           string    `json:"skill_path,omitempty"`
	SkillContent        string    `json:"skill_content,omitempty"`
	EmbeddingJSON       string    `json:"embedding_json,omitempty"`
	EmbeddingModel      string    `json:"embedding_model,omitempty"`
	CuratedRank         int       `json:"curated_rank,omitempty"`
	CuratedBoost        float64   `json:"curated_boost,omitempty"`
	CuratedLabel        string    `json:"curated_label,omitempty"`
	CuratedReason       string    `json:"curated_reason,omitempty"`
	LastUpdated         time.Time `json:"last_updated"`
	LastCrawledAt       time.Time `json:"last_crawled_at"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
}

type SkillFilters

type SkillFilters struct {
	Categories      []FilterOption `json:"categories"`
	Sources         []FilterOption `json:"sources"`
	RiskBadges      []FilterOption `json:"risk_badges"`
	InstallTypes    []FilterOption `json:"install_types"`
	ArtifactKinds   []FilterOption `json:"artifact_kinds"`
	Installable     map[string]int `json:"installable"`
	SecuritySignals map[string]int `json:"security_signals"`
}

type SkillUpsertRecord

type SkillUpsertRecord struct {
	Doc     *SkillDocument
	Version *SkillVersion
	Report  *SecurityReport
}

type SkillVersion

type SkillVersion struct {
	ID           string    `json:"id"`
	SkillID      string    `json:"skill_id"`
	Version      string    `json:"version"`
	CommitHash   string    `json:"commit_hash,omitempty"`
	SourceURL    string    `json:"source_url,omitempty"`
	Checksum     string    `json:"checksum,omitempty"`
	SkillPath    string    `json:"skill_path,omitempty"`
	RawSkillMD   string    `json:"raw_skill_md,omitempty"`
	ManifestJSON string    `json:"manifest_json,omitempty"`
	ReleasedAt   time.Time `json:"released_at"`
	ScannedAt    time.Time `json:"scanned_at"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type Source

type Source struct {
	ID                 string            `json:"id"`
	Type               string            `json:"type"`
	BaseURL            string            `json:"base_url"`
	DisplayName        string            `json:"display_name,omitempty"`
	SourceGroup        string            `json:"source_group,omitempty"`
	MirrorOf           string            `json:"mirror_of,omitempty"`
	AuthMode           string            `json:"auth_mode,omitempty"`
	Headers            map[string]string `json:"headers,omitempty"`
	Enabled            bool              `json:"enabled"`
	LastCursor         string            `json:"last_cursor,omitempty"`
	ETag               string            `json:"etag,omitempty"`
	RateLimitPerMinute int               `json:"rate_limit_per_minute"`
	Priority           int               `json:"priority"`
	LastSuccessAt      time.Time         `json:"last_success_at"`
	CreatedAt          time.Time         `json:"created_at"`
	UpdatedAt          time.Time         `json:"updated_at"`
}

type SourceSecuritySignals

type SourceSecuritySignals struct {
	Score               *int               `json:"score,omitempty"`
	RiskLevel           string             `json:"risk_level,omitempty"`
	SecurityBadge       string             `json:"security_badge,omitempty"`
	VulnerabilityStatus string             `json:"vulnerability_status,omitempty"`
	Permissions         []string           `json:"permissions,omitempty"`
	Vulnerabilities     []string           `json:"vulnerabilities,omitempty"`
	HasVulnerabilities  bool               `json:"has_vulnerabilities,omitempty"`
	HasPromptInjection  bool               `json:"has_prompt_injection,omitempty"`
	HasShellInjection   bool               `json:"has_shell_injection,omitempty"`
	HasDataExfiltration bool               `json:"has_data_exfiltration,omitempty"`
	HasBinary           bool               `json:"has_binary,omitempty"`
	HasScripts          bool               `json:"has_scripts,omitempty"`
	InstallType         string             `json:"install_type,omitempty"`
	ArtifactKind        string             `json:"artifact_kind,omitempty"`
	Installable         *bool              `json:"installable,omitempty"`
	Findings            []SecurityFinding  `json:"findings,omitempty"`
	Evidence            []SecurityEvidence `json:"evidence,omitempty"`
	ScannerVersion      string             `json:"scanner_version,omitempty"`
}

type Store

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

func NewStore

func NewStore(db *sql.DB) (*Store, error)

func NewStoreWithReadDB

func NewStoreWithReadDB(writeDB, readDB *sql.DB) (*Store, error)

func (*Store) BeginCrawlRun

func (s *Store) BeginCrawlRun(ctx context.Context, sourceID string) (*CrawlRun, error)

func (*Store) CompleteCrawlRun

func (s *Store) CompleteCrawlRun(ctx context.Context, run *CrawlRun) error

func (*Store) GetCurationSyncState

func (s *Store) GetCurationSyncState(ctx context.Context, id string) (*CurationSyncState, error)

func (*Store) GetFilters

func (s *Store) GetFilters(ctx context.Context) (*SkillFilters, error)

func (*Store) GetInstalledSkill

func (s *Store) GetInstalledSkill(ctx context.Context, skillID string) (*InstalledSkill, error)

func (*Store) GetLatestVersion

func (s *Store) GetLatestVersion(ctx context.Context, skillID string) (*SkillVersion, error)

func (*Store) GetSecurityReport

func (s *Store) GetSecurityReport(ctx context.Context, skillID, version string) (*SecurityReport, error)

func (*Store) GetSkill

func (s *Store) GetSkill(ctx context.Context, id string) (*SkillDetail, error)

func (*Store) GetSkillVersion

func (s *Store) GetSkillVersion(ctx context.Context, skillID, version string) (*SkillVersion, error)

func (*Store) ListFeatured

func (s *Store) ListFeatured(ctx context.Context, category string, source string, limit int) ([]SkillDocument, error)

func (*Store) ListFilteredSkills

func (s *Store) ListFilteredSkills(ctx context.Context, query SearchQuery) ([]SkillDocument, error)

func (*Store) ListInstalledSkills

func (s *Store) ListInstalledSkills(ctx context.Context) ([]InstalledSkill, error)

func (*Store) ListSources

func (s *Store) ListSources(ctx context.Context) ([]Source, error)

func (*Store) ListTrending

func (s *Store) ListTrending(ctx context.Context, category string, limit int) ([]SkillDocument, error)

func (*Store) ListUpdates

func (s *Store) ListUpdates(ctx context.Context) ([]AvailableUpdate, error)

func (*Store) RecordTelemetry

func (s *Store) RecordTelemetry(ctx context.Context, skillID, event string) error

func (*Store) RecordUpdateCheck

func (s *Store) RecordUpdateCheck(ctx context.Context, update AvailableUpdate) error

func (*Store) RemoveInstalledSkill

func (s *Store) RemoveInstalledSkill(ctx context.Context, skillID string) error

func (*Store) ReplaceCurations

func (s *Store) ReplaceCurations(ctx context.Context, entries []SkillCuration) error

func (*Store) RerankSemantic

func (s *Store) RerankSemantic(queryVector []float32, results []SearchResult) []SearchResult

func (*Store) Search

func (s *Store) Search(ctx context.Context, query SearchQuery) (*SearchResponse, error)

func (*Store) SearchKeywordCandidates

func (s *Store) SearchKeywordCandidates(ctx context.Context, query SearchQuery) ([]SearchResult, error)

func (*Store) SetInstalledSkill

func (s *Store) SetInstalledSkill(ctx context.Context, installed InstalledSkill) error

func (*Store) SetSourceEnabled

func (s *Store) SetSourceEnabled(ctx context.Context, sourceID string, enabled bool) error

func (*Store) SetSourceEnabledByIdentity

func (s *Store) SetSourceEnabledByIdentity(ctx context.Context, sourceID, sourceType, baseURL string, enabled bool) error

func (*Store) UpdateSkillEmbedding

func (s *Store) UpdateSkillEmbedding(ctx context.Context, skillID, embeddingJSON, embeddingModel string) error

func (*Store) UpsertCurationSyncState

func (s *Store) UpsertCurationSyncState(ctx context.Context, state CurationSyncState) error

func (*Store) UpsertSkill

func (s *Store) UpsertSkill(ctx context.Context, doc *SkillDocument, version *SkillVersion, report *SecurityReport) error

func (*Store) UpsertSkillBatch

func (s *Store) UpsertSkillBatch(ctx context.Context, records []*SkillUpsertRecord) (*SkillBatchUpsertResult, error)

func (*Store) UpsertSource

func (s *Store) UpsertSource(ctx context.Context, source Source) error

type VulnProvider

type VulnProvider interface {
	Analyze(ctx context.Context, surface InstallSurface) (string, []string, error)
}

Jump to

Keyboard shortcuts

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