mirror of
https://github.com/obra/superpowers.git
synced 2026-07-26 04:04:03 +08:00
Rebase of PR #1922 onto current dev: the ~14 files of v6.1.0-era codex/release drift are dropped, the porting-guide edits (stale against the post-prune rewrite, no Hermes content) are dropped, and the Hermes surface is kept intact: .hermes-plugin/ (on_session_start bootstrap injection), tests/hermes/ (20 tests, passing), docs/README.hermes.md, references/hermes-tools.md, the Platform Adaptation row, README section, and Python ignores. Known open items from review, unchanged by this rebase: the injection mechanism uses ctx.inject_message from on_session_start, which the official plugin guide does not document (pre_llm_call returning {"context": ...} is the sanctioned path), skills are not registered via ctx.register_skill, and the acceptance transcript predates the fix. Co-authored-by: kumarabd <kumarabd@users.noreply.github.com>
20 lines
445 B
Python
20 lines
445 B
Python
import pytest
|
|
from unittest.mock import MagicMock
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_ctx():
|
|
ctx = MagicMock()
|
|
ctx._hooks = {}
|
|
ctx._injected = []
|
|
|
|
def register_hook(event, fn):
|
|
ctx._hooks[event] = fn
|
|
|
|
def inject_message(content, role="user"):
|
|
ctx._injected.append({"content": content, "role": role})
|
|
|
|
ctx.register_hook.side_effect = register_hook
|
|
ctx.inject_message.side_effect = inject_message
|
|
return ctx
|