mcli-framework 7.11.2__py3-none-any.whl → 7.11.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.

mcli/app/main.py CHANGED
@@ -347,26 +347,32 @@ def _add_lazy_commands(app: click.Group):
347
347
  # Note: lib group removed - secrets moved to workflows
348
348
  # Previous: mcli lib secrets -> Now: mcli workflows secrets
349
349
 
350
- # Add workflows group (renamed from 'workflow') with completion-aware lazy loading
350
+ # Add workflows group directly (not lazy-loaded) to preserve -g/--global option
351
351
  try:
352
- from mcli.app.completion_helpers import create_completion_aware_lazy_group
353
-
354
- workflows_group = create_completion_aware_lazy_group(
355
- "workflows",
356
- "mcli.workflow.workflow.workflows",
357
- "Runnable workflows for automation, video processing, and daemon management",
358
- )
352
+ from mcli.workflow.workflow import workflows as workflows_group
359
353
  app.add_command(workflows_group, name="workflows")
360
- logger.debug("Added completion-aware workflows group")
354
+ logger.debug("Added workflows group with -g/--global support")
361
355
  except ImportError as e:
362
- logger.debug(f"Could not load completion helpers, using standard lazy group: {e}")
363
- # Fallback to standard lazy group
364
- workflows_group = LazyGroup(
365
- "workflows",
366
- "mcli.workflow.workflow.workflows",
367
- help="Runnable workflows for automation, video processing, and daemon management",
368
- )
369
- app.add_command(workflows_group, name="workflows")
356
+ logger.error(f"Could not load workflows group: {e}")
357
+ # Fallback to lazy loading if import fails
358
+ try:
359
+ from mcli.app.completion_helpers import create_completion_aware_lazy_group
360
+
361
+ workflows_group = create_completion_aware_lazy_group(
362
+ "workflows",
363
+ "mcli.workflow.workflow.workflows",
364
+ "Runnable workflows for automation, video processing, and daemon management",
365
+ )
366
+ app.add_command(workflows_group, name="workflows")
367
+ logger.debug("Added completion-aware workflows group (fallback)")
368
+ except ImportError:
369
+ workflows_group = LazyGroup(
370
+ "workflows",
371
+ "mcli.workflow.workflow.workflows",
372
+ help="Runnable workflows for automation, video processing, and daemon management",
373
+ )
374
+ app.add_command(workflows_group, name="workflows")
375
+ logger.debug("Added lazy workflows group (fallback)")
370
376
 
371
377
  # Lazy load other heavy commands that are used less frequently
372
378
  # NOTE: chat and model commands have been removed
mcli/workflow/workflow.py CHANGED
@@ -1,17 +1,98 @@
1
1
  """
2
2
  Workflows command group for mcli.
3
3
 
4
- All workflow commands are now loaded from portable JSON files in ~/.mcli/commands/
4
+ All workflow commands are now loaded from portable JSON files in ~/.mcli/workflows/
5
5
  This provides a clean, maintainable way to manage workflow commands.
6
6
  """
7
7
 
8
8
  import click
9
9
 
10
10
 
