Skip to content

Commit eafe577

Browse files
committed
feat: Ship docs directly at vite-plus/docs. (#1440)
This PR: * Ships the docs at `vite-plus/docs` * Further reduces the size of what we add to `AGENTS.md` * Removes the skills and mcp features in Vite+, which are unused and we aren't planning on using at this time. If we change our mind, we can bring them back anytime.
1 parent 2e7f74d commit eafe577

11 files changed

Lines changed: 32 additions & 910 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ jobs:
160160
path: ./packages/cli/dist
161161
if-no-files-found: error
162162

163-
- name: Upload cli skills (docs for agent integration)
163+
- name: Upload cli docs
164164
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
165165
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
166166
with:
167-
name: cli-skills
168-
path: ./packages/cli/skills
167+
name: cli-docs
168+
path: ./packages/cli/docs
169169
if-no-files-found: error
170170

171171
- name: Upload LICENSE files
@@ -210,11 +210,11 @@ jobs:
210210
pattern: cli
211211
merge-multiple: true
212212

213-
- name: Download cli skills
213+
- name: Download cli docs
214214
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
215215
with:
216-
path: packages/cli/skills
217-
pattern: cli-skills
216+
path: packages/cli/docs
217+
pattern: cli-docs
218218
merge-multiple: true
219219

220220
- name: Download cli binding

packages/cli/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/npm
22
/artifacts
33
/LICENSE
4-
/skills/vite-plus/docs
4+
/docs

packages/cli/AGENTS.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,12 @@
44

55
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, and it invokes Vite through `vp dev` and `vp build`. Run `vp help` to print a list of commands and `vp <command> --help` for information about a specific command.
66

7-
## Common Pitfalls
8-
9-
- **Running scripts:** Vite+ built-in commands (`vp lint`, `vp dev`, `vp build`, `vp test`, etc.) always run the Vite+ built-in tool. Use `vp run <script>` to run `package.json` scripts or tasks defined in `vite.config.ts`
10-
- **Do not install Vitest, Oxlint, Oxfmt, or tsdown directly:** Vite+ wraps these tools. Do not install or upgrade them, use Vite+ directly.
11-
- **Import JavaScript modules from `vite-plus`:** Import modules from the `vite-plus` dependency, not from `vite` or `vitest`. 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.
7+
Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.dev/guide/.
128

139
## Review Checklist
1410

1511
- [ ] Run `vp install` after pulling remote changes and before getting started.
1612
- [ ] Run `vp check` and `vp test` to format, lint, type check and test changes.
17-
- [ ] Check if there are tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.
13+
- [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.
1814

19-
* Docs: https://viteplus.dev/guide/
2015
<!--VITE PLUS END-->

packages/cli/build.ts

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* 3. syncCorePackageExports() - Creates shim files to re-export from @voidzero-dev/vite-plus-core
88
* 4. syncTestPackageExports() - Creates shim files to re-export from @voidzero-dev/vite-plus-test
99
* 5. syncVersionsExport() - Generates ./versions module with bundled tool versions
10-
* 6. copySkillDocs() - Copies docs into skills/vite-plus/docs for runtime MCP access
10+
* 6. copyBundledDocs() - Copies docs into docs/ for bundled package access
1111
* 7. syncReadmeFromRoot() - Keeps package README in sync
1212
*
1313
* The sync functions allow this package to be a drop-in replacement for 'vite' by
@@ -19,9 +19,9 @@
1919
*/
2020

2121
import { execSync } from 'node:child_process';
22-
import { existsSync, globSync, readdirSync, statSync } from 'node:fs';
23-
import { copyFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
24-
import { dirname, join } from 'node:path';
22+
import { existsSync, readdirSync, statSync } from 'node:fs';
23+
import { copyFile, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
24+
import { dirname, join, relative } from 'node:path';
2525
import { fileURLToPath } from 'node:url';
2626
import { parseArgs } from 'node:util';
2727

@@ -74,7 +74,7 @@ if (!skipTs) {
7474
await syncTestPackageExports();
7575
await syncVersionsExport();
7676
}
77-
await copySkillDocs();
77+
await copyBundledDocs();
7878
await syncReadmeFromRoot();
7979

8080
async function buildNapiBinding() {
@@ -387,42 +387,32 @@ async function syncVersionsExport() {
387387
}
388388

389389
/**
390-
* Copy markdown doc files from the monorepo docs/ directory into skills/vite-plus/docs/,
391-
* preserving the relative directory structure. This keeps stable file paths for
392-
* skills routing and MCP page slugs.
390+
* Copy the docs source tree into docs/, preserving relative paths.
391+
* Generated VitePress output and installed dependencies are excluded so the package
392+
* only ships authoring sources and referenced assets.
393393
*/
394-
async function copySkillDocs() {
395-
console.log('\nCopying skill docs...');
394+
async function copyBundledDocs() {
395+
console.log('\nCopying bundled docs...');
396396

397397
const docsSourceDir = join(projectDir, '..', '..', 'docs');
398-
const docsTargetDir = join(projectDir, 'skills', 'vite-plus', 'docs');
398+
const docsTargetDir = join(projectDir, 'docs');
399399

400400
if (!existsSync(docsSourceDir)) {
401-
console.log(' Docs source directory not found, skipping skill docs copy');
401+
console.log(' Docs source directory not found, skipping docs copy');
402402
return;
403403
}
404404

405-
// Clean and recreate target directory
405+
const skipPrefixes = ['node_modules', '.vitepress/cache', '.vitepress/dist'];
406406
await rm(docsTargetDir, { recursive: true, force: true });
407-
await mkdir(docsTargetDir, { recursive: true });
408-
409-
// Find all markdown files recursively and copy them with their relative paths.
410-
const mdFiles = globSync('**/*.md', { cwd: docsSourceDir }).filter(
411-
(f) => !f.includes('node_modules') && f !== 'index.md',
412-
);
413-
// eslint-disable-next-line unicorn/no-array-sort -- sorted traversal keeps output deterministic
414-
mdFiles.sort();
415-
416-
let copied = 0;
417-
for (const relPath of mdFiles) {
418-
const sourcePath = join(docsSourceDir, relPath);
419-
const targetPath = join(docsTargetDir, relPath);
420-
await mkdir(dirname(targetPath), { recursive: true });
421-
await copyFile(sourcePath, targetPath);
422-
copied++;
423-
}
407+
await cp(docsSourceDir, docsTargetDir, {
408+
recursive: true,
409+
filter: (src) => {
410+
const rel = relative(docsSourceDir, src).replaceAll('\\', '/');
411+
return !skipPrefixes.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`));
412+
},
413+
});
424414

425-
console.log(` Copied ${copied} doc files to skills/vite-plus/docs/ (with paths preserved)`);
415+
console.log(' Copied docs to docs/ (with paths preserved)');
426416
}
427417

428418
async function syncReadmeFromRoot() {

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"binding/index.d.ts",
2929
"binding/index.js",
3030
"dist/test",
31+
"docs",
3132
"rules",
32-
"skills",
3333
"templates"
3434
],
3535
"type": "module",

packages/cli/skills/vite-plus/SKILL.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

packages/cli/src/bin.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Unified entry point for both the local CLI (via bin/vp) and the global CLI (via Rust vp binary).
33
*
4-
* Global commands (create, migrate, config, mcp, staged, --version) are handled by tsdown-bundled modules.
4+
* Global commands (create, migrate, config, staged, --version) are handled by tsdown-bundled modules.
55
* All other commands are delegated to the Rust core through NAPI bindings, which
66
* uses JavaScript tool resolver functions to locate tool binaries.
77
*
@@ -54,8 +54,6 @@ if (command === 'create') {
5454
await import('./migration/bin.js');
5555
} else if (command === 'config') {
5656
await import('./config/bin.js');
57-
} else if (command === 'mcp') {
58-
await import('./mcp/bin.js');
5957
} else if (command === '--version' || command === '-V') {
6058
await import('./version.js');
6159
} else if (command === 'staged') {

0 commit comments

Comments
 (0)