empathy-framework 4.6.2__py3-none-any.whl → 4.6.5__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.
Files changed (43) hide show
  1. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.5.dist-info}/METADATA +53 -11
  2. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.5.dist-info}/RECORD +43 -35
  3. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.5.dist-info}/WHEEL +1 -1
  4. empathy_llm_toolkit/agent_factory/crews/health_check.py +7 -4
  5. empathy_llm_toolkit/agent_factory/decorators.py +3 -2
  6. empathy_llm_toolkit/agent_factory/memory_integration.py +6 -2
  7. empathy_llm_toolkit/contextual_patterns.py +5 -2
  8. empathy_llm_toolkit/git_pattern_extractor.py +8 -4
  9. empathy_llm_toolkit/providers.py +4 -3
  10. empathy_os/__init__.py +1 -1
  11. empathy_os/cli/__init__.py +306 -0
  12. empathy_os/cli/__main__.py +26 -0
  13. empathy_os/cli/commands/__init__.py +8 -0
  14. empathy_os/cli/commands/inspection.py +48 -0
  15. empathy_os/cli/commands/memory.py +56 -0
  16. empathy_os/cli/commands/provider.py +86 -0
  17. empathy_os/cli/commands/utilities.py +94 -0
  18. empathy_os/cli/core.py +32 -0
  19. empathy_os/cli.py +379 -38
  20. empathy_os/cli_unified.py +19 -3
  21. empathy_os/config/xml_config.py +8 -3
  22. empathy_os/core.py +37 -4
  23. empathy_os/leverage_points.py +2 -1
  24. empathy_os/memory/short_term.py +57 -3
  25. empathy_os/models/token_estimator.py +16 -9
  26. empathy_os/models/validation.py +7 -1
  27. empathy_os/orchestration/real_tools.py +4 -2
  28. empathy_os/project_index/scanner.py +151 -49
  29. empathy_os/socratic/storage.py +2 -1
  30. empathy_os/socratic/visual_editor.py +9 -4
  31. empathy_os/tier_recommender.py +5 -2
  32. empathy_os/workflow_commands.py +11 -6
  33. empathy_os/workflows/base.py +1 -1
  34. empathy_os/workflows/bug_predict.py +70 -1
  35. empathy_os/workflows/pr_review.py +6 -0
  36. empathy_os/workflows/security_audit.py +13 -0
  37. empathy_os/workflows/test_maintenance.py +3 -2
  38. empathy_os/workflows/tier_tracking.py +50 -2
  39. wizards/discharge_summary_wizard.py +4 -2
  40. wizards/incident_report_wizard.py +4 -2
  41. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.5.dist-info}/entry_points.txt +0 -0
  42. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.5.dist-info}/licenses/LICENSE +0 -0
  43. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.5.dist-info}/top_level.txt +0 -0
empathy_os/cli.py CHANGED
@@ -316,7 +316,14 @@ TIPS:
316
316
 
317
317
 
318
318
  def cmd_version(args):
319
- """Display version information"""
319
+ """Display version information for Empathy Framework.
320
+
321
+ Args:
322
+ args: Namespace object from argparse (no additional attributes used).
323
+
324
+ Returns:
325
+ None: Prints version, copyright, and license information to stdout.
326
+ """
320
327
  logger.info("Displaying version information")
321
328
  try:
322
329
  version = get_version("empathy")
@@ -331,7 +338,16 @@ def cmd_version(args):
331
338
 
332
339
 
333
340
  def cmd_cheatsheet(args):
334
- """Display quick reference cheatsheet for all commands."""
341
+ """Display quick reference cheatsheet for all commands.
342
+
343
+ Args:
344
+ args: Namespace object from argparse with attributes:
345
+ - category (str | None): Specific category to show (e.g., 'daily-workflow').
346
+ - compact (bool): If True, show commands only without descriptions.
347
+
348
+ Returns:
349
+ None: Prints formatted cheatsheet to stdout.
350
+ """
335
351
  category = getattr(args, "category", None)
