cli/internal/bnp/codeless.go
Alex Dunmow ab21eb4e88 Build codeless artifacts through the pluginsdk packer
The codeless build, declarative validation and tar.zst packer moved to
block/pluginsdk/bnp (v0.3.10). ninja plugin build and publish call
sdkbnp.BuildCodeless; the wasm build keeps DESCRIBE extraction and uses
the SDK helpers over os.DirFS. weareblissful and the wasm fixture build
to the same sha256 as before. ADR 0003.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 23:31:10 +08:00

29 lines
684 B
Go

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
}