Plugins
You can extend functionality of the core by writing plugins. We created SDK for plugins that serves as a bridge between the core and the plugin. Wsb harpoon uses npm for managing plugins, so you can upload your plugin to npm repository and install it from there. If you would like to add your plugin as a pre-bundled plugin feel free to contact maintainers.
Create plugin
- create package
npm init - install sdk for plugins
npm i @wsb-harpoon/tools - create
/dist/index.mjsimport {definePlugin} from '@wsb-harpoon/tools'; export default definePlugin({ // Your configuration }) - link your plugin to npm
# in plugin folder npm link - link your plugin to wsb core
#in `~/wsb-harpoon/.internal` (name is defined in package.json of your plugin) npm link {pluginName}
SDK
Plugin configuration
Wsb harpoon expect that your plugin will have default export of your plugin config in /dist/index.mjs
You can use definePlugin function from @wsb-harpoon/tools to create config object. It will provide you type safety
for your config.
name
type string
Name of your plugin has to be unique. It will be used to identify your plugin in the core.
description
type string (optional)
Description of your plugin functionality
version
type string (optional)
Version of your plugin.
commands
type Commands (optional)
export interface Commands {
[key: string]: Command
}
export interface Command {
description: string, // description of what command does
handler: (config: Config) => Promise<void> // function that executes command
}
Definition of you plugins commands.
beforeInstall
type () => Promise<void> (optional)
You can use this as a hook to do some actions before installation of your plugin.
afterInstall
type () => Promise<void> (optional)
You can use this as a hook to do some actions after installation of your plugin.
SDK functions
Function that are exported directly from @wsb-harpoon/tools
writeDocument
type (documentName: string, data: any) => Promise<void>
write into document
readDocument
type (documentName: string) => Promise<any>
read and return document
listDocuments
type () => Promise<string[]>
list all documents
