Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ jobs:
path: ./packages/cli/dist
if-no-files-found: error

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

- name: Upload LICENSE files
Expand Down Expand Up @@ -210,11 +210,11 @@ jobs:
pattern: cli
merge-multiple: true

- name: Download cli skills
- name: Download cli docs
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: packages/cli/skills
pattern: cli-skills
path: packages/cli/docs
pattern: cli-docs
merge-multiple: true

- name: Download cli binding
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/npm
/artifacts
/LICENSE
/skills/vite-plus/docs
/docs
9 changes: 2 additions & 7 deletions packages/cli/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@

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.

## Common Pitfalls

- **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`
- **Do not install Vitest, Oxlint, Oxfmt, or tsdown directly:** Vite+ wraps these tools. Do not install or upgrade them, use Vite+ directly.
- **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.
Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.dev/guide/.

## Review Checklist

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

* Docs: https://viteplus.dev/guide/
<!--VITE PLUS END-->
52 changes: 21 additions & 31 deletions packages/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 3. syncCorePackageExports() - Creates shim files to re-export from @voidzero-dev/vite-plus-core
* 4. syncTestPackageExports() - Creates shim files to re-export from @voidzero-dev/vite-plus-test
* 5. syncVersionsExport() - Generates ./versions module with bundled tool versions
* 6. copySkillDocs() - Copies docs into skills/vite-plus/docs for runtime MCP access
* 6. copyBundledDocs() - Copies docs into docs/ for bundled package access
* 7. syncReadmeFromRoot() - Keeps package README in sync
*
* The sync functions allow this package to be a drop-in replacement for 'vite' by
Expand All @@ -19,9 +19,9 @@
*/

import { execSync } from 'node:child_process';
import { existsSync, globSync, readdirSync, statSync } from 'node:fs';
import { copyFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { existsSync, readdirSync, statSync } from 'node:fs';
import { copyFile, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import { dirname, join, relative } from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';

Expand Down Expand Up @@ -74,7 +74,7 @@ if (!skipTs) {
await syncTestPackageExports();
await syncVersionsExport();
}
await copySkillDocs();
await copyBundledDocs();
await syncReadmeFromRoot();

async function buildNapiBinding() {
Expand Down Expand Up @@ -387,42 +387,32 @@ async function syncVersionsExport() {
}

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

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

if (!existsSync(docsSourceDir)) {
console.log(' Docs source directory not found, skipping skill docs copy');
console.log(' Docs source directory not found, skipping docs copy');
return;
}

// Clean and recreate target directory
const skipPrefixes = ['node_modules', '.vitepress/cache', '.vitepress/dist'];
await rm(docsTargetDir, { recursive: true, force: true });
await mkdir(docsTargetDir, { recursive: true });

// Find all markdown files recursively and copy them with their relative paths.
const mdFiles = globSync('**/*.md', { cwd: docsSourceDir }).filter(
(f) => !f.includes('node_modules') && f !== 'index.md',
);
// eslint-disable-next-line unicorn/no-array-sort -- sorted traversal keeps output deterministic
mdFiles.sort();

let copied = 0;
for (const relPath of mdFiles) {
const sourcePath = join(docsSourceDir, relPath);
const targetPath = join(docsTargetDir, relPath);
await mkdir(dirname(targetPath), { recursive: true });
await copyFile(sourcePath, targetPath);
copied++;
}
await cp(docsSourceDir, docsTargetDir, {
recursive: true,
filter: (src) => {
const rel = relative(docsSourceDir, src).replaceAll('\\', '/');
return !skipPrefixes.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`));
},
});

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

async function syncReadmeFromRoot() {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"binding/index.d.ts",
"binding/index.js",
"dist/test",
"docs",
"rules",
"skills",
"templates"
],
"type": "module",
Expand Down
58 changes: 0 additions & 58 deletions packages/cli/skills/vite-plus/SKILL.md

This file was deleted.

4 changes: 1 addition & 3 deletions packages/cli/src/bin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Unified entry point for both the local CLI (via bin/vp) and the global CLI (via Rust vp binary).
*
* Global commands (create, migrate, config, mcp, staged, --version) are handled by tsdown-bundled modules.
* Global commands (create, migrate, config, staged, --version) are handled by tsdown-bundled modules.
* All other commands are delegated to the Rust core through NAPI bindings, which
* uses JavaScript tool resolver functions to locate tool binaries.
*
Expand Down Expand Up @@ -54,8 +54,6 @@ if (command === 'create') {
await import('./migration/bin.js');
} else if (command === 'config') {
await import('./config/bin.js');
} else if (command === 'mcp') {
await import('./mcp/bin.js');
} else if (command === '--version' || command === '-V') {
await import('./version.js');
} else if (command === 'staged') {
Expand Down
Loading
Loading