Harness Intelligence Wiki
CLICommands

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

  1. Read the selected npm dist-tag, defaulting to DP_UPDATE_TAG or latest.
  2. Compare the registry version for @punks/cli with the running CLI version.
  3. Exit as current unless a newer version exists or --force is passed.
  4. Detect the global install manager from the current executable path or package-manager user agent.
  5. Build the matching global reinstall command.
  6. 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 as next or beta.
  • --force reinstalls the selected tag even when the current version is already fresh.
  • --json prints 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.

On this page