GeezerVison is showing github.com — vp migrate: precommit migration is silently skipped for lefthook/simple-git-hooks/yorkie even when opted-in · Issue #1854 · voidzero-dev/vite-plus
vp migrate: precommit migration is silently skipped for lefthook/simple-git-hooks/yorkie even when opted-in #1854DescriptionSummary
When running vp migrate and answering yes to the git-hooks / precommit prompt, the migration silently does nothing for projects that use lefthook (or simple-git-hooks / yorkie). The existing lefthook setup is left fully in place, no staged config is written to vite.config.ts, and .vite-hooks/ / core.hooksPath are never set up. The only signal is a single ⚠ Detected lefthook — skipping git hooks setup warning line, which is very easy to miss.
The net result is a "silent-ish" no-op: the user believes precommit was migrated to Vite+, but in reality the old lefthook + old tools keep running, and Vite+ precommit is never configured.
Environment
vite-plus@^0.1.24
- bun
1.3.14, monorepo (turbo)
- Pre-existing precommit: lefthook (running
oxlint --fix / oxfmt)
Steps to reproduce
- In a repo that already uses lefthook (
lefthook in devDependencies, lefthook.yml, prepare: "lefthook install").
- Run
vp migrate.
- Answer yes to the precommit / git-hooks prompt.
Expected
Answering yes to precommit migrates lefthook the same way husky is handled — i.e. either:
- migrate it: write
staged config to vite.config.ts, run vp config (generate .vite-hooks/, set core.hooksPath, rewrite prepare), and remove the old lefthook setup (lefthook.yml, devDependency, old .git/hooks/pre-commit); or
- if intentionally unsupported, make the skip impossible to miss (e.g. surface it in the final migration summary under a "skipped / manual action required" section, not just an inline warning).
Actual
core.hooksPath not set → git still uses .git/hooks/, which still calls lefthook.
lefthook.yml, prepare: "lefthook install", and the lefthook devDependency all remain.
- No
.vite-hooks/, no staged config in vite.config.ts.
- Only a single inline
⚠ Detected lefthook — skipping git hooks setup. Please configure git hooks manually. warning is printed.
Root cause (from reading the bundled dist/ of 0.1.24)
These references are from the minified bundle (node_modules/vite-plus/dist/...), so symbol/line numbers are approximate — please cross-check against source:
agent-*.js defines two lists:
const OTHER_HOOK_TOOLS = ["simple-git-hooks", "lefthook", "yorkie"];
const REPLACED_HOOK_PACKAGES = ["husky", "lint-staged"]; // only these are ever removed
preflightGitHooksSetup() scans deps and, if it finds any OTHER_HOOK_TOOLS entry, returns a reason string (a "skip" signal):
for (const tool of OTHER_HOOK_TOOLS)
if (deps?.[tool] || prodDeps?.[tool] || pkgContent[tool])
return `Detected ${tool} — skipping git hooks setup. Please configure git hooks manually.`;
- In
migration/bin.js collectMigrationPlan(), even when the user answered yes, that reason forces shouldSetupHooks = false:
let shouldSetupHooks = await promptGitHooks(options); // user said yes
if (shouldSetupHooks) {
const reason = preflightGitHooksSetup(rootDir, packageManager);
if (reason) { log.warn(`⚠ ${reason}`); shouldSetupHooks = false; }
}
- As a consequence, both follow-ups are skipped:
const skipStagedMigration = !plan.shouldSetupHooks; → no staged config is written.
if (plan.shouldSetupHooks) { installGitHooks(...) } → never runs (vp config equivalent skipped).
- lefthook is never removed because removal only targets
REPLACED_HOOK_PACKAGES (husky / lint-staged).
So this appears to be intentional (only husky + lint-staged are auto-migrated), but the UX makes it look like the precommit migration succeeded when it didn't.
Suggestions
- When the user explicitly opted into precommit but preflight skips it, surface the skip prominently in the final migration summary (and at exit), not just as an inline warning.
- For detected lefthook/simple-git-hooks/yorkie, offer an opt-in prompt to migrate (remove the old tool + set up Vite+ hooks), mirroring the husky migration path.
- At minimum, document that lefthook / simple-git-hooks / yorkie users must migrate precommit manually.
Manual migration that worked (for reference)
- Add
staged to vite.config.ts (translating lefthook.yml's oxlint --fix / oxfmt to vp lint --fix / vp fmt).
package.json: change prepare to vp config, remove the lefthook devDependency.
- Delete
lefthook.yml and the old .git/hooks/pre-commit.
- Run
vp config to generate .vite-hooks/ and set core.hooksPath.
- Reinstall to drop lefthook from the lockfile (had to manually
rm -rf node_modules/lefthook node_modules/.bin/lefthook afterward).
Note: I'm not a native English speaker — this report was written with translation assistance, so apologies for any awkward phrasing. ActivityKoutaro-Hanabusa commented on Jun 16, 2026 Ah — I just realized this is actually documented in the RFC (rfcs/config-and-staged-commands.md, the "Migration Edge Cases" part): "Has other tool (simple-git-hooks, lefthook, yorkie) — warns and skips." So the skip is intentional and already written down. Sorry for the noise — I missed it. 🙏
Feel free to close if there's nothing actionable here. (The one thing that tripped me up was that I'd opted into the precommit prompt and only got a single warning line, so I assumed it had migrated — but that's a minor UX nit, not a bug.) Reacted by JongKyung Lee and NaokiHaba naokihaba commented on Jun 19, 2026 @fengmk2 @jong-kyung
Perhaps we should include this in the migration guide.
https://viteplus.dev/guide/migrate
In an ideal world, developers would refer to the RFC, but it's a bit much to expect that every time. It would be far more helpful to have the information clearly laid out in the official documentation.
How does that sound to you?
I also think it would be even better to display a message after "vp migrate" is complete, encouraging users to check the guidelines. Reacted by Koutaro-Hanabusa Reacted by Koutaro-Hanabusa Reacted by Koutaro-Hanabusa jong-kyung commented on Jun 19, 2026
Perhaps we should include this in the migration guide. https://viteplus.dev/guide/migrate
@naokihaba I agree with this.
Since vp migrate currently only supports migrating lint-staged, I think it would be helpful to mention in the migration guide which Git hook tools are supported and which ones are intentionally skipped, such as lefthook, simple-git-hooks, and yorkie.
That should make the behavior clearer for users who opt into the precommit migration during vp migrate. Reacted by NaokiHaba and Koutaro-Hanabusa naokihaba commented on Jun 19, 2026 @jong-kyung
That sounds like a good idea.
Since this will help determine how much detail we should include in the migration guide, I'd like to move forward with this while also getting input from @fengmk2. Reacted by JongKyung Lee and Koutaro-Hanabusa fengmk2 commented on Jun 19, 2026 @naokihaba No problem, let's go with your suggestion 😉 Reacted by JongKyung Lee , NaokiHaba and Koutaro-Hanabusa added a commit that references this issue on Jun 21, 2026This issue will close once commit cadf5f1 is merged into the 'main' branch.cadf5f1
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|