Notify users of new versions and add commit update - #22
Conversation
- Add `commit update` to install the latest package version with the detected package manager. - Check cached npm registry metadata on startup and show an update banner when a newer version is available. - Suppress update checks in CI, non-interactive output, or when `NO_UPDATE_NOTIFIER=true`. - Add interactive shell execution for update installs and simplify `--version` output.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c20dadd22
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Check the Yarn major version before selecting the Yarn global update command. - Allow Yarn 1 global installs and reject modern Yarn with npm or pnpm install guidance. - Preserve pnpm and npm update commands and existing interactive execution flow.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b07b19e71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Motivation
An essential feature to notify users about updates and help them always run the latest version of the tool. Enjoy!
What's New
Version Check Infrastructure
checkForUpdateinsrc/infra/version-check.tsqueriesregistry.npmjs.orgfor the latest published versionversion-check.jsonunderCONFIG_DIRto avoid hitting the registry on every runnode -echild process so the CLI never waits on network I/OcompareVersionshelper for semver-style numeric comparison (major.minor.patch, ignores pre-release suffix)Update Banner
renderUpdateBannerinsrc/infra/ui/update-banner.tsrenders a@clack/promptsnote showingcurrent → latestcheckUpdateinsrc/cli/show-update-banner.tswires the check into CLI startupNO_UPDATE_NOTIFIER=true, whenCIis set, or when stdout is not a TTYcommit updateCommandUpdatecommand insrc/cli/update.tsruns the global install for the detected package managerdetectPackageManagerinspectsprocess.argv[1]to pickpnpm add -g,yarn global add, ornpm install -gexecBinInteractiveinsrc/infra/shell.tsspawns withstdio: "inherit"so install progress streams to the user's terminalexitCodeErrorhelper extracted and reused by bothexecBinandexecBinInteractiveCLI Parser & Help
updateregistered inCliCommandunion andcliCommandDecodergenerateto-hso runningcommitwith no args shows helpshowVersionsimplified to print just the version stringindex.tsswitched toabsurdfor exhaustive command checks and dropped the duplicateshowHelpcall on parse failureCommit Error Logging
src/cli/commit.tsalways logs the failure message viap.log.error, removing the priorinstanceof Errorguard that silently swallowed non-ErrorrejectionsTesting & Feedback
CI=true,NO_UPDATE_NOTIFIER=true, and when piping stdoutcommit updateunder each package manager (pnpm, yarn, npm) and confirm the correct global install command is invoked with live outputcommitwith no arguments now prints help instead of runninggeneratecommit --version/-vprints just the version stringIf you find any bugs or have recommendations for improvements, please open an issue and assign it to me.