Extend Synaptic with custom functionality using TypeScript. Learn the architecture, API, and best practices for building powerful plugins.
The Synaptic plugin system is built on a few core components:
src/plugins/types.ts): Defines the core interfaces.A basic plugin implements the Plugin interface. Here is a minimal example:
import type { Plugin } from '../../plugins/types';
export class MyPlugin implements Plugin {
id = 'my-plugin';
name = 'My Plugin';
version = '1.0.0';
description = 'My amazing plugin for Synaptic';
author = 'Developer',
category = 'productivity';
async onLoad() {
console.log('Plugin loaded!');
}
async onEnable() {
// Initialize your logic here
}
}
Plugins can inject components into various parts of the app:
components = {
view: MyFullPageView, // Renders as a main view
sidebar: MySidebarWidget, // Renders in the sidebar
settings: MySettingsPage // Custom settings UI
};
Register commands to appear in the Command Palette (Cmd+K):
commands = [
{
id: 'say-hello',
name: 'Say Hello',
description: 'Prints hello to console',
handler: () => console.log('Hello World!')
}
];
Plugins must request permissions in their manifest:
read_notes: Access note contentwrite_notes: Modify or create notesstorage: Persist plugin datanetwork: Make external API requestsRecently added, the Voice Memos plugin demonstrates how to use the storage permission to
save binary files and the write_notes permission to embed them.