Skip to content

feat(cli): add vp hooks command for managing Git hooks (#2219) - #2341

Open
dennybiasiolli wants to merge 4 commits into
voidzero-dev:mainfrom
dennybiasiolli:feat/2219-remove-git-hooks
Open

feat(cli): add vp hooks command for managing Git hooks (#2219)#2341
dennybiasiolli wants to merge 4 commits into
voidzero-dev:mainfrom
dennybiasiolli:feat/2219-remove-git-hooks

Conversation

@dennybiasiolli

@dennybiasiolli dennybiasiolli commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Closes #2219

Adds a dedicated vp hooks command so users can manage the Vite+ Git hook
dispatcher without following the manual steps from the commit-hooks guide:

  • vp hooks setup — install or refresh the dispatcher (core.hooksPath + <dir>/_)
  • vp hooks disable — tear down the dispatcher and persist the decision in local
    git config so prepare / vp config do not reinstall it
  • vp hooks enable — re-enable after disable (same as setup)
  • vp hooks status — show preference, core.hooksPath, dispatcher, and project hooks

Project-owned hooks (e.g. .vite-hooks/pre-commit), staged config, and
package.json lifecycle scripts are left alone. Custom directories work via
--hooks-dir and are remembered in local git config for later commands and
vp config.

Why

#2219: once hooks are set up there was no first-class way to remove them, so people
had to hand-edit core.hooksPath and delete .vite-hooks/_. Maintainers preferred
a vp hooks surface (setup / disable / enable / status) over a
vp config --uninstall-hooks flag, with the disable decision persisted.


Disclaimer: assisted by Grok 4.5 (xAI) while implementing and reviewing this change.

@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit db4b05e
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a747397beccd60008b67665

@dennybiasiolli
dennybiasiolli force-pushed the feat/2219-remove-git-hooks branch 3 times, most recently from 59537eb to 9ac52bd Compare August 6, 2026 09:19
Implement pure hook lifecycle helpers on top of install(): user preference
persistence (local git config), safe per-scope core.hooksPath unset, and
status reporting. Teach install() and vp config to honor a disable preference
and resolve the last-used hooks directory. Cover lifecycle, foreign path,
worktree, stored custom dir, and unsafe-tree cases in unit tests; update the
config help snapshot for the remembered hooks-dir default.
Add the hooks bin entry and register it from bin.ts so local vp can run
setup/disable/enable/status. Bundle the entry with tsdown, document it in
the CLI package build notes, and add a PTY lifecycle fixture for
setup/status/disable/enable plus prepare-style config skip after disable.
Delegate hooks from the Rust global CLI to the JS implementation, and list
the command in global help, the interactive picker, and the local NAPI
help surface. Update top-level help snapshots and add vp hooks --help
coverage for local and global flavors.
Add setup/disable/enable/status to the commit-hooks guide with a quick
start, and point create, migrate, troubleshooting, and the guide index at
the new commands so users can discover and operate them easily.
@dennybiasiolli
dennybiasiolli force-pushed the feat/2219-remove-git-hooks branch from 9ac52bd to db4b05e Compare August 6, 2026 11:44
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.

Command for removing git hooks

1 participant