Skip to content

vp migrate --full asks to set up pre-commit hooks even when they're already configured #3096

Closed

Description

@hyunbinseo

Description

In a project that already has Vite+ hooks (.vite-hooks/pre-commit, core.hooksPath=.vite-hooks/_), vp migrate --full still asks:

◇ Set up pre-commit hooks to run formatting, linting, and type checking with auto-fixes?
  Yes / No

It defaults to Yes and doesn't say hooks already exist. Answering No sounds like it might disable them, though it doesn't.

The agent prompt in the same run detects the existing file and offers Append/Skip:

› Agent instructions already exist at AGENTS.md.
    Append
  › Skip: Leave existing file unchanged

promptGitHooks() doesn't check hasExistingViteHooksPolicy(), which setupGitHooks() already uses to leave the hook as it is.

Suggested solution

When existing Vite+ hooks are detected, either:

  • Skip the prompt and log Git hooks already configured, or
  • Say so in the prompt and offer Keep/Skip, like the agent prompt does.

Additional context

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Activity

  1. 0froq commented on Oct 18, 2026

    @0froq
    Contributor

    I have a fix ready for this, following the second option: when existing Vite+ hooks are detected (and --hooks/--no-hooks isn't passed), the prompt becomes a Keep/Skip select mirroring the AGENTS.md one, listing the detected hooks, e.g. "Git hooks already configured in .vite-hooks/ (pre-commit, commit-msg)". Keep (default) leaves them unchanged; Skip leaves the hooks setup untouched. Non-interactive behavior is unchanged. Tests included.

    Branch: https://github.com/0froq/vite-plus/tree/fix/migrate-existing-hooks-prompt
    I also have the first option (skip the prompt and log) ready if you'd prefer that. Happy to open a PR with whichever you like.

  2. fengmk2 commented on Oct 19, 2026

    @fengmk2
    Member

    @0froq send the pr please 👍

  3. added a commit that references this issue on Oct 20, 2026
    00c7c5c
  4. added a commit that references this issue on Oct 20, 2026
    cffe33f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions