devagent-cli 3.3.0__py3-none-any.whl → 3.7.5__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.
- devagent/__init__.py +1 -1
- devagent/app/agent.py +27 -9
- devagent/cli.py +10 -2
- devagent/tools/env_detector.py +44 -0
- devagent/tools/test_runner.py +22 -1
- devagent/utils/environment.py +129 -0
- devagent/utils/logger.py +2 -1
- devagent_cli-3.7.5.dist-info/METADATA +163 -0
- {devagent_cli-3.3.0.dist-info → devagent_cli-3.7.5.dist-info}/RECORD +13 -11
- devagent_cli-3.3.0.dist-info/METADATA +0 -479
- {devagent_cli-3.3.0.dist-info → devagent_cli-3.7.5.dist-info}/WHEEL +0 -0
- {devagent_cli-3.3.0.dist-info → devagent_cli-3.7.5.dist-info}/entry_points.txt +0 -0
- {devagent_cli-3.3.0.dist-info → devagent_cli-3.7.5.dist-info}/licenses/LICENSE +0 -0
- {devagent_cli-3.3.0.dist-info → devagent_cli-3.7.5.dist-info}/top_level.txt +0 -0
devagent/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "3.
|
|
1
|
+
__version__ = "3.4.1"
|
devagent/app/agent.py
CHANGED
|
@@ -21,6 +21,10 @@ import re
|
|
|
21
21
|
import os
|
|
22
22
|
import time
|
|
23
23
|
from typing import Any
|
|
24
|
+
from rich.console import Console
|
|
25
|
+
from rich.panel import Panel
|
|
26
|
+
|
|
27
|
+
console = Console()
|
|
24
28
|
|
|
25
29
|
from devagent.app.llm import query, query_with_context
|
|
26
30
|
from devagent.app.reviewer import review_code, revise_code
|
|
@@ -31,6 +35,7 @@ from devagent.app.memory import WorkingMemory, chunk_project, SemanticIndex
|
|
|
31
35
|
from devagent.tools.search import search_code
|
|
32
36
|
from devagent.tools.file_ops import read_file, write_file, list_files
|
|
33
37
|
from devagent.tools.file_map import get_file_map
|
|
38
|
+
from devagent.tools.env_detector import get_environment_info, repair_environment
|
|
34
39
|
from devagent.tools.test_runner import run_tests
|
|
35
40
|
from devagent.tools.linter import lint_code
|
|
36
41
|
from devagent.tools.git_tools import git_diff, git_status
|
|
@@ -60,6 +65,8 @@ Current step: {step}/{max_steps}
|
|
|
60
65
|
Decide the SINGLE next action. Choose ONE:
|
|
61
66
|
- list_files: <relative_path>
|
|
62
67
|
- get_file_map: <relative_path>
|
|
68
|
+
- get_environment_info: <relative_path>
|
|
69
|
+
- repair_environment: <package_name>
|
|
63
70
|
- search_code: <keyword>
|
|
64
71
|
- semantic_search: <query>
|
|
65
72
|
- read_file: <relative_path>[:L<start>-<end>]
|
|
@@ -70,11 +77,13 @@ Decide the SINGLE next action. Choose ONE:
|
|
|
70
77
|
- git_diff
|
|
71
78
|
|
|
72
79
|
STRATEGY:
|
|
73
|
-
1. START by using '
|
|
74
|
-
2.
|
|
75
|
-
3. USE '
|
|
76
|
-
4.
|
|
77
|
-
5.
|
|
80
|
+
1. START by using 'get_environment_info' to understand the project runtime.
|
|
81
|
+
2. If tests fail with ModuleNotFoundError, use 'repair_environment' to fix the environment.
|
|
82
|
+
3. USE 'run_tests' to identify logic failures.
|
|
83
|
+
4. For large files (>50 lines), use 'get_file_map' FIRST to see the structure.
|
|
84
|
+
5. USE 'read_file' with line ranges (e.g. file.py:L10-L50) for targeted reading.
|
|
85
|
+
6. USE 'surgical_patch' for logic fixes. Format: file.py | <SEARCH> | <REPLACE>
|
|
86
|
+
7. ALWAYS use full relative paths.
|
|
78
87
|
|
|
79
88
|
Reply in this EXACT format (two lines only):
|
|
80
89
|
THOUGHT: <your reasoning>
|
|
@@ -96,7 +105,7 @@ Fix the bug. Output ONLY the COMPLETE Python code.
|
|
|
96
105
|
"""
|
|
97
106
|
|
|
98
107
|
EXTRACT_ACTION_PATTERN = re.compile(
|
|
99
|
-
r"ACTION:\s*(get_file_map|search_code|semantic_search|read_file|write_file|surgical_patch|run_tests|lint_code|list_files|git_diff)\s*:?\s*(.*)",
|
|
108
|
+
r"ACTION:\s*(get_file_map|get_environment_info|repair_environment|search_code|semantic_search|read_file|write_file|surgical_patch|run_tests|lint_code|list_files|git_diff)\s*:?\s*(.*)",
|
|
100
109
|
re.IGNORECASE,
|
|
101
110
|
)
|
|
102
111
|
|
|
@@ -268,8 +277,10 @@ class Agent:
|
|
|
268
277
|
|
|
269
278
|
# STEP 2 — EXECUTE ACTION → OBSERVATION
|
|
270
279
|
observation = self._execute_action(action_name, action_arg)
|
|
271
|
-
self.state.last_observation = observation
|
|
272
|
-
|
|
280
|
+
self.state.last_observation = observation # Store and display result
|
|
281
|
+
obs_text = str(observation) if isinstance(observation, dict) else observation
|
|
282
|
+
self.state.observations.append(obs_text[:2000])
|
|
283
|
+
console.print(Panel(obs_text[:1000], title="Observation", border_style="green"))
|
|
273
284
|
|
|
274
285
|
self.state.explanations.append({
|
|
275
286
|
"type": "action",
|
|
@@ -329,10 +340,11 @@ class Agent:
|
|
|
329
340
|
)
|
|
330
341
|
|
|
331
342
|
# Store in history
|
|
343
|
+
obs_text = str(observation) if isinstance(observation, dict) else observation
|
|
332
344
|
self.state.history.append({
|
|
333
345
|
"step": step, "thought": thought,
|
|
334
346
|
"action": action_name, "action_arg": action_arg,
|
|
335
|
-
"observation":
|
|
347
|
+
"observation": obs_text[:500],
|
|
336
348
|
"review": review_text, "test_status": status,
|
|
337
349
|
})
|
|
338
350
|
|
|
@@ -463,6 +475,12 @@ class Agent:
|
|
|
463
475
|
elif action_name == "get_file_map":
|
|
464
476
|
return get_file_map(action_arg, root)
|
|
465
477
|
|
|
478
|
+
elif action_name == "get_environment_info":
|
|
479
|
+
return get_environment_info(root)
|
|
480
|
+
|
|
481
|
+
elif action_name == "repair_environment":
|
|
482
|
+
return repair_environment(action_arg, root)
|
|
483
|
+
|
|
466
484
|
elif action_name == "semantic_search":
|
|
467
485
|
result = semantic_search(action_arg, root)
|
|
468
486
|
# Try to extract file from results
|
devagent/cli.py
CHANGED
|
@@ -142,7 +142,7 @@ def cmd_run(args):
|
|
|
142
142
|
if final_state.confidence_reasons:
|
|
143
143
|
console.print("\n[bold]Confidence Breakdown:[/bold]")
|
|
144
144
|
for reason in final_state.confidence_reasons:
|
|
145
|
-
console.print(f" [green]
|
|
145
|
+
console.print(f" [green]OK[/green] {reason}")
|
|
146
146
|
|
|
147
147
|
# Explain Mode
|
|
148
148
|
if config.explain and final_state.explanations:
|
|
@@ -187,7 +187,7 @@ def cmd_run(args):
|
|
|
187
187
|
result = sandbox.apply_to_project()
|
|
188
188
|
if result["applied"]:
|
|
189
189
|
for f in result["applied"]:
|
|
190
|
-
console.print(f" [green]
|
|
190
|
+
console.print(f" [green]OK[/green] {f}")
|
|
191
191
|
sandbox.destroy()
|
|
192
192
|
|
|
193
193
|
# Git operations
|
|
@@ -246,6 +246,14 @@ def cmd_doctor(args):
|
|
|
246
246
|
except:
|
|
247
247
|
checks.append(("[yellow]WARN[/yellow]", "FAISS not found (keyword search fallback active)"))
|
|
248
248
|
|
|
249
|
+
# Venv Check
|
|
250
|
+
try:
|
|
251
|
+
import venv
|
|
252
|
+
import ensurepip
|
|
253
|
+
checks.append(("[green]OK[/green]", "Virtual environment runtime (venv + pip) available"))
|
|
254
|
+
except:
|
|
255
|
+
checks.append(("[red]FAIL[/red]", "venv or ensurepip missing (required for Environment Isolation)"))
|
|
256
|
+
|
|
249
257
|
for status, msg in checks:
|
|
250
258
|
console.print(f" {status} {msg}")
|
|
251
259
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from devagent.utils.environment import EnvironmentDetector
|
|
3
|
+
|
|
4
|
+
def get_environment_info(project_path: str):
|
|
5
|
+
"""
|
|
6
|
+
Detects the project environment (pip, poetry, etc.) and lists dependencies.
|
|
7
|
+
Useful for understanding what the project needs to run.
|
|
8
|
+
"""
|
|
9
|
+
project_path = os.path.abspath(project_path)
|
|
10
|
+
detector = EnvironmentDetector(project_path)
|
|
11
|
+
info = detector.detect()
|
|
12
|
+
|
|
13
|
+
# Auto-setup venv if it's the first run or fingerprint missing install_success
|
|
14
|
+
fingerprint = detector.load_fingerprint(project_path)
|
|
15
|
+
if not fingerprint or not fingerprint.get("install_success"):
|
|
16
|
+
detector.setup_isolated_env()
|
|
17
|
+
info = detector.detect() # Refresh info
|
|
18
|
+
|
|
19
|
+
# Save fingerprint for observability
|
|
20
|
+
detector.save_fingerprint(info)
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
"status": "success",
|
|
24
|
+
"environment": {
|
|
25
|
+
"type": info.type,
|
|
26
|
+
"markers_found": info.markers,
|
|
27
|
+
"dependency_count": len(info.dependencies),
|
|
28
|
+
"dependencies": info.dependencies[:20] # Limit output
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def repair_environment(package_name: str, project_path: str):
|
|
33
|
+
"""
|
|
34
|
+
Attempts to install a missing package into the project environment.
|
|
35
|
+
Use this if you see ModuleNotFoundError or missing dependency errors.
|
|
36
|
+
"""
|
|
37
|
+
project_path = os.path.abspath(project_path)
|
|
38
|
+
detector = EnvironmentDetector(project_path)
|
|
39
|
+
success = detector.repair_dependencies(package_name)
|
|
40
|
+
|
|
41
|
+
if success:
|
|
42
|
+
return {"status": "success", "message": f"Successfully installed {package_name}"}
|
|
43
|
+
else:
|
|
44
|
+
return {"status": "error", "message": f"Failed to install {package_name}"}
|
devagent/tools/test_runner.py
CHANGED
|
@@ -45,7 +45,28 @@ def run_tests(project_root: str = ".", test_path: str = "") -> tuple[int, str]:
|
|
|
45
45
|
tf.write(config_content)
|
|
46
46
|
temp_config = tf.name
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
# ENVIRONMENT AWARENESS: Use venv python if available
|
|
49
|
+
python_exe = "python"
|
|
50
|
+
fingerprint_path = os.path.join(project_root, ".devagent_env.json")
|
|
51
|
+
if os.path.exists(fingerprint_path):
|
|
52
|
+
try:
|
|
53
|
+
import json
|
|
54
|
+
with open(fingerprint_path, 'r') as f:
|
|
55
|
+
data = json.load(f)
|
|
56
|
+
# Look for a valid python exe in .tmp_envs
|
|
57
|
+
env_path = os.path.join(project_root, ".tmp_envs", "validation_env")
|
|
58
|
+
if not os.path.exists(env_path):
|
|
59
|
+
# Fallback to test_env if that's what we used in the test
|
|
60
|
+
env_path = os.path.join(project_root, ".tmp_envs", "test_env")
|
|
61
|
+
|
|
62
|
+
v_exe = os.path.join(env_path, "Scripts", "python.exe") if os.name == "nt" else os.path.join(env_path, "bin", "python")
|
|
63
|
+
if os.path.exists(v_exe):
|
|
64
|
+
python_exe = v_exe
|
|
65
|
+
print(f" [ENV] Using isolated runtime: {python_exe}")
|
|
66
|
+
except:
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
cmd = [python_exe, "-m", "pytest", "-v", "--tb=short", "-c", temp_config]
|
|
49
70
|
if test_path:
|
|
50
71
|
cmd.append(test_path)
|
|
51
72
|
else:
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
from dataclasses import dataclass, field, asdict
|
|
4
|
+
from typing import List, Optional, Dict
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class EnvironmentInfo:
|
|
8
|
+
type: str = "unknown" # pip, poetry, conda, etc.
|
|
9
|
+
python_version: str = "unknown"
|
|
10
|
+
dependencies: List[str] = field(default_factory=list)
|
|
11
|
+
markers: List[str] = field(default_factory=list)
|
|
12
|
+
install_success: bool = False
|
|
13
|
+
last_fingerprint: Optional[float] = None
|
|
14
|
+
failures: List[str] = field(default_factory=list)
|
|
15
|
+
|
|
16
|
+
class EnvironmentDetector:
|
|
17
|
+
def __init__(self, project_path: str):
|
|
18
|
+
self.project_path = os.path.abspath(project_path)
|
|
19
|
+
self.markers = {
|
|
20
|
+
"requirements.txt": "pip",
|
|
21
|
+
"pyproject.toml": "modern/poetry/flit",
|
|
22
|
+
"poetry.lock": "poetry",
|
|
23
|
+
"Pipfile": "pipenv",
|
|
24
|
+
"environment.yml": "conda",
|
|
25
|
+
"setup.py": "setuptools"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def detect(self) -> EnvironmentInfo:
|
|
29
|
+
info = EnvironmentInfo()
|
|
30
|
+
found_markers = []
|
|
31
|
+
|
|
32
|
+
for marker, env_type in self.markers.items():
|
|
33
|
+
marker_path = os.path.join(self.project_path, marker)
|
|
34
|
+
if os.path.exists(marker_path):
|
|
35
|
+
found_markers.append(marker)
|
|
36
|
+
# Primary type detection (prioritize modern tools)
|
|
37
|
+
if info.type == "unknown" or env_type in ["poetry", "modern/poetry/flit"]:
|
|
38
|
+
info.type = env_type
|
|
39
|
+
|
|
40
|
+
info.markers = found_markers
|
|
41
|
+
|
|
42
|
+
# Try to parse dependencies from common files
|
|
43
|
+
if "requirements.txt" in found_markers:
|
|
44
|
+
info.dependencies.extend(self._parse_requirements())
|
|
45
|
+
|
|
46
|
+
return info
|
|
47
|
+
|
|
48
|
+
def _parse_requirements(self) -> List[str]:
|
|
49
|
+
req_path = os.path.join(self.project_path, "requirements.txt")
|
|
50
|
+
deps = []
|
|
51
|
+
try:
|
|
52
|
+
with open(req_path, 'r') as f:
|
|
53
|
+
for line in f:
|
|
54
|
+
line = line.strip()
|
|
55
|
+
if line and not line.startswith("#"):
|
|
56
|
+
deps.append(line)
|
|
57
|
+
except Exception:
|
|
58
|
+
pass
|
|
59
|
+
return deps
|
|
60
|
+
|
|
61
|
+
def setup_isolated_env(self, env_name: str = "validation_env") -> str:
|
|
62
|
+
"""Creates a venv and installs dependencies."""
|
|
63
|
+
env_path = os.path.join(self.project_path, ".tmp_envs", env_name)
|
|
64
|
+
python_exe = os.path.join(env_path, "Scripts", "python.exe") if os.name == "nt" else os.path.join(env_path, "bin", "python")
|
|
65
|
+
|
|
66
|
+
if os.path.exists(python_exe):
|
|
67
|
+
print(f"[ENV] Found existing virtual environment at {env_path}")
|
|
68
|
+
return python_exe
|
|
69
|
+
|
|
70
|
+
os.makedirs(os.path.dirname(env_path), exist_ok=True)
|
|
71
|
+
|
|
72
|
+
import venv
|
|
73
|
+
import subprocess
|
|
74
|
+
|
|
75
|
+
print(f"[ENV] Creating virtual environment at {env_path}...")
|
|
76
|
+
venv.create(env_path, with_pip=True)
|
|
77
|
+
|
|
78
|
+
info = self.detect()
|
|
79
|
+
|
|
80
|
+
# Install dependencies
|
|
81
|
+
if info.type == "pip":
|
|
82
|
+
req_path = os.path.join(self.project_path, "requirements.txt")
|
|
83
|
+
print(f"[ENV] Installing dependencies from {req_path}...")
|
|
84
|
+
try:
|
|
85
|
+
subprocess.check_call([python_exe, "-m", "pip", "install", "-r", req_path])
|
|
86
|
+
info.install_success = True
|
|
87
|
+
except subprocess.CalledProcessError as e:
|
|
88
|
+
info.failures.append(f"Install failed: {str(e)}")
|
|
89
|
+
info.install_success = False
|
|
90
|
+
|
|
91
|
+
# Validate installation
|
|
92
|
+
try:
|
|
93
|
+
subprocess.check_call([python_exe, "-m", "pip", "check"])
|
|
94
|
+
print("[ENV] Runtime health check passed.")
|
|
95
|
+
except subprocess.CalledProcessError:
|
|
96
|
+
print("[ENV] Runtime health check found conflicts.")
|
|
97
|
+
info.failures.append("Dependency conflicts detected.")
|
|
98
|
+
|
|
99
|
+
self.save_fingerprint(info)
|
|
100
|
+
return python_exe
|
|
101
|
+
|
|
102
|
+
def repair_dependencies(self, missing_package: str, env_name: str = "validation_env") -> bool:
|
|
103
|
+
"""Attempts to install a missing package into the venv."""
|
|
104
|
+
env_path = os.path.join(self.project_path, ".tmp_envs", env_name)
|
|
105
|
+
python_exe = os.path.join(env_path, "Scripts", "python.exe") if os.name == "nt" else os.path.join(env_path, "bin", "python")
|
|
106
|
+
|
|
107
|
+
if not os.path.exists(python_exe):
|
|
108
|
+
return False
|
|
109
|
+
|
|
110
|
+
import subprocess
|
|
111
|
+
print(f"[ENV] Repairing environment: Installing missing package '{missing_package}'...")
|
|
112
|
+
try:
|
|
113
|
+
subprocess.check_call([python_exe, "-m", "pip", "install", missing_package])
|
|
114
|
+
return True
|
|
115
|
+
except subprocess.CalledProcessError:
|
|
116
|
+
return False
|
|
117
|
+
|
|
118
|
+
def save_fingerprint(self, info: EnvironmentInfo):
|
|
119
|
+
fingerprint_path = os.path.join(self.project_path, ".devagent_env.json")
|
|
120
|
+
with open(fingerprint_path, 'w') as f:
|
|
121
|
+
json.dump(asdict(info), f, indent=2)
|
|
122
|
+
|
|
123
|
+
@staticmethod
|
|
124
|
+
def load_fingerprint(project_path: str) -> Optional[Dict]:
|
|
125
|
+
fingerprint_path = os.path.join(project_path, ".devagent_env.json")
|
|
126
|
+
if os.path.exists(fingerprint_path):
|
|
127
|
+
with open(fingerprint_path, 'r') as f:
|
|
128
|
+
return json.load(f)
|
|
129
|
+
return None
|
devagent/utils/logger.py
CHANGED
|
@@ -38,12 +38,13 @@ class AgentLogger:
|
|
|
38
38
|
patch_summary: str = "",
|
|
39
39
|
) -> None:
|
|
40
40
|
"""Log a complete agent iteration step."""
|
|
41
|
+
obs_text = str(observation) if isinstance(observation, dict) else observation
|
|
41
42
|
entry = {
|
|
42
43
|
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
43
44
|
"step": step,
|
|
44
45
|
"thought": thought,
|
|
45
46
|
"action": action,
|
|
46
|
-
"observation":
|
|
47
|
+
"observation": obs_text[:2000],
|
|
47
48
|
"review": review,
|
|
48
49
|
"test_result": test_result[:2000],
|
|
49
50
|
"latency": f"{latency:.2f}s" if latency else "",
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devagent-cli
|
|
3
|
+
Version: 3.7.5
|
|
4
|
+
Summary: A local autonomous coding agent CLI powered by Ollama.
|
|
5
|
+
Author: Vedant Jadhav
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: ai,agent,coding,ollama,local,devagent,devagent-cli
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Interpreters
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: rich
|
|
17
|
+
Requires-Dist: pytest
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: ollama
|
|
20
|
+
Requires-Dist: faiss-cpu
|
|
21
|
+
Provides-Extra: semantic
|
|
22
|
+
Requires-Dist: sentence-transformers; extra == "semantic"
|
|
23
|
+
Provides-Extra: lint
|
|
24
|
+
Requires-Dist: flake8; extra == "lint"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# 🧠 DevAgent
|
|
28
|
+
### Execution-Grounded Orchestration for Autonomous Local Coding.
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
[**🌐 Live Site**](https://devagent-cli.vercel.app/) • [**📦 PyPI**](https://pypi.org/project/devagent-cli/) • [**📜 Docs**](https://devagent-cli.vercel.app/docs)
|
|
33
|
+
|
|
34
|
+
[](https://badge.fury.io/py/devagent-cli)
|
|
35
|
+
[](LICENSE)
|
|
36
|
+
[](https://ollama.ai)
|
|
37
|
+
[](https://devagent-cli.vercel.app/benchmarks)
|
|
38
|
+
|
|
39
|
+
**DevAgent** is a research-grade, local-first coding agent runtime designed to bridge the gap between LLM-generated logic and production-ready execution integrity.
|
|
40
|
+
|
|
41
|
+
[Quick Start](#-quick-start) • [Architecture](#-high-integrity-architecture) • [Safety & Containment](#-safety-first-containment) • [Benchmarks](#-empirical-validation) • [Troubleshooting](docs/troubleshooting.md)
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 🛡️ The Problem: The "LLM-Execution Gap"
|
|
48
|
+
Most autonomous coding agents fail because they operate in a vacuum. They generate code that looks correct but fails at runtime due to **environment drift**, **dependency conflicts**, or **invalid execution assumptions**.
|
|
49
|
+
|
|
50
|
+
DevAgent is **Execution-Grounded Orchestration**. It doesn't just guess code; it manages the entire lifecycle of a fix:
|
|
51
|
+
1. **Discovery**: Scans and maps the environment.
|
|
52
|
+
2. **Isolation**: Provisions a clean, sandboxed virtual environment.
|
|
53
|
+
3. **Repair**: Autonomously resolves missing dependencies.
|
|
54
|
+
4. **Validation**: Verifies patches against your actual test suite.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🏗️ High-Integrity Architecture
|
|
59
|
+
DevAgent v3.4.1 implements a multi-layer orchestration stack designed for reliability over hype.
|
|
60
|
+
|
|
61
|
+
```mermaid
|
|
62
|
+
graph TD
|
|
63
|
+
subgraph "Orchestration Layer"
|
|
64
|
+
CLI[DevAgent CLI] --> Planner[Task Planner]
|
|
65
|
+
Planner --> Retrieval[Hierarchical Retrieval: FAISS + Ripgrep]
|
|
66
|
+
Retrieval --> Agent[ReAct Agent: Thought/Action/Observation]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
subgraph "Execution Layer"
|
|
70
|
+
Agent --> Patch[Surgical Patch Engine: Line-Level Diffs]
|
|
71
|
+
Patch --> Reviewer[Self-Review Loop: APPROVED/REVISE]
|
|
72
|
+
Reviewer --> Runtime[Environment Runtime]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
subgraph "The Maturity Layer"
|
|
76
|
+
Runtime --> Discovery[Auto-Dependency Discovery]
|
|
77
|
+
Discovery --> Isolation[Venv Isolation: .tmp_envs]
|
|
78
|
+
Isolation --> Repair[Autonomous Repair Loop: repair_environment]
|
|
79
|
+
Repair --> Validation[Validation Engine: pytest]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
Validation -- Pass --> Apply[Apply to Root Repo]
|
|
83
|
+
Validation -- Fail --> Agent
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🚀 Quick Start
|
|
89
|
+
|
|
90
|
+
### 1. Installation
|
|
91
|
+
Install the CLI via PyPI. Ensure [Ollama](https://ollama.ai) is running locally.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install devagent-cli
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2. Verify Infrastructure
|
|
98
|
+
Check your local environment, connectivity, and dependency health.
|
|
99
|
+
```bash
|
|
100
|
+
devagent doctor
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3. Run Your First Task
|
|
104
|
+
Execute an autonomous fix on any repository.
|
|
105
|
+
```bash
|
|
106
|
+
devagent run --task "Implement input validation for the user login" --root ./my-project
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## ✨ Advanced Features
|
|
112
|
+
|
|
113
|
+
### 🔍 Hierarchical Retrieval
|
|
114
|
+
Instead of dumping your entire codebase into a context window, DevAgent uses a multi-tier search:
|
|
115
|
+
- **Global Map**: Scans the file structure to identify relevant modules.
|
|
116
|
+
- **Semantic Tier**: FAISS-powered vector search for conceptual matching.
|
|
117
|
+
- **Precision Tier**: Ripgrep for exact symbol/error discovery.
|
|
118
|
+
|
|
119
|
+
### 🏖️ Environment Isolation & Repair
|
|
120
|
+
DevAgent is the first local agent to treat the environment as a first-class citizen. It detects `requirements.txt` or `pyproject.toml`, creates an isolated `.tmp_envs/` runtime, and **autonomously installs missing packages** if it encounters a `ModuleNotFoundError`.
|
|
121
|
+
|
|
122
|
+
### 🩹 Surgical Patch Engine
|
|
123
|
+
Most agents ruin git history by rewriting entire files. DevAgent generates **line-level unified diffs**, applying only the necessary changes while preserving your code style, comments, and structure.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 🔐 Safety-First Containment
|
|
128
|
+
We built DevAgent for engineers who care about their host systems.
|
|
129
|
+
- **Dry-Run Mode**: Visualize every change before it happens.
|
|
130
|
+
- **Atomic Snapshots**: A safety restore point is created before every execution.
|
|
131
|
+
- **Instant Rollback**: Revert any agent intervention with `devagent rollback`.
|
|
132
|
+
- **Sandbox Isolation**: Every run is contained in a separate workspace until validation passes 100%.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📊 Empirical Validation
|
|
137
|
+
We don't fake our success rates. DevAgent is evaluated against a public, messy benchmark suite.
|
|
138
|
+
|
|
139
|
+
| Metric | Result | Infrastructure Status |
|
|
140
|
+
| :--- | :--- | :--- |
|
|
141
|
+
| **Dependency Repair** | 95% | ✅ Production Ready |
|
|
142
|
+
| **Unit Bugfixes** | 80% | ✅ Highly Reliable |
|
|
143
|
+
| **Refactoring** | 20% | 📈 Improving (Model Bounded) |
|
|
144
|
+
| **Isolation Safety** | 100% | ✅ Absolute Containment |
|
|
145
|
+
|
|
146
|
+
> **Full Report**: [v3.4.1 Benchmark Analysis](docs/benchmarks.md)
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🤝 Contributing
|
|
151
|
+
Built with a focus on **Systems Thinking**. PRs that improve orchestration reliability, environment detection, or patch precision are highly encouraged.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Clone and Install in Editable Mode
|
|
155
|
+
git clone https://github.com/VedantJadhav701/Developer-Code-Intelligence-Agent.git
|
|
156
|
+
pip install -e .
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
<div align="center">
|
|
162
|
+
**DevAgent — Local-First. Execution-Grounded. Infrastructure-Grade.**
|
|
163
|
+
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
devagent/__init__.py,sha256=
|
|
2
|
-
devagent/cli.py,sha256=
|
|
1
|
+
devagent/__init__.py,sha256=z3MJNttjzZJkd4Yv_Ut_X2qO_gIKi4TijrHVpefXuRM,22
|
|
2
|
+
devagent/cli.py,sha256=vsHu_m4R4nOC3lb5XH2jOjzYSMEjjdzMR1mm9C9wTAU,13477
|
|
3
3
|
devagent/app/__init__.py,sha256=UlL-q-GtCMY01wlpT1gOrfl350-vl0_0dt8qx9A3UoI,29
|
|
4
|
-
devagent/app/agent.py,sha256=
|
|
4
|
+
devagent/app/agent.py,sha256=Po7mMCjQdPKeaoioUjoFcn_jqv6bE3ppA-7EDS02n8M,30955
|
|
5
5
|
devagent/app/llm.py,sha256=XuDeVP9C_YCze4_qxdpdPL15Fm1FhpgEkFj_kuItjms,2543
|
|
6
6
|
devagent/app/memory.py,sha256=ePxbVHxBBxg2QmihO3hkSarsM30Gp3CbuooKovskdO0,10220
|
|
7
7
|
devagent/app/patcher.py,sha256=yS3kGPmVDZcTKq488FdHm_U2hhbKT72BuCZWkyBsgi8,2482
|
|
@@ -11,6 +11,7 @@ devagent/app/sandbox.py,sha256=p6n_6mszQRgMRhP1BoXzPzpbPUHZ7Tk85AYpnjng-No,4038
|
|
|
11
11
|
devagent/app/state.py,sha256=sacTu_iclkzcI_K65vfc1ClMN2DWbTgEa0Gy9qJs4y4,3694
|
|
12
12
|
devagent/tools/__init__.py,sha256=RoXs8BohORYsmAjCY6xFiahsoPF5IX1qVJqm3NlWYXM,36
|
|
13
13
|
devagent/tools/benchmark_runner.py,sha256=MbBp7pDWLhM8jTYu2Jem8cINjBRmv7CnFkwT-5rE9tA,5465
|
|
14
|
+
devagent/tools/env_detector.py,sha256=35xBqtiOtrYmJo96mkWFULXbBRJiI1qecWEFsg2v5ts,1646
|
|
14
15
|
devagent/tools/file_map.py,sha256=dQMr44qTZ03BEIYVI3_2AKYJZlGLQpw3IIPtRZiFdj0,852
|
|
15
16
|
devagent/tools/file_ops.py,sha256=Z6rjnxPw0Mc5YSuU_wsRusupC0C6C6cEHDaxsO3V1hU,2212
|
|
16
17
|
devagent/tools/git_tools.py,sha256=FJmnvhgCk1qiiYIKwZo8oPjWM87MWR2jm6q8NzZ4M7Q,2954
|
|
@@ -18,16 +19,17 @@ devagent/tools/linter.py,sha256=nkd8SPsf8l8zmpu5cBPsiYAokeAgrYfmXDSbNe2Je3A,1754
|
|
|
18
19
|
devagent/tools/search.py,sha256=2YM473uduEWWvW1dFfLF7umZ5cMhLJ8y0VbYDJttVRo,1700
|
|
19
20
|
devagent/tools/semantic_search.py,sha256=vSkzwJUlNZDfslCjVxmBdeWC7eSP-wDZSP4ED-c-ppU,1731
|
|
20
21
|
devagent/tools/surgical_patcher.py,sha256=Bew2JI1FV5UV0-t-RwQMaRFMkhFRVMtA6JpHXV4O_AM,1456
|
|
21
|
-
devagent/tools/test_runner.py,sha256=
|
|
22
|
+
devagent/tools/test_runner.py,sha256=ap2O3H8rGsxwQF50uG5pkdubPlh77jGCGEDzrjqz2Hs,5846
|
|
22
23
|
devagent/utils/__init__.py,sha256=6t2JSRrTLfbdRUDa3y53Mv2353JyBGlOj5h6QXgUx1U,29
|
|
23
24
|
devagent/utils/ast_utils.py,sha256=M9iDfXxpaVuBKp8AkXJCDgb-lbf5RMv7bLpB_cUzojY,2693
|
|
24
25
|
devagent/utils/config.py,sha256=Etdk7ekCjiE5u_3WFncKbU6fShsf3eRYEwCH8SfcSnE,4229
|
|
25
|
-
devagent/utils/
|
|
26
|
+
devagent/utils/environment.py,sha256=eFY-gCISedwSgUThORq7cq4jSSTt099MincUIMQ_etA,5142
|
|
27
|
+
devagent/utils/logger.py,sha256=KlGDsP8rpoRO3BBdKAFZCt59iI5PFgXI4GFUuNj07j0,3140
|
|
26
28
|
devagent/utils/metrics.py,sha256=q9i4xWx6vOXSSRhqz1IG3GK_ltqAOf32Q268kBHkpCA,4127
|
|
27
29
|
devagent/utils/safety.py,sha256=Bl4Z4IU3y1shi4J5Kg-VHXuytTx-q8rKBKSL8_8VoFI,3557
|
|
28
|
-
devagent_cli-3.
|
|
29
|
-
devagent_cli-3.
|
|
30
|
-
devagent_cli-3.
|
|
31
|
-
devagent_cli-3.
|
|
32
|
-
devagent_cli-3.
|
|
33
|
-
devagent_cli-3.
|
|
30
|
+
devagent_cli-3.7.5.dist-info/licenses/LICENSE,sha256=sA9mYj2jzeK1h0jjUs7vNvd3nXk0CwFBkuSWkPeViIs,1070
|
|
31
|
+
devagent_cli-3.7.5.dist-info/METADATA,sha256=vY5Xw8apMsGFTeIhy6MxsHyrc0vqrh1lIEKJMql24gY,6268
|
|
32
|
+
devagent_cli-3.7.5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
33
|
+
devagent_cli-3.7.5.dist-info/entry_points.txt,sha256=PM0JnsK5pXqbEiJr5ZhhcHuZMEmI5x895XoS_nrfmfI,47
|
|
34
|
+
devagent_cli-3.7.5.dist-info/top_level.txt,sha256=mgd4Db3TkDcq3iBHZfYnN12pq3ufieFgfYc3AqR5WWc,9
|
|
35
|
+
devagent_cli-3.7.5.dist-info/RECORD,,
|
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: devagent-cli
|
|
3
|
-
Version: 3.3.0
|
|
4
|
-
Summary: A local autonomous coding agent CLI powered by Ollama.
|
|
5
|
-
Author: Vedant Jadhav
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: ai,agent,coding,ollama,local,devagent,devagent-cli
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Topic :: Software Development :: Interpreters
|
|
13
|
-
Requires-Python: >=3.11
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
License-File: LICENSE
|
|
16
|
-
Requires-Dist: rich
|
|
17
|
-
Requires-Dist: pytest
|
|
18
|
-
Requires-Dist: requests
|
|
19
|
-
Requires-Dist: ollama
|
|
20
|
-
Requires-Dist: faiss-cpu
|
|
21
|
-
Provides-Extra: semantic
|
|
22
|
-
Requires-Dist: sentence-transformers; extra == "semantic"
|
|
23
|
-
Provides-Extra: lint
|
|
24
|
-
Requires-Dist: flake8; extra == "lint"
|
|
25
|
-
Dynamic: license-file
|
|
26
|
-
|
|
27
|
-
<div align="center">
|
|
28
|
-
|
|
29
|
-
# 🧠 DevAgent
|
|
30
|
-
|
|
31
|
-
### A Lightweight Local Open-Source Miniature of Claude Code CLI
|
|
32
|
-
|
|
33
|
-
[](https://opensource.org/licenses/MIT)
|
|
34
|
-
[](https://badge.fury.io/py/devagent-cli)
|
|
35
|
-
[](https://www.python.org/)
|
|
36
|
-
[](https://ollama.ai)
|
|
37
|
-
[](CONTRIBUTING.md)
|
|
38
|
-
[](https://github.com/VedantJadhav701/Developer-Code-Intelligence-Agent)
|
|
39
|
-
|
|
40
|
-
**A production-grade local coding agent that finds bugs, writes patches, reviews its own code, and validates with tests — all offline, all local, zero API costs.**
|
|
41
|
-
|
|
42
|
-
[Quick Start](#-quick-start) •
|
|
43
|
-
[Architecture](#-architecture) •
|
|
44
|
-
[Benchmarks](#-benchmarks) •
|
|
45
|
-
[Roadmap](#-roadmap) •
|
|
46
|
-
[Contributing](#-contributing)
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
## 🛡️ Why DevAgent?
|
|
53
|
-
|
|
54
|
-
DevAgent is built on a "Safety-First" architecture for **high-integrity developer infrastructure**. Unlike chatbots that guess code, DevAgent is a local autonomous agent that operates within a strictly observed environment.
|
|
55
|
-
|
|
56
|
-
### 📊 Empirical Validation
|
|
57
|
-
We don't hide our limitations. DevAgent v3.2.3 has been stress-tested against real-world, "messy" repositories, providing a transparent **[Benchmark Report](docs/benchmarks.md)**.
|
|
58
|
-
|
|
59
|
-
| | Other Agents | DevAgent |
|
|
60
|
-
|---|---|---|
|
|
61
|
-
| **Safety Isolation** | ❌ | ✅ Strict Sandbox Mode |
|
|
62
|
-
| **Recovery** | ❌ | ✅ Git-native + Snapshot Rollback |
|
|
63
|
-
| **Validation** | ❌ | ✅ Empirical Stress Tests |
|
|
64
|
-
| **Transparency** | ❌ | ✅ Visible Failure Taxonomy |
|
|
65
|
-
| **Privacy** | ❌ | ✅ 100% Local (Ollama) |
|
|
66
|
-
| **Costs** | 💸 | ✅ Zero API Costs |
|
|
67
|
-
|
|
68
|
-
> **Philosophy:** Safety > Intelligence. Observability > Reasoning. Retrieval > Huge Context. Reliability > Hype.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## ✨ Features
|
|
73
|
-
|
|
74
|
-
🔁 **ReAct Loop** — Thought → Action → Observation → Fix → Review → Test cycle
|
|
75
|
-
|
|
76
|
-
🧠 **Planner** — LLM generates an action plan before coding
|
|
77
|
-
|
|
78
|
-
🔍 **Semantic Search** — FAISS + sentence-transformers code retrieval
|
|
79
|
-
|
|
80
|
-
🔎 **Code Search** — ripgrep-powered with cross-platform fallback
|
|
81
|
-
|
|
82
|
-
📝 **Self-Review** — LLM critiques its own fixes, revises until approved
|
|
83
|
-
|
|
84
|
-
🩹 **Patch Engine** — Line-level unified diffs instead of full file rewrites
|
|
85
|
-
|
|
86
|
-
🧪 **Test-Driven** — Runs pytest after every fix, retries on failure
|
|
87
|
-
|
|
88
|
-
🏖️ **Sandbox Mode** — Agent works in an isolated copy, applies changes only on success
|
|
89
|
-
|
|
90
|
-
📊 **Benchmarks** — 5 built-in benchmark suites with automated evaluation
|
|
91
|
-
|
|
92
|
-
📈 **Metrics** — Latency, token estimates, retries, and performance tracking
|
|
93
|
-
|
|
94
|
-
📋 **Full Audit Trail** — Every step logged to `logs/run.json`
|
|
95
|
-
|
|
96
|
-
🔒 **100% Offline** — Runs on Ollama with small models (2-4 GB)
|
|
97
|
-
|
|
98
|
-
⚡ **Low Resource** — Works on RTX 3050 (4 GB VRAM) / 16 GB RAM
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## 🚀 Quick Start
|
|
103
|
-
|
|
104
|
-
### Prerequisites
|
|
105
|
-
|
|
106
|
-
- [Python 3.11+](https://www.python.org/downloads/)
|
|
107
|
-
- [Ollama](https://ollama.ai) installed and running
|
|
108
|
-
|
|
109
|
-
### Install & Setup
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# 1. Clone
|
|
113
|
-
git clone https://github.com/VedantJadhav701/Developer-Code-Intelligence-Agent.git
|
|
114
|
-
cd Developer-Code-Intelligence-Agent
|
|
115
|
-
|
|
116
|
-
# 2. Install
|
|
117
|
-
pip install devagent-cli # (Coming soon to PyPI)
|
|
118
|
-
# Or locally: pip install -e .
|
|
119
|
-
|
|
120
|
-
# 3. Verify System (CRITICAL)
|
|
121
|
-
# This checks your Python environment, Ollama connection, and dependencies
|
|
122
|
-
devagent doctor
|
|
123
|
-
|
|
124
|
-
# 4. Pull the model
|
|
125
|
-
ollama pull qwen2.5-coder:3b
|
|
126
|
-
|
|
127
|
-
# 5. Run!
|
|
128
|
-
devagent run --task "Fix the divide-by-zero bug" --root ./demo_project
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### CLI Subcommands
|
|
132
|
-
|
|
133
|
-
| Command | Description |
|
|
134
|
-
|---|---|
|
|
135
|
-
| `devagent run` | Execute a coding task on a project |
|
|
136
|
-
| `devagent benchmark` | Run the automated benchmark suite |
|
|
137
|
-
| `devagent doctor` | Check system health and dependencies |
|
|
138
|
-
| `devagent models` | List available Ollama models |
|
|
139
|
-
| `devagent version` | Show current version |
|
|
140
|
-
|
|
141
|
-
#### 🛡️ Reliability & Safety
|
|
142
|
-
DevAgent is built for **production-grade reliability**:
|
|
143
|
-
- **Isolated Sandbox**: Agent works in `sandbox_workspace/`, keeping your source clean until success.
|
|
144
|
-
- **Auto-Snapshot**: Creates a safety restore point before every execution.
|
|
145
|
-
- **Instant Rollback**: Revert agent changes with `devagent rollback`.
|
|
146
|
-
- **Traceability**: Every thought and tool call is logged to `logs/run.json`.
|
|
147
|
-
- **Environment Awareness**: Detects and uses your project's Python environment automatically.
|
|
148
|
-
|
|
149
|
-
#### 🕹️ Interactive Mode
|
|
150
|
-
Run with `--interactive` (or `-i`) to review colorized diffs before they are applied to your project.
|
|
151
|
-
```bash
|
|
152
|
-
devagent run --task "Fix bug" --interactive
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## 🏗️ Architecture
|
|
158
|
-
|
|
159
|
-
```mermaid
|
|
160
|
-
graph TD
|
|
161
|
-
CLI[DevAgent CLI] --> Orchestrator[ReAct Orchestrator]
|
|
162
|
-
Orchestrator --> Safety[Safety Manager: Snapshots]
|
|
163
|
-
Orchestrator --> Memory[Working Memory]
|
|
164
|
-
Orchestrator --> Retrieval[Semantic Retrieval FAISS]
|
|
165
|
-
Orchestrator --> Tools[Tool Suite: pytest, ripgrep, git]
|
|
166
|
-
Orchestrator --> Reviewer[Self-Review Loop]
|
|
167
|
-
Reviewer --> Patch[Surgical Patch Engine]
|
|
168
|
-
Patch --> Sandbox[Sandbox Environment]
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
No API keys. No sign-ups. No cloud.
|
|
172
|
-
|
|
173
|
-
### Optional: Enable Semantic Search
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
pip install faiss-cpu sentence-transformers
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Without these, DevAgent falls back to keyword search — still fully functional.
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## 🎬 Demo
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
____ _ _
|
|
187
|
-
| _ \ _____ __/ \ __ _ ___ _ __ | |_
|
|
188
|
-
| | | |/ _ \ \ / / _ \ / _` |/ _ \ '_ \| __|
|
|
189
|
-
| |_| | __/\ V / ___ \ (_| | __/ | | | |_
|
|
190
|
-
|____/ \___| \_/_/ \_\__, |\___|_| |_|\__|
|
|
191
|
-
|___/
|
|
192
|
-
|
|
193
|
-
+==========================================================+
|
|
194
|
-
| DEVELOPER CODE INTELLIGENCE AGENT |
|
|
195
|
-
| Model: qwen2.5-coder:3b |
|
|
196
|
-
| Sandbox: OFF |
|
|
197
|
-
+==========================================================+
|
|
198
|
-
|
|
199
|
-
[PLAN] LIKELY_FILES: calculator.py
|
|
200
|
-
1. search_code: divide
|
|
201
|
-
2. read_file: calculator.py
|
|
202
|
-
3. run_tests
|
|
203
|
-
|
|
204
|
-
----------------------------------------
|
|
205
|
-
ITERATION 1/5
|
|
206
|
-
----------------------------------------
|
|
207
|
-
[TOOL] Executing: search_code(divide)
|
|
208
|
-
>> Found: calculator.py:10:def divide(a, b)
|
|
209
|
-
[REVIEW] #1: APPROVED
|
|
210
|
-
>> Tests: 5 passed ✓
|
|
211
|
-
|
|
212
|
-
[OK] AGENT COMPLETED SUCCESSFULLY
|
|
213
|
-
|
|
214
|
-
Status: success
|
|
215
|
-
Steps used: 1/5
|
|
216
|
-
Patches: 1
|
|
217
|
-
Time: 8.2s
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## 🏗️ Architecture
|
|
223
|
-
|
|
224
|
-
```
|
|
225
|
-
┌─────────────────────────────┐
|
|
226
|
-
│ CLI (main.py) │
|
|
227
|
-
│ --task --root --model │
|
|
228
|
-
│ --sandbox --benchmark │
|
|
229
|
-
│ --auto-commit --auto-push │
|
|
230
|
-
└──────────┬──────────────────┘
|
|
231
|
-
│
|
|
232
|
-
┌──────────▼──────────────────┐
|
|
233
|
-
│ Planner Layer │
|
|
234
|
-
│ Identifies files + strategy │
|
|
235
|
-
└──────────┬──────────────────┘
|
|
236
|
-
│
|
|
237
|
-
┌──────────▼──────────────────┐
|
|
238
|
-
│ Retrieval Layer (Memory) │
|
|
239
|
-
│ FAISS + Sentence-Transformers│
|
|
240
|
-
│ Chunk → Embed → Top-K │
|
|
241
|
-
└──────────┬──────────────────┘
|
|
242
|
-
│
|
|
243
|
-
┌──────────▼──────────────────┐
|
|
244
|
-
│ ReAct Agent Loop │
|
|
245
|
-
│ │
|
|
246
|
-
│ 1. THOUGHT (LLM) │
|
|
247
|
-
│ 2. ACTION (Tool) │
|
|
248
|
-
│ 3. OBSERVATION │
|
|
249
|
-
│ 4. FIX (LLM) │
|
|
250
|
-
│ 5. REVIEW (LLM) │
|
|
251
|
-
│ 6. PATCH (Diff Engine) │
|
|
252
|
-
│ 7. TEST (pytest) │
|
|
253
|
-
│ │
|
|
254
|
-
│ if FAIL → retry │
|
|
255
|
-
│ if PASS → done ✓ │
|
|
256
|
-
└──┬──────────────┬───────────┘
|
|
257
|
-
│ │
|
|
258
|
-
┌────────▼──┐ ┌──────▼──────┐
|
|
259
|
-
│ Tools │ │ Ollama │
|
|
260
|
-
│ │ │ (Local) │
|
|
261
|
-
│ • search │ │ │
|
|
262
|
-
│ • semantic│ │ qwen2.5- │
|
|
263
|
-
│ • read │ │ coder:3b │
|
|
264
|
-
│ • patch │ │ phi3:mini │
|
|
265
|
-
│ • pytest │ │ mistral:7b │
|
|
266
|
-
│ • flake8 │ │ │
|
|
267
|
-
│ • git_diff│ └─────────────┘
|
|
268
|
-
│ • sandbox │
|
|
269
|
-
└───────────┘
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### 9-Layer Architecture
|
|
273
|
-
|
|
274
|
-
| Layer | Module | Purpose |
|
|
275
|
-
|---|---|---|
|
|
276
|
-
| 1. CLI | `main.py` | Argument parsing, mode selection, banner |
|
|
277
|
-
| 2. Planner | `app/planner.py` | Task interpretation, file identification |
|
|
278
|
-
| 3. Retrieval | `app/memory.py` | FAISS index, semantic chunking, Top-K search |
|
|
279
|
-
| 4. Tools | `tools/*` | 8 real tools: search, semantic_search, read, write, test, lint, git, sandbox |
|
|
280
|
-
| 5. Agent | `app/agent.py` | ReAct orchestration loop |
|
|
281
|
-
| 6. Review | `app/reviewer.py` | Self-critique with APPROVED/REVISE |
|
|
282
|
-
| 7. Validation | `tools/test_runner.py` | pytest + flake8 execution feedback |
|
|
283
|
-
| 8. Logging | `utils/logger.py` | Structured JSON audit trail |
|
|
284
|
-
| 9. Safety | `app/sandbox.py` | Isolated workspace, path validation |
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## 📁 Project Structure
|
|
289
|
-
|
|
290
|
-
```
|
|
291
|
-
Developer-Code-Intelligence-Agent/
|
|
292
|
-
├── app/
|
|
293
|
-
│ ├── agent.py # Core ReAct agent engine
|
|
294
|
-
│ ├── planner.py # Task planning layer
|
|
295
|
-
│ ├── reviewer.py # Self-review module
|
|
296
|
-
│ ├── llm.py # Ollama integration
|
|
297
|
-
│ ├── memory.py # FAISS retrieval + working memory
|
|
298
|
-
│ ├── patcher.py # Unified diff patch engine
|
|
299
|
-
│ ├── sandbox.py # Sandbox workspace manager
|
|
300
|
-
│ └── state.py # Shared state dataclass
|
|
301
|
-
├── tools/
|
|
302
|
-
│ ├── search.py # Code search (ripgrep + fallbacks)
|
|
303
|
-
│ ├── semantic_search.py # FAISS semantic search
|
|
304
|
-
│ ├── file_ops.py # Safe file read/write
|
|
305
|
-
│ ├── test_runner.py # pytest runner
|
|
306
|
-
│ ├── linter.py # flake8 linter
|
|
307
|
-
│ ├── git_tools.py # Git diff/commit/push
|
|
308
|
-
│ └── benchmark_runner.py # Benchmark evaluation
|
|
309
|
-
├── utils/
|
|
310
|
-
│ ├── logger.py # Structured JSON logger
|
|
311
|
-
│ ├── config.py # Centralized configuration
|
|
312
|
-
│ └── metrics.py # Performance metrics
|
|
313
|
-
├── benchmarks/
|
|
314
|
-
│ ├── divide_by_zero/ # Benchmark: zero division guard
|
|
315
|
-
│ ├── missing_validation/ # Benchmark: input validation
|
|
316
|
-
│ ├── syntax_error/ # Benchmark: syntax fix
|
|
317
|
-
│ ├── import_bug/ # Benchmark: wrong import
|
|
318
|
-
│ └── edge_case/ # Benchmark: empty list handling
|
|
319
|
-
├── demo_project/ # Sample buggy project
|
|
320
|
-
├── docs/
|
|
321
|
-
│ └── USER_GUIDE.md # Full usage guide
|
|
322
|
-
├── main.py # CLI entry point
|
|
323
|
-
├── devagent.py # Global CLI wrapper
|
|
324
|
-
├── devagent.bat # Windows global shortcut
|
|
325
|
-
├── requirements.txt
|
|
326
|
-
├── CONTRIBUTING.md
|
|
327
|
-
├── CHANGELOG.md
|
|
328
|
-
├── CODE_OF_CONDUCT.md
|
|
329
|
-
├── SECURITY.md
|
|
330
|
-
├── LICENSE
|
|
331
|
-
└── README.md
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
---
|
|
335
|
-
|
|
336
|
-
## 💻 CLI Reference
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
python main.py --task "TASK" --root ./project [OPTIONS]
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
| Flag | Default | Description |
|
|
343
|
-
|---|---|---|
|
|
344
|
-
| `--task`, `-t` | *(required)* | The coding task for the agent |
|
|
345
|
-
| `--root`, `-r` | `.` | Project root directory |
|
|
346
|
-
| `--model` | `qwen2.5-coder:3b` | Any Ollama model |
|
|
347
|
-
| `--max-steps`, `-m` | `5` | Max ReAct iterations |
|
|
348
|
-
| `--benchmark` | off | Run benchmark suite |
|
|
349
|
-
| `--sandbox` | off | Run in isolated sandbox |
|
|
350
|
-
| `--auto-commit` | off | Git commit on success |
|
|
351
|
-
| `--auto-push` | off | Git push after commit |
|
|
352
|
-
| `--verbose`, `-v` | off | Verbose output |
|
|
353
|
-
|
|
354
|
-
### Examples
|
|
355
|
-
|
|
356
|
-
```bash
|
|
357
|
-
# Fix a specific bug
|
|
358
|
-
python main.py -t "Fix the TypeError in user_service.py" -r ./backend
|
|
359
|
-
|
|
360
|
-
# Run in sandbox mode (safe — doesn't touch real files until success)
|
|
361
|
-
python main.py -t "Fix divide-by-zero bug" -r ./project --sandbox
|
|
362
|
-
|
|
363
|
-
# Auto-commit changes on success
|
|
364
|
-
python main.py -t "Add input validation" -r ./api --auto-commit
|
|
365
|
-
|
|
366
|
-
# Use a stronger model
|
|
367
|
-
python main.py -t "Refactor auth middleware" -r ./server --model mistral:7b
|
|
368
|
-
|
|
369
|
-
# Run benchmarks
|
|
370
|
-
python main.py --benchmark
|
|
371
|
-
|
|
372
|
-
# More retries for complex tasks
|
|
373
|
-
python main.py -t "Make all tests pass" -r ./project --max-steps 10
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
> 📖 **[Full User Guide →](docs/USER_GUIDE.md)**
|
|
377
|
-
|
|
378
|
-
---
|
|
379
|
-
|
|
380
|
-
## 📊 Benchmarks
|
|
381
|
-
|
|
382
|
-
DevAgent includes 5 built-in benchmarks to evaluate agent performance:
|
|
383
|
-
|
|
384
|
-
| Benchmark | Bug Type | Difficulty |
|
|
385
|
-
|---|---|---|
|
|
386
|
-
| `divide_by_zero` | Missing guard clause | Easy |
|
|
387
|
-
| `missing_validation` | No input validation | Medium |
|
|
388
|
-
| `syntax_error` | Broken syntax | Medium |
|
|
389
|
-
| `import_bug` | Wrong module name | Easy |
|
|
390
|
-
| `edge_case` | Empty list crash | Medium |
|
|
391
|
-
|
|
392
|
-
Run benchmarks:
|
|
393
|
-
|
|
394
|
-
```bash
|
|
395
|
-
python main.py --benchmark
|
|
396
|
-
python main.py --benchmark --model phi3:mini
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
## 🔧 Supported Models
|
|
402
|
-
|
|
403
|
-
| Model | Size | Speed | Quality | Best For |
|
|
404
|
-
|---|---|---|---|---|
|
|
405
|
-
| `qwen2.5-coder:3b` | 1.9 GB | ⚡ Fast | ★★★★ | **Default — best for code** |
|
|
406
|
-
| `qwen2.5:3b` | 1.9 GB | ⚡ Fast | ★★★☆ | General fallback |
|
|
407
|
-
| `phi3:mini` | 2.2 GB | ⚡ Fast | ★★★☆ | Good reasoning |
|
|
408
|
-
| `qwen3:4b` | 2.5 GB | ⚡ Fast | ★★★★ | Better understanding |
|
|
409
|
-
| `gemma2:2b` | 1.6 GB | ⚡⚡ | ★★☆☆ | Ultra-low resource |
|
|
410
|
-
| `mistral:7b` | 4.4 GB | 🐢 | ★★★★★ | Best quality (8GB+ RAM) |
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
## 🗺️ Roadmap
|
|
415
|
-
|
|
416
|
-
### ✅ Completed (v2.0)
|
|
417
|
-
|
|
418
|
-
- [x] Core ReAct agent loop
|
|
419
|
-
- [x] Self-review module
|
|
420
|
-
- [x] Tool system (9 tools)
|
|
421
|
-
- [x] Planner layer
|
|
422
|
-
- [x] Semantic retrieval (FAISS)
|
|
423
|
-
- [x] Patch engine (unified diffs)
|
|
424
|
-
- [x] Sandbox mode
|
|
425
|
-
- [x] Benchmark system (5 suites)
|
|
426
|
-
- [x] Metrics + structured logging
|
|
427
|
-
- [x] Git integration
|
|
428
|
-
- [x] CLI with all flags
|
|
429
|
-
|
|
430
|
-
### 🔜 Coming Next
|
|
431
|
-
|
|
432
|
-
- [ ] **Multi-file support** — Agent works across multiple files simultaneously
|
|
433
|
-
- [ ] **Language support** — JavaScript, TypeScript, Go, Rust
|
|
434
|
-
- [ ] **Plugin system** — Custom tools via YAML/Python
|
|
435
|
-
- [ ] **Watch mode** — Auto-fix on test failure (`--watch`)
|
|
436
|
-
- [ ] **VS Code extension** — Run agent from your editor
|
|
437
|
-
- [ ] **Conversation memory** — Learn from past runs
|
|
438
|
-
- [ ] **Multi-agent mode** — Planner + Coder + Reviewer + Evaluator agents
|
|
439
|
-
|
|
440
|
-
---
|
|
441
|
-
|
|
442
|
-
## 🤝 Contributing
|
|
443
|
-
|
|
444
|
-
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
445
|
-
|
|
446
|
-
```bash
|
|
447
|
-
git checkout -b feature/your-feature
|
|
448
|
-
# ... make changes ...
|
|
449
|
-
python -m pytest demo_project/ -v
|
|
450
|
-
git commit -m "feat: your feature"
|
|
451
|
-
git push origin feature/your-feature
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
**Good first issues** are tagged and waiting:
|
|
455
|
-
[Browse good first issues →](https://github.com/VedantJadhav701/Developer-Code-Intelligence-Agent/labels/good%20first%20issue)
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
## 📜 License
|
|
460
|
-
|
|
461
|
-
MIT — use it however you want. See [LICENSE](LICENSE).
|
|
462
|
-
|
|
463
|
-
---
|
|
464
|
-
|
|
465
|
-
## ⭐ Star History
|
|
466
|
-
|
|
467
|
-
If DevAgent helps you, give it a star! It helps others discover the project.
|
|
468
|
-
|
|
469
|
-
[](https://star-history.com/#VedantJadhav701/Developer-Code-Intelligence-Agent&Date)
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
<div align="center">
|
|
474
|
-
|
|
475
|
-
**Built with 🧠 by [Vedant Jadhav](https://github.com/VedantJadhav701)**
|
|
476
|
-
|
|
477
|
-
*A lightweight local open-source miniature of Claude Code CLI.*
|
|
478
|
-
|
|
479
|
-
</div>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|