336
352
  compact = getattr(args, "compact", False)
337
353
 
@@ -374,7 +390,18 @@ def cmd_cheatsheet(args):
374
390
 
375
391
 
376
392
  def cmd_onboard(args):
377
- """Interactive onboarding tutorial for new users."""
393
+ """Interactive onboarding tutorial for new users.
394
+
395
+ Guides users through setup steps: init, learn, sync-claude, health check.
396
+
397
+ Args:
398
+ args: Namespace object from argparse with attributes:
399
+ - step (int | None): Jump to specific tutorial step (1-5).
400
+ - reset (bool): If True, reset onboarding progress.
401
+
402
+ Returns:
403
+ None: Prints tutorial content and tracks progress.
404
+ """
378
405
  from empathy_os.discovery import get_engine
379
406
 
380
407
  step = getattr(args, "step", None)
@@ -582,7 +609,17 @@ def _show_achievements(engine) -> None:
582
609
 
583
610
 
584
611
  def cmd_explain(args):
585
- """Show detailed explanation for a command."""
612
+ """Show detailed explanation for a command.
613
+
614
+ Provides in-depth documentation about how specific commands work.
615
+
616
+ Args:
617
+ args: Namespace object from argparse with attributes:
618
+ - command (str): Command name to explain (e.g., 'morning', 'ship').
619
+
620
+ Returns:
621
+ None: Prints detailed explanation to stdout.
622
+ """
586
623
  command = args.command
587
624
 
588
625
  if command in EXPLAIN_CONTENT:
@@ -596,7 +633,16 @@ def cmd_explain(args):
596
633
 
597
634
 
598
635
  def cmd_achievements(args):
599
- """Show user achievements and progress."""
636
+ """Show user achievements and progress.
637
+
638
+ Displays gamification stats including unlocked achievements and usage streaks.
639
+
640
+ Args:
641
+ args: Namespace object from argparse (no additional attributes used).
642
+
643
+ Returns:
644
+ None: Prints achievements and progress to stdout.
645
+ """
600
646
  from empathy_os.discovery import get_engine
601
647
 
602
648
  engine = get_engine()
@@ -638,7 +684,20 @@ def cmd_achievements(args):
638
684
 
639
685
 
640
686
  def cmd_tier_recommend(args):
641
- """Get intelligent tier recommendation for a bug/task."""
687
+ """Get intelligent tier recommendation for a bug/task.
688
+
689
+ Analyzes bug description and historical patterns to recommend
690
+ the most cost-effective tier (HAIKU/SONNET/OPUS).
691
+
692
+ Args:
693
+ args: Namespace object from argparse with attributes:
694
+ - description (str): Bug or task description to analyze.
695
+ - files (str | None): Comma-separated list of affected files.
696
+ - complexity (str | None): Complexity hint (low/medium/high).
697
+
698
+ Returns:
699
+ None: Prints tier recommendation with confidence and expected cost.
700
+ """
642
701
  from empathy_os.tier_recommender import TierRecommender
643
702
 
644
703
  recommender = TierRecommender()
@@ -683,7 +742,16 @@ def cmd_tier_recommend(args):
683
742
 
684
743
 
685
744
  def cmd_tier_stats(args):
686
- """Show tier pattern learning statistics."""
745
+ """Show tier pattern learning statistics.
746
+
747
+ Displays statistics about collected patterns and tier distribution.
748
+
749
+ Args:
750
+ args: Namespace object from argparse (no additional attributes used).
751
+
752
+ Returns:
753
+ None: Prints tier statistics, savings percentages, and bug type distribution.
754
+ """
687
755
  from empathy_os.tier_recommender import TierRecommender
688
756
 
689
757
  recommender = TierRecommender()
@@ -734,6 +802,18 @@ def cmd_orchestrate(args):
734
802
 
