Skip to main content

Module plugin

Module plugin 

Source
Expand description

Plugin protocol DTOs shared across plugin boundaries. Wire-format DTOs for the plugin protocol.

This module exists to define the stable boundary between osp-cli and external plugins. The app and plugin manager can evolve internally, but the JSON shapes in this module are the contract that both sides need to agree on.

In broad terms:

  • Describe* types advertise commands, arguments, and policy metadata
  • Response* types carry execution results, messages, and render hints
  • validation helpers reject protocol-shape errors before higher-level code tries to trust the payload

Wire flow:

plugin executable
     │
     ├── `describe` -> DescribeV1 / DescribeCommandV1
     │                host builds command catalog, completion, and policy
     │
     └── `run`      -> ResponseV1
                      host validates payload before adapting/rendering it

Useful mental split:

  • plugin authors care about these types as the stable JSON contract
  • host-side code cares about them as validated input before converting into command catalogs, policy registries, and rendered output

Clap-backed convenience constructors such as crate::core::plugin::DescribeV1::from_clap_command are available when the crate is built with the default clap feature. Builds that disable clap still expose the wire DTOs but omit those helper constructors.

Contract:

  • these types may depend on shared core metadata, but they should stay free of host runtime concerns
  • any parsing/validation here should enforce protocol rules, not business policy
  • caller-facing docs should describe stable wire behavior rather than internal plugin manager details

Structs§

DescribeArgV1
Positional argument description emitted by a plugin.
DescribeCommandAuthV1
Authorization metadata attached to a described command.
DescribeCommandV1
Recursive command description used in plugin metadata.
DescribeFlagV1
Flag description emitted by a plugin.
DescribeSuggestionV1
Suggested value emitted in plugin metadata.
DescribeV1
describe payload emitted by a plugin that speaks protocol v1.
ResponseErrorV1
Structured error payload returned when ok is false.
ResponseMessageV1
User-facing message emitted alongside a plugin response.
ResponseMetaV1
Rendering hints attached to a plugin response.
ResponseV1
Protocol v1 command response envelope.

Enums§

ColumnAlignmentV1
Column alignment hint used in plugin response metadata.
DescribeValueTypeV1
Wire-format type hint for plugin argument values.
DescribeVisibilityModeV1
Wire-format visibility mode used by plugin metadata.
ResponseMessageLevelV1
Message severity carried in plugin responses.

Constants§

PLUGIN_PROTOCOL_V1
Current plugin wire protocol version understood by this crate.