Coverage for scripts/check_version_parity.py: 100%
12 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-31 06:18 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-31 06:18 +0000
1#!/usr/bin/env python3
2"""Assert plugin.json and marketplace.json declare the same plugin version.
4Used as a pre-commit hook so the two manifests can never drift (the mistake
5that produced a 0.1.0 / v0.2.0 mismatch). Exits non-zero on mismatch.
6"""
8import json
9import sys
10from pathlib import Path
13def main() -> None:
14 """Entry point: assert both manifests share a version; exit 1 on mismatch."""
15 plugin = json.loads(Path(".claude-plugin/plugin.json").read_text())["version"]
16 entries = json.loads(Path(".claude-plugin/marketplace.json").read_text())["plugins"]
17 mismatches = [e["name"] for e in entries if e.get("version") != plugin]
18 if mismatches:
19 market = {e["name"]: e.get("version") for e in entries}
20 print(
21 f"Version mismatch: plugin.json={plugin} but marketplace.json entries={market}",
22 file=sys.stderr,
23 )
24 sys.exit(1)
25 print(f"manifest versions match: {plugin}")
28if __name__ == "__main__":
29 main()