11
- @click.group(name="workflows")
12
- def workflows():
13
- """Runnable workflows for automation, video processing, and daemon management"""
14
- pass
11
+ class ScopedWorkflowsGroup(click.Group):
12
+ """
13
+ Custom Click Group that loads workflows from either local or global scope
14
+ based on the -g/--global flag.
15
+ """
16
+
17
+ def list_commands(self, ctx):
18
+ """List available commands based on scope."""
19
+ # Get scope from context
20
+ is_global = ctx.params.get('is_global', False)
21
+
22
+ # Load commands from appropriate directory
23
+ from mcli.lib.custom_commands import get_command_manager
24
+
25
+ manager = get_command_manager(global_mode=is_global)
26
+ commands = manager.load_all_commands()
27
+
28
+ # Filter to only workflow group commands
29
+ workflow_commands = [cmd.get('name') for cmd in commands if cmd.get('group') == 'workflow']
30
+
31
+ # Also include built-in subcommands
32
+ builtin_commands = list(super().list_commands(ctx))
33
+
34
+ return sorted(set(workflow_commands + builtin_commands))
35
+
36
+ def get_command(self, ctx, cmd_name):
37
+ """Get a command by name, loading from appropriate scope."""
38
+ # First check if it's a built-in command
39
+ builtin_cmd = super().get_command(ctx, cmd_name)
40
+ if builtin_cmd:
41
+ return builtin_cmd
42
+
43
+ # Get scope from context
44
+ is_global = ctx.params.get('is_global', False)
45
+
46
+ # Load the workflow command from appropriate directory
47
+ from mcli.lib.custom_commands import get_command_manager
48
+
49
+ manager = get_command_manager(global_mode=is_global)
50
+ commands = manager.load_all_commands()
51
+
52
+ # Find the workflow command
53
+ for command_data in commands:
54
+ if command_data.get('name') == cmd_name and command_data.get('group') == 'workflow':
55
+ # Create a temporary group to register the command
56
+ temp_group = click.Group()
57
+ language = command_data.get("language", "python")
58
+
59
+ if language == "shell":
60
+ manager.register_shell_command_with_click(command_data, temp_group)
61
+ else:
62
+ manager.register_command_with_click(command_data, temp_group)
63
+
64
+ return temp_group.commands.get(cmd_name)
65
+
66
+ return None
67
+
68
+
69
+ @click.group(name="workflows", cls=ScopedWorkflowsGroup, invoke_without_command=True)
70
+ @click.option(
71
+ "-g",
72
+ "--global",
73
+ "is_global",
74
+ is_flag=True,
75
+ help="Execute workflows from global directory (~/.mcli/workflows/) instead of local (.mcli/workflows/)",
76
+ )
77
+ @click.pass_context
78
+ def workflows(ctx, is_global):
79
+ """Runnable workflows for automation, video processing, and daemon management
80
+
81
+ Examples:
82
+ mcli workflows my-workflow # Execute local workflow (if in git repo)
83
+ mcli workflows -g my-workflow # Execute global workflow
84
+ mcli workflows --global another-workflow # Execute global workflow
85
+ """
86
+ # Store the is_global flag in the context for subcommands to access
87
+ ctx.ensure_object(dict)
88
+ ctx.obj['is_global'] = is_global
89
+
90
+ # If a subcommand was invoked, the subcommand will handle execution
91
+ if ctx.invoked_subcommand:
92
+ return
93
+
94
+ # If no subcommand, show help
95
+ click.echo(ctx.get_help())
15
96
 
16
97
 
17
98
  # Add secrets workflow
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcli-framework
3
- Version: 7.11.2
3
+ Version: 7.11.3
4
4
  Summary: Portable workflow framework - transform any script into a versioned, schedulable command. Store in ~/.mcli/commands/, version with lockfile, run as daemon or cron job.
5
5
  Author-email: Luis Fernandez de la Vara <luis@lefv.io>
6
6
  Maintainer-email: Luis Fernandez de la Vara <luis@lefv.io>
@@ -5,7 +5,7 @@ mcli/config.toml,sha256=263yEVvP_W9F2zOLssUBgy7amKaRAFQuBrfxcMhKxaQ,1706
5
5
  mcli/app/__init__.py,sha256=D4RiKk2gOEXwanbe_jXyNSb5zdgNi47kahtskMnEwjY,489
6
6
  mcli/app/commands_cmd.py,sha256=gyvjkX8HyImUKaO37Du6XwklN6FJwvQX-VD3tNU0TGQ,76191
7
7
  mcli/app/completion_helpers.py,sha256=e62C6w2N-XoD66GYYHgtvKKoD3kYMuIeBBGzVKbuL04,7497
8
- mcli/app/main.py,sha256=CzF1iudFhVdAtC5d_KzRVAc6XT5Lkq6WZ1NnNKpdWnE,19165
8
+ mcli/app/main.py,sha256=4rfj8d68OgUErLmIRRFDu9UKBgJwc-HFgJ8MuAPur8s,19517
9
9
  mcli/app/model_cmd.py,sha256=LQQD8FaebFoaJGK3u_kt19wZ3HJyo_ecwSMYyC2xIp8,2497