735
803
  Orchestrates teams of agents to accomplish complex tasks through
736
804
  intelligent composition patterns.
805
+
806
+ Args:
807
+ args: Namespace object from argparse with attributes:
808
+ - workflow (str): Orchestration workflow name.
809
+ - path (str): Target path for orchestration.
810
+ - mode (str | None): Execution mode (e.g., 'daily', 'weekly', 'release').
811
+ - json (bool): If True, output as JSON format.
812
+ - dry_run (bool): If True, show plan without executing.
813
+ - verbose (bool): If True, show detailed output.
814
+
815
+ Returns:
816
+ int: 0 on success, 1 on failure.
737
817
  """
738
818
  import asyncio
739
819
  import json
@@ -894,10 +974,20 @@ def cmd_orchestrate(args):
894
974
 
895
975
 
896
976
  def cmd_init(args):
897
- """Initialize a new Empathy Framework project
977
+ """Initialize a new Empathy Framework project.
978
+
979
+ Creates a configuration file with sensible defaults.
980
+
981
+ Args:
982
+ args: Namespace object from argparse with attributes:
983
+ - format (str): Output format ('yaml' or 'json').
984
+ - output (str | None): Output file path.
985
+
986
+ Returns:
987
+ None: Creates configuration file at specified path.
898
988
 
899
989
  Raises:
900
- ValueError: If output path is invalid or unsafe
990
+ ValueError: If output path is invalid or unsafe.
901
991
  """
902
992
  config_format = args.format
903
993
  output_path = args.output or f"empathy.config.{config_format}"
@@ -926,7 +1016,17 @@ def cmd_init(args):
926
1016
 
927
1017
 
928
1018
  def cmd_validate(args):
929
- """Validate a configuration file"""
1019
+ """Validate a configuration file.
1020
+
1021
+ Loads and validates the specified configuration file.
1022
+
1023
+ Args:
1024
+ args: Namespace object from argparse with attributes:
1025
+ - config (str): Path to configuration file to validate.
1026
+
1027
+ Returns:
1028
+ None: Prints validation result. Exits with code 1 on failure.
1029
+ """
930
1030
  filepath = args.config
931
1031
  logger.info(f"Validating configuration file: {filepath}")
932
1032
 
@@ -958,7 +1058,17 @@ def cmd_validate(args):
958
1058
 
959
1059
 
960
1060
  def cmd_info(args):
961
- """Display information about the framework"""
1061
+ """Display information about the framework.
1062
+
1063
+ Shows configuration, persistence, and feature status.
1064
+
1065
+ Args:
1066
+ args: Namespace object from argparse with attributes:
1067
+ - config (str | None): Optional path to configuration file.
1068
+
1069
+ Returns:
1070
+ None: Prints framework information to stdout.
1071
+ """
962
1072
  config_file = args.config
963
1073
  logger.info("Displaying framework information")
964
1074
 
@@ -988,7 +1098,16 @@ def cmd_info(args):
988
1098
 
989
1099
 
990
1100
  def cmd_patterns_list(args):
991
- """List patterns in a pattern library"""
1101
+ """List patterns in a pattern library.
1102
+
1103
+ Args:
1104
+ args: Namespace object from argparse with attributes:
1105
+ - library (str): Path to pattern library file.
1106
+ - format (str): Library format ('json' or 'sqlite').
1107
+
1108
+ Returns:
1109
+ None: Prints pattern list to stdout. Exits with code 1 on failure.
1110
+ """
992
1111
  filepath = args.library
993
1112
  format_type = args.format
994
1113
  logger.info(f"Listing patterns from library: {filepath} (format: {format_type})")
@@ -1024,10 +1143,20 @@ def cmd_patterns_list(args):
1024
1143
 
1025
1144
 
1026
1145
  def cmd_patterns_export(args):
1027
- """Export patterns from one format to another
1146
+ """Export patterns from one format to another.
1147
+
1148
+ Args:
1149
+ args: Namespace object from argparse with attributes:
1150
+ - input (str): Input file path.
1151
+ - output (str): Output file path.
1152
+ - input_format (str): Input format ('json' or 'sqlite').
1153
+ - output_format (str): Output format ('json' or 'sqlite').
1154
+
1155
+ Returns:
1156
+ None: Exports patterns to output file. Exits with code 1 on failure.
1028
1157
 
1029
1158
  Raises:
1030
- ValueError: If output path is invalid
1159
+ ValueError: If output path is invalid or unsafe.
1031
1160
  """
1032
1161
  input_file = args.input
1033
1162
  input_format = args.input_format
@@ -1090,7 +1219,24 @@ def cmd_patterns_export(args):
1090
1219
 
1091
1220
 
1092
1221
  def cmd_patterns_resolve(args):
1093
- """Resolve investigating bug patterns with root cause and fix."""
1222
+ """Resolve investigating bug patterns with root cause and fix.
1223
+
1224
+ Updates pattern status and adds resolution information.
1225
+
1226
+ Args:
1227
+ args: Namespace object from argparse with attributes:
1228
+ - pattern_id (str | None): Pattern ID to resolve.
1229
+ - root_cause (str | None): Root cause description.
1230
+ - fix (str | None): Fix description.
1231
+ - fix_code (str | None): Code snippet of the fix.
1232
+ - time (int | None): Resolution time in minutes.
1233
+ - status (str): New status ('resolved', 'wont_fix', etc.).
1234
+ - patterns_dir (str): Patterns directory path.
1235
+ - commit (str | None): Related commit hash.
1236
+
1237
+ Returns:
1238
+ None: Updates pattern and prints result. Exits with code 1 on failure.
1239
+ """
1094
1240
  from empathy_llm_toolkit.pattern_resolver import PatternResolver
1095
1241
 
1096
1242
  resolver = PatternResolver(args.patterns_dir)
@@ -1146,7 +1292,24 @@ def cmd_patterns_resolve(args):
1146
1292
 
1147
1293
 
1148
1294
  def cmd_status(args):
1149
- """Session status assistant - prioritized project status report."""
1295
+ """Session status assistant - prioritized project status report.
1296
+
1297
+ Collects and displays project status including patterns, git context,
1298
+ and health metrics with priority scoring.
1299
+
1300
+ Args:
1301
+ args: Namespace object from argparse with attributes:
1302
+ - patterns_dir (str): Path to patterns directory (default: ./patterns).
1303
+ - project_root (str): Project root directory (default: .).
1304
+ - inactivity (int): Minutes of inactivity before showing status.
1305
+ - full (bool): If True, show all items without limit.
1306
+ - json (bool): If True, output as JSON format.
1307
+ - select (int | None): Select specific item for action prompt.
1308
+ - force (bool): If True, show status even with recent activity.
1309
+
1310
+ Returns:
1311
+ None: Prints prioritized status report or JSON output.
1312
+ """
1150
1313
  from empathy_llm_toolkit.session_status import SessionStatusCollector
1151
1314
 
1152
1315
  config = {"inactivity_minutes": args.inactivity}
@@ -1189,7 +1352,21 @@ def cmd_status(args):
1189
1352
 
1190
1353
 
1191
1354
  def cmd_review(args):
1192
- """Pattern-based code review against historical bugs."""
1355
+ """Pattern-based code review against historical bugs.
1356
+
1357
+ Analyzes code changes against learned patterns to identify potential issues.
1358
+
1359
+ Args:
1360
+ args: Namespace object from argparse with attributes:
1361
+ - files (list[str]): Files to review (default: recent changes).
1362
+ - staged (bool): If True, review staged changes only.
1363
+ - severity (str): Minimum severity threshold for findings.
1364
+ - patterns_dir (str): Path to patterns directory.
1365
+ - json (bool): If True, output as JSON format.
1366
+
1367
+ Returns:
1368
+ None: Prints review findings and recommendations.
1369
+ """
1193
1370
  import asyncio
1194
1371
 
1195
1372
  from empathy_software_plugin.wizards.code_review_wizard import CodeReviewWizard
@@ -1224,7 +1401,27 @@ def cmd_review(args):
1224
1401
 
1225
1402
 
1226
1403
  def cmd_health(args):
1227
- """Code health assistant - run health checks and auto-fix issues."""
1404
+ """Code health assistant - run health checks and auto-fix issues.
1405
+
1406
+ Runs comprehensive health checks including linting, type checking,
1407
+ and formatting with optional auto-fix capability.
1408
+
1409
+ Args:
1410
+ args: Namespace object from argparse with attributes:
1411
+ - check (str | None): Specific check to run (lint/type/format/test).
1412
+ - deep (bool): If True, run comprehensive checks.
1413
+ - fix (bool): If True, auto-fix issues where possible.
1414
+ - threshold (str): Severity threshold for issues.
1415
+ - project_root (str): Project root directory.
1416
+ - patterns_dir (str): Path to patterns directory.
1417
+ - details (bool): If True, show detailed issue list.
1418
+ - compare (str | None): Compare against historical baseline.
1419
+ - export (str | None): Export results to file.
1420
+ - json (bool): If True, output as JSON format.
1421
+
1422
+ Returns:
1423
+ None: Prints health check results and optionally fixes issues.
1424
+ """
1228
1425
  import asyncio
1229
1426
 
1230
1427
  from empathy_llm_toolkit.code_health import (
@@ -1351,7 +1548,16 @@ def cmd_health(args):
1351
1548
 
1352
1549
 
1353
1550
  def cmd_metrics_show(args):
1354
- """Display metrics for a user"""
1551
+ """Display metrics for a user.
1552
+
1553
+ Args:
1554
+ args: Namespace object from argparse with attributes:
1555
+ - user (str): User ID to retrieve metrics for.
1556
+ - db (str): Path to metrics database (default: ./metrics.db).
1557
+
1558
+ Returns:
1559
+ None: Prints user metrics to stdout. Exits with code 1 on failure.
1560
+ """
1355
1561
  db_path = args.db
1356
1562
  user_id = args.user
1357
1563
 
@@ -1394,7 +1600,15 @@ def cmd_metrics_show(args):
1394
1600
 
1395
1601
 
1396
1602
  def cmd_state_list(args):
1397
- """List saved user states"""
1603
+ """List saved user states.
1604
+
1605
+ Args:
1606
+ args: Namespace object from argparse with attributes:
1607
+ - state_dir (str): Directory containing state files.
1608
+
1609
+ Returns:
1610
+ None: Prints list of users with saved states.
1611
+ """
1398
1612
  state_dir = args.state_dir
1399
1613
 
1400
1614
  logger.info(f"Listing saved user states from: {state_dir}")
@@ -1413,7 +1627,19 @@ def cmd_state_list(args):
1413
1627
 
1414
1628
 
1415
1629
  def cmd_run(args):
1416
- """Interactive REPL for testing empathy interactions"""
1630
+ """Interactive REPL for testing empathy interactions.
1631
+
1632
+ Starts an interactive session for testing empathy levels and features.
1633
+
1634
+ Args:
1635
+ args: Namespace object from argparse with attributes:
1636
+ - config (str | None): Path to configuration file.
1637
+ - user_id (str | None): User ID (default: cli_user).
1638
+ - level (int): Target empathy level (1-5).
1639
+
1640
+ Returns:
1641
+ None: Runs interactive REPL until user exits.
1642
+ """
1417
1643
  config_file = args.config
1418
1644
  user_id = args.user_id or "cli_user"
1419
1645
  level = args.level
@@ -1546,7 +1772,20 @@ def cmd_run(args):
1546
1772
 
1547
1773
 
1548
1774
  def cmd_inspect(args):
1549
- """Unified inspection command for patterns, metrics, and state"""
1775
+ """Unified inspection command for patterns, metrics, and state.
1776
+
1777
+ Inspect various framework data including patterns, user metrics, and states.
1778
+
1779
+ Args:
1780
+ args: Namespace object from argparse with attributes:
1781
+ - type (str): What to inspect ('patterns', 'metrics', or 'state').
1782
+ - user_id (str | None): Filter by user ID.
1783
+ - db (str | None): Database path (default: .empathy/patterns.db).
1784
+ - state_dir (str | None): State directory for state inspection.
1785
+
1786
+ Returns:
1787
+ None: Prints inspection results. Exits with code 1 on failure.
1788
+ """
1550
1789
  inspect_type = args.type
1551
1790
  user_id = args.user_id
1552
1791
  db_path = args.db or ".empathy/patterns.db"
@@ -1653,10 +1892,20 @@ def cmd_inspect(args):
1653
1892
 
1654
1893
 
1655
1894
  def cmd_export(args):
1656
- """Export patterns to file for sharing/backup
1895
+ """Export patterns to file for sharing/backup.
1896
+
1897
+ Args:
1898
+ args: Namespace object from argparse with attributes:
1899
+ - output (str): Output file path.
1900
+ - user_id (str | None): Filter patterns by user ID.
1901
+ - db (str | None): Source database path.
1902
+ - format (str): Output format ('json').
1903
+
1904
+ Returns:
1905
+ None: Exports patterns to file. Exits with code 1 on failure.
1657
1906
 
1658
1907
  Raises:
1659
- ValueError: If output path is invalid
1908
+ ValueError: If output path is invalid or unsafe.
1660
1909
  """
