solutions: load a catalog without a disk (LoadFSWith, LoadBigPictureFS); skip *.conflict.md

LoadFSWith reads the Big Picture from its own fs.FS, so a catalog can be
embedded -- the web wizard runs the engine in the browser as WebAssembly.
The knowledge index leaves out wiki-sync conflict copies (*.conflict.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-12-01 16:20:21 +01:00
1 parent c8a219a84b
commit c1c0b8a116
4 files changed
+60 -6

No files matched your search

+17 -1
View File
@@ -156,6 +156,14 @@ func Load(root string) (*Catalog, error) {
// LoadFS reads a catalog from fsys (root is only used for messages and
// to find the Big Picture relative to it, when fsys is a directory).
func LoadFS(fsys fs.FS, root string) (*Catalog, error) {
return LoadFSWith(fsys, root, nil)
}
// LoadFSWith is LoadFS with the Big Picture read from bigPicture instead
// of the directory catalog.yaml names -- for a catalog without a disk
// (embedded in a program, or in the browser as WebAssembly). nil: as
// LoadFS.
func LoadFSWith(fsys fs.FS, root string, bigPicture fs.FS) (*Catalog, error) {
c := &Catalog{
Root: root,
Capabilities: map[string]*Capability{},
@@ -206,7 +214,15 @@ func LoadFS(fsys fs.FS, root string) (*Catalog, error) {
if !sawRoot {
c.add("error", "catalog.yaml", 0, "", "no-root", "no Catalog manifest (catalog.yaml) found")
}
if c.Spec.BigPicture != "" {
if c.Spec.BigPicture != "" && bigPicture != nil {
bp, err := LoadBigPictureFS(bigPicture, c.Spec.BigPicture)
if err != nil {
c.add("error", "catalog.yaml", 0, "", "bigpicture", err.Error())
} else {
c.BigPicture = bp
c.Files = append(c.Files, bp.Files...)
}
} else if c.Spec.BigPicture != "" {
bpDir := c.Spec.BigPicture
if !filepath.IsAbs(bpDir) {
bpDir = filepath.Join(root, bpDir)