This repository was archived by the owner on Jun 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheck_deps.py
More file actions
executable file
·133 lines (110 loc) · 4.16 KB
/
Copy pathcheck_deps.py
File metadata and controls
executable file
·133 lines (110 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env python3
"""Check if all required dependencies are installed for mimicode."""
import shutil
import subprocess
import sys
from pathlib import Path
def check_ripgrep():
"""Check if ripgrep is installed."""
rg_path = shutil.which("rg")
if rg_path:
try:
result = subprocess.run(
["rg", "--version"],
capture_output=True,
text=True,
check=True
)
version = result.stdout.split("\n")[0]
print(f"✅ ripgrep found: {version}")
return True
except subprocess.CalledProcessError:
print("⚠️ ripgrep found but unable to get version")
return True
else:
print("❌ ripgrep (rg) not found")
print("\nripgrep is REQUIRED for mimicode to function properly.")
print("The agent uses it for file searching and pattern matching.")
print("\nInstall instructions:")
# Platform-specific instructions
if sys.platform == "darwin":
print(" macOS (Homebrew):")
print(" brew install ripgrep")
elif sys.platform.startswith("linux"):
print(" Ubuntu/Debian: sudo apt install ripgrep")
print(" Fedora/RHEL: sudo dnf install ripgrep")
print(" Arch Linux: sudo pacman -S ripgrep")
elif sys.platform == "win32":
print(" Windows (Chocolatey): choco install ripgrep")
print(" Windows (Scoop): scoop install ripgrep")
print("\n Or download from: https://github.com/BurntSushi/ripgrep/releases")
return False
def check_python_packages():
"""Check if required Python packages are installed."""
requirements_file = Path("requirements.txt")
if not requirements_file.exists():
print("⚠️ requirements.txt not found")
return True
missing = []
with open(requirements_file) as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"):
continue
# Parse package name (before >= or ==)
package = line.split(">=")[0].split("==")[0].strip()
try:
__import__(package.replace("-", "_"))
except ImportError:
missing.append(package)
if missing:
print(f"❌ Missing Python packages: {', '.join(missing)}")
print("\nInstall them with:")
print(" pip install -r requirements.txt")
return False
else:
print("✅ All Python packages installed")
return True
def check_api_key():
"""Check if ANTHROPIC_API_KEY is set."""
import os
# Try .env file first
env_file = Path(".env")
if env_file.exists():
with open(env_file) as f:
for line in f:
if line.strip().startswith("ANTHROPIC_API_KEY"):
print("✅ API key found in .env file")
return True
# Check environment variable
if os.getenv("ANTHROPIC_API_KEY"):
print("✅ ANTHROPIC_API_KEY environment variable set")
return True
print("⚠️ ANTHROPIC_API_KEY not found")
print("\nSet your API key:")
print(" export ANTHROPIC_API_KEY='your-key-here'")
print("\nOr create a .env file with:")
print(" ANTHROPIC_API_KEY=your-key-here")
return False
def main():
"""Run all dependency checks."""
print("🔍 Checking mimicode dependencies...\n")
checks = [
("Ripgrep", check_ripgrep),
("Python packages", check_python_packages),
("API key", check_api_key),
]
results = []
for name, check_func in checks:
results.append(check_func())
print()
if all(results[:2]): # ripgrep and packages are critical
print("✅ All critical dependencies satisfied!")
if not results[2]:
print("⚠️ Remember to set your API key before running mimicode")
return 0
else:
print("❌ Some critical dependencies are missing. Please install them.")
return 1
if __name__ == "__main__":
sys.exit(main())