TypeScript template plugin
A starting point for a RIM plugin written with the TypeScript SDK. It has two commands:
- Template: Greet (
greet), a safe command: greets thenameargument or the signed-in user and counts the greetings. - Template: Reset greeting count (
reset_greetings), a dangerous command: the app asks you to confirm it, the AI agent can never run it, and the SDK refuses it if it ever arrives unconfirmed.
Files #
template-ts/
rim-plugin.json # manifest: id, commands, the dangerous flag
main.ts # entrypoint the host runs (executable, #!/usr/bin/env node)
plugin.ts # the commands
plugin.test.ts # tests against the SDK's in-memory host
package.json # the SDK, esbuild, TypeScript and Vitest as dev dependencies
tsconfig.json
Make it yours #
- Copy the folder and change
plugin_idinrim-plugin.jsonandPLUGIN_IDinplugin.tsto your own reverse-domain id. - Outside rim-ui,
npm installinstalls@rim-platform/plugin-sdkfrom npm; the imports stay as they are. In rim-ui the npm workspace links the package tosdk/plugin-sdkinstead. The SDK's README says how a plugin repository commits its build. - Add each command to the manifest and to
commandsinplugin.ts. Mark anything that changes or deletes somethingdangerousin both places.
Run it #
- Tests:
npm testhere or in rim-ui runsplugin.test.ts, and in rim-ui the SDK's stdio test starts this plugin as a real process. - In the app:
npm run plugin:bundle -- plugins/template-ts, thencp -r plugins/template-ts/dist/dev.example.template-ts ~/.rim/plugins/, start RIM, and enable "TypeScript Template" in Settings → Plugins. Run Template: Greet from the command palette.