@hover-dev/cli
v0.7.5
Published
CLI for Hover. Detects your bundler, installs the right Hover integration package, and wires it into your config — one command.
Downloads
766
Maintainers
Readme
@hover-dev/cli
One-command setup for Hover — detects your bundler, installs the right integration package, and wires it into your config file.
Usage
No installation required. npx runs the latest published version on demand:
npx @hover-dev/cli addThat's it. The CLI:
- Reads your
package.jsonto figure out your bundler (Vite, Astro, Nuxt, Next.js, or Webpack). - Reads your lockfile to pick the right package manager (pnpm, yarn, bun, or npm).
- Installs the matching Hover package as a dev dependency.
- Updates your config file (
vite.config.ts/astro.config.mjs/nuxt.config.ts/next.config.{ts,mjs,js}/webpack.config.js) to load the plugin.
Then run your dev server and click the floating ✨ in the bottom-right corner.
Monorepos (turbo / pnpm-workspace / yarn workspaces)
Run from the repo root. The CLI enumerates the workspaces declared in pnpm-workspace.yaml / package.json workspaces / turbo.json and looks for a supported bundler in each:
- One match — dispatches into that workspace automatically.
- Multiple matches in a TTY — interactive picker (
↑/↓, Enter).Escto cancel. - Multiple matches in CI / piped invocation — lists candidates and asks for
--cwd apps/web.
npx @hover-dev/cli add --cwd apps/web # target a specific workspaceSub-workspaces don't need their own lockfile — the CLI walks up to find one, so a pnpm-managed monorepo with a single root pnpm-lock.yaml works without surprise.
Force a specific bundler
If detection picks the wrong one (e.g. your project has multiple bundlers, or you're starting from a fresh repo), use a flag:
npx @hover-dev/cli add --vite # vite-plugin-hover
npx @hover-dev/cli add --astro # @hover-dev/astro
npx @hover-dev/cli add --nuxt # @hover-dev/nuxt
npx @hover-dev/cli add --next # @hover-dev/next
npx @hover-dev/cli add --webpack # webpack-plugin-hoverPreview without modifying anything
npx @hover-dev/cli add --dry-runPrints what would be installed + which config file would be modified, then exits without changing anything.
What if my config file is unusual?
The CLI uses magicast to safely mutate defineConfig({ ... }) and bare-object configs. If your config has an unusual shape (re-exported config, conditional logic, etc.), the CLI will:
- Still install the right Hover package.
- Skip the config mutation and print the exact lines you need to paste in.
This is also what happens if you have no config file at all — many projects rely on bundler defaults until they need to customise.
Use as a project dep (optional)
npx is the default and recommended way. If you want to lock the CLI version per-project (e.g. to make a setup command for new teammates), install it as a dev dep:
pnpm add -D @hover-dev/cli
pnpm hover addLicense
Apache-2.0 — same as the rest of Hover.
