Plugins

Planned for v0.3. This is a design, not a shipped feature, and nothing here runs today.

The idea

A plugin is a program, in any language, that exchanges JSON over stdin and stdout. Fudge's built-in features use the same provider interface, so plugins are meant to be first class.

Layout

Each plugin lives in its own folder with a manifest.

~/.local/share/fudge/plugins/<id>/plugin.toml
id      = "hello"
keyword = "hi"
exec    = "python3 plugin.py"
version = "0.1.0"

Protocol

  1. Fudge starts your program the first time its keyword is typed, and keeps it running.
  2. For each query, it writes one JSON line to stdin, such as {"method":"query","params":{"text":"hi bob"}}.
  3. You reply with one JSON line holding a list of results. Each has a title, a subtitle and an action: open, copy, run or paste.
  4. The host enforces timeouts, so a slow plugin cannot freeze the box.

Field names are not final.

Example

A draft Python plugin that replies with a greeting and copies it on Enter.

#!/usr/bin/env python3
import json, sys

for line in sys.stdin:
    msg = json.loads(line)
    if msg.get("method") != "query":
        continue
    text = msg["params"]["text"].strip()
    name = text.removeprefix("hi").strip() or "world"
    reply = {
        "results": [{
            "title": f"Hello, {name}",
            "subtitle": "Press Enter to copy",
            "action": {"type": "copy", "text": f"Hello, {name}"},
        }]
    }
    print(json.dumps(reply), flush=True)

Registry

Planned as a git-backed registry: a GitHub repository with an index.json signed with minisign, verified before anything installs. Downloads happen only when you browse or install, as the privacy page lists.