Upgrade Command
Self-update flow for the installed hi CLI executable
hi upgrade updates the CLI executable through the package manager that installed the current global command.
Interactive startup checks use the same self-update machinery. Before normal TTY commands run, the CLI can compare the selected npm dist-tag, ask for y/n confirmation, reinstall through the detected package manager on y, and exit so the operator can rerun the command on the upgraded binary. Help/version output, CI, non-interactive shells, and HI_NO_UPDATE_CHECK=1 skip the prompt.
The hi-cli operator skill check remains advisory and detached. It never installs or updates skills while another command is starting.
Flow
- Read the selected npm dist-tag, defaulting to
DP_UPDATE_TAGorlatest. - Compare the registry version for
@punks/cliwith the running CLI version. - Exit as current unless a newer version exists or
--forceis passed. - Detect the global install manager from the current executable path or package-manager user agent.
- Build the matching global reinstall command.
- Run the reinstall command and report the installer, version transition, and command used.
Install Manager Commands
The command preserves the operator's install path:
- Bun:
bun add -g @punks/cli@<tag> --minimum-release-age=0 - npm:
npm install -g @punks/cli@<tag> --min-release-age=0 - pnpm:
npm_config_minimum_release_age=0 pnpm add -g @punks/cli@<tag> - Yarn:
YARN_NPM_MINIMAL_AGE_GATE=0 yarn global add @punks/cli@<tag>
The zero-age flags and environment overrides are intentional. They let a just-published CLI release install immediately even when the package manager has an age gate configured.
Options
--tag <dist-tag>installs another npm dist-tag such asnextorbeta.--forcereinstalls the selected tag even when the current version is already fresh.--jsonprints the structured upgrade result.
Failure Modes
If the registry cannot be read, the command exits without reinstalling. If the install manager cannot be detected, it asks the operator to reinstall manually with Bun, pnpm, npm, or Yarn.