Documentation
¶
Index ¶
- type CatalogSkill
- type CatalogSnapshot
- type DB
- func (db *DB) Close() error
- func (db *DB) GetPendingUpdate(skillName string) (*PendingUpdate, error)
- func (db *DB) GetSkillPoll(skillName string) (*SkillPollRecord, error)
- func (db *DB) InsertUpdate(skillName, fromVersion, toVersion, source string) error
- func (db *DB) ListPendingUpdates() ([]PendingUpdate, error)
- func (db *DB) MarkUpdateAccepted(skillName string) error
- func (db *DB) MarkUpdateRejected(skillName string) error
- func (db *DB) MarkUpdateSummarized(skillName, summaryStatus, summaryPath string) error
- func (db *DB) Rebuild(snap CatalogSnapshot) error
- func (db *DB) RecordInvocation(inv Invocation) error
- func (db *DB) RecordInvocations(invs []Invocation) (int, error)
- func (db *DB) RefreshSkillPollCheckedAt(skillName string) error
- func (db *DB) SyncCatalog(snap CatalogSnapshot) error
- func (db *DB) UpsertSkillPoll(skillName, commit, etag string) error
- func (db *DB) UsageMatrix() ([]UsageCell, error)
- type Invocation
- type PendingUpdate
- type SkillPollRecord
- type UsageCell
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatalogSkill ¶
type CatalogSnapshot ¶
type CatalogSnapshot struct {
Skills []CatalogSkill
}
type DB ¶
func (*DB) GetPendingUpdate ¶
func (db *DB) GetPendingUpdate(skillName string) (*PendingUpdate, error)
GetPendingUpdate returns a single pending update by skill name.
func (*DB) GetSkillPoll ¶
func (db *DB) GetSkillPoll(skillName string) (*SkillPollRecord, error)
GetSkillPoll retrieves the cached poll record for a skill. Returns nil if the skill has no poll record.
func (*DB) InsertUpdate ¶
InsertUpdate records a new or updated pending update.
func (*DB) ListPendingUpdates ¶
func (db *DB) ListPendingUpdates() ([]PendingUpdate, error)
ListPendingUpdates returns all updates with status='pending'.
func (*DB) MarkUpdateAccepted ¶
MarkUpdateAccepted marks a pending update as accepted, removing it from the list.
func (*DB) MarkUpdateRejected ¶
MarkUpdateRejected marks a pending update as rejected, removing it from the pending list. The row is retained (status='rejected') so the rejected version is recorded rather than silently re-detected.
func (*DB) MarkUpdateSummarized ¶
MarkUpdateSummarized records the advisory summary cache path for a pending update.
func (*DB) Rebuild ¶
func (db *DB) Rebuild(snap CatalogSnapshot) error
Rebuild wipes derived-from-library tables (skills, requirement_checks) and repopulates skills from the snapshot. Per ownership rules, user-owned and machine-local-but-not-derived tables (projects, installs, invocations, detected, updates) are preserved.
func (*DB) RecordInvocation ¶
func (db *DB) RecordInvocation(inv Invocation) error
RecordInvocation records a single invocation, merging on tool_use_id (see insertInvocationSQL). An empty InvokedAt is defaulted to the current UTC time.
func (*DB) RecordInvocations ¶
func (db *DB) RecordInvocations(invs []Invocation) (int, error)
RecordInvocations records a batch of invocations in a single transaction. Records with an empty SkillName are skipped rather than aborting the batch, so a malformed event in an OTEL payload does not discard the valid ones. Returns the number of records processed (an upsert that merges into an existing row still counts as processed).
func (*DB) RefreshSkillPollCheckedAt ¶
RefreshSkillPollCheckedAt updates only the last_checked_at timestamp for a skill, preserving the existing commit and etag. Used when polling completes but staging fails, or when a 304 Not Modified is received.
func (*DB) SyncCatalog ¶
func (db *DB) SyncCatalog(snap CatalogSnapshot) error
func (*DB) UpsertSkillPoll ¶
UpsertSkillPoll inserts or updates the poll record for a skill.
func (*DB) UsageMatrix ¶
UsageMatrix returns invocation counts grouped by skill, project, and harness, ordered deterministically so callers and tests see stable output. This backs the Matrix view (skill × project × harness × count).
type Invocation ¶
type Invocation struct {
SkillName string
ProjectSlug string // empty when the source cannot attribute a project (e.g. OTEL)
Harness string
Trigger string // user-initiated | proactive | nested; empty when unknown
InvokedAt string // RFC3339 timestamp; defaulted to now when empty
Source string // otel | hook | watcher | manual
ToolUseID string // correlation id shared by the OTEL tool_result event and the hook
}
Invocation is a single recorded skill activation, sourced from Claude Code OTEL events, a PreToolUse hook, a watcher, or a manual entry.
type PendingUpdate ¶
type PendingUpdate struct {
SkillName string
FromVersion string
ToVersion string
Source string
DetectedAt string // RFC3339 timestamp
SummaryStatus string
SummaryPath string
Status string
}
PendingUpdate holds info about a staged update waiting for review.