MCPcopy Index your code
hub / github.com/jetify-com/devbox / getPluginNameFromContent

Function getPluginNameFromContent

internal/plugin/includable.go:46–67  ·  view source on GitHub ↗
(plugin fetcher)

Source from the content-addressed store, hash-verified

44)
45
46func getPluginNameFromContent(plugin fetcher) (string, error) {
47 content, err := plugin.Fetch()
48 if err != nil {
49 return "", err
50 }
51 m := map[string]any{}
52 if err := json.Unmarshal(content, &m); err != nil {
53 return "", err
54 }
55 name, ok := m["name"].(string)
56 if !ok || name == "" {
57 return "",
58 fmt.Errorf("%w in plugin %s", errNameMissing, plugin.LockfileKey())
59 }
60 if !nameRegex.MatchString(name) {
61 return "", usererr.New(
62 "plugin %s has an invalid name %q. Name must match %s",
63 plugin.LockfileKey(), name, nameRegex,
64 )
65 }
66 return name, nil
67}

Callers 2

newGithubPluginFunction · 0.85
newLocalPluginFunction · 0.85

Calls 3

NewFunction · 0.92
FetchMethod · 0.65
LockfileKeyMethod · 0.65

Tested by

no test coverage detected