crackerjack 0.18.2__py3-none-any.whl → 0.45.2__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.
- crackerjack/README.md +19 -0
- crackerjack/__init__.py +96 -2
- crackerjack/__main__.py +637 -138
- crackerjack/adapters/README.md +18 -0
- crackerjack/adapters/__init__.py +39 -0
- crackerjack/adapters/_output_paths.py +167 -0
- crackerjack/adapters/_qa_adapter_base.py +309 -0
- crackerjack/adapters/_tool_adapter_base.py +706 -0
- crackerjack/adapters/ai/README.md +65 -0
- crackerjack/adapters/ai/__init__.py +5 -0
- crackerjack/adapters/ai/claude.py +853 -0
- crackerjack/adapters/complexity/README.md +53 -0
- crackerjack/adapters/complexity/__init__.py +10 -0
- crackerjack/adapters/complexity/complexipy.py +641 -0
- crackerjack/adapters/dependency/__init__.py +22 -0
- crackerjack/adapters/dependency/pip_audit.py +418 -0
- crackerjack/adapters/format/README.md +72 -0
- crackerjack/adapters/format/__init__.py +11 -0
- crackerjack/adapters/format/mdformat.py +313 -0
- crackerjack/adapters/format/ruff.py +516 -0
- crackerjack/adapters/lint/README.md +47 -0
- crackerjack/adapters/lint/__init__.py +11 -0
- crackerjack/adapters/lint/codespell.py +273 -0
- crackerjack/adapters/lsp/README.md +49 -0
- crackerjack/adapters/lsp/__init__.py +27 -0
- crackerjack/adapters/lsp/_base.py +194 -0
- crackerjack/adapters/lsp/_client.py +358 -0
- crackerjack/adapters/lsp/_manager.py +193 -0
- crackerjack/adapters/lsp/skylos.py +283 -0
- crackerjack/adapters/lsp/zuban.py +557 -0
- crackerjack/adapters/refactor/README.md +59 -0
- crackerjack/adapters/refactor/__init__.py +12 -0
- crackerjack/adapters/refactor/creosote.py +318 -0
- crackerjack/adapters/refactor/refurb.py +406 -0
- crackerjack/adapters/refactor/skylos.py +494 -0
- crackerjack/adapters/sast/README.md +132 -0
- crackerjack/adapters/sast/__init__.py +32 -0
- crackerjack/adapters/sast/_base.py +201 -0
- crackerjack/adapters/sast/bandit.py +423 -0
- crackerjack/adapters/sast/pyscn.py +405 -0
- crackerjack/adapters/sast/semgrep.py +241 -0
- crackerjack/adapters/security/README.md +111 -0
- crackerjack/adapters/security/__init__.py +17 -0
- crackerjack/adapters/security/gitleaks.py +339 -0
- crackerjack/adapters/type/README.md +52 -0
- crackerjack/adapters/type/__init__.py +12 -0
- crackerjack/adapters/type/pyrefly.py +402 -0
- crackerjack/adapters/type/ty.py +402 -0
- crackerjack/adapters/type/zuban.py +522 -0
- crackerjack/adapters/utility/README.md +51 -0
- crackerjack/adapters/utility/__init__.py +10 -0
- crackerjack/adapters/utility/checks.py +884 -0
- crackerjack/agents/README.md +264 -0
- crackerjack/agents/__init__.py +66 -0
- crackerjack/agents/architect_agent.py +238 -0
- crackerjack/agents/base.py +167 -0
- crackerjack/agents/claude_code_bridge.py +641 -0
- crackerjack/agents/coordinator.py +600 -0
- crackerjack/agents/documentation_agent.py +520 -0
- crackerjack/agents/dry_agent.py +585 -0
- crackerjack/agents/enhanced_coordinator.py +279 -0
- crackerjack/agents/enhanced_proactive_agent.py +185 -0
- crackerjack/agents/error_middleware.py +53 -0
- crackerjack/agents/formatting_agent.py +230 -0
- crackerjack/agents/helpers/__init__.py +9 -0
- crackerjack/agents/helpers/performance/__init__.py +22 -0
- crackerjack/agents/helpers/performance/performance_ast_analyzer.py +357 -0
- crackerjack/agents/helpers/performance/performance_pattern_detector.py +909 -0
- crackerjack/agents/helpers/performance/performance_recommender.py +572 -0
- crackerjack/agents/helpers/refactoring/__init__.py +22 -0
- crackerjack/agents/helpers/refactoring/code_transformer.py +536 -0
- crackerjack/agents/helpers/refactoring/complexity_analyzer.py +344 -0
- crackerjack/agents/helpers/refactoring/dead_code_detector.py +437 -0
- crackerjack/agents/helpers/test_creation/__init__.py +19 -0
- crackerjack/agents/helpers/test_creation/test_ast_analyzer.py +216 -0
- crackerjack/agents/helpers/test_creation/test_coverage_analyzer.py +643 -0
- crackerjack/agents/helpers/test_creation/test_template_generator.py +1031 -0
- crackerjack/agents/import_optimization_agent.py +1181 -0
- crackerjack/agents/performance_agent.py +325 -0
- crackerjack/agents/performance_helpers.py +205 -0
- crackerjack/agents/proactive_agent.py +55 -0
- crackerjack/agents/refactoring_agent.py +511 -0
- crackerjack/agents/refactoring_helpers.py +247 -0
- crackerjack/agents/security_agent.py +793 -0
- crackerjack/agents/semantic_agent.py +479 -0
- crackerjack/agents/semantic_helpers.py +356 -0
- crackerjack/agents/test_creation_agent.py +570 -0
- crackerjack/agents/test_specialist_agent.py +526 -0
- crackerjack/agents/tracker.py +110 -0
- crackerjack/api.py +647 -0
- crackerjack/cli/README.md +394 -0
- crackerjack/cli/__init__.py +24 -0
- crackerjack/cli/cache_handlers.py +209 -0
- crackerjack/cli/cache_handlers_enhanced.py +680 -0
- crackerjack/cli/facade.py +162 -0
- crackerjack/cli/formatting.py +13 -0
- crackerjack/cli/handlers/__init__.py +85 -0
- crackerjack/cli/handlers/advanced.py +103 -0
- crackerjack/cli/handlers/ai_features.py +62 -0
- crackerjack/cli/handlers/analytics.py +479 -0
- crackerjack/cli/handlers/changelog.py +271 -0
- crackerjack/cli/handlers/config_handlers.py +16 -0
- crackerjack/cli/handlers/coverage.py +84 -0
- crackerjack/cli/handlers/documentation.py +280 -0
- crackerjack/cli/handlers/main_handlers.py +497 -0
- crackerjack/cli/handlers/monitoring.py +371 -0
- crackerjack/cli/handlers.py +700 -0
- crackerjack/cli/interactive.py +488 -0
- crackerjack/cli/options.py +1216 -0
- crackerjack/cli/semantic_handlers.py +292 -0
- crackerjack/cli/utils.py +19 -0
- crackerjack/cli/version.py +19 -0
- crackerjack/code_cleaner.py +1307 -0
- crackerjack/config/README.md +472 -0
- crackerjack/config/__init__.py +275 -0
- crackerjack/config/global_lock_config.py +207 -0
- crackerjack/config/hooks.py +390 -0
- crackerjack/config/loader.py +239 -0
- crackerjack/config/settings.py +141 -0
- crackerjack/config/tool_commands.py +331 -0
- crackerjack/core/README.md +393 -0
- crackerjack/core/__init__.py +0 -0
- crackerjack/core/async_workflow_orchestrator.py +738 -0
- crackerjack/core/autofix_coordinator.py +282 -0
- crackerjack/core/container.py +105 -0
- crackerjack/core/enhanced_container.py +583 -0
- crackerjack/core/file_lifecycle.py +472 -0
- crackerjack/core/performance.py +244 -0
- crackerjack/core/performance_monitor.py +357 -0
- crackerjack/core/phase_coordinator.py +1227 -0
- crackerjack/core/proactive_workflow.py +267 -0
- crackerjack/core/resource_manager.py +425 -0
- crackerjack/core/retry.py +275 -0
- crackerjack/core/service_watchdog.py +601 -0
- crackerjack/core/session_coordinator.py +239 -0
- crackerjack/core/timeout_manager.py +563 -0
- crackerjack/core/websocket_lifecycle.py +410 -0
- crackerjack/core/workflow/__init__.py +21 -0
- crackerjack/core/workflow/workflow_ai_coordinator.py +863 -0
- crackerjack/core/workflow/workflow_event_orchestrator.py +1107 -0
- crackerjack/core/workflow/workflow_issue_parser.py +714 -0
- crackerjack/core/workflow/workflow_phase_executor.py +1158 -0
- crackerjack/core/workflow/workflow_security_gates.py +400 -0
- crackerjack/core/workflow_orchestrator.py +2243 -0
- crackerjack/data/README.md +11 -0
- crackerjack/data/__init__.py +8 -0
- crackerjack/data/models.py +79 -0
- crackerjack/data/repository.py +210 -0
- crackerjack/decorators/README.md +180 -0
- crackerjack/decorators/__init__.py +35 -0
- crackerjack/decorators/error_handling.py +649 -0
- crackerjack/decorators/error_handling_decorators.py +334 -0
- crackerjack/decorators/helpers.py +58 -0
- crackerjack/decorators/patterns.py +281 -0
- crackerjack/decorators/utils.py +58 -0
- crackerjack/docs/INDEX.md +11 -0
- crackerjack/docs/README.md +11 -0
- crackerjack/docs/generated/api/API_REFERENCE.md +10895 -0
- crackerjack/docs/generated/api/CLI_REFERENCE.md +109 -0
- crackerjack/docs/generated/api/CROSS_REFERENCES.md +1755 -0
- crackerjack/docs/generated/api/PROTOCOLS.md +3 -0
- crackerjack/docs/generated/api/SERVICES.md +1252 -0
- crackerjack/documentation/README.md +11 -0
- crackerjack/documentation/__init__.py +31 -0
- crackerjack/documentation/ai_templates.py +756 -0
- crackerjack/documentation/dual_output_generator.py +767 -0
- crackerjack/documentation/mkdocs_integration.py +518 -0
- crackerjack/documentation/reference_generator.py +1065 -0
- crackerjack/dynamic_config.py +678 -0
- crackerjack/errors.py +378 -0
- crackerjack/events/README.md +11 -0
- crackerjack/events/__init__.py +16 -0
- crackerjack/events/telemetry.py +175 -0
- crackerjack/events/workflow_bus.py +346 -0
- crackerjack/exceptions/README.md +301 -0
- crackerjack/exceptions/__init__.py +5 -0
- crackerjack/exceptions/config.py +4 -0
- crackerjack/exceptions/tool_execution_error.py +245 -0
- crackerjack/executors/README.md +591 -0
- crackerjack/executors/__init__.py +13 -0
- crackerjack/executors/async_hook_executor.py +938 -0
- crackerjack/executors/cached_hook_executor.py +316 -0
- crackerjack/executors/hook_executor.py +1295 -0
- crackerjack/executors/hook_lock_manager.py +708 -0
- crackerjack/executors/individual_hook_executor.py +739 -0
- crackerjack/executors/lsp_aware_hook_executor.py +349 -0
- crackerjack/executors/progress_hook_executor.py +282 -0
- crackerjack/executors/tool_proxy.py +433 -0
- crackerjack/hooks/README.md +485 -0
- crackerjack/hooks/lsp_hook.py +93 -0
- crackerjack/intelligence/README.md +557 -0
- crackerjack/intelligence/__init__.py +37 -0
- crackerjack/intelligence/adaptive_learning.py +693 -0
- crackerjack/intelligence/agent_orchestrator.py +485 -0
- crackerjack/intelligence/agent_registry.py +377 -0
- crackerjack/intelligence/agent_selector.py +439 -0
- crackerjack/intelligence/integration.py +250 -0
- crackerjack/interactive.py +719 -0
- crackerjack/managers/README.md +369 -0
- crackerjack/managers/__init__.py +11 -0
- crackerjack/managers/async_hook_manager.py +135 -0
- crackerjack/managers/hook_manager.py +585 -0
- crackerjack/managers/publish_manager.py +631 -0
- crackerjack/managers/test_command_builder.py +391 -0
- crackerjack/managers/test_executor.py +474 -0
- crackerjack/managers/test_manager.py +1357 -0
- crackerjack/managers/test_progress.py +187 -0
- crackerjack/mcp/README.md +374 -0
- crackerjack/mcp/__init__.py +0 -0
- crackerjack/mcp/cache.py +352 -0
- crackerjack/mcp/client_runner.py +121 -0
- crackerjack/mcp/context.py +802 -0
- crackerjack/mcp/dashboard.py +657 -0
- crackerjack/mcp/enhanced_progress_monitor.py +493 -0
- crackerjack/mcp/file_monitor.py +394 -0
- crackerjack/mcp/progress_components.py +607 -0
- crackerjack/mcp/progress_monitor.py +1016 -0
- crackerjack/mcp/rate_limiter.py +336 -0
- crackerjack/mcp/server.py +24 -0
- crackerjack/mcp/server_core.py +526 -0
- crackerjack/mcp/service_watchdog.py +505 -0
- crackerjack/mcp/state.py +407 -0
- crackerjack/mcp/task_manager.py +259 -0
- crackerjack/mcp/tools/README.md +27 -0
- crackerjack/mcp/tools/__init__.py +19 -0
- crackerjack/mcp/tools/core_tools.py +469 -0
- crackerjack/mcp/tools/error_analyzer.py +283 -0
- crackerjack/mcp/tools/execution_tools.py +384 -0
- crackerjack/mcp/tools/intelligence_tool_registry.py +46 -0
- crackerjack/mcp/tools/intelligence_tools.py +264 -0
- crackerjack/mcp/tools/monitoring_tools.py +628 -0
- crackerjack/mcp/tools/proactive_tools.py +367 -0
- crackerjack/mcp/tools/progress_tools.py +222 -0
- crackerjack/mcp/tools/semantic_tools.py +584 -0
- crackerjack/mcp/tools/utility_tools.py +358 -0
- crackerjack/mcp/tools/workflow_executor.py +699 -0
- crackerjack/mcp/websocket/README.md +31 -0
- crackerjack/mcp/websocket/__init__.py +14 -0
- crackerjack/mcp/websocket/app.py +54 -0
- crackerjack/mcp/websocket/endpoints.py +492 -0
- crackerjack/mcp/websocket/event_bridge.py +188 -0
- crackerjack/mcp/websocket/jobs.py +406 -0
- crackerjack/mcp/websocket/monitoring/__init__.py +25 -0
- crackerjack/mcp/websocket/monitoring/api/__init__.py +19 -0
- crackerjack/mcp/websocket/monitoring/api/dependencies.py +141 -0
- crackerjack/mcp/websocket/monitoring/api/heatmap.py +154 -0
- crackerjack/mcp/websocket/monitoring/api/intelligence.py +199 -0
- crackerjack/mcp/websocket/monitoring/api/metrics.py +203 -0
- crackerjack/mcp/websocket/monitoring/api/telemetry.py +101 -0
- crackerjack/mcp/websocket/monitoring/dashboard.py +18 -0
- crackerjack/mcp/websocket/monitoring/factory.py +109 -0
- crackerjack/mcp/websocket/monitoring/filters.py +10 -0
- crackerjack/mcp/websocket/monitoring/metrics.py +64 -0
- crackerjack/mcp/websocket/monitoring/models.py +90 -0
- crackerjack/mcp/websocket/monitoring/utils.py +171 -0
- crackerjack/mcp/websocket/monitoring/websocket_manager.py +78 -0
- crackerjack/mcp/websocket/monitoring/websockets/__init__.py +17 -0
- crackerjack/mcp/websocket/monitoring/websockets/dependencies.py +126 -0
- crackerjack/mcp/websocket/monitoring/websockets/heatmap.py +176 -0
- crackerjack/mcp/websocket/monitoring/websockets/intelligence.py +291 -0
- crackerjack/mcp/websocket/monitoring/websockets/metrics.py +291 -0
- crackerjack/mcp/websocket/monitoring_endpoints.py +21 -0
- crackerjack/mcp/websocket/server.py +174 -0
- crackerjack/mcp/websocket/websocket_handler.py +276 -0
- crackerjack/mcp/websocket_server.py +10 -0
- crackerjack/models/README.md +308 -0
- crackerjack/models/__init__.py +40 -0
- crackerjack/models/config.py +730 -0
- crackerjack/models/config_adapter.py +265 -0
- crackerjack/models/protocols.py +1535 -0
- crackerjack/models/pydantic_models.py +320 -0
- crackerjack/models/qa_config.py +145 -0
- crackerjack/models/qa_results.py +134 -0
- crackerjack/models/resource_protocols.py +299 -0
- crackerjack/models/results.py +35 -0
- crackerjack/models/semantic_models.py +258 -0
- crackerjack/models/task.py +173 -0
- crackerjack/models/test_models.py +60 -0
- crackerjack/monitoring/README.md +11 -0
- crackerjack/monitoring/__init__.py +0 -0
- crackerjack/monitoring/ai_agent_watchdog.py +405 -0
- crackerjack/monitoring/metrics_collector.py +427 -0
- crackerjack/monitoring/regression_prevention.py +580 -0
- crackerjack/monitoring/websocket_server.py +406 -0
- crackerjack/orchestration/README.md +340 -0
- crackerjack/orchestration/__init__.py +43 -0
- crackerjack/orchestration/advanced_orchestrator.py +894 -0
- crackerjack/orchestration/cache/README.md +312 -0
- crackerjack/orchestration/cache/__init__.py +37 -0
- crackerjack/orchestration/cache/memory_cache.py +338 -0
- crackerjack/orchestration/cache/tool_proxy_cache.py +340 -0
- crackerjack/orchestration/config.py +297 -0
- crackerjack/orchestration/coverage_improvement.py +180 -0
- crackerjack/orchestration/execution_strategies.py +361 -0
- crackerjack/orchestration/hook_orchestrator.py +1398 -0
- crackerjack/orchestration/strategies/README.md +401 -0
- crackerjack/orchestration/strategies/__init__.py +39 -0
- crackerjack/orchestration/strategies/adaptive_strategy.py +630 -0
- crackerjack/orchestration/strategies/parallel_strategy.py +237 -0
- crackerjack/orchestration/strategies/sequential_strategy.py +299 -0
- crackerjack/orchestration/test_progress_streamer.py +647 -0
- crackerjack/plugins/README.md +11 -0
- crackerjack/plugins/__init__.py +15 -0
- crackerjack/plugins/base.py +200 -0
- crackerjack/plugins/hooks.py +254 -0
- crackerjack/plugins/loader.py +335 -0
- crackerjack/plugins/managers.py +264 -0
- crackerjack/py313.py +191 -0
- crackerjack/security/README.md +11 -0
- crackerjack/security/__init__.py +0 -0
- crackerjack/security/audit.py +197 -0
- crackerjack/services/README.md +374 -0
- crackerjack/services/__init__.py +9 -0
- crackerjack/services/ai/README.md +295 -0
- crackerjack/services/ai/__init__.py +7 -0
- crackerjack/services/ai/advanced_optimizer.py +878 -0
- crackerjack/services/ai/contextual_ai_assistant.py +542 -0
- crackerjack/services/ai/embeddings.py +444 -0
- crackerjack/services/ai/intelligent_commit.py +328 -0
- crackerjack/services/ai/predictive_analytics.py +510 -0
- crackerjack/services/anomaly_detector.py +392 -0
- crackerjack/services/api_extractor.py +617 -0
- crackerjack/services/backup_service.py +467 -0
- crackerjack/services/bounded_status_operations.py +530 -0
- crackerjack/services/cache.py +369 -0
- crackerjack/services/changelog_automation.py +399 -0
- crackerjack/services/command_execution_service.py +305 -0
- crackerjack/services/config_integrity.py +132 -0
- crackerjack/services/config_merge.py +546 -0
- crackerjack/services/config_service.py +198 -0
- crackerjack/services/config_template.py +493 -0
- crackerjack/services/coverage_badge_service.py +173 -0
- crackerjack/services/coverage_ratchet.py +381 -0
- crackerjack/services/debug.py +733 -0
- crackerjack/services/dependency_analyzer.py +460 -0
- crackerjack/services/dependency_monitor.py +622 -0
- crackerjack/services/documentation_generator.py +493 -0
- crackerjack/services/documentation_service.py +704 -0
- crackerjack/services/enhanced_filesystem.py +497 -0
- crackerjack/services/enterprise_optimizer.py +865 -0
- crackerjack/services/error_pattern_analyzer.py +676 -0
- crackerjack/services/file_filter.py +221 -0
- crackerjack/services/file_hasher.py +149 -0
- crackerjack/services/file_io_service.py +361 -0
- crackerjack/services/file_modifier.py +615 -0
- crackerjack/services/filesystem.py +381 -0
- crackerjack/services/git.py +422 -0
- crackerjack/services/health_metrics.py +615 -0
- crackerjack/services/heatmap_generator.py +744 -0
- crackerjack/services/incremental_executor.py +380 -0
- crackerjack/services/initialization.py +823 -0
- crackerjack/services/input_validator.py +668 -0
- crackerjack/services/intelligent_commit.py +327 -0
- crackerjack/services/log_manager.py +289 -0
- crackerjack/services/logging.py +228 -0
- crackerjack/services/lsp_client.py +628 -0
- crackerjack/services/memory_optimizer.py +414 -0
- crackerjack/services/metrics.py +587 -0
- crackerjack/services/monitoring/README.md +30 -0
- crackerjack/services/monitoring/__init__.py +9 -0
- crackerjack/services/monitoring/dependency_monitor.py +678 -0
- crackerjack/services/monitoring/error_pattern_analyzer.py +676 -0
- crackerjack/services/monitoring/health_metrics.py +716 -0
- crackerjack/services/monitoring/metrics.py +587 -0
- crackerjack/services/monitoring/performance_benchmarks.py +410 -0
- crackerjack/services/monitoring/performance_cache.py +388 -0
- crackerjack/services/monitoring/performance_monitor.py +569 -0
- crackerjack/services/parallel_executor.py +527 -0
- crackerjack/services/pattern_cache.py +333 -0
- crackerjack/services/pattern_detector.py +478 -0
- crackerjack/services/patterns/__init__.py +142 -0
- crackerjack/services/patterns/agents.py +107 -0
- crackerjack/services/patterns/code/__init__.py +15 -0
- crackerjack/services/patterns/code/detection.py +118 -0
- crackerjack/services/patterns/code/imports.py +107 -0
- crackerjack/services/patterns/code/paths.py +159 -0
- crackerjack/services/patterns/code/performance.py +119 -0
- crackerjack/services/patterns/code/replacement.py +36 -0
- crackerjack/services/patterns/core.py +212 -0
- crackerjack/services/patterns/documentation/__init__.py +14 -0
- crackerjack/services/patterns/documentation/badges_markdown.py +96 -0
- crackerjack/services/patterns/documentation/comments_blocks.py +83 -0
- crackerjack/services/patterns/documentation/docstrings.py +89 -0
- crackerjack/services/patterns/formatting.py +226 -0
- crackerjack/services/patterns/operations.py +339 -0
- crackerjack/services/patterns/security/__init__.py +23 -0
- crackerjack/services/patterns/security/code_injection.py +122 -0
- crackerjack/services/patterns/security/credentials.py +190 -0
- crackerjack/services/patterns/security/path_traversal.py +221 -0
- crackerjack/services/patterns/security/unsafe_operations.py +216 -0
- crackerjack/services/patterns/templates.py +62 -0
- crackerjack/services/patterns/testing/__init__.py +18 -0
- crackerjack/services/patterns/testing/error_patterns.py +107 -0
- crackerjack/services/patterns/testing/pytest_output.py +126 -0
- crackerjack/services/patterns/tool_output/__init__.py +16 -0
- crackerjack/services/patterns/tool_output/bandit.py +72 -0
- crackerjack/services/patterns/tool_output/other.py +97 -0
- crackerjack/services/patterns/tool_output/pyright.py +67 -0
- crackerjack/services/patterns/tool_output/ruff.py +44 -0
- crackerjack/services/patterns/url_sanitization.py +114 -0
- crackerjack/services/patterns/utilities.py +42 -0
- crackerjack/services/patterns/utils.py +339 -0
- crackerjack/services/patterns/validation.py +46 -0
- crackerjack/services/patterns/versioning.py +62 -0
- crackerjack/services/predictive_analytics.py +523 -0
- crackerjack/services/profiler.py +280 -0
- crackerjack/services/quality/README.md +415 -0
- crackerjack/services/quality/__init__.py +11 -0
- crackerjack/services/quality/anomaly_detector.py +392 -0
- crackerjack/services/quality/pattern_cache.py +333 -0
- crackerjack/services/quality/pattern_detector.py +479 -0
- crackerjack/services/quality/qa_orchestrator.py +491 -0
- crackerjack/services/quality/quality_baseline.py +395 -0
- crackerjack/services/quality/quality_baseline_enhanced.py +649 -0
- crackerjack/services/quality/quality_intelligence.py +949 -0
- crackerjack/services/regex_patterns.py +58 -0
- crackerjack/services/regex_utils.py +483 -0
- crackerjack/services/secure_path_utils.py +524 -0
- crackerjack/services/secure_status_formatter.py +450 -0
- crackerjack/services/secure_subprocess.py +635 -0
- crackerjack/services/security.py +239 -0
- crackerjack/services/security_logger.py +495 -0
- crackerjack/services/server_manager.py +411 -0
- crackerjack/services/smart_scheduling.py +167 -0
- crackerjack/services/status_authentication.py +460 -0
- crackerjack/services/status_security_manager.py +315 -0
- crackerjack/services/terminal_utils.py +0 -0
- crackerjack/services/thread_safe_status_collector.py +441 -0
- crackerjack/services/tool_filter.py +368 -0
- crackerjack/services/tool_version_service.py +43 -0
- crackerjack/services/unified_config.py +115 -0
- crackerjack/services/validation_rate_limiter.py +220 -0
- crackerjack/services/vector_store.py +689 -0
- crackerjack/services/version_analyzer.py +461 -0
- crackerjack/services/version_checker.py +223 -0
- crackerjack/services/websocket_resource_limiter.py +438 -0
- crackerjack/services/zuban_lsp_service.py +391 -0
- crackerjack/slash_commands/README.md +11 -0
- crackerjack/slash_commands/__init__.py +59 -0
- crackerjack/slash_commands/init.md +112 -0
- crackerjack/slash_commands/run.md +197 -0
- crackerjack/slash_commands/status.md +127 -0
- crackerjack/tools/README.md +11 -0
- crackerjack/tools/__init__.py +30 -0
- crackerjack/tools/_git_utils.py +105 -0
- crackerjack/tools/check_added_large_files.py +139 -0
- crackerjack/tools/check_ast.py +105 -0
- crackerjack/tools/check_json.py +103 -0
- crackerjack/tools/check_jsonschema.py +297 -0
- crackerjack/tools/check_toml.py +103 -0
- crackerjack/tools/check_yaml.py +110 -0
- crackerjack/tools/codespell_wrapper.py +72 -0
- crackerjack/tools/end_of_file_fixer.py +202 -0
- crackerjack/tools/format_json.py +128 -0
- crackerjack/tools/mdformat_wrapper.py +114 -0
- crackerjack/tools/trailing_whitespace.py +198 -0
- crackerjack/tools/validate_input_validator_patterns.py +236 -0
- crackerjack/tools/validate_regex_patterns.py +188 -0
- crackerjack/ui/README.md +11 -0
- crackerjack/ui/__init__.py +1 -0
- crackerjack/ui/dashboard_renderer.py +28 -0
- crackerjack/ui/templates/README.md +11 -0
- crackerjack/utils/console_utils.py +13 -0
- crackerjack/utils/dependency_guard.py +230 -0
- crackerjack/utils/retry_utils.py +275 -0
- crackerjack/workflows/README.md +590 -0
- crackerjack/workflows/__init__.py +46 -0
- crackerjack/workflows/actions.py +811 -0
- crackerjack/workflows/auto_fix.py +444 -0
- crackerjack/workflows/container_builder.py +499 -0
- crackerjack/workflows/definitions.py +443 -0
- crackerjack/workflows/engine.py +177 -0
- crackerjack/workflows/event_bridge.py +242 -0
- crackerjack-0.45.2.dist-info/METADATA +1678 -0
- crackerjack-0.45.2.dist-info/RECORD +478 -0
- {crackerjack-0.18.2.dist-info → crackerjack-0.45.2.dist-info}/WHEEL +1 -1
- crackerjack-0.45.2.dist-info/entry_points.txt +2 -0
- crackerjack/.gitignore +0 -14
- crackerjack/.libcst.codemod.yaml +0 -18
- crackerjack/.pdm.toml +0 -1
- crackerjack/.pre-commit-config.yaml +0 -91
- crackerjack/.pytest_cache/.gitignore +0 -2
- crackerjack/.pytest_cache/CACHEDIR.TAG +0 -4
- crackerjack/.pytest_cache/README.md +0 -8
- crackerjack/.pytest_cache/v/cache/nodeids +0 -1
- crackerjack/.pytest_cache/v/cache/stepwise +0 -1
- crackerjack/.ruff_cache/.gitignore +0 -1
- crackerjack/.ruff_cache/0.1.11/3256171999636029978 +0 -0
- crackerjack/.ruff_cache/0.1.14/602324811142551221 +0 -0
- crackerjack/.ruff_cache/0.1.4/10355199064880463147 +0 -0
- crackerjack/.ruff_cache/0.1.6/15140459877605758699 +0 -0
- crackerjack/.ruff_cache/0.1.7/1790508110482614856 +0 -0
- crackerjack/.ruff_cache/0.1.9/17041001205004563469 +0 -0
- crackerjack/.ruff_cache/0.11.2/4070660268492669020 +0 -0
- crackerjack/.ruff_cache/0.11.3/9818742842212983150 +0 -0
- crackerjack/.ruff_cache/0.11.4/9818742842212983150 +0 -0
- crackerjack/.ruff_cache/0.11.6/3557596832929915217 +0 -0
- crackerjack/.ruff_cache/0.11.7/10386934055395314831 +0 -0
- crackerjack/.ruff_cache/0.11.7/3557596832929915217 +0 -0
- crackerjack/.ruff_cache/0.11.8/530407680854991027 +0 -0
- crackerjack/.ruff_cache/0.2.0/10047773857155985907 +0 -0
- crackerjack/.ruff_cache/0.2.1/8522267973936635051 +0 -0
- crackerjack/.ruff_cache/0.2.2/18053836298936336950 +0 -0
- crackerjack/.ruff_cache/0.3.0/12548816621480535786 +0 -0
- crackerjack/.ruff_cache/0.3.3/11081883392474770722 +0 -0
- crackerjack/.ruff_cache/0.3.4/676973378459347183 +0 -0
- crackerjack/.ruff_cache/0.3.5/16311176246009842383 +0 -0
- crackerjack/.ruff_cache/0.5.7/1493622539551733492 +0 -0
- crackerjack/.ruff_cache/0.5.7/6231957614044513175 +0 -0
- crackerjack/.ruff_cache/0.5.7/9932762556785938009 +0 -0
- crackerjack/.ruff_cache/0.6.0/11982804814124138945 +0 -0
- crackerjack/.ruff_cache/0.6.0/12055761203849489982 +0 -0
- crackerjack/.ruff_cache/0.6.2/1206147804896221174 +0 -0
- crackerjack/.ruff_cache/0.6.4/1206147804896221174 +0 -0
- crackerjack/.ruff_cache/0.6.5/1206147804896221174 +0 -0
- crackerjack/.ruff_cache/0.6.7/3657366982708166874 +0 -0
- crackerjack/.ruff_cache/0.6.9/285614542852677309 +0 -0
- crackerjack/.ruff_cache/0.7.1/1024065805990144819 +0 -0
- crackerjack/.ruff_cache/0.7.1/285614542852677309 +0 -0
- crackerjack/.ruff_cache/0.7.3/16061516852537040135 +0 -0
- crackerjack/.ruff_cache/0.8.4/16354268377385700367 +0 -0
- crackerjack/.ruff_cache/0.9.10/12813592349865671909 +0 -0
- crackerjack/.ruff_cache/0.9.10/923908772239632759 +0 -0
- crackerjack/.ruff_cache/0.9.3/13948373885254993391 +0 -0
- crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
- crackerjack/.ruff_cache/0.9.9/8843823720003377982 +0 -0
- crackerjack/.ruff_cache/CACHEDIR.TAG +0 -1
- crackerjack/crackerjack.py +0 -855
- crackerjack/pyproject.toml +0 -214
- crackerjack-0.18.2.dist-info/METADATA +0 -420
- crackerjack-0.18.2.dist-info/RECORD +0 -59
- crackerjack-0.18.2.dist-info/entry_points.txt +0 -4
- {crackerjack-0.18.2.dist-info → crackerjack-0.45.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,1678 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crackerjack
|
|
3
|
+
Version: 0.45.2
|
|
4
|
+
Summary: Crackerjack Python project management tool
|
|
5
|
+
Project-URL: documentation, https://github.com/lesleslie/crackerjack
|
|
6
|
+
Project-URL: homepage, https://github.com/lesleslie/crackerjack
|
|
7
|
+
Project-URL: repository, https://github.com/lesleslie/crackerjack
|
|
8
|
+
Author-email: Les Leslie <les@wedgwoodwebworks.com>
|
|
9
|
+
License: BSD-3-CLAUSE
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Operating System :: POSIX
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Classifier: Topic :: Utilities
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.13
|
|
21
|
+
Requires-Dist: acb>=0.31.18
|
|
22
|
+
Requires-Dist: aiofiles>=25.1.0
|
|
23
|
+
Requires-Dist: aiohttp>=3.13.2
|
|
24
|
+
Requires-Dist: bandit>=1.9.2
|
|
25
|
+
Requires-Dist: bevy>=3.1.0b12
|
|
26
|
+
Requires-Dist: codespell>=2.4.1
|
|
27
|
+
Requires-Dist: complexipy>=5.1.0
|
|
28
|
+
Requires-Dist: creosote>=4.1.0
|
|
29
|
+
Requires-Dist: fastapi>=0.124.0
|
|
30
|
+
Requires-Dist: fastmcp>=2.13.2
|
|
31
|
+
Requires-Dist: hatchling>=1.28.0
|
|
32
|
+
Requires-Dist: hypothesis>=6.148.7
|
|
33
|
+
Requires-Dist: jinja2>=3.1.6
|
|
34
|
+
Requires-Dist: keyring>=25.7.0
|
|
35
|
+
Requires-Dist: mcp-common>=0.3.3
|
|
36
|
+
Requires-Dist: mcp>=1.23.3
|
|
37
|
+
Requires-Dist: mdformat-ruff>=0.1.3
|
|
38
|
+
Requires-Dist: mdformat>=1.0.0
|
|
39
|
+
Requires-Dist: nltk>=3.9.2
|
|
40
|
+
Requires-Dist: numpy>=2.3.5
|
|
41
|
+
Requires-Dist: onnxruntime>=1.23.2
|
|
42
|
+
Requires-Dist: pip-audit>=2.10.0
|
|
43
|
+
Requires-Dist: psutil>=7.1.3
|
|
44
|
+
Requires-Dist: pydantic>=2.12.5
|
|
45
|
+
Requires-Dist: pyleak>=0.1.14
|
|
46
|
+
Requires-Dist: pyright>=1.1.407
|
|
47
|
+
Requires-Dist: pyscn>=1.5.0
|
|
48
|
+
Requires-Dist: pytest-asyncio>=1.3.0
|
|
49
|
+
Requires-Dist: pytest-benchmark>=5.2.3
|
|
50
|
+
Requires-Dist: pytest-cov>=7.0.0
|
|
51
|
+
Requires-Dist: pytest-mock>=3.15.1
|
|
52
|
+
Requires-Dist: pytest-timeout>=2.4.0
|
|
53
|
+
Requires-Dist: pytest-xdist>=3.8.0
|
|
54
|
+
Requires-Dist: pytest>=9.0.2
|
|
55
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
56
|
+
Requires-Dist: refurb>=2.2.0
|
|
57
|
+
Requires-Dist: rich>=14.2.0
|
|
58
|
+
Requires-Dist: ruff>=0.14.8
|
|
59
|
+
Requires-Dist: scikit-learn>=1.7.2
|
|
60
|
+
Requires-Dist: scipy-stubs>=1.16.3.3
|
|
61
|
+
Requires-Dist: scipy>=1.16.3
|
|
62
|
+
Requires-Dist: session-mgmt-mcp>=0.9.8
|
|
63
|
+
Requires-Dist: skylos>=2.5.3
|
|
64
|
+
Requires-Dist: structlog>=25.5.0
|
|
65
|
+
Requires-Dist: textual>=6.8.0
|
|
66
|
+
Requires-Dist: tomli-w>=1.2.0
|
|
67
|
+
Requires-Dist: transformers>=4.57.3
|
|
68
|
+
Requires-Dist: typer>=0.20.0
|
|
69
|
+
Requires-Dist: types-aiofiles>=25.1.0.20251011
|
|
70
|
+
Requires-Dist: types-psutil>=7.1.3.20251202
|
|
71
|
+
Requires-Dist: types-pyyaml>=6.0.12.20250915
|
|
72
|
+
Requires-Dist: uv-bump>=0.3.2
|
|
73
|
+
Requires-Dist: uv>=0.9.16
|
|
74
|
+
Requires-Dist: uvicorn>=0.38.0
|
|
75
|
+
Requires-Dist: vulture>=2.14
|
|
76
|
+
Requires-Dist: watchdog>=6.0.0
|
|
77
|
+
Requires-Dist: websockets>=15.0.1
|
|
78
|
+
Requires-Dist: zuban>=0.3.0
|
|
79
|
+
Description-Content-Type: text/markdown
|
|
80
|
+
|
|
81
|
+
# Crackerjack: Advanced AI-Driven Python Development Platform
|
|
82
|
+
|
|
83
|
+
[](https://github.com/lesleslie/crackerjack)
|
|
84
|
+
[](https://www.python.org/downloads/)
|
|
85
|
+
[](https://pytest.org)
|
|
86
|
+
[](https://github.com/astral-sh/ruff)
|
|
87
|
+
[](https://github.com/astral-sh/uv)
|
|
88
|
+
[](https://github.com/lesleslie/crackerjack)
|
|
89
|
+
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
90
|
+

|
|
91
|
+
|
|
92
|
+
## 🎯 Purpose
|
|
93
|
+
|
|
94
|
+
**Crackerjack** transforms Python development from reactive firefighting to proactive excellence. This sophisticated platform empowers developers to create exceptional code through intelligent automation, comprehensive quality enforcement, and AI-powered assistance. Experience the confidence that comes from knowing your code meets the highest standards before it ever runs in production.
|
|
95
|
+
|
|
96
|
+
### What is "Crackerjack"?
|
|
97
|
+
|
|
98
|
+
**crack·er·jack** ˈkra-kər-ˌjak (noun): *A person or thing of marked excellence or ability; first-rate; exceptional.*
|
|
99
|
+
|
|
100
|
+
Just as the name suggests, Crackerjack makes your Python projects first-rate through:
|
|
101
|
+
|
|
102
|
+
- **🧠 Proactive AI Architecture**: 12 specialized AI agents prevent issues before they occur
|
|
103
|
+
- **⚡ Autonomous Quality**: Intelligent auto-fixing with architectural planning
|
|
104
|
+
- **🛡️ Zero-Compromise Standards**: 100% test coverage, complexity ≤15, security-first patterns
|
|
105
|
+
- **🔄 Learning System**: Gets smarter with every project, caching successful patterns
|
|
106
|
+
- **🌟 One Command Excellence**: From setup to PyPI publishing with a single command
|
|
107
|
+
|
|
108
|
+
**The Crackerjack Philosophy**: If your code needs fixing after it's written, you're doing it wrong. We prevent problems through intelligent architecture and proactive patterns, making exceptional code the natural outcome, not a lucky accident.
|
|
109
|
+
|
|
110
|
+
## What Problem Does Crackerjack Solve?
|
|
111
|
+
|
|
112
|
+
**Instead of configuring multiple tools separately:**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Traditional workflow
|
|
116
|
+
pip install black isort flake8 mypy pytest
|
|
117
|
+
# Configure each tool individually
|
|
118
|
+
# Set up git hooks manually
|
|
119
|
+
# Remember different commands for each tool
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Crackerjack provides unified commands:**
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
pip install crackerjack
|
|
126
|
+
python -m crackerjack # Setup + quality checks
|
|
127
|
+
python -m crackerjack --run-tests # Add testing
|
|
128
|
+
python -m crackerjack --all patch # Full release workflow
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Key differentiators:**
|
|
132
|
+
|
|
133
|
+
- **Single command** replaces 6+ separate tools
|
|
134
|
+
- **Pre-configured** with Python best practices
|
|
135
|
+
- **UV integration** for fast dependency management
|
|
136
|
+
- **Automated publishing** with PyPI authentication
|
|
137
|
+
- **MCP server** for AI agent integration
|
|
138
|
+
|
|
139
|
+
## The Crackerjack Philosophy
|
|
140
|
+
|
|
141
|
+
Crackerjack is built on the following core principles:
|
|
142
|
+
|
|
143
|
+
- **Code Clarity:** Code should be easy to read, understand, and maintain
|
|
144
|
+
- **Automation:** Tedious tasks should be automated, allowing developers to focus on solving problems
|
|
145
|
+
- **Consistency:** Code style, formatting, and project structure should be consistent across projects
|
|
146
|
+
- **Reliability:** Tests are essential, and code should be checked rigorously
|
|
147
|
+
- **Tool Integration:** Leverage powerful existing tools instead of reinventing the wheel
|
|
148
|
+
- **Auto-Discovery:** Prefer intelligent auto-discovery of configurations and settings over manual configuration whenever possible, reducing setup friction and configuration errors
|
|
149
|
+
- **Static Typing:** Static typing is essential for all development
|
|
150
|
+
|
|
151
|
+
## Crackerjack vs Pre-commit: Architecture & Features
|
|
152
|
+
|
|
153
|
+
Crackerjack and pre-commit solve related but different problems. While pre-commit is a language-agnostic git hook manager, Crackerjack is a comprehensive Python development platform with quality enforcement built-in.
|
|
154
|
+
|
|
155
|
+
### Architectural Differences
|
|
156
|
+
|
|
157
|
+
| Aspect | Pre-commit | Crackerjack |
|
|
158
|
+
|--------|-----------|-------------|
|
|
159
|
+
| **Execution Model** | Wrapper framework that spawns subprocesses for each hook | Direct tool invocation with ACB adapter architecture |
|
|
160
|
+
| **Concurrency** | Synchronous sequential execution (one hook at a time) | **Async-first with 11 concurrent adapters** - true parallel execution |
|
|
161
|
+
| **Performance** | Overhead from framework wrapper + subprocess spawning | Zero wrapper overhead, 70% cache hit rate, 50% faster workflows |
|
|
162
|
+
| **Language Focus** | Language-agnostic (Python, Go, Rust, Docker, etc.) | Python-first with native tool implementations |
|
|
163
|
+
| **Configuration** | YAML-based `.pre-commit-config.yaml` with repo URLs | Python-based configuration with intelligent defaults |
|
|
164
|
+
| **Hook Management** | Clones repos, manages environments per hook | Native Python tools + direct UV invocation |
|
|
165
|
+
|
|
166
|
+
### Feature Comparison
|
|
167
|
+
|
|
168
|
+
#### Quality Hooks & Tools
|
|
169
|
+
|
|
170
|
+
| Feature | Pre-commit | Crackerjack |
|
|
171
|
+
|---------|-----------|-------------|
|
|
172
|
+
| **Code Formatting** | ✅ Via hooks (black, ruff, etc.) | ✅ Native Ruff integration + mdformat |
|
|
173
|
+
| **Linting** | ✅ Via hooks (flake8, pylint, etc.) | ✅ Native Ruff + codespell |
|
|
174
|
+
| **Type Checking** | ✅ Via hooks (mypy, pyright) | ✅ **Zuban** (20-200x faster than pyright) |
|
|
175
|
+
| **Security Scanning** | ✅ Via hooks (bandit, gitleaks) | ✅ Native bandit + gitleaks integration |
|
|
176
|
+
| **Dead Code Detection** | ✅ Via vulture hook | ✅ **Skylos** (20x faster than vulture) |
|
|
177
|
+
| **Complexity Analysis** | ❌ Not built-in | ✅ Native complexipy integration |
|
|
178
|
+
| **Dependency Validation** | ❌ Not built-in | ✅ Native creosote unused dependency detection |
|
|
179
|
+
| **Custom Python Tools** | ✅ Via `repo: local` hooks | ✅ 6 native tools in `crackerjack/tools/` |
|
|
180
|
+
|
|
181
|
+
#### Development Workflow
|
|
182
|
+
|
|
183
|
+
| Feature | Pre-commit | Crackerjack |
|
|
184
|
+
|---------|-----------|-------------|
|
|
185
|
+
| **Git Integration** | ✅ Pre-commit, pre-push, commit-msg hooks | ✅ Git hooks + intelligent commit messages |
|
|
186
|
+
| **Testing Framework** | ❌ Not included | ✅ Built-in pytest with coverage ratchet |
|
|
187
|
+
| **CI/CD Integration** | ✅ Via `pre-commit run --all-files` | ✅ Unified `--ci` mode with quality + tests |
|
|
188
|
+
| **Version Management** | ❌ Not included | ✅ Intelligent version bumping + AI recommendations |
|
|
189
|
+
| **Publishing** | ❌ Not included | ✅ PyPI publishing with UV authentication |
|
|
190
|
+
| **Hook Stages** | ✅ Multiple stages (commit, push, merge, manual) | ✅ Fast (~5s) vs Comprehensive (~30s) strategies |
|
|
191
|
+
| **Retry Logic** | ❌ No built-in retry | ✅ Automatic retry for formatting hooks |
|
|
192
|
+
| **Parallel Execution** | ✅ Limited parallelism (sequential by default) | ✅ **Async-first architecture**: 11 concurrent adapters, 76% speedup |
|
|
193
|
+
|
|
194
|
+
#### Advanced Features
|
|
195
|
+
|
|
196
|
+
| Feature | Pre-commit | Crackerjack |
|
|
197
|
+
|---------|-----------|-------------|
|
|
198
|
+
| **AI Integration** | ❌ Not built-in | ✅ 12 specialized AI agents + auto-fixing |
|
|
199
|
+
| **Dependency Injection** | ❌ Not applicable | ✅ ACB framework with protocol-based DI |
|
|
200
|
+
| **Caching** | ✅ Per-file hash caching | ✅ Content-based caching (70% hit rate) |
|
|
201
|
+
| **MCP Server** | ❌ Not included | ✅ Built-in MCP server for Claude integration |
|
|
202
|
+
| **Monitoring Dashboard** | ❌ Not included | ✅ Real-time WebSocket dashboard |
|
|
203
|
+
| **Configuration Management** | ✅ YAML + `--config` flag | ✅ ACB Settings with YAML + local overrides |
|
|
204
|
+
| **Auto-Update** | ✅ `pre-commit autoupdate` | ⚠️ Manual UV dependency updates |
|
|
205
|
+
| **Language Support** | ✅ 15+ languages (Python, Go, Rust, Docker, etc.) | ✅ Python + external tools (gitleaks, etc.) |
|
|
206
|
+
|
|
207
|
+
#### Configuration & Ease of Use
|
|
208
|
+
|
|
209
|
+
| Feature | Pre-commit | Crackerjack |
|
|
210
|
+
|---------|-----------|-------------|
|
|
211
|
+
| **Setup Complexity** | Medium (YAML config + `pre-commit install`) | Low (single `python -m crackerjack`) |
|
|
212
|
+
| **Configuration Format** | YAML with repo URLs and hook IDs | Python settings with intelligent defaults |
|
|
213
|
+
| **Hook Discovery** | Manual (add repos to `.pre-commit-config.yaml`) | Automatic (17 tools pre-configured) |
|
|
214
|
+
| **Tool Installation** | Auto (pre-commit manages environments) | UV-based (one virtual environment) |
|
|
215
|
+
| **Learning Curve** | Medium (understand repos, hooks, stages) | Low (unified Python commands) |
|
|
216
|
+
|
|
217
|
+
### When to Use Each
|
|
218
|
+
|
|
219
|
+
**Choose Pre-commit when:**
|
|
220
|
+
|
|
221
|
+
- ✅ Working with multiple languages (Go, Rust, Docker, etc.)
|
|
222
|
+
- ✅ Need language-agnostic hook framework
|
|
223
|
+
- ✅ Want to use hooks from community repositories
|
|
224
|
+
- ✅ Polyglot projects requiring diverse tooling
|
|
225
|
+
- ✅ Simple YAML-based configuration preferred
|
|
226
|
+
|
|
227
|
+
**Choose Crackerjack when:**
|
|
228
|
+
|
|
229
|
+
- ✅ Python-focused development (Python 3.13+)
|
|
230
|
+
- ✅ Want comprehensive development platform (testing, publishing, AI)
|
|
231
|
+
- ✅ Need maximum performance (async architecture, Rust tools, caching, 11x parallelism)
|
|
232
|
+
- ✅ Desire AI-powered auto-fixing and recommendations
|
|
233
|
+
- ✅ Want unified workflow (quality + tests + publishing in one command)
|
|
234
|
+
- ✅ Prefer Python-based configuration over YAML
|
|
235
|
+
- ✅ Need advanced features (coverage ratchet, MCP integration, dashboards)
|
|
236
|
+
|
|
237
|
+
### Migration from Pre-commit
|
|
238
|
+
|
|
239
|
+
Crackerjack can **coexist** with pre-commit if needed, but most Python projects can fully migrate:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Remove pre-commit (optional)
|
|
243
|
+
pre-commit uninstall
|
|
244
|
+
rm .pre-commit-config.yaml
|
|
245
|
+
|
|
246
|
+
# Install crackerjack
|
|
247
|
+
uv tool install crackerjack
|
|
248
|
+
|
|
249
|
+
# Run quality checks (replaces pre-commit run --all-files)
|
|
250
|
+
python -m crackerjack
|
|
251
|
+
|
|
252
|
+
# With tests (comprehensive workflow)
|
|
253
|
+
python -m crackerjack --run-tests
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Note**: Crackerjack Phase 8 successfully migrated from pre-commit framework to direct tool invocation, achieving 50% performance improvement while maintaining full compatibility with existing quality standards.
|
|
257
|
+
|
|
258
|
+
## Table of Contents
|
|
259
|
+
|
|
260
|
+
- [Crackerjack vs Pre-commit](<#crackerjack-vs-pre-commit-architecture--features>)
|
|
261
|
+
- [Installation](<#installation>)
|
|
262
|
+
- [Quick Start](<#quick-start>)
|
|
263
|
+
- [AI Auto-Fix Features](<#ai-auto-fix-features>)
|
|
264
|
+
- [Core Workflow](<#core-workflow>)
|
|
265
|
+
- [Core Features](<#core-features>)
|
|
266
|
+
- [ACB Architecture & Performance](<#-acb-architecture--performance>)
|
|
267
|
+
- [Adapters](<#adapters>)
|
|
268
|
+
- [Configuration Management](<#-configuration-management-acb-settings--configuration-templates>)
|
|
269
|
+
- [MCP Server Configuration](<#mcp-server-configuration>)
|
|
270
|
+
- [Quality Hook Modes](<#quality-hook-modes>)
|
|
271
|
+
- [Command Reference](<#command-reference>)
|
|
272
|
+
- [Style Guide](<#style-guide>)
|
|
273
|
+
- [Publishing & Version Management](<#publishing--version-management>)
|
|
274
|
+
- [Troubleshooting](<#-troubleshooting>)
|
|
275
|
+
|
|
276
|
+
## Installation
|
|
277
|
+
|
|
278
|
+
### Prerequisites
|
|
279
|
+
|
|
280
|
+
- Python 3.13+
|
|
281
|
+
- [UV](https://github.com/astral-sh/uv) package manager
|
|
282
|
+
|
|
283
|
+
### Install UV
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Recommended: Official installer script
|
|
287
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
288
|
+
|
|
289
|
+
# Alternative: Using pipx
|
|
290
|
+
pipx install uv
|
|
291
|
+
|
|
292
|
+
# Alternative: Using Homebrew (macOS)
|
|
293
|
+
brew install uv
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Install Crackerjack
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# Recommended: Using UV (fastest)
|
|
300
|
+
uv tool install crackerjack
|
|
301
|
+
|
|
302
|
+
# Alternative: Using pip
|
|
303
|
+
pip install crackerjack
|
|
304
|
+
|
|
305
|
+
# For existing project: Add as dependency
|
|
306
|
+
uv add crackerjack
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Quick Start
|
|
310
|
+
|
|
311
|
+
### Initialize a Project
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# Navigate to your project directory
|
|
315
|
+
cd your-project
|
|
316
|
+
|
|
317
|
+
# Initialize with Crackerjack
|
|
318
|
+
python -m crackerjack
|
|
319
|
+
|
|
320
|
+
# Or use interactive mode
|
|
321
|
+
python -m crackerjack -i
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## AI Auto-Fix Features
|
|
325
|
+
|
|
326
|
+
Crackerjack provides two distinct approaches to automatic error fixing:
|
|
327
|
+
|
|
328
|
+
### 1. Hook Auto-Fix Modes (Basic Formatting)
|
|
329
|
+
|
|
330
|
+
Limited tool-specific auto-fixes for simple formatting issues:
|
|
331
|
+
|
|
332
|
+
- `ruff --fix`: Import sorting, basic formatting
|
|
333
|
+
- `trailing-whitespace --fix`: Removes trailing whitespace
|
|
334
|
+
- `end-of-file-fixer --fix`: Ensures files end with newline
|
|
335
|
+
|
|
336
|
+
**Limitations:** Only handles simple style issues, cannot fix type errors, security issues, test failures, or complex code quality problems.
|
|
337
|
+
|
|
338
|
+
### 2. AI Agent Auto-Fixing (Comprehensive Intelligence)
|
|
339
|
+
|
|
340
|
+
**Revolutionary AI-powered code quality enforcement** that automatically fixes ALL types of issues:
|
|
341
|
+
|
|
342
|
+
#### How AI Agent Auto-Fixing Works
|
|
343
|
+
|
|
344
|
+
1. **🚀 Run All Checks**: Fast hooks, comprehensive hooks, full test suite
|
|
345
|
+
1. **🔍 Analyze Failures**: AI parses error messages, identifies root causes
|
|
346
|
+
1. **🤖 Intelligent Fixes**: AI reads source code and makes targeted modifications
|
|
347
|
+
1. **🔄 Repeat**: Continue until ALL checks pass (up to 8 iterations)
|
|
348
|
+
1. **🎉 Perfect Quality**: Zero manual intervention required
|
|
349
|
+
|
|
350
|
+
#### Comprehensive Coverage
|
|
351
|
+
|
|
352
|
+
The AI agent intelligently fixes:
|
|
353
|
+
|
|
354
|
+
- **Type Errors (zuban)**: Adds missing annotations, fixes type mismatches
|
|
355
|
+
- **🔒 Security Issues (bandit)**: Comprehensive security hardening including:
|
|
356
|
+
- **Shell Injection Prevention**: Removes `shell=True` from subprocess calls
|
|
357
|
+
- **Weak Cryptography**: Replaces MD5/SHA1 with SHA256
|
|
358
|
+
- **Insecure Random Functions**: Replaces `random.choice` with `secrets.choice`
|
|
359
|
+
- **Unsafe YAML Loading**: Replaces `yaml.load` with `yaml.safe_load`
|
|
360
|
+
- **Token Exposure**: Masks PyPI tokens, GitHub PATs, and sensitive credentials
|
|
361
|
+
- **Debug Print Removal**: Eliminates debug prints containing sensitive information
|
|
362
|
+
- **Dead Code (vulture)**: Removes unused imports, variables, functions
|
|
363
|
+
- **Performance Issues**: Transforms inefficient patterns (list concatenation, string building, nested loops)
|
|
364
|
+
- **Documentation Issues**: Auto-generates changelogs, maintains consistency across .md files
|
|
365
|
+
- **Test Failures**: Fixes missing fixtures, import errors, assertions
|
|
366
|
+
- **Code Quality (refurb)**: Applies refactoring, reduces complexity
|
|
367
|
+
- **All Hook Failures**: Formatting, linting, style issues
|
|
368
|
+
|
|
369
|
+
#### AI Agent Commands
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Standard AI agent mode (recommended)
|
|
373
|
+
python -m crackerjack --ai-fix --run-tests --verbose
|
|
374
|
+
|
|
375
|
+
# Preview fixes without applying (dry-run mode)
|
|
376
|
+
python -m crackerjack --dry-run --run-tests --verbose
|
|
377
|
+
|
|
378
|
+
# Custom iteration limit
|
|
379
|
+
python -m crackerjack --ai-fix --max-iterations 15
|
|
380
|
+
|
|
381
|
+
# MCP server with WebSocket support (localhost:8675)
|
|
382
|
+
python -m crackerjack --start-mcp-server
|
|
383
|
+
|
|
384
|
+
# Progress monitoring via WebSocket
|
|
385
|
+
python -m crackerjack.mcp.progress_monitor <job_id> ws://localhost:8675
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
#### MCP Integration
|
|
389
|
+
|
|
390
|
+
When using crackerjack via MCP tools (session-mgmt-mcp):
|
|
391
|
+
|
|
392
|
+
```python
|
|
393
|
+
# ✅ CORRECT - Use semantic command + ai_agent_mode parameter
|
|
394
|
+
crackerjack_run(command="test", ai_agent_mode=True)
|
|
395
|
+
|
|
396
|
+
# ✅ CORRECT - With additional arguments
|
|
397
|
+
crackerjack_run(command="check", args="--verbose", ai_agent_mode=True, timeout=600)
|
|
398
|
+
|
|
399
|
+
# ✅ CORRECT - Dry-run mode
|
|
400
|
+
crackerjack_run(command="test", args="--dry-run", ai_agent_mode=True)
|
|
401
|
+
|
|
402
|
+
# ❌ WRONG - Don't put flags in command parameter
|
|
403
|
+
crackerjack_run(command="--ai-fix -t") # This will error!
|
|
404
|
+
|
|
405
|
+
# ❌ WRONG - Don't use --ai-fix in args
|
|
406
|
+
crackerjack_run(command="test", args="--ai-fix") # Use ai_agent_mode=True instead
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### Configuration
|
|
410
|
+
|
|
411
|
+
Auto-fix requires:
|
|
412
|
+
|
|
413
|
+
1. **Anthropic API key**: Set environment variable
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
1. **Configuration file**: `settings/adapters.yml`
|
|
420
|
+
|
|
421
|
+
```yaml
|
|
422
|
+
ai: claude
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
#### Key Benefits
|
|
426
|
+
|
|
427
|
+
- **Zero Configuration**: No complex flag combinations needed
|
|
428
|
+
- **Complete Automation**: Handles entire quality workflow automatically
|
|
429
|
+
- **Intelligent Analysis**: Understands code context and business logic
|
|
430
|
+
- **Comprehensive Coverage**: Fixes ALL error types, not just formatting
|
|
431
|
+
- **Perfect Results**: Achieves 100% code quality compliance
|
|
432
|
+
|
|
433
|
+
#### 🤖 Specialized Agent Architecture
|
|
434
|
+
|
|
435
|
+
**12 Specialized AI Agents** for comprehensive code quality improvements:
|
|
436
|
+
|
|
437
|
+
- **🔒 SecurityAgent**: Fixes shell injections, weak crypto, token exposure, unsafe library usage
|
|
438
|
+
- **♻️ RefactoringAgent**: Reduces complexity ≤15, extracts helper methods, applies SOLID principles
|
|
439
|
+
- **🚀 PerformanceAgent**: Optimizes algorithms, fixes O(n²) patterns, improves string building
|
|
440
|
+
- **📝 DocumentationAgent**: Auto-generates changelogs, maintains .md file consistency
|
|
441
|
+
- **🧹 DRYAgent**: Eliminates code duplication, extracts common patterns to utilities
|
|
442
|
+
- **✨ FormattingAgent**: Handles code style, import organization, formatting violations
|
|
443
|
+
- **🧪 TestCreationAgent**: Fixes test failures, missing fixtures, dependency issues
|
|
444
|
+
- **📦 ImportOptimizationAgent**: Removes unused imports, restructures import statements
|
|
445
|
+
- **🔬 TestSpecialistAgent**: Advanced testing scenarios, fixture management
|
|
446
|
+
- **🔍 SemanticAgent**: Advanced semantic analysis, code comprehension, intelligent refactoring suggestions based on business logic understanding
|
|
447
|
+
- **🏗️ ArchitectAgent**: High-level architectural patterns, design recommendations, system-level optimization strategies
|
|
448
|
+
- **🎯 EnhancedProactiveAgent**: Proactive issue prevention, predictive quality monitoring, optimization before problems occur
|
|
449
|
+
|
|
450
|
+
**Agent Coordination Features**:
|
|
451
|
+
|
|
452
|
+
- **Confidence Scoring**: Routes issues to best-match agent (≥0.7 confidence)
|
|
453
|
+
- **Batch Processing**: Groups related issues for efficient parallel processing
|
|
454
|
+
- **Collaborative Mode**: Multiple agents handle complex cross-cutting concerns
|
|
455
|
+
|
|
456
|
+
#### Security & Safety Features
|
|
457
|
+
|
|
458
|
+
- **Command Validation**: All AI modifications are validated for safety
|
|
459
|
+
- **Advanced-Grade Regex**: Centralized pattern system eliminates dangerous regex issues
|
|
460
|
+
- **No Shell Injection**: Uses secure subprocess execution with validated patterns
|
|
461
|
+
- **Rollback Support**: All changes can be reverted via git
|
|
462
|
+
- **Human Review**: Review AI-generated changes before commit
|
|
463
|
+
|
|
464
|
+
#### ⚡ High-Performance Rust Tool Integration
|
|
465
|
+
|
|
466
|
+
**Ultra-Fast Static Analysis Tools**:
|
|
467
|
+
|
|
468
|
+
- **🦅 Skylos** (Dead Code Detection): Replaces vulture with **20x performance improvement**
|
|
469
|
+
|
|
470
|
+
- Rust-powered dead code detection and import analysis
|
|
471
|
+
- Seamlessly integrates with crackerjack's quality workflow
|
|
472
|
+
- Zero configuration changes required
|
|
473
|
+
|
|
474
|
+
- **🔍 Zuban** (Type Checking): Replaces pyright with **20-200x performance improvement**
|
|
475
|
+
|
|
476
|
+
- Lightning-fast type checking and static analysis
|
|
477
|
+
- Drop-in replacement for slower Python-based tools
|
|
478
|
+
- Maintains full compatibility with existing configurations
|
|
479
|
+
|
|
480
|
+
**Performance Benefits**:
|
|
481
|
+
|
|
482
|
+
- **Faster Development Cycles**: Quality hooks complete in seconds, not minutes
|
|
483
|
+
- **Improved Developer Experience**: Near-instantaneous feedback during development
|
|
484
|
+
- **Seamless Integration**: Works transparently with existing crackerjack workflows
|
|
485
|
+
- **Zero Breaking Changes**: Same CLI interface, dramatically better performance
|
|
486
|
+
|
|
487
|
+
**Implementation Details**:
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
# These commands now benefit from Rust tool speed improvements:
|
|
491
|
+
python -m crackerjack # Dead code detection 20x faster
|
|
492
|
+
python -m crackerjack --run-tests # Type checking 20-200x faster
|
|
493
|
+
python -m crackerjack --ai-fix --run-tests # Complete workflow optimized
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
**Benchmark Results**: Real-world performance measurements show consistent **6,000+ operations/second** throughput with **600KB+/second** data processing capabilities during comprehensive quality checks.
|
|
497
|
+
|
|
498
|
+
## Core Workflow
|
|
499
|
+
|
|
500
|
+
**Enhanced three-stage quality enforcement with intelligent code cleaning:**
|
|
501
|
+
|
|
502
|
+
1. **Fast Hooks** (~5 seconds): Essential formatting and security checks
|
|
503
|
+
1. **🧹 Code Cleaning Stage** (between fast and comprehensive): AI-powered cleanup for optimal comprehensive hook results
|
|
504
|
+
1. **Comprehensive Hooks** (~30 seconds): Complete static analysis on cleaned code
|
|
505
|
+
|
|
506
|
+
**Optimal Execution Order**:
|
|
507
|
+
|
|
508
|
+
- **Fast hooks first** # → **retry once if any fail** (formatting fixes cascade to other issues)
|
|
509
|
+
- **Code cleaning** # → Remove TODO detection, apply standardized patterns
|
|
510
|
+
- **Post-cleaning fast hooks sanity check** # → Ensure cleaning didn't introduce issues
|
|
511
|
+
- **Full test suite** # → Collect ALL test failures (don't stop on first)
|
|
512
|
+
- **Comprehensive hooks** # → Collect ALL quality issues on clean codebase
|
|
513
|
+
- **AI batch fixing** # → Process all collected issues intelligently
|
|
514
|
+
|
|
515
|
+
**With AI integration:**
|
|
516
|
+
|
|
517
|
+
- `--ai-fix` flag enables automatic error resolution with specialized sub-agents
|
|
518
|
+
- MCP server allows AI agents to run crackerjack commands with real-time progress tracking
|
|
519
|
+
- Structured error output for programmatic fixes with confidence scoring
|
|
520
|
+
- Advanced-grade regex pattern system ensures safe automated text transformations
|
|
521
|
+
|
|
522
|
+
## Core Features
|
|
523
|
+
|
|
524
|
+
### Project Management
|
|
525
|
+
|
|
526
|
+
- **Effortless Project Setup:** Initializes new Python projects with a standard directory structure, `pyproject.toml`, and essential configuration files
|
|
527
|
+
- **UV Integration:** Manages dependencies and virtual environments using [UV](https://github.com/astral-sh/uv) for lightning-fast package operations
|
|
528
|
+
- **Dependency Management:** Automatically detects and manages project dependencies
|
|
529
|
+
|
|
530
|
+
### Code Quality
|
|
531
|
+
|
|
532
|
+
- **Automated Code Cleaning:** Removes unnecessary docstrings, line comments, and trailing whitespace
|
|
533
|
+
- **Consistent Code Formatting:** Enforces a unified style using [Ruff](https://github.com/astral-sh/ruff), the lightning-fast Python linter and formatter
|
|
534
|
+
- **Comprehensive Quality Hooks:** Direct tool invocation with no wrapper overhead - runs Python tools, Rust analyzers, and security scanners efficiently
|
|
535
|
+
- **Interactive Checks:** Supports interactive quality checks (like `refurb`, `bandit`, and `pyright`) to fix issues in real-time
|
|
536
|
+
- **Static Type Checking:** Enforces type safety with Pyright integration
|
|
537
|
+
|
|
538
|
+
### Testing & Coverage Ratchet System
|
|
539
|
+
|
|
540
|
+
- **Built-in Testing:** Automatically runs tests using `pytest` with intelligent parallelization
|
|
541
|
+
- **Coverage Ratchet:** Revolutionary coverage system that targets 100% - coverage can only increase, never decrease
|
|
542
|
+
- **Milestone Celebrations:** Progress tracking with milestone achievements (15%, 20%, 25%... # → 100%)
|
|
543
|
+
- **No Arbitrary Limits:** Replaced traditional hard limits with continuous improvement toward perfection
|
|
544
|
+
- **Visual Progress:** Rich terminal displays showing journey to 100% coverage
|
|
545
|
+
- **Benchmark Testing:** Performance regression detection and monitoring
|
|
546
|
+
- **Easy Version Bumping:** Provides commands to bump the project version (patch, minor, or major)
|
|
547
|
+
- **Simplified Publishing:** Automates publishing to PyPI via UV with enhanced authentication
|
|
548
|
+
|
|
549
|
+
#### Coverage Ratchet Philosophy
|
|
550
|
+
|
|
551
|
+
🎯 **Target: 100% Coverage** - Not an arbitrary number, but true comprehensive testing
|
|
552
|
+
📈 **Continuous Improvement** - Each test run can only maintain or improve coverage
|
|
553
|
+
🏆 **Milestone System** - Celebrate achievements at 15%, 25%, 50%, 75%, 90%, and 100%
|
|
554
|
+
🚫 **No Regression** - Once you achieve a coverage level, you can't go backward
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
# Show coverage progress
|
|
558
|
+
python -m crackerjack --coverage-report
|
|
559
|
+
|
|
560
|
+
# Run tests with ratchet system
|
|
561
|
+
python -m crackerjack --run-tests
|
|
562
|
+
|
|
563
|
+
# Example output:
|
|
564
|
+
# 🎉 Coverage improved from 10.11% to 15.50%!
|
|
565
|
+
# 🏆 Milestone achieved: 15% coverage!
|
|
566
|
+
# 📈 Progress: [███░░░░░░░░░░░░░░░░░] 15.50% # → 100%
|
|
567
|
+
# 🎯 Next milestone: 20% (+4.50% needed)
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### Git Integration
|
|
571
|
+
|
|
572
|
+
- **Intelligent Commit Messages:** Analyzes git changes and suggests descriptive commit messages based on file types and modifications
|
|
573
|
+
- **Commit and Push:** Commits and pushes your changes with standardized commit messages
|
|
574
|
+
- **Pull Request Creation:** Creates pull requests to upstream repositories on GitHub or GitLab
|
|
575
|
+
- **Git Hook Integration:** Ensures code quality before commits with fast, direct tool execution
|
|
576
|
+
|
|
577
|
+
## ⚡ ACB Architecture & Performance
|
|
578
|
+
|
|
579
|
+
Crackerjack is built on the **ACB (Asynchronous Component Base)** framework, providing advanced-grade dependency injection, intelligent caching, and parallel execution.
|
|
580
|
+
|
|
581
|
+
### What is ACB?
|
|
582
|
+
|
|
583
|
+
[ACB](https://github.com/lesleslie/acb) is a lightweight dependency injection framework that enables:
|
|
584
|
+
|
|
585
|
+
- **Module-level registration** via `depends.set()` for clean dependency management
|
|
586
|
+
- **Runtime-checkable protocols** ensuring type safety across all components
|
|
587
|
+
- **Async-first design** with lifecycle management and timeout strategies
|
|
588
|
+
- **Clean separation of concerns** through adapters, orchestrators, and services
|
|
589
|
+
|
|
590
|
+
### Architecture Overview
|
|
591
|
+
|
|
592
|
+
**ACB Workflow Engine (Default since Phase 4.2)**
|
|
593
|
+
|
|
594
|
+
```
|
|
595
|
+
User Command # → BasicWorkflowEngine (ACB)
|
|
596
|
+
↓
|
|
597
|
+
Workflow Selection (Standard/Fast/Comprehensive/Test)
|
|
598
|
+
↓
|
|
599
|
+
Action Handlers (run_fast_hooks, run_code_cleaning, run_comprehensive_hooks, run_test_workflow)
|
|
600
|
+
↓
|
|
601
|
+
asyncio.to_thread() for non-blocking execution
|
|
602
|
+
↓
|
|
603
|
+
WorkflowPipeline (DI-injected via context)
|
|
604
|
+
↓
|
|
605
|
+
Phase Execution (_run_fast_hooks_phase, _run_comprehensive_hooks_phase, etc.)
|
|
606
|
+
↓
|
|
607
|
+
HookManager + TestManager (Manager Layer: 80% compliant)
|
|
608
|
+
↓
|
|
609
|
+
Direct adapter.check() calls (No subprocess overhead)
|
|
610
|
+
↓
|
|
611
|
+
ToolProxyCacheAdapter (Content-based caching, 70% hit rate)
|
|
612
|
+
↓
|
|
613
|
+
Parallel Execution (Up to 11 concurrent adapters)
|
|
614
|
+
↓
|
|
615
|
+
Results Aggregation with real-time console output
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
**Legacy Orchestrator Path** (opt-out with `--use-legacy-orchestrator`)
|
|
619
|
+
|
|
620
|
+
```
|
|
621
|
+
User Command # → WorkflowOrchestrator (Legacy)
|
|
622
|
+
↓
|
|
623
|
+
SessionCoordinator (@depends.inject + protocols)
|
|
624
|
+
↓
|
|
625
|
+
PhaseCoordinator (Orchestration Layer)
|
|
626
|
+
↓
|
|
627
|
+
HookManager + TestManager
|
|
628
|
+
↓
|
|
629
|
+
[Same execution path as ACB from here...]
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
**Architecture Compliance (Phase 2-4.2 Audit Results)**
|
|
633
|
+
|
|
634
|
+
| Layer | Compliance | Status | Notes |
|
|
635
|
+
|-------|-----------|--------|-------|
|
|
636
|
+
| **ACB Workflows** | 95% | ✅ Production | **Default since Phase 4.2** - Real-time output, non-blocking |
|
|
637
|
+
| **CLI Handlers** | 90% | ✅ Excellent | Gold standard: `@depends.inject` + `Inject[Protocol]` |
|
|
638
|
+
| **Services** | 95% | ✅ Excellent | Phase 3 refactored, consistent constructors |
|
|
639
|
+
| **Managers** | 80% | ✅ Good | Protocol-based injection, minor improvements needed |
|
|
640
|
+
| **Legacy Orchestration** | 70% | ⚠️ Opt-out | Available with `--use-legacy-orchestrator` |
|
|
641
|
+
| **Coordinators** | 70% | ⚠️ Mixed | Phase coordinators ✅, async needs standardization |
|
|
642
|
+
| **Agent System** | 40% | 📋 Legacy | Uses `AgentContext` pattern (predates ACB) |
|
|
643
|
+
|
|
644
|
+
**Key Architectural Patterns**
|
|
645
|
+
|
|
646
|
+
```python
|
|
647
|
+
# ✅ GOLD STANDARD Pattern (from CLI Handlers)
|
|
648
|
+
from acb.depends import depends, Inject
|
|
649
|
+
from crackerjack.models.protocols import Console
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
@depends.inject
|
|
653
|
+
def setup_environment(console: Inject[Console] = None, verbose: bool = False) -> None:
|
|
654
|
+
"""Protocol-based injection with @depends.inject decorator."""
|
|
655
|
+
console.print("[green]Environment ready[/green]")
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
# ❌ ANTI-PATTERN: Avoid manual fallbacks
|
|
659
|
+
def setup_environment_wrong(console: Console | None = None):
|
|
660
|
+
self.console = console or Console() # Bypasses DI container
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### Performance Benefits
|
|
664
|
+
|
|
665
|
+
| Metric | Legacy | ACB Workflows (Phase 4.2) | Improvement |
|
|
666
|
+
|--------|--------|----------------------------|-------------|
|
|
667
|
+
| **Fast Hooks** | ~45s | ~48s | Comparable |
|
|
668
|
+
| **Full Workflow** | ~60s | ~90s | Real-time output |
|
|
669
|
+
| **Console Output** | Buffered | **Real-time streaming** | UX improvement |
|
|
670
|
+
| **Event Loop** | Sync (blocking) | **Async (non-blocking)** | Responsive |
|
|
671
|
+
| **Cache Hit Rate** | 0% | **70%** | New capability |
|
|
672
|
+
| **Concurrent Adapters** | 1 | **11** | 11x parallelism |
|
|
673
|
+
| **DI Context** | Manual | **Protocol-based injection** | Type safety |
|
|
674
|
+
|
|
675
|
+
### Core Components
|
|
676
|
+
|
|
677
|
+
#### 1. Quality Assurance Adapters
|
|
678
|
+
|
|
679
|
+
**Location:** `crackerjack/adapters/`
|
|
680
|
+
|
|
681
|
+
ACB-registered adapters for all quality checks:
|
|
682
|
+
|
|
683
|
+
- **Format:** Ruff formatting, mdformat
|
|
684
|
+
- **Lint:** Codespell, complexity analysis
|
|
685
|
+
- **Security:** Bandit security scanning, Gitleaks secret detection
|
|
686
|
+
- **Type:** Zuban type checking (20-200x faster than Pyright)
|
|
687
|
+
- **Refactor:** Creosote (unused dependencies), Refurb (Python idioms)
|
|
688
|
+
- **Complexity:** Complexipy analysis
|
|
689
|
+
- **Utility:** Various validation checks
|
|
690
|
+
- **AI:** Claude integration for intelligent auto-fixing
|
|
691
|
+
|
|
692
|
+
#### 2. Hook Orchestrator
|
|
693
|
+
|
|
694
|
+
**Location:** `crackerjack/orchestration/hook_orchestrator.py`
|
|
695
|
+
|
|
696
|
+
Features:
|
|
697
|
+
|
|
698
|
+
- **Dual execution mode:** Legacy (pre-commit CLI) + ACB (direct adapters)
|
|
699
|
+
- **Dependency resolution:** Intelligent hook ordering (e.g., format before lint)
|
|
700
|
+
- **Adaptive strategies:** Fast, comprehensive, or dependency-aware execution
|
|
701
|
+
- **Graceful degradation:** Timeout strategies prevent hanging
|
|
702
|
+
|
|
703
|
+
#### 3. Cache Adapters
|
|
704
|
+
|
|
705
|
+
**Location:** `crackerjack/orchestration/cache/`
|
|
706
|
+
|
|
707
|
+
Two caching strategies:
|
|
708
|
+
|
|
709
|
+
- **ToolProxyCache:** Content-based caching with file hash verification
|
|
710
|
+
- **MemoryCache:** In-memory LRU cache for testing
|
|
711
|
+
|
|
712
|
+
Benefits:
|
|
713
|
+
|
|
714
|
+
- **70% cache hit rate** in typical workflows
|
|
715
|
+
- **Content-aware invalidation:** Only re-runs when files actually change
|
|
716
|
+
- **Configurable TTL:** Default 3600s (1 hour)
|
|
717
|
+
|
|
718
|
+
#### 4. MCP Server Integration
|
|
719
|
+
|
|
720
|
+
**Location:** `crackerjack/mcp/`
|
|
721
|
+
|
|
722
|
+
ACB-registered services:
|
|
723
|
+
|
|
724
|
+
- **MCPServerService:** FastMCP server for AI agent integration
|
|
725
|
+
- **ErrorCache:** Pattern tracking for AI fix recommendations
|
|
726
|
+
- **JobManager:** WebSocket job tracking and progress streaming
|
|
727
|
+
- **WebSocketSecurityConfig:** Security hardening (localhost-only, rate limiting)
|
|
728
|
+
|
|
729
|
+
### Migration from Pre-commit
|
|
730
|
+
|
|
731
|
+
Crackerjack has migrated from pre-commit subprocess calls to direct ACB adapter execution:
|
|
732
|
+
|
|
733
|
+
**Old Approach (Pre-commit):**
|
|
734
|
+
|
|
735
|
+
```bash
|
|
736
|
+
pre-commit run ruff --all-files # Subprocess overhead
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
**New Approach (ACB):**
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
python -m crackerjack --fast # Direct Python API, 70% faster
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
**Migration Guide:** See `docs/README.md` (Migration Notes)
|
|
746
|
+
|
|
747
|
+
### Configuration Management (ACB Settings & Configuration Templates)
|
|
748
|
+
|
|
749
|
+
Crackerjack utilizes a **dual configuration system** to handle both runtime application settings and project configuration templates:
|
|
750
|
+
|
|
751
|
+
#### 1. Runtime Configuration (ACB Settings)
|
|
752
|
+
|
|
753
|
+
**ACB Settings** manages application runtime configuration:
|
|
754
|
+
|
|
755
|
+
**Before (11 config files, ~1,808 LOC):**
|
|
756
|
+
|
|
757
|
+
```python
|
|
758
|
+
from crackerjack.models.config import WorkflowOptions, HookConfig
|
|
759
|
+
from crackerjack.orchestration.config import OrchestrationConfig
|
|
760
|
+
# ... multiple configuration imports
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
**After (1 settings file, ~300 LOC):**
|
|
764
|
+
|
|
765
|
+
```python
|
|
766
|
+
from acb.depends import depends
|
|
767
|
+
from crackerjack.config import CrackerjackSettings
|
|
768
|
+
|
|
769
|
+
settings = depends.get(CrackerjackSettings)
|
|
770
|
+
# Auto-loads from: env vars (CRACKERJACK_*), .env file, defaults
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**Benefits:**
|
|
774
|
+
|
|
775
|
+
- **83% LOC reduction** in configuration code
|
|
776
|
+
- **Automatic environment variable loading** (CRACKERJACK\_\* prefix)
|
|
777
|
+
- **Type validation** via Pydantic
|
|
778
|
+
- **Single source of truth** for all runtime settings
|
|
779
|
+
- **Backward compatible** - Public API unchanged (`create_workflow_options()`)
|
|
780
|
+
|
|
781
|
+
#### 2. Project Configuration Templates (ConfigTemplateService)
|
|
782
|
+
|
|
783
|
+
**ConfigTemplateService** manages project-level configuration templates for files like `.pre-commit-config.yaml` and `pyproject.toml`:
|
|
784
|
+
|
|
785
|
+
```bash
|
|
786
|
+
# Check for available configuration updates
|
|
787
|
+
python -m crackerjack --check-config-updates
|
|
788
|
+
|
|
789
|
+
# Show diff for specific configuration type
|
|
790
|
+
python -m crackerjack --diff-config pre-commit
|
|
791
|
+
|
|
792
|
+
# Apply configuration updates interactively
|
|
793
|
+
python -m crackerjack --apply-config-updates --config-interactive
|
|
794
|
+
|
|
795
|
+
# Refresh configuration cache
|
|
796
|
+
python -m crackerjack --refresh-cache
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
**ConfigTemplateService Benefits:**
|
|
800
|
+
|
|
801
|
+
- **Version-based tracking** - Each configuration has version control
|
|
802
|
+
- **User-controlled updates** - Explicit approval required for changes
|
|
803
|
+
- **Diff visibility** - Shows changes before applying
|
|
804
|
+
- **Cache management** - Automatic pre-commit cache invalidation
|
|
805
|
+
- **Template management** - Centralized configuration templates as code
|
|
806
|
+
|
|
807
|
+
**Config Merge Service (Initialization)**
|
|
808
|
+
|
|
809
|
+
The ConfigMergeService handles intelligent configuration merging during project initialization:
|
|
810
|
+
|
|
811
|
+
```python
|
|
812
|
+
# Used by InitializationService for new project setup
|
|
813
|
+
merge_result = config_merge_service.smart_merge_pyproject(
|
|
814
|
+
source_config, target_path, project_name
|
|
815
|
+
)
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
**For Complete Configuration System Details:** See `docs/README.md` (Project Structure and Coding Standards).
|
|
819
|
+
|
|
820
|
+
**Migration Details:** See `docs/README.md` (Migration Notes)
|
|
821
|
+
|
|
822
|
+
### Using ACB Dependency Injection
|
|
823
|
+
|
|
824
|
+
Example: Custom QA Adapter
|
|
825
|
+
|
|
826
|
+
```python
|
|
827
|
+
import uuid
|
|
828
|
+
from contextlib import suppress
|
|
829
|
+
from acb.depends import depends
|
|
830
|
+
from crackerjack.adapters._qa_adapter_base import QAAdapterBase
|
|
831
|
+
|
|
832
|
+
# Module-level registration (ACB pattern)
|
|
833
|
+
MODULE_ID = uuid.UUID("01937d86-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
|
|
834
|
+
MODULE_STATUS = "stable"
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
class CustomAdapter(QAAdapterBase):
|
|
838
|
+
@property
|
|
839
|
+
def adapter_name(self) -> str:
|
|
840
|
+
return "Custom Checker"
|
|
841
|
+
|
|
842
|
+
@property
|
|
843
|
+
def module_id(self) -> uuid.UUID:
|
|
844
|
+
return MODULE_ID
|
|
845
|
+
|
|
846
|
+
async def check(self, files, config):
|
|
847
|
+
# Your quality check logic here
|
|
848
|
+
return QAResult(passed=True, issues=[])
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
# Register with DI container
|
|
852
|
+
with suppress(Exception):
|
|
853
|
+
depends.set(CustomAdapter)
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
### Performance Optimization
|
|
857
|
+
|
|
858
|
+
#### Intelligent Caching
|
|
859
|
+
|
|
860
|
+
- **Content-based keys:** `{hook_name}:{config_hash}:{content_hash}`
|
|
861
|
+
- **File hash verification:** Detects actual file changes, not just timestamps
|
|
862
|
+
- **LRU eviction:** Automatic cleanup of old entries
|
|
863
|
+
|
|
864
|
+
#### Parallel Execution
|
|
865
|
+
|
|
866
|
+
- **Dependency-aware scheduling:** Runs independent hooks in parallel
|
|
867
|
+
- **Semaphore control:** Prevents resource exhaustion
|
|
868
|
+
- **Async I/O:** 76% faster for I/O-bound operations
|
|
869
|
+
|
|
870
|
+
#### Timeout Strategies
|
|
871
|
+
|
|
872
|
+
- **Graceful degradation:** Continues execution even if one hook times out
|
|
873
|
+
- **Configurable limits:** Default 60s per hook, 300s overall
|
|
874
|
+
- **Context managers:** Automatic cleanup on timeout
|
|
875
|
+
|
|
876
|
+
### ACB Benefits
|
|
877
|
+
|
|
878
|
+
1. **Type Safety:** Runtime-checkable protocols ensure correctness
|
|
879
|
+
1. **Testability:** Easy mocking with `depends.get()`
|
|
880
|
+
1. **Maintainability:** Clear separation between adapters and orchestration
|
|
881
|
+
1. **Observability:** Structured logging with context fields
|
|
882
|
+
1. **Security:** Input validation, timeout protection, origin validation
|
|
883
|
+
1. **Performance:** 47% faster overall execution with intelligent caching
|
|
884
|
+
|
|
885
|
+
### Documentation
|
|
886
|
+
|
|
887
|
+
- See `docs/README.md` for consolidated documentation and references.
|
|
888
|
+
- **Code Review Report:** Available from maintainers
|
|
889
|
+
|
|
890
|
+
**Status:** ✅ Production Ready (as of 2025-10-09)
|
|
891
|
+
|
|
892
|
+
## 🛡️ Advanced-Grade Pattern Management System
|
|
893
|
+
|
|
894
|
+
### Advanced Regex Pattern Validation
|
|
895
|
+
|
|
896
|
+
Crackerjack includes a revolutionary **centralized regex pattern management system** that eliminates dangerous regex issues through comprehensive validation and safety controls.
|
|
897
|
+
|
|
898
|
+
#### Key Components
|
|
899
|
+
|
|
900
|
+
**📦 Centralized Pattern Registry** (`crackerjack/services/regex_patterns.py`):
|
|
901
|
+
|
|
902
|
+
- **18+ validated patterns** for security, formatting, version management
|
|
903
|
+
- **ValidatedPattern class** with comprehensive testing and safety limits
|
|
904
|
+
- **Thread-safe compiled pattern caching** for performance
|
|
905
|
+
- **Iterative application** for complex multi-word cases (e.g., `pytest - hypothesis - specialist`)
|
|
906
|
+
|
|
907
|
+
**🔧 Pattern Categories**:
|
|
908
|
+
|
|
909
|
+
- **Command & Flag Formatting**: Fix spacing in `python -m command`, `--flags`, hyphenated names
|
|
910
|
+
- **Security Token Masking**: PyPI tokens, GitHub PATs, generic long tokens, assignment patterns
|
|
911
|
+
- **Version Management**: Update `pyproject.toml` versions, coverage requirements
|
|
912
|
+
- **Code Quality**: Subprocess security fixes, unsafe library replacements, formatting normalization
|
|
913
|
+
- **Test Optimization**: Assert statement normalization, job ID validation
|
|
914
|
+
|
|
915
|
+
**⚡ Performance & Safety Features**:
|
|
916
|
+
|
|
917
|
+
```python
|
|
918
|
+
# Thread-safe pattern cache with size limits
|
|
919
|
+
CompiledPatternCache.get_compiled_pattern(pattern)
|
|
920
|
+
|
|
921
|
+
# Safety limits prevent catastrophic backtracking
|
|
922
|
+
MAX_INPUT_SIZE = 10 * 1024 * 1024 # 10MB max
|
|
923
|
+
MAX_ITERATIONS = 10 # Iterative application limit
|
|
924
|
+
|
|
925
|
+
# Iterative fixes for complex cases
|
|
926
|
+
pattern.apply_iteratively("pytest - hypothesis - specialist")
|
|
927
|
+
# # → "pytest-hypothesis-specialist"
|
|
928
|
+
|
|
929
|
+
# Performance monitoring capabilities
|
|
930
|
+
pattern.get_performance_stats(text, iterations=100)
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
#### Security Pattern Examples
|
|
934
|
+
|
|
935
|
+
**Token Masking Patterns**:
|
|
936
|
+
|
|
937
|
+
```python
|
|
938
|
+
# PyPI tokens (word boundaries prevent false matches)
|
|
939
|
+
"pypi-AgEIcHlwaS5vcmcCJGE4M2Y3ZjI" # → "pypi-****"
|
|
940
|
+
|
|
941
|
+
# GitHub personal access tokens (exactly 40 chars)
|
|
942
|
+
"ghp_1234567890abcdef1234567890abcdef1234" # → "ghp_****"
|
|
943
|
+
|
|
944
|
+
# Generic long tokens (32+ chars with word boundaries)
|
|
945
|
+
"secret_key=abcdef1234567890abcdef1234567890abcdef" # → "secret_key=****"
|
|
946
|
+
```
|
|
947
|
+
|
|
948
|
+
**Subprocess Security Fixes**:
|
|
949
|
+
|
|
950
|
+
```python
|
|
951
|
+
# Automatic shell injection prevention
|
|
952
|
+
subprocess.run(cmd, shell=True) # → subprocess.run(cmd.split())
|
|
953
|
+
subprocess.call(cmd, shell=True) # → subprocess.call(cmd.split())
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
**Unsafe Library Replacements**:
|
|
957
|
+
|
|
958
|
+
```python
|
|
959
|
+
# Weak crypto # → Strong crypto
|
|
960
|
+
hashlib.md5(data) # → hashlib.sha256(data)
|
|
961
|
+
hashlib.sha1(data) # → hashlib.sha256(data)
|
|
962
|
+
|
|
963
|
+
# Insecure random # → Cryptographic random
|
|
964
|
+
random.choice(options) # → secrets.choice(options)
|
|
965
|
+
|
|
966
|
+
# Unsafe YAML # → Safe YAML
|
|
967
|
+
yaml.load(file) # → yaml.safe_load(file)
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
#### Pattern Validation Requirements
|
|
971
|
+
|
|
972
|
+
**Every pattern MUST include**:
|
|
973
|
+
|
|
974
|
+
- ✅ **Comprehensive test cases** (positive, negative, edge cases)
|
|
975
|
+
- ✅ **Replacement syntax validation** (no spaces in `\g<N>`)
|
|
976
|
+
- ✅ **Safety limits** and performance monitoring
|
|
977
|
+
- ✅ **Thread-safe compilation** and caching
|
|
978
|
+
- ✅ **Descriptive documentation** and usage examples
|
|
979
|
+
|
|
980
|
+
**Quality Guarantees**:
|
|
981
|
+
|
|
982
|
+
- **Zero regex-related bugs** since implementation
|
|
983
|
+
- **Performance optimized** with compiled pattern caching
|
|
984
|
+
- **Security hardened** with input size limits and validation
|
|
985
|
+
- **Maintenance friendly** with centralized pattern management
|
|
986
|
+
|
|
987
|
+
### Pre-commit Regex Validation Hook
|
|
988
|
+
|
|
989
|
+
**Future Enhancement**: Automated validation hook to ensure all regex usage follows safe patterns:
|
|
990
|
+
|
|
991
|
+
```bash
|
|
992
|
+
# Validates all .py files for regex pattern compliance
|
|
993
|
+
python -m crackerjack.tools.validate_regex_usage
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
This advanced-grade pattern management system has **eliminated all regex-related spacing and security issues** that previously plagued the codebase, providing a robust foundation for safe text processing operations.
|
|
997
|
+
|
|
998
|
+
## Adapters
|
|
999
|
+
|
|
1000
|
+
Adapters connect Crackerjack to external tools and subsystems (e.g., Ruff, Zuban, Bandit) using ACB patterns. Each adapter exposes typed settings, async initialization, and standardized results.
|
|
1001
|
+
|
|
1002
|
+
- AI — Claude-powered code fixes: [crackerjack/adapters/ai/README.md](<./crackerjack/adapters/ai/README.md>)
|
|
1003
|
+
- Complexity — Code complexity analysis (Complexipy): [crackerjack/adapters/complexity/README.md](<./crackerjack/adapters/complexity/README.md>)
|
|
1004
|
+
- Format — Python/Markdown formatting (Ruff, Mdformat): [crackerjack/adapters/format/README.md](<./crackerjack/adapters/format/README.md>)
|
|
1005
|
+
- Lint — Spelling and simple linters (Codespell): [crackerjack/adapters/lint/README.md](<./crackerjack/adapters/lint/README.md>)
|
|
1006
|
+
- LSP — Rust tools with LSP (Zuban, Skylos): [crackerjack/adapters/lsp/README.md](<./crackerjack/adapters/lsp/README.md>)
|
|
1007
|
+
- Refactor — Modernization, dead code, unused deps (Refurb, Skylos, Creosote): [crackerjack/adapters/refactor/README.md](<./crackerjack/adapters/refactor/README.md>)
|
|
1008
|
+
- Security — Static analysis and secrets (Bandit, Gitleaks, Pyscn): [crackerjack/adapters/security/README.md](<./crackerjack/adapters/security/README.md>)
|
|
1009
|
+
- Type — Static type checking (Zuban, Pyrefly, Ty): [crackerjack/adapters/type/README.md](<./crackerjack/adapters/type/README.md>)
|
|
1010
|
+
- Utility — Config-driven checks (EOF newline, regex, size, lock): [crackerjack/adapters/utility/README.md](<./crackerjack/adapters/utility/README.md>)
|
|
1011
|
+
|
|
1012
|
+
Quick index: [crackerjack/adapters/README.md](<./crackerjack/adapters/README.md>).
|
|
1013
|
+
|
|
1014
|
+
## MCP Server Configuration
|
|
1015
|
+
|
|
1016
|
+
### What is MCP?
|
|
1017
|
+
|
|
1018
|
+
Model Context Protocol (MCP) enables AI agents to interact directly with Crackerjack's CLI tools for autonomous code quality fixes.
|
|
1019
|
+
|
|
1020
|
+
### Setup MCP Server
|
|
1021
|
+
|
|
1022
|
+
1. **Install development dependencies (includes MCP tools):**
|
|
1023
|
+
|
|
1024
|
+
```bash
|
|
1025
|
+
uv sync --group dev
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
1. **Start the MCP server:**
|
|
1029
|
+
|
|
1030
|
+
```bash
|
|
1031
|
+
# Starts WebSocket server on localhost:8675 with MCP protocol support
|
|
1032
|
+
python -m crackerjack --start-mcp-server
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
1. **Configure your MCP client (e.g., Claude Desktop):**
|
|
1036
|
+
|
|
1037
|
+
Add to your MCP configuration file (`mcp.json`):
|
|
1038
|
+
|
|
1039
|
+
**For installed crackerjack (from PyPI):**
|
|
1040
|
+
|
|
1041
|
+
```json
|
|
1042
|
+
{
|
|
1043
|
+
"mcpServers": {
|
|
1044
|
+
"crackerjack": {
|
|
1045
|
+
"command": "uvx",
|
|
1046
|
+
"args": [
|
|
1047
|
+
"crackerjack",
|
|
1048
|
+
"--start-mcp-server"
|
|
1049
|
+
],
|
|
1050
|
+
"env": {
|
|
1051
|
+
"UV_KEYRING_PROVIDER": "subprocess",
|
|
1052
|
+
"EDITOR": "code --wait"
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
**For local development version:**
|
|
1060
|
+
|
|
1061
|
+
```json
|
|
1062
|
+
{
|
|
1063
|
+
"mcpServers": {
|
|
1064
|
+
"crackerjack": {
|
|
1065
|
+
"command": "uvx",
|
|
1066
|
+
"args": [
|
|
1067
|
+
"--from",
|
|
1068
|
+
"/path/to/crackerjack",
|
|
1069
|
+
"crackerjack",
|
|
1070
|
+
"--start-mcp-server"
|
|
1071
|
+
],
|
|
1072
|
+
"env": {
|
|
1073
|
+
"UV_KEYRING_PROVIDER": "subprocess",
|
|
1074
|
+
"EDITOR": "code --wait"
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
### Environment Variables & Security
|
|
1082
|
+
|
|
1083
|
+
Crackerjack supports several environment variables for configuration:
|
|
1084
|
+
|
|
1085
|
+
- **`UV_PUBLISH_TOKEN`**: PyPI authentication token for publishing ⚠️ **Keep secure!**
|
|
1086
|
+
- **`UV_KEYRING_PROVIDER`**: Keyring provider for secure credential storage (e.g., "subprocess")
|
|
1087
|
+
- **`EDITOR`**: Default text editor for interactive commit message editing (e.g., "code --wait")
|
|
1088
|
+
- **`AI_AGENT`**: Set to "1" to enable AI agent mode with structured JSON output
|
|
1089
|
+
|
|
1090
|
+
#### 🔒 Security Best Practices
|
|
1091
|
+
|
|
1092
|
+
**Token Security:**
|
|
1093
|
+
|
|
1094
|
+
- **Never commit tokens to version control**
|
|
1095
|
+
- Use `.env` files (add to `.gitignore`)
|
|
1096
|
+
- Prefer keyring over environment variables
|
|
1097
|
+
- Rotate tokens regularly
|
|
1098
|
+
|
|
1099
|
+
**Recommended setup:**
|
|
1100
|
+
|
|
1101
|
+
```bash
|
|
1102
|
+
# Create .env file (add to .gitignore)
|
|
1103
|
+
echo "UV_PUBLISH_TOKEN=pypi-your-token-here" > .env
|
|
1104
|
+
echo ".env" >> .gitignore
|
|
1105
|
+
|
|
1106
|
+
# Or use secure keyring storage
|
|
1107
|
+
keyring set https://upload.pypi.org/legacy/ __token__
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
**Example MCP configuration with environment variables:**
|
|
1111
|
+
|
|
1112
|
+
```json
|
|
1113
|
+
{
|
|
1114
|
+
"mcpServers": {
|
|
1115
|
+
"crackerjack": {
|
|
1116
|
+
"command": "uvx",
|
|
1117
|
+
"args": [
|
|
1118
|
+
"--from",
|
|
1119
|
+
"/path/to/crackerjack",
|
|
1120
|
+
"crackerjack",
|
|
1121
|
+
"--start-mcp-server"
|
|
1122
|
+
],
|
|
1123
|
+
"env": {
|
|
1124
|
+
"UV_KEYRING_PROVIDER": "subprocess",
|
|
1125
|
+
"EDITOR": "code --wait",
|
|
1126
|
+
"UV_PUBLISH_TOKEN": "pypi-your-token-here"
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
### Available MCP Tools
|
|
1134
|
+
|
|
1135
|
+
**Job Execution & Monitoring:**
|
|
1136
|
+
|
|
1137
|
+
- **`execute_crackerjack`**: Start iterative auto-fixing with job tracking
|
|
1138
|
+
- **`get_job_progress`**: Real-time progress for running jobs
|
|
1139
|
+
- **`run_crackerjack_stage`**: Execute specific quality stages (fast, comprehensive, tests)
|
|
1140
|
+
|
|
1141
|
+
**Error Analysis:**
|
|
1142
|
+
|
|
1143
|
+
- **`analyze_errors`**: Analyze and categorize code quality errors
|
|
1144
|
+
- **`smart_error_analysis`**: AI-powered error analysis with cached patterns
|
|
1145
|
+
|
|
1146
|
+
**Session Management:**
|
|
1147
|
+
|
|
1148
|
+
- **`get_stage_status`**: Check current status of quality stages
|
|
1149
|
+
- **`get_next_action`**: Get optimal next action based on session state
|
|
1150
|
+
- **`session_management`**: Manage sessions with checkpoints and resume capability
|
|
1151
|
+
|
|
1152
|
+
**WebSocket Endpoints:**
|
|
1153
|
+
|
|
1154
|
+
- **Server URL**: `ws://localhost:8675`
|
|
1155
|
+
- **Progress Streaming**: `/ws/progress/{job_id}` for real-time updates
|
|
1156
|
+
|
|
1157
|
+
### Slash Commands
|
|
1158
|
+
|
|
1159
|
+
**`/crackerjack:run`**: Autonomous code quality enforcement with AI agent
|
|
1160
|
+
|
|
1161
|
+
```bash
|
|
1162
|
+
# Through MCP
|
|
1163
|
+
{
|
|
1164
|
+
"command": "/crackerjack:run",
|
|
1165
|
+
"args": []
|
|
1166
|
+
}
|
|
1167
|
+
```
|
|
1168
|
+
|
|
1169
|
+
**`/crackerjack:init`**: Initialize or update project configuration
|
|
1170
|
+
|
|
1171
|
+
```bash
|
|
1172
|
+
# Through MCP
|
|
1173
|
+
{
|
|
1174
|
+
"command": "/crackerjack:init",
|
|
1175
|
+
"args": ["--force"] # Optional: force reinitialize
|
|
1176
|
+
}
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
## Quality Hook Modes
|
|
1180
|
+
|
|
1181
|
+
Crackerjack runs quality checks in a two-stage process for optimal development workflow:
|
|
1182
|
+
|
|
1183
|
+
### Hook Details
|
|
1184
|
+
|
|
1185
|
+
**Fast Hooks (~5 seconds):**
|
|
1186
|
+
|
|
1187
|
+
- Ruff formatting and linting
|
|
1188
|
+
- Trailing whitespace cleanup
|
|
1189
|
+
- UV lock file updates
|
|
1190
|
+
- Security credential detection
|
|
1191
|
+
- Spell checking
|
|
1192
|
+
|
|
1193
|
+
**Comprehensive Hooks (~30 seconds):**
|
|
1194
|
+
|
|
1195
|
+
- Zuban type checking
|
|
1196
|
+
- Bandit security analysis
|
|
1197
|
+
- Dead code detection (vulture)
|
|
1198
|
+
- Dependency analysis (creosote)
|
|
1199
|
+
- Complexity limits (complexipy)
|
|
1200
|
+
- Modern Python patterns (refurb)
|
|
1201
|
+
|
|
1202
|
+
```bash
|
|
1203
|
+
# Default behavior runs comprehensive hooks
|
|
1204
|
+
python -m crackerjack
|
|
1205
|
+
|
|
1206
|
+
# Skip hooks if you only want setup/cleaning
|
|
1207
|
+
python -m crackerjack --skip-hooks
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
### Common Commands
|
|
1211
|
+
|
|
1212
|
+
```bash
|
|
1213
|
+
# Quality checks only
|
|
1214
|
+
python -m crackerjack
|
|
1215
|
+
|
|
1216
|
+
# With testing
|
|
1217
|
+
python -m crackerjack --run-tests
|
|
1218
|
+
|
|
1219
|
+
# Full release workflow
|
|
1220
|
+
python -m crackerjack --all patch
|
|
1221
|
+
|
|
1222
|
+
# AI agent mode
|
|
1223
|
+
python -m crackerjack --ai-fix
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
## Quick Reference Index
|
|
1227
|
+
|
|
1228
|
+
**📋 Command Index by Use Case**
|
|
1229
|
+
|
|
1230
|
+
| Use Case | Command | Description |
|
|
1231
|
+
|----------|---------|-------------|
|
|
1232
|
+
| **Basic Quality Check** | `python -m crackerjack` | Run quality checks only |
|
|
1233
|
+
| **Quality + Tests** | `python -m crackerjack --run-tests` | Quality checks with test suite |
|
|
1234
|
+
| **AI Auto-Fix** | `python -m crackerjack --ai-fix --run-tests` | AI-powered fixing + tests (recommended) |
|
|
1235
|
+
| **Full Release** | `python -m crackerjack --all patch` | Version bump, quality checks, publish |
|
|
1236
|
+
| **Quick Publish** | `python -m crackerjack --publish patch` | Version bump + publish only |
|
|
1237
|
+
| **Start MCP Server** | `python -m crackerjack --start-mcp-server` | Launch MCP agent integration |
|
|
1238
|
+
| **Monitoring Dashboard** | `python -m crackerjack --dashboard` | Comprehensive monitoring view |
|
|
1239
|
+
| **AI Debugging** | `python -m crackerjack --ai-debug --run-tests` | Verbose AI debugging mode |
|
|
1240
|
+
| **Coverage Status** | `python -m crackerjack --coverage-status` | Show coverage ratchet progress |
|
|
1241
|
+
| **Clear Caches** | `python -m crackerjack --clear-cache` | Reset all cache data |
|
|
1242
|
+
| **Fast Iteration** | `python -m crackerjack --skip-hooks` | Skip quality checks during dev |
|
|
1243
|
+
| **Documentation** | `python -m crackerjack --generate-docs` | Generate API documentation |
|
|
1244
|
+
| **Advanced Features** | See `docs/README.md` | Advanced flags and workflows |
|
|
1245
|
+
|
|
1246
|
+
**📑 Alphabetical Flag Reference**
|
|
1247
|
+
|
|
1248
|
+
| Flag | Short | Description |
|
|
1249
|
+
|------|-------|-------------|
|
|
1250
|
+
| `--ai-debug` | - | Verbose debugging for AI auto-fixing |
|
|
1251
|
+
| `--ai-fix` | - | Enable AI-powered auto-fixing |
|
|
1252
|
+
| `--all` | `-a` | Full release workflow (bump, test, publish) |
|
|
1253
|
+
| `--benchmark` | - | Run tests in benchmark mode |
|
|
1254
|
+
| `--boost-coverage` | - | Auto-improve test coverage (default) |
|
|
1255
|
+
| `--bump` | `-b` | Bump version (patch/minor/major/auto) |
|
|
1256
|
+
| `--cache-stats` | - | Display cache statistics |
|
|
1257
|
+
| `--clear-cache` | - | Clear all caches and exit |
|
|
1258
|
+
| `--commit` | `-c` | Commit and push changes to Git |
|
|
1259
|
+
| `--comp` | - | Run only comprehensive hooks |
|
|
1260
|
+
| `--coverage-status` | - | Show coverage ratchet status |
|
|
1261
|
+
| `--dashboard` | - | Start comprehensive monitoring dashboard |
|
|
1262
|
+
| `--debug` | - | Enable debug output |
|
|
1263
|
+
| `--dev` | - | Enable development mode for monitors |
|
|
1264
|
+
| `--enhanced-monitor` | - | Advanced monitoring with patterns |
|
|
1265
|
+
| `--fast` | - | Run only fast hooks |
|
|
1266
|
+
| `--generate-docs` | - | Generate API documentation |
|
|
1267
|
+
| `--interactive` | `-i` | Use Rich UI interface |
|
|
1268
|
+
| `--monitor` | - | Multi-project progress monitor |
|
|
1269
|
+
| `--orchestrated` | - | Advanced orchestrated workflow mode |
|
|
1270
|
+
| `--publish` | `-p` | Bump version and publish to PyPI |
|
|
1271
|
+
| `--quick` | - | Quick mode (3 iterations, for CI/CD) |
|
|
1272
|
+
| `--restart-mcp-server` | - | Restart MCP server |
|
|
1273
|
+
| `--run-tests` | `-t` | Execute test suite |
|
|
1274
|
+
| `--skip-hooks` | `-s` | Skip pre-commit hooks |
|
|
1275
|
+
| `--start-mcp-server` | - | Start MCP server |
|
|
1276
|
+
| `--stop-mcp-server` | - | Stop MCP server |
|
|
1277
|
+
| `--strip-code` | `-x` | Remove docstrings/comments |
|
|
1278
|
+
| `--thorough` | - | Thorough mode (8 iterations) |
|
|
1279
|
+
| `--unified-dashboard` | - | Unified real-time dashboard |
|
|
1280
|
+
| `--verbose` | `-v` | Enable verbose output |
|
|
1281
|
+
| `--watchdog` | - | Service watchdog with auto-restart |
|
|
1282
|
+
|
|
1283
|
+
**🔗 Related Documentation**
|
|
1284
|
+
|
|
1285
|
+
- **Advanced Features**: See `docs/README.md` - consolidated advanced flags
|
|
1286
|
+
- **Developer Guide**: [CLAUDE.md](<./CLAUDE.md>) - AI assistant guidelines and developer commands
|
|
1287
|
+
|
|
1288
|
+
______________________________________________________________________
|
|
1289
|
+
|
|
1290
|
+
## Command Reference
|
|
1291
|
+
|
|
1292
|
+
**Core Workflow Commands:**
|
|
1293
|
+
|
|
1294
|
+
```bash
|
|
1295
|
+
# Quality checks and development
|
|
1296
|
+
python -m crackerjack # Quality checks only
|
|
1297
|
+
python -m crackerjack --run-tests # Quality checks + tests
|
|
1298
|
+
python -m crackerjack --ai-fix --run-tests # AI auto-fixing + tests (recommended)
|
|
1299
|
+
|
|
1300
|
+
# Release workflow
|
|
1301
|
+
python -m crackerjack --all patch # Full release workflow
|
|
1302
|
+
python -m crackerjack --publish patch # Version bump + publish
|
|
1303
|
+
```
|
|
1304
|
+
|
|
1305
|
+
**AI-Powered Development:**
|
|
1306
|
+
|
|
1307
|
+
```bash
|
|
1308
|
+
python -m crackerjack --ai-fix # AI auto-fixing mode
|
|
1309
|
+
python -m crackerjack --ai-debug --run-tests # AI debugging with verbose output
|
|
1310
|
+
python -m crackerjack --ai-fix --run-tests --verbose # Full AI workflow
|
|
1311
|
+
python -m crackerjack --orchestrated # Advanced orchestrated workflow
|
|
1312
|
+
python -m crackerjack --quick # Quick mode (3 iterations max)
|
|
1313
|
+
python -m crackerjack --thorough # Thorough mode (8 iterations max)
|
|
1314
|
+
```
|
|
1315
|
+
|
|
1316
|
+
**Monitoring & Observability:**
|
|
1317
|
+
|
|
1318
|
+
```bash
|
|
1319
|
+
python -m crackerjack --dashboard # Comprehensive monitoring dashboard
|
|
1320
|
+
python -m crackerjack --unified-dashboard # Unified real-time dashboard
|
|
1321
|
+
python -m crackerjack --monitor # Multi-project progress monitor
|
|
1322
|
+
python -m crackerjack --enhanced-monitor # Enhanced monitoring with patterns
|
|
1323
|
+
python -m crackerjack --watchdog # Service watchdog (auto-restart)
|
|
1324
|
+
```
|
|
1325
|
+
|
|
1326
|
+
**MCP Server Management:**
|
|
1327
|
+
|
|
1328
|
+
```bash
|
|
1329
|
+
python -m crackerjack --start-mcp-server # Start MCP server
|
|
1330
|
+
python -m crackerjack --stop-mcp-server # Stop MCP server
|
|
1331
|
+
python -m crackerjack --restart-mcp-server # Restart MCP server
|
|
1332
|
+
python -m crackerjack --start-websocket-server # Start WebSocket server
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
**Performance & Caching:**
|
|
1336
|
+
|
|
1337
|
+
```bash
|
|
1338
|
+
python -m crackerjack --cache-stats # Display cache statistics
|
|
1339
|
+
python -m crackerjack --clear-cache # Clear all caches
|
|
1340
|
+
python -m crackerjack --benchmark # Run in benchmark mode
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
**Coverage Management:**
|
|
1344
|
+
|
|
1345
|
+
```bash
|
|
1346
|
+
python -m crackerjack --coverage-status # Show coverage ratchet status
|
|
1347
|
+
python -m crackerjack --coverage-goal 85.0 # Set explicit coverage target
|
|
1348
|
+
python -m crackerjack --no-coverage-ratchet # Disable coverage ratchet temporarily
|
|
1349
|
+
python -m crackerjack --boost-coverage # Auto-improve test coverage (default)
|
|
1350
|
+
python -m crackerjack --no-boost-coverage # Disable coverage improvements
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
**Zuban LSP Server Management:**
|
|
1354
|
+
|
|
1355
|
+
```bash
|
|
1356
|
+
python -m crackerjack --start-zuban-lsp # Start Zuban LSP server
|
|
1357
|
+
python -m crackerjack --stop-zuban-lsp # Stop Zuban LSP server
|
|
1358
|
+
python -m crackerjack --restart-zuban-lsp # Restart Zuban LSP server
|
|
1359
|
+
python -m crackerjack --no-zuban-lsp # Disable automatic LSP startup
|
|
1360
|
+
python -m crackerjack --zuban-lsp-port 8677 # Custom LSP port
|
|
1361
|
+
python -m crackerjack --zuban-lsp-mode tcp # Transport mode (tcp/stdio)
|
|
1362
|
+
python -m crackerjack --zuban-lsp-timeout 30 # LSP operation timeout
|
|
1363
|
+
python -m crackerjack --enable-lsp-hooks # Enable LSP-optimized hooks
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
**Documentation Generation:**
|
|
1367
|
+
|
|
1368
|
+
```bash
|
|
1369
|
+
python -m crackerjack --generate-docs # Generate comprehensive API docs
|
|
1370
|
+
python -m crackerjack --docs-format markdown # Documentation format (markdown/rst/html)
|
|
1371
|
+
python -m crackerjack --validate-docs # Validate existing documentation
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
**Global Locking & Concurrency:**
|
|
1375
|
+
|
|
1376
|
+
```bash
|
|
1377
|
+
python -m crackerjack --disable-global-locking # Allow concurrent execution
|
|
1378
|
+
python -m crackerjack --global-lock-timeout 600 # Lock timeout in seconds
|
|
1379
|
+
python -m crackerjack --cleanup-stale-locks # Clean stale lock files (default)
|
|
1380
|
+
python -m crackerjack --no-cleanup-stale-locks # Don't clean stale locks
|
|
1381
|
+
python -m crackerjack --global-lock-dir ~/.crackerjack/locks # Custom lock directory
|
|
1382
|
+
```
|
|
1383
|
+
|
|
1384
|
+
**Git & Version Control:**
|
|
1385
|
+
|
|
1386
|
+
```bash
|
|
1387
|
+
python -m crackerjack --no-git-tags # Skip creating git tags
|
|
1388
|
+
python -m crackerjack --skip-version-check # Skip version consistency verification
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
**Experimental Features:**
|
|
1392
|
+
|
|
1393
|
+
```bash
|
|
1394
|
+
python -m crackerjack --experimental-hooks # Enable experimental pre-commit hooks
|
|
1395
|
+
python -m crackerjack --enable-pyrefly # Enable pyrefly type checking (experimental)
|
|
1396
|
+
python -m crackerjack --enable-ty # Enable ty type verification (experimental)
|
|
1397
|
+
```
|
|
1398
|
+
|
|
1399
|
+
**Common Options:**
|
|
1400
|
+
|
|
1401
|
+
- `-i, --interactive`: Rich UI interface with better experience
|
|
1402
|
+
- `-v, --verbose`: Detailed output for debugging
|
|
1403
|
+
- `-c, --commit`: Auto-commit and push changes to Git
|
|
1404
|
+
- `--skip-hooks`: Skip quality checks during development iteration
|
|
1405
|
+
- `--strip-code`: Remove docstrings/comments for production
|
|
1406
|
+
- `--dev`: Enable development mode for progress monitors
|
|
1407
|
+
- `--fast`: Run only fast hooks (formatting and basic checks)
|
|
1408
|
+
- `--comp`: Run only comprehensive hooks (type checking, security, complexity)
|
|
1409
|
+
- `--quick`: Quick mode (3 iterations max, ideal for CI/CD)
|
|
1410
|
+
- `--thorough`: Thorough mode (8 iterations max, for complex refactoring)
|
|
1411
|
+
- `--debug`: Enable debug output with detailed information
|
|
1412
|
+
- `--no-config-update`: Do not update configuration files
|
|
1413
|
+
- `--update-precommit`: Update pre-commit hooks configuration
|
|
1414
|
+
|
|
1415
|
+
## Style Guide
|
|
1416
|
+
|
|
1417
|
+
**Code Standards:**
|
|
1418
|
+
|
|
1419
|
+
- Python 3.13+ with modern type hints (`|` unions, PEP 695)
|
|
1420
|
+
- No docstrings (self-documenting code)
|
|
1421
|
+
- Pathlib over os.path
|
|
1422
|
+
- Protocol-based interfaces
|
|
1423
|
+
- Cognitive complexity ≤15 per function
|
|
1424
|
+
- UV for dependency management
|
|
1425
|
+
|
|
1426
|
+
## Publishing & Version Management
|
|
1427
|
+
|
|
1428
|
+
### 🔐 Secure PyPI Authentication
|
|
1429
|
+
|
|
1430
|
+
**Keyring Storage (Most Secure):**
|
|
1431
|
+
|
|
1432
|
+
```bash
|
|
1433
|
+
# Install keyring support
|
|
1434
|
+
uv add keyring
|
|
1435
|
+
|
|
1436
|
+
# Store token securely
|
|
1437
|
+
keyring set https://upload.pypi.org/legacy/ __token__
|
|
1438
|
+
# Enter your PyPI token when prompted
|
|
1439
|
+
```
|
|
1440
|
+
|
|
1441
|
+
**Environment Variable (Alternative):**
|
|
1442
|
+
|
|
1443
|
+
```bash
|
|
1444
|
+
# For CI/CD or temporary use
|
|
1445
|
+
export UV_PUBLISH_TOKEN=pypi-your-token-here
|
|
1446
|
+
|
|
1447
|
+
# ⚠️ Security Warning: Never commit this to git
|
|
1448
|
+
```
|
|
1449
|
+
|
|
1450
|
+
**Environment File (Local Development):**
|
|
1451
|
+
|
|
1452
|
+
```bash
|
|
1453
|
+
# Create .env file (must be in .gitignore)
|
|
1454
|
+
echo "UV_PUBLISH_TOKEN=pypi-your-token-here" > .env
|
|
1455
|
+
echo ".env" >> .gitignore
|
|
1456
|
+
```
|
|
1457
|
+
|
|
1458
|
+
### Version Management
|
|
1459
|
+
|
|
1460
|
+
```bash
|
|
1461
|
+
python -m crackerjack --publish patch # 1.0.0 -> 1.0.1
|
|
1462
|
+
python -m crackerjack --publish minor # 1.0.0 -> 1.1.0
|
|
1463
|
+
python -m crackerjack --publish major # 1.0.0 -> 2.0.0
|
|
1464
|
+
```
|
|
1465
|
+
|
|
1466
|
+
### 🛡️ Security Considerations
|
|
1467
|
+
|
|
1468
|
+
- **Token Rotation**: Rotate PyPI tokens every 90 days
|
|
1469
|
+
- **Scope Limitation**: Use project-scoped tokens when possible
|
|
1470
|
+
- **Access Review**: Regularly audit who has publish access
|
|
1471
|
+
- **Backup Tokens**: Keep backup tokens in secure location
|
|
1472
|
+
|
|
1473
|
+
## MCP Integration
|
|
1474
|
+
|
|
1475
|
+
**AI Agent Support:**
|
|
1476
|
+
Crackerjack provides a WebSocket-enabled MCP server for AI agent integration:
|
|
1477
|
+
|
|
1478
|
+
```bash
|
|
1479
|
+
# Start WebSocket MCP server on localhost:8675
|
|
1480
|
+
python -m crackerjack --start-mcp-server
|
|
1481
|
+
|
|
1482
|
+
# Monitor job progress via WebSocket
|
|
1483
|
+
python -m crackerjack.mcp.progress_monitor <job_id> ws://localhost:8675
|
|
1484
|
+
```
|
|
1485
|
+
|
|
1486
|
+
**MCP client configuration (stdio-based):**
|
|
1487
|
+
|
|
1488
|
+
```json
|
|
1489
|
+
{
|
|
1490
|
+
"mcpServers": {
|
|
1491
|
+
"crackerjack": {
|
|
1492
|
+
"command": "uvx",
|
|
1493
|
+
"args": [
|
|
1494
|
+
"--from",
|
|
1495
|
+
"/path/to/crackerjack",
|
|
1496
|
+
"crackerjack",
|
|
1497
|
+
"--start-mcp-server"
|
|
1498
|
+
]
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
```
|
|
1503
|
+
|
|
1504
|
+
**WebSocket MCP client configuration:**
|
|
1505
|
+
|
|
1506
|
+
- **Server URL**: `ws://localhost:8675`
|
|
1507
|
+
- **Protocol**: WebSocket-based MCP with real-time progress streaming
|
|
1508
|
+
- **Endpoints**: `/ws/progress/{job_id}` for live job monitoring
|
|
1509
|
+
|
|
1510
|
+
**Available tools:** `execute_crackerjack`, `get_job_progress`, `run_crackerjack_stage`, `analyze_errors`, `smart_error_analysis`, `get_next_action`, `session_management`
|
|
1511
|
+
|
|
1512
|
+
## 🤝 Complementary Tools
|
|
1513
|
+
|
|
1514
|
+
### Session Management MCP Server
|
|
1515
|
+
|
|
1516
|
+
For enhanced AI-assisted development with conversation memory and context persistence, consider using the [session-mgmt-mcp](https://github.com/lesleslie/session-mgmt-mcp) server alongside Crackerjack:
|
|
1517
|
+
|
|
1518
|
+
## 🤝 Session-mgmt Integration (Enhanced)
|
|
1519
|
+
|
|
1520
|
+
**Automatic for Git Projects:**
|
|
1521
|
+
|
|
1522
|
+
- Session management starts automatically
|
|
1523
|
+
- No manual `/start` or `/end` needed
|
|
1524
|
+
- Checkpoints auto-compact when necessary
|
|
1525
|
+
- Works seamlessly with `python -m crackerjack`
|
|
1526
|
+
|
|
1527
|
+
**Benefits of Combined Usage:**
|
|
1528
|
+
|
|
1529
|
+
- **🧠 Persistent Learning**: Session-mgmt remembers your error patterns and successful fixes
|
|
1530
|
+
- **📝 Context Preservation**: Maintains conversation context across Claude sessions
|
|
1531
|
+
- **📊 Quality Tracking**: Monitors your project's quality score evolution over time
|
|
1532
|
+
- **🔄 Workflow Optimization**: Learns from your development patterns to suggest improvements
|
|
1533
|
+
- **🎯 Intelligent Coordination**: The two servers share insights for smarter assistance
|
|
1534
|
+
- **🚀 Zero Manual Intervention**: Fully automatic lifecycle for git repositories
|
|
1535
|
+
|
|
1536
|
+
**Quick Setup:**
|
|
1537
|
+
|
|
1538
|
+
```json
|
|
1539
|
+
{
|
|
1540
|
+
"mcpServers": {
|
|
1541
|
+
"crackerjack": {
|
|
1542
|
+
"command": "python",
|
|
1543
|
+
"args": ["-m", "crackerjack", "--start-mcp-server"]
|
|
1544
|
+
},
|
|
1545
|
+
"session-mgmt": {
|
|
1546
|
+
"command": "python",
|
|
1547
|
+
"args": ["-m", "session_mgmt_mcp.server"]
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
```
|
|
1552
|
+
|
|
1553
|
+
**Example Workflow:**
|
|
1554
|
+
|
|
1555
|
+
```bash
|
|
1556
|
+
# Just start working - session auto-initializes!
|
|
1557
|
+
python -m crackerjack --ai-fix --run-tests
|
|
1558
|
+
|
|
1559
|
+
# Checkpoint periodically (auto-compacts if needed)
|
|
1560
|
+
/checkpoint
|
|
1561
|
+
|
|
1562
|
+
# Quit any way - session auto-saves
|
|
1563
|
+
/quit # or Cmd+Q, or network disconnect
|
|
1564
|
+
```
|
|
1565
|
+
|
|
1566
|
+
**How They Work Together:**
|
|
1567
|
+
|
|
1568
|
+
- **Crackerjack** handles code quality enforcement, testing, and release management
|
|
1569
|
+
- **Session-mgmt** maintains AI conversation context and learns from your patterns
|
|
1570
|
+
- **Combined**: Creates an intelligent development environment that remembers what works and gets smarter over time
|
|
1571
|
+
|
|
1572
|
+
The integration is automatic - session-mgmt includes a comprehensive `crackerjack_integration.py` module that captures quality metrics, test results, and error patterns for enhanced learning across sessions.
|
|
1573
|
+
|
|
1574
|
+
## 🔧 Troubleshooting
|
|
1575
|
+
|
|
1576
|
+
### Common Issues
|
|
1577
|
+
|
|
1578
|
+
#### Installation Problems
|
|
1579
|
+
|
|
1580
|
+
```bash
|
|
1581
|
+
# UV not found
|
|
1582
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
1583
|
+
source ~/.bashrc
|
|
1584
|
+
|
|
1585
|
+
# Python 3.13+ required
|
|
1586
|
+
uv python install 3.13
|
|
1587
|
+
uv python pin 3.13
|
|
1588
|
+
```
|
|
1589
|
+
|
|
1590
|
+
#### Authentication Errors
|
|
1591
|
+
|
|
1592
|
+
```bash
|
|
1593
|
+
# PyPI token issues
|
|
1594
|
+
keyring get https://upload.pypi.org/legacy/ __token__ # Verify stored token
|
|
1595
|
+
keyring set https://upload.pypi.org/legacy/ __token__ # Reset if needed
|
|
1596
|
+
|
|
1597
|
+
# Permission denied
|
|
1598
|
+
chmod +x ~/.local/bin/uv
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
#### Hook Failures
|
|
1602
|
+
|
|
1603
|
+
```bash
|
|
1604
|
+
# Pre-commit hooks failing
|
|
1605
|
+
python -m crackerjack --skip-hooks # Skip hooks temporarily
|
|
1606
|
+
pre-commit clean # Clear hook cache
|
|
1607
|
+
pre-commit install --force # Reinstall hooks
|
|
1608
|
+
|
|
1609
|
+
# Update hooks
|
|
1610
|
+
python -m crackerjack --update-precommit
|
|
1611
|
+
|
|
1612
|
+
# Type checking errors
|
|
1613
|
+
python -m crackerjack # Run quality checks
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
#### MCP Server Issues
|
|
1617
|
+
|
|
1618
|
+
```bash
|
|
1619
|
+
# Server won't start
|
|
1620
|
+
python -m crackerjack --start-mcp-server --verbose
|
|
1621
|
+
|
|
1622
|
+
# WebSocket connection issues
|
|
1623
|
+
# Check if server is running on localhost:8675
|
|
1624
|
+
netstat -an | grep :8675
|
|
1625
|
+
|
|
1626
|
+
# Test WebSocket connectivity
|
|
1627
|
+
curl -s "http://localhost:8675/" || echo "Server not responding"
|
|
1628
|
+
```
|
|
1629
|
+
|
|
1630
|
+
#### Performance Issues
|
|
1631
|
+
|
|
1632
|
+
```bash
|
|
1633
|
+
# Slow execution
|
|
1634
|
+
python -m crackerjack --test-workers 1 # Reduce parallelism
|
|
1635
|
+
python -m crackerjack --skip-hooks # Skip time-consuming checks
|
|
1636
|
+
|
|
1637
|
+
# Memory issues
|
|
1638
|
+
export UV_CACHE_DIR=/tmp/uv-cache # Use different cache location
|
|
1639
|
+
```
|
|
1640
|
+
|
|
1641
|
+
### Debug Mode
|
|
1642
|
+
|
|
1643
|
+
```bash
|
|
1644
|
+
# Enable verbose output
|
|
1645
|
+
python -m crackerjack --verbose
|
|
1646
|
+
|
|
1647
|
+
# Check debug logs (in XDG cache directory)
|
|
1648
|
+
ls ~/.cache/crackerjack/logs/debug/
|
|
1649
|
+
|
|
1650
|
+
# MCP debugging
|
|
1651
|
+
python -m crackerjack --start-mcp-server --verbose
|
|
1652
|
+
```
|
|
1653
|
+
|
|
1654
|
+
### Getting Help
|
|
1655
|
+
|
|
1656
|
+
- **GitHub Issues**: [Report bugs](https://github.com/lesleslie/crackerjack/issues)
|
|
1657
|
+
- **Command Help**: `python -m crackerjack --help`
|
|
1658
|
+
- **MCP Tools**: Use `get_next_action` tool for guidance
|
|
1659
|
+
|
|
1660
|
+
## Contributing
|
|
1661
|
+
|
|
1662
|
+
1. Fork and clone the repository
|
|
1663
|
+
1. Run `uv sync --group dev` to install dependencies
|
|
1664
|
+
1. Ensure `python -m crackerjack` passes all checks
|
|
1665
|
+
1. Submit pull request
|
|
1666
|
+
|
|
1667
|
+
**Requirements:** Python 3.13+, UV package manager, all quality checks must pass
|
|
1668
|
+
|
|
1669
|
+
## License
|
|
1670
|
+
|
|
1671
|
+
BSD 3-Clause License - see [LICENSE](LICENSE) file.
|
|
1672
|
+
|
|
1673
|
+
______________________________________________________________________
|
|
1674
|
+
|
|
1675
|
+
**Issues:** [GitHub Issues](https://github.com/lesleslie/crackerjack/issues)
|
|
1676
|
+
**Repository:** [GitHub](https://github.com/lesleslie/crackerjack)
|
|
1677
|
+
|
|
1678
|
+
# Test
|