GeezerVison is showing github.com — Allow `vp config` to install hooks without forcing `vp staged` · Issue #2252 · voidzero-dev/vite-plus
Allow vp config to install hooks without forcing vp staged #2252DescriptionDescribe the bug
I want Vite+ to install the Git hook dispatcher while keeping a custom pre-commit hook that runs whole-project checks. For example:
vp run lint
vp exec tsc --noEmit
Currently, vp config appends vp staged to the existing hook and adds a staged block to vite.config.ts.
--no-hooks does not cover this use case because it also skips dispatcher installation, so the setup is not reproducible on a fresh clone.
Reproduction
Not required
Steps to reproduce
No response
System Info
Tool Paths:
node /Users/user/.vite-plus/js_runtime/node/26.5.0/bin/node
npm /Users/user/.vite-plus/js_runtime/node/26.5.0/bin/npm
npx /Users/user/.vite-plus/js_runtime/node/26.5.0/bin/npx
Package Manager:
Name pnpm
Version 11.17.0
Source packageManager
Source Path /Users/user/src/user/repo/package.json
Project Root /Users/user/src/user/repo
Bin Path /Users/user/.vite-plus/package_manager/pnpm/11.17.0/pnpm/bin/pnpm
vp v0.2.6
Local vite-plus:
vite-plus v0.2.6
Tools:
vite v8.1.5
rolldown v1.2.0
vitest v4.1.10
oxfmt v0.60.0
oxlint v1.75.0
oxlint-tsgolint v7.0.2001
tsdown v0.22.13
Environment:
Package manager pnpm v11.17.0
Node.js v26.5.0 (.node-version)
Used Package Manager
pnpm
Logs
Validations
ActivityliangmiQwQ commented on Jul 27, 2026 Hello!
At the present, vp config forces the hooks must include vp staged. That said, you can still modify your <project-root>/.vite-hooks/pre-commit to add other commands.
Like
vp staged
vp run lint
vp exec tsc --noEmit
It is just a small .includes('vp staged') string match, so there is a small workaround if you don't really want to use vp staged
# vp staged
vp run lint
vp exec tsc --noEmit
Considering the current vp config's behavior is documented and expected. I will treat it as a feature request :), and I think it is worth supporting! Perdolique commented on Jul 27, 2026 @liangmiQwQ, I still consider it a bug. I don't want to use "staged" at all, only commands in the hooks, similar to husky, but vp config is forcing it:
The config (or lacking of a config file at all)
export default defineConfig({});
becomes
export default defineConfig({
staged: {
"*": "vp check --fix"
}
});
every time a new user clones the repo. This section should be optional. At the moment, it's a blocker for migration from husky.
As a workaround, I did:
export default defineConfig({
staged: {
'*': (): string[] => []
}
})
But it looks like an unnecessary crutch, to be honest 🤔. liangmiQwQ commented on Jul 27, 2026 liangmiQwQ commented on Jul 27, 2026
every time a new user clones the repo.
Cloning repo itself shouldn't trigger git hooks. Maybe you mean vp install?
As a workaround, I did:
export default defineConfig({
staged: {
'*': (): string[] => []
}
})
@Perdolique Maybe you can try leave an empty object for staged, like staged: {}. Perdolique commented on Jul 27, 2026 Yes, vp install, which one is triggering prepare. It looks like the empty staged also works. For some reason, the absence of this option generates a new rule on vp install right after a fresh clone, even if the config file exists. TheAlexLichter commented on Jul 27, 2026 How about this:
- vp config should only install and refresh the generated hook dispatcher under
.vite-hooks/_. It should not modify hooks such as .vite-hooks/pre-commit and does not write to vite.config.ts.
- Top-level
.vite-hooks/* scripts are project-owned and live in the repo (committed), while .vite-hooks/_/* stays ignored and is recreated after installation
vp create can continue scaffolding a default vp staged pre-commit hook and staged configuration when the user opts into that workflow
vp migrate should preserve or translate existing behavior (e.g. from husky) and only introduce defaults when there is no existing hook policy
That would allow custom hooks without requiring an empty staged configuration or a new opt-out flag. Perdolique commented on Jul 27, 2026 @TheAlexLichter, yes. It sounds exactly like how husky works right now. Currently, I have a config just for an empty staged: {} as a workaround for hooks. Reacted by Alexander Lichter added a commit that references this issue on Aug 4, 2026This issue will close once commit cfb59b2 is merged into the 'main' branch.cfb59b2
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|