{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sdk\n\nPackage sdk contains authoring tools for Workflow plugins.\n\nThe package is used by wfctl plugin init and by tests that need to generate realistic plugin repositories. TemplateGenerator creates a buildable plugin project with plugin.json, Go code, release workflows, GoReleaser metadata, and contract descriptor files. Runtime plugin binaries should use github.com/GoCodeAlone/workflow/plugin/external/sdk.\n\nThis file hosts the plugin SDK manifest schema and helpers used by wfctl to discover plugin capabilities.\n\nThe SDK manifest is intentionally additive over [plugin.PluginManifest](/github.com/GoCodeAlone/workflow/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.\n\n## Functions\n\n```go\nfunc DiscoverWorkflowModuleRoot(start string) string\n```\n\n```go\nfunc ManifestSchemaJSON() []byte\n```\nManifestSchemaJSON 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.\n\nReturns a copy so callers cannot mutate the embedded schema; the underlying slice from //go:embed is technically writable.\n\n## Types\n\n```go\ntype DocGenerator struct{}\n```\nDocGenerator produces markdown documentation from plugin manifests and contracts.\n\n```go\nfunc NewDocGenerator() *DocGenerator\n```\nNewDocGenerator creates a new DocGenerator.\n\n```go\nfunc (g *DocGenerator) GenerateContractDoc(contract *dynamic.FieldContract) string\n```\nGenerateContractDoc produces a markdown section documenting a field contract.\n\n```go\nfunc (g *DocGenerator) GeneratePluginDoc(manifest *plugin.PluginManifest) string\n```\nGeneratePluginDoc produces a complete markdown document for a plugin.\n\n```go\ntype GenerateOptions struct {\n\t// Name is the plugin manifest name. It may include the workflow-plugin-\n\t// prefix; generated type names and step names use the normalized suffix.\n\tName string\n\t// Version is deprecated. Generated plugin.json files use the \"0.0.0\"\n\t// sentinel and release builds inject the real tag into the binary.\n\tVersion string\n\t// Author is required and is also used to build the default Go module path.\n\tAuthor string\n\t// Description is written to plugin.json and README.md. When empty, a\n\t// generic description is used.\n\tDescription string\n\t// License is copied into plugin.json when supplied.\n\tLicense string\n\t// OutputDir is the directory to create. It defaults to Name.\n\tOutputDir string\n\t// WithContract adds the legacy dynamic field contract to plugin.json.\n\tWithContract bool\n\t// LegacyContracts forces the older map-based step scaffold. By default the\n\t// generator emits strict typed contracts when it can resolve a local\n\t// workflow source checkout.\n\tLegacyContracts bool\n\t// GoModule overrides the default github.com/\u003cauthor\u003e/workflow-plugin-\u003cname\u003e\n\t// module path.\n\tGoModule string\n\t// WorkflowReplace is an optional local replace path for\n\t// github.com/GoCodeAlone/workflow.\n\tWorkflowReplace string\n\t// MessageContracts are descriptor-only protobuf contracts to include in\n\t// plugin.contracts.json for plugins that publish messages without serving a\n\t// step for them.\n\tMessageContracts []MessageContract\n}\n```\nGenerateOptions configures a generated plugin project.\n\nThe committed plugin.json version is always the stable \"0.0.0\" sentinel. Release versions are injected into the generated binary from Git tags via GoReleaser ldflags and surfaced at runtime through sdk.ResolveBuildVersion.\n\n```go\ntype IaCProvider struct {\n\t// ComputePlanVersion is parse-time manifest metadata retained for plugin\n\t// authors and validation tooling. Runtime selection is strict: the typed\n\t// CapabilitiesResponse.compute_plan_version gate accepts \"v2\" only and\n\t// routes through wfctlhelpers.ApplyPlanWithHooks.\n\t// Schema-validated against the enum [\"v1\",\"v2\"]; \"\" passes validation for\n\t// older manifests, but load-time typed capability validation rejects non-v2\n\t// providers.\n\tComputePlanVersion string `json:\"computePlanVersion,omitempty\"`\n}\n```\nIaCProvider describes IaC-provider-specific manifest fields.\n\n```go\ntype Manifest struct {\n\t// Name is the plugin name. Carried for diagnostics; the SDK schema\n\t// does not enforce shape (lowercase/hyphen rules live in plugin.PluginManifest).\n\tName string `json:\"name\"`\n\n\t// IaCProvider holds IaC-provider-specific manifest fields. Empty\n\t// (zero-valued) when the plugin does not implement IaCProvider.\n\tIaCProvider IaCProvider `json:\"iacProvider\"`\n}\n```\nManifest 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.\n\n```go\nfunc ParseManifest(data []byte) (*Manifest, error)\n```\nParseManifest 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.\n\n```go\ntype MessageContract struct {\n\tContractType    string   `json:\"contractType\"`\n\tProtoPackage    string   `json:\"protoPackage\"`\n\tMessageNames    []string `json:\"messageNames\"`\n\tGoImportPath    string   `json:\"goImportPath,omitempty\"`\n\tSchemaDigest    string   `json:\"schemaDigest,omitempty\"`\n\tProtocolVersion string   `json:\"protocolVersion,omitempty\"`\n}\n```\nMessageContract describes a descriptor-only protobuf message contract.\n\n```go\nfunc (c MessageContract) ContractDescriptor() (*pb.ContractDescriptor, error)\n```\nContractDescriptor converts c into the shared plugin contract descriptor.\n\n```go\ntype TemplateGenerator struct{}\n```\nTemplateGenerator scaffolds new plugin projects with a manifest and component skeleton.\n\n```go\nfunc NewTemplateGenerator() *TemplateGenerator\n```\nNewTemplateGenerator creates a new TemplateGenerator.\n\n```go\nfunc (g *TemplateGenerator) Generate(opts GenerateOptions) error\n```\nGenerate creates a new plugin directory with manifest and component skeleton, plus a full project structure (cmd/, internal/, CI workflows, Makefile, README).\n\n","path":"github.com/GoCodeAlone/workflow/plugin/sdk","name":"sdk","synopsis":"Package sdk contains authoring tools for Workflow plugins.","isRedistributable":true}
