@voltlaunchrr/plugin-api
v0.1.0
Published
Plugin API for Volt launcher extensions
Maintainers
Readme
@voltlaunchrr/plugin-api
TypeScript API for building Volt launcher plugins.
Installation
npm install @voltlaunchrr/plugin-apiQuick Start
import { Plugin, PluginContext, PluginResult, PluginResultType } from '@voltlaunchrr/plugin-api';
export class MyPlugin implements Plugin {
id = 'my-plugin';
name = 'My Plugin';
description = 'My awesome plugin';
enabled = true;
canHandle(context: PluginContext): boolean {
return context.query.startsWith('my:');
}
async match(context: PluginContext): Promise<PluginResult[]> {
return [{
id: 'result-1',
type: PluginResultType.Info,
title: 'Hello!',
score: 100,
}];
}
async execute(result: PluginResult): Promise<void> {
console.log('Executed!');
}
}
export default MyPlugin;Exports
| Export | Type | Description |
|--------|------|-------------|
| Plugin | Interface | Main plugin contract (canHandle, match, execute) |
| PluginContext | Interface | Query context passed to plugin methods |
| PluginResult | Interface | Result object returned by match() |
| PluginResultType | Enum | 12 result types (Calculator, WebSearch, Info, Password, etc.) |
| PluginRegistry | Interface | Registry contract for managing plugins |
| pluginRegistry | Instance | Singleton registry with parallel querying (500ms timeout) |
Plugin Lifecycle
canHandle(context)- Called on every keystroke. Returntrueif your plugin handles this query. Must be fast (< 1ms).match(context)- Generate results. Can be sync or async. Has a 500ms timeout.execute(result)- Called when user selects a result. Perform the action (copy, open URL, etc.).
Documentation
- Getting Started - Create your first plugin in 5 minutes
- TypeScript API Guide - Detailed TypeScript development guide
- Plugin API Reference - Complete interface documentation
- Examples - Working plugins (Calculator, Password Generator, Web Search)
