plugingen

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package plugingen provides multi-language code generation from cleat plugin manifests. It normalizes a plugin.Manifest into an intermediate representation (IR), then feeds it to language-specific generators.

Supported target languages: Go, TypeScript, Python, Rust.

Key types:

  • IR — intermediate representation of a plugin's API surface
  • HostFuncIR — description of a single host function
  • TypeIR — description of a named structured type

Key functions:

  • FromManifest — converts a plugin.Manifest into IR
  • GenerateGo / GenerateTS / GeneratePython / GenerateRust — code gen

Package plugingen provides intermediate representation and code generation from cleat plugin manifests. It normalizes a plugin.Manifest into an IR that is then fed to language-specific code generators (TypeScript, Python, Rust, Go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGo

func GenerateGo(ir *IR) (string, error)

GenerateGo generates Go source code from the IR.

func GeneratePython

func GeneratePython(ir *IR) (string, error)

GeneratePython generates Python source code from the IR.

func GenerateRust

func GenerateRust(ir *IR) (string, error)

GenerateRust generates Rust source code from the IR.

func GenerateTypeScript

func GenerateTypeScript(ir *IR) (string, error)

GenerateTypeScript generates TypeScript source code from the IR.

Types

type FieldIR

type FieldIR struct {
	Name        string
	Type        string // "string", "int64", "float64", "bool", "bytes", "timestamp", "uuid", "array", "map", or a TypeIR name
	Optional    bool
	Description string
	Nested      *TypeIR // for array<T>, optional<T>, map<K,V>, inline objects
	ItemsType   string  // for array<T> with simple element type
	KeyType     string  // for map<K,V> with simple key type
	ValueType   string  // for map<K,V> with simple value type
}

FieldIR describes a single field within a structured type.

Simple fields set only Type (e.g. "string", "int64", "bool", "bytes", "timestamp", "uuid", or a reference to a named TypeIR).

Array fields set ItemsType for simple element types, or Nested for complex element types (inline objects).

Map fields set KeyType and ValueType for simple key/value types, or Nested for complex value types.

Inline object fields set Nested to a *TypeIR with the embedded fields.

func (FieldIR) ArrayLike

func (f FieldIR) ArrayLike() bool

ArrayLike returns true if this field looks like an array.

func (FieldIR) IsArrayType

func (f FieldIR) IsArrayType() bool

IsArrayType is a method on FieldIR to check if it's an array type.

type HostFuncIR

type HostFuncIR struct {
	Name        string
	Description string
	InputType   string // name of the type in Types, or a simple type ("string", etc.)
	OutputType  string // name of the type in Types, or a simple type ("string", etc.)
	Idempotent  bool
	Streaming   bool
}

HostFuncIR describes a single host function (workflow-callable plugin method) in the IR.

type IR

type IR struct {
	PluginName    string
	PluginVersion string
	Description   string
	HostFunctions []HostFuncIR
	Types         []TypeIR
}

IR (Intermediate Representation) is the normalized form of a plugin's API surface, suitable for code generation in any target language.

func FromManifest

func FromManifest(m *plugin.Manifest) (*IR, error)

FromManifest converts a plugin.Manifest to the code-generation IR. It normalizes all types and host function signatures into the IR format.

type TypeIR

type TypeIR struct {
	Name   string
	Fields []FieldIR
}

TypeIR describes a named structured type in the IR.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL