crackerjack 0.30.3__py3-none-any.whl → 0.31.7__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 (156) hide show
  1. crackerjack/CLAUDE.md +1005 -0
  2. crackerjack/RULES.md +380 -0
  3. crackerjack/__init__.py +42 -13
  4. crackerjack/__main__.py +227 -299
  5. crackerjack/agents/__init__.py +41 -0
  6. crackerjack/agents/architect_agent.py +281 -0
  7. crackerjack/agents/base.py +170 -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 +657 -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 +409 -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 +585 -0
  37. crackerjack/core/proactive_workflow.py +316 -0
  38. crackerjack/core/session_coordinator.py +289 -0
  39. crackerjack/core/workflow_orchestrator.py +826 -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 +433 -0
  58. crackerjack/managers/test_command_builder.py +151 -0
  59. crackerjack/managers/test_executor.py +443 -0
  60. crackerjack/managers/test_manager.py +258 -0
  61. crackerjack/managers/test_manager_backup.py +1124 -0
  62. crackerjack/managers/test_progress.py +114 -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 +621 -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 +372 -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 +217 -0
  88. crackerjack/mcp/tools/utility_tools.py +341 -0
  89. crackerjack/mcp/tools/workflow_executor.py +565 -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/coverage_improvement.py +223 -0
  107. crackerjack/orchestration/execution_strategies.py +341 -0
  108. crackerjack/orchestration/test_progress_streamer.py +636 -0
  109. crackerjack/plugins/__init__.py +15 -0
  110. crackerjack/plugins/base.py +200 -0
  111. crackerjack/plugins/hooks.py +246 -0
  112. crackerjack/plugins/loader.py +335 -0
  113. crackerjack/plugins/managers.py +259 -0
  114. crackerjack/py313.py +8 -3
  115. crackerjack/services/__init__.py +22 -0
  116. crackerjack/services/cache.py +314 -0
  117. crackerjack/services/config.py +358 -0
  118. crackerjack/services/config_integrity.py +99 -0
  119. crackerjack/services/contextual_ai_assistant.py +516 -0
  120. crackerjack/services/coverage_ratchet.py +356 -0
  121. crackerjack/services/debug.py +736 -0
  122. crackerjack/services/dependency_monitor.py +617 -0
  123. crackerjack/services/enhanced_filesystem.py +439 -0
  124. crackerjack/services/file_hasher.py +151 -0
  125. crackerjack/services/filesystem.py +421 -0
  126. crackerjack/services/git.py +176 -0
  127. crackerjack/services/health_metrics.py +611 -0
  128. crackerjack/services/initialization.py +873 -0
  129. crackerjack/services/log_manager.py +286 -0
  130. crackerjack/services/logging.py +174 -0
  131. crackerjack/services/metrics.py +578 -0
  132. crackerjack/services/pattern_cache.py +362 -0
  133. crackerjack/services/pattern_detector.py +515 -0
  134. crackerjack/services/performance_benchmarks.py +653 -0
  135. crackerjack/services/security.py +163 -0
  136. crackerjack/services/server_manager.py +234 -0
  137. crackerjack/services/smart_scheduling.py +144 -0
  138. crackerjack/services/tool_version_service.py +61 -0
  139. crackerjack/services/unified_config.py +437 -0
  140. crackerjack/services/version_checker.py +248 -0
  141. crackerjack/slash_commands/__init__.py +14 -0
  142. crackerjack/slash_commands/init.md +122 -0
  143. crackerjack/slash_commands/run.md +163 -0
  144. crackerjack/slash_commands/status.md +127 -0
  145. crackerjack-0.31.7.dist-info/METADATA +742 -0
  146. crackerjack-0.31.7.dist-info/RECORD +149 -0
  147. crackerjack-0.31.7.dist-info/entry_points.txt +2 -0
  148. crackerjack/.gitignore +0 -34
  149. crackerjack/.libcst.codemod.yaml +0 -18
  150. crackerjack/.pdm.toml +0 -1
  151. crackerjack/crackerjack.py +0 -3805
  152. crackerjack/pyproject.toml +0 -286
  153. crackerjack-0.30.3.dist-info/METADATA +0 -1290
  154. crackerjack-0.30.3.dist-info/RECORD +0 -16
  155. {crackerjack-0.30.3.dist-info → crackerjack-0.31.7.dist-info}/WHEEL +0 -0
  156. {crackerjack-0.30.3.dist-info → crackerjack-0.31.7.dist-info}/licenses/LICENSE +0 -0
