mcli-framework 7.12.1__py3-none-any.whl → 7.12.3__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 (216) hide show
  1. mcli/app/__init__.py +0 -2
  2. mcli/app/commands_cmd.py +19 -23
  3. mcli/app/completion_helpers.py +5 -5
  4. mcli/app/init_cmd.py +10 -10
  5. mcli/app/lock_cmd.py +82 -27
  6. mcli/app/main.py +2 -8
  7. mcli/app/model/model.py +5 -10
  8. mcli/app/store_cmd.py +8 -8
  9. mcli/app/video/__init__.py +0 -2
  10. mcli/app/video/video.py +1 -14
  11. mcli/chat/chat.py +90 -108
  12. mcli/chat/command_rag.py +0 -4
  13. mcli/chat/enhanced_chat.py +32 -41
  14. mcli/chat/system_controller.py +37 -37
  15. mcli/chat/system_integration.py +4 -5
  16. mcli/cli.py +2 -3
  17. mcli/lib/api/api.py +4 -9
  18. mcli/lib/api/daemon_client.py +19 -20
  19. mcli/lib/api/daemon_client_local.py +1 -3
  20. mcli/lib/api/daemon_decorator.py +6 -6
  21. mcli/lib/api/mcli_decorators.py +4 -8
  22. mcli/lib/auth/__init__.py +0 -1
  23. mcli/lib/auth/auth.py +4 -5
  24. mcli/lib/auth/mcli_manager.py +7 -12
  25. mcli/lib/auth/token_util.py +5 -5
  26. mcli/lib/config/__init__.py +29 -1
  27. mcli/lib/config/config.py +0 -1
  28. mcli/lib/custom_commands.py +1 -1
  29. mcli/lib/discovery/command_discovery.py +15 -15
  30. mcli/lib/erd/erd.py +7 -7
  31. mcli/lib/files/files.py +1 -1
  32. mcli/lib/fs/__init__.py +31 -1
  33. mcli/lib/fs/fs.py +12 -13
  34. mcli/lib/lib.py +0 -1
  35. mcli/lib/logger/logger.py +7 -10
  36. mcli/lib/performance/optimizer.py +25 -27
  37. mcli/lib/performance/rust_bridge.py +22 -27
  38. mcli/lib/performance/uvloop_config.py +0 -1
  39. mcli/lib/pickles/__init__.py +0 -1
  40. mcli/lib/pickles/pickles.py +0 -2
  41. mcli/lib/secrets/commands.py +0 -2
  42. mcli/lib/secrets/manager.py +0 -1
  43. mcli/lib/secrets/repl.py +2 -3
  44. mcli/lib/secrets/store.py +1 -2
  45. mcli/lib/services/data_pipeline.py +34 -34
  46. mcli/lib/services/lsh_client.py +38 -40
  47. mcli/lib/shell/shell.py +2 -2
  48. mcli/lib/toml/__init__.py +0 -1
  49. mcli/lib/ui/styling.py +0 -1
  50. mcli/lib/ui/visual_effects.py +33 -41
  51. mcli/lib/watcher/watcher.py +0 -1
  52. mcli/ml/__init__.py +1 -1
  53. mcli/ml/api/__init__.py +1 -1
  54. mcli/ml/api/app.py +8 -9
  55. mcli/ml/api/middleware.py +10 -10
  56. mcli/ml/api/routers/__init__.py +1 -1
  57. mcli/ml/api/routers/admin_router.py +3 -3
  58. mcli/ml/api/routers/auth_router.py +17 -18
  59. mcli/ml/api/routers/backtest_router.py +2 -2
  60. mcli/ml/api/routers/data_router.py +2 -2
  61. mcli/ml/api/routers/model_router.py +14 -15
  62. mcli/ml/api/routers/monitoring_router.py +2 -2
  63. mcli/ml/api/routers/portfolio_router.py +2 -2
  64. mcli/ml/api/routers/prediction_router.py +10 -9
  65. mcli/ml/api/routers/trade_router.py +2 -2
  66. mcli/ml/api/routers/websocket_router.py +6 -7
  67. mcli/ml/api/schemas.py +2 -2
  68. mcli/ml/auth/__init__.py +1 -1
  69. mcli/ml/auth/auth_manager.py +22 -23
  70. mcli/ml/auth/models.py +17 -17
  71. mcli/ml/auth/permissions.py +17 -17
  72. mcli/ml/backtesting/__init__.py +1 -1
  73. mcli/ml/backtesting/backtest_engine.py +31 -35
  74. mcli/ml/backtesting/performance_metrics.py +12 -14
  75. mcli/ml/backtesting/run.py +1 -2
  76. mcli/ml/cache.py +35 -36
  77. mcli/ml/cli/__init__.py +1 -1
  78. mcli/ml/cli/main.py +21 -24
  79. mcli/ml/config/__init__.py +1 -1
  80. mcli/ml/config/settings.py +28 -29
  81. mcli/ml/configs/__init__.py +1 -1
  82. mcli/ml/configs/dvc_config.py +14 -15
  83. mcli/ml/configs/mlflow_config.py +12 -13
  84. mcli/ml/configs/mlops_manager.py +19 -21
  85. mcli/ml/dashboard/__init__.py +4 -4
  86. mcli/ml/dashboard/app.py +20 -30
  87. mcli/ml/dashboard/app_supabase.py +16 -19
  88. mcli/ml/dashboard/app_training.py +11 -14
  89. mcli/ml/dashboard/cli.py +2 -2
  90. mcli/ml/dashboard/common.py +2 -3
  91. mcli/ml/dashboard/components/__init__.py +1 -1
  92. mcli/ml/dashboard/components/charts.py +13 -11
  93. mcli/ml/dashboard/components/metrics.py +7 -7
  94. mcli/ml/dashboard/components/tables.py +12 -9
  95. mcli/ml/dashboard/overview.py +2 -2
  96. mcli/ml/dashboard/pages/__init__.py +1 -1
  97. mcli/ml/dashboard/pages/cicd.py +15 -18
  98. mcli/ml/dashboard/pages/debug_dependencies.py +7 -7
  99. mcli/ml/dashboard/pages/monte_carlo_predictions.py +11 -18
  100. mcli/ml/dashboard/pages/predictions_enhanced.py +24 -32
  101. mcli/ml/dashboard/pages/scrapers_and_logs.py +22 -24
  102. mcli/ml/dashboard/pages/test_portfolio.py +3 -6
  103. mcli/ml/dashboard/pages/trading.py +16 -18
  104. mcli/ml/dashboard/pages/workflows.py +20 -30
  105. mcli/ml/dashboard/utils.py +9 -9
  106. mcli/ml/dashboard/warning_suppression.py +3 -3
  107. mcli/ml/data_ingestion/__init__.py +1 -1
  108. mcli/ml/data_ingestion/api_connectors.py +41 -46
  109. mcli/ml/data_ingestion/data_pipeline.py +36 -46
  110. mcli/ml/data_ingestion/stream_processor.py +43 -46
  111. mcli/ml/database/__init__.py +1 -1
  112. mcli/ml/database/migrations/env.py +2 -2
  113. mcli/ml/database/models.py +22 -24
  114. mcli/ml/database/session.py +14 -14
  115. mcli/ml/experimentation/__init__.py +1 -1
  116. mcli/ml/experimentation/ab_testing.py +45 -46
  117. mcli/ml/features/__init__.py +1 -1
  118. mcli/ml/features/ensemble_features.py +22 -27
  119. mcli/ml/features/recommendation_engine.py +30 -30
  120. mcli/ml/features/stock_features.py +29 -32
  121. mcli/ml/features/test_feature_engineering.py +10 -11
  122. mcli/ml/logging.py +4 -4
  123. mcli/ml/mlops/__init__.py +1 -1
  124. mcli/ml/mlops/data_versioning.py +29 -30
  125. mcli/ml/mlops/experiment_tracker.py +24 -24
  126. mcli/ml/mlops/model_serving.py +31 -34
  127. mcli/ml/mlops/pipeline_orchestrator.py +27 -35
  128. mcli/ml/models/__init__.py +5 -6
  129. mcli/ml/models/base_models.py +23 -23
  130. mcli/ml/models/ensemble_models.py +31 -31
  131. mcli/ml/models/recommendation_models.py +18 -19
  132. mcli/ml/models/test_models.py +14 -16
  133. mcli/ml/monitoring/__init__.py +1 -1
  134. mcli/ml/monitoring/drift_detection.py +32 -36
  135. mcli/ml/monitoring/metrics.py +2 -2
  136. mcli/ml/optimization/__init__.py +1 -1
  137. mcli/ml/optimization/optimize.py +1 -2
  138. mcli/ml/optimization/portfolio_optimizer.py +30 -32
  139. mcli/ml/predictions/__init__.py +1 -1
  140. mcli/ml/preprocessing/__init__.py +1 -1
  141. mcli/ml/preprocessing/data_cleaners.py +22 -23
  142. mcli/ml/preprocessing/feature_extractors.py +23 -26
  143. mcli/ml/preprocessing/ml_pipeline.py +23 -23
  144. mcli/ml/preprocessing/test_preprocessing.py +7 -8
  145. mcli/ml/scripts/populate_sample_data.py +0 -4
  146. mcli/ml/serving/serve.py +1 -2
  147. mcli/ml/tasks.py +17 -17
  148. mcli/ml/tests/test_integration.py +29 -30
  149. mcli/ml/tests/test_training_dashboard.py +21 -21
  150. mcli/ml/trading/__init__.py +1 -1
  151. mcli/ml/trading/migrations.py +5 -5
  152. mcli/ml/trading/models.py +21 -23
  153. mcli/ml/trading/paper_trading.py +16 -13
  154. mcli/ml/trading/risk_management.py +17 -18
  155. mcli/ml/trading/trading_service.py +25 -28
  156. mcli/ml/training/__init__.py +1 -1
  157. mcli/ml/training/train.py +0 -1
  158. mcli/public/oi/oi.py +1 -2
  159. mcli/self/completion_cmd.py +6 -10
  160. mcli/self/logs_cmd.py +19 -24
  161. mcli/self/migrate_cmd.py +22 -20
  162. mcli/self/redis_cmd.py +10 -11
  163. mcli/self/self_cmd.py +10 -18
  164. mcli/self/store_cmd.py +10 -12
  165. mcli/self/visual_cmd.py +9 -14
  166. mcli/self/zsh_cmd.py +2 -4
  167. mcli/workflow/daemon/async_command_database.py +23 -24
  168. mcli/workflow/daemon/async_process_manager.py +27 -29
  169. mcli/workflow/daemon/client.py +27 -33
  170. mcli/workflow/daemon/daemon.py +32 -36
  171. mcli/workflow/daemon/enhanced_daemon.py +24 -33
  172. mcli/workflow/daemon/process_cli.py +11 -12
  173. mcli/workflow/daemon/process_manager.py +23 -26
  174. mcli/workflow/daemon/test_daemon.py +4 -5
  175. mcli/workflow/dashboard/dashboard_cmd.py +0 -1
  176. mcli/workflow/doc_convert.py +15 -17
  177. mcli/workflow/gcloud/__init__.py +0 -1
  178. mcli/workflow/gcloud/gcloud.py +11 -8
  179. mcli/workflow/git_commit/ai_service.py +14 -15
  180. mcli/workflow/lsh_integration.py +9 -11
  181. mcli/workflow/model_service/client.py +26 -31
  182. mcli/workflow/model_service/download_and_run_efficient_models.py +10 -14
  183. mcli/workflow/model_service/lightweight_embedder.py +25 -35
  184. mcli/workflow/model_service/lightweight_model_server.py +26 -32
  185. mcli/workflow/model_service/lightweight_test.py +7 -10
  186. mcli/workflow/model_service/model_service.py +80 -91
  187. mcli/workflow/model_service/ollama_efficient_runner.py +14 -18
  188. mcli/workflow/model_service/openai_adapter.py +23 -23
  189. mcli/workflow/model_service/pdf_processor.py +21 -26
  190. mcli/workflow/model_service/test_efficient_runner.py +12 -16
  191. mcli/workflow/model_service/test_example.py +11 -13
  192. mcli/workflow/model_service/test_integration.py +3 -5
  193. mcli/workflow/model_service/test_new_features.py +7 -8
  194. mcli/workflow/notebook/converter.py +1 -1
  195. mcli/workflow/notebook/notebook_cmd.py +5 -6
  196. mcli/workflow/notebook/schema.py +0 -1
  197. mcli/workflow/notebook/validator.py +7 -3
  198. mcli/workflow/openai/openai.py +1 -2
  199. mcli/workflow/registry/registry.py +4 -1
  200. mcli/workflow/repo/repo.py +6 -7
  201. mcli/workflow/scheduler/cron_parser.py +16 -19
  202. mcli/workflow/scheduler/job.py +10 -10
  203. mcli/workflow/scheduler/monitor.py +15 -15
  204. mcli/workflow/scheduler/persistence.py +17 -18
  205. mcli/workflow/scheduler/scheduler.py +37 -38
  206. mcli/workflow/secrets/__init__.py +1 -1
  207. mcli/workflow/sync/test_cmd.py +0 -1
  208. mcli/workflow/wakatime/__init__.py +5 -9
  209. mcli/workflow/wakatime/wakatime.py +1 -2
  210. {mcli_framework-7.12.1.dist-info → mcli_framework-7.12.3.dist-info}/METADATA +1 -1
  211. mcli_framework-7.12.3.dist-info/RECORD +279 -0
  212. mcli_framework-7.12.1.dist-info/RECORD +0 -279
  213. {mcli_framework-7.12.1.dist-info → mcli_framework-7.12.3.dist-info}/WHEEL +0 -0
  214. {mcli_framework-7.12.1.dist-info → mcli_framework-7.12.3.dist-info}/entry_points.txt +0 -0
  215. {mcli_framework-7.12.1.dist-info → mcli_framework-7.12.3.dist-info}/licenses/LICENSE +0 -0
  216. {mcli_framework-7.12.1.dist-info → mcli_framework-7.12.3.dist-info}/top_level.txt +0 -0
