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.
- crackerjack/CLAUDE.md +1005 -0
- crackerjack/RULES.md +380 -0
- crackerjack/__init__.py +42 -13
- crackerjack/__main__.py +225 -299
- crackerjack/agents/__init__.py +41 -0
- crackerjack/agents/architect_agent.py +281 -0
- crackerjack/agents/base.py +169 -0
- crackerjack/agents/coordinator.py +512 -0
- crackerjack/agents/documentation_agent.py +498 -0
- crackerjack/agents/dry_agent.py +388 -0
- crackerjack/agents/formatting_agent.py +245 -0
- crackerjack/agents/import_optimization_agent.py +281 -0
- crackerjack/agents/performance_agent.py +669 -0
- crackerjack/agents/proactive_agent.py +104 -0
- crackerjack/agents/refactoring_agent.py +788 -0
- crackerjack/agents/security_agent.py +529 -0
- crackerjack/agents/test_creation_agent.py +652 -0
- crackerjack/agents/test_specialist_agent.py +486 -0
- crackerjack/agents/tracker.py +212 -0
- crackerjack/api.py +560 -0
- crackerjack/cli/__init__.py +24 -0
- crackerjack/cli/facade.py +104 -0
- crackerjack/cli/handlers.py +267 -0
- crackerjack/cli/interactive.py +471 -0
- crackerjack/cli/options.py +401 -0
- crackerjack/cli/utils.py +18 -0
- crackerjack/code_cleaner.py +618 -928
- crackerjack/config/__init__.py +19 -0
- crackerjack/config/hooks.py +218 -0
- crackerjack/core/__init__.py +0 -0
- crackerjack/core/async_workflow_orchestrator.py +406 -0
- crackerjack/core/autofix_coordinator.py +200 -0
- crackerjack/core/container.py +104 -0
- crackerjack/core/enhanced_container.py +542 -0
- crackerjack/core/performance.py +243 -0
- crackerjack/core/phase_coordinator.py +561 -0
- crackerjack/core/proactive_workflow.py +316 -0
- crackerjack/core/session_coordinator.py +289 -0
- crackerjack/core/workflow_orchestrator.py +640 -0
- crackerjack/dynamic_config.py +94 -103
- crackerjack/errors.py +263 -41
- crackerjack/executors/__init__.py +11 -0
- crackerjack/executors/async_hook_executor.py +431 -0
- crackerjack/executors/cached_hook_executor.py +242 -0
- crackerjack/executors/hook_executor.py +345 -0
- crackerjack/executors/individual_hook_executor.py +669 -0
- crackerjack/intelligence/__init__.py +44 -0
- crackerjack/intelligence/adaptive_learning.py +751 -0
- crackerjack/intelligence/agent_orchestrator.py +551 -0
- crackerjack/intelligence/agent_registry.py +414 -0
- crackerjack/intelligence/agent_selector.py +502 -0
- crackerjack/intelligence/integration.py +290 -0
- crackerjack/interactive.py +576 -315
- crackerjack/managers/__init__.py +11 -0
- crackerjack/managers/async_hook_manager.py +135 -0
- crackerjack/managers/hook_manager.py +137 -0
- crackerjack/managers/publish_manager.py +411 -0
- crackerjack/managers/test_command_builder.py +151 -0
- crackerjack/managers/test_executor.py +435 -0
- crackerjack/managers/test_manager.py +258 -0
- crackerjack/managers/test_manager_backup.py +1124 -0
- crackerjack/managers/test_progress.py +144 -0
- crackerjack/mcp/__init__.py +0 -0
- crackerjack/mcp/cache.py +336 -0
- crackerjack/mcp/client_runner.py +104 -0
- crackerjack/mcp/context.py +615 -0
- crackerjack/mcp/dashboard.py +636 -0
- crackerjack/mcp/enhanced_progress_monitor.py +479 -0
- crackerjack/mcp/file_monitor.py +336 -0
- crackerjack/mcp/progress_components.py +569 -0
- crackerjack/mcp/progress_monitor.py +949 -0
- crackerjack/mcp/rate_limiter.py +332 -0
- crackerjack/mcp/server.py +22 -0
- crackerjack/mcp/server_core.py +244 -0
- crackerjack/mcp/service_watchdog.py +501 -0
- crackerjack/mcp/state.py +395 -0
- crackerjack/mcp/task_manager.py +257 -0
- crackerjack/mcp/tools/__init__.py +17 -0
- crackerjack/mcp/tools/core_tools.py +249 -0
- crackerjack/mcp/tools/error_analyzer.py +308 -0
- crackerjack/mcp/tools/execution_tools.py +370 -0
- crackerjack/mcp/tools/execution_tools_backup.py +1097 -0
- crackerjack/mcp/tools/intelligence_tool_registry.py +80 -0
- crackerjack/mcp/tools/intelligence_tools.py +314 -0
- crackerjack/mcp/tools/monitoring_tools.py +502 -0
- crackerjack/mcp/tools/proactive_tools.py +384 -0
- crackerjack/mcp/tools/progress_tools.py +141 -0
- crackerjack/mcp/tools/utility_tools.py +341 -0
- crackerjack/mcp/tools/workflow_executor.py +360 -0
- crackerjack/mcp/websocket/__init__.py +14 -0
- crackerjack/mcp/websocket/app.py +39 -0
- crackerjack/mcp/websocket/endpoints.py +559 -0
- crackerjack/mcp/websocket/jobs.py +253 -0
- crackerjack/mcp/websocket/server.py +116 -0
- crackerjack/mcp/websocket/websocket_handler.py +78 -0
- crackerjack/mcp/websocket_server.py +10 -0
- crackerjack/models/__init__.py +31 -0
- crackerjack/models/config.py +93 -0
- crackerjack/models/config_adapter.py +230 -0
- crackerjack/models/protocols.py +118 -0
- crackerjack/models/task.py +154 -0
- crackerjack/monitoring/ai_agent_watchdog.py +450 -0
- crackerjack/monitoring/regression_prevention.py +638 -0
- crackerjack/orchestration/__init__.py +0 -0
- crackerjack/orchestration/advanced_orchestrator.py +970 -0
- crackerjack/orchestration/execution_strategies.py +341 -0
- crackerjack/orchestration/test_progress_streamer.py +636 -0
- crackerjack/plugins/__init__.py +15 -0
- crackerjack/plugins/base.py +200 -0
- crackerjack/plugins/hooks.py +246 -0
- crackerjack/plugins/loader.py +335 -0
- crackerjack/plugins/managers.py +259 -0
- crackerjack/py313.py +8 -3
- crackerjack/services/__init__.py +22 -0
- crackerjack/services/cache.py +314 -0
- crackerjack/services/config.py +347 -0
- crackerjack/services/config_integrity.py +99 -0
- crackerjack/services/contextual_ai_assistant.py +516 -0
- crackerjack/services/coverage_ratchet.py +347 -0
- crackerjack/services/debug.py +736 -0
- crackerjack/services/dependency_monitor.py +617 -0
- crackerjack/services/enhanced_filesystem.py +439 -0
- crackerjack/services/file_hasher.py +151 -0
- crackerjack/services/filesystem.py +395 -0
- crackerjack/services/git.py +165 -0
- crackerjack/services/health_metrics.py +611 -0
- crackerjack/services/initialization.py +847 -0
- crackerjack/services/log_manager.py +286 -0
- crackerjack/services/logging.py +174 -0
- crackerjack/services/metrics.py +578 -0
- crackerjack/services/pattern_cache.py +362 -0
- crackerjack/services/pattern_detector.py +515 -0
- crackerjack/services/performance_benchmarks.py +653 -0
- crackerjack/services/security.py +163 -0
- crackerjack/services/server_manager.py +234 -0
- crackerjack/services/smart_scheduling.py +144 -0
- crackerjack/services/tool_version_service.py +61 -0
- crackerjack/services/unified_config.py +437 -0
- crackerjack/services/version_checker.py +248 -0
- crackerjack/slash_commands/__init__.py +14 -0
- crackerjack/slash_commands/init.md +122 -0
- crackerjack/slash_commands/run.md +163 -0
- crackerjack/slash_commands/status.md +127 -0
- crackerjack-0.31.4.dist-info/METADATA +742 -0
- crackerjack-0.31.4.dist-info/RECORD +148 -0
- crackerjack-0.31.4.dist-info/entry_points.txt +2 -0
- crackerjack/.gitignore +0 -34
- crackerjack/.libcst.codemod.yaml +0 -18
- crackerjack/.pdm.toml +0 -1
- crackerjack/crackerjack.py +0 -3805
- crackerjack/pyproject.toml +0 -286
- crackerjack-0.30.3.dist-info/METADATA +0 -1290
- crackerjack-0.30.3.dist-info/RECORD +0 -16
- {crackerjack-0.30.3.dist-info → crackerjack-0.31.4.dist-info}/WHEEL +0 -0
- {crackerjack-0.30.3.dist-info → crackerjack-0.31.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
from abc import abstractmethod
|
|
3
|
+
|
|
4
|
+
from .base import AgentContext, FixResult, Issue, SubAgent
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProactiveAgent(SubAgent):
|
|
8
|
+
"""Base class for agents that can plan before executing fixes.
|
|
9
|
+
|
|
10
|
+
Proactive agents analyze the codebase and create architectural plans
|
|
11
|
+
before applying fixes, preventing violations rather than just fixing them.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, context: AgentContext) -> None:
|
|
15
|
+
super().__init__(context)
|
|
16
|
+
self._planning_cache: dict[str, dict[str, t.Any]] = {}
|
|
17
|
+
self._pattern_cache: dict[str, t.Any] = {}
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
async def plan_before_action(self, issue: Issue) -> dict[str, t.Any]:
|
|
21
|
+
"""Create an architectural plan before fixing the issue.
|
|
22
|
+
|
|
23
|
+
Returns a plan dictionary with:
|
|
24
|
+
- strategy: How to approach the fix
|
|
25
|
+
- patterns: Recommended patterns to use
|
|
26
|
+
- dependencies: Other changes needed
|
|
27
|
+
- risks: Potential issues to watch for
|
|
28
|
+
"""
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
async def analyze_and_fix_proactively(self, issue: Issue) -> FixResult:
|
|
32
|
+
"""Execute proactive fix with planning phase.
|
|
33
|
+
|
|
34
|
+
1. Create architectural plan
|
|
35
|
+
2. Apply fix following the plan
|
|
36
|
+
3. Validate against plan
|
|
37
|
+
4. Cache successful patterns
|
|
38
|
+
"""
|
|
39
|
+
# Check planning cache first
|
|
40
|
+
cache_key = self._get_planning_cache_key(issue)
|
|
41
|
+
if cache_key in self._planning_cache:
|
|
42
|
+
plan = self._planning_cache[cache_key]
|
|
43
|
+
self.log(f"Using cached plan for {cache_key}")
|
|
44
|
+
else:
|
|
45
|
+
plan = await self.plan_before_action(issue)
|
|
46
|
+
self._planning_cache[cache_key] = plan
|
|
47
|
+
self.log(f"Created new plan for {cache_key}")
|
|
48
|
+
|
|
49
|
+
# Execute the fix with the plan
|
|
50
|
+
result = await self._execute_with_plan(issue, plan)
|
|
51
|
+
|
|
52
|
+
# Cache successful patterns
|
|
53
|
+
if result.success and result.confidence >= 0.8:
|
|
54
|
+
self._cache_successful_pattern(issue, plan, result)
|
|
55
|
+
|
|
56
|
+
return result
|
|
57
|
+
|
|
58
|
+
async def _execute_with_plan(
|
|
59
|
+
self, issue: Issue, plan: dict[str, t.Any]
|
|
60
|
+
) -> FixResult:
|
|
61
|
+
"""Execute the fix following the architectural plan."""
|
|
62
|
+
# Default implementation falls back to standard analyze_and_fix
|
|
63
|
+
# Subclasses should override to use the plan
|
|
64
|
+
return await self.analyze_and_fix(issue)
|
|
65
|
+
|
|
66
|
+
def _get_planning_cache_key(self, issue: Issue) -> str:
|
|
67
|
+
"""Generate cache key for planning."""
|
|
68
|
+
return f"{issue.type.value}:{issue.file_path}:{issue.line_number}"
|
|
69
|
+
|
|
70
|
+
def _cache_successful_pattern(
|
|
71
|
+
self, issue: Issue, plan: dict[str, t.Any], result: FixResult
|
|
72
|
+
) -> None:
|
|
73
|
+
"""Cache successful patterns for future reuse."""
|
|
74
|
+
pattern_key = f"{issue.type.value}_{plan.get('strategy', 'default')}"
|
|
75
|
+
self._pattern_cache[pattern_key] = {
|
|
76
|
+
"plan": plan,
|
|
77
|
+
"confidence": result.confidence,
|
|
78
|
+
"files_modified": result.files_modified,
|
|
79
|
+
"fixes_applied": result.fixes_applied,
|
|
80
|
+
}
|
|
81
|
+
self.log(f"Cached successful pattern: {pattern_key}")
|
|
82
|
+
|
|
83
|
+
def get_cached_patterns(self) -> dict[str, t.Any]:
|
|
84
|
+
"""Get all cached patterns for inspection."""
|
|
85
|
+
return self._pattern_cache.copy()
|
|
86
|
+
|
|
87
|
+
def clear_pattern_cache(self) -> None:
|
|
88
|
+
"""Clear the pattern cache."""
|
|
89
|
+
self._pattern_cache.clear()
|
|
90
|
+
self.log("Cleared pattern cache")
|
|
91
|
+
|
|
92
|
+
def get_planning_confidence(self, issue: Issue) -> float:
|
|
93
|
+
"""Get confidence in planning ability for this issue."""
|
|
94
|
+
# Check if we have cached patterns for this issue type
|
|
95
|
+
issue_patterns = [
|
|
96
|
+
key for key in self._pattern_cache if key.startswith(issue.type.value)
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
if issue_patterns:
|
|
100
|
+
# Higher confidence if we have successful patterns
|
|
101
|
+
return min(0.9, 0.6 + (len(issue_patterns) * 0.1))
|
|
102
|
+
|
|
103
|
+
# Base confidence from can_handle
|
|
104
|
+
return 0.5
|