diff --git a/pkg/config/config_struct_test.go b/pkg/config/config_struct_test.go index 280db5d0f..dc35d14f3 100644 --- a/pkg/config/config_struct_test.go +++ b/pkg/config/config_struct_test.go @@ -402,16 +402,3 @@ func TestSkillsRegistriesConfigUnmarshalYAMLRetainsDefaultsForOmittedFields(t *t assert.Equal(t, "registry-token", github.AuthToken.String()) assert.Empty(t, github.Param) } - -func TestSkillsGithubConfigV0ToSkillsGithubConfigPreservesBaseURL(t *testing.T) { - legacy := skillsGithubConfigV0{ - BaseURL: "https://ghe.example.com/git", - Token: "ghp-test-token", - Proxy: "http://127.0.0.1:7890", - } - - converted := legacy.ToSkillsGithubConfig() - assert.Equal(t, "https://ghe.example.com/git", converted.BaseURL) - assert.Equal(t, "ghp-test-token", converted.Token.String()) - assert.Equal(t, "http://127.0.0.1:7890", converted.Proxy) -} diff --git a/pkg/config/migration.go b/pkg/config/migration.go index 133757269..4fe2148b2 100644 --- a/pkg/config/migration.go +++ b/pkg/config/migration.go @@ -361,6 +361,21 @@ func loadConfigMap(path string) (map[string]any, error) { m["registries"] = map[string]any{"clawhub": m["clawhub"]} delete(m, "clawhub") } + if gh, ok := m["github"].(map[string]any); ok { + registries, _ := m["registries"].(map[string]any) + if registries == nil { + registries = map[string]any{} + } + githubRegistry := map[string]any{} + for k, v := range gh { + githubRegistry[k] = v + } + if token, ok := githubRegistry["token"]; ok { + githubRegistry["auth_token"] = token + } + registries["github"] = githubRegistry + m["registries"] = registries + } } } m2["tools"] = m3