Implement REUSE-WP-0013 registry establish, update, and stats
Some checks failed
ci / validate-registry (push) Has been cancelled

Add stats, establish (scaffold, publish-check, discover), and update CLI
commands with optional llm-connect bridge, validate --root for sibling repos,
pytest coverage, and documentation for sibling registry onboarding.
This commit is contained in:
2026-06-16 01:21:01 +02:00
parent fb712b4b98
commit 70a5003f6e
19 changed files with 1740 additions and 30 deletions

53
tests/test_llm_bridge.py Normal file
View File

@@ -0,0 +1,53 @@
from __future__ import annotations
import json
from unittest.mock import patch
import pytest
from reuse_surface.llm_bridge import (
extract_json_object,
llm_connect_url,
request_registry_draft,
)
def test_extract_json_object_from_fenced_block():
data = extract_json_object('```json\n{"capabilities": []}\n```')
assert data == {"capabilities": []}
def test_llm_connect_url_missing_raises():
with pytest.raises(ValueError, match="LLM_CONNECT_URL"):
llm_connect_url(None)
def test_request_registry_draft_mock_http():
payload = {
"content": json.dumps(
{
"capabilities": [
{
"id": "capability.demo.sample",
"name": "Sample",
"summary": "Demo capability",
}
]
}
)
}
class FakeResponse:
def __enter__(self):
return self
def __exit__(self, *args):
return False
def read(self):
return json.dumps(payload).encode("utf-8")
with patch.dict("os.environ", {"LLM_CONNECT_URL": "http://llm.test"}):
with patch("urllib.request.urlopen", return_value=FakeResponse()):
draft = request_registry_draft("test prompt")
assert draft["capabilities"][0]["id"] == "capability.demo.sample"