topdata: skip .md doc files in asset validation and packaging (#32)
build-binaries / build-binaries (push) Successful in 2m14s
test / test (push) Successful in 1m26s

Docs like AGENTS.md/CLAUDE.md under assets/ broke sow-topdata builds
with "unsupported topdata asset HAK resource extension". Skip .md in
both the validator and HAK package walker.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Reviewed-on: #32
Reviewed-by: xtul <mpiasecki720@protonmail.com>
Co-authored-by: vickydotbat <vickydotbat@tutamail.com>
Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #32.
This commit is contained in:
2026-07-08 16:02:38 +00:00
committed by archvillainette
parent cec3466779
commit 018b0f7686
3 changed files with 26 additions and 0 deletions
+3
View File
@@ -214,6 +214,9 @@ func collectTopPackageResources(p *project.Project, compiled2DADir string) ([]er
if strings.HasPrefix(filepath.Base(path), ".") { if strings.HasPrefix(filepath.Base(path), ".") {
return nil return nil
} }
if strings.EqualFold(filepath.Ext(path), ".md") {
return nil // docs (AGENTS.md, README.md, ...) are never HAK resources
}
resource, err := topPackageResourceFromPath(path) resource, err := topPackageResourceFromPath(path)
if err != nil { if err != nil {
return err return err
+3
View File
@@ -2233,6 +2233,9 @@ func validateTopPackageAssets(sourceDir, dataDir string, report *ValidationRepor
if strings.HasPrefix(filepath.Base(path), ".") { if strings.HasPrefix(filepath.Base(path), ".") {
return nil return nil
} }
if strings.EqualFold(filepath.Ext(path), ".md") {
return nil // docs (AGENTS.md, README.md, ...) are never HAK resources
}
base := strings.ToLower(strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))) base := strings.ToLower(strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)))
ext := strings.TrimPrefix(strings.ToLower(filepath.Ext(path)), ".") ext := strings.TrimPrefix(strings.ToLower(filepath.Ext(path)), ".")
if _, ok := erf.HAKResourceTypeForExtension(ext); !ok { if _, ok := erf.HAKResourceTypeForExtension(ext); !ok {
+20
View File
@@ -15115,3 +15115,23 @@ func writeBytes(t *testing.T, path string, content []byte) {
t.Fatalf("write %s: %v", path, err) t.Fatalf("write %s: %v", path, err)
} }
} }
func TestValidateTopPackageAssetsSkipsMarkdown(t *testing.T) {
dir := t.TempDir()
assets := filepath.Join(dir, "assets", "gui")
if err := os.MkdirAll(assets, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(assets, "AGENTS.md"), []byte("docs"), 0o644); err != nil {
t.Fatal(err)
}
dataDir := filepath.Join(dir, "data")
if err := os.MkdirAll(dataDir, 0o755); err != nil {
t.Fatal(err)
}
var report ValidationReport
validateTopPackageAssets(dir, dataDir, &report)
for _, d := range report.Diagnostics {
t.Errorf("unexpected diagnostic: %s: %s", d.Path, d.Message)
}
}