mcli/self/self_cmd.py CHANGED
@@ -9,7 +9,6 @@ import inspect
9
9
  import json
10
10
  import os
11
11
  import platform
12
- import re
13
12
  import sys
14
13
  import time
15
14
  from datetime import datetime
@@ -21,7 +20,6 @@ from typing import Any, Dict, List, Optional
21
20
  import click
22
21
  import tomli
23
22
  from rich.console import Console
24
- from rich.prompt import Prompt
25
23
  from rich.table import Table
26
24
 
27
25
  try:
@@ -33,7 +31,6 @@ try:
33
31
  except ImportError:
34
32
  process = None
35
33
 
36
- from mcli.lib.custom_commands import get_command_manager
37
34
  from mcli.lib.logger.logger import get_logger
38
35
 
39
36
  logger = get_logger()
@@ -45,7 +42,6 @@ def self_app():
45
42
  """
46
43
  Self-management commands for mcli.
47
44
  """
48
- pass
49
45
 
50
46
 
51
47
  console = Console()
@@ -93,7 +89,7 @@ def get_version_info(verbose: bool = False) -> str:
93
89
 
94
90
 
95
91
  def get_current_command_state():
96
- """Collect all command metadata (names, groups, etc.)"""
92
+ """Collect all command metadata (names, groups, etc.)."""
97
93
  # This should use your actual command collection logic
