config

package
v0.2.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: GPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ExpectedAPIVersion = "loom.rickliujh.github.io/v1beta1"
	ExpectedKind       = "Loom"
)

Variables

This section is empty.

Functions

func Validate

func Validate(lf *LoomFile) error

Validate checks that a LoomFile has required fields and valid structure.

Types

type CommitPush

type CommitPush struct {
	Message string `yaml:"message"`
	Author  string `yaml:"author,omitempty"`
	Email   string `yaml:"email,omitempty"`
}

type DynamicParamDef added in v0.0.6

type DynamicParamDef struct {
	Name    string `yaml:"name"`
	Command string `yaml:"command"`
	Default string `yaml:"default,omitempty"` // Fallback if not needed; command takes priority.
}

DynamicParamDef defines a parameter whose value comes from a shell command. The command is templated with all resolved params before execution. Dynamic params are always evaluated after all regular params are resolved.

type LLM added in v0.2.0

type LLM struct {
	Provider       string             `yaml:"provider"`                 // "openai", "anthropic", "vertex", "gemini", "openrouter", "bedrock"
	Model          string             `yaml:"model"`                    // e.g. "gpt-4o", "claude-sonnet-4-20250514", "gemini-2.5-flash"
	Prompt         string             `yaml:"prompt"`                   // Templated prompt text
	SystemPrompt   string             `yaml:"systemPrompt,omitempty"`   // Optional system prompt
	Target         string             `yaml:"target"`                   // File path relative to target dir to write/modify
	Mode           string             `yaml:"mode,omitempty"`           // "generate" (default) or "modify"
	MaxTokens      int                `yaml:"maxTokens,omitempty"`      // Max output tokens (optional)
	Retries        int                `yaml:"retries,omitempty"`        // Max retry attempts on failure (default: 0, no retry)
	RetryDelay     string             `yaml:"retryDelay,omitempty"`     // Initial delay between retries (default: "2s"), doubles each attempt
	ProviderConfig *LLMProviderConfig `yaml:"providerConfig,omitempty"` // Provider-specific configuration
}

LLM defines an operation that uses LLM inference to generate or modify a file.

type LLMProviderConfig added in v0.2.0

type LLMProviderConfig struct {
	// Auth — env var name holding the API key (openai, anthropic, gemini, openrouter).
	// Not used by vertex (ADC) or bedrock (AWS credential chain).
	TokenEnv string `yaml:"tokenEnv,omitempty"`

	// Google Cloud (vertex only)
	Project  string `yaml:"project,omitempty"`  // GCP project ID (required for vertex)
	Location string `yaml:"location,omitempty"` // GCP region (default: "us-central1")
}

LLMProviderConfig holds provider-specific settings for the LLM operation. All auth credentials are referenced by env var name — secrets must never appear in loom.yaml.

type LoomFile

type LoomFile struct {
	APIVersion string   `yaml:"apiVersion"`
	Kind       string   `yaml:"kind"`
	Metadata   Metadata `yaml:"metadata"`
	Spec       Spec     `yaml:"spec"`
}

LoomFile represents the top-level loom.yaml structure.

func Load

func Load(moduleDir string) (*LoomFile, error)

Load reads and parses a loom.yaml file from the given module directory.

type Metadata

type Metadata struct {
	Name string `yaml:"name"`
}

type ModuleRef

type ModuleRef struct {
	Name   string            `yaml:"name"`
	Source string            `yaml:"source"`
	Params map[string]string `yaml:"params,omitempty"`
}

type NewFiles

type NewFiles struct {
	Source string `yaml:"source"`
	Dest   string `yaml:"dest,omitempty"`
}

type Operation

type Operation struct {
	Name       string      `yaml:"name"`
	NewFiles   *NewFiles   `yaml:"newFiles,omitempty"`
	Patch      *Patch      `yaml:"patch,omitempty"`
	Shell      *Shell      `yaml:"shell,omitempty"`
	CommitPush *CommitPush `yaml:"commitPush,omitempty"`
	PR         *PR         `yaml:"pr,omitempty"`
	LLM        *LLM        `yaml:"llm,omitempty"`
}

type PR

type PR struct {
	Provider   string   `yaml:"provider"`
	Title      string   `yaml:"title"`
	Body       string   `yaml:"body,omitempty"`
	BaseBranch string   `yaml:"baseBranch,omitempty"`
	Labels     []string `yaml:"labels,omitempty"`
	TokenEnv   string   `yaml:"tokenEnv,omitempty"`
}

type ParamDef

type ParamDef struct {
	Name     string `yaml:"name"`
	Required bool   `yaml:"required,omitempty"`
	Default  string `yaml:"default,omitempty"`
}

type Patch

type Patch struct {
	Engine string `yaml:"engine,omitempty"` // "smp" (default, strategic merge patch) or "json6902"
	Path   string `yaml:"path"`
	Target string `yaml:"target"`
}

type Shell

type Shell struct {
	Command string `yaml:"command"`
	Timeout string `yaml:"timeout,omitempty"`
}

type Spec

type Spec struct {
	Params        []ParamDef        `yaml:"params,omitempty"`
	DynamicParams []DynamicParamDef `yaml:"dynamicParams,omitempty"`
	Excludes      []string          `yaml:"excludes,omitempty"`
	Includes      []string          `yaml:"includes,omitempty"`
	Target        *TargetSpec       `yaml:"target,omitempty"`
	Modules       []ModuleRef       `yaml:"modules,omitempty"`
	Operations    []Operation       `yaml:"operations,omitempty"`
}

type TargetSpec

type TargetSpec struct {
	URL           string `yaml:"url"`
	Branch        string `yaml:"branch,omitempty"`
	FeatureBranch string `yaml:"featureBranch,omitempty"`
}

Jump to

Keyboard shortcuts

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