crackerjack 0.31.10__py3-none-any.whl → 0.31.12__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 +288 -705
  2. crackerjack/__main__.py +22 -8
  3. crackerjack/agents/__init__.py +0 -3
  4. crackerjack/agents/architect_agent.py +0 -43
  5. crackerjack/agents/base.py +1 -9
  6. crackerjack/agents/coordinator.py +2 -148
  7. crackerjack/agents/documentation_agent.py +109 -81
  8. crackerjack/agents/dry_agent.py +122 -97
  9. crackerjack/agents/formatting_agent.py +3 -16
  10. crackerjack/agents/import_optimization_agent.py +1174 -130
  11. crackerjack/agents/performance_agent.py +956 -188
  12. crackerjack/agents/performance_helpers.py +229 -0
  13. crackerjack/agents/proactive_agent.py +1 -48
  14. crackerjack/agents/refactoring_agent.py +516 -246
  15. crackerjack/agents/refactoring_helpers.py +282 -0
  16. crackerjack/agents/security_agent.py +393 -90
  17. crackerjack/agents/test_creation_agent.py +1776 -120
  18. crackerjack/agents/test_specialist_agent.py +59 -15
  19. crackerjack/agents/tracker.py +0 -102
  20. crackerjack/api.py +145 -37
  21. crackerjack/cli/handlers.py +48 -30
  22. crackerjack/cli/interactive.py +11 -11
  23. crackerjack/cli/options.py +66 -4
  24. crackerjack/code_cleaner.py +808 -148
  25. crackerjack/config/global_lock_config.py +110 -0
  26. crackerjack/config/hooks.py +43 -64
  27. crackerjack/core/async_workflow_orchestrator.py +247 -97
  28. crackerjack/core/autofix_coordinator.py +192 -109
  29. crackerjack/core/enhanced_container.py +46 -63
  30. crackerjack/core/file_lifecycle.py +549 -0
  31. crackerjack/core/performance.py +9 -8
  32. crackerjack/core/performance_monitor.py +395 -0
  33. crackerjack/core/phase_coordinator.py +281 -94
  34. crackerjack/core/proactive_workflow.py +9 -58
  35. crackerjack/core/resource_manager.py +501 -0
  36. crackerjack/core/service_watchdog.py +490 -0
  37. crackerjack/core/session_coordinator.py +4 -8
  38. crackerjack/core/timeout_manager.py +504 -0
  39. crackerjack/core/websocket_lifecycle.py +475 -0
  40. crackerjack/core/workflow_orchestrator.py +343 -209
  41. crackerjack/dynamic_config.py +47 -6
  42. crackerjack/errors.py +3 -4
  43. crackerjack/executors/async_hook_executor.py +63 -13
  44. crackerjack/executors/cached_hook_executor.py +14 -14
  45. crackerjack/executors/hook_executor.py +100 -37
  46. crackerjack/executors/hook_lock_manager.py +856 -0
  47. crackerjack/executors/individual_hook_executor.py +120 -86
  48. crackerjack/intelligence/__init__.py +0 -7
  49. crackerjack/intelligence/adaptive_learning.py +13 -86
  50. crackerjack/intelligence/agent_orchestrator.py +15 -78
  51. crackerjack/intelligence/agent_registry.py +12 -59
  52. crackerjack/intelligence/agent_selector.py +31 -92
  53. crackerjack/intelligence/integration.py +1 -41
  54. crackerjack/interactive.py +9 -9
  55. crackerjack/managers/async_hook_manager.py +25 -8
  56. crackerjack/managers/hook_manager.py +9 -9
  57. crackerjack/managers/publish_manager.py +57 -59
  58. crackerjack/managers/test_command_builder.py +6 -36
  59. crackerjack/managers/test_executor.py +9 -61
  60. crackerjack/managers/test_manager.py +17 -63
  61. crackerjack/managers/test_manager_backup.py +77 -127
  62. crackerjack/managers/test_progress.py +4 -23
  63. crackerjack/mcp/cache.py +5 -12
  64. crackerjack/mcp/client_runner.py +10 -10
  65. crackerjack/mcp/context.py +64 -6
  66. crackerjack/mcp/dashboard.py +14 -11
  67. crackerjack/mcp/enhanced_progress_monitor.py +55 -55
  68. crackerjack/mcp/file_monitor.py +72 -42
  69. crackerjack/mcp/progress_components.py +103 -84
  70. crackerjack/mcp/progress_monitor.py +122 -49
  71. crackerjack/mcp/rate_limiter.py +12 -12
  72. crackerjack/mcp/server_core.py +16 -22
  73. crackerjack/mcp/service_watchdog.py +26 -26
  74. crackerjack/mcp/state.py +15 -0
  75. crackerjack/mcp/tools/core_tools.py +95 -39
  76. crackerjack/mcp/tools/error_analyzer.py +6 -32
  77. crackerjack/mcp/tools/execution_tools.py +1 -56
  78. crackerjack/mcp/tools/execution_tools_backup.py +35 -131
  79. crackerjack/mcp/tools/intelligence_tool_registry.py +0 -36
  80. crackerjack/mcp/tools/intelligence_tools.py +2 -55
  81. crackerjack/mcp/tools/monitoring_tools.py +308 -145
  82. crackerjack/mcp/tools/proactive_tools.py +12 -42
  83. crackerjack/mcp/tools/progress_tools.py +23 -15
  84. crackerjack/mcp/tools/utility_tools.py +3 -40
  85. crackerjack/mcp/tools/workflow_executor.py +40 -60
  86. crackerjack/mcp/websocket/app.py +0 -3
  87. crackerjack/mcp/websocket/endpoints.py +206 -268
  88. crackerjack/mcp/websocket/jobs.py +213 -66
  89. crackerjack/mcp/websocket/server.py +84 -6
  90. crackerjack/mcp/websocket/websocket_handler.py +137 -29
  91. crackerjack/models/config_adapter.py +3 -16
  92. crackerjack/models/protocols.py +162 -3
  93. crackerjack/models/resource_protocols.py +454 -0
  94. crackerjack/models/task.py +3 -3
  95. crackerjack/monitoring/__init__.py +0 -0
  96. crackerjack/monitoring/ai_agent_watchdog.py +25 -71
  97. crackerjack/monitoring/regression_prevention.py +28 -87
  98. crackerjack/orchestration/advanced_orchestrator.py +44 -78
  99. crackerjack/orchestration/coverage_improvement.py +10 -60
  100. crackerjack/orchestration/execution_strategies.py +16 -16
  101. crackerjack/orchestration/test_progress_streamer.py +61 -53
  102. crackerjack/plugins/base.py +1 -1
  103. crackerjack/plugins/managers.py +22 -20
  104. crackerjack/py313.py +65 -21
  105. crackerjack/services/backup_service.py +467 -0
  106. crackerjack/services/bounded_status_operations.py +627 -0
  107. crackerjack/services/cache.py +7 -9
  108. crackerjack/services/config.py +35 -52
  109. crackerjack/services/config_integrity.py +5 -16
  110. crackerjack/services/config_merge.py +542 -0
  111. crackerjack/services/contextual_ai_assistant.py +17 -19
  112. crackerjack/services/coverage_ratchet.py +44 -73
  113. crackerjack/services/debug.py +25 -39
  114. crackerjack/services/dependency_monitor.py +52 -50
  115. crackerjack/services/enhanced_filesystem.py +14 -11
  116. crackerjack/services/file_hasher.py +1 -1
  117. crackerjack/services/filesystem.py +1 -12
  118. crackerjack/services/git.py +71 -47
  119. crackerjack/services/health_metrics.py +31 -27
  120. crackerjack/services/initialization.py +276 -428
  121. crackerjack/services/input_validator.py +760 -0
  122. crackerjack/services/log_manager.py +16 -16
  123. crackerjack/services/logging.py +7 -6
  124. crackerjack/services/metrics.py +43 -43
  125. crackerjack/services/pattern_cache.py +2 -31
  126. crackerjack/services/pattern_detector.py +26 -63
  127. crackerjack/services/performance_benchmarks.py +20 -45
  128. crackerjack/services/regex_patterns.py +2887 -0
  129. crackerjack/services/regex_utils.py +537 -0
  130. crackerjack/services/secure_path_utils.py +683 -0
  131. crackerjack/services/secure_status_formatter.py +534 -0
  132. crackerjack/services/secure_subprocess.py +605 -0
  133. crackerjack/services/security.py +47 -10
  134. crackerjack/services/security_logger.py +492 -0
  135. crackerjack/services/server_manager.py +109 -50
  136. crackerjack/services/smart_scheduling.py +8 -25
  137. crackerjack/services/status_authentication.py +603 -0
  138. crackerjack/services/status_security_manager.py +442 -0
  139. crackerjack/services/thread_safe_status_collector.py +546 -0
  140. crackerjack/services/tool_version_service.py +1 -23
  141. crackerjack/services/unified_config.py +36 -58
  142. crackerjack/services/validation_rate_limiter.py +269 -0
  143. crackerjack/services/version_checker.py +9 -40
  144. crackerjack/services/websocket_resource_limiter.py +572 -0
  145. crackerjack/slash_commands/__init__.py +52 -2
  146. crackerjack/tools/__init__.py +0 -0
  147. crackerjack/tools/validate_input_validator_patterns.py +262 -0
  148. crackerjack/tools/validate_regex_patterns.py +198 -0
  149. {crackerjack-0.31.10.dist-info → crackerjack-0.31.12.dist-info}/METADATA +197 -12
  150. crackerjack-0.31.12.dist-info/RECORD +178 -0
  151. crackerjack/cli/facade.py +0 -104
  152. crackerjack-0.31.10.dist-info/RECORD +0 -149
  153. {crackerjack-0.31.10.dist-info → crackerjack-0.31.12.dist-info}/WHEEL +0 -0
  154. {crackerjack-0.31.10.dist-info → crackerjack-0.31.12.dist-info}/entry_points.txt +0 -0
  155. {crackerjack-0.31.10.dist-info → crackerjack-0.31.12.dist-info}/licenses/LICENSE +0 -0
