checkpoint: this is a mess... need to define stricter DSL or system for how the AI devices sims and hookup api for tests.

This commit is contained in:
2026-02-28 22:50:14 -05:00
parent 2a69244f36
commit 6b0823ad6c
10 changed files with 101 additions and 77 deletions

View File

@@ -8,21 +8,60 @@ def main() -> None:
sys.stderr.write(f"DEBUG: GEMINI_CLI_HOOK_CONTEXT: {os.environ.get('GEMINI_CLI_HOOK_CONTEXT')}\n")
# Read prompt from stdin
try:
# On Windows, stdin might be closed or behave weirdly if not handled
prompt = sys.stdin.read()
except EOFError:
prompt = ""
sys.stderr.write(f"DEBUG: Received prompt via stdin ({len(prompt)} chars)\n")
sys.stderr.flush()
# Skip management commands
if len(sys.argv) > 1 and sys.argv[1] in ["mcp", "extensions", "skills", "hooks"]:
return
# If the prompt contains tool results, provide final answer
# Check for specific simulation contexts
# Use startswith or check the beginning of the prompt to avoid matching text inside skeletons
if 'PATH: Epic Initialization' in prompt[:500]:
mock_response = [
{"id": "mock-track-1", "type": "Track", "module": "core", "persona": "Tech Lead", "severity": "Medium", "goal": "Mock Goal 1", "acceptance_criteria": ["criteria 1"], "title": "Mock Goal 1"},
{"id": "mock-track-2", "type": "Track", "module": "ui", "persona": "Frontend Lead", "severity": "Low", "goal": "Mock Goal 2", "acceptance_criteria": ["criteria 2"], "title": "Mock Goal 2"}
]
print(json.dumps({
"type": "message",
"role": "assistant",
"content": json.dumps(mock_response)
}), flush=True)
print(json.dumps({
"type": "result",
"status": "success",
"stats": {"total_tokens": 100, "input_tokens": 50, "output_tokens": 50},
"session_id": "mock-session-epic"
}), flush=True)
return
if 'PATH: Sprint Planning' in prompt[:500]:
mock_response = [
{"id": "mock-ticket-1", "type": "Ticket", "goal": "Mock Ticket 1", "target_file": "file1.py", "depends_on": [], "context_requirements": "req 1"},
{"id": "mock-ticket-2", "type": "Ticket", "goal": "Mock Ticket 2", "target_file": "file2.py", "depends_on": ["mock-ticket-1"], "context_requirements": "req 2"}
]
print(json.dumps({
"type": "message",
"role": "assistant",
"content": json.dumps(mock_response)
}), flush=True)
print(json.dumps({
"type": "result",
"status": "success",
"stats": {"total_tokens": 100, "input_tokens": 50, "output_tokens": 50},
"session_id": "mock-session-sprint"
}), flush=True)
return
# If the prompt contains tool results, provide final answer
if '"role": "tool"' in prompt or '"tool_call_id"' in prompt:
print(json.dumps({
"type": "message",
"role": "assistant",
"content": "I have processed the tool results. Everything looks good!"
"content": "SUCCESS: Mock Tier 3 worker implemented the change. [MOCK OUTPUT]"
}), flush=True)
print(json.dumps({
"type": "result",
@@ -31,7 +70,8 @@ def main() -> None:
"session_id": "mock-session-final"
}), flush=True)
return
# Default flow: simulate a tool call
# Default flow: simulate a tool call
bridge_path = os.path.abspath("scripts/cli_tool_bridge.py")
# Using format that bridge understands
bridge_tool_call = {
@@ -66,11 +106,6 @@ def main() -> None:
"tool_id": "call_123",
"parameters": {"path": "test.txt"}
}), flush=True)
print(json.dumps({
"type": "message",
"role": "assistant",
"content": "I am reading the file now..."
}), flush=True)
print(json.dumps({
"type": "result",
"status": "success",