Documentation
¶
Index ¶
- func RegisterRoutes(api huma.API, store *Store)
- type ActivationSummary
- type AgentDailyCount
- type DailyCount
- type Event
- type OverviewData
- type SecuritySummary
- type SkillAnalytics
- type SkillsQuery
- type Store
- func (s *Store) CleanupOldEvents(ctx context.Context, retentionDays int) (int64, error)
- func (s *Store) DismissSkill(ctx context.Context, name string) error
- func (s *Store) GetActivations(ctx context.Context, skillName string, days int) (*ActivationSummary, error)
- func (s *Store) GetAllTags(ctx context.Context) ([]string, error)
- func (s *Store) GetOverview(ctx context.Context, days int) (*OverviewData, error)
- func (s *Store) GetSkillTimeSeries(ctx context.Context, skillName string, days int) ([]AgentDailyCount, error)
- func (s *Store) GetSkillsAnalytics(ctx context.Context, days int, opts SkillsQuery) ([]SkillAnalytics, int, error)
- func (s *Store) GetTimeSeries(ctx context.Context, days int) ([]DailyCount, error)
- func (s *Store) GetUnregisteredSkills(ctx context.Context, days int) ([]UnregisteredSkill, error)
- func (s *Store) Insert(ctx context.Context, e Event) error
- type UnregisteredSkill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes wires up all analytics-related HTTP endpoints onto the provided Huma API.
Types ¶
type ActivationSummary ¶
type ActivationSummary struct {
TotalCount int `json:"total_count"`
UniqueDevs int `json:"unique_devs"`
LastTriggered *time.Time `json:"last_triggered"`
ByAgent map[string]int `json:"by_agent"`
}
ActivationSummary summarises activations for a specific skill over a time window.
type AgentDailyCount ¶
AgentDailyCount holds per-agent activation counts for a single day.
func (AgentDailyCount) MarshalJSON ¶
func (a AgentDailyCount) MarshalJSON() ([]byte, error)
MarshalJSON produces a flat object: {"date":"2026-05-20","claude-code":5,"cursor":2}
type DailyCount ¶
DailyCount holds the activation count for a single day.
type Event ¶
type Event struct {
SkillName string `json:"skill_name"`
Agent string `json:"agent"`
TriggerType string `json:"trigger_type"`
ProjectHash string `json:"project_hash"`
DeveloperHash string `json:"developer_hash"`
}
Event represents a single skill activation telemetry record.
type OverviewData ¶
type OverviewData struct {
TotalSkills int `json:"total_skills"`
ActiveSkills int `json:"active_skills"`
TotalActivations int `json:"total_activations"`
UnreviewedSkills int `json:"unreviewed_skills"`
Security SecuritySummary `json:"security"`
}
OverviewData holds top-level KPI metrics for the analytics overview strip.
type SecuritySummary ¶
type SecuritySummary struct {
Clean int `json:"clean"`
Warning int `json:"warning"`
Critical int `json:"critical"`
}
SecuritySummary aggregates skill security statuses. The scanner produces "warn" and "high" status strings; both are counted under the Warning field. "critical" maps to Critical. Everything else (including "clean", "info", and skills with no scan results) maps to Clean.
type SkillAnalytics ¶
type SkillAnalytics struct {
Name string `json:"name"`
Description string `json:"description"`
Tags []string `json:"tags"`
Author string `json:"author"`
SpecCompliance string `json:"spec_compliance"`
Activations int `json:"activations"`
UniqueDevs int `json:"unique_devs"`
LastTriggered *time.Time `json:"last_triggered"`
SecurityStatus string `json:"security_status"`
ReviewedAt *time.Time `json:"reviewed_at"`
LatestVersion int `json:"latest_version"`
UpdatedAt time.Time `json:"updated_at"`
}
SkillAnalytics holds per-skill analytics data for the table view.
type SkillsQuery ¶ added in v0.4.0
type SkillsQuery struct {
Limit int
Offset int
Sort string // "activations" (default) | "name" | "updated"
Query string // case-insensitive substring on name/description
Tag string // frontmatter tag membership
}
GetSkillsAnalytics returns per-skill analytics for all skills over the last `days` days, ordered by activation count descending. SkillsQuery holds optional list filters/pagination for GetSkillsAnalytics.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles Postgres persistence for skill_events.
func (*Store) CleanupOldEvents ¶ added in v0.7.0
CleanupOldEvents deletes events older than retentionDays and returns the number of rows removed. Pass 0 to disable (caller should check before calling).
func (*Store) DismissSkill ¶
DismissSkill inserts a name into dismissed_skills. Idempotent.
func (*Store) GetActivations ¶
func (s *Store) GetActivations(ctx context.Context, skillName string, days int) (*ActivationSummary, error)
GetActivations returns an ActivationSummary for the given skill over the last `days` days. Returns a zero-value summary (no error) when no events exist.
func (*Store) GetAllTags ¶ added in v0.4.0
GetAllTags returns the distinct, sorted set of tags across all skills.
func (*Store) GetOverview ¶
GetOverview returns aggregate KPI data covering the last `days` days.
func (*Store) GetSkillTimeSeries ¶
func (s *Store) GetSkillTimeSeries(ctx context.Context, skillName string, days int) ([]AgentDailyCount, error)
GetSkillTimeSeries returns daily per-agent activation counts for a specific skill over the last `days` days. Days with zero activations are included.
func (*Store) GetSkillsAnalytics ¶
func (s *Store) GetSkillsAnalytics(ctx context.Context, days int, opts SkillsQuery) ([]SkillAnalytics, int, error)
func (*Store) GetTimeSeries ¶
GetTimeSeries returns daily activation counts for the last `days` days. Days with zero activations are included (filled with 0).
func (*Store) GetUnregisteredSkills ¶
GetUnregisteredSkills returns skill names from events that don't exist in the skills table or dismissed_skills table, with activation stats.
type UnregisteredSkill ¶
type UnregisteredSkill struct {
Name string `json:"name"`
Activations int `json:"activations"`
UniqueDevs int `json:"unique_devs"`
LastTriggered *time.Time `json:"last_triggered"`
FirstSeen *time.Time `json:"first_seen"`
}
UnregisteredSkill represents a skill name found in events but not in the registry.