Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveSource ¶
func ResolveSource(source, parentDir string, logger *slog.Logger) (dir string, cleanup func(), err error)
ResolveSource resolves a module source to a local directory. Sources starting with "." or "/" are treated as local paths (cleanup is nil). Other sources are treated as git URLs and cloned to a temp directory. The "//" separator in git URLs denotes a subdirectory within the repo. Callers must call cleanup (if non-nil) when the directory is no longer needed.
Types ¶
type Module ¶
type Module struct {
// Dir is the directory containing the module's loom.yaml.
Dir string
// Config is the parsed loom.yaml.
Config *config.LoomFile
// Params are the resolved parameters for this module.
Params map[string]string
// Logger is the structured logger.
Logger *slog.Logger
}
Module represents a loaded and resolved loom module.
func (*Module) NewExecutionContext ¶
func (m *Module) NewExecutionContext(targetDir string, opts RunOptions) *action.ExecutionContext
NewExecutionContext creates an ExecutionContext for this module.
type RunOptions ¶ added in v0.1.2
type RunOptions struct {
DryRun bool
LocalRun bool
ShowDiff bool
// Diffs collects file diffs across the run, shared by parent and child
// executions, for printing once at the end. May be nil.
Diffs *action.DiffCollector
// TargetPath is the base directory for --local-run mode.
// Each module with a target spec clones into a numbered subdirectory.
TargetPath string
// GitAuthor is the default git author name for commitPush operations
// when not specified in loom.yaml.
GitAuthor string
// GitEmail is the default git author email for commitPush operations
// when not specified in loom.yaml.
GitEmail string
// Summary collects created PRs/MRs across the run, shared by parent
// and child executions. May be nil.
Summary *action.RunSummary
// ModulePath is the instance breadcrumb of the executing module: the chain
// of instance names from the run's root down to and including this module.
// It identifies which module — and, in a bulk run, which item — a diff or
// log line belongs to, where the shared metadata.name cannot. It is extended
// as each child is dispatched.
ModulePath []string
// DirLabels maps a local-run clone directory to the breadcrumb of the module
// that clones into it. Full-mode `loom diff` reads changes back from those
// clone dirs rather than the in-memory collector, so this lets it head each
// diff with the same module/item identity quick mode shows. The map is shared
// across parent and child executions; nil outside full-mode diff.
DirLabels map[string][]string
// contains filtered or unexported fields
}
RunOptions holds runtime flags for module execution.
func (*RunOptions) NextLocalDir ¶ added in v0.1.3
func (o *RunOptions) NextLocalDir(name string) string
NextLocalDir returns the next numbered subdirectory under TargetPath for a module with the given name, e.g. "00-parent-module".
func (*RunOptions) RegisterDirLabel ¶ added in v0.3.0
func (o *RunOptions) RegisterDirLabel(dir, name string)
RegisterDirLabel records a single-name breadcrumb for a root module's clone dir. The diff command clones the root before Execute seeds opts.ModulePath, so it labels that dir with just the module's own name.