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§
- Plugin
Config - Plugin-facing view of the
[checks.source]block. - Plugin
Describe - What a plugin sends in response to
--describe. Used by klasp to verify forward-compatibility before invoking--gate. - Plugin
Finding - A single finding reported by a plugin. Maps to klasp’s
Findingstruct. - Plugin
Gate Input - The JSON object written to plugin stdin on
--gate. - Plugin
Gate Output - The JSON object a plugin writes to stdout on
--gate. - Plugin
Supports - Capability flags advertised in
PluginDescribe. - Plugin
Trigger - Git event information forwarded to plugins.
Enums§
- Plugin
Trigger Kind - Git event tier as reported on the plugin wire. Mirrors
GitEventbut kept distinct so wire-format evolution is decoupled from internal types. - Plugin
Verdict - Verdict tier as reported by a plugin. Maps to klasp’s
Verdictenum.
Constants§
- KLASP_
PLUGIN_ BIN_ PREFIX - Prefix for plugin binary names on
$PATH. A plugin namedmy-linteris invoked asklasp-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::Warnfor a plugin infrastructure error. Plugin errors (non-zero exit, malformed JSON, timeout, unknown version) produce aVerdict::Warnwithrule = KLASP_PLUGIN_RULE. The gate continues with the remaining checks — plugin errors never crash klasp.