1661
1910
  output_file = args.output
1662
1911
  user_id = args.user_id
@@ -1722,7 +1971,18 @@ def cmd_export(args):
1722
1971
 
1723
1972
 
1724
1973
  def cmd_import(args):
1725
- """Import patterns from file (local dev only - SQLite/JSON)"""
1974
+ """Import patterns from file (local dev only - SQLite/JSON).
1975
+
1976
+ Merges imported patterns into existing pattern library.
1977
+
1978
+ Args:
1979
+ args: Namespace object from argparse with attributes:
1980
+ - input (str): Input file path.
1981
+ - db (str | None): Target database path (default: .empathy/patterns.db).
1982
+
1983
+ Returns:
1984
+ None: Imports and merges patterns. Exits with code 1 on failure.
1985
+ """
1726
1986
  input_file = args.input
1727
1987
  db_path = args.db or ".empathy/patterns.db"
1728
1988
 
@@ -1785,7 +2045,16 @@ def cmd_import(args):
1785
2045
 
1786
2046
 
1787
2047
  def cmd_wizard(args):
1788
- """Interactive setup wizard"""
2048
+ """Interactive setup wizard.
2049
+
2050
+ Guides user through initial framework configuration step by step.
2051
+
2052
+ Args:
2053
+ args: Namespace object from argparse (no additional attributes used).
2054
+
2055
+ Returns:
2056
+ None: Creates empathy.config.yml with user's choices.
2057
+ """
1789
2058
  print("🧙 Empathy Framework Setup Wizard")
