mcli-framework 7.0.0__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.

Potentially problematic release.


This version of mcli-framework might be problematic. Click here for more details.

Files changed (186) hide show
  1. mcli/app/chat_cmd.py +42 -0
  2. mcli/app/commands_cmd.py +226 -0
  3. mcli/app/completion_cmd.py +216 -0
  4. mcli/app/completion_helpers.py +288 -0
  5. mcli/app/cron_test_cmd.py +697 -0
  6. mcli/app/logs_cmd.py +419 -0
  7. mcli/app/main.py +492 -0
  8. mcli/app/model/model.py +1060 -0
  9. mcli/app/model_cmd.py +227 -0
  10. mcli/app/redis_cmd.py +269 -0
  11. mcli/app/video/video.py +1114 -0
  12. mcli/app/visual_cmd.py +303 -0
  13. mcli/chat/chat.py +2409 -0
  14. mcli/chat/command_rag.py +514 -0
  15. mcli/chat/enhanced_chat.py +652 -0
  16. mcli/chat/system_controller.py +1010 -0
  17. mcli/chat/system_integration.py +1016 -0
  18. mcli/cli.py +25 -0
  19. mcli/config.toml +20 -0
  20. mcli/lib/api/api.py +586 -0
  21. mcli/lib/api/daemon_client.py +203 -0
  22. mcli/lib/api/daemon_client_local.py +44 -0
  23. mcli/lib/api/daemon_decorator.py +217 -0
  24. mcli/lib/api/mcli_decorators.py +1032 -0
  25. mcli/lib/auth/auth.py +85 -0
  26. mcli/lib/auth/aws_manager.py +85 -0
  27. mcli/lib/auth/azure_manager.py +91 -0
  28. mcli/lib/auth/credential_manager.py +192 -0
  29. mcli/lib/auth/gcp_manager.py +93 -0
  30. mcli/lib/auth/key_manager.py +117 -0
  31. mcli/lib/auth/mcli_manager.py +93 -0
  32. mcli/lib/auth/token_manager.py +75 -0
  33. mcli/lib/auth/token_util.py +1011 -0
  34. mcli/lib/config/config.py +47 -0
  35. mcli/lib/discovery/__init__.py +1 -0
  36. mcli/lib/discovery/command_discovery.py +274 -0
  37. mcli/lib/erd/erd.py +1345 -0
  38. mcli/lib/erd/generate_graph.py +453 -0
  39. mcli/lib/files/files.py +76 -0
  40. mcli/lib/fs/fs.py +109 -0
  41. mcli/lib/lib.py +29 -0
  42. mcli/lib/logger/logger.py +611 -0
  43. mcli/lib/performance/optimizer.py +409 -0
  44. mcli/lib/performance/rust_bridge.py +502 -0
  45. mcli/lib/performance/uvloop_config.py +154 -0
  46. mcli/lib/pickles/pickles.py +50 -0
  47. mcli/lib/search/cached_vectorizer.py +479 -0
  48. mcli/lib/services/data_pipeline.py +460 -0
  49. mcli/lib/services/lsh_client.py +441 -0
  50. mcli/lib/services/redis_service.py +387 -0
  51. mcli/lib/shell/shell.py +137 -0
  52. mcli/lib/toml/toml.py +33 -0
  53. mcli/lib/ui/styling.py +47 -0
  54. mcli/lib/ui/visual_effects.py +634 -0
  55. mcli/lib/watcher/watcher.py +185 -0
  56. mcli/ml/api/app.py +215 -0
  57. mcli/ml/api/middleware.py +224 -0
  58. mcli/ml/api/routers/admin_router.py +12 -0
  59. mcli/ml/api/routers/auth_router.py +244 -0
  60. mcli/ml/api/routers/backtest_router.py +12 -0
  61. mcli/ml/api/routers/data_router.py +12 -0
  62. mcli/ml/api/routers/model_router.py +302 -0
  63. mcli/ml/api/routers/monitoring_router.py +12 -0
  64. mcli/ml/api/routers/portfolio_router.py +12 -0
  65. mcli/ml/api/routers/prediction_router.py +267 -0
  66. mcli/ml/api/routers/trade_router.py +12 -0
  67. mcli/ml/api/routers/websocket_router.py +76 -0
  68. mcli/ml/api/schemas.py +64 -0
  69. mcli/ml/auth/auth_manager.py +425 -0
  70. mcli/ml/auth/models.py +154 -0
  71. mcli/ml/auth/permissions.py +302 -0
  72. mcli/ml/backtesting/backtest_engine.py +502 -0
  73. mcli/ml/backtesting/performance_metrics.py +393 -0
  74. mcli/ml/cache.py +400 -0
  75. mcli/ml/cli/main.py +398 -0
  76. mcli/ml/config/settings.py +394 -0
  77. mcli/ml/configs/dvc_config.py +230 -0
  78. mcli/ml/configs/mlflow_config.py +131 -0
  79. mcli/ml/configs/mlops_manager.py +293 -0
  80. mcli/ml/dashboard/app.py +532 -0
  81. mcli/ml/dashboard/app_integrated.py +738 -0
  82. mcli/ml/dashboard/app_supabase.py +560 -0
  83. mcli/ml/dashboard/app_training.py +615 -0
  84. mcli/ml/dashboard/cli.py +51 -0
  85. mcli/ml/data_ingestion/api_connectors.py +501 -0
  86. mcli/ml/data_ingestion/data_pipeline.py +567 -0
  87. mcli/ml/data_ingestion/stream_processor.py +512 -0
  88. mcli/ml/database/migrations/env.py +94 -0
  89. mcli/ml/database/models.py +667 -0
  90. mcli/ml/database/session.py +200 -0
  91. mcli/ml/experimentation/ab_testing.py +845 -0
  92. mcli/ml/features/ensemble_features.py +607 -0
  93. mcli/ml/features/political_features.py +676 -0
  94. mcli/ml/features/recommendation_engine.py +809 -0
  95. mcli/ml/features/stock_features.py +573 -0
  96. mcli/ml/features/test_feature_engineering.py +346 -0
  97. mcli/ml/logging.py +85 -0
  98. mcli/ml/mlops/data_versioning.py +518 -0
  99. mcli/ml/mlops/experiment_tracker.py +377 -0
  100. mcli/ml/mlops/model_serving.py +481 -0
  101. mcli/ml/mlops/pipeline_orchestrator.py +614 -0
  102. mcli/ml/models/base_models.py +324 -0
  103. mcli/ml/models/ensemble_models.py +675 -0
  104. mcli/ml/models/recommendation_models.py +474 -0
  105. mcli/ml/models/test_models.py +487 -0
  106. mcli/ml/monitoring/drift_detection.py +676 -0
  107. mcli/ml/monitoring/metrics.py +45 -0
  108. mcli/ml/optimization/portfolio_optimizer.py +834 -0
  109. mcli/ml/preprocessing/data_cleaners.py +451 -0
  110. mcli/ml/preprocessing/feature_extractors.py +491 -0
  111. mcli/ml/preprocessing/ml_pipeline.py +382 -0
  112. mcli/ml/preprocessing/politician_trading_preprocessor.py +569 -0
  113. mcli/ml/preprocessing/test_preprocessing.py +294 -0
  114. mcli/ml/scripts/populate_sample_data.py +200 -0
  115. mcli/ml/tasks.py +400 -0
  116. mcli/ml/tests/test_integration.py +429 -0
  117. mcli/ml/tests/test_training_dashboard.py +387 -0
  118. mcli/public/oi/oi.py +15 -0
  119. mcli/public/public.py +4 -0
  120. mcli/self/self_cmd.py +1246 -0
  121. mcli/workflow/daemon/api_daemon.py +800 -0
  122. mcli/workflow/daemon/async_command_database.py +681 -0
  123. mcli/workflow/daemon/async_process_manager.py +591 -0
  124. mcli/workflow/daemon/client.py +530 -0
  125. mcli/workflow/daemon/commands.py +1196 -0
  126. mcli/workflow/daemon/daemon.py +905 -0
  127. mcli/workflow/daemon/daemon_api.py +59 -0
  128. mcli/workflow/daemon/enhanced_daemon.py +571 -0
  129. mcli/workflow/daemon/process_cli.py +244 -0
  130. mcli/workflow/daemon/process_manager.py +439 -0
  131. mcli/workflow/daemon/test_daemon.py +275 -0
  132. mcli/workflow/dashboard/dashboard_cmd.py +113 -0
  133. mcli/workflow/docker/docker.py +0 -0
  134. mcli/workflow/file/file.py +100 -0
  135. mcli/workflow/gcloud/config.toml +21 -0
  136. mcli/workflow/gcloud/gcloud.py +58 -0
  137. mcli/workflow/git_commit/ai_service.py +328 -0
  138. mcli/workflow/git_commit/commands.py +430 -0
  139. mcli/workflow/lsh_integration.py +355 -0
  140. mcli/workflow/model_service/client.py +594 -0
  141. mcli/workflow/model_service/download_and_run_efficient_models.py +288 -0
  142. mcli/workflow/model_service/lightweight_embedder.py +397 -0
  143. mcli/workflow/model_service/lightweight_model_server.py +714 -0
  144. mcli/workflow/model_service/lightweight_test.py +241 -0
  145. mcli/workflow/model_service/model_service.py +1955 -0
  146. mcli/workflow/model_service/ollama_efficient_runner.py +425 -0
  147. mcli/workflow/model_service/pdf_processor.py +386 -0
  148. mcli/workflow/model_service/test_efficient_runner.py +234 -0
  149. mcli/workflow/model_service/test_example.py +315 -0
  150. mcli/workflow/model_service/test_integration.py +131 -0
  151. mcli/workflow/model_service/test_new_features.py +149 -0
  152. mcli/workflow/openai/openai.py +99 -0
  153. mcli/workflow/politician_trading/commands.py +1790 -0
  154. mcli/workflow/politician_trading/config.py +134 -0
  155. mcli/workflow/politician_trading/connectivity.py +490 -0
  156. mcli/workflow/politician_trading/data_sources.py +395 -0
  157. mcli/workflow/politician_trading/database.py +410 -0
  158. mcli/workflow/politician_trading/demo.py +248 -0
  159. mcli/workflow/politician_trading/models.py +165 -0
  160. mcli/workflow/politician_trading/monitoring.py +413 -0
  161. mcli/workflow/politician_trading/scrapers.py +966 -0
  162. mcli/workflow/politician_trading/scrapers_california.py +412 -0
  163. mcli/workflow/politician_trading/scrapers_eu.py +377 -0
  164. mcli/workflow/politician_trading/scrapers_uk.py +350 -0
  165. mcli/workflow/politician_trading/scrapers_us_states.py +438 -0
  166. mcli/workflow/politician_trading/supabase_functions.py +354 -0
  167. mcli/workflow/politician_trading/workflow.py +852 -0
  168. mcli/workflow/registry/registry.py +180 -0
  169. mcli/workflow/repo/repo.py +223 -0
  170. mcli/workflow/scheduler/commands.py +493 -0
  171. mcli/workflow/scheduler/cron_parser.py +238 -0
  172. mcli/workflow/scheduler/job.py +182 -0
  173. mcli/workflow/scheduler/monitor.py +139 -0
  174. mcli/workflow/scheduler/persistence.py +324 -0
  175. mcli/workflow/scheduler/scheduler.py +679 -0
  176. mcli/workflow/sync/sync_cmd.py +437 -0
  177. mcli/workflow/sync/test_cmd.py +314 -0
  178. mcli/workflow/videos/videos.py +242 -0
  179. mcli/workflow/wakatime/wakatime.py +11 -0
  180. mcli/workflow/workflow.py +37 -0
  181. mcli_framework-7.0.0.dist-info/METADATA +479 -0
  182. mcli_framework-7.0.0.dist-info/RECORD +186 -0
  183. mcli_framework-7.0.0.dist-info/WHEEL +5 -0
  184. mcli_framework-7.0.0.dist-info/entry_points.txt +7 -0
  185. mcli_framework-7.0.0.dist-info/licenses/LICENSE +21 -0
  186. mcli_framework-7.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,634 @@