98
94
  # For now, use the collect_commands() function
99
95
  return collect_commands()
@@ -247,8 +243,6 @@ def collect_commands() -> List[Dict[str, Any]]:
247
243
  try:
248
244
  # Suppress Streamlit warnings and logging during module import
249
245
  import logging
250
- import os
251
- import sys
252
246
  import warnings
253
247
  from contextlib import redirect_stderr
254
248
  from io import StringIO
@@ -285,7 +279,7 @@ def collect_commands() -> List[Dict[str, Any]]:
285
279
  streamlit_logger.setLevel(original_level)
286
280
 
287
281
  # Extract command and group objects
288
- for name, obj in inspect.getmembers(module):
282
+ for _name, obj in inspect.getmembers(module):
289
283
  # Handle Click commands and groups
290
284
  if isinstance(obj, click.Command):
291
285
  if isinstance(obj, click.Group):
@@ -342,7 +336,6 @@ def open_editor_for_command(
342
336
  import subprocess
343
337
  import sys
344
338
  import tempfile
345
- from pathlib import Path
346
339
 
347
340
  # Get the user's default editor
348
341
  editor = os.environ.get("EDITOR")
@@ -470,7 +463,7 @@ logger = get_logger()
470
463
  return None
471
464
  finally:
472
465
  # Clean up temporary file
473
- try:
466
+ try: # noqa: SIM105
474
467
  os.unlink(temp_file_path)
475
468
  except OSError:
476
469
  pass
@@ -487,7 +480,6 @@ def plugin():
487
480
  Use one of the subcommands: add, remove, update.
488
481
  """
489
482
  logger.info("Plugin management commands loaded")
490
- pass
491
483
 
492
484
 
493
485
  @plugin.command("add")
@@ -732,7 +724,7 @@ def logs():
732
724
  @click.option("--detailed", "-d", is_flag=True, help="Show detailed performance information")
733
725
  @click.option("--benchmark", "-b", is_flag=True, help="Run performance benchmarks")
734
726
  def performance(detailed: bool, benchmark: bool):
735
- """🚀 Show performance optimization status and benchmarks"""
727
+ """🚀 Show performance optimization status and benchmarks."""
736
728
  try:
737
729
  from mcli.lib.performance.optimizer import get_global_optimizer
738
730
  from mcli.lib.performance.rust_bridge import print_performance_summary
@@ -784,7 +776,7 @@ def performance(detailed: bool, benchmark: bool):
784
776
  optimizer = get_global_optimizer()
785
777
 
786
778
  # Update progress
787
- for i in range(20):
779
+ for _i in range(20):
788
780
  progress.update(task, advance=5)
789
781
  time.sleep(0.05)
790
782
 
@@ -806,7 +798,7 @@ def performance(detailed: bool, benchmark: bool):
806
798
 
807
799
  system_info = benchmark_results.get("system_info", {})
808
800
  if system_info:
809
- console.print(f"\n💻 System Info:")
801
+ console.print("\n💻 System Info:")
810
802
  console.print(f" Platform: {system_info.get('platform', 'Unknown')}")
811
803
  console.print(f" CPUs: {system_info.get('cpu_count', 'Unknown')}")
812
804
  console.print(
@@ -828,7 +820,7 @@ def performance(detailed: bool, benchmark: bool):
828
820
  @click.option("--refresh", "-r", default=2.0, help="Refresh interval in seconds")
829
821
  @click.option("--once", is_flag=True, help="Show dashboard once and exit")
830
822
  def dashboard(refresh: float, once: bool):
831
- """📊 Launch live system dashboard"""
823
+ """📊 Launch live system dashboard."""
832
824
  try:
833
825
  from mcli.lib.ui.visual_effects import LiveDashboard
834
826
 
@@ -895,7 +887,7 @@ def check_ci_status(version: str) -> tuple[bool, Optional[str]]:
895
887
  @click.option("--yes", "-y", is_flag=True, help="Skip confirmation prompt")
896
888
  @click.option("--skip-ci-check", is_flag=True, help="Skip CI status check and install anyway")
897
889
  def update(check: bool, pre: bool, yes: bool, skip_ci_check: bool):
898
- """🔄 Check for and install mcli updates from PyPI"""
890
+ """🔄 Check for and install mcli updates from PyPI."""
899
891
  import subprocess
900
892
  import sys
901
893
  from importlib.metadata import version as get_version
@@ -950,7 +942,7 @@ def update(check: bool, pre: bool, yes: bool, skip_ci_check: bool):
950
942
  def parse_version(v):
951
943
  try:
952
944
  return tuple(int(x) for x in v.split(".") if x.isdigit())
953
- except:
945
+ except Exception:
954
946
  return (0, 0, 0)
955
947
 
956
948
  current_parsed = parse_version(current_version)
@@ -1043,7 +1035,7 @@ def update(check: bool, pre: bool, yes: bool, skip_ci_check: bool):
1043
1035
  "[yellow]ℹ️ Restart your terminal or run 'hash -r' to use the new version[/yellow]"
1044
1036
  )
1045
1037
  else:
1046
- console.print(f"[red]❌ Update failed:[/red]")
1038
+ console.print("[red]❌ Update failed:[/red]")
1047
1039
  console.print(result.stderr)
1048
1040
 
1049
1041
  except Exception as e:
mcli/self/store_cmd.py CHANGED
@@ -3,7 +3,6 @@ Command Store Management - Sync ~/.mcli/commands/ to git
3
3
  Similar to lsh secrets but for workflow commands
4
4
  """
5
5
 
6
- import os
7
6
  import shutil
8
7
  import subprocess
9
8
  from datetime import datetime
@@ -23,15 +22,14 @@ COMMANDS_PATH = Path.home() / ".mcli" / "commands"
23
22
 
24
23
  @click.group(name="store")
25
24
  def store():
26
- """Manage command store - sync ~/.mcli/commands/ to git"""
27
- pass
25
+ """Manage command store - sync ~/.mcli/commands/ to git."""
28
26
 
29
27
 
30
28
  @store.command(name="init")
31
29
  @click.option("--path", "-p", type=click.Path(), help=f"Store path (default: {DEFAULT_STORE_PATH})")
32
30
  @click.option("--remote", "-r", help="Git remote URL (optional)")
33
31
  def init_store(path, remote):
34
- """Initialize command store with git"""
32
+ """Initialize command store with git."""
35
33
  store_path = Path(path) if path else DEFAULT_STORE_PATH
36
34
 
37
35
  try:
@@ -109,7 +107,7 @@ Last updated: {datetime.now().isoformat()}
109
107
  @click.option("--message", "-m", help="Commit message")
110
108
  @click.option("--all", "-a", is_flag=True, help="Push all files (including backups)")
111
109
  def push_commands(message, all):
112
- """Push commands from ~/.mcli/commands/ to git store"""
110
+ """Push commands from ~/.mcli/commands/ to git store."""
113
111
  try:
114
112
  store_path = _get_store_path()
115
113
 
@@ -164,7 +162,7 @@ def push_commands(message, all):
164
162
  @store.command(name="pull")
165
163
  @click.option("--force", "-f", is_flag=True, help="Overwrite local commands without backup")
166
164
  def pull_commands(force):
167
- """Pull commands from git store to ~/.mcli/commands/"""
165
+ """Pull commands from git store to ~/.mcli/commands/."""
168
166
  try:
169
167
  store_path = _get_store_path()
170
168
 
@@ -212,7 +210,7 @@ def pull_commands(force):
212
210
  @store.command(name="sync")
213
211
  @click.option("--message", "-m", help="Commit message if pushing")
214
212
  def sync_commands(message):
215
- """Sync commands bidirectionally (pull then push if changes)"""
213
+ """Sync commands bidirectionally (pull then push if changes)."""
216
214
  try:
217
215
  store_path = _get_store_path()
218
216
 
@@ -265,7 +263,7 @@ def sync_commands(message):
265
263
  @store.command(name="list")
266
264
  @click.option("--store", "-s", is_flag=True, help="List store instead of local")
267
265
  def list_commands(store):
268
- """List all commands"""
266
+ """List all commands."""
269
267
  try:
270
268
  if store:
271
269
  store_path = _get_store_path()
@@ -307,7 +305,7 @@ def list_commands(store):
307
305
 
308
306
  @store.command(name="status")
309
307
  def store_status():
310
- """Show git status of command store"""
308
+ """Show git status of command store."""
311
309
  try:
312
310
  store_path = _get_store_path()
313
311
 
@@ -343,7 +341,7 @@ def store_status():
343
341
  @click.argument("command_name")
344
342
  @click.option("--store", "-s", is_flag=True, help="Show from store instead of local")
345
343
  def show_command(command_name, store):
346
- """Show command file contents"""
344
+ """Show command file contents."""
347
345
  try:
348
346
  if store:
349
347
  store_path = _get_store_path()
@@ -374,7 +372,7 @@ def show_command(command_name, store):
374
372
  @click.option("--remote", "-r", help="Set git remote URL")
375
373
  @click.option("--path", "-p", type=click.Path(), help="Change store path")
376
374
  def configure_store(remote, path):
377
- """Configure store settings"""
375
+ """Configure store settings."""
378
376
  try:
379
377
  store_path = _get_store_path()
380
378
 
@@ -408,7 +406,7 @@ def configure_store(remote, path):
408
406
 
409
407
 
410
408
  def _get_store_path() -> Path:
411
- """Get store path from config or default"""
409
+ """Get store path from config or default."""
412
410
  config_file = Path.home() / ".mcli" / "store.conf"
413
411
 
414
412
  if config_file.exists():
mcli/self/visual_cmd.py CHANGED
@@ -14,8 +14,7 @@ logger = get_logger(__name__)
14
14
 
15
15
  @click.group()
16
16
  def visual():
17
- """🎨 Visual effects and enhancements showcase"""
18
- pass
17
+ """🎨 Visual effects and enhancements showcase."""
19
18
 
20
19
 
21
20
  @visual.command()
@@ -26,10 +25,9 @@ def visual():
26
25
  help="Type of visual demo to run",
27
26
  )
