Plugin CLI Reference
The Lokus Plugin CLI (lokus-plugin-cli) is the official command-line tool for creating, building, testing, and publishing Lokus plugins.
Installation
# Install globally
npm install -g lokus-plugin-cli
# Or use with npx (no installation needed)
npx lokus-plugin <command>Commands Overview
| Command | Description |
|---|---|
create | Create a new plugin from a template |
build | Build plugin for production |
dev | Run in development mode with hot reload |
validate | Validate plugin manifest |
link | Link plugin for local development |
package | Create distributable package |
publish | Publish to the registry |
login | Authenticate with the registry |
list | List installed plugins |
info | Show plugin information |
create
Create a new plugin project from a template.
npx lokus-plugin create <plugin-name> [options]Options
| Option | Description |
|---|---|
-t, --template \<name\> | Template to use (see below) |
--skip-prompts | Skip interactive prompts, use defaults |
--author \<name\> | Plugin author name |
--description \<desc\> | Plugin description |
--display-name \<name\> | Human-readable plugin name |
Available Templates
| Template | Description |
|---|---|
basic-typescript | Simple TypeScript plugin with commands |
basic-plugin | Minimal plugin structure |
react-ui-panel | Plugin with React-based UI panel |
ui-extension-plugin | Plugin with toolbar and status bar items |
language-support-plugin | Plugin for language/syntax support |
Examples
# Interactive mode (prompts for all options)
npx lokus-plugin create my-plugin
# Quick start with defaults
npx lokus-plugin create my-plugin --skip-prompts
# Specific template
npx lokus-plugin create my-plugin --template react-ui-panel
# With metadata
npx lokus-plugin create my-plugin \
--template basic-typescript \
--author "John Doe" \
--description "My awesome plugin" \
--display-name "My Plugin"Generated Files
my-plugin/
├── src/
│ └── index.ts # Plugin entry point
├── test/
│ ├── index.test.ts # Unit tests
│ └── setup.ts # Test setup
├── dist/ # Build output (after npm run build)
├── package.json # npm configuration
├── plugin.json # Plugin manifest
├── tsconfig.json # TypeScript config
├── esbuild.config.js # Build configuration
└── README.mdbuild
Build the plugin for production.
npx lokus-plugin build [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
--watch | Watch mode for continuous building |
--minify | Minify output |
--sourcemap | Generate source maps |
Examples
# Build current directory
npx lokus-plugin build
# Build with source maps
npx lokus-plugin build --sourcemap
# Watch mode
npx lokus-plugin build --watch
# Build specific directory
npx lokus-plugin build --path ./my-pluginNote: Most projects use npm run build which is configured in package.json to use esbuild directly.
dev
Run the plugin in development mode with file watching.
npx lokus-plugin dev [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
--verbose | Enable verbose logging |
--clean | Clean build artifacts before starting |
Examples
# Start dev mode
npx lokus-plugin dev
# With verbose output
npx lokus-plugin dev --verbose
# Clean start
npx lokus-plugin dev --cleanvalidate
Validate the plugin manifest (plugin.json).
npx lokus-plugin validate [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
Output
On success:
✓ Plugin manifest is valid
Name: my-plugin
Version: 0.1.0
Description: A Lokus pluginOn failure:
Error: Missing required fields: version, mainExamples
# Validate current directory
npx lokus-plugin validate
# Validate specific plugin
npx lokus-plugin validate --path ./my-pluginlink
Create a symbolic link in the Lokus plugins directory for local development.
npx lokus-plugin link [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
What it does
- Reads the plugin ID from
plugin.json - Creates a symlink at
~/.lokus/plugins/\<plugin-id\>pointing to your plugin directory - Lokus will now load your plugin on startup
Examples
# Link current plugin
npx lokus-plugin link
# Link specific plugin
npx lokus-plugin link --path ./my-pluginVerifying the Link
ls -la ~/.lokus/plugins/
# Should show: my-plugin -> /path/to/your/pluginUnlinking
To remove the link:
rm ~/.lokus/plugins/<plugin-id>package
Create a distributable package (.zip file).
npx lokus-plugin package [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
-o, --output \<dir\> | Output directory |
What it includes
dist/directory (compiled code)plugin.jsonmanifestREADME.md(if exists)LICENSE(if exists)- Assets defined in manifest
Examples
# Package current plugin
npx lokus-plugin package
# Custom output directory
npx lokus-plugin package --output ./releasesOutput: my-plugin-1.0.0.zip
publish
Publish the plugin to the Lokus registry.
npx lokus-plugin publish [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
-r, --registry \<url\> | Registry URL (default: https://lokusmd.com) |
--dry-run | Simulate without publishing |
--tag \<tag\> | Version tag (e.g., beta, latest) |
Prerequisites
- Login first: Run
npx lokus-plugin login - Build: Ensure plugin is built (
npm run build) - Validate: Run
npx lokus-plugin validate - Version: Update version in
plugin.jsonandpackage.json
Examples
# Publish to production
npx lokus-plugin publish
# Dry run (test without publishing)
npx lokus-plugin publish --dry-run
# Publish as beta
npx lokus-plugin publish --tag betaPublish Flow
- Validates manifest
- Packages the plugin
- Uploads to registry at
lokusmd.com/api/v1/registry/publish - Returns the published package URL
login
Authenticate with the plugin registry.
npx lokus-plugin login [options]Options
| Option | Description |
|---|---|
--token \<token\> | API token (or set via prompt) |
Getting a Token
- Go to lokusmd.com/marketplace
- Sign in to your account
- Navigate to Developer Settings
- Generate an API token
Examples
# Interactive login
npx lokus-plugin login
# With token
npx lokus-plugin login --token lok_xxxxxxxxxxxxxxxx
# Using environment variable
export LOKUS_REGISTRY_TOKEN=lok_xxxxxxxxxxxxxxxx
npx lokus-plugin publishToken Storage
Tokens are stored in ~/.lokus/config.json:
{
"registryToken": "lok_xxxxxxxxxxxxxxxx"
}list
List installed plugins.
npx lokus-plugin list [options]Options
| Option | Description |
|---|---|
--json | Output as JSON |
Example Output
Installed Plugins:
my-plugin (0.1.0) - linked
other-plugin (1.2.3) - installedinfo
Show detailed information about a plugin.
npx lokus-plugin info [plugin-id] [options]Options
| Option | Description |
|---|---|
-p, --path \<path\> | Plugin directory (default: .) |
Examples
# Info for current plugin
npx lokus-plugin info
# Info for specific plugin
npx lokus-plugin info my-pluginEnvironment Variables
| Variable | Description |
|---|---|
LOKUS_REGISTRY_URL | Registry URL (default: https://lokusmd.com) |
LOKUS_REGISTRY_TOKEN | Authentication token |
LOKUS_PLUGIN_TOKEN | Alternative token variable |
Configuration
You can configure defaults in package.json:
{
"lokus": {
"manifest": "./plugin.json",
"entry": "./src/index.ts",
"outDir": "./dist"
}
}Or in .lokuspluginrc.json:
{
"registry": "https://lokusmd.com",
"manifest": "./plugin.json"
}Common Workflows
Creating and Testing a New Plugin
# 1. Create plugin
npx lokus-plugin create my-plugin --template basic-typescript
cd my-plugin
# 2. Install dependencies
npm install
# 3. Build
npm run build
# 4. Validate
npx lokus-plugin validate
# 5. Link for development
npx lokus-plugin link
# 6. Start Lokus and test your pluginPublishing a Plugin
# 1. Ensure tests pass
npm test
# 2. Build production
npm run build
# 3. Validate
npx lokus-plugin validate
# 4. Update version
npm version patch # or minor/major
# 5. Login (if not already)
npx lokus-plugin login
# 6. Publish
npx lokus-plugin publishUpdating a Published Plugin
# 1. Make changes
# 2. Update version
npm version patch
# 3. Build and validate
npm run build
npx lokus-plugin validate
# 4. Publish update
npx lokus-plugin publishTroubleshooting
”Command not found"
# Use npx instead of global install
npx lokus-plugin <command>"Plugin manifest not found”
Ensure you’re in the plugin directory and plugin.json exists:
ls plugin.json“Authentication failed"
# Re-login
npx lokus-plugin login
# Check token
cat ~/.lokus/config.json"Version already exists”
Update the version in both plugin.json and package.json:
npm version patchNext Steps
- Getting Started - Create your first plugin
- API Reference - Full API documentation
- Publishing - Detailed publishing guide