Skip to main content

Module plugin

Module plugin 

Source
Expand description

Plugin subprocess protocol types — v0.3 experimental.

Design: [docs/plugin-protocol.md]. The protocol is PLUGIN_PROTOCOL_VERSION = 0 — explicitly experimental. It may break in any v0.3.x release and graduates to 1 only at v1.0.

Plugins are separate binaries named klasp-plugin-<name> discovered on $PATH at gate time. They communicate over stdin/stdout using JSON. Two subcommands: --describe (capability query) and --gate (execute a check).

See docs/plugin-protocol.md for the full wire format specification.

Structs§

PluginConfig
Plugin-facing view of the [checks.source] block.
PluginDescribe
What a plugin sends in response to --describe. Used by klasp to verify forward-compatibility before invoking --gate.
PluginFinding
A single finding reported by a plugin. Maps to klasp’s Finding struct.
PluginGateInput
The JSON object written to plugin stdin on --gate.
PluginGateOutput
The JSON object a plugin writes to stdout on --gate.
PluginSupports
Capability flags advertised in PluginDescribe.
PluginTrigger
Git event information forwarded to plugins.

Enums§

PluginTriggerKind
Git event tier as reported on the plugin wire. Mirrors GitEvent but kept distinct so wire-format evolution is decoupled from internal types.
PluginVerdict
Verdict tier as reported by a plugin. Maps to klasp’s Verdict enum.

Constants§

KLASP_PLUGIN_BIN_PREFIX
Prefix for plugin binary names on $PATH. A plugin named my-linter is invoked as klasp-plugin-my-linter. Renaming this prefix is a single-site edit.
KLASP_PLUGIN_RULE
Rule slug used for all plugin infrastructure errors (binary missing, non-zero exit, malformed JSON, version mismatch, timeout). Plugin-reported findings carry their own rule strings — this slug only identifies klasp’s own plugin-runtime warnings.

Functions§

plugin_error_warn
Construct a Verdict::Warn for a plugin infrastructure error. Plugin errors (non-zero exit, malformed JSON, timeout, unknown version) produce a Verdict::Warn with rule = KLASP_PLUGIN_RULE. The gate continues with the remaining checks — plugin errors never crash klasp.