tunacode-cli 0.0.24__tar.gz → 0.0.25__tar.gz
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.
Potentially problematic release.
This version of tunacode-cli might be problematic. Click here for more details.
- {tunacode_cli-0.0.24/src/tunacode_cli.egg-info → tunacode_cli-0.0.25}/PKG-INFO +3 -2
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/README.md +2 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/pyproject.toml +1 -2
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/constants.py +1 -1
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/prompts/system.md +18 -5
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25/src/tunacode_cli.egg-info}/PKG-INFO +3 -2
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode_cli.egg-info/SOURCES.txt +0 -1
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode_cli.egg-info/requires.txt +0 -1
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_architect_integration.py +46 -22
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_architect_simple.py +37 -5
- tunacode_cli-0.0.25/tests/test_fast_glob_search.py +191 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_orchestrator_planning_visibility.py +15 -23
- tunacode_cli-0.0.25/tests/test_react_thoughts.py +149 -0
- tunacode_cli-0.0.24/src/tunacode/prompts/system.txt +0 -203
- tunacode_cli-0.0.24/tests/test_fast_glob_search.py +0 -111
- tunacode_cli-0.0.24/tests/test_react_thoughts.py +0 -92
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/CLAUDE.md +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/LICENSE +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/MANIFEST.in +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/TUNACODE.md +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/setup.cfg +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/setup.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/cli/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/cli/commands.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/cli/main.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/cli/repl.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/cli/textual_app.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/cli/textual_bridge.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/configuration/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/configuration/defaults.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/configuration/models.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/configuration/settings.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/context.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/agents/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/agents/main.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/agents/orchestrator.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/agents/planner_schema.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/agents/readonly.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/background/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/background/manager.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/llm/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/llm/planner.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/agent_setup.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/base.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/config_setup.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/coordinator.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/environment_setup.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/setup/git_safety_setup.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/state.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/core/tool_handler.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/exceptions.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/py.typed +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/services/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/services/mcp.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/setup.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/base.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/bash.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/grep.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/read_file.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/run_command.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/update_file.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/tools/write_file.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/types.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/completers.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/console.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/constants.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/decorators.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/input.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/keybindings.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/lexers.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/output.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/panels.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/prompt_manager.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/tool_ui.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/ui/validators.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/__init__.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/bm25.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/diff_utils.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/file_utils.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/import_cache.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/ripgrep.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/system.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/text_utils.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode/utils/user_configuration.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode_cli.egg-info/dependency_links.txt +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode_cli.egg-info/entry_points.txt +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/src/tunacode_cli.egg-info/top_level.txt +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_agent_initialization.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_background_manager.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_config_setup_async.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_file_reference_expansion.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_json_tool_parsing.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_orchestrator_file_references.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_orchestrator_import.py +0 -0
- {tunacode_cli-0.0.24 → tunacode_cli-0.0.25}/tests/test_update_command.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tunacode-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.25
|
|
4
4
|
Summary: Your agentic CLI developer.
|
|
5
5
|
Author-email: larock22 <noreply@github.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -30,7 +30,6 @@ Requires-Dist: black; extra == "dev"
|
|
|
30
30
|
Requires-Dist: flake8; extra == "dev"
|
|
31
31
|
Requires-Dist: isort; extra == "dev"
|
|
32
32
|
Requires-Dist: pytest; extra == "dev"
|
|
33
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
34
33
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
35
34
|
Requires-Dist: textual-dev; extra == "dev"
|
|
36
35
|
Dynamic: license-file
|
|
@@ -45,6 +44,8 @@ Dynamic: license-file
|
|
|
45
44
|
|
|
46
45
|
**Your AI-powered CLI coding assistant**
|
|
47
46
|
|
|
47
|
+