28
27
  def demo(demo_type: str):
29
- """🎭 Demonstrate MCLI's visual capabilities"""
28
+ """🎭 Demonstrate MCLI's visual capabilities."""
30
29
  try:
31
30
  from rich.rule import Rule
32
- from rich.text import Text
33
31
 
34
32
  from mcli.lib.ui.styling import celebrate
35
33
  from mcli.lib.ui.visual_effects import (
@@ -37,10 +35,8 @@ def demo(demo_type: str):
37
35
  ColorfulOutput,
38
36
  MCLIBanner,
39
37
  MCLIProgressBar,
40
- StartupSequence,
41
38
  VisualTable,
42
39
  console,
43
- demo_visual_effects,
44
40
  )
45
41
 
46
42
  console.clear()
@@ -91,7 +87,7 @@ def demo(demo_type: str):
91
87
  for task_name, duration in tasks:
92
88
  task = progress.add_task(task_name, total=duration)
93
89
 
94
- for i in range(duration):
90
+ for _i in range(duration):
95
91
  progress.update(task, advance=1)
96
92
  time.sleep(0.1)
97
93
 
@@ -143,7 +139,7 @@ def demo(demo_type: str):
143
139
 
144
140
  @visual.command()
145
141
  def startup():
146
- """🚀 Show the full startup animation sequence"""
142
+ """🚀 Show the full startup animation sequence."""
147
143
  try:
