Documentation
¶
Overview ¶
Package plugin starts the programs docs/PLUGINS.md describes: `jaira <id>` runs ~/.jaira/plugins/<id>/jaira-<id>, and a write a plugin subscribed to runs `jaira-<id> event <name>`.
What runs is only what sits in the plugins directory. jaira never searches PATH for a jaira-<id>: a program somebody dropped on PATH is not a plugin a person chose to install, and the directory is the whitelist.
Index ¶
Constants ¶
const InEventVar = "JAIRA_IN_EVENT"
InEventVar is set to "1" for a plugin run by an event. A write made from inside one fires no events, or a plugin that answers a set with a set — or two plugins answering each other — would never stop.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
func Dir() string
Dir is where installed plugins live: plugins/ beside settings.json, which is JAIRA_HOME when that is set, so tests and a sandboxed run never reach the real one.
func Fire ¶
Fire runs `jaira-<id> event <name>` for each of ids — what Subscribers returned — one after the other, with payload on stdin. Nothing about a plugin's run reaches the caller: the write has already happened, so a plugin that fails, times out or is missing changes nothing about the command's result. Its output is discarded, as a hook's is, so it never mixes into JSON an agent is parsing.
func Program ¶
Program is the path of id's program, or "" when id is not a well-formed id or no such plugin is installed.
func Run ¶
Run starts prog with args on jaira's own stdin, stdout and stderr, in the directory jaira was started in, and returns the plugin's exit code. The error is only for a program that could not be started at all.
func Subscribers ¶
Subscribers are the ids of the installed plugins whose manifest names event, in order of their ids. A plugin without a readable manifest, or whose manifest names another id, hears nothing: the manifest is the subscription.
Inside an event — JAIRA_IN_EVENT=1 — there are none, so a write a plugin makes from its own event calls nobody.
Types ¶
type Env ¶
type Env struct {
// Root is the directory holding .jaira/, "" outside a repository.
Root string
// Board is the board the call works on, "default" for today's.
Board string
// Version is the running jaira's version.
Version string
}
Env is what a plugin is told about the call, in the three variables the standard names.