@@ -1,15 +1,3 @@
1
- """Refactored MCP execution tools with focused responsibilities.
2
-
3
- This module provides the main MCP tool registration and high-level coordination.
4
- Implementation details are delegated to specialized modules:
5
- - workflow_executor.py: Core workflow execution logic
6
- - error_analyzer.py: Error analysis and pattern detection
7
- - (Additional initialization and suggestion modules as needed)
8
-
9
- REFACTORING NOTE: Original execution_tools.py was 1110 lines with 30+ functions.
10
- This refactored version is ~300 lines and delegates to focused modules.
11
- """
12
-
13
1
  import json
14
2
  import typing as t
15
3
 
@@ -20,7 +8,6 @@ from .workflow_executor import execute_crackerjack_workflow
20
8
 
21
9
 
22
10
  def register_execution_tools(mcp_app: t.Any) -> None:
23
- """Register all execution-related MCP tools."""
24
11
  _register_execute_crackerjack_tool(mcp_app)
25
12
  _register_smart_error_analysis_tool(mcp_app)
26
13
  _register_init_crackerjack_tool(mcp_app)
@@ -28,26 +15,20 @@ def register_execution_tools(mcp_app: t.Any) -> None:
28
15
 
29
16
 
30
17
  def _register_execute_crackerjack_tool(mcp_app: t.Any) -> None:
31
- """Register the main crackerjack execution tool."""
32
-
33
18
  @mcp_app.tool()
34
19
  async def execute_crackerjack(args: str, kwargs: str) -> str:
35
- """Execute crackerjack workflow with AI agent auto-fixing."""
36
20
  context = get_context()
37
21
 
38
- # Validate context and rate limits
39
22
  validation_error = await _validate_context_and_rate_limit(context)
40
23
  if validation_error:
41
24
  return validation_error
42
25
 
43
- # Parse arguments
44
26
  kwargs_result = _parse_kwargs(kwargs)
45
27
  if "error" in kwargs_result:
46
28
  return json.dumps(kwargs_result)
47
29
 
48
30
  extra_kwargs = kwargs_result["kwargs"]
49
31
 
50
- # Execute workflow
51
32
  try:
52
33
  result = await execute_crackerjack_workflow(args, extra_kwargs)
53
34
  return json.dumps(result, indent=2)
@@ -64,11 +45,8 @@ def _register_execute_crackerjack_tool(mcp_app: t.Any) -> None:
64
45
 
65
46
 
66
47
  def _register_smart_error_analysis_tool(mcp_app: t.Any) -> None:
67
- """Register the smart error analysis tool."""
68
-
69
48
  @mcp_app.tool()
70
49
  async def smart_error_analysis(use_cache: bool = True) -> str:
71
- """Analyze cached error patterns and provide intelligent recommendations."""
72
50
  context = get_context()
73
51
 
74
52
  try:
@@ -85,11 +63,8 @@ def _register_smart_error_analysis_tool(mcp_app: t.Any) -> None:
85
63
 
86
64
 
87
65
  def _register_init_crackerjack_tool(mcp_app: t.Any) -> None:
88
- """Register the crackerjack initialization tool."""
89
-
90
66
  @mcp_app.tool()
91
67
  def init_crackerjack(args: str = "", kwargs: str = "{}") -> str:
92
- """Initialize or update crackerjack configuration in current project."""
93
68
  try:
94
69
  target_path, force, error = _parse_init_arguments(args, kwargs)
95
70
  if error:
@@ -103,15 +78,12 @@ def _register_init_crackerjack_tool(mcp_app: t.Any) -> None:
103
78
 
104
79
 
105
80
  def _register_agent_suggestions_tool(mcp_app: t.Any) -> None:
106
- """Register the agent suggestions tool."""
107
-
108
81
  @mcp_app.tool()
109
82
  def suggest_agents(
110
83
  task_description: str = "",
111
84
  project_type: str = "python",
112
85
  current_context: str = "",
113
86
  ) -> str:
114
- """Suggest appropriate Claude Code agents based on task and context."""
115
87
  try:
116
88
  recommendations = _generate_agent_recommendations(
117
89
  task_description, project_type, current_context
@@ -127,15 +99,10 @@ def _register_agent_suggestions_tool(mcp_app: t.Any) -> None:
127
99
  )
128
100
 
129
101
 
130
- # Helper functions for argument parsing and validation
131
-
132
-
133
102
  async def _validate_context_and_rate_limit(context: t.Any) -> str | None:
134
- """Validate MCP context and check rate limits."""
135
103
  if not context:
136
104
  return json.dumps({"status": "error", "message": "MCP context not available"})
137
105
 
138
- # Check rate limits if available
139
106
  if hasattr(context, "rate_limiter"):
140
107
  from contextlib import suppress
141
108
 
@@ -155,18 +122,13 @@ async def _validate_context_and_rate_limit(context: t.Any) -> str | None:
155
122
 
156
123
 
157
124
  def _parse_kwargs(kwargs: str) -> dict[str, t.Any]:
158
- """Parse and validate kwargs string."""
159
125
  try:
160
126
  return {"kwargs": json.loads(kwargs) if kwargs.strip() else {}}
161
127
  except json.JSONDecodeError as e:
162
128
  return {"error": f"Invalid JSON in kwargs: {e}"}
163
129
 
164
130
 
165
- # Initialization helper functions
166
-
167
-
168
131
  def _parse_init_arguments(args: str, kwargs: str) -> tuple[t.Any, bool, str | None]:
169
- """Parse and validate initialization arguments."""
170
132
  try:
171
133
  target_path = args.strip() or "."
172
134
  kwargs_dict = json.loads(kwargs) if kwargs.strip() else {}
