config

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 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 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"`
}

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).

func DefaultAgentEntries added in v0.24.0

func DefaultAgentEntries(harnessNames []string, commitSHA string, builder AgentEntryBuilder) ([]AgentEntry, error)

DefaultAgentEntries returns agent entries for the given harness names, using builder to compute each URL. When builder is nil, it returns nil (for callers that don't have access to the scaffold package). Called by install/scaffold in Phase 2 (ADR 0058); defined here in Phase 1 so the type and validation are co-located.

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) 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 AgentEntryBuilder added in v0.24.0

type AgentEntryBuilder func(harnessName, commitSHA string) (string, error)

DefaultAgentEntries computes default agent URL entries for the given harness names at a specific commit SHA. Each entry is a pinned raw.githubusercontent.com URL with an integrity hash.

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 and parses config.yaml from dir, returning a ConfigReader. This is the preferred entry point for consumer packages that only need read access. It wraps LoadFromDir and returns the underlying OrgConfig or PerRepoConfig.

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 and parses config.yaml from dir, returning a ConfigWriter. This is the preferred entry point for consumer packages that need read-write access (e.g. CLI commands that modify and write-back config). It wraps LoadFromDir and returns the underlying OrgConfig or PerRepoConfig.

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 DirConfig added in v0.31.0

type DirConfig struct {
	Agents                 []AgentEntry
	AllowedRemoteResources []string
	KillSwitch             bool
	IsOrg                  bool
	Org                    *OrgConfig
	PerRepo                *PerRepoConfig
}

DirConfig is the unified view of a fullsend config directory used by agent list and dispatch. It preserves the underlying org or per-repo struct for CLI write-back.

func LoadFromDir added in v0.31.0

func LoadFromDir(dir string, opts LoadOpts) (*DirConfig, error)

LoadFromDir reads and parses config.yaml from dir.

func LoadFromFile added in v0.31.0

func LoadFromFile(path string, opts LoadOpts) (*DirConfig, error)

LoadFromFile reads and parses a config file at path.

func (*DirConfig) AgentEntries added in v0.31.0

func (dc *DirConfig) AgentEntries() []AgentEntry

AgentEntries returns the registered agent entries.

func (*DirConfig) AllowedResources added in v0.31.0

func (dc *DirConfig) AllowedResources() []string

AllowedResources returns the allowed remote resource prefixes.

func (*DirConfig) ConfigVersion added in v0.31.0

func (dc *DirConfig) ConfigVersion() string

ConfigVersion returns the config schema version by delegating to the underlying OrgConfig or PerRepoConfig.

func (*DirConfig) IsKillSwitchActive added in v0.31.0

func (dc *DirConfig) IsKillSwitchActive() bool

IsKillSwitchActive reports whether the kill switch is engaged.

func (*DirConfig) IsOrgMode added in v0.31.0

func (dc *DirConfig) IsOrgMode() bool

IsOrgMode reports whether this is an org-mode configuration.

func (*DirConfig) IssueCreationConfig added in v0.31.0

func (dc *DirConfig) IssueCreationConfig() *CreateIssuesConfig

IssueCreationConfig returns the cross-repo issue creation config by delegating to the underlying OrgConfig or PerRepoConfig.

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 an empty DirConfig when config.yaml is absent.
	MissingOK bool
}

LoadOpts controls how LoadFromDir handles a missing config.yaml.

type MergedAgent added in v0.25.0

type MergedAgent struct {
	Name     string // canonical agent name
	Source   string // URL (with #sha256=), local path, or scaffold URL
	IsConfig bool   // true = from config agents list; false = scaffold default
}

MergedAgent represents an agent in the merged set produced by combining scaffold-discovered agents with config-registered agents. Config entries override scaffold entries with the same name (case-insensitive).

func LookupMergedAgent added in v0.25.0

func LookupMergedAgent(agents []MergedAgent, name string) *MergedAgent

LookupMergedAgent finds an agent by name (case-insensitive) in the merged set. Returns nil if not found.

func MergedAgents added in v0.25.0

func MergedAgents(scaffoldNames []string, commitSHA string, configAgents []AgentEntry, builder AgentEntryBuilder) ([]MergedAgent, error)

MergedAgents builds the merged agent set from scaffold defaults and config overlay. Scaffold entries are constructed from scaffoldNames using builder (typically scaffold.HarnessBaseURLWithHash); config entries overlay by DerivedName, replacing scaffold entries with matching names (case-insensitive). The result is sorted by Name.

When builder is nil or commitSHA is empty, scaffold entries are omitted (config-only mode). This mirrors the DefaultAgentEntries nil-builder pattern.

type OrgConfig

