fix v0 skills migration preserving github registry defaults
This commit is contained in:
parent
383b13b11e
commit
4dae95d870
2 changed files with 25 additions and 7 deletions
|
|
@ -984,13 +984,20 @@ func (v *skillsGithubConfigV0) ToSkillsGithubConfig() SkillsGithubConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *skillsToolsConfigV0) ToSkillsToolsConfig() SkillsToolsConfig {
|
func (v *skillsToolsConfigV0) ToSkillsToolsConfig() SkillsToolsConfig {
|
||||||
|
cfg := DefaultConfig().Tools.Skills
|
||||||
clawHub := v.Registries.ClawHub.ToSkillRegistryConfig()
|
clawHub := v.Registries.ClawHub.ToSkillRegistryConfig()
|
||||||
github := v.Github.ToSkillsGithubConfig()
|
cfg.ToolConfig = v.ToolConfig
|
||||||
return SkillsToolsConfig{
|
cfg.Registries.Set(clawHub.Name, clawHub)
|
||||||
ToolConfig: v.ToolConfig,
|
if v.Github.BaseURL != "" {
|
||||||
Registries: SkillsRegistriesConfig{&clawHub},
|
cfg.Github.BaseURL = v.Github.BaseURL
|
||||||
Github: github,
|
|
||||||
MaxConcurrentSearches: v.MaxConcurrentSearches,
|
|
||||||
SearchCache: v.SearchCache,
|
|
||||||
}
|
}
|
||||||
|
if v.Github.Token != "" {
|
||||||
|
cfg.Github.Token = *NewSecureString(v.Github.Token)
|
||||||
|
}
|
||||||
|
if v.Github.Proxy != "" {
|
||||||
|
cfg.Github.Proxy = v.Github.Proxy
|
||||||
|
}
|
||||||
|
cfg.MaxConcurrentSearches = v.MaxConcurrentSearches
|
||||||
|
cfg.SearchCache = v.SearchCache
|
||||||
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1118,6 +1118,17 @@ func TestLoadConfig_V0MigrateProducesV2(t *testing.T) {
|
||||||
if !modelEnabled("local-model") {
|
if !modelEnabled("local-model") {
|
||||||
t.Error("local-model from V0 should be enabled")
|
t.Error("local-model from V0 should be enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
githubRegistry, ok := cfg.Tools.Skills.Registries.Get("github")
|
||||||
|
if !ok {
|
||||||
|
t.Fatal("expected default github skills registry to survive V0 migration")
|
||||||
|
}
|
||||||
|
if !githubRegistry.Enabled {
|
||||||
|
t.Error("github skills registry should remain enabled after V0 migration")
|
||||||
|
}
|
||||||
|
if githubRegistry.BaseURL != "https://github.com" {
|
||||||
|
t.Errorf("github registry base_url = %q, want %q", githubRegistry.BaseURL, "https://github.com")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestLoadConfig_UnsupportedVersion verifies that unsupported versions return an error.
|
// TestLoadConfig_UnsupportedVersion verifies that unsupported versions return an error.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue