swadhin biswas redy to jump in work Β· 7/25/2025
d8c49a5
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/usr/bin/env python3
"""
LaxyFile Launcher with AI Features
Enhanced terminal file manager with OpenRouter AI integration
"""
import os
import sys
import subprocess
import shutil
from pathlib import Path
def check_terminal_capabilities():
"""Check terminal capabilities for optimal experience"""
capabilities = {
"color_support": False,
"unicode_support": False,
"terminal_size": (80, 24),
"ai_configured": False
}
# Check color support
if os.getenv("COLORTERM") or os.getenv("TERM", "").endswith("color"):
capabilities["color_support"] = True
# Check terminal size
try:
size = shutil.get_terminal_size()
capabilities["terminal_size"] = (size.columns, size.lines)
except:
pass
# Check Unicode support
try:
"π".encode(sys.stdout.encoding or 'utf-8')
capabilities["unicode_support"] = True
except:
pass
# Check AI configuration
if os.getenv("OPENROUTER_API_KEY"):
capabilities["ai_configured"] = True
return capabilities
def check_dependencies():
"""Check for required and optional dependencies"""
required_deps = [
"rich", "pydantic", "yaml", "PIL", "pygments"
]
optional_deps = [
"cv2", "openai", "psutil", "magic"
]
missing_required = []
missing_optional = []
for dep in required_deps:
try:
if dep == "yaml":
import yaml
elif dep == "PIL":
from PIL import Image
else:
__import__(dep)
except ImportError:
missing_required.append(dep)
for dep in optional_deps:
try:
if dep == "cv2":
import cv2
elif dep == "magic":
import magic
elif dep == "openai":
import openai
elif dep == "psutil":
import psutil
except ImportError:
missing_optional.append(dep)
return missing_required, missing_optional
def show_startup_banner(capabilities):
"""Show startup banner with system info"""
width = capabilities["terminal_size"][0]
if capabilities["unicode_support"]:
banner = """
π LaxyFile - Advanced Terminal File Manager π
Powered by Kimi AI through OpenRouter
"""
else:
banner = """
LaxyFile - Advanced Terminal File Manager
Powered by Kimi AI through OpenRouter
"""
print("=" * min(width, 60))
print(banner)
print("=" * min(width, 60))
# System info
print(f"Terminal: {capabilities['terminal_size'][0]}x{capabilities['terminal_size'][1]}")
print(f"Colors: {'β
Supported' if capabilities['color_support'] else 'β Limited'}")
print(f"Unicode: {'β
Supported' if capabilities['unicode_support'] else 'β Limited'}")
print(f"AI Features: {'π€ Ready' if capabilities['ai_configured'] else 'π΄ Setup Required'}")
print()
def show_ai_setup_instructions():
"""Show AI setup instructions"""
print("π€ AI ASSISTANT SETUP")
print("=" * 50)
print()
print("To enable the advanced AI features:")
print()
print("1. Get an OpenRouter API key:")
print(" β’ Visit https://openrouter.ai/")
print(" β’ Create an account and get your API key")
print(" β’ Free tier includes access to Kimi AI model")
print()
print("2. Set the environment variable:")
print(" export OPENROUTER_API_KEY='your-api-key-here'")
print()
print("3. Or add to your shell profile:")
print(" echo 'export OPENROUTER_API_KEY=\"your-key\"' >> ~/.bashrc")
print(" source ~/.bashrc")
print()
print("π― AI Features include:")
print(" β’ Complete system analysis with device monitoring")
print(" β’ Intelligent file organization suggestions")
print(" β’ Security audits and vulnerability detection")
print(" β’ Performance optimization recommendations")
print(" β’ Video and media analysis with metadata")
print(" β’ Duplicate detection and cleanup")
print(" β’ Smart backup strategies")
print(" β’ Real-time content analysis and insights")
print()
def main():
"""Main launcher function"""
try:
# Check Python version
if sys.version_info < (3, 8):
print("β LaxyFile requires Python 3.8 or higher")
print(f" Current version: {sys.version}")
return 1
# Check terminal capabilities
capabilities = check_terminal_capabilities()
# Show banner
show_startup_banner(capabilities)
# Check dependencies
missing_required, missing_optional = check_dependencies()
if missing_required:
print("β MISSING REQUIRED DEPENDENCIES:")
for dep in missing_required:
print(f" β’ {dep}")
print()
print("Install with: pip install -r requirements.txt")
return 1
if missing_optional:
print("β οΈ MISSING OPTIONAL DEPENDENCIES:")
for dep in missing_optional:
print(f" β’ {dep}")
print()
print("Some features will be limited. Install with:")
print("pip install opencv-python openai psutil python-magic")
print("(Note: These enhance video analysis and AI features)")
print()
# AI setup check
if not capabilities["ai_configured"]:
show_ai_setup_instructions()
response = input("Continue without AI features? (y/N): ").lower()
if response not in ['y', 'yes']:
return 0
else:
print("π€ AI Assistant: Ready with Kimi AI model")
print()
# Performance warning for small terminals
if capabilities["terminal_size"][0] < 100:
print("β οΈ Terminal width < 100 columns. Consider resizing for optimal experience.")
print()
# Launch LaxyFile
print("π Launching LaxyFile...")
print("π‘ Press 'i' for AI assistant, '?' for help, 'q' to quit")
print("=" * 50)
print()
# Add current directory to Python path
current_dir = Path(__file__).parent
if str(current_dir) not in sys.path:
sys.path.insert(0, str(current_dir))
# Import and run
from laxyfile.main import main as laxyfile_main
return laxyfile_main()
except KeyboardInterrupt:
print("\nπ Goodbye!")
return 0
except ImportError as e:
print(f"β Import error: {e}")
print("Please install dependencies: pip install -r requirements.txt")
return 1
except Exception as e:
print(f"β Launcher error: {e}")
return 1
if __name__ == "__main__":
sys.exit(main())