|
|
48
|
+
|
|
48
49
|
[Quick Start](#quick-start) • [Features](#features) • [Configuration](#configuration) • [Documentation](#documentation)
|
|
49
50
|
|
|
50
51
|
</div>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tunacode-cli"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.25"
|
|
8
8
|
description = "Your agentic CLI developer."
|
|
9
9
|
keywords = ["cli", "agent", "development", "automation"]
|
|
10
10
|
readme = "README.md"
|
|
@@ -42,7 +42,6 @@ dev = [
|
|
|
42
42
|
"flake8",
|
|
43
43
|
"isort",
|
|
44
44
|
"pytest",
|
|
45
|
-
"pytest-asyncio",
|
|
46
45
|
"pytest-cov",
|
|
47
46
|
"textual-dev",
|
|
48
47
|
]
|
|
@@ -14,17 +14,30 @@ You MUST follow these rules:
|
|
|
14
14
|
|
|
15
15
|
You HAVE the following tools available. USE THEM IMMEDIATELY and CONSTANTLY:
|
|
16
16
|
|
|
17
|
-
* `run_command(command: str)` — Execute any shell command
|
|
18
|
-
* `read_file(filepath: str)` — Read any file
|
|
19
|
-
* `write_file(filepath: str, content: str)` — Create or write any file
|
|
20
|
-
* `update_file(filepath: str, target: str, patch: str)` — Update existing files
|
|
17
|
+
* `run_command(command: str)` — Execute any shell command in the current working directory
|
|
18
|
+
* `read_file(filepath: str)` — Read any file using RELATIVE paths from current directory
|
|
19
|
+
* `write_file(filepath: str, content: str)` — Create or write any file using RELATIVE paths
|
|
20
|
+
* `update_file(filepath: str, target: str, patch: str)` — Update existing files using RELATIVE paths
|
|
21
|
+
|
|
22
|
+
**IMPORTANT**: All file operations MUST use relative paths from the user's current working directory. NEVER create files in /tmp or use absolute paths.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
\###Working Directory Rules###
|
|
27
|
+
|
|
28
|
+
**CRITICAL**: You MUST respect the user's current working directory:
|
|
29
|
+
- **ALWAYS** use relative paths (e.g., `src/main.py`, `./config.json`, `../lib/utils.js`)
|
|
30
|
+
- **NEVER** use absolute paths (e.g., `/tmp/file.txt`, `/home/user/file.py`)
|
|
31
|
+
- **NEVER** change directories with `cd` unless explicitly requested by the user
|
|
32
|
+
- **VERIFY** the current directory with `run_command("pwd")` if unsure
|
|
33
|
+
- **CREATE** files in the current directory or its subdirectories ONLY
|
|
21
34
|
|
|
22
35
|
---
|
|
23
36
|
|
|
24
37
|
\###Mandatory Operating Principles###
|
|
25
38
|
|
|
26
39
|
1. **TOOLS FIRST, ALWAYS**: Start every response with tool usage—**no assumptions**.
|
|
27
|
-
2. **USE
|
|
40
|
+
2. **USE RELATIVE PATHS**: Always work in the current directory. Use relative paths like `src/`, `cli/`, `core/`, `tools/`, etc. NEVER use absolute paths starting with `/`.
|
|
28
41
|
3. **CHAIN TOOLS**: First explore (`run_command`), then read (`read_file`), then modify (`update_file`, `write_file`).
|
|
29
42
|
4. **ACT IMMEDIATELY**: Don’t describe what to do—**just do it**.
|
|
30
43
|
5. **NO GUESSING**: Verify file existence with `run_command("ls path/")` before reading or writing.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tunacode-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.25
|
|
4
4
|
Summary: Your agentic CLI developer.
|
|
5
5
|
Author-email: larock22 <noreply@github.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -30,7 +30,6 @@ Requires-Dist: black; extra == "dev"
|
|
|
30
30
|
Requires-Dist: flake8; extra == "dev"
|
|
31
31
|
Requires-Dist: isort; extra == "dev"
|
|
32
32
|
Requires-Dist: pytest; extra == "dev"
|
|
33
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
34
33
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
35
34
|
Requires-Dist: textual-dev; extra == "dev"
|
|
36
35
|
Dynamic: license-file
|
|
@@ -45,6 +44,8 @@ Dynamic: license-file
|
|
|
45
44
|
|
|
46
45
|
**Your AI-powered CLI coding assistant**
|
|
47
46
|
|
|
47
|
+

|
|
48
|
+
|
|
48
49
|
[Quick Start](#quick-start) • [Features](#features) • [Configuration](#configuration) • [Documentation](#documentation)
|
|
49
50
|
|
|
50
51
|
</div>
|
|
@@ -42,7 +42,6 @@ src/tunacode/core/setup/coordinator.py
|
|
|
42
42
|
src/tunacode/core/setup/environment_setup.py
|
|
43
43
|
src/tunacode/core/setup/git_safety_setup.py
|
|
44
44
|
src/tunacode/prompts/system.md
|
|
45
|
-
src/tunacode/prompts/system.txt
|
|
46
45
|
src/tunacode/services/__init__.py
|
|
47
46
|
src/tunacode/services/mcp.py
|
|
48
47
|
src/tunacode/tools/__init__.py
|
|
@@ -4,21 +4,20 @@
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import sys
|
|
6
6
|
import os
|
|
7
|
-
import pytest
|
|
8
7
|
|
|
9
8
|
# Add src to path
|
|
10
9
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../src'))
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
@pytest.mark.asyncio
|
|
14
12
|
async def test_orchestrator_planning():
|
|
15
13
|
"""Test that orchestrator actually creates and shows a plan."""
|
|
14
|
+
print("\n[TEST] Testing orchestrator planning output...")
|
|
15
|
+
|
|
16
16
|
try:
|
|
17
17
|
from tunacode.core.agents.orchestrator import OrchestratorAgent
|
|
18
18
|
from tunacode.core.state import StateManager
|
|
19
19
|
from tunacode.types import ModelName
|
|
20
|
-
from unittest.mock import patch, MagicMock
|
|
21
|
-
from tunacode.core.agents.planner_schema import Task
|
|
20
|
+
from unittest.mock import patch, MagicMock
|
|
22
21
|
|
|
23
22
|
# Create state manager
|
|
24
23
|
state = StateManager()
|
|
@@ -33,10 +32,10 @@ async def test_orchestrator_planning():
|
|
|
33
32
|
# Create orchestrator
|
|
34
33
|
orchestrator = OrchestratorAgent(state)
|
|
35
34
|
|
|
36
|
-
#
|
|
35
|
+
# Mock the LLM to return a simple plan
|
|
37
36
|
mock_tasks = [
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
MagicMock(id=1, description="Read the file", mutate=False),
|
|
38
|
+
MagicMock(id=2, description="Update the code", mutate=True)
|
|
40
39
|
]
|
|
41
40
|
|
|
42
41
|
# Capture console output
|
|
@@ -46,33 +45,35 @@ async def test_orchestrator_planning():
|
|
|
46
45
|
if args:
|
|
47
46
|
outputs.append(str(args[0]))
|
|
48
47
|
|
|
49
|
-
# Mock the Agent class to avoid API key requirement
|
|
50
|
-
mock_agent_instance = MagicMock()
|
|
51
|
-
mock_agent_instance.run = AsyncMock(return_value=MagicMock(data=mock_tasks))
|
|
52
|
-
|
|
53
48
|
with patch('rich.console.Console.print', side_effect=capture_print):
|
|
54
|
-
|
|
55
|
-
with patch('tunacode.core.agents.main.get_agent_tool', return_value=(MagicMock(return_value=mock_agent_instance), None)):
|
|
49
|
+
with patch('tunacode.core.llm.planner.make_plan', return_value=mock_tasks):
|
|
56
50
|
# Mock the agent execution
|
|
57
51
|
mock_run = MagicMock()
|
|
58
52
|
mock_run.result = MagicMock(output="Task completed")
|
|
59
53
|
|
|
60
|
-
with patch.object(orchestrator, '_run_sub_task',
|
|
54
|
+
with patch.object(orchestrator, '_run_sub_task', return_value=mock_run):
|
|
61
55
|
# Run orchestrator
|
|
62
56
|
results = await orchestrator.run("Test request")
|
|
63
57
|
|
|
64
58
|
# Check outputs
|
|
65
|
-
assert any("Orchestrator Mode" in out for out in outputs), "Missing orchestrator start message"
|
|
59
|
+
assert any("[TARGET] Orchestrator Mode" in out for out in outputs), "Missing orchestrator start message"
|
|
66
60
|
assert any("Executing plan" in out for out in outputs), "Missing execution message"
|
|
67
|
-
assert any("Orchestrator completed" in out for out in outputs), "Missing completion message"
|
|
61
|
+
assert any("[SUCCESS] Orchestrator completed" in out for out in outputs), "Missing completion message"
|
|
62
|
+
|
|
63
|
+
print("[PASS] Orchestrator displayed planning messages")
|
|
64
|
+
print("[PASS] Orchestrator completed successfully")
|
|
65
|
+
|
|
66
|
+
print("[SUCCESS] Orchestrator planning test PASSED!")
|
|
68
67
|
|
|
69
68
|
except ImportError as e:
|
|
70
|
-
|
|
69
|
+
print(f"[WARNING] Skipping integration test due to missing dependencies: {e}")
|
|
70
|
+
print("[SUCCESS] Integration test skipped (dependencies not available)")
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
@pytest.mark.asyncio
|
|
74
73
|
async def test_architect_mode_check():
|
|
75
74
|
"""Test the actual check in repl.py for architect mode."""
|
|
75
|
+
print("\n[TEST] Testing architect mode check in process_request...")
|
|
76
|
+
|
|
76
77
|
# Simulate the check from repl.py
|
|
77
78
|
class MockSession:
|
|
78
79
|
architect_mode = False
|
|
@@ -84,13 +85,36 @@ async def test_architect_mode_check():
|
|
|
84
85
|
|
|
85
86
|
# Test the actual condition used in repl.py
|
|
86
87
|
if getattr(state.session, 'architect_mode', False):
|
|
87
|
-
|
|
88
|
+
print("[FAIL] Should not use orchestrator when architect_mode is False")
|
|
89
|
+
assert False
|
|
90
|
+
else:
|
|
91
|
+
print("[PASS] Correctly skipping orchestrator when architect_mode is False")
|
|
88
92
|
|
|
89
93
|
# Enable architect mode
|
|
90
94
|
state.session.architect_mode = True
|
|
91
95
|
|
|
92
|
-
if
|
|
93
|
-
|
|
96
|
+
if getattr(state.session, 'architect_mode', False):
|
|
97
|
+
print("[PASS] Correctly using orchestrator when architect_mode is True")
|
|
98
|
+
else:
|
|
99
|
+
print("[FAIL] Should use orchestrator when architect_mode is True")
|
|
100
|
+
assert False
|
|
101
|
+
|
|
102
|
+
print("[SUCCESS] Architect mode check test PASSED!")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def main():
|
|
106
|
+
"""Run integration tests."""
|
|
107
|
+
print("=" * 60)
|
|
108
|
+
print("ARCHITECT MODE INTEGRATION TESTS")
|
|
109
|
+
print("=" * 60)
|
|
110
|
+
|
|
111
|
+
await test_architect_mode_check()
|
|
112
|
+
await test_orchestrator_planning()
|
|
113
|
+
|
|
114
|
+
print("\n" + "=" * 60)
|
|
115
|
+
print("[SUCCESS] ALL INTEGRATION TESTS COMPLETED!")
|
|
116
|
+
print("=" * 60)
|
|
94
117
|
|
|
95
118
|
|
|
96
|
-
|
|
119
|
+
if __name__ == "__main__":
|
|
120
|
+
asyncio.run(main())
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import sys
|
|
6
6
|
import os
|
|
7
|
-
import pytest
|
|
8
7
|
|
|
9
8
|
# Add src to path
|
|
10
9
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../src'))
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
@pytest.mark.asyncio
|
|
14
12
|
async def test_architect_toggle():
|
|
15
13
|
"""Test that architect mode can be toggled."""
|
|
14
|
+
print("\n[TEST] Testing architect mode toggle...")
|
|
15
|
+
|
|
16
16
|
# Create a minimal state object
|
|
17
17
|
class MockSession:
|
|
18
18
|
def __init__(self):
|
|
@@ -26,19 +26,25 @@ async def test_architect_toggle():
|
|
|
26
26
|
|
|
27
27
|
# Test initial state
|
|
28
28
|
assert not hasattr(state.session, 'architect_mode') or state.session.architect_mode is False
|
|
29
|
+
print("[PASS] Initial state: architect_mode is OFF")
|
|
29
30
|
|
|
30
31
|
# Toggle ON
|
|
31
32
|
state.session.architect_mode = not getattr(state.session, 'architect_mode', False)
|
|
32
33
|
assert state.session.architect_mode is True
|
|
34
|
+
print("[PASS] After toggle: architect_mode is ON")
|
|
33
35
|
|
|
34
36
|
# Toggle OFF
|
|
35
37
|
state.session.architect_mode = not state.session.architect_mode
|
|
36
38
|
assert state.session.architect_mode is False
|
|
39
|
+
print("[PASS] After second toggle: architect_mode is OFF")
|
|
40
|
+
|
|
41
|
+
print("[SUCCESS] Architect toggle test PASSED!")
|
|
37
42
|
|
|
38
43
|
|
|
39
|
-
@pytest.mark.asyncio
|
|
40
44
|
async def test_orchestrator_routing():
|
|
41
45
|
"""Test that process_request routes to orchestrator when architect_mode is ON."""
|
|
46
|
+
print("\n[TEST] Testing orchestrator routing...")
|
|
47
|
+
|
|
42
48
|
# Test the routing logic without actual imports
|
|
43
49
|
class MockSession:
|
|
44
50
|
def __init__(self):
|
|
@@ -53,21 +59,28 @@ async def test_orchestrator_routing():
|
|
|
53
59
|
|
|
54
60
|
# Test routing decision
|
|
55
61
|
if getattr(state.session, 'architect_mode', False):
|
|
62
|
+
print("[PASS] Architect mode ON - Would use orchestrator")
|
|
56
63
|
assert state.session.architect_mode is True
|
|
57
64
|
else:
|
|
65
|
+
print("[FAIL] Architect mode OFF - Would use normal agent")
|
|
58
66
|
assert False, "Should have used orchestrator"
|
|
59
67
|
|
|
60
68
|
# Test with architect_mode OFF
|
|
61
69
|
state.session.architect_mode = False
|
|
62
70
|
if getattr(state.session, 'architect_mode', False):
|
|
71
|
+
print("[FAIL] Architect mode ON - Would use orchestrator")
|
|
63
72
|
assert False, "Should have used normal agent"
|
|
64
73
|
else:
|
|
74
|
+
print("[PASS] Architect mode OFF - Would use normal agent")
|
|
65
75
|
assert state.session.architect_mode is False
|
|
76
|
+
|
|
77
|
+
print("[SUCCESS] Orchestrator routing test PASSED!")
|
|
66
78
|
|
|
67
79
|
|
|
68
|
-
@pytest.mark.asyncio
|
|
69
80
|
async def test_command_parsing():
|
|
70
81
|
"""Test architect command argument parsing."""
|
|
82
|
+
print("\n[TEST] Testing architect command parsing...")
|
|
83
|
+
|
|
71
84
|
# Test various command inputs
|
|
72
85
|
test_cases = [
|
|
73
86
|
(["on"], True, "Explicit ON"),
|
|
@@ -88,6 +101,25 @@ async def test_command_parsing():
|
|
|
88
101
|
result = None
|
|
89
102
|
|
|
90
103
|
assert result == expected, f"Failed for {desc}"
|
|
104
|
+
print(f"[PASS] {desc}: correctly parsed as {expected}")
|
|
105
|
+
|
|
106
|
+
print("[SUCCESS] Command parsing test PASSED!")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
async def main():
|
|
110
|
+
"""Run all tests."""
|
|
111
|
+
print("=" * 60)
|
|
112
|
+
print("ARCHITECT MODE TESTS")
|
|
113
|
+
print("=" * 60)
|
|
114
|
+
|
|
115
|
+
await test_architect_toggle()
|
|
116
|
+
await test_orchestrator_routing()
|
|
117
|
+
await test_command_parsing()
|
|
118
|
+
|
|
119
|
+
print("\n" + "=" * 60)
|
|
120
|
+
print("[SUCCESS] ALL TESTS PASSED!")
|
|
121
|
+
print("=" * 60)
|
|
91
122
|
|
|
92
123
|
|
|
93
|
-
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Simple test for fast-glob prefilter search functionality
|
|
4
|
+
"""
|
|
5
|
+
import asyncio
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
import tempfile
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
# Add src to path so we can import tunacode modules
|
|
12
|
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
|
13
|
+
|
|
14
|
+
def test_fast_glob_import():
|
|
15
|
+
"""Test that fast_glob function can be imported"""
|
|
16
|
+
try:
|
|
17
|
+
from tunacode.tools.grep import fast_glob
|
|
18
|
+
print("✓ fast_glob import successful")
|
|
19
|
+
return True
|
|
20
|
+
except ImportError as e:
|
|
21
|
+
print(f"✗ fast_glob import failed: {e}")
|
|
22
|
+
return False
|
|
23
|
+
|
|
24
|
+
def test_fast_glob_basic_functionality():
|
|
25
|
+
"""Test basic fast_glob functionality with real files"""
|
|
26
|
+
try:
|
|
27
|
+
from tunacode.tools.grep import fast_glob
|
|
28
|
+
|
|
29
|
+
# Use current directory which has Python files
|
|
30
|
+
root = Path(".")
|
|
31
|
+
|
|
32
|
+
# Test finding Python files
|
|
33
|
+
python_files = fast_glob(root, "*.py")
|
|
34
|
+
|
|
35
|
+
assert len(python_files) > 0, "Should find at least some Python files"
|
|
36
|
+
assert all(str(f).endswith('.py') for f in python_files), "All results should be .py files"
|
|
37
|
+
|
|
38
|
+
# Test specific pattern
|
|
39
|
+
test_files = fast_glob(root, "test_*.py")
|
|
40
|
+
assert len(test_files) >= 2, "Should find our test files" # At least test_react_thoughts.py and this file
|
|
41
|
+
|
|
42
|
+
print(f"✓ fast_glob found {len(python_files)} Python files and {len(test_files)} test files")
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
except Exception as e:
|
|
46
|
+
print(f"✗ fast_glob basic functionality test failed: {e}")
|
|
47
|
+
return False
|
|
48
|
+
|
|
49
|
+
def test_fast_glob_multiple_extensions():
|
|
50
|
+
"""Test fast_glob with multiple extensions pattern"""
|
|
51
|
+
try:
|
|
52
|
+
from tunacode.tools.grep import fast_glob
|
|
53
|
+
|
|
54
|
+
root = Path(".")
|
|
55
|
+
|
|
56
|
+
# Test multiple extensions pattern
|
|
57
|
+
code_files = fast_glob(root, "*.{py,md}")
|
|
58
|
+
|
|
59
|
+
assert len(code_files) > 0, "Should find Python and Markdown files"
|
|
60
|
+
|
|
61
|
+
py_files = [f for f in code_files if str(f).endswith('.py')]
|
|
62
|
+
md_files = [f for f in code_files if str(f).endswith('.md')]
|
|
63
|
+
|
|
64
|
+
assert len(py_files) > 0, "Should find some Python files"
|
|
65
|
+
assert len(md_files) > 0, "Should find some Markdown files"
|
|
66
|
+
|
|
67
|
+
print(f"✓ fast_glob multiple extensions: {len(py_files)} .py + {len(md_files)} .md = {len(code_files)} total")
|
|
68
|
+
return True
|
|
69
|
+
|
|
70
|
+
except Exception as e:
|
|
71
|
+
print(f"✗ fast_glob multiple extensions test failed: {e}")
|
|
72
|
+
return False
|
|
73
|
+
|
|
74
|
+
def test_parallel_grep_import():
|
|
75
|
+
"""Test that ParallelGrep class can be imported"""
|
|
76
|
+
try:
|
|
77
|
+
from tunacode.tools.grep import ParallelGrep, grep
|
|
78
|
+
print("✓ ParallelGrep and grep import successful")
|
|
79
|
+
return True
|
|
80
|
+
except ImportError as e:
|
|
81
|
+
print(f"✗ ParallelGrep import failed: {e}")
|
|
82
|
+
return False
|
|
83
|
+
|
|
84
|
+
def test_grep_search_integration():
|
|
85
|
+
"""Test that grep function works with fast-glob prefilter"""
|
|
86
|
+
try:
|
|
87
|
+
from tunacode.tools.grep import grep
|
|
88
|
+
|
|
89
|
+
# Test searching for a pattern we know exists
|
|
90
|
+
result = asyncio.run(grep("import", ".", include_files="*.py", max_results=5))
|
|
91
|
+
|
|
92
|
+
assert isinstance(result, str), "grep should return a string"
|
|
93
|
+
assert "Found" in result or "No matches" in result, "Result should indicate search status"
|
|
94
|
+
|
|
95
|
+
# If we found matches, check they contain our search pattern
|
|
96
|
+
if "Found" in result:
|
|
97
|
+
assert "Strategy:" in result, "Result should show which strategy was used"
|
|
98
|
+
assert "Candidates:" in result, "Result should show candidate count"
|
|
99
|
+
|
|
100
|
+
print("✓ grep search integration works")
|
|
101
|
+
return True
|
|
102
|
+
|
|
103
|
+
except Exception as e:
|
|
104
|
+
print(f"✗ grep search integration test failed: {e}")
|
|
105
|
+
return False
|
|
106
|
+
|
|
107
|
+
def test_smart_strategy_selection():
|
|
108
|
+
"""Test that smart strategy selection works based on candidate count"""
|
|
109
|
+
try:
|
|
110
|
+
from tunacode.tools.grep import ParallelGrep
|
|
111
|
+
|
|
112
|
+
# Create grep tool instance
|
|
113
|
+
grep_tool = ParallelGrep()
|
|
114
|
+
|
|
115
|
+
# Test with very specific pattern (should find few files)
|
|
116
|
+
result_few = asyncio.run(grep_tool._execute(
|
|
117
|
+
"test_", ".", include_files="test_*.py", search_type="smart", max_results=10
|
|
118
|
+
))
|
|
119
|
+
|
|
120
|
+
# Should use python strategy for small sets
|
|
121
|
+
assert "Strategy: python" in result_few, "Should use python strategy for small candidate sets"
|
|
122
|
+
|
|
123
|
+
# Test with broader pattern (more files)
|
|
124
|
+
result_many = asyncio.run(grep_tool._execute(
|
|
125
|
+
"import", ".", include_files="*.py", search_type="smart", max_results=10
|
|
126
|
+
))
|
|
127
|
+
|
|
128
|
+
# Should show some strategy was selected
|
|
129
|
+
assert "Strategy:" in result_many, "Should show strategy selection"
|
|
130
|
+
|
|
131
|
+
print("✓ Smart strategy selection works")
|
|
132
|
+
return True
|
|
133
|
+
|
|
134
|
+
except Exception as e:
|
|
135
|
+
print(f"✗ Smart strategy selection test failed: {e}")
|
|
136
|
+
return False
|
|
137
|
+
|
|
138
|
+
def test_bounded_results():
|
|
139
|
+
"""Test that results are properly bounded by MAX_GLOB"""
|
|
140
|
+
try:
|
|
141
|
+
from tunacode.tools.grep import fast_glob, MAX_GLOB
|
|
142
|
+
|
|
143
|
+
root = Path(".")
|
|
144
|
+
|
|
145
|
+
# Test that we don't exceed MAX_GLOB even with broad pattern
|
|
146
|
+
all_files = fast_glob(root, "*")
|
|
147
|
+
|
|
148
|
+
assert len(all_files) <= MAX_GLOB, f"Results should be bounded by MAX_GLOB ({MAX_GLOB})"
|
|
149
|
+
|
|
150
|
+
print(f"✓ Results properly bounded: {len(all_files)} <= {MAX_GLOB}")
|
|
151
|
+
return True
|
|
152
|
+
|
|
153
|
+
except Exception as e:
|
|
154
|
+
print(f"✗ Bounded results test failed: {e}")
|
|
155
|
+
return False
|
|
156
|
+
|
|
157
|
+
def main():
|
|
158
|
+
"""Run all fast-glob search tests"""
|
|
159
|
+
print("Testing fast-glob prefilter search functionality...")
|
|
160
|
+
print("=" * 60)
|
|
161
|
+
|
|
162
|
+
tests = [
|
|
163
|
+
test_fast_glob_import,
|
|
164
|
+
test_fast_glob_basic_functionality,
|
|
165
|
+
test_fast_glob_multiple_extensions,
|
|
166
|
+
test_parallel_grep_import,
|
|
167
|
+
test_grep_search_integration,
|
|
168
|
+
test_smart_strategy_selection,
|
|
169
|
+
test_bounded_results,
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
passed = 0
|
|
173
|
+
total = len(tests)
|
|
174
|
+
|
|
175
|
+
for test in tests:
|
|
176
|
+
if test():
|
|
177
|
+
passed += 1
|
|
178
|
+
print()
|
|
179
|
+
|
|
180
|
+
print("=" * 60)
|
|
181
|
+
print(f"Results: {passed}/{total} tests passed")
|
|
182
|
+
|
|
183
|
+
if passed == total:
|
|
184
|
+
print("🎉 All fast-glob search tests PASSED!")
|
|
185
|
+
return 0
|
|
186
|
+
else:
|
|
187
|
+
print("❌ Some tests FAILED!")
|
|
188
|
+
return 1
|
|
189
|
+
|
|
190
|
+
if __name__ == "__main__":
|
|
191
|
+
sys.exit(main())
|
|
@@ -4,18 +4,14 @@
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import sys
|
|
6
6
|
import os
|
|
7
|
-
import pytest
|
|
8
7
|
|
|
9
8
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../src'))
|
|
10
9
|
|
|
11
|
-
@pytest.mark.asyncio
|
|
12
10
|
async def test_planning_visibility():
|
|
13
11
|
"""Test that planning steps are visible in orchestrator output."""
|
|
14
12
|
from tunacode.core.agents.orchestrator import OrchestratorAgent
|
|
15
13
|
from tunacode.core.state import StateManager
|
|
16
14
|
from tunacode.types import ModelName
|
|
17
|
-
from unittest.mock import patch, MagicMock, AsyncMock
|
|
18
|
-
from tunacode.core.agents.planner_schema import Task
|
|
19
15
|
|
|
20
16
|
# Create state manager
|
|
21
17
|
state = StateManager()
|
|
@@ -41,24 +37,20 @@ async def test_planning_visibility():
|
|
|
41
37
|
Then create a new file called feature.py with a simple function.
|
|
42
38
|
"""
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Task(id=1, description="Read README.md", mutate=False),
|
|
47
|
-
Task(id=2, description="Create feature.py", mutate=True)
|
|
48
|
-
]
|
|
40
|
+
print("=== Testing Orchestrator Planning Visibility ===\n")
|
|
41
|
+
print(f"Request: {test_request.strip()}\n")
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
with patch('tunacode.core.agents.main.get_agent_tool', return_value=(MagicMock(return_value=mock_agent_instance), None)):
|
|
56
|
-
# Mock the agent execution
|
|
57
|
-
mock_run = MagicMock()
|
|
58
|
-
mock_run.result = MagicMock(output="Task completed")
|
|
43
|
+
try:
|
|
44
|
+
# Run the orchestrator
|
|
45
|
+
results = await orchestrator.run(test_request)
|
|
46
|
+
|
|
47
|
+
print(f"\n=== Orchestrator completed with {len(results)} results ===")
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
except Exception as e:
|
|
50
|
+
print(f"\nError during orchestration: {e}")
|
|
51
|
+
import traceback
|
|
52
|
+
traceback.print_exc()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
asyncio.run(test_planning_visibility())
|