Skip to content

fix(config): auto-set git core.hooksPath without prompting#1157

Open
fengmk2 wants to merge 3 commits intomainfrom
auto-set-git-core-hooksPath
Open

fix(config): auto-set git core.hooksPath without prompting#1157
fengmk2 wants to merge 3 commits intomainfrom
auto-set-git-core-hooksPath

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Mar 26, 2026

Summary

  • Skip the git-hook prompt in vp config when staged config already exists in vite.config.ts — the project has already opted into hooks
  • Recognize postinstall lifecycle in addition to prepare — projects that call vp config from postinstall (e.g. npmx.dev) now auto-install hooks without prompting
  • Add vp config hooks setup flow diagram and prompt decision table to RFC

Test plan

  • New snap test command-config-auto-hooks — verifies auto-install when staged config exists (no lifecycle env)
  • New snap test command-config-postinstall-auto-hooks — verifies auto-install from postinstall lifecycle
  • All existing command-config-* snap tests pass unchanged

Closes #1154

When a user clones a project with staged config in vite.config.ts and
manually runs `vp config`, the prompt was incorrectly shown because
hook shims don't exist after clone (they're gitignored). The existing
staged config is sufficient signal that the project opted into hooks.

Add `hasStagedConfigInViteConfig(root)` check to the prompt condition
so projects with staged config auto-install hooks without prompting.

Closes #1154
@netlify
Copy link

netlify bot commented Mar 26, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit c267e06
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69c557c1fc880f0009de091e

Copy link
Member Author

fengmk2 commented Mar 26, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 self-assigned this Mar 26, 2026
fengmk2 added 2 commits March 26, 2026 23:48
Projects like npmx.dev call `vp config` from `postinstall` instead of
`prepare`. Extend the lifecycle detection to also recognize `postinstall`
so hooks are auto-installed without prompting in both cases.

Closes #1154
Update all sections to reflect that vp config now recognizes both
prepare and postinstall lifecycle events, and skips the interactive
prompt when staged config already exists in vite.config.ts.
@fengmk2 fengmk2 changed the title fix(config): skip git-hook prompt when staged config already exists fix(config): auto-set git core.hooksPath without prompting Mar 26, 2026
@fengmk2 fengmk2 marked this pull request as ready for review March 26, 2026 15:59
@fengmk2 fengmk2 requested review from branchseer and cpojer March 26, 2026 15:59
Copy link
Member Author

fengmk2 commented Mar 26, 2026

Before merging, I will first release a test version for manual verification.

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.

vp create: skip git-hook prompt when staged config already exists

1 participant