install_vue_project
Create a Vue.js project using Vite, configure templates (Vue or TypeScript), install dependencies, and open in VSCode for immediate development.
Instructions
Create a new Vue project using Vite and open it in VSCode
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectName | Yes | Name of the Vue project | |
| destination | Yes | Directory where to create the project (e.g., ~/Desktop) | |
| template | No | Vite template to use | |
| installDependencies | No | Install dependencies after creating project (default: true) |
Implementation Reference
- src/index.ts:335-387 (handler)The main handler logic for the 'install_vue_project' tool. It resolves the destination path, ensures the directory exists, creates a new Vite Vue.js project using 'npm create vite', optionally installs dependencies with 'npm install', opens the project in VSCode, and returns a success message with instructions.case "install_vue_project": { const { projectName, destination, template = "vue-ts", installDependencies = true } = args as { projectName: string; destination: string; template?: string; installDependencies?: boolean; }; const destPath = resolvePath(destination); await ensureDirectory(destPath); // Create Vite Vue project const createCommand = `npm create vite@latest ${projectName} -- --template ${template}`; const { stdout: createOutput } = await execa(createCommand, { shell: true, cwd: destPath, }); const projectPath = path.join(destPath, projectName); // Install dependencies if requested if (installDependencies) { const installCommand = "npm install"; const { stdout: installOutput } = await execa(installCommand, { shell: true, cwd: projectPath, }); } // Open in VSCode await openInVSCode(projectPath); return { content: [ { type: "text", text: `Vue project "${projectName}" created successfully with Vite at ${projectPath}\n\n` + `Template: ${template}\n` + `Dependencies: ${installDependencies ? "Installed" : "Not installed (run npm install manually)"}\n` + `VSCode: Opened\n\n` + `To start development:\n` + ` cd ${projectPath}\n` + ` ${installDependencies ? "" : "npm install\n "}npm run dev`, }, ], }; }
- src/index.ts:147-169 (schema)Input schema defining the parameters for the 'install_vue_project' tool: projectName (required), destination (required), template (enum: vue, vue-ts), installDependencies (boolean, default true).inputSchema: { type: "object", properties: { projectName: { type: "string", description: "Name of the Vue project", }, destination: { type: "string", description: "Directory where to create the project (e.g., ~/Desktop)", }, template: { type: "string", description: "Vite template to use", enum: ["vue", "vue-ts"], }, installDependencies: { type: "boolean", description: "Install dependencies after creating project (default: true)", }, }, required: ["projectName", "destination"], },
- src/index.ts:144-170 (registration)Tool registration in the ListTools response, including name, description, and inputSchema.{ name: "install_vue_project", description: "Create a new Vue project using Vite and open it in VSCode", inputSchema: { type: "object", properties: { projectName: { type: "string", description: "Name of the Vue project", }, destination: { type: "string", description: "Directory where to create the project (e.g., ~/Desktop)", }, template: { type: "string", description: "Vite template to use", enum: ["vue", "vue-ts"], }, installDependencies: { type: "boolean", description: "Install dependencies after creating project (default: true)", }, }, required: ["projectName", "destination"], }, },
- src/index.ts:34-58 (helper)Helper function to open a project directory in VSCode, with fallback paths for the 'code' executable.async function openInVSCode(projectPath: string): Promise<void> { try { await execa("code", [projectPath]); } catch (error) { // If 'code' command fails, try common VSCode executable paths const vscodePaths = [ "code", "/usr/local/bin/code", "/usr/bin/code", "C:\\Program Files\\Microsoft VS Code\\Code.exe", "C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe", ]; for (const codePath of vscodePaths) { try { await execa(codePath, [projectPath]); return; } catch { // Continue to next path } } throw new Error("VSCode not found. Please ensure VSCode is installed and 'code' command is available in PATH"); } }
- src/index.ts:26-31 (helper)Helper function to resolve paths, handling '~' expansion to home directory.function resolvePath(inputPath: string): string { if (inputPath.startsWith("~")) { return path.join(os.homedir(), inputPath.slice(1)); } return path.resolve(inputPath); }