code-puppy 0.0.153__py3-none-any.whl → 0.0.155__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. code_puppy/agent.py +4 -3
  2. code_puppy/agents/agent_creator_agent.py +9 -2
  3. code_puppy/agents/runtime_manager.py +12 -4
  4. code_puppy/command_line/mcp/install_command.py +50 -1
  5. code_puppy/command_line/mcp/wizard_utils.py +88 -17
  6. code_puppy/config.py +8 -2
  7. code_puppy/main.py +17 -4
  8. code_puppy/mcp/__init__.py +2 -2
  9. code_puppy/mcp/config_wizard.py +1 -1
  10. code_puppy/message_history_processor.py +1 -9
  11. code_puppy/messaging/spinner/console_spinner.py +1 -1
  12. code_puppy/model_factory.py +13 -12
  13. code_puppy/models.json +26 -0
  14. code_puppy/round_robin_model.py +35 -18
  15. code_puppy/summarization_agent.py +1 -3
  16. code_puppy/tools/agent_tools.py +41 -138
  17. code_puppy/tools/file_operations.py +116 -96
  18. code_puppy/tui/app.py +1 -1
  19. {code_puppy-0.0.153.data → code_puppy-0.0.155.data}/data/code_puppy/models.json +26 -0
  20. {code_puppy-0.0.153.dist-info → code_puppy-0.0.155.dist-info}/METADATA +2 -2
  21. {code_puppy-0.0.153.dist-info → code_puppy-0.0.155.dist-info}/RECORD +24 -46
  22. code_puppy/token_utils.py +0 -67
  23. code_puppy/tools/token_check.py +0 -32
  24. code_puppy/tui/tests/__init__.py +0 -1
  25. code_puppy/tui/tests/test_agent_command.py +0 -79
  26. code_puppy/tui/tests/test_chat_message.py +0 -28
  27. code_puppy/tui/tests/test_chat_view.py +0 -88
  28. code_puppy/tui/tests/test_command_history.py +0 -89
  29. code_puppy/tui/tests/test_copy_button.py +0 -191
  30. code_puppy/tui/tests/test_custom_widgets.py +0 -27
  31. code_puppy/tui/tests/test_disclaimer.py +0 -27
  32. code_puppy/tui/tests/test_enums.py +0 -15
  33. code_puppy/tui/tests/test_file_browser.py +0 -60
  34. code_puppy/tui/tests/test_help.py +0 -38
  35. code_puppy/tui/tests/test_history_file_reader.py +0 -107
  36. code_puppy/tui/tests/test_input_area.py +0 -33
  37. code_puppy/tui/tests/test_settings.py +0 -44
  38. code_puppy/tui/tests/test_sidebar.py +0 -33
  39. code_puppy/tui/tests/test_sidebar_history.py +0 -153
  40. code_puppy/tui/tests/test_sidebar_history_navigation.py +0 -132
  41. code_puppy/tui/tests/test_status_bar.py +0 -54
  42. code_puppy/tui/tests/test_timestamped_history.py +0 -52
  43. code_puppy/tui/tests/test_tools.py +0 -82
  44. {code_puppy-0.0.153.dist-info → code_puppy-0.0.155.dist-info}/WHEEL +0 -0
  45. {code_puppy-0.0.153.dist-info → code_puppy-0.0.155.dist-info}/entry_points.txt +0 -0
  46. {code_puppy-0.0.153.dist-info → code_puppy-0.0.155.dist-info}/licenses/LICENSE +0 -0
@@ -1,52 +0,0 @@
1
- import unittest
2
- from unittest.mock import MagicMock, patch
3
-
4
- from code_puppy.config import save_command_to_history
5
- from code_puppy.tui.app import CodePuppyTUI
6
- from code_puppy.tui.components.custom_widgets import CustomTextArea
7
-
8
-
9
- class TestTimestampedHistory(unittest.TestCase):
10
- def setUp(self):
11
- self.app = CodePuppyTUI()
12
-
13
- @patch("code_puppy.tui.app.save_command_to_history")
14
- def test_action_send_message_uses_timestamp_function(self, mock_save_command):
15
- # Setup test mocks
16
- self.app.query_one = MagicMock()
17
- input_field_mock = MagicMock(spec=CustomTextArea)
18
- input_field_mock.text = "test command"
19
- self.app.query_one.return_value = input_field_mock
20
-
21
- # Mock other methods to prevent full execution
22
- self.app.add_user_message = MagicMock()
23
- self.app._update_submit_cancel_button = MagicMock()
24
- self.app.run_worker = MagicMock()
25
-
26
- # Execute
27
- self.app.action_send_message()
28
-
29
- # Assertions
30
- mock_save_command.assert_called_once_with("test command")
31
- self.app.add_user_message.assert_called_once_with("test command")
32
-
33
- @patch("datetime.datetime")
34
- @patch("builtins.open", new_callable=unittest.mock.mock_open)
35
- def test_save_command_uses_iso_timestamp(self, mock_file, mock_datetime):
36
- # Setup
37
- mock_now = MagicMock()
38
- mock_now.isoformat.return_value = "2023-01-01T12:34:56"
39
- mock_datetime.now.return_value = mock_now
40
-
41
- # Call function
42
- save_command_to_history("test command")
43
-
44
- # Assertions
45
- mock_file().write.assert_called_once_with(
46
- "\n# 2023-01-01T12:34:56\ntest command\n"
47
- )
48
- mock_now.isoformat.assert_called_once_with(timespec="seconds")
49
-
50
-
51
- if __name__ == "__main__":
52
- unittest.main()
@@ -1,82 +0,0 @@
1
- """
2
- Tests for ToolsScreen TUI component.
3
- """
4
-
5
- from unittest.mock import patch
6
-
7
- from code_puppy.tools.tools_content import tools_content
8
- from code_puppy.tui.screens.tools import ToolsScreen
9
-
10
-
11
- class TestToolsScreen:
12
- """Test cases for ToolsScreen functionality."""
13
-
14
- def test_tools_screen_initialization(self):
15
- """Test that ToolsScreen can be initialized."""
16
- screen = ToolsScreen()
17
- assert screen is not None
18
- assert isinstance(screen, ToolsScreen)
19
-
20
- def test_tools_content_import(self):
21
- """Test that tools_content is imported correctly."""
22
- # Verify that tools_content is a non-empty string
23
- assert isinstance(tools_content, str)
24
- assert len(tools_content) > 0
25
- assert "File Operations" in tools_content
26
- assert "Search & Analysis" in tools_content
27
-
28
- def test_screen_composition(self):
29
- """Test that screen has compose method and can be called."""
30
- screen = ToolsScreen()
31
-
32
- # Verify the compose method exists and is callable
33
- assert hasattr(screen, "compose")
34
- assert callable(screen.compose)
35
-
36
- def test_markdown_widget_receives_tools_content(self):
37
- """Test that Markdown widget receives tools_content."""
38
- # Instead of actually executing compose, verify the tools.py implementation
39
- # directly by examining the source code
40
- import inspect
41
-
42
- source = inspect.getsource(ToolsScreen.compose)
43
-
44
- # Check that the compose method references tools_content
45
- assert "tools_content" in source
46
- # Check that Markdown is created with tools_content
47
- assert "yield Markdown(tools_content" in source
48
-
49
- def test_dismiss_functionality(self):
50
- """Test that dismiss button works correctly."""
51
- screen = ToolsScreen()
52
-
53
- # Mock the dismiss method
54
- with patch.object(screen, "dismiss") as mock_dismiss:
55
- screen.dismiss_tools()
56
-
57
- mock_dismiss.assert_called_once()
58
-
59
- def test_escape_key_dismisses(self):
60
- """Test that escape key dismisses the screen."""
61
- screen = ToolsScreen()
62
-
63
- # Create a mock key event
64
- class MockKeyEvent:
65
- key = "escape"
66
-
67
- with patch.object(screen, "dismiss") as mock_dismiss:
68
- screen.on_key(MockKeyEvent())
69
-
70
- mock_dismiss.assert_called_once()
71
-
72
- def test_non_escape_key_ignored(self):
73
- """Test that non-escape keys don't dismiss the screen."""
74
- screen = ToolsScreen()
75
-
76
- class MockKeyEvent:
77
- key = "enter"
78
-
79
- with patch.object(screen, "dismiss") as mock_dismiss:
80
- screen.on_key(MockKeyEvent())
81
-
82
- mock_dismiss.assert_not_called()