@vertesia/create-plugin
v0.82.1
Published
CLI to create Vertesia plugins: UI plugins or tool servers
Readme
@vertesia/plugin
CLI tool to create Vertesia plugins:
- UI Plugins
- Tool Server Plugins.
Usage
# Using pnpm create (recommended)
pnpm create @vertesia/plugin my-project
# Using npm create
npm create @vertesia/plugin my-project
# Using pnpm dlx (runs without installing)
pnpm dlx @vertesia/plugin my-project
# Using npx
npx @vertesia/plugin my-project
# Or install globally
pnpm install -g @vertesia/plugin
create-tool-server my-projectNote: When using pnpm create or npm create, drop the create- prefix from the package name.
Features
- 📦 Downloads template from GitHub - Always get the latest template
- ⚙️ Template-driven configuration - Template defines its own prompts via
template.config.json - 🎨 Interactive prompts - User-friendly CLI with validation
- 🔄 Variable replacement - Automatically replaces
{{VARIABLES}}in files - 🧹 Smart cleanup - Removes meta files after installation
- 📚 Package manager agnostic - Works with npm, pnpm, or yarn
How It Works
- Downloads the template repository from GitHub using
degit - Reads
template.config.jsonfrom the template to determine configuration - Prompts the user for values (project name, description, etc.)
- Replaces variables in specified files (e.g.,
{{PROJECT_NAME}}→my-project) - Cleans up meta files (
.git,template.config.json, etc.) - Installs dependencies using the configured package manager
Configuration
All configuration is centralized in src/configuration.ts:
export const config = {
templateRepo: 'vertesiahq/plugin-template',
templateConfigFile: 'template.config.json',
packageManager: 'pnpm',
// ... more options
}Key Configuration Options
templateRepo- GitHub repository for the template (format:owner/repo)templateConfigFile- Name of the config file in the templatepackageManager- Which package manager to use (npm,pnpm, oryarn)useCache- Whether to cache downloaded templates
Template Structure
The template repository should include a template.config.json file:
{
"version": "1.0",
"prompts": [
{
"type": "text",
"name": "PROJECT_NAME",
"message": "Project name",
"initial": "my-tool-server"
},
{
"type": "text",
"name": "DESCRIPTION",
"message": "Project description",
"initial": "A tool server for LLM integrations"
}
],
"files": [
"package.json",
"README.md",
"src/server.ts"
],
"removeAfterInstall": [
".git",
"template.config.json"
]
}Template Config Schema
prompts- Array of prompts using the prompts library formatfiles- List of files where variable replacement should occurremoveAfterInstall- Files/directories to remove after installationconditionalRemove- Conditional file removal based on user answers
Development
# Install dependencies
pnpm install
# Build
pnpm build
# Test locally
pnpm test
# Watch mode
pnpm devPublishing
# Build and publish
npm publishAfter publishing, users can create projects with:
pnpm create @vertesia/plugin my-projectTemplate Development
To develop a template:
- Create a GitHub repository with your template files
- Add a
template.config.jsonfile with prompts and configuration - Use
{{VARIABLES}}in files where you want replacements - Update
src/configuration.tsto point to your template repo - Test with
pnpm testor run the built CLI directly
Examples
Create a project with default settings
pnpm create @vertesia/plugin my-projectView help
pnpm dlx @vertesia/plugin --helpLicense
MIT
