wetwire

package module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 1 Imported by: 0

README

wetwire-github-go

CI codecov Go Reference Go Report Card

Declarative GitHub YAML configurations using native Go constructs.

Overview

wetwire-github-go generates GitHub Actions workflows, Dependabot configs, and Issue Templates from typed Go declarations. No YAML required.

package ci

import (
    "github.com/lex00/wetwire-github-go/workflow"
    "github.com/lex00/wetwire-github-go/actions/checkout"
    "github.com/lex00/wetwire-github-go/actions/setup_go"
)

// Workflow declaration
var CI = workflow.Workflow{
    Name: "CI",
    On:   CITriggers,
}

// Triggers as flat variable
var CITriggers = workflow.Triggers{
    Push:        &CIPush,
    PullRequest: &CIPullRequest,
}

var CIPush = workflow.PushTrigger{Branches: []string{"main"}}
var CIPullRequest = workflow.PullRequestTrigger{Branches: []string{"main"}}

// Job declaration
var Build = workflow.Job{
    Name:   "build",
    RunsOn: "ubuntu-latest",
    Steps:  BuildSteps,
}

var BuildSteps = []any{
    checkout.Checkout{},
    setup_go.SetupGo{GoVersion: "1.23"},
    workflow.Step{Run: "go build ./..."},
    workflow.Step{Run: "go test ./..."},
}

Build to YAML:

wetwire-github build ./ci
# Outputs .github/workflows/ci.yml

The "No Parens" Pattern

Resources are declared as Go variables using struct literals — no function calls needed:

// Declare variables
var MyWorkflow = workflow.Workflow{...}
var BuildJob = workflow.Job{...}
var TestJob = workflow.Job{...}

// Cross-references via direct field access
var DeployJob = workflow.Job{
    Needs: []any{BuildJob, TestJob},  // Automatic dependency resolution
}

// Type-safe action wrappers
var CheckoutStep = checkout.Checkout{
    FetchDepth: 0,
    Submodules: "recursive",
}

// Expression contexts
var ConditionalStep = workflow.Step{
    If:  workflow.Branch("main").And(workflow.Push()),
    Run: "deploy.sh",
    Env: workflow.Env{
        "TOKEN": workflow.Secrets.Get("DEPLOY_TOKEN"),
    },
}

// Matrix configuration
var BuildMatrix = workflow.Matrix{
    Values: map[string][]any{"go": {"1.22", "1.23"}},
}

var BuildStrategy = workflow.Strategy{
    Matrix: &BuildMatrix,
}

var MatrixJob = workflow.Job{
    RunsOn:   "ubuntu-latest",
    Strategy: &BuildStrategy,
}

The CLI discovers declarations via AST parsing — no registration required.

Helpers

// []string{} for typed slices
Branches: []string{"main", "develop"}

// []any{} for mixed-type slices
Needs: []any{BuildJob, TestJob}

// Env type alias
Env: workflow.Env{"TOKEN": workflow.Secrets.Get("TOKEN")}

Generated Package Structure

Import existing workflows or init a new project:

wetwire-github import .github/workflows/ci.yml -o my-ci/
# OR
wetwire-github init my-ci/

Generated structure:

my-ci/
├── go.mod                    # Module with wetwire-github-go dependency
├── README.md                 # Generated docs
├── cmd/main.go               # Usage instructions
└── workflows/
    ├── workflows.go          # Workflow declarations
    ├── jobs.go               # Job declarations
    ├── triggers.go           # Trigger configurations
    └── steps.go              # Step declarations

All nested structs become flat variables.

Scope

