Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 2.42 KB

tutorial.md

File metadata and controls

13 lines (9 loc) · 2.42 KB

Build a fourth plugin

The public Go SDK is github.com/allisonhere/tide/sdk/go/pluginapi. A plugin is a separate executable: it reads newline-delimited JSON-RPC from stdin and writes only JSON-RPC to stdout. It may log to stderr. Other languages can implement protocol v1 without importing any Go package.

  1. Copy templates/hello-world into a new directory. Change the manifest ID to your own reverse-domain identifier, and set the name, author, license, version, permissions, and platform entrypoints.
  2. In main.go, handle tide/initialize by returning {"api":"1"}. Handle view/render by returning a document or canvas. Handle view/event to update your own state. Use a mutex if handlers share state: the SDK dispatches requests concurrently.
  3. For host data, call peer.Call(ctx, "host/articles.list", map[string]any{"limit":20}, &result) from a handler. Declare articles.metadata.read in the manifest, then approve it during installation. Keep a deadline on calls and show errors in your UI.
  4. Build a Linux binary into the path listed in entrypoints, for example go build -o bin/my-plugin .. For Windows, build GOOS=windows GOARCH=amd64 go build -o bin/my-plugin.exe . and list windows/amd64 in the manifest. Ensure a Linux entrypoint has executable permissions.
  5. Launch Tide, press P, then i, enter the directory path, inspect the requested permissions, and press y. The managed copy can be replaced by a higher version. Press Enter on the installed plugin to open its view.

For distribution, package tide-plugin.json and the executable at the ZIP root. Name a GitHub release asset tide-plugin-<os>-<arch>.zip, tag the release with the manifest version, and provide a GitHub SHA-256 digest. Users can inspect it through P → h. A private custom registry uses the registry format. Tide never runs build or install scripts from an archive.

The host supports a focused set of methods, including article reads and state, storage, settings, secrets, the browser, notifications, clipboard, approved Markdown export, published articles, and AI generation. See the method table and the later capabilities before declaring permissions, and configuration for settings fields. Plugin-to-plugin services, graphics, and OS sandboxing are not available yet.