148
144
  from mcli.lib.ui.visual_effects import StartupSequence
149
145
 
@@ -163,7 +159,7 @@ def startup():
163
159
  @click.option("--duration", default=5, help="Duration in seconds")
164
160
  @click.option("--message", default="Processing...", help="Loading message")
165
161
  def spinner(spinner_type: str, duration: int, message: str):
166
- """⚡ Show an animated spinner"""
162
+ """⚡ Show an animated spinner."""
167
163
  try:
168
164
  from mcli.lib.ui.visual_effects import AnimatedSpinner
169
165
 
@@ -180,7 +176,7 @@ def spinner(spinner_type: str, duration: int, message: str):
180
176
 
181
177
  @visual.command()
182
178
  def performance():
183
- """📊 Show enhanced performance summary"""
179
+ """📊 Show enhanced performance summary."""
184
180
  try:
185
181
  from mcli.lib.performance.rust_bridge import print_performance_summary
186
182
 
@@ -199,7 +195,7 @@ def performance():
199
195
  )
200
196
  @click.argument("message", default="This is a test message!")
201
197
  def message(style: str, message: str):
202
- """💬 Show styled message examples"""
198
+ """💬 Show styled message examples."""
203
199
  try:
204
200
  from mcli.lib.ui.styling import celebrate
