Versions in this module Expand all Collapse all v0 v0.3.0 Nov 27, 2026 Changes in this version + const AnyProgram + const AttrBehavior + const AttrChanged + const AttrMethod + const AttrOutcome + const AttrVerb + const KindBlock + const KindCall + const KindChain + const KindCompose + const KindDefinition + const KindError + const KindExample + const KindFailStep + const KindGenerated + const KindHost + const KindMethod + const KindNotYet + const KindOption + const KindRefine + const KindTag + const KindTemplate + const OutcomeError + const OutcomeOK + const RuleBefore + const RuleCalled + const RuleChanged + const RuleDoc + const RuleDuplicate + const RuleExample + const RuleFails + const RuleInput + const RuleInternal + const RuleKey + const RuleMethods + const RuleName + const RuleOptional + const RuleOutputShape + const RuleParent + const RulePlacement + const RulePlatform + const RuleReadBack + const RuleRequires + const RuleRoute + const RuleSchema + const RuleSecret + const RuleSettings + const RuleSpan + const RuleSurface + const RuleTag + const RuleTemplate + const RuleUsed + const RuleValidate + const RuleVerb + const RuleWrites + const SettingsPrefix + const TagBefore + const TestCall + const TestEffects + const TestErrors + const TestFileSpan + const TestGohai + const TestIdempotent + const TestKeepsState + const TestNewLine + const TestOption + const TestOutput + const TestPlatforms + const TestRefusal + const TestRuns + const TestShell + const TestState + const TestTraversal + const TestWrites + var ChainChecks = guide.Checks + var ChainSpec = guide.Spec + var Checks = guide.Checks + var ErrInvalid = errors.New("invalid input") + var ErrNotFound = errors.New("not found") + var ErrNotInstalled = errors.New("not installed") + var ErrNotManaged = errors.New("not managed by osapi") + var ErrUnsupported = errors.New("operation not supported on this OS family") + var HostFamilies = []PlatformName + var Spec = guide.Spec + var TestChecks = guide.Checks + func Call[P any, In any, Out any](ctx context.Context, b *Behavior, ...) (Out, error) + func Changed(out any) (changed bool, ok bool) + func CheckTemplates(in any) (string, bool) + func ChildSpans(b *Behavior) []string + func CurrentChainSpec() guide.Spec + func CurrentSpec(factKeys ...string) guide.Spec + func FieldShape(t reflect.Type, input bool) string + func GroupOf(b *Behavior) *endpoint.Group + func InputAttributes(in any, fields []string) []attribute.KeyValue + func JSONName(f reflect.StructField) string + func ReadMethod(b *Behavior, input any) (*Behavior, *Method) + func ReadRow(m *Method) reflect.Type + func Record(ctx context.Context, s *Step) context.Context + func Redact(in any) any + func RegisterGroup(name string, g *endpoint.Group) + func Render(text string, data TemplateData) (string, error) + func Reset() + func Scaffold(root string, name string, goPackage string, doc string, requires []string) ([]string, error) + func Secret(f reflect.StructField) bool + func SecretFields() map[string]bool + func SecretLeaks(parent *Step, child *Step) []string + func SetByBefore(f reflect.StructField) bool + func SetMeterProvider(mp metric.MeterProvider) + func Settings[T any](b *Behavior) T + func Shape(t reflect.Type, s *Schema, input bool) string + func TestFailure(rule string, message string) string + func Tree(b *Behavior) string + func TypeName(t reflect.Type) string + type Behavior struct + API bool + Area area.Name + CLI bool + Defaults any + Doc string + Internal bool + KeepsState bool + Methods []*Method + Name string + Parent *Behavior + Placement Placement + PlatformRuns []PlatformPrograms + Platforms []*PlatformProvider + ProviderSudo []PlatformPrograms + Requires []*Behavior + Runs []string + RunsIfPresent []string + Sudo []string + Title string + UnderCollection bool + Writes []string + func All() []*Behavior + func Define(name string, doc string, opts ...Option) *Behavior + func Lookup(name string) *Behavior + func Register(b *Behavior) *Behavior + func RequiredBy(b *Behavior) []*Behavior + func (b *Behavior) Command(m *Method) string + func (b *Behavior) CurrentSettings() any + func (b *Behavior) Method(name string) *Method + func (b *Behavior) Operation(m *Method) string + func (b *Behavior) OperationID(m *Method) string + func (b *Behavior) ParentKey() string + func (b *Behavior) Path(m *Method) string + func (b *Behavior) Permission(v types.Verb) types.Permission + func (b *Behavior) Programs(platform PlatformName) (sudo []string, runs []string) + func (b *Behavior) Provider(platform PlatformName, h any) (any, error) + func (b *Behavior) ProviderSudoOn(platform PlatformName) []string + func (b *Behavior) RunBefore(ctx context.Context, m *Method, in any) (any, error) + func (b *Behavior) RunsOnHost(m *Method, platform PlatformName) bool + func (b *Behavior) Serves(m *Method, platform PlatformName) bool + func (b *Behavior) SetSettings(v any) + func (b *Behavior) SettingFlag(path string) string + func (b *Behavior) SettingsKey() string + func (b *Behavior) SettingsType() reflect.Type + func (b *Behavior) SpanName(m *Method) string + func (b *Behavior) Tag() string + func (b *Behavior) TypeName() string + type Effect struct + Command string + Content string + Kind EffectKind + Path string + func Ran(name string, args ...string) Effect + func Removed(path string) Effect + func Wrote(path string, content string) Effect + type EffectKind string + const EffectRan + const EffectRemoved + const EffectWrote + type Example struct + Doc string + Effects []Effect + Given []Given + Input any + Live []LiveField + NoReadBack string + NotLive string + Output any + Platforms []PlatformName + ReadBacks []ReadBack + func (e Example) RunsOn(platform PlatformName) bool + type Fact string + const FactAdminGroup + const FactInterface + const FactPID + const FactSSHService + const FactSSHUnit + const FactUser + type Given struct + After string + Command string + Content string + ContentType types.ContentType + ExitCode int + Input any + Kind GivenKind + Path string + func After(input any) Given + func Exists(path string, content string) Given + func ExistsAfter(after string, path string, content string) Given + func Exits(command string, code int) Given + func Links(path string, target string) Given + func Prints(command string, output string) Given + func PrintsAfter(after string, command string, output string) Given + func Stored(name string, content string, contentType types.ContentType) Given + type GivenKind string + const GivenCall + const GivenFile + const GivenLink + const GivenObject + const GivenOutput + type HostOption interface + func Live(field string, fact Fact) HostOption + func NoReadBack(why string) HostOption + func NotLive(why string) HostOption + func OnPlatform(platforms ...PlatformName) HostOption + func Reads(input any, want any, fields ...string) HostOption + func ReadsNone(input any, want any, fields ...string) HostOption + type LiveField struct + Fact Fact + Field string + type Method struct + Action bool + Admin bool + AlwaysChanges bool + Disruption string + Disruptive bool + Doc string + Examples []Example + In reflect.Type + KeyField string + Long string + Name string + NoReadBack string + NonFact string + Out reflect.Type + PermitVerb types.Verb + Platforms []PlatformName + Refusals []Refusal + RunsPrograms []string + SudoPrograms []string + Verb types.Verb + func Action[P any, In any, Out any](name string, fn func(ctx context.Context, p P, in In) (Out, error)) *Method + func Read[P any, In any, Out any](name string, fn func(ctx context.Context, p P, in In) (Out, error)) *Method + func Write[P any, In any, Out any](name string, fn func(ctx context.Context, p P, in In) (Out, error)) *Method + func (m *Method) AdminOnly() *Method + func (m *Method) AdminRole() bool + func (m *Method) Always() *Method + func (m *Method) Before(fn any) *Method + func (m *Method) Check(ctx context.Context, input []byte) error + func (m *Method) Describe(doc string) *Method + func (m *Method) Disrupts(why string) *Method + func (m *Method) Example(doc string, input any, output any, host ...HostOption) *Method + func (m *Method) Explain(long string) *Method + func (m *Method) Fails(doc string, input any, errorText string, host ...HostOption) *Method + func (m *Method) Func() string + func (m *Method) HTTPMethod() string + func (m *Method) HasBefore() bool + func (m *Method) InPath(name string) bool + func (m *Method) Invoke(ctx context.Context, provider any, input []byte) (any, error) + func (m *Method) Key(field string) *Method + func (m *Method) NotAFact(why string) *Method + func (m *Method) On(platforms ...PlatformName) *Method + func (m *Method) PathKeys() []string + func (m *Method) PermissionVerb() types.Verb + func (m *Method) PermitAs(verb types.Verb) *Method + func (m *Method) ProviderType() reflect.Type + func (m *Method) ReadsNothing(why string) *Method + func (m *Method) Runs(programs ...string) *Method + func (m *Method) RunsOn(platform PlatformName) bool + func (m *Method) Shell() *Method + func (m *Method) SpanInputs() []string + func (m *Method) Sudo(programs ...string) *Method + type Option interface + var API Option = optionFunc(func(b *Behavior) { ... }) + var CLI Option = optionFunc(func(b *Behavior) { ... }) + var Internal Option = optionFunc(func(b *Behavior) { ... }) + var KeepsState Option = optionFunc(func(b *Behavior) { ... }) + var Node Option = optionFunc(func(b *Behavior) { ... }) + func Area(name area.Name) Option + func Config(defaults any) Option + func Of(parent *Behavior) Option + func Platform[H any, P any](name PlatformName, build func(h H) (P, error)) Option + func Requires(behaviors ...*Behavior) Option + func Runs(programs ...string) Option + func RunsIfPresent(programs ...string) Option + func RunsOnPlatform(platform PlatformName, programs ...string) Option + func Sudo(programs ...string) Option + func SudoOnPlatform(platform PlatformName, programs ...string) Option + func Title(title string) Option + func Under(parent *Behavior) Option + func Validator(tag string, check func(value string) bool, schema func(t rule.Target), ...) Option + func Writes(paths ...string) Option + type Placement string + const NodePlacement + type PlatformName string + const PlatformDarwin + const PlatformDebian + const PlatformLinux + const PlatformSUSE + func KnownPlatforms() []PlatformName + type PlatformPrograms struct + Platform PlatformName + Programs []string + type PlatformProvider struct + Name PlatformName + Type reflect.Type + type Problem struct + Behavior string + Fix string + Message string + Method string + Rule string + func ChainProblems() []Problem + func Validate() []Problem + func ValidateBehavior(b *Behavior) []Problem + type ReadBack struct + Fields []string + Input any + None bool + Want any + type Refusal struct + Error string + type Schema struct + AdditionalProperties *Schema + Description string + Enum []string + Format string + Items *Schema + MaxItems *int + MaxLength *int + Maximum *float64 + MinItems *int + MinLength *int + Minimum *float64 + Order []string + Pattern string + Properties map[string]*Schema + Required []string + Secret bool + Type string + Validate string + WriteOnly bool + func SchemaFor(t reflect.Type) (*Schema, error) + type Step struct + Behavior string + Duration time.Duration + Error string + Input any + Method string + Output any + Steps []*Step + func NewStep(behavior string, method string, in any) *Step + func (s *Step) Wire() []types.Step + type TemplateData struct + Facts map[string]any + Hostname string + Vars map[string]string + type TemplateField struct + Field string + Vars string + func TemplateFields(t reflect.Type) []TemplateField