#!/usr/bin/env python3 """Rendere autocontenuto un .md generato da mcp-docugen. Sostituisce un eventuale `stylesheet: ` nel frontmatter con un blocco `\n\n{rest.lstrip()}" ) if in_place: md_path.write_text(bundled, encoding="utf-8") return md_path out_path = md_path.with_name(md_path.stem + ".bundled.md") out_path.write_text(bundled, encoding="utf-8") return out_path def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("md_file", type=Path) parser.add_argument("--css", type=Path, default=DEFAULT_CSS) parser.add_argument("--in-place", action="store_true") args = parser.parse_args() if not args.md_file.is_file(): raise SystemExit(f"file non trovato: {args.md_file}") if not args.css.is_file(): raise SystemExit(f"CSS non trovato: {args.css}") out = bundle(args.md_file, args.css, args.in_place) print(f"OK: {out}", file=sys.stderr) if __name__ == "__main__": main()