Documentation
¶
Overview ¶
Package configedit provides reusable config mutation helpers.
This package owns pure config data transforms only. Keep command parsing, Cobra/view dependencies, keyring operations, and exit-code mapping in command packages such as configcmd.
Index ¶
- Variables
- func AddAgentSource(existing []string, raw string) ([]string, bool, error)
- func CanonicalRepositoryRoutes(routes []config.RepositoryProfile) []config.RepositoryProfile
- func ClearLLMCredentialRef(profile config.Profile) (config.Profile, bool)
- func ClearReviewerCredentials(profile config.Profile) (config.Profile, bool)
- func FirstProfileName(profiles map[string]config.Profile) string
- func FormatRepositoryRouteSpec(spec RepositoryRouteSpec) string
- func NormalizeAgentSourcePath(raw string) (string, error)
- func NormalizeRepositoryRouteRepos(raw []string) ([]string, error)
- func NormalizeSecretsProfileID(raw string) (string, error)
- func PruneRepositoryProfileRoutes(routes []config.RepositoryProfile, profileName string) []config.RepositoryProfile
- func RemoveAgentSource(existing []string, raw string) ([]string, bool, error)
- func RemoveSecretsProfile(cfg config.File, rawID string) (config.File, bool, error)
- func RenameProfile(cfg config.File, oldName string, newName string) (config.File, bool, error)
- func ResetAgentSources(existing []string) ([]string, bool)
- func ResetModelMap(profile config.Profile) (config.Profile, bool)
- func SetGitCredentialRef(profile config.Profile, ref string) (config.Profile, bool)
- func SetLLMCredentialRef(profile config.Profile, ref string) (config.Profile, bool)
- func SetRepositoryRoutes(routes []config.RepositoryProfile, profileName string, ...) ([]config.RepositoryProfile, error)
- func SetReviewerCredentialRef(profile config.Profile, ref string) (config.Profile, bool, error)
- func SetSecretsProfile(cfg config.File, rawID string, patch SecretsProfilePatch) (config.File, bool, bool, error)
- func UnsetRepositoryRoutes(routes []config.RepositoryProfile, spec RepositoryRouteSpec) ([]config.RepositoryProfile, bool, error)
- func UpdateRepositoryProfileReferences(routes []config.RepositoryProfile, oldName string, newName string) ([]config.RepositoryProfile, bool)
- type RepositoryRouteSpec
- type SecretsProfilePatch
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRouteHostRequired means a repository route host was omitted. ErrRouteHostRequired = errors.New("route host is required") // ErrRouteNamespaceRequired means a repository route namespace was omitted. ErrRouteNamespaceRequired = errors.New("route namespace is required") // ErrRouteRepoRequired means an explicitly supplied repository route repo was blank. ErrRouteRepoRequired = errors.New("route repo is required") // ErrAgentSourcePathRequired means an agent source path was omitted. ErrAgentSourcePathRequired = errors.New("agent source path is required") // ErrProfileNameRequired means a profile name was omitted. ErrProfileNameRequired = errors.New("profile name is required") // ErrProfileExists means the destination profile already exists. ErrProfileExists = errors.New("profile already exists") // ErrReviewerCredentialsNotConfigured means reviewer credentials are absent. ErrReviewerCredentialsNotConfigured = errors.New("reviewer credentials are not configured") )
var ( // ErrSecretsProfileIDRequired means a secrets-profile id was omitted. ErrSecretsProfileIDRequired = errors.New("secrets-profile id is required") // ErrSecretsProfileReserved means the caller targeted a reserved projected id. ErrSecretsProfileReserved = errors.New("secrets-profile id is reserved") // ErrSecretsProfileBackendRequired means a create operation omitted the backend. ErrSecretsProfileBackendRequired = errors.New("secrets-profile backend is required") // ErrSecretsProfileMutationRequired means an update operation omitted mutation flags. ErrSecretsProfileMutationRequired = errors.New("secrets-profile mutation is required") // ErrSecretsProfileLabelConflict means both set and clear label were requested. ErrSecretsProfileLabelConflict = errors.New("secrets-profile label flags conflict") // ErrSecretsProfileLabelRequired means a provided label was blank after trim. ErrSecretsProfileLabelRequired = errors.New("secrets-profile label is required") )
Functions ¶
func AddAgentSource ¶
AddAgentSource appends raw when an equivalent normalized path is absent.
func CanonicalRepositoryRoutes ¶
func CanonicalRepositoryRoutes(routes []config.RepositoryProfile) []config.RepositoryProfile
CanonicalRepositoryRoutes returns normalized repository routes in stable order.
func ClearLLMCredentialRef ¶
ClearLLMCredentialRef clears the optional LLM credential ref.
func ClearReviewerCredentials ¶
ClearReviewerCredentials removes the optional reviewer credential section.
func FirstProfileName ¶
FirstProfileName returns the lexicographically first profile name.
func FormatRepositoryRouteSpec ¶
func FormatRepositoryRouteSpec(spec RepositoryRouteSpec) string
FormatRepositoryRouteSpec returns a stable domain representation of a route.
func NormalizeAgentSourcePath ¶
NormalizeAgentSourcePath trims and cleans an agent source path.
func NormalizeRepositoryRouteRepos ¶
NormalizeRepositoryRouteRepos trims, dedupes, and sorts repository names.
func NormalizeSecretsProfileID ¶ added in v0.3.147
NormalizeSecretsProfileID trims and validates one secrets-profile id.
func PruneRepositoryProfileRoutes ¶
func PruneRepositoryProfileRoutes(routes []config.RepositoryProfile, profileName string) []config.RepositoryProfile
PruneRepositoryProfileRoutes removes all repository routes pointing at profileName.
func RemoveAgentSource ¶
RemoveAgentSource removes entries that normalize to raw.
func RemoveSecretsProfile ¶ added in v0.3.147
RemoveSecretsProfile removes one explicit named credential store.
func RenameProfile ¶
RenameProfile renames a profile and updates route references.
func ResetAgentSources ¶
ResetAgentSources clears agent sources while reporting whether anything changed.
func ResetModelMap ¶
ResetModelMap clears profile-specific model mappings.
func SetGitCredentialRef ¶
SetGitCredentialRef updates the profile's required git credential ref.
func SetLLMCredentialRef ¶
SetLLMCredentialRef updates the profile's LLM credential ref.
func SetRepositoryRoutes ¶
func SetRepositoryRoutes(routes []config.RepositoryProfile, profileName string, spec RepositoryRouteSpec) ([]config.RepositoryProfile, error)
SetRepositoryRoutes assigns the specified routes to profileName.
func SetReviewerCredentialRef ¶
SetReviewerCredentialRef updates the reviewer credential ref when the section exists.
func SetSecretsProfile ¶ added in v0.3.147
func SetSecretsProfile(cfg config.File, rawID string, patch SecretsProfilePatch) (config.File, bool, bool, error)
SetSecretsProfile creates or updates one named secrets-management profile.
func UnsetRepositoryRoutes ¶
func UnsetRepositoryRoutes(routes []config.RepositoryProfile, spec RepositoryRouteSpec) ([]config.RepositoryProfile, bool, error)
UnsetRepositoryRoutes removes the specified routes.
func UpdateRepositoryProfileReferences ¶
func UpdateRepositoryProfileReferences(routes []config.RepositoryProfile, oldName string, newName string) ([]config.RepositoryProfile, bool)
UpdateRepositoryProfileReferences renames route profile references.
Types ¶
type RepositoryRouteSpec ¶
RepositoryRouteSpec identifies one namespace route or one set of repo routes.
func NormalizeRepositoryRouteSpec ¶
func NormalizeRepositoryRouteSpec(spec RepositoryRouteSpec) (RepositoryRouteSpec, error)
NormalizeRepositoryRouteSpec returns a normalized copy of spec.
type SecretsProfilePatch ¶ added in v0.3.147
type SecretsProfilePatch struct {
Backend *config.SecretsProfileBackend
Label *string
ClearLabel bool
}
SecretsProfilePatch describes a config-only update to one named secrets-management profile.