Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface {
Execute(ctx context.Context, execCtx *ExecutionContext) error
}
Action is the interface that all operation types implement.
type ActionFactory ¶
type ActionFactory func() Action
ActionFactory creates an Action from raw operation config.
type CommitPushAction ¶
type CommitPushAction struct {
Config config.CommitPush
}
CommitPushAction commits all changes and pushes to the remote.
func (*CommitPushAction) Execute ¶
func (a *CommitPushAction) Execute(ctx context.Context, execCtx *ExecutionContext) error
type ExecutionContext ¶
type ExecutionContext struct {
// ModuleName is the metadata.name of the executing module.
ModuleName string
// ModuleDir is the path to the module directory containing loom.yaml.
ModuleDir string
// TargetDir is the path to the target repository working directory.
TargetDir string
// Params are the resolved template parameters.
Params map[string]string
// Excludes are glob patterns for files/dirs to exclude from template walking.
Excludes []string
// Includes are glob patterns that override excludes (including implicit ones).
Includes []string
// DryRun indicates whether to simulate operations.
DryRun bool
// LocalRun runs all operations locally but skips remote push and PR creation.
LocalRun bool
// ShowDiff displays file diffs during dry-run.
ShowDiff bool
// DiffWriter is the destination for diff output (bypasses the logger).
// When nil, diff output is suppressed.
DiffWriter io.Writer
// GitAuthor is the default git author name for commitPush when not set in loom.yaml.
GitAuthor string
// GitEmail is the default git author email for commitPush when not set in loom.yaml.
GitEmail string
// Summary collects created PRs/MRs across the run. May be nil.
Summary *RunSummary
// Logger is the structured logger.
Logger *slog.Logger
}
ExecutionContext holds runtime state shared across actions.
type InferFunc ¶ added in v0.2.0
InferFunc is the signature for LLM inference. Defaults to llm.Infer.
type LLMAction ¶ added in v0.2.0
type LLMAction struct {
Config config.LLM
// Infer overrides the inference function (for testing). Nil uses llm.Infer.
Infer InferFunc
}
LLMAction uses LLM inference to generate or modify a file.
type NewFilesAction ¶
NewFilesAction renders template files from the module directory and writes them to the target directory.
func (*NewFilesAction) Execute ¶
func (a *NewFilesAction) Execute(ctx context.Context, execCtx *ExecutionContext) error
type PRResult ¶ added in v0.3.0
type PRResult struct {
// Module is the name of the module whose pr operation created it.
Module string
// Title is the rendered PR title.
Title string
// URL is the web URL of the created PR/MR.
URL string
}
PRResult records one pull/merge request created during a run.
type PatchAction ¶
PatchAction applies patch operations to a target YAML file using the kustomize library. Two engines are supported:
- "smp" (default): Strategic Merge Patch — a partial YAML document deep-merged into the target.
- "json6902": RFC 6902 JSON Patch — an explicit list of add/remove/replace/move/copy/test operations.
func (*PatchAction) Execute ¶
func (a *PatchAction) Execute(ctx context.Context, execCtx *ExecutionContext) error
type RunSummary ¶ added in v0.3.0
type RunSummary struct {
PRs []PRResult
}
RunSummary collects outward-facing results across a whole run, shared by parent and child module executions. Execution is sequential, so no locking is needed.
func (*RunSummary) AddPR ¶ added in v0.3.0
func (s *RunSummary) AddPR(module, title, url string)
AddPR records a created PR/MR. Safe to call on a nil summary.
func (*RunSummary) Print ¶ added in v0.3.0
func (s *RunSummary) Print(w io.Writer)
Print writes the collected PR/MR list to w. Nothing is written when the summary is nil or empty.
type ShellAction ¶
ShellAction runs a shell command on the host.
func (*ShellAction) Execute ¶
func (a *ShellAction) Execute(ctx context.Context, execCtx *ExecutionContext) error