# Shared: Update check (skills + CLI)

Run this once per `/shiplight` invocation, after the test project root is known
and before the selected subcommand's work. It covers two things that drift apart
on their own: the installed **skills** (this repo's content, refreshed daily) and
the project's **selected Shiplight CLI**, which `package-lock.json` freezes at whatever
version was resolved on the day the project was scaffolded.

**Skip this entire module in CI / non-interactive mode.**

Each command below is given in npm's form and Bun's. In a Bun project
(`package-manager.md`) run only the Bun form; never `node`, `npm` or `npx`.

## 1. Skill refresh (daily, automatic)

1. Check the timestamp file `.shiplight-agent-skills-last-update` in the test
   project root.
2. If it is **missing**, create it with the current timestamp and continue
   **without** running an update (a freshly installed project should not pay for
   a second install). Treat the file as local cache — do not commit it.
3. If it **exists and is older than 24 hours**, run
   `npx -y skills@latest update -y` (Bun: `bunx --bun skills@latest update -y`), then create/update the timestamp file even
   if the command fails.
4. If the update command fails, continue with the currently installed skill and
   mention the failure briefly.

## 2. Check the selected CLI

Skip this section for `init` and `update`. Use the launcher from
[Package manager](./package-manager.md) to read `info` and then `latest`.
For the registry check use `node "$SKILL_DIR/scripts/cli.cjs" latest`
(in a Bun project, `bun "$SKILL_DIR/scripts/cli.cjs" latest`).
The launcher looks up the selected package. For a `-partner.<n>` prerelease,
skip the public registry check and leave the project on its distribution channel.

If a newer version is available, offer `/shiplight update` and continue. If the
current workflow requires a feature the installed version lacks, explain the
specific requirement before offering an update. A registry lookup failure leaves
the installed CLI available for use.
