Files
ankn a5f8fb49ab Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
      Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
      Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)

Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
2026-06-30 20:39:52 +02:00

57 lines
1.6 KiB
Python

"""Stub page creation for entities that don't yet have a NoteGraph page.
Creates minimal markdown pages in the appropriate directory (people/ or projects/)
so that wiki-links resolve immediately after import.
"""
import logging
from pathlib import Path
from slugify import slugify
from ingestion.enrichment.models import Entity
logger = logging.getLogger(__name__)
def create_stub_pages(entities: list[Entity], notes_dir: Path) -> list[Path]:
"""Create stub pages for entities that don't have existing pages.
Args:
entities: List of entities to check/create stubs for.
notes_dir: Root notes directory (e.g., ./notes).
Returns:
List of paths to newly created stub pages.
"""
notes_dir = Path(notes_dir)
created: list[Path] = []
linkable = [e for e in entities if e.type in ("person", "project")]
seen_slugs: set[str] = set()
for entity in linkable:
slug = slugify(entity.value)
if slug in seen_slugs:
continue
seen_slugs.add(slug)
if entity.type == "person":
target = notes_dir / "people" / f"{slug}.md"
elif entity.type == "project":
target = notes_dir / "projects" / f"{slug}.md"
else:
continue
if target.exists():
logger.debug("Page already exists: %s", target)
continue
# Create stub page
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(f"# {entity.value}\n", encoding="utf-8")
logger.info("Created stub page: %s", target)
created.append(target)
return created