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 ParseSkillsList(text string) []string
- func ReadSyncedVersion() (string, bool)
- func SetPending(n *StaleNotice)
- func WriteState(state SkillsState) error
- 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. 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 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 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 ¶
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 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 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