skillscheck

package
v1.0.42 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package skillscheck verifies that the locally installed lark-cli skills are in sync with the running binary version, by comparing the current binary version against skills-state.json. On mismatch it stores a notice for injection into JSON envelopes via output.PendingNotice.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnreadableState = errors.New("skills state is unreadable")

Functions

func Init

func Init(currentVersion string)

Init runs the synchronous skills version check. Stores a StaleNotice when the local skills state records a version that does not match currentVersion. Safe to call from cmd/root.go before rootCmd.Execute(); zero network, zero subprocess — only a local state file read.

Skip rules: see shouldSkip (CI envs, DEV builds, non-release semver, LARKSUITE_CLI_NO_SKILLS_NOTIFIER opt-out).

func ParseSkillsList added in v1.0.35

func ParseSkillsList(text string) []string

func ReadSyncedVersion added in v1.0.35

func ReadSyncedVersion() (string, bool)

func SetPending

func SetPending(n *StaleNotice)

SetPending stores the stale notice for consumption by output decorators. Pass nil to clear.

func WriteState added in v1.0.35

func WriteState(state SkillsState) error

Types

type SkillsRunner added in v1.0.35

type SkillsRunner interface {
	ListOfficialSkills() *selfupdate.NpmResult
	ListGlobalSkills() *selfupdate.NpmResult
	InstallSkill(nameList []string) *selfupdate.NpmResult
	InstallAllSkills() *selfupdate.NpmResult
}

type SkillsState added in v1.0.35

type SkillsState struct {
	Version              string   `json:"version"`
	OfficialSkills       []string `json:"official_skills"`
	UpdatedSkills        []string `json:"updated_skills"`
	AddedOfficialSkills  []string `json:"added_official_skills"`
	SkippedDeletedSkills []string `json:"skipped_deleted_skills"`
	UpdatedAt            string   `json:"updated_at"`
}

func ReadState added in v1.0.35

func ReadState() (*SkillsState, bool, error)

type StaleNotice

type StaleNotice struct {
	Current string `json:"current"`
	Target  string `json:"target"`
}

StaleNotice signals that the locally synced skills version does not match the running binary. Current is the last successfully synced version (always non-empty — Init no longer emits a notice on cold start). Target is the running binary version. Mirrors internal/update.UpdateInfo's pending-notice pattern.

func GetPending

func GetPending() *StaleNotice

GetPending returns the pending stale notice, or nil.

func (*StaleNotice) Message

func (s *StaleNotice) Message() string

Message returns a single-line, AI-agent-parseable description of the drift plus the canonical fix command. Mirrors internal/update.UpdateInfo.Message in style ("..., run: lark-cli update" suffix). Current is guaranteed non-empty because Init only emits a StaleNotice for the drift case.

type SyncInput added in v1.0.35

type SyncInput struct {
	Version        string
	OfficialSkills []string
	LocalSkills    []string
	PreviousState  *SkillsState
	StateReadable  bool
	Force          bool
}

type SyncOptions added in v1.0.35

type SyncOptions struct {
	Version string
	Force   bool
	Runner  SkillsRunner
	Now     func() time.Time
}

type SyncPlan added in v1.0.35

type SyncPlan struct {
	Version        string
	OfficialSkills []string
	ToUpdate       []string
	Added          []string
	SkippedDeleted []string
}

func PlanSync added in v1.0.35

func PlanSync(input SyncInput) SyncPlan

type SyncResult added in v1.0.35

type SyncResult struct {
	Action         string
	Official       []string
	Updated        []string
	Added          []string
	SkippedDeleted []string
	Failed         []string
	Err            error
	Detail         string
	Force          bool
}

func SyncSkills added in v1.0.35

func SyncSkills(opts SyncOptions) *SyncResult

Jump to

Keyboard shortcuts

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