fix(sdk): Coords trims leading @ from scope so callers can store either form

This commit is contained in:
Alex Dunmow 2026-06-03 07:03:19 +08:00
parent 12afdbd25e
commit 139d9b8543
2 changed files with 4 additions and 2 deletions

View File

@ -558,7 +558,7 @@ func upsertPluginMod(scope, name, kind string, categories []string) error {
if mod.Plugin.Version == "" { if mod.Plugin.Version == "" {
mod.Plugin.Version = "0.1.0" mod.Plugin.Version = "0.1.0"
} }
mod.Plugin.Scope = strings.TrimPrefix(scope, "@") mod.Plugin.Scope = scope
mod.Plugin.Name = name mod.Plugin.Name = name
mod.Plugin.Kind = kind mod.Plugin.Kind = kind
mod.Plugin.Categories = categories mod.Plugin.Categories = categories

View File

@ -1,6 +1,8 @@
package plugin package plugin
import ( import (
"strings"
tomlpkg "github.com/BurntSushi/toml" tomlpkg "github.com/BurntSushi/toml"
) )
@ -39,7 +41,7 @@ func (m *ModFile) Coords() string {
if m == nil { if m == nil {
return "" return ""
} }
scope := m.Plugin.Scope scope := strings.TrimPrefix(m.Plugin.Scope, "@")
if scope == "" { if scope == "" {
return m.Plugin.Name + "@" + m.Plugin.Version return m.Plugin.Name + "@" + m.Plugin.Version
} }