crackerjack/errors.py CHANGED
@@ -31,8 +31,16 @@ class ErrorCode(Enum):
31
31
  PERMISSION_ERROR = 6002
32
32
  FILE_READ_ERROR = 6003
33
33
  FILE_WRITE_ERROR = 6004
34
+ FILE_TOO_LARGE = 6005
34
35
  CODE_CLEANING_ERROR = 7001
35
36
  FORMATTING_ERROR = 7002
37
+ RESOURCE_ERROR = 8001
38
+ TIMEOUT_ERROR = 8002
39
+ NETWORK_ERROR = 8003
40
+ DEPENDENCY_ERROR = 8004
41
+ VALIDATION_ERROR = 8005
42
+ SECURITY_ERROR = 8006
43
+ GENERAL_ERROR = 9000
36
44
  UNKNOWN_ERROR = 9001
37
45
  NOT_IMPLEMENTED = 9002
38
46
  UNEXPECTED_ERROR = 9999
@@ -43,7 +51,7 @@ class CrackerjackError(Exception):
43
51
  self,
44
52
  message: str,
45
53
  error_code: ErrorCode,
46
- details: str | None = None,
54
+ details: str | dict[str, t.Any] | None = None,
47
55
  recovery: str | None = None,
48
56
  exit_code: int = 1,
49
57
  ) -> None:
@@ -56,31 +64,267 @@ class CrackerjackError(Exception):
56
64
 
57
65
 
58
66
  class ConfigError(CrackerjackError):
59
- pass
67
+ def __init__(
68
+ self,
69
+ message: str,
70
+ error_code: ErrorCode = ErrorCode.CONFIG_PARSE_ERROR,
71
+ details: str | dict[str, t.Any] | None = None,
72
+ recovery: str | None = None,
73
+ exit_code: int = 1,
74
+ ) -> None:
75
+ super().__init__(
76
+ message=message,
77
+ error_code=error_code,
78
+ details=details,
79
+ recovery=recovery,
80
+ exit_code=exit_code,
81
+ )
60
82
 
61
83
 
62
84
  class ExecutionError(CrackerjackError):
63
- pass
85
+ def __init__(
86
+ self,
87
+ message: str,
88
+ error_code: ErrorCode = ErrorCode.COMMAND_EXECUTION_ERROR,
89
+ details: str | dict[str, t.Any] | None = None,
90
+ recovery: str | None = None,
91
+ exit_code: int = 1,
92
+ ) -> None:
93
+ super().__init__(
94
+ message=message,
95
+ error_code=error_code,
96
+ details=details,
97
+ recovery=recovery,
98
+ exit_code=exit_code,
99
+ )
64
100
 
65
101
 
66
- class TestError(CrackerjackError):
67
- pass
102
+ class TestExecutionError(CrackerjackError):
103
+ def __init__(
104
+ self,
105
+ message: str,
106
+ error_code: ErrorCode = ErrorCode.TEST_EXECUTION_ERROR,
107
+ details: str | dict[str, t.Any] | None = None,
108
+ recovery: str | None = None,
109
+ exit_code: int = 1,
110
+ ) -> None:
111
+ super().__init__(
112
+ message=message,
113
+ error_code=error_code,
114
+ details=details,
115
+ recovery=recovery,
116
+ exit_code=exit_code,
117
+ )
68
118
 
69
119
 
70
120
  class PublishError(CrackerjackError):
71
- pass
121
+ def __init__(
122
+ self,
123
+ message: str,
124
+ details: str | dict[str, t.Any] | None = None,
125
+ recovery: str | None = None,
126
+ exit_code: int = 1,
127
+ ) -> None:
128
+ super().__init__(
129
+ message=message,
130
+ error_code=ErrorCode.PUBLISH_ERROR,
131
+ details=details,
132
+ recovery=recovery,
133
+ exit_code=exit_code,
134
+ )
72
135
 
73
136
 
74
137
  class GitError(CrackerjackError):
75
- pass
138
+ def __init__(
139
+ self,
140
+ message: str,
141
+ details: str | dict[str, t.Any] | None = None,
142
+ recovery: str | None = None,
143
+ exit_code: int = 1,
144
+ ) -> None:
145
+ super().__init__(
146
+ message=message,
147
+ error_code=ErrorCode.GIT_COMMAND_ERROR,
148
+ details=details,
149
+ recovery=recovery,
150
+ exit_code=exit_code,
151
+ )
76
152
 
