MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _render_core

Function _render_core

tools/skillgen/gen.py:360–390  ·  view source on GitHub ↗

Fill the shared core template's per-platform slots for this platform.

(platform: Platform)

Source from the content-addressed store, hash-verified

358
359
360def _render_core(platform: Platform) -> str:
361 """Fill the shared core template's per-platform slots for this platform."""
362 template = _read_fragment(f"core/{platform.core}.md")
363
364 if platform.dispatch is None:
365 raise ValueError(f"split platform '{platform.key}' is missing a dispatch variant")
366
367 install = _read_fragment(f"shell/{platform.shell}.md").rstrip("\n")
368 dispatch = _read_fragment(f"dispatch/{platform.dispatch}.md").rstrip("\n")
369 query_stub = _read_fragment(_QUERY_STUB).rstrip("\n")
370
371 if platform.extra_sections:
372 extra = "".join(
373 _read_fragment(f"extra/{name}.md").rstrip("\n") + "\n\n"
374 for name in platform.extra_sections
375 )
376 else:
377 extra = ""
378
379 body = (
380 template.replace("@@FRONTMATTER@@", _render_frontmatter(platform))
381 .replace("@@INSTALL@@", install)
382 .replace("@@DISPATCH@@", dispatch)
383 .replace("@@QUERY_STUB@@", query_stub)
384 .replace("@@HOOKS_TARGET@@", platform.hooks_target)
385 .replace("@@EXTRA@@", extra)
386 )
387 if "@@" in body:
388 leftover = sorted(set(re.findall(r"@@\w+@@", body)))
389 raise ValueError(f"unfilled core slots for '{platform.key}': {leftover}")
390 return _normalise(body)
391
392
393def _render_agents_md_hooks(platform: Platform) -> str:

Callers 1

renderFunction · 0.85

Calls 3

_read_fragmentFunction · 0.85
_render_frontmatterFunction · 0.85
_normaliseFunction · 0.85

Tested by

no test coverage detected