Skip to content

feat: notify when a new version is available#31

Merged
bumaruf merged 11 commits into
mainfrom
feat/update-notifier
Jul 15, 2026
Merged

feat: notify when a new version is available#31
bumaruf merged 11 commits into
mainfrom
feat/update-notifier

Conversation

@bumaruf

@bumaruf bumaruf commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Periodically checks for a new version of ttm in the background (throttled to once per 24h)
  • Displays a one-line notice when an update is available, with the command tailored to your installation method (npm, .deb, or binary)
  • Never installs anything automatically; purely informational

How it works

The update check runs as a detached background process, so it never delays the execution of the main command. The notice is displayed from a cached result, ensuring zero latency impact. The check runs at most once per 24 hours.

Per-channel commands: The notice intelligently detects how ttm was installed and suggests the right update command:

  • npm: npm i -g @bumaruf/ttm-cli
  • .deb (Debian/Ubuntu): sudo apt upgrade ttm
  • Binary: link to the releases page

Opt-out: Set TTM_NO_UPDATE_CHECK=1 to disable the checks entirely.

Teardown contract: The notice is printed after the TUI closes, so it doesn't interfere with the interactive session.

Notes

  • New themes arrive via ttm update without needing to update ttm itself — this notifier only alerts you to changes in the tool's code
  • The interactive check (notice appearing after a real TUI session) has been implemented but still needs manual human verification on each platform to confirm the timing and behavior are correct

bumaruf added 11 commits July 15, 2026 13:18
Number("") and Number(" 2") coerce successfully, letting strings like
"1..3", "1.2.-3", "1. 2.3", and "01.2.3" slip past validation and be
misread as valid semver, breaking the update notifier's core safety
guarantee that garbage never triggers a nag. Each segment must now
match /^(0|[1-9]\d*)$/ before being coerced to a number.
readNotice and cacheAgeOk left the preceding fs.exists call outside their
try/catch, so Bun's exists() rejecting (e.g. EACCES/ENOTDIR on a broken
HOME/XDG_CACHE_HOME) would throw past both call sites in cli.ts, which run
unwrapped on the hot path. Wrap the whole cache-reading body, including
fs.exists, in both functions so any failure degrades to silence per the
module's never-crash contract.
@bumaruf bumaruf merged commit 7da2a0b into main Jul 15, 2026
9 checks passed
@bumaruf bumaruf deleted the feat/update-notifier branch July 15, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant