Documentation
¶
Index ¶
- Constants
- func Validate(lf *LoomFile) error
- func ValidateInDir(lf *LoomFile, moduleDir string) error
- type CommitPush
- type DynamicParamDef
- type LLM
- type LLMProviderConfig
- type LoomFile
- type Metadata
- type ModuleRef
- type NewFiles
- type Operation
- type PR
- type ParamDef
- type Patch
- type Shell
- type Spec
- type TargetSpec
Constants ¶
const ( ExpectedAPIVersion = "loom.rickliujh.github.io/v1beta1" ExpectedKind = "Loom" )
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate checks that a LoomFile has required fields and valid structure. All violations are collected and returned as a single joined error so a config can be fixed in one pass.
func ValidateInDir ¶ added in v0.3.0
ValidateInDir runs all Validate checks plus filesystem checks that need the module directory: newFiles.source must be an existing directory and patch.path an existing file (both resolved like at run time, skipped when templated).
Types ¶
type CommitPush ¶
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.
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"`
// PreserveComments controls whether target comments survive an smp merge:
// "true" (default) or "false". String so it stays templatable (T4).
PreserveComments string `yaml:"preserveComments,omitempty"`
}
type Shell ¶
type Shell struct {
Command string `yaml:"command"`
Timeout string `yaml:"timeout,omitempty"`
// Pure marks this command as having no external side effects,
// making it safe to run in --local-run mode.
// Shell commands are skipped by default when --local-run is set.
Pure bool `yaml:"pure,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"`
}