fix redundant skills registry names in saved config

This commit is contained in:
lxowalle 2026-04-12 20:01:59 +08:00
parent 59c8c76588
commit 954ea3be14
2 changed files with 2 additions and 6 deletions

View file

@ -445,9 +445,6 @@ func (c SkillRegistryConfig) MarshalJSON() ([]byte, error) {
"enabled": c.Enabled, "enabled": c.Enabled,
"base_url": c.BaseURL, "base_url": c.BaseURL,
} }
if c.Name != "" {
m["name"] = c.Name
}
if c.AuthToken.String() != "" { if c.AuthToken.String() != "" {
m["auth_token"] = c.AuthToken m["auth_token"] = c.AuthToken
} }
@ -514,9 +511,6 @@ func (c SkillRegistryConfig) MarshalYAML() (any, error) {
"enabled": c.Enabled, "enabled": c.Enabled,
"base_url": c.BaseURL, "base_url": c.BaseURL,
} }
if c.Name != "" {
m["name"] = c.Name
}
if c.AuthToken.String() != "" { if c.AuthToken.String() != "" {
m["auth_token"] = c.AuthToken m["auth_token"] = c.AuthToken
} }

View file

@ -242,6 +242,8 @@ func TestSkillsRegistriesConfigMarshalJSONPreservesObjectShape(t *testing.T) {
assert.Contains(t, string(data), `"github":{`) assert.Contains(t, string(data), `"github":{`)
assert.Contains(t, string(data), `"clawhub":{`) assert.Contains(t, string(data), `"clawhub":{`)
assert.NotContains(t, string(data), `[{`) assert.NotContains(t, string(data), `[{`)
assert.NotContains(t, string(data), `"name":"github"`)
assert.NotContains(t, string(data), `"name":"clawhub"`)
var decoded map[string]json.RawMessage var decoded map[string]json.RawMessage
err = json.Unmarshal(data, &decoded) err = json.Unmarshal(data, &decoded)