feat(pipeline): write into wiki/<wing>/{sources,facts}/ when Config.Wing is set (#205 S2)
Sources -> wiki/<wing>/sources, concepts/entities -> wiki/<wing>/facts with kind: frontmatter; inventory, title resolution and back-references are confined to the target wing. Empty Wing keeps the retired layout unchanged. Mutation-checked: widening the inventory beyond the wing fails the cross-wing back-reference test; a non-plain wing name is rejected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ func Resolve(proposed []wiki.Page, inventory map[wiki.PageType][]wiki.Entry) []w
|
||||
|
||||
out := make([]wiki.Page, 0, len(proposed))
|
||||
for _, page := range proposed {
|
||||
pt := pageTypeFromPath(page.Path)
|
||||
pt := pageTypeOf(page)
|
||||
title := extractTitle(page.Content)
|
||||
k := key{pt: pt, normalized: normalizeTitle(title)}
|
||||
if canonicalSlug, ok := lookup[k]; ok {
|
||||
@@ -55,6 +55,22 @@ func normalizeTitle(s string) string {
|
||||
return strings.Join(strings.Fields(s), " ")
|
||||
}
|
||||
|
||||
// pageTypeOf is the page's type: from its directory in the retired layout, or
|
||||
// from `kind:` for a wing-layout facts page (concepts and entities share facts/).
|
||||
func pageTypeOf(p wiki.Page) wiki.PageType {
|
||||
parts := strings.Split(filepath.ToSlash(p.Path), "/")
|
||||
if len(parts) >= 4 && parts[0] == "wiki" {
|
||||
switch parts[2] {
|
||||
case "sources":
|
||||
return wiki.PageTypeSource
|
||||
case "facts":
|
||||
pt, _ := wiki.KindFromContent(p.Content)
|
||||
return pt
|
||||
}
|
||||
}
|
||||
return pageTypeFromPath(p.Path)
|
||||
}
|
||||
|
||||
// pageTypeFromPath extracts the wiki.PageType from a path like "wiki/entities/foo.md".
|
||||
func pageTypeFromPath(path string) wiki.PageType {
|
||||
parts := strings.Split(filepath.ToSlash(path), "/")
|
||||
|
||||
Reference in New Issue
Block a user