@@ -185,7 +147,6 @@ def _parse_init_arguments(args: str, kwargs: str) -> tuple[t.Any, bool, str | No
185
147
 
186
148
 
187
149
  def _execute_initialization(target_path: t.Any, force: bool) -> dict[str, t.Any]:
188
- """Execute crackerjack initialization."""
189
150
  from rich.console import Console
190
151
 
191
152
  from crackerjack.services.initialization import InitializationService
@@ -198,7 +159,6 @@ def _execute_initialization(target_path: t.Any, force: bool) -> dict[str, t.Any]
198
159
 
199
160
 
200
161
  def _create_init_error_response(message: str) -> str:
201
- """Create initialization error response."""
202
162
  return json.dumps(
203
163
  {
204
164
  "status": "error",
@@ -209,7 +169,6 @@ def _create_init_error_response(message: str) -> str:
209
169
 
210
170
 
211
171
  def _create_init_success_response(result: dict[str, t.Any]) -> str:
212
- """Create initialization success response."""
213
172
  return json.dumps(
214
173
  {
215
174
  "status": "success",
@@ -222,7 +181,6 @@ def _create_init_success_response(result: dict[str, t.Any]) -> str:
222
181
 
223
182
 
224
183
  def _create_init_exception_response(error: Exception, target_path: t.Any) -> str:
225
- """Create initialization exception response."""
226
184
  return json.dumps(
227
185
  {
228
186
  "status": "error",
@@ -233,13 +191,9 @@ def _create_init_exception_response(error: Exception, target_path: t.Any) -> str
233
191
  )
234
192
 
235
193
 
236
- # Agent suggestion helper functions
237
-
238
-
239
194
  def _generate_agent_recommendations(
240
195
  task_description: str, project_type: str, current_context: str
241
196
  ) -> dict[str, t.Any]:
242
- """Generate agent recommendations based on task context."""
243
197
  recommendations = {
244
198
  "status": "success",
245
199
  "task_analysis": {
@@ -252,7 +206,6 @@ def _generate_agent_recommendations(
252
206
  "reasoning": "",
253
207
  }
254
208
 
255
- # Analyze task and context
256
209
  suggestions = _analyze_task_for_agents(
257
210
  task_description, project_type, current_context
258
211
  )
@@ -266,7 +219,6 @@ def _generate_agent_recommendations(
266
219
  def _analyze_task_for_agents(
267
220
  task_description: str, project_type: str, current_context: str
268
221
  ) -> dict[str, t.Any]:
269
- """Analyze task description to determine appropriate agents."""
270
222
  agents = []
271
223
  workflows = []
272
224
  reasoning_parts = []
@@ -274,7 +226,6 @@ def _analyze_task_for_agents(
274
226
  task_lower = task_description.lower()
275
227
  current_context.lower()
276
228
 
277
- # Code quality and testing agents
278
229
  if any(keyword in task_lower for keyword in ("test", "quality", "fix", "error")):
279
230
  agents.extend(
280
231
  [
@@ -292,7 +243,6 @@ def _analyze_task_for_agents(
292
243
  )
293
244
  reasoning_parts.append("Task involves testing or quality improvement")
294
245
 
295
- # Security-related tasks
296
246
  if any(
297
247
  keyword in task_lower for keyword in ("security", "vulnerability", "secure")
298
248
  ):
@@ -305,7 +255,6 @@ def _analyze_task_for_agents(
305
255
  )
306
256
  reasoning_parts.append("Security concerns detected")
307
257
 
308
- # Performance optimization
309
258
  if any(
310
259
  keyword in task_lower
311
260
  for keyword in ("performance", "optimize", "speed", "slow")
@@ -319,7 +268,6 @@ def _analyze_task_for_agents(
319
268
  )
320
269
  reasoning_parts.append("Performance optimization required")
321
270
 
322
- # Documentation tasks
323
271
  if any(
324
272
  keyword in task_lower for keyword in ("document", "readme", "doc", "explain")
325
273
  ):
@@ -332,7 +280,6 @@ def _analyze_task_for_agents(
332
280
  )
333
281
  reasoning_parts.append("Documentation work identified")
334
282
 
335
- # Import and dependency management
336
283
  if any(
337
284
  keyword in task_lower
338
285
  for keyword in ("import", "dependency", "package", "module")
@@ -344,9 +291,8 @@ def _analyze_task_for_agents(
344
291
  "confidence": 0.7,
345
292
  }
346
293
  )
347
- reasoning_parts.append("Import/dependency work detected")
294
+ reasoning_parts.append("Import / dependency work detected")
348
295
 
349
- # Project type specific suggestions
350
296
  if project_type == "python":
351
297
  workflows.extend(
352
298
  [
@@ -356,7 +302,6 @@ def _analyze_task_for_agents(
356
302
  ]
357
303
  )
358
304
 
359
- # Default fallback
360
305
  if not agents:
361
306
  agents.append(
362
307
  {