scaffoldhooks

package
v1.232.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package scaffoldhooks runs a scaffold template's declarative hooks: block around atmos scaffold generate / atmos init. It reuses the exact hook schema and when: vocabulary that stack-level lifecycle hooks use (pkg/hooks.Hook), driving step-backed hooks (kind: step, kind: steps) through the same shared step-execution engine (pkg/runner/step) that workflows and custom commands use -- not a bespoke execution engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(in RunInput) error

Run evaluates and executes every hook in in.HooksMap that matches in.Event, in a stable (name-sorted) order, skipping any hook that in.SkipHooks (implementing --skip-hooks) reports true for before event/when: evaluation, mirroring pkg/hooks' own --skip-hooks semantics.

Types

type RunInput added in v1.230.0

type RunInput struct {
	// HooksMap is the scaffold's decoded spec.hooks block.
	HooksMap map[string]hooks.Hook
	// Event is the scaffold lifecycle event being fired (before/after.scaffold.generate).
	Event hooks.HookEvent
	// Answers is the collected prompt answers, exposed to hooks as {{ .Answers.<field> }} and as
	// the `answers` when: CEL variable.
	Answers map[string]any
	// Status is the run outcome ("success"/"failure"), exposed as the `status` when: CEL variable.
	Status string
	// SkipHooks implements --skip-hooks; nil means no hook is skipped.
	SkipHooks func(string) bool
	// TargetPath is the scaffold's target/output directory. An unset or bare-relative
	// working_directory on a step-backed hook defaults to it (see
	// hooks.ApplyDefaultWorkingDirectory), and it is exposed to hook templates as
	// {{ .TargetPath }}.
	TargetPath string
}

RunInput bundles scaffoldhooks.Run's inputs into a single argument, mirroring how pkg/hooks.ExecContext bundles a stack-level lifecycle hook run's inputs.

Jump to

Keyboard shortcuts

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