component-shape 0.3.5

Framework-neutral component shape metadata and naming utilities.
Documentation
component-shape-0.3.5 has been yanked.

component-shape

Codecov: component-shape crates.io: component-shape

component-shape provides framework-neutral metadata, value compatibility, validated Rust syntax, and naming contracts for library and generator authors in the component-shape project. Depend on it directly for shared contracts that do not need a UI or protocol runtime. GPUI consumers can use the same metadata through component-shape-gpui; typed schemas and decoding belong in component-shape-mcp.

Requires Rust 1.99 or newer.

Example

A shape advertises the value it supports and a coarse input description without constructing a widget or starting an MCP server:

use component_shape::{ComponentShapeFor, ComponentShapeMetadata, McpInput};

struct TextInputShape;

impl ComponentShapeMetadata for TextInputShape {
    const MCP_INPUT: McpInput = McpInput::string();
}

impl ComponentShapeFor<String> for TextInputShape {}

fn main() {
    let input = <TextInputShape as ComponentShapeFor<String>>::MCP_INPUT;
    assert_eq!(input, McpInput::string());
}

ComponentShapeFor<Value> can override this input description for a particular shape/value pair. See the API reference for the metadata and syntax contracts.