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
@@ -9,12 +9,6 @@ from ..models.protocols import OptionsProtocol
9
9
 
10
10
 
11
11
  class ProactiveWorkflowPipeline:
12
- """Enhanced workflow pipeline with proactive architectural planning.
13
-
14
- This pipeline adds a planning phase before each iteration to prevent
15
- issues through intelligent architecture rather than reactive fixing.
16
- """
17
-
18
12
  def __init__(self, project_path: Path) -> None:
19
13
  self.project_path = project_path
20
14
  self.logger = logging.getLogger(__name__)
@@ -23,22 +17,18 @@ class ProactiveWorkflowPipeline:
23
17
  async def run_complete_workflow_with_planning(
24
18
  self, options: OptionsProtocol
25
19
  ) -> bool:
26
- """Execute workflow with proactive planning phases."""
27
20
  self.logger.info("Starting proactive workflow with architectural planning")
28
21
 
29
22
  start_time = time.time()
30
23
 
31
24
  try:
32
- # Phase 1: Initial architectural assessment
33
25
  assessment = await self._assess_codebase_architecture()
34
26
 
35
27
  if assessment.needs_planning:
36
28
  self.logger.info("Codebase requires architectural planning")
37
29
 
38
- # Phase 2: Create comprehensive architectural plan
39
30
  architectural_plan = await self._create_comprehensive_plan(assessment)
40
31
 
41
- # Phase 3: Execute workflow following the plan
42
32
  result = await self._execute_planned_workflow(
43
33
  options, architectural_plan
44
34
  )
@@ -46,33 +36,29 @@ class ProactiveWorkflowPipeline:
46
36
  self.logger.info(
47
37
  "Codebase is architecturally sound, using standard workflow"
48
38
  )
49
- # Fallback to standard workflow for simple fixes
39
+
50
40
  result = await self._execute_standard_workflow(options)
51
41
 
52
42
  execution_time = time.time() - start_time
53
- self.logger.info(f"Proactive workflow completed in {execution_time:.2f}s")
43
+ self.logger.info(f"Proactive workflow completed in {execution_time: .2f}s")
54
44
 
55
45
  return result
56
46
 
57
47
  except Exception as e:
58
48
  self.logger.exception(f"Proactive workflow failed: {e}")
59
- # Fallback to standard workflow on planning failure
49
+
60
50
  return await self._execute_standard_workflow(options)
61
51
 
62
52
  async def _assess_codebase_architecture(self) -> "ArchitecturalAssessment":
63
- """Assess the codebase to determine if proactive planning is needed."""
64
53
  self.logger.info("Assessing codebase architecture...")
65
54
 
66
- # Initialize architect coordinator if needed
67
55
  if not self._architect_agent_coordinator:
68
56
  agent_context = AgentContext(project_path=self.project_path)
69
57
  self._architect_agent_coordinator = AgentCoordinator(agent_context)
70
58
  self._architect_agent_coordinator.initialize_agents()
71
59
 
72
- # Create test issues to assess complexity
73
60
  test_issues = await self._identify_potential_issues()
74
61
 
75
- # Determine if planning is beneficial
76
62
  needs_planning = self._evaluate_planning_need(test_issues)
77
63
 
78
64
  return ArchitecturalAssessment(
@@ -83,13 +69,8 @@ class ProactiveWorkflowPipeline:
83
69
  )
84
70
 
85
71
  async def _identify_potential_issues(self) -> list[Issue]:
86
- """Identify potential architectural issues in the codebase."""
87
- # This would integrate with static analysis tools
88
- # For now, create representative issues based on common patterns
89
-
90
72
  potential_issues = []
91
73
 