1790
2059
  print("=" * 50)
1791
2060
  print("\nI'll help you set up your Empathy Framework configuration.\n")
@@ -1919,14 +2188,28 @@ llm_provider: "{llm_provider}"
1919
2188
 
1920
2189
 
1921
2190
  def cmd_provider_hybrid(args):
1922
- """Configure hybrid mode - pick best models for each tier."""
2191
+ """Configure hybrid mode - pick best models for each tier.
2192
+
2193
+ Args:
2194
+ args: Namespace object from argparse (no additional attributes used).
2195
+
2196
+ Returns:
2197
+ None: Launches interactive tier configuration.
2198
+ """
1923
2199
  from empathy_os.models.provider_config import configure_hybrid_interactive
1924
2200
 
1925
2201
  configure_hybrid_interactive()
1926
2202
 
1927
2203
 
1928
2204
  def cmd_provider_show(args):
1929
- """Show current provider configuration."""
2205
+ """Show current provider configuration.
2206
+
2207
+ Args:
2208
+ args: Namespace object from argparse (no additional attributes used).
2209
+
2210
+ Returns:
2211
+ None: Prints provider configuration and model mappings.
2212
+ """
1930
2213
  from empathy_os.models.provider_config import ProviderConfig
1931
2214
  from empathy_os.workflows.config import WorkflowConfig
