Commit 5fc11da
committed
fix(cli): suppress Vite+ header in non-TTY and git hook contexts
The banner was printing from every `vp` invocation, cluttering captured
output (lefthook/husky, `execSync`, CI pipes, pagers) and the git commit
flow when a shell pre-commit hook runs `vp check --fix` — in the hook
the colour detection is unreliable, so the banner also rendered in a
degraded style.
Banner emission now gates on two signals at every call site:
- `stdout.is_terminal()` — catches piped/redirected contexts.
- `GIT_INDEX_FILE` env var — catches direct shell hooks that inherit
the terminal for stdout. Git sets this for pre-commit, commit-msg,
and prepare-commit-msg, which is where `vp check --fix` typically
runs.
Centralised behind `vite_shared::header::print_header()` on the Rust
side and a new `printHeader()` helper in `packages/cli/src/utils/
terminal.ts` on the Node CLI side. The interactive `prompts.intro()` in
`vp create` and the interactive top-level command picker are left
alone — they only run when genuinely interactive.
Snap fixtures regenerated to reflect the removed banner lines.1 parent 90e7beb commit 5fc11da
202 files changed
Lines changed: 84 additions & 583 deletions
File tree
- crates
- vite_global_cli/src
- commands
- env
- packages/cli
- binding/src/cli
- snap-tests-global
- cli-helper-message
- command-add-bun
- command-add-npm10-with-workspace
- command-add-npm10
- command-add-npm11-with-workspace
- command-add-npm11
- command-add-pnpm10-with-workspace
- command-add-pnpm10
- command-add-pnpm9-with-workspace
- command-add-pnpm9
- command-add-yarn4-with-workspace
- command-add-yarn4
- command-cache-bun
- command-cache-pnpm10
- command-check-help
- command-config-help
- command-config-pnpm10
- command-create-help
- command-dedupe-pnpm10
- command-dlx-bun
- command-dlx-npm10
- command-dlx-pnpm10
- command-dlx-yarn4
- command-env-install-conflict
- command-env-install-fail
- command-env-install-no-arg-fail
- command-env-install-no-arg
- command-env-install-node-version
- command-env-install-version-alias
- command-env-off-on
- command-env-use
- command-env-which
- command-exec
- command-fmt-help
- command-link-pnpm10
- command-lint-help
- command-list-bun
- command-list-npm10-with-workspace
- command-list-npm10
- command-list-pnpm10-with-workspace
- command-list-pnpm10
- command-list-yarn1
- command-outdated-bun
- command-outdated-npm10-with-workspace
- command-outdated-npm10
- command-outdated-pnpm10-with-workspace
- command-outdated-pnpm10
- command-owner-pnpm10
- command-pack-exe-error
- command-pack-exe
- command-pack-pnpm10
- command-pack-yarn4-with-workspace
- command-prune-npm10
- command-prune-pnpm10
- command-prune-yarn4
- command-publish-bun
- command-publish-pnpm10
- command-remove-bun
- command-remove-pnpm10
- command-run-script-vite-program
- command-run-without-vite-plus
- command-staged-help
- command-staged-no-config
- command-unlink-pnpm10
- command-update-bun
- command-update-pnpm10
- command-version-no-side-effects
- command-version-with-env
- command-view-bun
- command-view-pnpm10
- command-vpr
- command-why-bun
- command-why-npm10-with-workspace
- command-why-npm10
- command-why-pnpm10-with-workspace
- command-why-pnpm10
- command-why-yarn4
- create-framework-shim-astro
- create-framework-shim-vue
- delegate-respects-default-node-version
- env-install-binary-conflict
- fallback-all-invalid-to-user-default
- fallback-invalid-engines-to-dev-engines
- global-cli-fallback
- migration-add-git-hooks
- migration-agent-claude
- migration-already-vite-plus-with-husky-hookspath
- migration-already-vite-plus-with-husky-lint-staged
- migration-already-vite-plus
- migration-auto-create-vite-config
- migration-baseurl-tsconfig
- migration-chained-lint-staged-pre-commit
- migration-check
- migration-composed-husky-custom-dir
- migration-composed-husky-prepare
- migration-env-prefix-lint-staged
- migration-eslint-legacy-already-vite-plus
- migration-eslint-legacy
- migration-eslint-lint-staged-mjs
- migration-eslint-lint-staged
- migration-eslint-lintstagedrc
- migration-eslint-monorepo-package-only
- migration-eslint-monorepo
- migration-eslint-npx-wrapper
- migration-eslint-rerun-dual-config
- migration-eslint-rerun-mjs
- migration-eslint-rerun
- migration-eslint
- migration-existing-husky-lint-staged
- migration-existing-husky-v8-hooks
- migration-existing-husky-v8-multi-hooks
- migration-existing-husky
- migration-existing-lint-staged-config
- migration-existing-pnpm-exec-lint-staged
- migration-existing-pre-commit
- migration-existing-prepare-script
- migration-framework-shim-astro-vue
- migration-framework-shim-astro
- migration-framework-shim-vue
- migration-from-tsdown-json-config
- migration-from-tsdown
- migration-from-vitest-config
- migration-from-vitest-files
- migration-hooks-skip-on-existing-hookspath
- migration-husky-env-skip
- migration-husky-latest-dist-tag-v9-installed
- migration-husky-latest-dist-tag
- migration-husky-or-prepare
- migration-husky-semicolon-prepare
- migration-husky-v8-preserves-lint-staged
- migration-lint-staged-in-scripts
- migration-lint-staged-merge-fail
- migration-lint-staged-ts-config
- migration-lintstagedrc-json
- migration-lintstagedrc-merge-fail
- migration-lintstagedrc-not-support
- migration-lintstagedrc-staged-exists
- migration-merge-vite-config-js
- migration-merge-vite-config-ts
- migration-monorepo-bun
- migration-monorepo-husky-v8-preserves-lint-staged
- migration-monorepo-pnpm-overrides-dependency-selector
- migration-monorepo-pnpm
- migration-monorepo-skip-vite-peer-dependency
- migration-monorepo-yarn4
- migration-no-agent
- migration-no-git-repo
- migration-no-hooks-with-husky
- migration-no-hooks
- migration-not-supported-npm8.2
- migration-not-supported-pnpm9.4
- migration-not-supported-vite6
- migration-not-supported-vitest3
- migration-nvmrc-lts
- migration-nvmrc-node-alias
- migration-nvmrc
- migration-other-hook-tool
- migration-oxlintrc-json-with-comments
- migration-oxlintrc-jsonc
- migration-partially-migrated-pre-commit
- migration-pre-commit-env-setup
- migration-prettier-eslint-combo
- migration-prettier-ignore-unknown
- migration-prettier-lint-staged
- migration-prettier-pkg-json
- migration-prettier-rerun
- migration-prettier
- migration-rewrite-declare-module
- migration-rewrite-reference-types
- migration-skip-vite-dependency
- migration-skip-vite-peer-dependency
- migration-standalone-npm
- migration-standalone-pnpm
- migration-subpath
- migration-tsconfig-esmoduleinterop
- migration-vite-version
- migration-vitest-peer-dep
- migration-volta-with-nvmrc
- migration-volta
- new-check
- npm-global-install-already-linked
- npm-global-uninstall-vp-managed
- runtime-with-incompatible-env-node
- runtime-with-incompatible-project-node
- shim-recursive-package-binary
- snap-tests
- cli-helper-message
- command-helper
- command-version
- command-vp-alias
- src
- config
- create
- migration
- staged
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2102 | 2102 | | |
2103 | 2103 | | |
2104 | 2104 | | |
2105 | | - | |
2106 | | - | |
| 2105 | + | |
2107 | 2106 | | |
2108 | 2107 | | |
2109 | 2108 | | |
| |||
2120 | 2119 | | |
2121 | 2120 | | |
2122 | 2121 | | |
2123 | | - | |
| 2122 | + | |
2124 | 2123 | | |
2125 | 2124 | | |
2126 | 2125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
143 | | - | |
144 | | - | |
| 142 | + | |
145 | 143 | | |
146 | 144 | | |
147 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
165 | | - | |
| 164 | + | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
993 | 993 | | |
994 | 994 | | |
995 | 995 | | |
996 | | - | |
997 | | - | |
| 996 | + | |
998 | 997 | | |
999 | 998 | | |
1000 | 999 | | |
| |||
1024 | 1023 | | |
1025 | 1024 | | |
1026 | 1025 | | |
1027 | | - | |
1028 | | - | |
| 1026 | + | |
1029 | 1027 | | |
1030 | 1028 | | |
1031 | 1029 | | |
1032 | 1030 | | |
1033 | 1031 | | |
1034 | 1032 | | |
1035 | 1033 | | |
1036 | | - | |
1037 | | - | |
| 1034 | + | |
1038 | 1035 | | |
1039 | 1036 | | |
1040 | 1037 | | |
| |||
1057 | 1054 | | |
1058 | 1055 | | |
1059 | 1056 | | |
1060 | | - | |
1061 | | - | |
| 1057 | + | |
1062 | 1058 | | |
1063 | 1059 | | |
1064 | 1060 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
237 | 236 | | |
238 | 237 | | |
239 | 238 | | |
240 | | - | |
241 | | - | |
| 239 | + | |
242 | 240 | | |
243 | 241 | | |
244 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
539 | 569 | | |
540 | 570 | | |
541 | 571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| |||
Lines changed: 0 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
| |||
76 | 73 | | |
77 | 74 | | |
78 | 75 | | |
79 | | - | |
80 | | - | |
81 | 76 | | |
82 | 77 | | |
83 | 78 | | |
| |||
116 | 111 | | |
117 | 112 | | |
118 | 113 | | |
119 | | - | |
120 | | - | |
121 | 114 | | |
122 | 115 | | |
123 | 116 | | |
| |||
146 | 139 | | |
147 | 140 | | |
148 | 141 | | |
149 | | - | |
150 | | - | |
151 | 142 | | |
152 | 143 | | |
153 | 144 | | |
| |||
171 | 162 | | |
172 | 163 | | |
173 | 164 | | |
174 | | - | |
175 | | - | |
176 | 165 | | |
177 | 166 | | |
178 | 167 | | |
| |||
199 | 188 | | |
200 | 189 | | |
201 | 190 | | |
202 | | - | |
203 | | - | |
204 | 191 | | |
205 | 192 | | |
206 | 193 | | |
| |||
216 | 203 | | |
217 | 204 | | |
218 | 205 | | |
219 | | - | |
220 | | - | |
221 | 206 | | |
222 | 207 | | |
223 | 208 | | |
| |||
234 | 219 | | |
235 | 220 | | |
236 | 221 | | |
237 | | - | |
238 | | - | |
239 | 222 | | |
240 | 223 | | |
241 | 224 | | |
| |||
251 | 234 | | |
252 | 235 | | |
253 | 236 | | |
254 | | - | |
255 | | - | |
256 | 237 | | |
257 | 238 | | |
258 | 239 | | |
| |||
279 | 260 | | |
280 | 261 | | |
281 | 262 | | |
282 | | - | |
283 | | - | |
284 | 263 | | |
285 | 264 | | |
286 | 265 | | |
| |||
309 | 288 | | |
310 | 289 | | |
311 | 290 | | |
312 | | - | |
313 | | - | |
314 | 291 | | |
315 | 292 | | |
316 | 293 | | |
| |||
328 | 305 | | |
329 | 306 | | |
330 | 307 | | |
331 | | - | |
332 | | - | |
333 | 308 | | |
334 | 309 | | |
335 | 310 | | |
| |||
362 | 337 | | |
363 | 338 | | |
364 | 339 | | |
365 | | - | |
366 | | - | |
367 | 340 | | |
368 | 341 | | |
369 | 342 | | |
| |||
423 | 396 | | |
424 | 397 | | |
425 | 398 | | |
426 | | - | |
427 | | - | |
428 | 399 | | |
429 | 400 | | |
430 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | 2 | | |
5 | 3 | | |
6 | 4 | | |
| |||
71 | 69 | | |
72 | 70 | | |
73 | 71 | | |
74 | | - | |
75 | | - | |
76 | 72 | | |
77 | 73 | | |
78 | 74 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
184 | | - | |
185 | 183 | | |
186 | 184 | | |
187 | 185 | | |
| |||
0 commit comments