fix: harden review and verifier governance
This commit is contained in:
44
scripts/scripts_package_structure_test.go
Normal file
44
scripts/scripts_package_structure_test.go
Normal file
@@ -0,0 +1,44 @@
|
||||
//go:build llm_script
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestScriptsPackageCompileContract(t *testing.T) {
|
||||
projectRoot, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("getwd: %v", err)
|
||||
}
|
||||
scriptDir := projectRoot
|
||||
if filepath.Base(projectRoot) != "scripts" {
|
||||
scriptDir = filepath.Join(projectRoot, "scripts")
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(scriptDir)
|
||||
if err != nil {
|
||||
t.Fatalf("readdir %s: %v", scriptDir, err)
|
||||
}
|
||||
|
||||
var mainCount int
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".go") || strings.HasSuffix(entry.Name(), "_test.go") {
|
||||
continue
|
||||
}
|
||||
content, err := os.ReadFile(filepath.Join(scriptDir, entry.Name()))
|
||||
if err != nil {
|
||||
t.Fatalf("read %s: %v", entry.Name(), err)
|
||||
}
|
||||
if strings.Contains(string(content), "func main()") {
|
||||
mainCount++
|
||||
}
|
||||
}
|
||||
|
||||
if mainCount < 2 {
|
||||
t.Fatalf("expected scripts package to contain multiple CLI entrypoints, got %d", mainCount)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user