skillscheck

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 11 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 a stamp file written when skills are last synced (by `lark-cli update`). On mismatch it stores a notice for injection into JSON envelopes via output.PendingNotice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(currentVersion string)

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

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

Failure modes (all → no notice, no nag):

  • shouldSkip rule met
  • ReadStamp returns an I/O error other than ENOENT
  • Stamp matches currentVersion (in-sync)

func ReadStamp

func ReadStamp() (string, error)

ReadStamp returns the version recorded in the stamp file. Returns ("", nil) when the file does not exist (interpreted as "never synced"). Other I/O errors are returned as-is so callers can fail closed.

func SetPending

func SetPending(n *StaleNotice)

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

func WriteStamp

func WriteStamp(version string) error

WriteStamp records `version` as the last successfully synced skills version. Atomic via tmp + rename (validate.AtomicWrite). Creates the base config directory if it does not exist.

Types

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 (or "" when never synced); 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 gap plus the canonical fix command. Mirrors internal/update.UpdateInfo.Message in style ("..., run: lark-cli update" suffix).

Jump to

Keyboard shortcuts

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