Sliprail validates an extension's registered ID, manifest, entry file, and default export before loading it.
All public and private extensions need an ID from the Sliprail Developer Portal.
manifest.jsonThe following fields are required for an extension manifest:
iddisplayNamedescriptionmainicon is optional. displayName and description can be a string or a language map.
{
"id": "your-registered-extension-id",
"displayName": {
"en": "Hello Sliprail",
"zh-hans": "你好 Sliprail"
},
"description": {
"en": "Copies a greeting to the clipboard",
"zh-hans": "将问候语复制到剪贴板"
},
"main": "main.mjs",
"icon": "icon.svg"
}
The main path is relative to the directory containing manifest.json and must point to an existing JavaScript module.
import type { Extension } from '@sliprail/sdk'
const extension: Extension = {
shortcuts: [
{
id: 'hello-sliprail',
displayName: {
en: 'Hello Sliprail',
'zh-hans': '你好 Sliprail',
},
handle: (context) => {
context.writeTextToClipboard('Hello from Sliprail')
context.showNotification({
title: 'Hello Sliprail',
message: 'The greeting was copied to the clipboard',
})
},
},
],
}
export default extension
Sliprail imports the file referenced by main and reads its default export. A named export alone will not load as an extension.
If the source file is TypeScript, build it to the JavaScript path referenced by main before loading the project directory.