1
+ """
2
+ 🎨 MCLI Visual Effects and Enhanced CLI Experience
3
+ Provides stunning visual elements, animations, and rich formatting for the CLI
4
+ """
5
+
6
+ import random
7
+ import sys
8
+ import threading
9
+ import time
10
+ from typing import Any, Dict, List, Optional
11
+
12
+ from rich.align import Align
13
+ from rich.box import ASCII, DOUBLE, HEAVY, ROUNDED
14
+ from rich.columns import Columns
15
+ from rich.console import Console
16
+ from rich.live import Live
17
+ from rich.markdown import Markdown
18
+ from rich.panel import Panel
19
+ from rich.progress import (
20
+ BarColumn,
21
+ MofNCompleteColumn,
22
+ Progress,
23
+ SpinnerColumn,
24
+ TextColumn,
25
+ TimeElapsedColumn,
26
+ TimeRemainingColumn,
27
+ )
28
+ from rich.rule import Rule
29
+ from rich.syntax import Syntax
30
+ from rich.table import Table
31
+ from rich.text import Text
32
+ from rich.tree import Tree
33
+
34
+ console = Console()
35
+
36
+
37
+ class MCLIBanner:
38
+ """Stunning ASCII art banners for MCLI"""
39
+
40
+ MAIN_BANNER = """
41
+ ╔════════════════════════════════════════════════════════════════╗
42
+ ║ ███╗ ███╗ ██████╗██╗ ██╗ ┌─┐┌─┐┬ ┬┌─┐┬─┐┌─┐┌┬┐ ║
43
+ ║ ████╗ ████║██╔════╝██║ ██║ ├─┘│ ││││├┤ ├┬┘├┤ ││ ║
44
+ ║ ██╔████╔██║██║ ██║ ██║ ┴ └─┘└┴┘└─┘┴└─└─┘─┴┘ ║
45
+ ║ ██║╚██╔╝██║██║ ██║ ██║ ┌┐ ┬ ┬ ┬─┐┬ ┬┌─┐┌┬┐ ║
46
+ ║ ██║ ╚═╝ ██║╚██████╗███████╗██║ ├┴┐└┬┘ ├┬┘│ │└─┐ │ ║
47
+ ║ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚═╝ └─┘ ┴ ┴└─└─┘└─┘ ┴ ║
48
+ ╚════════════════════════════════════════════════════════════════╝
49
+ """
50
+
51
+ PERFORMANCE_BANNER = """
52
+ ⚡ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ⚡
53
+ ██████╗ ███████╗██████╗ ███████╗ ██████╗ ██████╗ ███╗ ███╗
54
+ ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔═══██╗██╔══██╗████╗ ████║
55
+ ██████╔╝█████╗ ██████╔╝█████╗ ██║ ██║██████╔╝██╔████╔██║
56
+ ██╔═══╝ ██╔══╝ ██╔══██╗██╔══╝ ██║ ██║██╔══██╗██║╚██╔╝██║
57
+ ██║ ███████╗██║ ██║██║ ╚██████╔╝██║ ██║██║ ╚═╝ ██║
58
+ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
59
+ ⚡ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ⚡
60
+ """
61
+
62
+ RUST_BANNER = """
63
+ 🦀 ┌─────────────────────────────────────────────────────────────┐ 🦀
64
+ │ ██████╗ ██╗ ██╗███████╗████████╗ │
65
+ │ ██╔══██╗██║ ██║██╔════╝╚══██╔══╝ │
66
+ │ ██████╔╝██║ ██║███████╗ ██║ │
67
+ │ ██╔══██╗██║ ██║╚════██║ ██║ │
68
+ │ ██║ ██║╚██████╔╝███████║ ██║ │
69
+ │ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ │
70
+ │ ███████╗██╗ ██╗████████╗███████╗███╗ ██╗ │
71
+ │ ██╔════╝╚██╗██╔╝╚══██╔══╝██╔════╝████╗ ██║ │
72
+ │ █████╗ ╚███╔╝ ██║ █████╗ ██╔██╗ ██║ │
73
+ │ ██╔══╝ ██╔██╗ ██║ ██╔══╝ ██║╚██╗██║ │
74
+ │ ███████╗██╔╝ ██╗ ██║ ███████╗██║ ╚████║ │
75
+ │ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ │
76
+ 🦀 └─────────────────────────────────────────────────────────────┘ 🦀
77
+ """
78
+
79
+ @classmethod
80
+ def show_main_banner(cls, subtitle: str = "Powered by Rust"):
81
+ """Display the main MCLI banner with gradient colors"""
82
+ console.print()
83
+
84
+ # Create gradient text effect
85
+ banner_text = Text(cls.MAIN_BANNER)
86
+ banner_text.stylize("bold magenta on black", 0, len(banner_text))
87
+
88
+ # Add subtitle
89
+ subtitle_text = Text(f" {subtitle}", style="bold cyan italic")
90
+
91
+ panel = Panel(
92
+ Align.center(Text.assemble(banner_text, "\n", subtitle_text)),
93
+ box=DOUBLE,
94
+ border_style="bright_blue",
95
+ padding=(1, 2),
96
+ )
97
+
98
+ console.print(panel)
99
+ console.print()
100
+
101
+ @classmethod
102
+ def show_performance_banner(cls):
103
+ """Display performance optimization banner"""
104
+ console.print()
105
+
106
+ banner_text = Text(cls.PERFORMANCE_BANNER)
107
+ banner_text.stylize("bold yellow on black")
108
+
109
+ panel = Panel(
110
+ Align.center(banner_text),
111
+ title="⚡ PERFORMANCE MODE ACTIVATED ⚡",
112
+ title_align="center",
113
+ box=HEAVY,
114
+ border_style="bright_yellow",
115
+ padding=(1, 2),
116
+ )
117
+
118
+ console.print(panel)
119
+
120
+ @classmethod
121
+ def show_rust_banner(cls):
122
+ """Display Rust extensions banner"""
123
+ console.print()
124
+
125
+ banner_text = Text(cls.RUST_BANNER)
126
+ banner_text.stylize("bold red on black")
127
+
128
+ panel = Panel(
129
+ Align.center(banner_text),
130
+ title="🦀 RUST EXTENSIONS LOADED 🦀",
131
+ title_align="center",
132
+ box=ROUNDED,
133
+ border_style="bright_red",
134
+ padding=(1, 2),
135
+ )
136
+
137
+ console.print(panel)
138
+
139
+
140
+ class AnimatedSpinner:
141
+ """Fancy animated spinners and loading indicators"""
142
+
143
+ SPINNERS = {
144
+ "rocket": ["🚀", "🌟", "⭐", "✨", "💫", "🌠"],
145
+ "gears": ["⚙️ ", "⚙️⚙️", "⚙️⚙️⚙️", "⚙️⚙️", "⚙️ ", " "],
146
+ "rust": ["🦀", "🔧", "⚡", "🔥", "💨", "✨"],
147
+ "matrix": ["│", "╱", "─", "╲"],
148
+ "dots": ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
149
+ "arrows": ["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"],
150
+ "lightning": ["⚡", "🌩️", "⚡", "🔥", "💥", "✨"],
151
+ }
152
+
153
+ def __init__(self, spinner_type: str = "rocket", speed: float = 0.1):
154
+ self.frames = self.SPINNERS.get(spinner_type, self.SPINNERS["rocket"])
155
+ self.speed = speed
156
+ self.running = False
157
+ self.thread = None
158
+
159
+ def start(self, message: str = "Loading..."):
160
+ """Start the animated spinner"""
161
+ self.running = True
162
+ self.thread = threading.Thread(target=self._animate, args=(message,))
163
+ self.thread.daemon = True
164
+ self.thread.start()
165
+
166
+ def stop(self):
167
+ """Stop the spinner"""
168
+ self.running = False
169
+ if self.thread:
170
+ self.thread.join()
171
+ # Clear the line
172
+ console.print("\r" + " " * 80 + "\r", end="")
173
+
174
+ def _animate(self, message: str):
175
+ """Animation loop"""
176
+ frame_idx = 0
177
+ while self.running:
178
+ frame = self.frames[frame_idx % len(self.frames)]
179
+ console.print(f"\r{frame} {message}", end="", style="bold cyan")
180
+ frame_idx += 1
181
+ time.sleep(self.speed)
182
+
183
+
184
+ class MCLIProgressBar:
185
+ """Enhanced progress bars with visual flair"""
186
+
187
+ @staticmethod
188
+ def create_fancy_progress():
189
+ """Create a fancy progress bar with multiple columns"""
190
+ return Progress(
191
+ SpinnerColumn("dots"),
192
+ TextColumn("[progress.description]{task.description}"),
193
+ BarColumn(complete_style="bright_green", finished_style="bright_blue"),
194
+ MofNCompleteColumn(),
195
+ "•",
196
+ TimeElapsedColumn(),
197
+ "•",
198
+ TimeRemainingColumn(),
199
+ console=console,
200
+ )
201
+
202
+ @staticmethod
203
+ def show_rust_compilation_progress():
204
+ """Simulate Rust compilation with progress"""
205
+ progress = MCLIProgressBar.create_fancy_progress()
206
+
207
+ with progress:
208
+ # Compilation stages
209
+ stages = [
210
+ ("Checking dependencies", 15),
211
+ ("Compiling core", 30),
212
+ ("Building TF-IDF module", 25),
213
+ ("Building file watcher", 20),
214
+ ("Building command matcher", 25),
215
+ ("Building process manager", 30),
216
+ ("Linking extensions", 15),
217
+ ("Optimizing release build", 20),
218
+ ]
219
+
220
+ for stage_name, duration in stages:
221
+ task = progress.add_task(f"🦀 {stage_name}...", total=duration)
222
+
223
+ for i in range(duration):
224
+ progress.update(task, advance=1)
225
+ time.sleep(0.1)
226
+
227
+ progress.remove_task(task)
228
+
229
+
230
+ class VisualTable:
231
+ """Enhanced tables with visual styling"""
232
+
233
+ @staticmethod
234
+ def create_performance_table(data: Dict[str, Any]) -> Table:
235
+ """Create a beautiful performance status table"""
236
+ table = Table(
237
+ title="🚀 Performance Optimization Status",
238
+ box=ROUNDED,
239
+ title_style="bold magenta",
240
+ header_style="bold cyan",
241
+ border_style="bright_blue",
242
+ )
243
+
244
+ table.add_column("Component", style="bold white", min_width=20)
245
+ table.add_column("Status", justify="center", min_width=10)
246
+ table.add_column("Performance Gain", style="green", min_width=25)
247
+ table.add_column("Details", style="dim white", min_width=30)
248
+
249
+ # Add rows with conditional styling
250
+ components = [
251
+ ("UVLoop", "uvloop", "2-4x async I/O"),
252
+ ("Rust Extensions", "rust", "10-100x compute"),
253
+ ("Redis Cache", "redis", "Caching speedup"),
254
+ ("Python Optimizations", "python", "Reduced overhead"),
255
+ ]
256
+
257
+ for name, key, gain in components:
258
+ status_data = data.get(key, {})
259
+ success = status_data.get("success", False)
260
+
261
+ status_emoji = "✅" if success else "❌"
262
+ status_text = "Active" if success else "Disabled"
263
+
264
+ details = (
265
+ status_data.get("reason", "Not available")
266
+ if not success
267
+ else status_data.get("reason", "Loaded successfully")
268
+ )
269
+
270
+ table.add_row(
271
+ name, f"{status_emoji} {status_text}", gain if success else "Baseline", details
272
+ )
273
+
274
+ return table
275
+
276
+ @staticmethod
277
+ def create_rust_extensions_table(extensions: Dict[str, bool]) -> Table:
278
+ """Create a table showing Rust extension status"""
279
+ table = Table(
280
+ title="🦀 Rust Extensions Status",
281
+ box=HEAVY,
282
+ title_style="bold red",
283
+ header_style="bold yellow",
284
+ border_style="bright_red",
285
+ )
286
+
287
+ table.add_column("Extension", style="bold white", min_width=20)
288
+ table.add_column("Status", justify="center", min_width=15)
289
+ table.add_column("Performance", style="green", min_width=20)
290
+ table.add_column("Use Case", style="cyan", min_width=25)
291
+
292
+ extensions_info = [
293
+ ("TF-IDF Vectorizer", "tfidf", "50-100x faster", "Text analysis & search"),
294
+ ("File Watcher", "file_watcher", "Native performance", "Real-time file monitoring"),
295
+ ("Command Matcher", "command_matcher", "Optimized algorithms", "Fuzzy command search"),
296
+ (
297
+ "Process Manager",
298
+ "process_manager",
299
+ "Async I/O with Tokio",
300
+ "Background task management",
301
+ ),
302
+ ]
303
+
304
+ for name, key, perf, use_case in extensions_info:
305
+ is_loaded = extensions.get(key, False)
306
+
307
+ status = "🦀 Loaded" if is_loaded else "❌ Failed"
308
+ status_style = "bold green" if is_loaded else "bold red"
309
+
310
+ table.add_row(
311
+ name,
312
+ f"[{status_style}]{status}[/{status_style}]",
313
+ perf if is_loaded else "Python fallback",
314
+ use_case,
315
+ )
316
+
317
+ return table
318
+
319
+
320
+ class LiveDashboard:
321
+ """Live updating dashboard for system status"""
322
+
323
+ def __init__(self):
324
+ self.console = Console()
325
+ self.running = False
326
+
327
+ def create_system_overview(self) -> Panel:
328
+ """Create a live system overview panel"""
329
+ try:
330
+ import psutil
331
+
332
+ # Get system info
333
+ cpu_percent = psutil.cpu_percent(interval=1)
334
+ memory = psutil.virtual_memory()
335
+ disk = psutil.disk_usage("/")
336
+
337
+ # Create content
338
+ overview = Text()
339
+ overview.append("🖥️ System Overview\n\n", style="bold cyan")
340
+ overview.append(f"CPU Usage: {cpu_percent:.1f}%\n", style="yellow")
341
+ overview.append(
342
+ f"Memory: {memory.percent:.1f}% ({memory.available // (1024**3):.1f}GB free)\n",
343
+ style="green",
344
+ )
345
+ overview.append(f"Disk: {disk.free // (1024**3):.1f}GB free\n", style="blue")
346
+
347
+ return Panel(overview, box=ROUNDED, border_style="bright_cyan", padding=(1, 2))
348
+
349
+ except ImportError:
350
+ return Panel(
351
+ "System monitoring requires psutil\nInstall with: pip install psutil",
352
+ title="System Info Unavailable",
353
+ border_style="yellow",
354
+ )
355
+
356
+ def create_mcli_status_panel(self) -> Panel:
357
+ """Create MCLI status overview panel"""
358
+ try:
359
+ import platform
360
+
361
+ status = Text()
362
+ status.append("🚀 MCLI Status\n\n", style="bold magenta")
363
+
364
+ # Version info
365
+ try:
366
+ from importlib.metadata import version
367
+
368
+ mcli_version = version("mcli")
369
+ status.append(f"Version: {mcli_version}\n", style="cyan")
370
+ except Exception:
371
+ status.append("Version: Development\n", style="cyan")
372
+
373
+ # Platform info
374
+ status.append(f"Platform: {platform.system()} {platform.machine()}\n", style="blue")
375
+ status.append(f"Python: {platform.python_version()}\n", style="green")
376
+
377
+ # Performance status
378
+ try:
379
+ from mcli.lib.performance.rust_bridge import check_rust_extensions
380
+
381
+ rust_available = check_rust_extensions()
382
+ if rust_available:
383
+ status.append("⚡ Rust Extensions: Active\n", style="bright_green")
384
+ else:
385
+ status.append("🐍 Rust Extensions: Fallback to Python\n", style="yellow")
386
+ except Exception:
387
+ status.append("🔧 Performance Status: Unknown\n", style="dim")
388
+
389
+ return Panel(status, box=ROUNDED, border_style="bright_magenta", padding=(1, 2))
390
+
391
+ except Exception as e:
392
+ return Panel(
393
+ f"Error getting MCLI status: {str(e)}",
394
+ title="MCLI Status Error",
395
+ border_style="red",
396
+ )
397
+
398
+ def create_services_panel(self) -> Panel:
399
+ """Create services status panel"""
400
+ services = Text()
401
+ services.append("🔧 Services Status\n\n", style="bold yellow")
402
+
403
+ # Check daemon status
404
+ try:
405
+ from mcli.lib.api.daemon_client import get_daemon_client
406
+
407
+ daemon = get_daemon_client()
408
+ if daemon.is_running():
409
+ services.append("✅ MCLI Daemon: Running\n", style="green")
410
+ else:
411
+ services.append("❌ MCLI Daemon: Stopped\n", style="red")
412
+ except Exception:
413
+ services.append("⚠️ MCLI Daemon: Unknown\n", style="yellow")
414
+
415
+ # Check Ollama status
416
+ try:
417
+ import requests
418
+
419
+ response = requests.get("http://localhost:11434/api/tags", timeout=2)
420
+ if response.status_code == 200:
421
+ services.append("✅ Ollama: Running\n", style="green")
422
+ else:
423
+ services.append("❌ Ollama: Not responding\n", style="red")
424
+ except Exception:
425
+ services.append("❌ Ollama: Not running\n", style="red")
426
+
427
+ return Panel(services, box=ROUNDED, border_style="bright_yellow", padding=(1, 2))
428
+
429
+ def create_recent_activity_panel(self) -> Panel:
430
+ """Create recent activity panel"""
431
+ activity = Text()
432
+ activity.append("📊 Recent Activity\n\n", style="bold blue")
433
+
434
+ # This would typically read from logs or activity history
435
+ activity.append("• Started chat session at 14:32\n", style="dim")
436
+ activity.append("• Executed 'mcli self performance' at 14:30\n", style="dim")
437
+ activity.append("• Daemon started at 14:25\n", style="dim")
438
+ activity.append("• Last command execution: SUCCESS\n", style="green")
439
+
440
+ return Panel(activity, box=ROUNDED, border_style="bright_blue", padding=(1, 2))
441
+
442
+ def create_full_dashboard(self):
443
+ """Create a complete dashboard layout"""
444
+ from rich.layout import Layout
445
+
446
+ layout = Layout()
447
+
448
+ # Create main sections
449
+ layout.split_column(
450
+ Layout(name="header", size=3),
451
+ Layout(name="main", ratio=1),
452
+ Layout(name="footer", size=3),
453
+ )
454
+
455
+ # Split main section
456
+ layout["main"].split_row(Layout(name="left"), Layout(name="right"))
457
+
458
+ # Split left and right sections
459
+ layout["left"].split_column(Layout(name="system"), Layout(name="mcli"))
460
+
461
+ layout["right"].split_column(Layout(name="services"), Layout(name="activity"))
462
+
463
+ # Add content to each section
464
+ layout["header"].update(Panel("🚀 MCLI Live Dashboard", style="bold cyan"))
465
+ layout["system"].update(self.create_system_overview())
466
+ layout["mcli"].update(self.create_mcli_status_panel())
467
+ layout["services"].update(self.create_services_panel())
468
+ layout["activity"].update(self.create_recent_activity_panel())
469
+
470
+ from datetime import datetime
471
+
472
+ layout["footer"].update(
473
+ Panel(f"Last updated: {datetime.now().strftime('%H:%M:%S')}", style="dim")
474
+ )
475
+
476
+ return layout
477
+
478
+ def start_live_dashboard(self, refresh_interval: float = 2.0):
479
+ """Start the live updating dashboard"""
480
+ import threading
481
+ import time
482
+
483
+ self.running = True
484
+
485
+ def update_loop():
486
+ while self.running:
487
+ try:
488
+ with self.console:
489
+ self.console.clear()
490
+ dashboard = self.create_full_dashboard()
491
+ self.console.print(dashboard)
492
+ time.sleep(refresh_interval)
493
+ except KeyboardInterrupt:
494
+ self.running = False
495
+ break
496
+ except Exception as e:
497
+ self.console.print(f"Dashboard error: {e}")
498
+ time.sleep(refresh_interval)
499
+
500
+ try:
501
+ self.console.print("Starting MCLI Live Dashboard... Press Ctrl+C to exit")
502
+ update_loop()
503
+ except KeyboardInterrupt:
504
+ self.console.print("\n[yellow]Dashboard stopped by user[/yellow]")
505
+ finally:
506
+ self.running = False
507
+
508
+ def stop_dashboard(self):
509
+ """Stop the live dashboard"""
510
+ self.running = False
511
+
512
+
513
+ class ColorfulOutput:
514
+ """Enhanced colorful output utilities"""
515
+
516
+ @staticmethod
517
+ def success(message: str, icon: str = "✅"):
518
+ """Display a success message with style"""
519
+ panel = Panel(f"{icon} {message}", box=ROUNDED, border_style="bright_green", padding=(0, 1))
520
+ console.print(panel)
521
+
522
+ @staticmethod
523
+ def error(message: str, icon: str = "❌"):
524
+ """Display an error message with style"""
525
+ panel = Panel(f"{icon} {message}", box=HEAVY, border_style="bright_red", padding=(0, 1))
526
+ console.print(panel)
527
+
528
+ @staticmethod
529
+ def info(message: str, icon: str = "ℹ️"):
530
+ """Display an info message with style"""
531
+ panel = Panel(f"{icon} {message}", box=ROUNDED, border_style="bright_cyan", padding=(0, 1))
532
+ console.print(panel)
533
+
534
+ @staticmethod
535
+ def warning(message: str, icon: str = "⚠️"):
536
+ """Display a warning message with style"""
537
+ panel = Panel(
538
+ f"{icon} {message}", box=ROUNDED, border_style="bright_yellow", padding=(0, 1)
539
+ )
540
+ console.print(panel)
541
+
542
+
543
+ class StartupSequence:
544
+ """Fancy startup sequence with animations"""
545
+
546
+ @staticmethod
547
+ def run_startup_animation():
548
+ """Run the full startup sequence"""
549
+ console.clear()
550
+
551
+ # Show main banner
552
+ MCLIBanner.show_main_banner("Next-Generation CLI Tool")
553
+
554
+ # Animated loading
555
+ spinner = AnimatedSpinner("rocket", 0.15)
556
+ spinner.start("Initializing MCLI systems...")
557
+ time.sleep(2)
558
+ spinner.stop()
559
+
560
+ ColorfulOutput.success("Core systems initialized")
561
+
562
+ # Show performance optimizations
563
+ spinner = AnimatedSpinner("gears", 0.1)
564
+ spinner.start("Applying performance optimizations...")
565
+ time.sleep(1.5)
566
+ spinner.stop()
567
+
568
+ ColorfulOutput.success("Performance optimizations applied")
569
+
570
+ # Rust extensions check
571
+ spinner = AnimatedSpinner("rust", 0.12)
572
+ spinner.start("Loading Rust extensions...")
573
+ time.sleep(1)
574
+ spinner.stop()
575
+
576
+ ColorfulOutput.success("Rust extensions loaded successfully")
577
+
578
+ console.print()
579
+ console.print(Rule("🚀 MCLI Ready for Action! 🚀", style="bright_green"))
580
+ console.print()
581
+
582
+
583
+ def demo_visual_effects():
584
+ """Demonstrate all visual effects"""
585
+ console.clear()
586
+
587
+ # Show banners
588
+ MCLIBanner.show_main_banner()
589
+ time.sleep(1)
590
+
591
+ MCLIBanner.show_performance_banner()
592
+ time.sleep(1)
593
+
594
+ MCLIBanner.show_rust_banner()
595
+ time.sleep(1)
596
+
597
+ # Show tables
598
+ console.print("\n")
599
+ sample_data = {
600
+ "uvloop": {"success": True, "reason": "Loaded successfully"},
601
+ "rust": {
602
+ "success": True,
603
+ "extensions": {
604
+ "tfidf": True,
605
+ "file_watcher": True,
606
+ "command_matcher": True,
607
+ "process_manager": True,
608
+ },
609
+ },
610
+ "redis": {"success": False, "reason": "Redis server not available"},
611
+ "python": {"success": True, "optimizations": {"gc_tuned": True}},
612
+ }
613
+
614
+ table = VisualTable.create_performance_table(sample_data)
615
+ console.print(table)
616
+
617
+ console.print("\n")
618
+ rust_table = VisualTable.create_rust_extensions_table(
619
+ {"tfidf": True, "file_watcher": True, "command_matcher": False, "process_manager": True}
620
+ )
621
+ console.print(rust_table)
622
+
623
+ # Test messages
624
+ console.print("\n")
625
+ ColorfulOutput.success("All systems operational!")
626
+ ColorfulOutput.warning("Redis cache not available")
627
+ ColorfulOutput.info("System ready for commands")
628
+
629
+ console.print("\n")
630
+ console.print(Rule("Demo Complete", style="bright_magenta"))
631
+
632
+
633
+ if __name__ == "__main__":
634
+ demo_visual_effects()