--- description: Update the Claude-Mailbox daemon to the latest published npm version and restart it. allowed-tools: Bash --- You are running the **Claude-Mailbox update** command. Update the `@kuns/claude-mailbox` npm package and restart the daemon. Never run `sudo` automatically — if elevation is needed, stop and ask. ## Step 1 — current version Run: `claude-mailbox --version` - Exit 0 → record the version string as `CURRENT`. - Non-zero → tell the user the daemon binary is not installed yet. Suggest `/claude-mailbox:mailbox-doctor` to do a full setup and stop. ## Step 2 — latest published version Run: `npm view @kuns/claude-mailbox version` If the npm registry config is missing, the call may fail with a 404. Fall back to: ``` npm view --registry=https://git.kuns.dev/api/packages/releases/npm/ @kuns/claude-mailbox version ``` Record the result as `LATEST`. ## Step 3 — compare - If `CURRENT === LATEST`: print "Already up to date (vX.Y.Z)." and stop. Do not run any further steps. - Otherwise: tell the user `CURRENT` → `LATEST` and ask for confirmation before proceeding. ## Step 4 — perform the update On user confirmation, run these in order. Stop on the first failure and report it: 1. `claude-mailbox stop` 2. `npm install -g @kuns/claude-mailbox@latest` - On Linux/macOS this may fail with EACCES. **Do not run sudo automatically.** Ask the user how they want to proceed (e.g., `sudo npm install -g …`, or switch to a user-scoped Node setup with nvm/fnm). 3. `claude-mailbox start` 4. `claude-mailbox --version` to verify the upgrade landed. 5. `claude-mailbox status` to verify the daemon is `Running`. ## Step 5 — summary Print exactly this block: ``` Claude-Mailbox update previous version: new version: daemon: Running | Stopped | NotInstalled pending messages survived: ``` If the new version matches `LATEST` and daemon is `Running`, end with: "Update complete." Otherwise, end with the first thing that went wrong.