forked from Rockachopa/Timmy-time-dashboard
Use TIMMY_STATUS_PROMPT in CLI status command
TIMMY_STATUS_PROMPT was defined in timmy/prompts.py and covered by tests, but never wired into the application. The CLI status command was passing a hardcoded inline string instead. Replace the inline string with the canonical prompt and add two CLI tests that verify the correct prompt is used. https://claude.ai/code/session_01DMjQ5qMZ8iHeyix1j3GS7c
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import typer
|
||||
|
||||
from timmy.agent import create_timmy
|
||||
from timmy.prompts import TIMMY_STATUS_PROMPT
|
||||
|
||||
app = typer.Typer(help="Timmy — sovereign AI agent")
|
||||
|
||||
@@ -23,7 +24,7 @@ def chat(message: str = typer.Argument(..., help="Message to send")):
|
||||
def status():
|
||||
"""Print Timmy's operational status."""
|
||||
timmy = create_timmy()
|
||||
timmy.print_response("Brief status report — one sentence.", stream=False)
|
||||
timmy.print_response(TIMMY_STATUS_PROMPT, stream=False)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
29
tests/test_cli.py
Normal file
29
tests/test_cli.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from timmy.cli import app
|
||||
from timmy.prompts import TIMMY_STATUS_PROMPT
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
def test_status_uses_status_prompt():
|
||||
"""status command must pass TIMMY_STATUS_PROMPT to the agent."""
|
||||
mock_timmy = MagicMock()
|
||||
|
||||
with patch("timmy.cli.create_timmy", return_value=mock_timmy):
|
||||
runner.invoke(app, ["status"])
|
||||
|
||||
mock_timmy.print_response.assert_called_once_with(TIMMY_STATUS_PROMPT, stream=False)
|
||||
|
||||
|
||||
def test_status_does_not_use_inline_string():
|
||||
"""status command must not pass the old inline hardcoded string."""
|
||||
mock_timmy = MagicMock()
|
||||
|
||||
with patch("timmy.cli.create_timmy", return_value=mock_timmy):
|
||||
runner.invoke(app, ["status"])
|
||||
|
||||
call_args = mock_timmy.print_response.call_args
|
||||
assert call_args[0][0] != "Brief status report — one sentence."
|
||||
Reference in New Issue
Block a user