from __future__ import annotations import hashlib import json from datetime import datetime, timezone from pathlib import Path def main() -> None: skill_name = "mgm-galaxy-financial-chart-report-safe" workspace = Path("/root/.beaver/workspace") skill_dir = workspace / "skills" / skill_name skill_md = skill_dir / "versions" / "v0001" / "SKILL.md" content = skill_md.read_text(encoding="utf-8") digest = "sha256:" + hashlib.sha256(content.encode("utf-8")).hexdigest() now = datetime.now(timezone.utc).isoformat() (skill_dir / "current.json").write_text( json.dumps({"current_version": "v0001"}, indent=2, ensure_ascii=False) + "\n", encoding="utf-8", ) (skill_dir / "skill.json").write_text( json.dumps( { "name": skill_name, "display_name": "MGM/Galaxy Financial Chart Report Safe", "description": "Compare MGM China and Galaxy Entertainment using official financial sources, produce chart-ready Markdown, and avoid claiming generated chart image/file artifacts.", "created_at": now, "updated_at": now, "current_version": "v0001", "status": "active", "tags": ["finance", "research", "report", "chart-ready-data", "mgm", "galaxy"], "owners": ["steven"], "source_kind": "workspace", "lineage": [], }, indent=2, ensure_ascii=False, ) + "\n", encoding="utf-8", ) (skill_dir / "versions" / "v0001" / "version.json").write_text( json.dumps( { "skill_name": skill_name, "version": "v0001", "content_hash": digest, "summary_hash": digest, "created_at": now, "created_by": "steven", "change_reason": "Add real Skill Team Template example for MGM/Galaxy finance report demo", "parent_version": None, "review_state": "published", "frontmatter": { "name": skill_name, "description": "Compare MGM China and Galaxy Entertainment using official financial sources, produce chart-ready Markdown, and avoid claiming generated chart image/file artifacts.", "tools": ["web_search", "web_fetch"], }, "summary": "MGM/Galaxy finance report skill with a task-only Beaver team template for official source collection, metric extraction, validation, and Markdown chart-ready reporting.", "tool_hints": ["web_search", "web_fetch"], "provenance": {"source_kind": "manual_demo", "target_instance": "steven"}, "tree_hash": "", }, indent=2, ensure_ascii=False, ) + "\n", encoding="utf-8", ) index_path = workspace / "skills" / "_index" / "published.json" try: payload = json.loads(index_path.read_text(encoding="utf-8")) except FileNotFoundError: payload = {"items": []} items = [str(item) for item in payload.get("items", [])] if skill_name not in items: items.append(skill_name) index_path.write_text(json.dumps({"items": items}, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") print(f"installed metadata for {skill_name}: {digest}") if __name__ == "__main__": main()