205
201
  from mcli.lib.ui.visual_effects import ColorfulOutput
@@ -221,7 +217,7 @@ def message(style: str, message: str):
221
217
 
222
218
  @visual.command()
223
219
  def banner():
224
- """🎯 Show all available banners"""
220
+ """🎯 Show all available banners."""
225
221
  try:
226
222
  from mcli.lib.ui.visual_effects import MCLIBanner
227
223
 
@@ -239,13 +235,12 @@ def banner():
239
235
 
240
236
  @visual.command()
241
237
  def interactive():
242
- """🎮 Interactive visual experience"""
238
+ """🎮 Interactive visual experience."""
243
239
  try:
244
240
  import random
245
241
 
246
242
  from rich.panel import Panel
247
243
  from rich.prompt import Confirm, Prompt
248
- from rich.text import Text
249
244
 
250
245
  from mcli.lib.ui.visual_effects import AnimatedSpinner, ColorfulOutput, MCLIBanner, console
251
246
 
mcli/self/zsh_cmd.py CHANGED
@@ -5,7 +5,6 @@ ZSH-specific commands and utilities for MCLI.
5
5
  import os
6
6
  import subprocess
7
7
  from pathlib import Path
8
- from typing import Optional
9
8
 
10
9
  import click
11
10
 
