MCPcopy
hub / github.com/openai/plugins / plugin_metadata

Function plugin_metadata

plugins/ngs-analysis/scripts/ngs_run_utils.py:391–417  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389
390
391def plugin_metadata() -> dict[str, Any]:
392 root = _find_plugin_root()
393 metadata: dict[str, Any] = {
394 "name": None,
395 "version": None,
396 "repository": None,
397 "source_root": str(root) if root else None,
398 "git_commit": None,
399 }
400 if root is None:
401 return metadata
402 plugin_json = root / ".codex-plugin" / "plugin.json"
403 try:
404 payload = json.loads(plugin_json.read_text(encoding="utf-8"))
405 metadata["name"] = payload.get("name")
406 metadata["version"] = payload.get("version")
407 metadata["repository"] = payload.get("repository")
408 except (OSError, json.JSONDecodeError):
409 pass
410 git_root = next(
411 (candidate for candidate in [root, *root.parents] if (candidate / ".git").exists()), None
412 )
413 if git_root is not None:
414 revision = run_cmd(["git", "rev-parse", "HEAD"], git_root, timeout=15)
415 if revision.get("ok") and revision.get("stdout_tail"):
416 metadata["git_commit"] = str(revision["stdout_tail"]).splitlines()[0].strip()
417 return metadata
418
419
420def environment_snapshot() -> dict[str, Any]:

Callers 1

write_standard_manifestFunction · 0.85

Calls 4

_find_plugin_rootFunction · 0.85
run_cmdFunction · 0.70
nextFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected