Documentation
¶
Overview ¶
Package sdk hosts the plugin SDK manifest schema and helpers used by wfctl to discover plugin capabilities.
The SDK manifest is intentionally additive over plugin.PluginManifest; it captures only the fields that wfctl validates before typed runtime capability discovery. After the strict lifecycle cutover, the typed CapabilitiesResponse.compute_plan_version declaration is authoritative and wfctl accepts "v2" only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverWorkflowModuleRoot ¶ added in v0.19.0
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 is parse-time manifest metadata retained for plugin
// authors and validation tooling. Runtime selection is strict: the typed
// CapabilitiesResponse.compute_plan_version gate accepts "v2" only and
// routes through wfctlhelpers.ApplyPlanWithHooks.
// Schema-validated against the enum ["v1","v2"]; "" passes validation for
// older manifests, but load-time typed capability validation rejects non-v2
// providers.
ComputePlanVersion string `json:"computePlanVersion,omitempty"`
}
IaCProvider describes IaC-provider-specific manifest fields.
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
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).