The hook now derives a unique mailbox name from the session_id supplied on hook stdin, so two parallel Claude Code sessions in the same project get distinct mailboxes (e.g. `claude-a8b3c1d2`, `claude-d4e5f6a7`) instead of colliding on a shared env value. An optional CLAUDE_MAILBOX_NAME base prefix flavors the names as `<base>-<sid>`. Adds: - `claude-mailbox session-announce` subcommand for the new SessionStart hook, which prints the current session's mailbox name to context - `/claude-mailbox:mailbox-update` slash command for `npm update` + daemon restart - stdin parsing helpers (parseHookStdin, deriveSessionName) with unit tests; the doctor no longer needs a mandatory name prompt
2.1 KiB
2.1 KiB
description, allowed-tools
| description | allowed-tools |
|---|---|
| Update the Claude-Mailbox daemon to the latest published npm version and restart it. | 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-doctorto 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→LATESTand 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:
claude-mailbox stopnpm 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).
- On Linux/macOS this may fail with EACCES. Do not run sudo automatically. Ask the user how they want to proceed (e.g.,
claude-mailbox startclaude-mailbox --versionto verify the upgrade landed.claude-mailbox statusto verify the daemon isRunning.
Step 5 — summary
Print exactly this block:
Claude-Mailbox update
previous version: <CURRENT>
new version: <whatever --version now reports>
daemon: Running | Stopped | NotInstalled
pending messages survived: <count of messages still in inbox via `claude-mailbox list`, if applicable>
If the new version matches LATEST and daemon is Running, end with: "Update complete."
Otherwise, end with the first thing that went wrong.