77
153
 
78
154
  class FileError(CrackerjackError):
79
- pass
155
+ def __init__(
156
+ self,
157
+ message: str,
158
+ error_code: ErrorCode = ErrorCode.FILE_NOT_FOUND,
159
+ details: str | dict[str, t.Any] | None = None,
160
+ recovery: str | None = None,
161
+ exit_code: int = 1,
162
+ ) -> None:
163
+ super().__init__(
164
+ message=message,
165
+ error_code=error_code,
166
+ details=details,
167
+ recovery=recovery,
168
+ exit_code=exit_code,
169
+ )
80
170
 
81
171
 
82
172
  class CleaningError(CrackerjackError):
83
- pass
173
+ def __init__(
174
+ self,
175
+ message: str,
176
+ details: str | dict[str, t.Any] | None = None,
177
+ recovery: str | None = None,
178
+ exit_code: int = 1,
179
+ ) -> None:
180
+ super().__init__(
181
+ message=message,
182
+ error_code=ErrorCode.EXTERNAL_TOOL_ERROR,
183
+ details=details,
184
+ recovery=recovery,
185
+ exit_code=exit_code,
186
+ )
187
+
188
+
189
+ class NetworkError(CrackerjackError):
190
+ def __init__(
191
+ self,
192
+ message: str,
193
+ details: str | None = None,
194
+ recovery: str | None = None,
195
+ exit_code: int = 1,
196
+ ) -> None:
197
+ super().__init__(
198
+ message=message,
199
+ error_code=ErrorCode.NETWORK_ERROR,
200
+ details=details,
201
+ recovery=recovery,
202
+ exit_code=exit_code,
203
+ )
204
+
205
+
206
+ class DependencyError(CrackerjackError):
207
+ def __init__(
208
+ self,
209
+ message: str,
210
+ details: str | None = None,
211
+ recovery: str | None = None,
212
+ exit_code: int = 1,
213
+ ) -> None:
214
+ super().__init__(
215
+ message=message,
216
+ error_code=ErrorCode.DEPENDENCY_ERROR,
217
+ details=details,
218
+ recovery=recovery,
219
+ exit_code=exit_code,
220
+ )
221
+
222
+
223
+ class ResourceError(CrackerjackError):
224
+ def __init__(
225
+ self,
226
+ message: str,
227
+ details: str | dict[str, t.Any] | None = None,
228
+ recovery: str | None = None,
229
+ exit_code: int = 1,
230
+ ) -> None:
231
+ super().__init__(
232
+ message=message,
233
+ error_code=ErrorCode.RESOURCE_ERROR,
234
+ details=details,
235
+ recovery=recovery,
236
+ exit_code=exit_code,
237
+ )
238
+
239
+
240
+ class ValidationError(CrackerjackError):
241
+ def __init__(
242
+ self,
243
+ message: str,
244
+ details: str | None = None,
245
+ recovery: str | None = None,
246
+ exit_code: int = 1,
247
+ ) -> None:
248
+ super().__init__(
249
+ message=message,
250
+ error_code=ErrorCode.VALIDATION_ERROR,
251
+ details=details,
252
+ recovery=recovery,
253
+ exit_code=exit_code,
254
+ )
255
+
256
+
257
+ class TimeoutError(CrackerjackError):
258
+ def __init__(
259
+ self,
260
+ message: str,
261
+ details: str | None = None,
262
+ recovery: str | None = None,
263
+ exit_code: int = 1,
264
+ ) -> None:
265
+ super().__init__(
266
+ message=message,
267
+ error_code=ErrorCode.TIMEOUT_ERROR,
268
+ details=details,
269
+ recovery=recovery,
270
+ exit_code=exit_code,
271
+ )
272
+
273
+
274
+ class SecurityError(CrackerjackError):
275
+ def __init__(
276
+ self,
277
+ message: str,
278
+ details: str | None = None,
279
+ recovery: str | None = None,
280
+ exit_code: int = 1,
281
+ ) -> None:
282
+ super().__init__(
283
+ message=message,
284
+ error_code=ErrorCode.SECURITY_ERROR,
285
+ details=details,
286
+ recovery=recovery,
287
+ exit_code=exit_code,
288
+ )
289
+
290
+
291
+ def _format_error_for_ai_agent(error: CrackerjackError, verbose: bool) -> str:
292
+ import json
293
+
294
+ error_data = {
295
+ "status": "error",
296
+ "error_code": error.error_code.name,
297
+ "code": error.error_code.value,
298
+ "message": error.message,
299
+ }
300
+ if verbose and error.details:
301
+ error_data["details"] = (
302
+ json.dumps(error.details)
303
+ if isinstance(error.details, dict)
304
+ else error.details
305
+ )
306
+ if error.recovery:
307
+ error_data["recovery"] = error.recovery
308
+
309
+ return json.dumps(error_data)
310
+
311
+
312
+ def _format_error_for_console(error: CrackerjackError, verbose: bool) -> Panel:
313
+ title = f"Error {error.error_code.value}: {error.error_code.name}"
314
+ content = [error.message]
315
+
316
+ if verbose and error.details:
317
+ content.extend(("\n[white]Details: [/white]", str(error.details)))
318
+ if error.recovery:
319
+ content.extend(("\n[green]Recovery suggestion: [/green]", str(error.recovery)))
320
+
321
+ return Panel(
322
+ "\n".join(content),
323
+ title=title,
324
+ border_style="red",
325
+ title_align="left",
326
+ expand=False,
327
+ )
84
328
 
