crackerjack 0.30.3__py3-none-any.whl → 0.31.4__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 crackerjack might be problematic. Click here for more details.

Files changed (155) hide show
  1. crackerjack/CLAUDE.md +1005 -0
  2. crackerjack/RULES.md +380 -0
  3. crackerjack/__init__.py +42 -13
  4. crackerjack/__main__.py +225 -299
  5. crackerjack/agents/__init__.py +41 -0
  6. crackerjack/agents/architect_agent.py +281 -0
  7. crackerjack/agents/base.py +169 -0
  8. crackerjack/agents/coordinator.py +512 -0
  9. crackerjack/agents/documentation_agent.py +498 -0
  10. crackerjack/agents/dry_agent.py +388 -0
  11. crackerjack/agents/formatting_agent.py +245 -0
  12. crackerjack/agents/import_optimization_agent.py +281 -0
  13. crackerjack/agents/performance_agent.py +669 -0
  14. crackerjack/agents/proactive_agent.py +104 -0
  15. crackerjack/agents/refactoring_agent.py +788 -0
  16. crackerjack/agents/security_agent.py +529 -0
  17. crackerjack/agents/test_creation_agent.py +652 -0
  18. crackerjack/agents/test_specialist_agent.py +486 -0
  19. crackerjack/agents/tracker.py +212 -0
  20. crackerjack/api.py +560 -0
  21. crackerjack/cli/__init__.py +24 -0
  22. crackerjack/cli/facade.py +104 -0
  23. crackerjack/cli/handlers.py +267 -0
  24. crackerjack/cli/interactive.py +471 -0
  25. crackerjack/cli/options.py +401 -0
  26. crackerjack/cli/utils.py +18 -0
  27. crackerjack/code_cleaner.py +618 -928
  28. crackerjack/config/__init__.py +19 -0
  29. crackerjack/config/hooks.py +218 -0
  30. crackerjack/core/__init__.py +0 -0
  31. crackerjack/core/async_workflow_orchestrator.py +406 -0
  32. crackerjack/core/autofix_coordinator.py +200 -0
  33. crackerjack/core/container.py +104 -0
  34. crackerjack/core/enhanced_container.py +542 -0
  35. crackerjack/core/performance.py +243 -0
  36. crackerjack/core/phase_coordinator.py +561 -0
  37. crackerjack/core/proactive_workflow.py +316 -0
  38. crackerjack/core/session_coordinator.py +289 -0
  39. crackerjack/core/workflow_orchestrator.py +640 -0
  40. crackerjack/dynamic_config.py +94 -103
  41. crackerjack/errors.py +263 -41
  42. crackerjack/executors/__init__.py +11 -0
  43. crackerjack/executors/async_hook_executor.py +431 -0
  44. crackerjack/executors/cached_hook_executor.py +242 -0
  45. crackerjack/executors/hook_executor.py +345 -0
  46. crackerjack/executors/individual_hook_executor.py +669 -0
  47. crackerjack/intelligence/__init__.py +44 -0
  48. crackerjack/intelligence/adaptive_learning.py +751 -0
  49. crackerjack/intelligence/agent_orchestrator.py +551 -0
  50. crackerjack/intelligence/agent_registry.py +414 -0
  51. crackerjack/intelligence/agent_selector.py +502 -0
  52. crackerjack/intelligence/integration.py +290 -0
  53. crackerjack/interactive.py +576 -315
  54. crackerjack/managers/__init__.py +11 -0
  55. crackerjack/managers/async_hook_manager.py +135 -0
  56. crackerjack/managers/hook_manager.py +137 -0
  57. crackerjack/managers/publish_manager.py +411 -0
  58. crackerjack/managers/test_command_builder.py +151 -0
  59. crackerjack/managers/test_executor.py +435 -0
  60. crackerjack/managers/test_manager.py +258 -0
  61. crackerjack/managers/test_manager_backup.py +1124 -0
  62. crackerjack/managers/test_progress.py +144 -0
  63. crackerjack/mcp/__init__.py +0 -0
  64. crackerjack/mcp/cache.py +336 -0
  65. crackerjack/mcp/client_runner.py +104 -0
  66. crackerjack/mcp/context.py +615 -0
  67. crackerjack/mcp/dashboard.py +636 -0
  68. crackerjack/mcp/enhanced_progress_monitor.py +479 -0
  69. crackerjack/mcp/file_monitor.py +336 -0
  70. crackerjack/mcp/progress_components.py +569 -0
  71. crackerjack/mcp/progress_monitor.py +949 -0
  72. crackerjack/mcp/rate_limiter.py +332 -0
  73. crackerjack/mcp/server.py +22 -0
  74. crackerjack/mcp/server_core.py +244 -0
  75. crackerjack/mcp/service_watchdog.py +501 -0
  76. crackerjack/mcp/state.py +395 -0
  77. crackerjack/mcp/task_manager.py +257 -0
  78. crackerjack/mcp/tools/__init__.py +17 -0
  79. crackerjack/mcp/tools/core_tools.py +249 -0
  80. crackerjack/mcp/tools/error_analyzer.py +308 -0
  81. crackerjack/mcp/tools/execution_tools.py +370 -0
  82. crackerjack/mcp/tools/execution_tools_backup.py +1097 -0
  83. crackerjack/mcp/tools/intelligence_tool_registry.py +80 -0
  84. crackerjack/mcp/tools/intelligence_tools.py +314 -0
  85. crackerjack/mcp/tools/monitoring_tools.py +502 -0
  86. crackerjack/mcp/tools/proactive_tools.py +384 -0
  87. crackerjack/mcp/tools/progress_tools.py +141 -0
  88. crackerjack/mcp/tools/utility_tools.py +341 -0
  89. crackerjack/mcp/tools/workflow_executor.py +360 -0
  90. crackerjack/mcp/websocket/__init__.py +14 -0
  91. crackerjack/mcp/websocket/app.py +39 -0
  92. crackerjack/mcp/websocket/endpoints.py +559 -0
  93. crackerjack/mcp/websocket/jobs.py +253 -0
  94. crackerjack/mcp/websocket/server.py +116 -0
  95. crackerjack/mcp/websocket/websocket_handler.py +78 -0
  96. crackerjack/mcp/websocket_server.py +10 -0
  97. crackerjack/models/__init__.py +31 -0
  98. crackerjack/models/config.py +93 -0
  99. crackerjack/models/config_adapter.py +230 -0
  100. crackerjack/models/protocols.py +118 -0
  101. crackerjack/models/task.py +154 -0
  102. crackerjack/monitoring/ai_agent_watchdog.py +450 -0
  103. crackerjack/monitoring/regression_prevention.py +638 -0
  104. crackerjack/orchestration/__init__.py +0 -0
  105. crackerjack/orchestration/advanced_orchestrator.py +970 -0
  106. crackerjack/orchestration/execution_strategies.py +341 -0
  107. crackerjack/orchestration/test_progress_streamer.py +636 -0
  108. crackerjack/plugins/__init__.py +15 -0
  109. crackerjack/plugins/base.py +200 -0
  110. crackerjack/plugins/hooks.py +246 -0
  111. crackerjack/plugins/loader.py +335 -0
  112. crackerjack/plugins/managers.py +259 -0
  113. crackerjack/py313.py +8 -3
  114. crackerjack/services/__init__.py +22 -0
  115. crackerjack/services/cache.py +314 -0
  116. crackerjack/services/config.py +347 -0
  117. crackerjack/services/config_integrity.py +99 -0
  118. crackerjack/services/contextual_ai_assistant.py +516 -0
  119. crackerjack/services/coverage_ratchet.py +347 -0
  120. crackerjack/services/debug.py +736 -0
  121. crackerjack/services/dependency_monitor.py +617 -0
  122. crackerjack/services/enhanced_filesystem.py +439 -0
  123. crackerjack/services/file_hasher.py +151 -0
  124. crackerjack/services/filesystem.py +395 -0
  125. crackerjack/services/git.py +165 -0
  126. crackerjack/services/health_metrics.py +611 -0
  127. crackerjack/services/initialization.py +847 -0
  128. crackerjack/services/log_manager.py +286 -0
  129. crackerjack/services/logging.py +174 -0
  130. crackerjack/services/metrics.py +578 -0
  131. crackerjack/services/pattern_cache.py +362 -0
  132. crackerjack/services/pattern_detector.py +515 -0
  133. crackerjack/services/performance_benchmarks.py +653 -0
  134. crackerjack/services/security.py +163 -0
  135. crackerjack/services/server_manager.py +234 -0
  136. crackerjack/services/smart_scheduling.py +144 -0
  137. crackerjack/services/tool_version_service.py +61 -0
  138. crackerjack/services/unified_config.py +437 -0
  139. crackerjack/services/version_checker.py +248 -0
  140. crackerjack/slash_commands/__init__.py +14 -0
  141. crackerjack/slash_commands/init.md +122 -0
  142. crackerjack/slash_commands/run.md +163 -0
  143. crackerjack/slash_commands/status.md +127 -0
  144. crackerjack-0.31.4.dist-info/METADATA +742 -0
  145. crackerjack-0.31.4.dist-info/RECORD +148 -0
  146. crackerjack-0.31.4.dist-info/entry_points.txt +2 -0
  147. crackerjack/.gitignore +0 -34
  148. crackerjack/.libcst.codemod.yaml +0 -18
  149. crackerjack/.pdm.toml +0 -1
  150. crackerjack/crackerjack.py +0 -3805
  151. crackerjack/pyproject.toml +0 -286
  152. crackerjack-0.30.3.dist-info/METADATA +0 -1290
  153. crackerjack-0.30.3.dist-info/RECORD +0 -16
  154. {crackerjack-0.30.3.dist-info → crackerjack-0.31.4.dist-info}/WHEEL +0 -0
  155. {crackerjack-0.30.3.dist-info → crackerjack-0.31.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,267 @@
1
+ import asyncio
2
+ import os
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ from rich.console import Console
7
+
8
+ from .options import Options
9
+
10
+
11
+ def setup_ai_agent_env(ai_agent: bool, verbose: bool = False) -> None:
12
+ if ai_agent:
13
+ os.environ["AI_AGENT"] = "1"
14
+ os.environ["AI_AGENT_DEBUG"] = "1"
15
+
16
+ if verbose:
17
+ os.environ["AI_AGENT_VERBOSE"] = "1"
18
+
19
+ if verbose:
20
+ console = Console()
21
+ console.print(
22
+ "[bold cyan]🐛 AI Agent Debug Mode Configuration: [/bold cyan]",
23
+ )
24
+ console.print(f" • AI Agent: {'✅ Enabled' if ai_agent else '❌ Disabled'}")
25
+ console.print(
26
+ f" • Debug Mode: {'✅ Enabled' if os.environ.get('AI_AGENT_DEBUG') == '1' else '❌ Disabled'}",
27
+ )
28
+ console.print(
29
+ f" • Verbose Mode: {'✅ Enabled' if os.environ.get('AI_AGENT_VERBOSE') == '1' else '❌ Disabled'}",
30
+ )
31
+ console.print(" • Enhanced logging will be available during execution")
32
+
33
+
34
+ def handle_mcp_server(websocket_port: int | None = None) -> None:
35
+ from crackerjack.mcp.server import main as start_mcp_main
36
+
37
+ # Always pass current working directory as project path
38
+ project_path = str(Path.cwd())
39
+
40
+ if websocket_port:
41
+ start_mcp_main(project_path, websocket_port)
42
+ else:
43
+ start_mcp_main(project_path)
44
+
45
+
46
+ def handle_monitor_mode(dev_mode: bool = False) -> None:
47
+ from crackerjack.mcp.progress_monitor import run_progress_monitor
48
+
49
+ console = Console()
50
+ console.print("[bold cyan]🌟 Starting Multi-Project Progress Monitor[/bold cyan]")
51
+ console.print(
52
+ "[bold yellow]🐕 With integrated Service Watchdog and WebSocket polling[/bold yellow]",
53
+ )
54
+
55
+ try:
56
+ asyncio.run(run_progress_monitor(dev_mode=dev_mode))
57
+ except KeyboardInterrupt:
58
+ console.print("\n[yellow]🛑 Monitor stopped[/yellow]")
59
+
60
+
61
+ def handle_enhanced_monitor_mode(dev_mode: bool = False) -> None:
62
+ from crackerjack.mcp.enhanced_progress_monitor import run_enhanced_progress_monitor
63
+
64
+ console = Console()
65
+ console.print("[bold magenta]✨ Starting Enhanced Progress Monitor[/bold magenta]")
66
+ console.print(
67
+ "[bold cyan]📊 With advanced MetricCard widgets and modern web UI patterns[/bold cyan]",
68
+ )
69
+
70
+ try:
71
+ asyncio.run(run_enhanced_progress_monitor(dev_mode=dev_mode))
72
+ except KeyboardInterrupt:
73
+ console.print("\n[yellow]🛑 Enhanced Monitor stopped[/yellow]")
74
+
75
+
76
+ def handle_dashboard_mode(dev_mode: bool = False) -> None:
77
+ from crackerjack.mcp.dashboard import run_dashboard
78
+
79
+ console = Console()
80
+ console.print("[bold green]🎯 Starting Comprehensive Dashboard[/bold green]")
81
+ console.print(
82
+ "[bold cyan]📈 With system metrics, job tracking, and performance monitoring[/bold cyan]",
83
+ )
84
+
85
+ try:
86
+ run_dashboard()
87
+ except KeyboardInterrupt:
88
+ console.print("\n[yellow]🛑 Dashboard stopped[/yellow]")
89
+
90
+
91
+ def handle_watchdog_mode() -> None:
92
+ from crackerjack.mcp.service_watchdog import main as start_watchdog
93
+
94
+ console = Console()
95
+ try:
96
+ asyncio.run(start_watchdog())
97
+ except KeyboardInterrupt:
98
+ console.print("\n[yellow]🛑 Watchdog stopped[/yellow]")
99
+
100
+
101
+ def handle_start_websocket_server(port: int = 8675) -> None:
102
+ from crackerjack.mcp.websocket.server import handle_websocket_server_command
103
+
104
+ handle_websocket_server_command(start=True, port=port)
105
+
106
+
107
+ def handle_stop_websocket_server() -> None:
108
+ from crackerjack.mcp.websocket.server import handle_websocket_server_command
109
+
110
+ handle_websocket_server_command(stop=True)
111
+
112
+
113
+ def handle_restart_websocket_server(port: int = 8675) -> None:
114
+ from crackerjack.mcp.websocket.server import handle_websocket_server_command
115
+
116
+ handle_websocket_server_command(restart=True, port=port)
117
+
118
+
119
+ def handle_stop_mcp_server() -> None:
120
+ from crackerjack.services.server_manager import list_server_status, stop_all_servers
121
+
122
+ console = Console()
123
+ console.print("[bold red]🛑 Stopping MCP Servers[/bold red]")
124
+
125
+ list_server_status(console)
126
+
127
+ if stop_all_servers(console):
128
+ console.print("\n[bold green]✅ All servers stopped successfully[/bold green]")
129
+ else:
130
+ console.print("\n[bold red]❌ Some servers failed to stop[/bold red]")
131
+ raise SystemExit(1)
132
+
133
+
134
+ def handle_restart_mcp_server(websocket_port: int | None = None) -> None:
135
+ from crackerjack.services.server_manager import restart_mcp_server
136
+
137
+ console = Console()
138
+ if restart_mcp_server(websocket_port, console):
139
+ console.print("\n[bold green]✅ MCP server restart completed[/bold green]")
140
+ else:
141
+ console.print("\n[bold red]❌ MCP server restart failed[/bold red]")
142
+ raise SystemExit(1)
143
+
144
+
145
+ def handle_interactive_mode(options: Options) -> None:
146
+ from crackerjack.cli.utils import get_package_version
147
+
148
+ from .interactive import launch_interactive_cli
149
+
150
+ pkg_version = get_package_version()
151
+ launch_interactive_cli(pkg_version, options)
152
+
153
+
154
+ def handle_standard_mode(
155
+ options: Options,
156
+ async_mode: bool,
157
+ job_id: str | None = None,
158
+ orchestrated: bool = False,
159
+ ) -> None:
160
+ from rich.console import Console
161
+
162
+ console = Console()
163
+
164
+ if orchestrated:
165
+ handle_orchestrated_mode(options, job_id)
166
+ else:
167
+ from crackerjack.core.async_workflow_orchestrator import (
168
+ AsyncWorkflowOrchestrator,
169
+ )
170
+ from crackerjack.core.workflow_orchestrator import WorkflowOrchestrator
171
+
172
+ pkg_path = Path.cwd()
173
+
174
+ if async_mode:
175
+ orchestrator = AsyncWorkflowOrchestrator(
176
+ console=console,
177
+ pkg_path=pkg_path,
178
+ web_job_id=job_id,
179
+ )
180
+ success = asyncio.run(orchestrator.run_complete_workflow_async(options))
181
+ else:
182
+ orchestrator = WorkflowOrchestrator(
183
+ console=console,
184
+ pkg_path=pkg_path,
185
+ web_job_id=job_id,
186
+ verbose=options.verbose,
187
+ )
188
+ success = asyncio.run(orchestrator.run_complete_workflow(options))
189
+
190
+ if not success:
191
+ raise SystemExit(1)
192
+
193
+
194
+ def handle_orchestrated_mode(options: Options, job_id: str | None = None) -> None:
195
+ from rich.console import Console
196
+
197
+ console = Console()
198
+ console.print("[bold bright_blue]🚀 ORCHESTRATED MODE ENABLED[/bold bright_blue]")
199
+
200
+ try:
201
+ from crackerjack.core.session_coordinator import SessionCoordinator
202
+ from crackerjack.orchestration.advanced_orchestrator import (
203
+ AdvancedWorkflowOrchestrator,
204
+ )
205
+ from crackerjack.orchestration.execution_strategies import (
206
+ AICoordinationMode,
207
+ ExecutionStrategy,
208
+ OrchestrationConfig,
209
+ ProgressLevel,
210
+ )
211
+ except ImportError as e:
212
+ console.print(f"[red]Orchestrated mode not available: {e}[/red]")
213
+ console.print("[yellow]Falling back to standard mode[/yellow]")
214
+ handle_standard_mode(options, False, job_id)
215
+ return
216
+
217
+ try:
218
+ strategy = ExecutionStrategy(options.orchestration_strategy)
219
+ except ValueError:
220
+ console.print(
221
+ f"[red]Invalid orchestration strategy: {options.orchestration_strategy}[/red]",
222
+ )
223
+ strategy = ExecutionStrategy.ADAPTIVE
224
+
225
+ try:
226
+ progress = ProgressLevel(options.orchestration_progress)
227
+ except ValueError:
228
+ console.print(
229
+ f"[red]Invalid progress level: {options.orchestration_progress}[/red]",
230
+ )
231
+ progress = ProgressLevel.GRANULAR
232
+
233
+ try:
234
+ ai_mode = AICoordinationMode(options.orchestration_ai_mode)
235
+ except ValueError:
236
+ console.print(f"[red]Invalid AI mode: {options.orchestration_ai_mode}[/red]")
237
+ ai_mode = AICoordinationMode.SINGLE_AGENT
238
+
239
+ config = OrchestrationConfig(
240
+ execution_strategy=strategy,
241
+ progress_level=progress,
242
+ ai_coordination_mode=ai_mode,
243
+ )
244
+
245
+ console.print(f"[cyan]Execution Strategy: [/cyan] {strategy.value}")
246
+ console.print(f"[cyan]Progress Level: [/cyan] {progress.value}")
247
+ console.print(f"[cyan]AI Coordination: [/cyan] {ai_mode.value}")
248
+
249
+ pkg_path = Path.cwd()
250
+ session = SessionCoordinator(console, pkg_path, web_job_id=job_id)
251
+ orchestrator = AdvancedWorkflowOrchestrator(console, pkg_path, session, config)
252
+
253
+ try:
254
+ success = asyncio.run(orchestrator.execute_orchestrated_workflow(options))
255
+ if success:
256
+ console.print(
257
+ "\n[bold green]🎉 ORCHESTRATED WORKFLOW COMPLETED SUCCESSFULLY![/bold green]",
258
+ )
259
+ else:
260
+ console.print("\n[bold red]❌ ORCHESTRATED WORKFLOW FAILED[/bold red]")
261
+ sys.exit(1)
262
+ except KeyboardInterrupt:
263
+ console.print("\n[yellow]🛑 Orchestrated workflow interrupted[/yellow]")
264
+ sys.exit(130)
265
+ except Exception as e:
266
+ console.print(f"\n[red]💥 Orchestrated workflow error: {e}[/red]")
267
+ sys.exit(1)