1932
2215
 
@@ -1965,8 +2248,15 @@ def cmd_provider_show(args):
1965
2248
 
1966
2249
 
1967
2250
  def cmd_provider_set(args):
1968
- """Set default provider."""
2251
+ """Set default provider.
2252
+
2253
+ Args:
2254
+ args: Namespace object from argparse with attributes:
2255
+ - name (str): Provider name to set as default.
1969
2256
 
2257
+ Returns:
2258
+ None: Saves provider to .empathy/workflows.yaml.
2259
+ """
1970
2260
  import yaml
1971
2261
 
1972
2262
  provider = args.name
@@ -1996,8 +2286,18 @@ def cmd_provider_set(args):
1996
2286
  def cmd_sync_claude(args):
1997
2287
  """Sync patterns to Claude Code rules directory.
1998
2288
 
2289
+ Converts learned patterns into Claude Code markdown rules.
2290
+
2291
+ Args:
2292
+ args: Namespace object from argparse with attributes:
2293
+ - patterns_dir (str): Source patterns directory.
2294
+ - output_dir (str): Target Claude Code rules directory.
2295
+
2296
+ Returns:
2297
+ int: 0 on success, 1 on failure.
2298
+
1999
2299
  Raises:
2000
- ValueError: If output path is invalid
2300
+ ValueError: If output path is invalid or unsafe.
2001
2301
  """
2002
2302
  import json as json_mod
2003
2303
 
@@ -2198,7 +2498,24 @@ def _extract_workflow_content(final_output):
2198
2498
 
2199
2499
 
2200
2500
  def cmd_workflow(args):
2201
- """Multi-model workflow management and execution."""
2501
+ """Multi-model workflow management and execution.
2502
+
2503
+ Supports listing, describing, and running workflows with tier-based models.
2504
+
2505
+ Args:
2506
+ args: Namespace object from argparse with attributes:
2507
+ - action (str): Action to perform ('list', 'describe', 'run').
2508
+ - name (str | None): Workflow name (for describe/run).
2509
+ - input (str | None): JSON input for workflow execution.
2510
+ - provider (str | None): LLM provider override.
2511
+ - json (bool): If True, output as JSON format.
2512
+ - use_recommended_tier (bool): Enable tier fallback.
2513
+ - write_tests (bool): For test-gen, write tests to files.
2514
+ - output_dir (str | None): For test-gen, output directory.
2515
+
2516
+ Returns:
2517
+ int | None: 0 on success, 1 on failure, None for list action.
2518
+ """
2202
2519
  import asyncio
2203
2520
  import json as json_mod
2204
2521
 
@@ -2283,15 +2600,27 @@ def cmd_workflow(args):
2283
2600
  wf_config = WorkflowConfig.load()
2284
2601
  provider = wf_config.default_provider
2285
2602
 
2286
- # Initialize workflow with tier fallback if requested
2603
+ # Initialize workflow with provider and optional tier fallback
2604
+ # Note: Not all workflows support enable_tier_fallback, so we check first
2605
+ import inspect
2287
2606
  use_tier_fallback = getattr(args, "use_recommended_tier", False)
