haiku.rag/tests/test_bump_version.py
Yiorgis Gozadinos eb9995e9b7
Ship a Claude Code plugin with the haiku-rag skill
claude-plugin/ holds the plugin manifest, the server configuration
(haiku-rag mcp --stdio, the configuration decides the database) and a
skill that says when to reach for the knowledge base and how to move
from a search result to a document, a section, an answer or a
computation. A repo-root marketplace manifest makes
`claude plugin marketplace add ggozad/haiku.rag` work. The skill
pre-approves every tool the server registers, and a test keeps the two
in step.

The manifest carries the package version, which bump_version.py now
rewrites: a versioned plugin updates only on a bump, so the installed
skill stays in step with the haiku-rag release the user has.

Refs #599
2026-09-04 13:00:15 +03:00

38 lines
1.2 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_manifest_carries_the_package_version():
root = Path(__file__).resolve().parents[1]
plugin = json.loads(
(root / "claude-plugin" / ".claude-plugin" / "plugin.json").read_text()
)
assert plugin["version"] == bump_version.get_current_version(
root / "haiku_rag_slim" / "pyproject.toml"
)