From 8b914d9ac7ca98847ef7222fcee8c665304da5a1 Mon Sep 17 00:00:00 2001 From: arthie Date: Tue, 17 Mar 2026 22:31:27 +0100 Subject: [PATCH 1/4] chore: migrate from Husky to vp config for git hooks - Replace Husky pre-commit hook with .vite-hooks/pre-commit - Move lint-staged config from package.json to vite.config.ts - Remove husky and lint-staged dependencies - 'vp config': Add Claude MCP server configuration for vite-plus - 'vp config': Update CLAUDE.md with Vite+ workflow documentation --- .claude/settings.json | 11 ++++++ .claude/skills/vite-plus | 1 + .husky/pre-commit | 1 - .vite-hooks/pre-commit | 1 + CLAUDE.md | 77 ++++++++++++++++++++++++++++++++++++++++ package.json | 8 +---- pnpm-lock.yaml | 9 ----- pnpm-workspace.yaml | 1 - vite.config.ts | 4 +++ 9 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 .claude/settings.json create mode 120000 .claude/skills/vite-plus delete mode 100644 .husky/pre-commit create mode 100755 .vite-hooks/pre-commit diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000000..7d51bb73da --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,11 @@ +{ + "mcpServers": { + "vite-plus": { + "command": "npx", + "args": [ + "vp", + "mcp" + ] + } + } +} diff --git a/.claude/skills/vite-plus b/.claude/skills/vite-plus new file mode 120000 index 0000000000..d7066c08d4 --- /dev/null +++ b/.claude/skills/vite-plus @@ -0,0 +1 @@ +../../node_modules/vite-plus/skills/vite-plus \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index e02c24e2b5..0000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1 +0,0 @@ -pnpm lint-staged \ No newline at end of file diff --git a/.vite-hooks/pre-commit b/.vite-hooks/pre-commit new file mode 100755 index 0000000000..85fb65b4fc --- /dev/null +++ b/.vite-hooks/pre-commit @@ -0,0 +1 @@ +vp staged diff --git a/CLAUDE.md b/CLAUDE.md index 10f95666d0..e57b0dd0df 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -136,3 +136,80 @@ pnpm -F vite-plus snap-test-global ``` The snap test will automatically generate/update the `snap.txt` file with the command outputs. It exits with zero status even if there are output differences; you need to manually check the diffs(`git diff`) to verify correctness. + + + +# Using Vite+, the Unified Toolchain for the Web + +This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, but it invokes Vite through `vp dev` and `vp build`. + +## Vite+ Workflow + +`vp` is a global binary that handles the full development lifecycle. Run `vp help` to print a list of commands and `vp --help` for information about a specific command. + +### Start + +- create - Create a new project from a template +- migrate - Migrate an existing project to Vite+ +- config - Configure hooks and agent integration +- staged - Run linters on staged files +- install (`i`) - Install dependencies +- env - Manage Node.js versions + +### Develop + +- dev - Run the development server +- check - Run format, lint, and TypeScript type checks +- lint - Lint code +- fmt - Format code +- test - Run tests + +### Execute + +- run - Run monorepo tasks +- exec - Execute a command from local `node_modules/.bin` +- dlx - Execute a package binary without installing it as a dependency +- cache - Manage the task cache + +### Build + +- build - Build for production +- pack - Build libraries +- preview - Preview production build + +### Manage Dependencies + +Vite+ automatically detects and wraps the underlying package manager such as pnpm, npm, or Yarn through the `packageManager` field in `package.json` or package manager-specific lockfiles. + +- add - Add packages to dependencies +- remove (`rm`, `un`, `uninstall`) - Remove packages from dependencies +- update (`up`) - Update packages to latest versions +- dedupe - Deduplicate dependencies +- outdated - Check for outdated packages +- list (`ls`) - List installed packages +- why (`explain`) - Show why a package is installed +- info (`view`, `show`) - View package information from the registry +- link (`ln`) / unlink - Manage local package links +- pm - Forward a command to the package manager + +### Maintain + +- upgrade - Update `vp` itself to the latest version + +These commands map to their corresponding tools. For example, `vp dev --port 3000` runs Vite's dev server and works the same as Vite. `vp test` runs JavaScript tests through the bundled Vitest. The version of all tools can be checked using `vp --version`. This is useful when researching documentation, features, and bugs. + +## Common Pitfalls + +- **Using the package manager directly:** Do not use pnpm, npm, or Yarn directly. Vite+ can handle all package manager operations. +- **Always use Vite commands to run tools:** Don't attempt to run `vp vitest` or `vp oxlint`. They do not exist. Use `vp test` and `vp lint` instead. +- **Running scripts:** Vite+ commands take precedence over `package.json` scripts. If there is a `test` script defined in `scripts` that conflicts with the built-in `vp test` command, run it using `vp run test`. +- **Do not install Vitest, Oxlint, Oxfmt, or tsdown directly:** Vite+ wraps these tools. They must not be installed directly. You cannot upgrade these tools by installing their latest versions. Always use Vite+ commands. +- **Use Vite+ wrappers for one-off binaries:** Use `vp dlx` instead of package-manager-specific `dlx`/`npx` commands. +- **Import JavaScript modules from `vite-plus`:** Instead of importing from `vite` or `vitest`, all modules should be imported from the project's `vite-plus` dependency. For example, `import { defineConfig } from 'vite-plus';` or `import { expect, test, vi } from 'vite-plus/test';`. You must not install `vitest` to import test utilities. +- **Type-Aware Linting:** There is no need to install `oxlint-tsgolint`, `vp lint --type-aware` works out of the box. + +## Review Checklist for Agents + +- [ ] Run `vp install` after pulling remote changes and before getting started. +- [ ] Run `vp check` and `vp test` to validate changes. + diff --git a/package.json b/package.json index 23a4321c29..20c49bd6b1 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "test:unit": "vp test run", "docs:dev": "pnpm --filter=./docs dev", "docs:build": "pnpm --filter=./docs build", - "prepare": "husky" + "prepare": "vp config" }, "devDependencies": { "@napi-rs/cli": "catalog:", @@ -25,8 +25,6 @@ "@typescript/native-preview": "catalog:", "@voidzero-dev/vite-plus-tools": "workspace:*", "bingo": "catalog:", - "husky": "catalog:", - "lint-staged": "catalog:", "oxfmt": "catalog:", "oxlint": "catalog:", "playwright": "catalog:", @@ -36,10 +34,6 @@ "vitest": "catalog:", "zod": "catalog:" }, - "lint-staged": { - "*.@(js|ts|tsx|md|yaml|yml)": "vp check --fix", - "*.rs": "cargo fmt --" - }, "engines": { "node": ">=22.18.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24bb7e91e4..737d6ae3bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,9 +135,6 @@ catalogs: glob: specifier: ^13.0.0 version: 13.0.0 - husky: - specifier: ^9.1.7 - version: 9.1.7 lint-staged: specifier: ^16.2.6 version: 16.3.2 @@ -292,12 +289,6 @@ importers: bingo: specifier: 'catalog:' version: 0.9.2 - husky: - specifier: 'catalog:' - version: 9.1.7 - lint-staged: - specifier: 'catalog:' - version: 16.3.2 oxfmt: specifier: 'catalog:' version: 0.41.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 6bbf4342f3..4fe604ad92 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -68,7 +68,6 @@ catalog: follow-redirects: ^1.15.6 fs-extra: ^11.3.2 glob: ^13.0.0 - husky: ^9.1.7 jsonc-parser: ^3.3.1 lint-staged: ^16.2.6 lodash-es: ^4.17.21 diff --git a/vite.config.ts b/vite.config.ts index df3ef55db6..5a0ee2f1fd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,10 @@ import { defineConfig } from 'vite-plus'; export default defineConfig({ + staged: { + '*.@(js|ts|tsx|md|yaml|yml)': 'vp check --fix', + '*.rs': 'cargo fmt --', + }, lint: { options: { typeAware: true, From 59cfb3eab2f2bbcd05d4c7367aff1ad47cd1de26 Mon Sep 17 00:00:00 2001 From: arthie Date: Wed, 18 Mar 2026 09:45:19 +0100 Subject: [PATCH 2/4] chore: move "lint-staged" dependency --- packages/cli/package.json | 2 +- pnpm-lock.yaml | 5 +---- pnpm-workspace.yaml | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 3f69ae8335..4278e5d970 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -339,7 +339,7 @@ "detect-indent": "catalog:", "detect-newline": "catalog:", "glob": "catalog:", - "lint-staged": "catalog:", + "lint-staged": "^16.2.6", "minimatch": "catalog:", "mri": "catalog:", "rolldown": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 737d6ae3bb..e8e485b367 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,9 +135,6 @@ catalogs: glob: specifier: ^13.0.0 version: 13.0.0 - lint-staged: - specifier: ^16.2.6 - version: 16.3.2 lodash-es: specifier: ^4.17.21 version: 4.17.23 @@ -378,7 +375,7 @@ importers: specifier: 'catalog:' version: 13.0.0 lint-staged: - specifier: 'catalog:' + specifier: ^16.2.6 version: 16.3.2 minimatch: specifier: 'catalog:' diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 4fe604ad92..6a512fb824 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -69,7 +69,6 @@ catalog: fs-extra: ^11.3.2 glob: ^13.0.0 jsonc-parser: ^3.3.1 - lint-staged: ^16.2.6 lodash-es: ^4.17.21 micromatch: ^4.0.9 minimatch: ^10.0.3 From a2687474ee590f10d20faeb4527d27a3fe7d7259 Mon Sep 17 00:00:00 2001 From: arthie Date: Sat, 21 Mar 2026 21:54:47 +0100 Subject: [PATCH 3/4] fix install --- .claude/settings.json | 5 +---- pnpm-lock.yaml | 14 +------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 7d51bb73da..16d60e3eee 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -2,10 +2,7 @@ "mcpServers": { "vite-plus": { "command": "npx", - "args": [ - "vp", - "mcp" - ] + "args": ["vp", "mcp"] } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e037b04bde..c5a8d99998 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,15 +135,9 @@ catalogs: glob: specifier: ^13.0.0 version: 13.0.0 - husky: - specifier: ^9.1.7 - version: 9.1.7 jsonc-parser: specifier: ^3.3.1 version: 3.3.1 - lint-staged: - specifier: ^16.2.6 - version: 16.4.0 lodash-es: specifier: ^4.17.21 version: 4.17.23 @@ -295,12 +289,6 @@ importers: bingo: specifier: 'catalog:' version: 0.9.2 - husky: - specifier: 'catalog:' - version: 9.1.7 - lint-staged: - specifier: 'catalog:' - version: 16.4.0 oxfmt: specifier: 'catalog:' version: 0.41.0 @@ -393,7 +381,7 @@ importers: specifier: 'catalog:' version: 3.3.1 lint-staged: - specifier: 'catalog:' + specifier: ^16.2.6 version: 16.4.0 minimatch: specifier: 'catalog:' From e35d7ff599663955677e6a53a5c1e411f9b36da5 Mon Sep 17 00:00:00 2001 From: arthie Date: Sat, 21 Mar 2026 21:56:30 +0100 Subject: [PATCH 4/4] run vp config --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index e57b0dd0df..3df71778df 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -202,7 +202,7 @@ These commands map to their corresponding tools. For example, `vp dev --port 300 - **Using the package manager directly:** Do not use pnpm, npm, or Yarn directly. Vite+ can handle all package manager operations. - **Always use Vite commands to run tools:** Don't attempt to run `vp vitest` or `vp oxlint`. They do not exist. Use `vp test` and `vp lint` instead. -- **Running scripts:** Vite+ commands take precedence over `package.json` scripts. If there is a `test` script defined in `scripts` that conflicts with the built-in `vp test` command, run it using `vp run test`. +- **Running scripts:** Vite+ built-in commands (`vp dev`, `vp build`, `vp test`, etc.) always run the Vite+ built-in tool, not any `package.json` script of the same name. To run a custom script that shares a name with a built-in command, use `vp run