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 ¶
- Variables
- func Init(currentVersion string)
- func ParseOfficialSkillsIndexJSON(text string) ([]string, error)
- func ParseSkillsList(text string) []string
- func ReadSyncedVersion() (string, bool)
- func SetPending(n *StaleNotice)
- func WriteState(state SkillsState) error
- type Layout
- type SkillsRunner
- type SkillsState
- type StaleNotice
- type SyncInput
- type SyncOptions
- type SyncPlan
- type SyncResult
Constants ¶
This section is empty.
Variables ¶
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, or the last sync could not determine the complete official Skill set. 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 ParseOfficialSkillsIndexJSON ¶ added in v1.0.49
func ParseSkillsList ¶ added in v1.0.35
func ReadSyncedVersion ¶ added in v1.0.35
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 Layout ¶ added in v1.0.88
type Layout string
func EffectiveLayout ¶ added in v1.0.88
func EffectiveLayout(state *SkillsState) Layout
func ParseLayout ¶ added in v1.0.88
func ResolveLayout ¶ added in v1.0.88
func ResolveLayout(requested Layout, state *SkillsState, readable bool) (Layout, error)
type SkillsRunner ¶ added in v1.0.35
type SkillsRunner interface {
SkillsSources() []string
FetchSkillsIndex(source string) *selfupdate.NpmResult
ListGlobalSkillsJSON() *selfupdate.NpmResult
ListGlobalSkills() *selfupdate.NpmResult
InstallSkills(source string, nameList []string) *selfupdate.NpmResult
InstallAllSkills(source string) *selfupdate.NpmResult
StageSuite(source, dir string) *selfupdate.NpmResult
InstallLocalSuite(path string) *selfupdate.NpmResult
RemoveGlobalSkills(names []string) *selfupdate.NpmResult
}
type SkillsState ¶ added in v1.0.35
type SkillsState struct {
Version string `json:"version"`
Layout Layout `json:"layout,omitempty"`
OfficialSkills []string `json:"official_skills"`
OfficialSkillsUnknown bool `json:"official_skills_unknown,omitempty"`
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"`
OfficialUnknown bool `json:"official_unknown,omitempty"`
}
StaleNotice signals that the locally synced skills need attention because their version is stale or their official completeness is unknown. Current is the last successfully synced version (always non-empty — Init does not emit 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 after a completed sync.
type SyncOptions ¶ added in v1.0.35
type SyncPlan ¶ added in v1.0.35
type SyncResult ¶ added in v1.0.35
type SyncResult struct {
Action string
Official []string
OfficialUnknown bool
Updated []string
Added []string
SkippedDeleted []string
Failed []string
Err error
Detail string
Warning string
Layout Layout
Force bool
}
func SyncSkills ¶ added in v1.0.35
func SyncSkills(opts SyncOptions) *SyncResult