Config Type Output Schema
GitHub Actions .github/workflows/*.yml workflow schema
Dependabot .github/dependabot.yml dependabot-2.0
Issue Templates .github/ISSUE_TEMPLATE/*.yml issue-forms
Discussion Templates .github/DISCUSSION_TEMPLATE/*.yml discussion-forms

AI-Assisted Design with Kiro

wetwire-github integrates with Kiro CLI for AI-assisted workflow design:

# Install and authenticate with Kiro
curl -fsSL https://cli.kiro.dev/install | bash
kiro-cli login

# Start AI-assisted design session
wetwire-github design --provider kiro "Create a CI workflow for a Go project"

The MCP server (wetwire-github mcp) exposes tools for AI assistants:

  • wetwire_init - Initialize new workflow projects
  • wetwire_lint - Validate code against WAG001-WAG008 rules
  • wetwire_build - Generate .github/workflows/*.yml from Go code
  • wetwire_validate - Validate YAML with actionlint

See docs/GITHUB-KIRO-CLI.md for complete integration guide.

Status

Under development. See Roadmap for implementation plan and feature matrix.

For the wetwire pattern, see the Wetwire Specification.

License

MIT

Documentation

Overview

Package wetwire provides typed Go declarations for generating GitHub YAML configurations.

wetwire-github-go is a synthesis library that generates GitHub Actions workflow YAML, Dependabot configuration, and Issue/Discussion templates from typed Go declarations.

The "No Parens" Pattern

All declarations use struct literals — no function calls or registration:

var CIPush = workflow.PushTrigger{Branches: List("main")}
var CI = workflow.Workflow{Name: "CI", On: workflow.Triggers{Push: CIPush}}
var Build = workflow.Job{Name: "build", RunsOn: "ubuntu-latest", Steps: BuildSteps}

Generated Package Structure

User projects declare workflows as Go variables using struct literals. The wetwire-github CLI discovers these declarations via AST parsing and generates the corresponding YAML output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildResult

type BuildResult struct {
	Success   bool     `json:"success"`
	Workflows []string `json:"workflows,omitempty"`
	Files     []string `json:"files,omitempty"`
	Errors    []string `json:"errors,omitempty"`
}

BuildResult contains the result of a build operation.

type DiscoveredJob

type DiscoveredJob struct {
	Name         string   // Variable name
	File         string   // Source file path
	Line         int      // Line number
	Dependencies []string // Referenced job names (Needs field)
}

DiscoveredJob represents a job found by AST parsing.

type DiscoveredWorkflow

type DiscoveredWorkflow struct {
	Name string   // Variable name
	File string   // Source file path
	Line int      // Line number
	Jobs []string // Job variable names in this workflow
}

DiscoveredWorkflow represents a workflow found by AST parsing.

type GraphResult

type GraphResult struct {
	Success bool   `json:"success"`
	Format  string `json:"format"` // "dot" or "mermaid"
	Output  string `json:"output"`
	Nodes   int    `json:"nodes"`
	Edges   int    `json:"edges"`
}

GraphResult contains the result of a graph operation.

type ImportResult

type ImportResult struct {
	Success   bool     `json:"success"`
	OutputDir string   `json:"output_dir,omitempty"`
	Files     []string `json:"files,omitempty"`
	Workflows int      `json:"workflows"`
	Jobs      int      `json:"jobs"`
	Steps     int      `json:"steps"`
	Errors    []string `json:"errors,omitempty"`
}

ImportResult contains the result of an import operation.

type InitResult

type InitResult struct {
	Success   bool     `json:"success"`
	OutputDir string   `json:"output_dir,omitempty"`
	Files     []string `json:"files,omitempty"`
	Error     string   `json:"error,omitempty"`
}

InitResult contains the result of an init operation.

type LintIssue

type LintIssue struct {
	File     string `json:"file"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
	Severity string `json:"severity"` // "error", "warning", "info"
	Message  string `json:"message"`
	Rule     string `json:"rule"`
	Fixable  bool   `json:"fixable"`
}

LintIssue represents a single lint issue.

type LintResult

type LintResult struct {
	Success bool        `json:"success"`
	Issues  []LintIssue `json:"issues,omitempty"`
}

LintResult contains the result of a lint operation.

type ListResult

type ListResult struct {
	Workflows []ListWorkflow `json:"workflows"`
}

ListResult contains the result of a list operation.

type ListWorkflow

type ListWorkflow struct {
	Name string `json:"name"`
	File string `json:"file"`
	Line int    `json:"line"`
	Jobs int    `json:"jobs"`
}

ListWorkflow represents a workflow in list output.

type OutputRef

type OutputRef struct {
	StepID string
	Output string
}

OutputRef represents a reference to a step output. When serialized to YAML, becomes: ${{ steps.step_id.outputs.name }}

func (OutputRef) String

func (o OutputRef) String() string

String returns the GitHub Actions expression for this output reference.

type TestCase

type TestCase struct {
	Name    string `json:"name"`
	Persona string `json:"persona,omitempty"`
	Passed  bool   `json:"passed"`
	Error   string `json:"error,omitempty"`
}

TestCase represents a single test case result.

type TestResult

type TestResult struct {
	Success bool       `json:"success"`
	Tests   []TestCase `json:"tests,omitempty"`
	Passed  int        `json:"passed"`
	Failed  int        `json:"failed"`
}

TestResult contains the result of a test operation.

type ValidateResult

type ValidateResult struct {
	Success  bool              `json:"success"`
	Errors   []ValidationError `json:"errors,omitempty"`
	Warnings []string          `json:"warnings,omitempty"`
}

ValidateResult contains the result of a validate operation.

type ValidationError

type ValidationError struct {
	File    string `json:"file"`
	Line    int    `json:"line"`
	Column  int    `json:"column"`
	Message string `json:"message"`
	RuleID  string `json:"rule_id,omitempty"`
}

ValidationError represents a validation error from actionlint.

type WorkflowResource

type WorkflowResource interface {
	ResourceType() string // e.g., "workflow", "job"
}

WorkflowResource represents a GitHub workflow resource. All resource types (Workflow, Job) implement this interface.

Directories

Path Synopsis
actions
actions_rs_toolchain
Package actions_rs_toolchain provides a typed wrapper for actions-rs/toolchain.
Package actions_rs_toolchain provides a typed wrapper for actions-rs/toolchain.
add_and_commit
Package add_and_commit provides a typed wrapper for EndBug/add-and-commit.
Package add_and_commit provides a typed wrapper for EndBug/add-and-commit.
add_to_project
Package add_to_project provides a typed wrapper for actions/add-to-project.
Package add_to_project provides a typed wrapper for actions/add-to-project.
attest_build_provenance
Package attest_build_provenance provides a typed wrapper for actions/attest-build-provenance.
Package attest_build_provenance provides a typed wrapper for actions/attest-build-provenance.
aws_configure_credentials
Package aws_configure_credentials provides a typed wrapper for aws-actions/configure-aws-credentials.
Package aws_configure_credentials provides a typed wrapper for aws-actions/configure-aws-credentials.
aws_ecr_login
Package aws_ecr_login provides a typed wrapper for aws-actions/amazon-ecr-login.
Package aws_ecr_login provides a typed wrapper for aws-actions/amazon-ecr-login.
azure_docker_login
Package azure_docker_login provides a typed wrapper for azure/docker-login.
Package azure_docker_login provides a typed wrapper for azure/docker-login.
azure_login
Package azure_login provides a typed wrapper for azure/login.
Package azure_login provides a typed wrapper for azure/login.
azure_webapps_deploy
Package azure_webapps_deploy provides a typed wrapper for azure/webapps-deploy.
Package azure_webapps_deploy provides a typed wrapper for azure/webapps-deploy.
cache
Package cache provides a typed wrapper for actions/cache.
Package cache provides a typed wrapper for actions/cache.
cargo
Package cargo provides a typed wrapper for actions-rs/cargo.
Package cargo provides a typed wrapper for actions-rs/cargo.
checkout
Package checkout provides a typed wrapper for actions/checkout.
Package checkout provides a typed wrapper for actions/checkout.
codecov
Package codecov provides a typed wrapper for codecov/codecov-action.
Package codecov provides a typed wrapper for codecov/codecov-action.
codeql_analyze
Package codeql_analyze provides a typed wrapper for github/codeql-action/analyze.
Package codeql_analyze provides a typed wrapper for github/codeql-action/analyze.
codeql_init
Package codeql_init provides a typed wrapper for github/codeql-action/init.
Package codeql_init provides a typed wrapper for github/codeql-action/init.
configure_pages
Package configure_pages provides a typed wrapper for actions/configure-pages.
Package configure_pages provides a typed wrapper for actions/configure-pages.
cosign_installer
Package cosign_installer provides a typed wrapper for sigstore/cosign-installer.
Package cosign_installer provides a typed wrapper for sigstore/cosign-installer.
create_github_app_token
Package create_github_app_token provides a typed wrapper for actions/create-github-app-token.
Package create_github_app_token provides a typed wrapper for actions/create-github-app-token.
create_pull_request
Package create_pull_request provides a typed wrapper for peter-evans/create-pull-request.
Package create_pull_request provides a typed wrapper for peter-evans/create-pull-request.
create_release
Package create_release provides a typed wrapper for actions/create-release.
Package create_release provides a typed wrapper for actions/create-release.
dawidd6_download_artifact
Package dawidd6_download_artifact provides a typed wrapper for dawidd6/action-download-artifact.
Package dawidd6_download_artifact provides a typed wrapper for dawidd6/action-download-artifact.
dependency_review
Package dependency_review provides a typed wrapper for actions/dependency-review-action.
Package dependency_review provides a typed wrapper for actions/dependency-review-action.
deploy_pages
Package deploy_pages provides a typed wrapper for actions/deploy-pages.
Package deploy_pages provides a typed wrapper for actions/deploy-pages.
docker_build_push
Package docker_build_push provides a typed wrapper for docker/build-push-action.
Package docker_build_push provides a typed wrapper for docker/build-push-action.
docker_login
Package docker_login provides a typed wrapper for docker/login-action.
Package docker_login provides a typed wrapper for docker/login-action.
docker_metadata
Package docker_metadata provides a typed wrapper for docker/metadata-action.
Package docker_metadata provides a typed wrapper for docker/metadata-action.
docker_setup_buildx
Package docker_setup_buildx provides a typed wrapper for docker/setup-buildx-action.
Package docker_setup_buildx provides a typed wrapper for docker/setup-buildx-action.
download_artifact
Package download_artifact provides a typed wrapper for actions/download-artifact.
Package download_artifact provides a typed wrapper for actions/download-artifact.
first_interaction
Package first_interaction provides a typed wrapper for actions/first-interaction.
Package first_interaction provides a typed wrapper for actions/first-interaction.
fossa
Package fossa provides a typed wrapper for fossas/fossa-action.
Package fossa provides a typed wrapper for fossas/fossa-action.
gcp_auth
Package gcp_auth provides a typed wrapper for google-github-actions/auth.
Package gcp_auth provides a typed wrapper for google-github-actions/auth.
gcp_deploy_cloudrun
Package gcp_deploy_cloudrun provides a typed wrapper for google-github-actions/deploy-cloudrun.
Package gcp_deploy_cloudrun provides a typed wrapper for google-github-actions/deploy-cloudrun.
gcp_setup_gcloud
Package gcp_setup_gcloud provides a typed wrapper for google-github-actions/setup-gcloud.
Package gcp_setup_gcloud provides a typed wrapper for google-github-actions/setup-gcloud.
gh_pages_deploy
Package gh_pages_deploy provides a typed wrapper for JamesIves/github-pages-deploy-action.
Package gh_pages_deploy provides a typed wrapper for JamesIves/github-pages-deploy-action.
gh_pages_peaceiris
Package gh_pages_peaceiris provides a typed wrapper for peaceiris/actions-gh-pages.
Package gh_pages_peaceiris provides a typed wrapper for peaceiris/actions-gh-pages.
gh_release
Package gh_release provides a typed wrapper for softprops/action-gh-release.
Package gh_release provides a typed wrapper for softprops/action-gh-release.
github_script
Package github_script provides a typed wrapper for actions/github-script.
Package github_script provides a typed wrapper for actions/github-script.
github_tag_action
Package github_tag_action provides a typed wrapper for anothrNick/github-tag-action.
Package github_tag_action provides a typed wrapper for anothrNick/github-tag-action.
golangci_lint
Package golangci_lint provides a typed wrapper for golangci/golangci-lint-action.
Package golangci_lint provides a typed wrapper for golangci/golangci-lint-action.
helm_chart_releaser
Package helm_chart_releaser provides a typed wrapper for helm/chart-releaser-action.
Package helm_chart_releaser provides a typed wrapper for helm/chart-releaser-action.
hugo
Package hugo provides a typed wrapper for peaceiris/actions-hugo.
Package hugo provides a typed wrapper for peaceiris/actions-hugo.
import_gpg
Package import_gpg provides a typed wrapper for crazy-max/ghaction-import-gpg.
Package import_gpg provides a typed wrapper for crazy-max/ghaction-import-gpg.
junit_report
Package junit_report provides a typed wrapper for mikepenz/action-junit-report.
Package junit_report provides a typed wrapper for mikepenz/action-junit-report.
k8s_set_context
Package k8s_set_context provides a typed wrapper for azure/k8s-set-context.
Package k8s_set_context provides a typed wrapper for azure/k8s-set-context.
kind
Package kind provides a typed wrapper for helm/kind-action.
Package kind provides a typed wrapper for helm/kind-action.
kustomize
Package kustomize provides a typed wrapper for stefanprodan/kustomize-action.
Package kustomize provides a typed wrapper for stefanprodan/kustomize-action.
labeler
Package labeler provides a typed wrapper for actions/labeler.
Package labeler provides a typed wrapper for actions/labeler.
ncipollo_release
Package ncipollo_release provides a typed wrapper for ncipollo/release-action.
Package ncipollo_release provides a typed wrapper for ncipollo/release-action.
pre_commit
Package pre_commit provides a typed wrapper for pre-commit/action.
Package pre_commit provides a typed wrapper for pre-commit/action.
pulumi
Package pulumi provides a typed wrapper for pulumi/actions.
Package pulumi provides a typed wrapper for pulumi/actions.
reviewdog
Package reviewdog provides a typed wrapper for reviewdog/action-setup.
Package reviewdog provides a typed wrapper for reviewdog/action-setup.
scorecard
Package scorecard provides a typed wrapper for ossf/scorecard-action.
Package scorecard provides a typed wrapper for ossf/scorecard-action.
setup_dotnet
Package setup_dotnet provides a typed wrapper for actions/setup-dotnet.
Package setup_dotnet provides a typed wrapper for actions/setup-dotnet.
setup_go
Package setup_go provides a typed wrapper for actions/setup-go.
Package setup_go provides a typed wrapper for actions/setup-go.
setup_helm
Package setup_helm provides a typed wrapper for azure/setup-helm.
Package setup_helm provides a typed wrapper for azure/setup-helm.
setup_java
Package setup_java provides a typed wrapper for actions/setup-java.
Package setup_java provides a typed wrapper for actions/setup-java.
setup_node
Package setup_node provides a typed wrapper for actions/setup-node.
Package setup_node provides a typed wrapper for actions/setup-node.
setup_python
Package setup_python provides a typed wrapper for actions/setup-python.
Package setup_python provides a typed wrapper for actions/setup-python.
setup_ruby
Package setup_ruby provides a typed wrapper for ruby/setup-ruby.
Package setup_ruby provides a typed wrapper for ruby/setup-ruby.
setup_rust
Package setup_rust provides a typed wrapper for dtolnay/rust-toolchain.
Package setup_rust provides a typed wrapper for dtolnay/rust-toolchain.
setup_terraform
Package setup_terraform provides a typed wrapper for hashicorp/setup-terraform.
Package setup_terraform provides a typed wrapper for hashicorp/setup-terraform.
slack
Package slack provides a typed wrapper for slackapi/slack-github-action.
Package slack provides a typed wrapper for slackapi/slack-github-action.
sonarcloud
Package sonarcloud provides a typed wrapper for SonarSource/sonarcloud-github-action.
Package sonarcloud provides a typed wrapper for SonarSource/sonarcloud-github-action.
stale
Package stale provides a typed wrapper for actions/stale.
Package stale provides a typed wrapper for actions/stale.
super_linter
Package super_linter provides a typed wrapper for super-linter/super-linter.
Package super_linter provides a typed wrapper for super-linter/super-linter.
trivy
Package trivy provides a typed wrapper for aquasecurity/trivy-action.
Package trivy provides a typed wrapper for aquasecurity/trivy-action.
upload_artifact
Package upload_artifact provides a typed wrapper for actions/upload-artifact.
Package upload_artifact provides a typed wrapper for actions/upload-artifact.
upload_pages_artifact
Package upload_pages_artifact provides a typed wrapper for actions/upload-pages-artifact.
Package upload_pages_artifact provides a typed wrapper for actions/upload-pages-artifact.
upload_release_asset
Package upload_release_asset provides a typed wrapper for actions/upload-release-asset.
Package upload_release_asset provides a typed wrapper for actions/upload-release-asset.
upload_sarif
Package upload_sarif provides a typed wrapper for github/codeql-action/upload-sarif.
Package upload_sarif provides a typed wrapper for github/codeql-action/upload-sarif.
cmd
wetwire-github command
Command design provides AI-assisted workflow design.
Command design provides AI-assisted workflow design.
Package codegen provides schema fetching and code generation for GitHub Actions.
Package codegen provides schema fetching and code generation for GitHub Actions.
Package codeowners provides types for GitHub CODEOWNERS configuration.
Package codeowners provides types for GitHub CODEOWNERS configuration.
Package dependabot provides types for Dependabot configuration.
Package dependabot provides types for Dependabot configuration.
internal
agent
Package agent provides AI-assisted workflow generation using wetwire-core-go.
Package agent provides AI-assisted workflow generation using wetwire-core-go.
discover
Package discover provides AST-based resource discovery for wetwire workflows.
Package discover provides AST-based resource discovery for wetwire workflows.
importer
Package importer provides YAML parsing into intermediate representation.
Package importer provides YAML parsing into intermediate representation.
linter
Package linter provides Go code quality rules for wetwire workflow declarations.
Package linter provides Go code quality rules for wetwire workflow declarations.
runner
Package runner provides value extraction from Go declarations.
Package runner provides value extraction from Go declarations.
serialize
Package serialize provides YAML serialization for workflow types.
Package serialize provides YAML serialization for workflow types.
template
Package template provides workflow template building with dependency ordering.
Package template provides workflow template building with dependency ordering.
validation
Package validation provides YAML validation using actionlint.
Package validation provides YAML validation using actionlint.
Package templates provides types for GitHub issue and discussion templates.
Package templates provides types for GitHub issue and discussion templates.
Package workflow provides typed Go declarations for GitHub Actions workflows.
Package workflow provides typed Go declarations for GitHub Actions workflows.

Jump to

Keyboard shortcuts

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