85
329
 
86
330
  def handle_error(
@@ -91,38 +335,12 @@ def handle_error(
91
335
  exit_on_error: bool = True,
92
336
  ) -> None:
93
337
  if ai_agent:
94
- import json
95
-
96
- error_data = {
97
- "status": "error",
98
- "error_code": error.error_code.name,
99
- "code": error.error_code.value,
100
- "message": error.message,
101
- }
102
- if verbose and error.details:
103
- error_data["details"] = error.details
104
- if error.recovery:
105
- error_data["recovery"] = error.recovery
106
- formatted_json = json.dumps(error_data)
338
+ formatted_json = _format_error_for_ai_agent(error, verbose)
107
339
  console.print(f"[json]{formatted_json}[/json]")
108
340
  else:
109
- title = f"Error {error.error_code.value}: {error.error_code.name}"
110
- content = [error.message]
111
- if verbose and error.details:
112
- content.extend(("\n[white]Details:[/white]", str(error.details)))
113
- if error.recovery:
114
- content.extend(
115
- ("\n[green]Recovery suggestion:[/green]", str(error.recovery))
116
- )
117
- console.print(
118
- Panel(
119
- "\n".join(content),
120
- title=title,
121
- border_style="red",
122
- title_align="left",
123
- expand=False,
124
- )
125
- )
341
+ panel = _format_error_for_console(error, verbose)
342
+ console.print(panel)
343
+
126
344
  if exit_on_error:
127
345
  sys.exit(error.exit_code)
128
346
 
@@ -131,7 +349,6 @@ def check_file_exists(path: Path, error_message: str) -> None:
131
349
  if not path.exists():
132
350
  raise FileError(
133
351
  message=error_message,
134
- error_code=ErrorCode.FILE_NOT_FOUND,
135
352
  details=f"The file at {path} does not exist.",
136
353
  recovery="Check the file path and ensure the file exists.",
137
354
  )
@@ -148,10 +365,15 @@ def check_command_result(
148
365
  stderr = getattr(result, "stderr", "")
149
366
  details = f"Command '{command}' failed with return code {result.returncode}."
150
367
  if stderr:
151
- details += f"\nStandard error output:\n{stderr}"
368
+ details += f"\nStandard error output: \n{stderr}"
152
369
  raise ExecutionError(
153
370
  message=error_message,
154
371
  error_code=error_code,
155
372
  details=details,
156
373
  recovery=recovery,
157
374
  )
375
+
376
+
377
+ def format_error_report(error: CrackerjackError) -> str:
378
+ """Format an error for reporting purposes."""
379
+ return f"Error {error.error_code.value}: {error.message}"
@@ -0,0 +1,11 @@
1
+ from .async_hook_executor import AsyncHookExecutor
2
+ from .cached_hook_executor import CachedHookExecutor, SmartCacheManager
3
+ from .hook_executor import HookExecutionResult, HookExecutor
4
+
5
+ __all__ = [
6
+ "AsyncHookExecutor",
7
+ "CachedHookExecutor",
8
+ "HookExecutionResult",
9
+ "HookExecutor",
10
+ "SmartCacheManager",
11
+ ]