type OrgConfig struct {
	Version                string                `yaml:"version"`
	KillSwitch             bool                  `yaml:"kill_switch,omitempty"`
	Dispatch               DispatchConfig        `yaml:"dispatch"`
	Inference              InferenceConfig       `yaml:"inference,omitempty"`
	Defaults               RepoDefaults          `yaml:"defaults"`
	Repos                  map[string]RepoConfig `yaml:"repos"`
	Agents                 []AgentEntry          `yaml:"agents,omitempty"`
	AllowedRemoteResources []string              `yaml:"allowed_remote_resources,omitempty"`
	CreateIssues           *CreateIssuesConfig   `yaml:"create_issues,omitempty"`
}

OrgConfig is the top-level configuration for a fullsend organization.

func NewOrgConfig

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

NewOrgConfig creates a new OrgConfig with sensible defaults.

func OrgConfigFromPerRepo added in v0.28.0

func OrgConfigFromPerRepo(pr *PerRepoConfig) *OrgConfig

OrgConfigFromPerRepo adapts a PerRepoConfig into an OrgConfig so callers that expect OrgConfig can work uniformly with both config formats. Shared fields and Roles (mapped to Defaults.Roles) are copied; OrgConfig-specific fields (Dispatch, Inference, Repos) remain zero-valued.

func ParseOrgConfig

func ParseOrgConfig(data []byte) (*OrgConfig, error)

ParseOrgConfig parses YAML bytes into an OrgConfig.

func (*OrgConfig) AgentEntries added in v0.31.0

func (c *OrgConfig) AgentEntries() []AgentEntry

AgentEntries returns the registered agent entries.

func (*OrgConfig) AllowedResources added in v0.31.0

func (c *OrgConfig) AllowedResources() []string

AllowedResources returns the allowed remote resource prefixes.

func (*OrgConfig) ConfigVersion added in v0.31.0

func (c *OrgConfig) ConfigVersion() string

ConfigVersion returns the config schema version.

func (*OrgConfig) DefaultRoles

func (c *OrgConfig) DefaultRoles() []string

DefaultRoles returns the default roles configured for the organization.

func (*OrgConfig) DisabledRepos added in v0.0.3

func (c *OrgConfig) DisabledRepos() []string

DisabledRepos returns a sorted list of repo names where Enabled is false.

func (*OrgConfig) DispatchSettings added in v0.31.0

func (c *OrgConfig) DispatchSettings() DispatchConfig

DispatchSettings returns the dispatch configuration.

func (*OrgConfig) EnabledRepos

func (c *OrgConfig) EnabledRepos() []string

EnabledRepos returns a sorted list of repo names where Enabled is true.

func (*OrgConfig) InferenceSettings added in v0.31.0

func (c *OrgConfig) InferenceSettings() InferenceConfig

InferenceSettings returns the inference provider configuration.

func (*OrgConfig) IsKillSwitchActive added in v0.31.0

func (c *OrgConfig) IsKillSwitchActive() bool

IsKillSwitchActive reports whether the kill switch is engaged.

func (*OrgConfig) IsOrgMode added in v0.31.0

func (c *OrgConfig) IsOrgMode() bool

IsOrgMode reports that this is an org-mode configuration.

func (*OrgConfig) IssueCreationConfig added in v0.31.0

func (c *OrgConfig) IssueCreationConfig() *CreateIssuesConfig

IssueCreationConfig returns the cross-repo issue creation config.

func (*OrgConfig) Marshal

func (c *OrgConfig) Marshal() ([]byte, error)

Marshal serializes the OrgConfig to YAML with a descriptive header comment.

func (*OrgConfig) OrgRepoDefaults added in v0.31.0

func (c *OrgConfig) OrgRepoDefaults() RepoDefaults

OrgRepoDefaults returns the default settings applied to all repos.

func (*OrgConfig) RepoMap added in v0.31.0

func (c *OrgConfig) RepoMap() map[string]RepoConfig

RepoMap returns the per-repo configuration map.

func (*OrgConfig) SetAgents added in v0.31.0

func (c *OrgConfig) SetAgents(agents []AgentEntry)

SetAgents replaces the registered agent entries.

func (*OrgConfig) SetAllowedRemoteResources added in v0.31.0

func (c *OrgConfig) SetAllowedRemoteResources(resources []string)

SetAllowedRemoteResources replaces the allowed remote resource prefixes.

func (*OrgConfig) SetDispatch added in v0.31.0

func (c *OrgConfig) SetDispatch(d DispatchConfig)

SetDispatch replaces the dispatch configuration.

func (*OrgConfig) SetInference added in v0.31.0

func (c *OrgConfig) SetInference(i InferenceConfig)