10
10
  mcli/app/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  mcli/app/model/model.py,sha256=EUGu_td-hRlbf4OElkdk1-0p7WyuG7sZmb-Ux2-J9KY,39061
@@ -209,7 +209,7 @@ mcli/self/zsh_cmd.py,sha256=63jKmfjhJp2zxJL2c37OdtdzDrnOreXXfyARN7TyfzU,8294
209
209
  mcli/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
210
  mcli/workflow/doc_convert.py,sha256=X7ZCYbGCBZLv6WkxAgHfVOkD-6k-euo6qIaPgaKiwhA,25972
211
211
  mcli/workflow/lsh_integration.py,sha256=jop80DUjdOSxmqPb-gX_OBep5f1twViv-pXmkcFqBPY,13314
212
- mcli/workflow/workflow.py,sha256=zaRXrmVqILvGX9u_Mp0FTBgydzr_z20fiYSFv8MgjK0,1154
212
+ mcli/workflow/workflow.py,sha256=ctnPo6dwSTcwUPPTa6_K_feZJUXkkIc9n9jvQf_4n_Q,4159
213
213
  mcli/workflow/daemon/__init__.py,sha256=iDounKzoQhHcgHwK1kFJHnPPhn09JFzvSEpXRZDSnxU,565
214
214
  mcli/workflow/daemon/async_command_database.py,sha256=pvfKYjt0Jg1EPwJ1p2C0M3bsBWvjEs4Ok-Y6-jY0qVI,24873
215
215
  mcli/workflow/daemon/async_process_manager.py,sha256=hDehiYuWnBOv8LbMLTDEi4DVyrwm8YrrYF8Ca5P66A4,21374
@@ -268,9 +268,9 @@ mcli/workflow/sync/test_cmd.py,sha256=neVgs9zEnKSxlvzDpFkuCGucqnzjrShm2OvJtHibsl
268
268
  mcli/workflow/videos/__init__.py,sha256=aV3DEoO7qdKJY4odWKoQbOKDQq4ludTeCLnZcupOFIM,25
269
269
  mcli/workflow/wakatime/__init__.py,sha256=wKG8cVIHVtMPhNRFGFtX43bRnocHqOMMkFMkmW-M6pU,2626
270
270
  mcli/workflow/wakatime/wakatime.py,sha256=sEjsUKa3-XyE8Ni6sAb_D3GAY5jDcA30KknW9YTbLTA,142
271
- mcli_framework-7.11.2.dist-info/licenses/LICENSE,sha256=sahwAMfrJv2-V66HNPTp7A9UmMjxtyejwTZZoWQvEcI,1075
272
- mcli_framework-7.11.2.dist-info/METADATA,sha256=b7Gcj2KCC86Lu2OTxVRCi_NmfDb40mADWTigjuFcATg,18655
273
- mcli_framework-7.11.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
274
- mcli_framework-7.11.2.dist-info/entry_points.txt,sha256=dYrZbDIm-KUPsl1wfv600Kx_8sMy89phMkCihbDRgP8,261
275
- mcli_framework-7.11.2.dist-info/top_level.txt,sha256=_bnO8J2EUkliWivey_1le0UrnocFKmyVMQjbQ8iVXjc,5
276
- mcli_framework-7.11.2.dist-info/RECORD,,
271
+ mcli_framework-7.11.3.dist-info/licenses/LICENSE,sha256=sahwAMfrJv2-V66HNPTp7A9UmMjxtyejwTZZoWQvEcI,1075
272
+ mcli_framework-7.11.3.dist-info/METADATA,sha256=3YjC0sbDgOscsVMhVbcOsw8pnvhzlq3MlYBvxekbanY,18655
273
+ mcli_framework-7.11.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
274
+ mcli_framework-7.11.3.dist-info/entry_points.txt,sha256=dYrZbDIm-KUPsl1wfv600Kx_8sMy89phMkCihbDRgP8,261
275
+ mcli_framework-7.11.3.dist-info/top_level.txt,sha256=_bnO8J2EUkliWivey_1le0UrnocFKmyVMQjbQ8iVXjc,5
276
+ mcli_framework-7.11.3.dist-info/RECORD,,