Skip to content

feat: add update notifications and one-click updates - #148

Open
AbdelrahmanHafez wants to merge 90 commits into
nkzw-tech:mainfrom
AbdelrahmanHafez:feat/update-notifications
Open

feat: add update notifications and one-click updates#148
AbdelrahmanHafez wants to merge 90 commits into
nkzw-tech:mainfrom
AbdelrahmanHafez:feat/update-notifications

Conversation

@AbdelrahmanHafez

Copy link
Copy Markdown
Contributor

This PR adds update notifications and in-place updates, using GH releases as the source of truth.

This PR:

  • Checks GitHub Releases once a day and caches the result in ~/.codiff/update-state.json, shared by the app and the CLI
  • Shows a small pill at the bottom of the sidebar when an update is available. One click applies it: macOS and Squirrel Windows download the update and restart into the new version, Linux and non-Squirrel Windows download the matching release asset and open it, then the pill asks you to quit to finish
  • The pill tracks progress (updating, quit to finish, failed with one-click retry), and its tooltip says what clicking will do for the platform's update strategy
  • Adds codiff update to the CLI, which upgrades through Homebrew when the cask owns the install, opens the app to update itself otherwise, and points at the release page for source checkouts
  • Prints a one-line notice after codiff --version when a newer version is cached, implemented in the Node CLI and mirrored in the POSIX sh wrapper with the same version comparison and state validation so a broken or stale state file stays silent
Screenshots image image
Previous iterations This iteration was a two-click update, which after some thought it felt like it can be simplified to match modern tools like VSCode and Codex, an update is just a single-click and self-explanatory. So I decided to match it. image image

Used Fable 5 xhigh with 20 iterations of review with Sol 5.6 xhigh.

@AbdelrahmanHafez
AbdelrahmanHafez marked this pull request as ready for review July 29, 2026 17:10
@cpojer

cpojer commented Jul 29, 2026

Copy link
Copy Markdown
Member

Codex said this about auto-updating with Homebrew and on mac OS:

Add to the tap:

livecheck do
  url :url
  strategy :github_latest
end

auto_updates true

depends_on arch: :arm64
depends_on :macos

Homebrew specifically recommends auto_updates true when an app’s “Check for Updates” functionality downloads and installs the update, rather than merely opening a webpage. Homebrew can then compare the installed app bundle’s version against the cask version and avoid accidentally downgrading a self-updated app. Homebrew Cask Cookbook⁠, Homebrew FAQ⁠

For #148, I would also make these corresponding changes:

  • Make codiff update open the application’s self-updater on macOS, even when installed through Homebrew. Its current brew upgrade --cask codiff special case becomes unnecessary and may lag behind the newest GitHub release if the tap has not been updated yet.
  • Continue updating the cask’s version, sha256, and URL for fresh installations. auto_updates true does not eliminate normal cask maintenance.
  • Keep publishing only signed and notarized macOS ZIPs. Electron requires a signed application for Squirrel.Mac updates. Electron autoUpdater documentation⁠
  • Test an actual upgrade starting from brew install --cask nkzw-tech/tap/codiff, then verify:
    • Codiff updates in place.
    • The terminal-helper symlink still works.
    • CFBundleShortVersionString reflects the new version.
    • brew outdated and brew upgrade do not reinstall or downgrade it.
    • brew uninstall --cask codiff still removes the updated app.

The existing build already has the important prerequisites: its bundle versions are correctly set to 1.9.2, and the local release build is Developer ID signed, notarized, and has a stapled ticket.

So I’d consider issue #2 resolved by adding auto_updates true, aligning codiff update with the in-app updater, and testing the Homebrew-installed upgrade path. It would not resolve #148’s Windows ZIP behavior, missing download verification, Linux architecture matching, or web CSS leakage.

@AbdelrahmanHafez

Copy link
Copy Markdown
Contributor Author

All addressed, and updated the button

image
  1. Windows now has its own manual strategy: since the releases deliberately ship only a ZIP, the update button opens the release page instead of downloading an archive that can't install itself. The status stays available because nothing was installed.
  2. codiff update no longer special-cases brew, it hands every packaged install to the app's self-updater. On the tap side I'd add auto_updates true together with the first release that ships this updater, not before: brew upgrade skips auto_updates casks unless --greedy, so flipping it while 1.9.2 is current would leave existing brew installs with no update path at all.
  3. Downloads now stream to disk through a SHA-256 hash and are verified against the digest GitHub publishes for the asset before anything is opened. A missing or mismatched digest deletes the file and surfaces an error. This also removes the full in-memory buffering and sync write.
  4. Linux assets are matched against process.arch (amd64/arm64 for deb, x86_64/aarch64 for rpm), with a fallback to an unmarked asset. An installer marked for another architecture is refused rather than opened.
  5. All the update pill CSS (and its variables) moved to Desktop.css.

The pill itself now renders through the shared <Button> component and only layers an accent fill on top, so it picks up the squircle corners and sizing from the shared styles.

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.

2 participants