feat(standards): serve service version-wiring rule + bundle wiki pages in MCP

Versioning standard now states services must read their VERSION (e.g. a build arg) rather than hardcoding it; the compliance prompt repeats it. build_bundle also bundles src/wiki/** as wiki_-prefixed modules (e.g. docs://modules/wiki_development_releasing), so the release runbook is reachable from the MCP. Bundle grows to 22 modules.
This commit is contained in:
2026-10-15 18:50:03 +05:30
parent 5971f26c08
commit e33a6d6704
14 changed files with 111 additions and 8 deletions

View File

@@ -99,13 +99,26 @@ def _read_title(path: Path) -> str:
return _module_name(path.stem).replace("_", " ").title()
def _wiki_module_name(rel: Path) -> str:
"""Map a wiki page path to a namespaced module name.
``04_development/02_releasing.md`` -> ``wiki_development_releasing``; the
``wiki_`` prefix keeps wiki pages from colliding with lib modules (both have
an ``index``).
"""
parts = [NUM_PREFIX.sub("", part) or part for part in rel.with_suffix("").parts]
return "wiki_" + "_".join(parts)
def build_bundle(folder: Path, dry_run: bool = False) -> None:
"""Regenerate ``<name>/mcp`` from ``folder/src/lib`` markdown.
"""Regenerate ``<name>/mcp`` from ``folder/src/lib`` and ``folder/src/wiki``.
The bundle mirrors the lib site (in the same way doc-forge's MCP output
mirrors its lib documentation). Writes ``index.json``, ``nav.json`` and
``modules/*.json`` in the doc-forge MCP bundle shape. Hand-authored extras
(e.g. ``libraries.json``) are left untouched.
(e.g. ``libraries.json``) are left untouched. Wiki pages (``src/wiki/**``)
are also bundled, under a ``wiki_`` namespaced module name, so the runbooks
are reachable from the MCP.
Args:
folder (Path): The hub folder owning a ``src/lib``.
@@ -149,6 +162,17 @@ def build_bundle(folder: Path, dry_run: bool = False) -> None:
"title": _read_title(path),
})
wiki = folder / "src" / "wiki"
if wiki.is_dir():
for path in sorted(wiki.rglob("*.md")):
module = _wiki_module_name(path.relative_to(wiki))
write_module(module, path.read_text(encoding="utf-8"))
nav.append({
"module": module,
"resource": f"docs://modules/{module}",
"title": _read_title(path),
})
(out_dir / "nav.json").write_text(
json.dumps(nav, indent=2, ensure_ascii=False), encoding="utf-8"
)