haiku.rag/tests/test_bump_version.py
Yiorgis Gozadinos d7c131bc28
Package the plugin for Codex from the same bundle
The Claude Code plugin moves to plugins/haiku-rag/ and gains a Codex
manifest at .codex-plugin/plugin.json; both share one .mcp.json and one
haiku-rag Agent Skill. .agents/plugins/marketplace.json serves Codex, the
Claude marketplace points at the new path, and scripts/bump_version.py
bumps both manifests. The skill declares its compatibility.
2026-09-07 11:21:25 +03:00

41 lines
1.3 KiB
Python

import importlib.util
import json
from pathlib import Path
_spec = importlib.util.spec_from_file_location(
"bump_version", Path(__file__).resolve().parents[1] / "scripts" / "bump_version.py"
)
assert _spec is not None and _spec.loader is not None
bump_version = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(bump_version)
def test_update_plugin_version_rewrites_only_the_version_field(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
manifest = tmp_path / "plugin.json"
manifest.write_text(
'{\n "name": "haiku-rag",\n "version": "0.1.0",\n "license": "MIT"\n}\n'
)
bump_version.update_plugin_version(manifest, "0.2.0")
assert json.loads(manifest.read_text()) == {
"name": "haiku-rag",
"version": "0.2.0",
"license": "MIT",
}
assert manifest.read_text().endswith("}\n")
def test_the_shipped_plugin_manifests_carry_the_package_version():
root = Path(__file__).resolve().parents[1]
package_version = bump_version.get_current_version(
root / "haiku_rag_slim" / "pyproject.toml"
)
for client in ("claude", "codex"):
manifest = json.loads(
(
root / "plugins" / "haiku-rag" / f".{client}-plugin" / "plugin.json"
).read_text()
)
assert manifest["version"] == package_version