Documentation
¶
Overview ¶
Package initspec resolves awf init answers against the catalog's value descriptors and emits the descriptor schema (ADR-0029). It bridges the catalog's VarDescriptor set to a resolved (vars, catalog-trim) pair plus the commit-scope list via explicit answers, an optional line-based prompter, or the silent default.
Index ¶
- Variables
- func Describe(descs []catalog.VarDescriptor) ([]byte, error)
- func InitDescriptors(vars []catalog.VarDescriptor) []catalog.VarDescriptor
- func MergeSetFlags(base map[string]string, sets []string) error
- func ParseAnswersFile(b []byte) (map[string]string, error)
- func Resolve(descs []catalog.VarDescriptor, answers map[string]string, in io.Reader, ...) (map[string]string, []string, error)
- func ResolveInit(vars []catalog.VarDescriptor, answers map[string]string, in io.Reader, ...) (map[string]string, []string, catalog.Profile, error)
- type Outcome
Constants ¶
This section is empty.
Variables ¶
var ProfileDescriptor = catalog.VarDescriptor{ Key: "profile", Kind: "enum", Target: "profile", Description: "Closed workflow profile: Core operational workflow or Full governance workflow.", Default: "core", Options: []string{"core", "full"}, }
ProfileDescriptor is the init-facing required repository fact. It is kept separate from catalog Vars because profile selects the catalog view rather than supplying a rendered template value.
Functions ¶
func Describe ¶
func Describe(descs []catalog.VarDescriptor) ([]byte, error)
Describe marshals the descriptor set as JSON ({"descriptors": [...]}) for `awf init --describe`. An empty Target is normalized to "var".
func InitDescriptors ¶ added in v0.38.0
func InitDescriptors(vars []catalog.VarDescriptor) []catalog.VarDescriptor
InitDescriptors returns the required profile fact followed by catalog vars.
func MergeSetFlags ¶
MergeSetFlags overlays "key=value" strings onto base (later wins).
func ParseAnswersFile ¶
ParseAnswersFile parses a flat key→value answer map from JSON or YAML bytes.
func Resolve ¶
func Resolve(descs []catalog.VarDescriptor, answers map[string]string, in io.Reader, out io.Writer, interactive bool, needed func() (map[string]bool, error)) (map[string]string, []string, error)
Resolve maps descriptors and answers to a vars map and the resolved commit-scope list. For a string or enum descriptor the value is the explicit answer if present; otherwise an interactive prompt when applicable; otherwise empty. A nil needed filter prompts for every descriptor.
func ResolveInit ¶ added in v0.38.0
func ResolveInit(vars []catalog.VarDescriptor, answers map[string]string, in io.Reader, out io.Writer, interactive bool, needed func() (map[string]bool, error)) (map[string]string, []string, catalog.Profile, error)
ResolveInit resolves the required profile fact separately from rendered vars.
Types ¶
type Outcome ¶ added in v0.30.0
type Outcome struct {
ConfigPath string
ExistingConfig bool
IgnoredAnswers bool
Sync presentation.Mutation
Advisories []string
NextActions []string
}
Outcome is the complete ordinary result of one successful initialization. It combines config adoption, sync mutation, advisories, and ordered next actions without owning any mutation behavior.