package bnp import ( "fmt" "os" "path/filepath" "strings" sdkbnp "git.dev.alexdunmow.com/block/pluginsdk/bnp" ) // IsCodelessRepo reports whether dir is a declarative plugin repo: it has a // plugin.mod but no Go source at the root (the wasm main package's home). func IsCodelessRepo(dir string) (bool, error) { if _, err := os.Stat(filepath.Join(dir, sdkbnp.FileMod)); err != nil { return false, fmt.Errorf("read plugin.mod (is %s a plugin repo?): %w", dir, err) } entries, err := os.ReadDir(dir) if err != nil { return false, err } for _, e := range entries { if !e.IsDir() && strings.HasSuffix(e.Name(), ".go") { return false, nil } } return true, nil }