92
- # Check for complexity hotspots (would use real analysis)
93
74
  potential_issues.extend(
94
75
  (
95
76
  Issue(
@@ -114,12 +95,6 @@ class ProactiveWorkflowPipeline:
114
95
  return potential_issues
115
96
 
116
97
  def _evaluate_planning_need(self, issues: list[Issue]) -> bool:
117
- """Evaluate if proactive planning would be beneficial."""
118
- # Planning is beneficial for:
119
- # 1. Multiple complex issues
120
- # 2. Architectural issues (complexity, DRY, performance)
121
- # 3. Projects with many interdependencies
122
-
123
98
  complex_issues = [
124
99
  issue
125
100
  for issue in issues
@@ -127,18 +102,16 @@ class ProactiveWorkflowPipeline:
127
102
  in {IssueType.COMPLEXITY, IssueType.DRY_VIOLATION, IssueType.PERFORMANCE}
128
103
  ]
129
104
 
130
- # Need planning if we have 2+ complex issues
131
105
  return len(complex_issues) >= 2
132
106
 
133
107
  async def _create_comprehensive_plan(
134
108
  self, assessment: "ArchitecturalAssessment"
135
109
  ) -> dict[str, t.Any]:
136
- """Create comprehensive architectural plan based on assessment."""
137
110
  self.logger.info("Creating comprehensive architectural plan...")
138
111
 
139
- assert self._architect_agent_coordinator is not None
112
+ if self._architect_agent_coordinator is None:
113
+ raise RuntimeError("ArchitectAgentCoordinator is not initialized")
140
114
 
141
- # Use ArchitectAgent to create the plan
142
115
  architect = self._architect_agent_coordinator._get_architect_agent()
143
116
 
144
117
  if not architect:
@@ -149,7 +122,6 @@ class ProactiveWorkflowPipeline:
149
122
  "patterns": ["default"],
150
123
  }
151
124
 
152
- # Create plan for the most complex issue as representative
153
125
  complex_issues = [
154
126
  issue
155
127
  for issue in assessment.potential_issues
@@ -160,7 +132,6 @@ class ProactiveWorkflowPipeline:
160
132
  primary_issue = complex_issues[0]
161
133
  base_plan = await architect.plan_before_action(primary_issue)
162
134
 
163
- # Extend to comprehensive workflow plan
164
135
  comprehensive_plan = base_plan | {
165
136
  "phases": [
166
137
  "configuration_setup",
@@ -190,24 +161,20 @@ class ProactiveWorkflowPipeline:
190
161
  async def _execute_planned_workflow(
191
162
  self, options: OptionsProtocol, plan: dict[str, t.Any]
192
163
  ) -> bool:
193
- """Execute workflow following the architectural plan."""
194
164
  strategy = plan.get("strategy", "basic_reactive")
195
165
  phases = plan.get("phases", ["standard_workflow"])
196
166
 
197
167
  self.logger.info(f"Executing {strategy} workflow with {len(phases)} phases")
198
168
 
199
- # Execute each phase according to the plan
200
169
  for phase in phases:
201
170
  success = await self._execute_workflow_phase(phase, options, plan)
202
171
  if not success and phase in (
203
172
  "configuration_setup",
204
173
  "architectural_refactoring",
205
174
  ):
206
- # Critical phases - fail fast
207
175
  self.logger.error(f"Critical phase {phase} failed")
208
176
  return False
209
177
  elif not success:
210
- # Non-critical phases - log and continue
211
178
  self.logger.warning(f"Phase {phase} had issues but continuing")
212
179
 
213
180
  return True
@@ -215,10 +182,8 @@ class ProactiveWorkflowPipeline:
215
182
  async def _execute_workflow_phase(
216
183
  self, phase: str, options: OptionsProtocol, plan: dict[str, t.Any]
217
184
  ) -> bool:
218
- """Execute a specific workflow phase."""
219
185
  self.logger.info(f"Executing phase: {phase}")
220
186
 
221
- # Different phase implementations
222
187
  if phase == "configuration_setup":
223
188
  return await self._setup_with_architecture(options, plan)
224
189
  elif phase == "fast_hooks_with_architecture":
@@ -229,38 +194,31 @@ class ProactiveWorkflowPipeline:
229
194
  return await self._comprehensive_validation(options, plan)
230
195
  elif phase == "pattern_learning":
231
196
  return await self._learn_and_cache_patterns(plan)
232
- # Fallback to standard workflow for unknown phases
197
+
233
198
  return await self._execute_standard_workflow(options)
234
199
 
235
200
  async def _setup_with_architecture(
236
201
  self, options: OptionsProtocol, plan: dict[str, t.Any]
237
202
  ) -> bool:
238
- """Setup phase with architectural considerations."""
239
203
  self.logger.info("Setting up project with architectural planning")
240
- # This would integrate with existing setup logic
241
- # For now, return success as architecture is already integrated
204
+
242
205
  return True
243
206
 
244
207
  async def _run_fast_hooks_with_planning(
245
208
  self, options: OptionsProtocol, plan: dict[str, t.Any]
246
209
  ) -> bool:
247
- """Run fast hooks with architectural awareness."""
248
210
  self.logger.info("Running fast hooks with architectural planning")
249
- # This would integrate with existing hook manager
250
- # Enhanced to use architectural patterns from the plan
211
+
251
212
  return True
252
213
 
253
214
  async def _perform_architectural_refactoring(
254
215
  self, options: OptionsProtocol, plan: dict[str, t.Any]
255
216
  ) -> bool:
256
- """Perform refactoring following architectural plan."""
257
217
  self.logger.info("Performing architectural refactoring")
258
218
 
259
- # Use ArchitectAgent to guide refactoring
260
219
  if self._architect_agent_coordinator:
261
220
  architect = self._architect_agent_coordinator._get_architect_agent()
262
221
  if architect:
263
- # This would apply the architectural patterns
264
222
  patterns = plan.get("patterns", [])
265
223
  self.logger.info(f"Applying architectural patterns: {patterns}")
266
224
  return True
@@ -270,21 +228,17 @@ class ProactiveWorkflowPipeline:
270
228
  async def _comprehensive_validation(
271
229
  self, options: OptionsProtocol, plan: dict[str, t.Any]
272
230
  ) -> bool:
273
- """Validate results against architectural plan."""
274
231
  self.logger.info("Performing comprehensive validation")
275
232
  validation_steps = plan.get("validation", [])
276
233
 
277
234
  for step in validation_steps:
278
235
  self.logger.info(f"Validating: {step}")
279
- # Implement specific validation logic
280
236
 
281
237
  return True
282
238
 
283
239
  async def _learn_and_cache_patterns(self, plan: dict[str, t.Any]) -> bool:
284
- """Learn from successful patterns and cache them."""
285
240
  self.logger.info("Learning and caching successful patterns")
286
241
 
287
- # Cache successful patterns from the plan
288
242
  if self._architect_agent_coordinator:
289
243
  architect = self._architect_agent_coordinator._get_architect_agent()
290
244
  if architect and hasattr(architect, "get_cached_patterns"):
@@ -294,15 +248,12 @@ class ProactiveWorkflowPipeline:
294
248
  return True
295
249
 
296
250
  async def _execute_standard_workflow(self, options: OptionsProtocol) -> bool:
297
- """Fallback to standard workflow execution."""
298
251
  self.logger.info("Executing standard workflow (fallback)")
299
- # This would delegate to the existing workflow pipeline
252
+
300
253
  return True
301
254
 
302
255
 
303
256
  class ArchitecturalAssessment:
304
- """Assessment of codebase architecture for planning decisions."""
305
-
306
257
  def __init__(
307
258
  self,
308
259
  needs_planning: bool,