@@ -18,7 +17,6 @@ from mcli.lib.ui.styling import error, info, success, warning
18
17
  @click.group(name="zsh", help="ZSH shell integration and utilities")
19
18
  def zsh_group():
20
19
  """ZSH-specific commands and utilities."""
21
- pass
22
20
 
23
21
 
24
22
  @zsh_group.command(name="config", help="Configure ZSH for optimal MCLI experience")
@@ -160,7 +158,7 @@ def zsh_prompt(style: str):
160
158
  # Update existing prompt
161
159
  lines = content.split("\n")
162
160
  for i, line in enumerate(lines):
163
- if line.strip() == prompt_marker:
161
+ if line.strip() == prompt_marker: # noqa: SIM102
164
162
  if i + 1 < len(lines) and lines[i + 1].startswith("PS1="):
165
163
  lines[i + 1] = config
166
164
  content = "\n".join(lines)
@@ -244,7 +242,7 @@ def zsh_test():
244
242
  try:
245
243
  result = subprocess.run(["zsh", "-c", "alias | grep mcli"], capture_output=True, text=True)
246
244
  checks.append(("Aliases configured", result.returncode == 0))
247
- except:
245
+ except Exception:
248
246
  checks.append(("Aliases configured", False))
249
247
 
250
248
  # Display results
@@ -1,9 +1,8 @@
1
1
  import asyncio
2
2
  import json
3
- import sqlite3
4
3
  import uuid
5
4
  from contextlib import asynccontextmanager
6
- from dataclasses import asdict, dataclass
5
+ from dataclasses import dataclass
7
6
  from datetime import datetime
8
7
  from pathlib import Path
9
8
  from typing import Any, Dict, List, Optional
@@ -18,7 +17,7 @@ logger = get_logger(__name__)
18
17
 
19
18
  @dataclass
20
19
  class Command:
21
- """Represents a stored command with enhanced metadata"""
20
+ """Represents a stored command with enhanced metadata."""
22
21
 
23
22
  id: str
24
23
  name: str
@@ -49,7 +48,7 @@ class Command:
49
48
 
50
49
  @dataclass
51
50
  class ExecutionRecord:
52
- """Represents a command execution record"""
51
+ """Represents a command execution record."""
53
52
 
54
53
  id: str
55
54
  command_id: str
@@ -63,7 +62,7 @@ class ExecutionRecord:
63
62
 
64
63
 
65
64
  class AsyncCommandDatabase:
66
- """High-performance async command database with connection pooling and caching"""
65
+ """High-performance async command database with connection pooling and caching."""
67
66
 
