config

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUpstreamRepo is the canonical fullsend repository for layered workflow calls.
	DefaultUpstreamRepo = "fullsend-ai/fullsend"
	// DefaultUpstreamRef is the default tag for layered upstream workflow calls.
	DefaultUpstreamRef = "v0"
	// DefaultGHRunner is the default GitHub Actions runner image for scaffold workflows.
	DefaultGHRunner = "ubuntu-24.04"
)

Variables

This section is empty.

Functions

func DefaultAgentRoles

func DefaultAgentRoles() []string

DefaultAgentRoles returns the standard set of agent roles installed when no custom roles are specified. The fix stage reuses the coder app (role: coder) so it does not need a separate app or PEM.

func DefaultAllowedRemoteResources added in v0.24.0

func DefaultAllowedRemoteResources() []string

DefaultAllowedRemoteResources returns the standard allowlist prefixes for base composition and agent registration URLs.

func EnsureDefaultAllowedRemoteResources added in v0.31.0

func EnsureDefaultAllowedRemoteResources(existing []string) []string

EnsureDefaultAllowedRemoteResources returns a new slice with default allowed-remote-resources prefixes merged into the provided list. Nil input (field omitted from YAML) returns defaults alone. An explicit empty slice (allowed_remote_resources: []) is returned unchanged to preserve deny-all semantics. Non-empty input gets any missing defaults appended (preserving the caller's original ordering).

func IsAgentExplicitlyDisabled added in v0.33.0

func IsAgentExplicitlyDisabled(agents []AgentEntry, name string) bool

IsAgentExplicitlyDisabled returns true if the last config entry matching name has Enabled explicitly set to false. Iterates in reverse to respect last-writer-wins ordering.

func IsPerRepoYAML added in v0.31.0

func IsPerRepoYAML(data []byte) bool

IsPerRepoYAML probes raw YAML for structural markers that distinguish perRepoConfig from orgConfig. orgConfig has org-only top-level keys (dispatch, repos, inference, defaults); perRepoConfig never does. When no org-only key is present we default to per-repo: the shared fields parse identically under either parser, and this avoids silently dropping the per-repo Roles field on configs that omit it.

func PerRepoDefaultRoles added in v0.8.0

func PerRepoDefaultRoles() []string

PerRepoDefaultRoles returns agent roles for per-repo installation. The "fullsend" dispatch role is excluded because per-repo mode uses the target repo's shim workflow for dispatch instead of a separate app.

func ValidProviders added in v0.0.3

func ValidProviders() []string

ValidProviders returns the set of recognized inference providers.

func ValidRoles

func ValidRoles() []string

ValidRoles returns the set of recognized agent roles.

func ValidRuntimes added in v0.30.0

func ValidRuntimes() []string

ValidRuntimes returns the set of recognized agent runtimes.

func ValidateAgentEntries added in v0.25.0

func ValidateAgentEntries(agents []AgentEntry, allowlist []string) error

ValidateAgentEntries checks agent entries for structural correctness. Uses urlutil.IsURL, urlutil.ParseIntegrityHash, and urlutil.MatchingAllowedPrefixInList for consistency with runtime resolution (case-insensitive scheme, percent-decoding, dot-segment cleaning).

Types

type AgentEntry

type AgentEntry struct {
	Name    string `yaml:"name,omitempty"`
	Source  string `yaml:"source"`
	Enabled *bool  `yaml:"enabled,omitempty"`
}

AgentEntry represents a registered agent source in config. It supports both string shorthand (just the source URL/path) and object form (with an explicit name override).

Enabled controls whether the agent participates in the merged agent set. When nil (omitted) the agent defaults to enabled. When explicitly set to false the agent is suppressed — this allows disabling built-in scaffold agents without removing their role. A suppression-only entry (Enabled=false, no Source) is valid.

func (AgentEntry) DerivedName added in v0.24.0

func (a AgentEntry) DerivedName() string

DerivedName returns the explicit Name if set, otherwise derives one from the Source filename (e.g. "triage.yaml" → "triage").

func (AgentEntry) IsEnabled added in v0.33.0

func (a AgentEntry) IsEnabled() bool

IsEnabled returns whether the agent entry is enabled. A nil Enabled pointer (field omitted) defaults to true.

func (*AgentEntry) UnmarshalYAML added in v0.24.0

func (a *AgentEntry) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler so that a plain string is treated as a source-only entry, while a mapping decodes normally. Old-format entries (role/name/slug identity tuples from pre-ADR-0058 config) are detected and rejected with a clear error message.

type AgentLister added in v0.31.0

type AgentLister interface {
	AgentEntries() []AgentEntry
}

AgentLister provides read access to registered agent entries.

type AllowTargets added in v0.18.0

type AllowTargets struct {
	Orgs  []string `yaml:"orgs,omitempty"`
	Repos []string `yaml:"repos,omitempty"`
}

AllowTargets defines which orgs and repos agents may create issues in.

type AllowedResourcesReader added in v0.31.0

type AllowedResourcesReader interface {
	AllowedResources() []string
}

AllowedResourcesReader provides read access to the allowed remote resources list.

type CommentNotificationConfig added in v0.15.0

type CommentNotificationConfig struct {
	Start      string `yaml:"start,omitempty"`
	Completion string `yaml:"completion,omitempty"`
}

CommentNotificationConfig controls start/completion comments. Valid values: "enabled" (default when parent is set), "disabled".

type ConfigReader added in v0.31.0

type ConfigReader interface {
	AgentLister
	KillSwitchReader
	AllowedResourcesReader
	CreateIssuesReader
	ConfigVersion() string
	IsOrgMode() bool
}

ConfigReader is the common read interface for fields shared by both orgConfig and perRepoConfig. Consumer packages should depend on this interface rather than accessing struct fields directly.

func LoadConfig added in v0.31.0

func LoadConfig(dir string, opts LoadOpts) (ConfigReader, error)

LoadConfig reads config.yaml (and config.base.yaml if present) from dir, returning a ConfigReader. For per-repo configs the parent chain is wired as overlay (config.yaml) → base (config.base.yaml) → code defaults. This is the preferred entry point for consumer packages that only need read access.

type ConfigWriter added in v0.31.0

type ConfigWriter interface {
	ConfigReader
	SetKillSwitch(bool)
	SetAgents([]AgentEntry)
	SetAllowedRemoteResources([]string)
	Marshal() ([]byte, error)
	Validate() error
}

ConfigWriter extends ConfigReader with mutation methods shared by both config modes.

func LoadConfigWriter added in v0.32.0

func LoadConfigWriter(dir string, opts LoadOpts) (ConfigWriter, error)

LoadConfigWriter reads config.yaml (and config.base.yaml if present) from dir, returning a ConfigWriter. For per-repo configs the parent chain is wired as overlay (config.yaml) → base (config.base.yaml) → code defaults. Only the overlay layer is mutable; base and defaults are read-only via the parent pointer. This is the preferred entry point for consumer packages that need read-write access (e.g. CLI commands that modify and write-back config).

func ParsePerRepoConfigWriter added in v0.33.0

func ParsePerRepoConfigWriter(data []byte) (ConfigWriter, error)

ParsePerRepoConfigWriter parses YAML bytes into a ConfigWriter for callers that need to modify the config after parsing.

type CreateIssuesConfig added in v0.18.0

type CreateIssuesConfig struct {
	AllowTargets AllowTargets `yaml:"allow_targets"`
}

CreateIssuesConfig controls cross-repo issue creation by agents.

type CreateIssuesReader added in v0.31.0

type CreateIssuesReader interface {
	IssueCreationConfig() *CreateIssuesConfig
}

CreateIssuesReader provides read access to cross-repo issue creation configuration.

type DispatchConfig

type DispatchConfig struct {
	Platform string `yaml:"platform"`
	Mode     string `yaml:"mode,omitempty"`     // "oidc-mint"
	MintURL  string `yaml:"mint_url,omitempty"` // informational, set when mode=oidc-mint
}

DispatchConfig configures how agent work is dispatched.

type InferenceConfig added in v0.0.3

type InferenceConfig struct {
	Provider string `yaml:"provider"`
}

InferenceConfig configures the inference provider used by agents.

type KillSwitchReader added in v0.31.0

type KillSwitchReader interface {
	IsKillSwitchActive() bool
}

KillSwitchReader provides read access to the kill switch state.

type LoadOpts added in v0.31.0

type LoadOpts struct {
	// MissingOK returns a default config when config.yaml is absent.
	MissingOK bool
}

LoadOpts controls how LoadConfig handles a missing config.yaml.

type OrgConfigReader added in v0.31.0

type OrgConfigReader interface {
	ConfigReader
	DispatchSettings() DispatchConfig
	InferenceSettings() InferenceConfig
	OrgRepoDefaults() RepoDefaults
	RepoMap() map[string]RepoConfig
	EnabledRepos() []string
	DisabledRepos() []string
	StatusNotifications() *StatusNotificationConfig
}

OrgConfigReader extends ConfigReader with org-mode-specific fields.

func ParseOrgConfig

func ParseOrgConfig(data []byte) (OrgConfigReader, error)

ParseOrgConfig parses YAML bytes into an OrgConfigReader.

type OrgConfigWriter added in v0.31.0

type OrgConfigWriter interface {
	OrgConfigReader
	ConfigWriter
	SetDispatch(DispatchConfig)
	SetInference(InferenceConfig)
	SetDefaultRuntime(string)
	SetRepo(name string, rc RepoConfig)
}

OrgConfigWriter extends OrgConfigReader and ConfigWriter with org-specific mutation methods.

func NewOrgConfig

func NewOrgConfig(allRepos, enabledRepos, roles []string, inferenceProvider, org string) OrgConfigWriter

NewOrgConfig creates a new orgConfig with sensible defaults. The returned OrgConfigWriter provides full read-write access.

func ParseOrgConfigWriter added in v0.33.0

func ParseOrgConfigWriter(data []byte) (OrgConfigWriter, error)

ParseOrgConfigWriter parses YAML bytes into an OrgConfigWriter for callers that need to modify the config after parsing.

type PerRepoConfigReader added in v0.31.0

type PerRepoConfigReader interface {
	ConfigReader
	ConfigRoles() []string
	ConfigRuntime() string
	ConfigForge() string
}

PerRepoConfigReader extends ConfigReader with per-repo-specific fields. Methods are prefixed with "Config" to avoid conflicts with the struct field names (Roles and Runtime).

func ParsePerRepoConfig added in v0.8.0

func ParsePerRepoConfig(data []byte) (PerRepoConfigReader, error)

ParsePerRepoConfig parses YAML bytes into a PerRepoConfigReader.

type PerRepoConfigWriter added in v0.33.0

type PerRepoConfigWriter interface {
	PerRepoConfigReader
	ConfigWriter
	SetRoles([]string)
	SetRuntime(string)
}

PerRepoConfigWriter extends PerRepoConfigReader and ConfigWriter with per-repo-specific mutation methods.

func NewPerRepoConfig added in v0.8.0

func NewPerRepoConfig(roles []string, targetRepo string) PerRepoConfigWriter

NewPerRepoConfig creates a new perRepoConfig with the given roles. The returned ConfigWriter provides read-write access to shared config fields; use PerRepoConfigReader type assertion for per-repo-specific methods.

func NewPerRepoConfigFromOrg added in v0.34.0

func NewPerRepoConfigFromOrg(orgCfg OrgConfigReader, repoName, targetRepo string) PerRepoConfigWriter

NewPerRepoConfigFromOrg creates a per-repo config by mapping portable fields from an org config. Per-repo role overrides (repos.<name>.roles) take precedence over defaults.roles. Non-portable fields (max_implementation_retries, auto_merge, status_notifications) are not carried over — callers should warn separately.

type RepoConfig

type RepoConfig struct {
	Roles   []string `yaml:"roles,omitempty"`
	Enabled bool     `yaml:"enabled"`
}

RepoConfig holds per-repo configuration. StatusNotifications is intentionally absent here — notification style is an org-wide UX decision (consistent appearance across all repos), unlike roles and auto_merge which are operationally per-repo.

type RepoDefaults

type RepoDefaults struct {
	Roles                    []string                  `yaml:"roles"`
	Runtime                  string                    `yaml:"runtime,omitempty"`
	MaxImplementationRetries int                       `yaml:"max_implementation_retries"`
	AutoMerge                bool                      `yaml:"auto_merge"`
	StatusNotifications      *StatusNotificationConfig `yaml:"status_notifications,omitempty"`
}

RepoDefaults holds default settings applied to all repos.

type StatusNotificationConfig added in v0.15.0

type StatusNotificationConfig struct {
	Comment CommentNotificationConfig `yaml:"comment,omitempty"`
}

StatusNotificationConfig controls status comments posted on issues/PRs when agents start and complete.

Jump to

Keyboard shortcuts

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