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

Function newGithubPlugin

internal/plugin/github.go:34–50  ·  view source on GitHub ↗
(ref flake.Ref)

Source from the content-addressed store, hash-verified

32var githubNameRegexp = regexp.MustCompile("[^a-zA-Z0-9-_.]+")
33
34func newGithubPlugin(ref flake.Ref) (*githubPlugin, error) {
35 plugin := &githubPlugin{ref: ref}
36 // For backward compatibility, we don't strictly require name to be present
37 // in github plugins. If it's missing, we just use the directory as the name.
38 name, err := getPluginNameFromContent(plugin)
39 if err != nil && !errors.Is(err, errNameMissing) {
40 return nil, err
41 }
42 if name == "" {
43 name = strings.ReplaceAll(ref.Dir, "/", "-")
44 }
45 plugin.name = githubNameRegexp.ReplaceAllString(
46 strings.Join(lo.Compact([]string{ref.Owner, ref.Repo, name}), "."),
47 " ",
48 )
49 return plugin, nil
50}
51
52func (p *githubPlugin) Fetch() ([]byte, error) {
53 content, err := p.FileContent(pluginConfigName)

Callers 1

parseIncludableFunction · 0.85

Calls 2

getPluginNameFromContentFunction · 0.85
IsMethod · 0.80

Tested by

no test coverage detected