scaffoldhooks

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 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

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 {
	// Edition is the effective project edition pin. Empty selects current behavior.
	Edition string
	// 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
	// and to step-backed hooks as ATMOS_HOOK_STATUS (with ATMOS_HOOK_EXIT_CODE).
	Status string
	// Err is the generation error behind a "failure" Status, exposed to step-backed hooks as
	// ATMOS_HOOK_ERROR. Nil on success.
	Err error
	// 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