Documentation
¶
Overview ¶
Package codegen renders a complete consumer `main.go` from a KDL Guardfile, so a consumer never hand-writes the specverb wiring. See docs/specverb.md.
Index ¶
Constants ¶
const ( TransportSpec = "spec" TransportExec = "exec" TransportMCP = "mcp" )
Transport is the dialect one merged member speaks: spec (HTTP/specverb), exec (wrapped binary/execverb), or mcp (upstream MCP server/mcpverb).
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render emits a gofmt'd `package main` wiring specverb.Mount for gf, the single-guardfile convenience over RenderSet.
func RenderParams ¶
RenderParams emits a gofmt'd `package main` from pre-planned SetParams, mixing spec and exec members onto the one shared binary. The driver's entry.
Types ¶
type EmbeddedFile ¶
EmbeddedFile maps the guardfile-relative source key used by execverb to the project-relative artifact name embedded in generated Go.
type Params ¶
type Params struct {
Transport string // TransportSpec | TransportExec
Binary string // binary name, e.g. ward (Guardfile group[0])
GuardfileName string // embedded Guardfile filename, e.g. forgejo.guardfile.kdl
SpecLockName string // committed gzip lock filename, e.g. forgejo.swagger.lock.json.gz
SpecURL string // upstream Swagger URL; the `umbra lock` source and bootstrap fallback
SpecEnvVar string // env var overriding the embedded lock, e.g. WARD_KDL_SPEC
// Providers are the value-source provider names this member's guardfile uses,
// so the codegen wires exactly the resolvers in play. Empty for an exec member.
Providers []string
// ProviderDecls are the member's `provider <name> { exec ... }` declarations,
// the consumer-supplied resolvers for any non-builtin provider it names.
ProviderDecls []guardfile.ProviderDecl
// EmbeddedFiles are fixed build-time sources used as typed argv by an exec
// member. Empty for spec members.
EmbeddedFiles []EmbeddedFile
// Replace marks an exec member that declares `replace`: the generated binary
// is the wrapped tool rather than a verb group under a driver.
Replace bool
// Occluded is the binary name a replacement is installed under. Empty unless
// Replace is set. See docs/execverb-replacement.md.
Occluded string
}
Params is the per-consumer data the template binds to, derived from the Guardfile. The spec-lock fields are empty for an exec member. See specverb.md.
func Plan ¶
Plan derives the per-consumer Params from gf without rendering, the shared derivation behind both Render and the driver. guardfileName feeds the embed.
type SetParams ¶
type SetParams struct {
Binary string
Mounts []Params
HasSpec bool
HasExec bool
HasMCP bool
HasEmbeds bool
// ExecProviders are the consumer-declared resolvers actually named by some
// member, deduped. umbra itself ships none. See docs/value-providers.md.
ExecProviders []guardfile.ProviderDecl
// Replace roots the binary at the wrapped tool, so a grant is a top-level
// verb. Only ever set with exactly one mount.
Replace bool
// Occluded is the tool name the replacement stands in front of.
Occluded string
}
SetParams binds the merged-binary template: one shared Binary and N mounts. HasSpec/HasExec/HasMCP gate the per-transport imports the template emits.