From af02d5de0289776e05d6cdb56f06560bcdfe41a5 Mon Sep 17 00:00:00 2001 From: bolbol Date: Thu, 30 Jul 2026 08:36:34 +0000 Subject: [PATCH] test: regression projection markdown + commit git automatique --- app/test_phase4_git_sync.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 app/test_phase4_git_sync.py diff --git a/app/test_phase4_git_sync.py b/app/test_phase4_git_sync.py new file mode 100644 index 0000000..5f1a986 --- /dev/null +++ b/app/test_phase4_git_sync.py @@ -0,0 +1,28 @@ +import asyncio, sqlite3 +from mcp.client.sse import sse_client +from mcp import ClientSession + +def get_key(agent): + con = sqlite3.connect("data/context_hub.db") + cur = con.cursor() + cur.execute("SELECT api_key FROM api_keys WHERE agent_name=?", (agent,)) + return cur.fetchone()[0] + +async def call_as(agent, tool, args): + key = get_key(agent) + async with sse_client("http://localhost:8000/mcp", headers={"X-API-Key": key}) as (read, write): + async with ClientSession(read, write) as session: + await session.initialize() + return await session.call_tool(tool, args) + +async def main(): + print("=== record_lesson avec push git ===") + r = await call_as("CLAUDE", "record_lesson", { + "scope": "coding", "type": "best-practice", + "title": "Test phase 4 - a supprimer", + "body": "Validation generation markdown + commit Git automatique.", + "project": "context-hub", "tags": ["test", "phase4"] + }) + print(r.content[0].text) + +asyncio.run(main())