2288
- workflow_kwargs = {
2289
- "provider": provider,
2290
- "enable_tier_fallback": use_tier_fallback,
2291
- }
2607
+
2608
+ # Get the workflow's __init__ signature to know what params it accepts
2609
+ init_sig = inspect.signature(workflow_cls.__init__)
2610
+ init_params = set(init_sig.parameters.keys())
2611
+
2612
+ workflow_kwargs = {}
2613
+
2614
+ # Add provider if supported
2615
+ if "provider" in init_params:
2616
+ workflow_kwargs["provider"] = provider
2617
+
2618
+ # Add enable_tier_fallback only if the workflow supports it
2619
+ if "enable_tier_fallback" in init_params and use_tier_fallback:
2620
+ workflow_kwargs["enable_tier_fallback"] = use_tier_fallback
2292
2621
 
2293
2622
  # Add health-check specific parameters
2294
- if name == "health-check":
2623
+ if name == "health-check" and "health_score_threshold" in init_params:
2295
2624
  health_score_threshold = getattr(args, "health_score_threshold", 100)
2296
2625
  workflow_kwargs["health_score_threshold"] = health_score_threshold
2297
2626
 
@@ -2516,7 +2845,19 @@ def cmd_workflow(args):
2516
2845
 
2517
2846
 
2518
2847
  def cmd_frameworks(args):
2519
- """List and manage agent frameworks."""
2848
+ """List and manage agent frameworks.
2849
+
2850
+ Displays available agent frameworks with their capabilities and recommendations.
2851
+
2852
+ Args:
2853
+ args: Namespace object from argparse with attributes:
2854
+ - all (bool): If True, show all frameworks including experimental.
2855
+ - recommend (str | None): Use case for framework recommendation.
2856
+ - json (bool): If True, output as JSON format.
2857
+
2858
+ Returns:
2859
+ int: 0 on success, 1 on failure.
2860
+ """
2520
2861
  import json as json_mod
2521
2862
 
2522
2863
  try:
empathy_os/cli_unified.py CHANGED
@@ -441,11 +441,24 @@ def workflow_list():
441
441
  @workflow_app.command("run")
442
442
  def workflow_run(
443
443
  name: str = typer.Argument(..., help="Workflow name"),
444
- path: Path = Path("."),
444
+ path: Path = typer.Option(Path("."), "--path", "-p", help="Target path for workflow"),
445
+ input_json: str = typer.Option(None, "--input", "-i", help="JSON input for workflow (overrides --path)"),
445
446
  use_recommended_tier: bool = False,
446
447
  health_score_threshold: int = 95,
448
+ json_output: bool = typer.Option(False, "--json", help="Output as JSON"),
447
449
  ):
448
- """Run a multi-model workflow."""
450
+ """Run a multi-model workflow.
451
+
452
+ Examples:
453
+ empathy workflow run code-review --path ./src
454
+ empathy workflow run test-gen --input '{"path": ".", "file_types": [".py"]}'
455
+ """
456
+ # Determine input JSON - explicit --input takes precedence over --path
457
+ if input_json:
458
+ workflow_input = input_json
459
+ else:
460
+ workflow_input = f'{{"path": "{path}"}}'
461
+
449
462
  cmd = [
450
463
  sys.executable,
451
464
  "-m",
@@ -454,7 +467,7 @@ def workflow_run(
454
467
  "run",
455
468
  name,
456
469
  "--input",
457
- f'{{"path": "{path}"}}',
470
+ workflow_input,
458
471
  ]
459
472
 
460
473
  if use_recommended_tier:
@@ -463,6 +476,9 @@ def workflow_run(
463
476
  if health_score_threshold != 95:
464
477
  cmd.extend(["--health-score-threshold", str(health_score_threshold)])
465
478
 
479
+ if json_output:
480
+ cmd.append("--json")
481
+
466
482
  subprocess.run(cmd, check=False)
467
483
 
468
484