sdk

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sdk hosts the plugin SDK manifest schema and helpers used by wfctl to discover plugin capabilities (currently: IaC dispatch version).

The SDK manifest is intentionally additive over plugin.PluginManifest; it captures only the fields that wfctl reads at apply-time to choose between the v1 (legacy in-provider Apply) and v2 (wfctlhelpers.ApplyPlan) dispatch paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverWorkflowModuleRoot added in v0.19.0

func DiscoverWorkflowModuleRoot(start string) string

func ManifestSchemaJSON added in v0.21.0

func ManifestSchemaJSON() []byte

ManifestSchemaJSON returns the raw JSON Schema bytes used to validate SDK manifests. Exported for plugin authors and external tooling that want to validate plugin.json without depending on this package's ParseManifest entry point.

Returns a copy so callers cannot mutate the embedded schema; the underlying slice from //go:embed is technically writable.

Types

type DocGenerator

type DocGenerator struct{}

DocGenerator produces markdown documentation from plugin manifests and contracts.

func NewDocGenerator

func NewDocGenerator() *DocGenerator

NewDocGenerator creates a new DocGenerator.

func (*DocGenerator) GenerateContractDoc

func (g *DocGenerator) GenerateContractDoc(contract *dynamic.FieldContract) string

GenerateContractDoc produces a markdown section documenting a field contract.

func (*DocGenerator) GeneratePluginDoc

func (g *DocGenerator) GeneratePluginDoc(manifest *plugin.PluginManifest) string

GeneratePluginDoc produces a complete markdown document for a plugin.

type GenerateOptions

type GenerateOptions struct {
	Name            string
	Version         string
	Author          string
	Description     string
	License         string
	OutputDir       string
	WithContract    bool
	LegacyContracts bool
	GoModule        string // e.g. "github.com/MyOrg/workflow-plugin-foo"
	WorkflowReplace string // optional local replace path for github.com/GoCodeAlone/workflow
}

GenerateOptions configures what gets generated.

type IaCProvider added in v0.21.0

type IaCProvider struct {
	// ComputePlanVersion selects the apply-time dispatch path:
	//   "" (default, treated as "v1"): legacy in-provider Apply switch.
	//   "v1":                          explicit legacy dispatch.
	//   "v2":                          route through wfctlhelpers.ApplyPlan
	//                                   (Replace + input-drift postcondition).
	// Schema-validated against the enum ["v1","v2"]; "" passes validation
	// because the field is optional.
	ComputePlanVersion string `json:"computePlanVersion,omitempty"`
}

IaCProvider describes IaC-provider-specific manifest fields.

func (IaCProvider) EffectiveComputePlanVersion added in v0.21.0

func (p IaCProvider) EffectiveComputePlanVersion() string

EffectiveComputePlanVersion returns the dispatch version, defaulting to "v1" when the manifest omits the field. Callers should always go through this accessor rather than reading ComputePlanVersion directly so the default-v1 contract stays in one place.

type Manifest added in v0.21.0

type Manifest struct {
	// Name is the plugin name. Carried for diagnostics; the SDK schema
	// does not enforce shape (lowercase/hyphen rules live in plugin.PluginManifest).
	Name string `json:"name"`

	// IaCProvider holds IaC-provider-specific manifest fields. Empty
	// (zero-valued) when the plugin does not implement IaCProvider.
	IaCProvider IaCProvider `json:"iacProvider"`
}

Manifest captures the SDK-level fields wfctl reads from plugin.json. It is a strict subset of the full plugin.PluginManifest — only fields that gate apply-time dispatch live here.

func ParseManifest added in v0.21.0

func ParseManifest(data []byte) (*Manifest, error)

ParseManifest validates raw plugin.json bytes against the SDK schema and decodes them into a Manifest. Returns an error if the JSON is malformed or violates the schema (e.g., iacProvider.computePlanVersion not in {"v1","v2"}). Pure-additive: existing plugin.json files without an iacProvider key parse cleanly with a zero-valued IaCProvider.

type TemplateGenerator

type TemplateGenerator struct{}

TemplateGenerator scaffolds new plugin projects with a manifest and component skeleton.

func NewTemplateGenerator

func NewTemplateGenerator() *TemplateGenerator

NewTemplateGenerator creates a new TemplateGenerator.

func (*TemplateGenerator) Generate

func (g *TemplateGenerator) Generate(opts GenerateOptions) error

Generate creates a new plugin directory with manifest and component skeleton, plus a full project structure (cmd/, internal/, CI workflows, Makefile, README).

Directories

Path Synopsis
Package iaclint provides cross-provider review discipline as executable test helpers for IaC plugin authors.
Package iaclint provides cross-provider review discipline as executable test helpers for IaC plugin authors.

Jump to

Keyboard shortcuts

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