Off by default (retired layout unchanged). On: eligibility from classification.yaml, local ingest LLM as classifier, BM25 as cross-check, INGEST_WING_THRESHOLD (default 0.9, rejected outside [0,1]). Build failure is fatal when explicitly enabled. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
40 lines
979 B
Go
40 lines
979 B
Go
package wing
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"sort"
|
|
)
|
|
|
|
// legacyDirs are the retired wiki/{concepts,entities,sources}/ layout, not wings.
|
|
var legacyDirs = map[string]bool{"concepts": true, "entities": true, "sources": true}
|
|
|
|
// KnownWings lists wiki/<wing>/ directories that contain at least one hall
|
|
// subdirectory, sorted. The retired layout is not a wing. A missing wiki/ is
|
|
// an error: an unreadable brain must not look like "no wings".
|
|
func KnownWings(brainDir string) ([]string, error) {
|
|
entries, err := os.ReadDir(filepath.Join(brainDir, "wiki"))
|
|
if err != nil {
|
|
return nil, fmt.Errorf("list wings: %w", err)
|
|
}
|
|
var out []string
|
|
for _, e := range entries {
|
|
if !e.IsDir() || legacyDirs[e.Name()] {
|
|
continue
|
|
}
|
|
subs, err := os.ReadDir(filepath.Join(brainDir, "wiki", e.Name()))
|
|
if err != nil {
|
|
continue
|
|
}
|
|
for _, s := range subs {
|
|
if s.IsDir() {
|
|
out = append(out, e.Name())
|
|
break
|
|
}
|
|
}
|
|
}
|
|
sort.Strings(out)
|
|
return out, nil
|
|
}
|