SetInference replaces the inference provider configuration.

func (*OrgConfig) SetKillSwitch added in v0.31.0

func (c *OrgConfig) SetKillSwitch(v bool)

SetKillSwitch sets the kill switch state.

func (*OrgConfig) StatusNotifications added in v0.31.0

func (c *OrgConfig) StatusNotifications() *StatusNotificationConfig

StatusNotifications returns the status notification configuration.

func (*OrgConfig) Validate

func (c *OrgConfig) Validate() error

Validate checks the OrgConfig for structural correctness.

type OrgConfigReader added in v0.31.0

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

OrgConfigReader extends ConfigReader with org-mode-specific fields.

type OrgConfigWriter added in v0.31.0

type OrgConfigWriter interface {
	OrgConfigReader
	ConfigWriter
	SetDispatch(DispatchConfig)
	SetInference(InferenceConfig)
}

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

type PerRepoConfig added in v0.8.0

type PerRepoConfig struct {
	Version                string              `yaml:"version"`
	KillSwitch             bool                `yaml:"kill_switch,omitempty"`
	Runtime                string              `yaml:"runtime,omitempty"`
	Roles                  []string            `yaml:"roles,omitempty"`
	Agents                 []AgentEntry        `yaml:"agents,omitempty"`
	AllowedRemoteResources []string            `yaml:"allowed_remote_resources,omitempty"`
	CreateIssues           *CreateIssuesConfig `yaml:"create_issues,omitempty"`
}

PerRepoConfig holds configuration for per-repo installation mode. Stored in .fullsend/config.yaml within the target repository.

func NewPerRepoConfig added in v0.8.0

func NewPerRepoConfig(roles []string, targetRepo string) *PerRepoConfig

NewPerRepoConfig creates a new PerRepoConfig with the given roles.

func ParsePerRepoConfig added in v0.8.0

func ParsePerRepoConfig(data []byte) (*PerRepoConfig, error)

ParsePerRepoConfig parses YAML bytes into a PerRepoConfig.

func (*PerRepoConfig) AgentEntries added in v0.31.0

func (c *PerRepoConfig) AgentEntries() []AgentEntry

AgentEntries returns the registered agent entries.

func (*PerRepoConfig) AllowedResources added in v0.31.0

func (c *PerRepoConfig) AllowedResources() []string

AllowedResources returns the allowed remote resource prefixes.

func (*PerRepoConfig) ConfigRoles added in v0.31.0

func (c *PerRepoConfig) ConfigRoles() []string

ConfigRoles returns the configured agent roles.

func (*PerRepoConfig) ConfigRuntime added in v0.31.0

func (c *PerRepoConfig) ConfigRuntime() string

ConfigRuntime returns the configured agent runtime.

func (*PerRepoConfig) ConfigVersion added in v0.31.0

func (c *PerRepoConfig) ConfigVersion() string

ConfigVersion returns the config schema version.

func (*PerRepoConfig) IsKillSwitchActive added in v0.31.0

func (c *PerRepoConfig) IsKillSwitchActive() bool

IsKillSwitchActive reports whether the kill switch is engaged.

func (*PerRepoConfig) IsOrgMode added in v0.31.0

func (c *PerRepoConfig) IsOrgMode() bool

IsOrgMode reports that this is a per-repo configuration.

func (*PerRepoConfig) IssueCreationConfig added in v0.31.0

func (c *PerRepoConfig) IssueCreationConfig() *CreateIssuesConfig

IssueCreationConfig returns the cross-repo issue creation config.

func (*PerRepoConfig) Marshal added in v0.8.0

func (c *PerRepoConfig) Marshal() ([]byte, error)

Marshal serializes the PerRepoConfig to YAML with a descriptive header.

func (*PerRepoConfig) SetAgents added in v0.31.0

func (c *PerRepoConfig) SetAgents(agents []AgentEntry)

SetAgents replaces the registered agent entries.

func (*PerRepoConfig) SetAllowedRemoteResources added in v0.31.0

func (c *PerRepoConfig) SetAllowedRemoteResources(resources []string)

SetAllowedRemoteResources replaces the allowed remote resource prefixes.

func (*PerRepoConfig) SetKillSwitch added in v0.31.0

func (c *PerRepoConfig) SetKillSwitch(v bool)

SetKillSwitch sets the kill switch state.

func (*PerRepoConfig) Validate added in v0.8.0

func (c *PerRepoConfig) Validate() error

Validate checks the PerRepoConfig for structural correctness.

type PerRepoConfigReader added in v0.31.0

type PerRepoConfigReader interface {
	ConfigReader
	ConfigRoles() []string
	ConfigRuntime() 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).

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