68
67
  def __init__(
69
68
  self, db_path: Optional[str] = None, redis_url: Optional[str] = None, pool_size: int = 10
@@ -88,7 +87,7 @@ class AsyncCommandDatabase:
88
87
  self.enable_caching = True
89
88
 
90
89
  async def initialize(self):
91
- """Initialize database and connection pool"""
90
+ """Initialize database and connection pool."""
92
91
  if self._initialized:
93
92
  return
94
93
 
@@ -100,7 +99,7 @@ class AsyncCommandDatabase:
100
99
  logger.info("AsyncCommandDatabase initialized successfully")
101
100
 
102
101
  async def _init_database(self):
103
- """Initialize SQLite database with optimizations"""
102
+ """Initialize SQLite database with optimizations."""
104
103
  async with aiosqlite.connect(self.db_path) as db:
105
104
  # Enable performance optimizations
106
105
  await db.execute("PRAGMA journal_mode=WAL")
@@ -231,7 +230,7 @@ class AsyncCommandDatabase:
231
230
  await db.commit()
232
231
 
233
232
  async def _init_redis(self):
234
- """Initialize Redis connection for caching"""
233
+ """Initialize Redis connection for caching."""
235
234
  if not self.enable_caching:
236
235
  return
237
236
 
@@ -245,7 +244,7 @@ class AsyncCommandDatabase:
245
244
  self.enable_caching = False
246
245
 
247
246
  async def _init_connection_pool(self):
248
- """Initialize connection pool"""
247
+ """Initialize connection pool."""
249
248
  async with self._pool_lock:
250
249
  for _ in range(self.pool_size):
251
250
  conn = await aiosqlite.connect(self.db_path)
@@ -255,7 +254,7 @@ class AsyncCommandDatabase:
255
254
 
256
255
  @asynccontextmanager
257
256
  async def _get_connection(self):
258
- """Get a database connection from the pool"""
257
+ """Get a database connection from the pool."""
259
258
  async with self._pool_lock:
260
259
  if self._connection_pool:
261
260
  conn = self._connection_pool.pop()
@@ -273,7 +272,7 @@ class AsyncCommandDatabase:
273
272
  await conn.close()
274
273
 
275
274
  async def add_command(self, command: Command) -> str:
276
- """Add a new command to the database"""
275
+ """Add a new command to the database."""
277
276
  if not command.id:
278
277
  command.id = str(uuid.uuid4())
279
278
 
@@ -323,7 +322,7 @@ class AsyncCommandDatabase:
323
322
  raise
324
323
 
325
324
  async def get_command(self, command_id: str) -> Optional[Command]:
326
- """Get a command by ID with caching"""
325
+ """Get a command by ID with caching."""
327
326
  # Try cache first
328
327
  if self.enable_caching and self.redis_client:
329
328
  cached = await self._get_cached_command(command_id)
@@ -347,7 +346,7 @@ class AsyncCommandDatabase:
347
346
  return None
348
347
 
349
348
  async def update_command(self, command: Command) -> bool:
350
- """Update an existing command"""
349
+ """Update an existing command."""
351
350
  command.updated_at = datetime.now()
352
351
 
353
352
  async with self._get_connection() as db:
@@ -396,7 +395,7 @@ class AsyncCommandDatabase:
396
395
  raise
397
396
 
398
397
  async def delete_command(self, command_id: str) -> bool:
399
- """Delete a command (soft delete)"""
398
+ """Delete a command (soft delete)."""
400
399
  async with self._get_connection() as db:
401
400
  try:
402
401
  result = await db.execute(
@@ -422,7 +421,7 @@ class AsyncCommandDatabase:
422
421
  raise
423
422
 
424
423
  async def search_commands(self, query: str, limit: int = 50) -> List[Command]:
425
- """Full-text search for commands"""
424
+ """Full-text search for commands."""
426
425
  if not query.strip():
427
426
  return await self.get_all_commands(limit=limit)
428
427
 
@@ -453,7 +452,7 @@ class AsyncCommandDatabase:
453
452
  limit: int = 100,
454
453
  offset: int = 0,
455
454
  ) -> List[Command]:
456
- """Get all commands with optional filtering"""
455
+ """Get all commands with optional filtering."""
457
456
  where_clauses = ["is_active = 1"]
458
457
  params = []
459
458
 
@@ -467,7 +466,7 @@ class AsyncCommandDatabase:
467
466
 
468
467
  params.extend([limit, offset])
469
468
 
470
- query = f"""
469
+ query = """
471
470
  SELECT * FROM commands
472
471
  WHERE {" AND ".join(where_clauses)}
473
472
  ORDER BY execution_count DESC, updated_at DESC
@@ -482,7 +481,7 @@ class AsyncCommandDatabase:
482
481
  return commands
483
482
 
484
483
  async def get_popular_commands(self, limit: int = 10) -> List[Command]:
485
- """Get most popular commands by execution count"""
484
+ """Get most popular commands by execution count."""
486
485
  async with self._get_connection() as db:
487
486
  async with db.execute(
488
487
  """
@@ -499,7 +498,7 @@ class AsyncCommandDatabase:
499
498
  return commands
500
499
 
501
500
  async def record_execution(self, execution: ExecutionRecord):
502
- """Record a command execution"""
501
+ """Record a command execution."""
503
502
  async with self._get_connection() as db:
504
503
  try:
505
504
  await db.execute(
@@ -546,7 +545,7 @@ class AsyncCommandDatabase:
546
545
  async def get_execution_history(
547
546
  self, command_id: Optional[str] = None, limit: int = 100
548
547
  ) -> List[ExecutionRecord]:
549
- """Get execution history"""
548
+ """Get execution history."""
550
549
  query = "SELECT * FROM executions"
551
550
  params = []
552
551
 
@@ -577,7 +576,7 @@ class AsyncCommandDatabase:
577
576
  return executions
578
577
 
579
578
  async def _cache_command(self, command: Command):
580
- """Cache a command in Redis"""
579
+ """Cache a command in Redis."""
581
580
  if not self.redis_client:
582
581
  return
583
582
 
@@ -609,7 +608,7 @@ class AsyncCommandDatabase:
609
608
  logger.warning(f"Failed to cache command {command.id}: {e}")
610
609
 
611
610
  async def _get_cached_command(self, command_id: str) -> Optional[Command]:
612
- """Get a command from Redis cache"""
611
+ """Get a command from Redis cache."""
613
612
  if not self.redis_client:
614
613
  return None
615
614
 
@@ -649,7 +648,7 @@ class AsyncCommandDatabase:
649
648
  return None
650
649
 
651
650
  def _row_to_command(self, row) -> Command:
652
- """Convert database row to Command object"""
651
+ """Convert database row to Command object."""
653
652
  return Command(
654
653
  id=row[0],
655
654
  name=row[1],
@@ -669,7 +668,7 @@ class AsyncCommandDatabase:
669
668
  )
670
669
 
671
670
  async def close(self):
672
- """Clean up resources"""
671
+ """Clean up resources."""
673
672
  async with self._pool_lock:
674
673
  for conn in self._connection_pool:
675
674
  await conn.close()