roadmap-cli 0.1.1__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.
- roadmap/__init__.py +27 -0
- roadmap/adapters/__init__.py +1 -0
- roadmap/adapters/base_paginated_adapter.py +117 -0
- roadmap/adapters/cli/__init__.py +249 -0
- roadmap/adapters/cli/analysis/__init__.py +5 -0
- roadmap/adapters/cli/analysis/commands.py +370 -0
- roadmap/adapters/cli/analysis/presenter.py +125 -0
- roadmap/adapters/cli/archive_operations.py +86 -0
- roadmap/adapters/cli/cli_command_helpers.py +109 -0
- roadmap/adapters/cli/cli_confirmations.py +74 -0
- roadmap/adapters/cli/cli_error_handlers.py +146 -0
- roadmap/adapters/cli/cli_validators.py +39 -0
- roadmap/adapters/cli/commands/sync_status.py +308 -0
- roadmap/adapters/cli/comment/__init__.py +5 -0
- roadmap/adapters/cli/comment/commands.py +106 -0
- roadmap/adapters/cli/config/__init__.py +5 -0
- roadmap/adapters/cli/config/commands.py +198 -0
- roadmap/adapters/cli/console_exports.py +10 -0
- roadmap/adapters/cli/core.py +26 -0
- roadmap/adapters/cli/crud/__init__.py +47 -0
- roadmap/adapters/cli/crud/base_archive.py +208 -0
- roadmap/adapters/cli/crud/base_create.py +154 -0
- roadmap/adapters/cli/crud/base_delete.py +155 -0
- roadmap/adapters/cli/crud/base_restore.py +283 -0
- roadmap/adapters/cli/crud/base_update.py +193 -0
- roadmap/adapters/cli/crud/crud_helpers.py +206 -0
- roadmap/adapters/cli/crud/crud_utils.py +152 -0
- roadmap/adapters/cli/crud/entity_builders.py +374 -0
- roadmap/adapters/cli/data/__init__.py +8 -0
- roadmap/adapters/cli/data/commands.py +149 -0
- roadmap/adapters/cli/decorators.py +208 -0
- roadmap/adapters/cli/dtos/__init__.py +155 -0
- roadmap/adapters/cli/exception_handler.py +105 -0
- roadmap/adapters/cli/git/__init__.py +8 -0
- roadmap/adapters/cli/git/commands.py +475 -0
- roadmap/adapters/cli/git/handlers/__init__.py +1 -0
- roadmap/adapters/cli/git/handlers/git_authentication_handler.py +124 -0
- roadmap/adapters/cli/git/handlers/git_branch_handler.py +238 -0
- roadmap/adapters/cli/git/handlers/git_connectivity_handler.py +122 -0
- roadmap/adapters/cli/git/handlers/git_hooks_handler.py +105 -0
- roadmap/adapters/cli/git/hooks_config.py +327 -0
- roadmap/adapters/cli/git/status_display.py +158 -0
- roadmap/adapters/cli/health/__init__.py +8 -0
- roadmap/adapters/cli/health/db_integrity.py +204 -0
- roadmap/adapters/cli/health/enhancer.py +227 -0
- roadmap/adapters/cli/health/fixer.py +295 -0
- roadmap/adapters/cli/health/fixers/__init__.py +10 -0
- roadmap/adapters/cli/health/fixers/corrupted_comments_fixer.py +231 -0
- roadmap/adapters/cli/health/fixers/data_integrity_fixer.py +137 -0
- roadmap/adapters/cli/health/fixers/duplicate_issues_fixer.py +138 -0
- roadmap/adapters/cli/health/fixers/folder_structure_fixer.py +114 -0
- roadmap/adapters/cli/health/fixers/label_normalization_fixer.py +162 -0
- roadmap/adapters/cli/health/fixers/milestone_name_normalization_fixer.py +181 -0
- roadmap/adapters/cli/health/fixers/milestone_naming_compliance_fixer.py +244 -0
- roadmap/adapters/cli/health/fixers/milestone_parse_error_fixer.py +162 -0
- roadmap/adapters/cli/health/fixers/milestone_validation_fixer.py +211 -0
- roadmap/adapters/cli/health/fixers/old_backups_fixer.py +135 -0
- roadmap/adapters/cli/health/fixers/orphaned_issues_fixer.py +252 -0
- roadmap/adapters/cli/health/formatter.py +250 -0
- roadmap/adapters/cli/health/formatters.py +427 -0
- roadmap/adapters/cli/health/scan.py +293 -0
- roadmap/adapters/cli/init/__init__.py +5 -0
- roadmap/adapters/cli/init/commands.py +587 -0
- roadmap/adapters/cli/init.py +9 -0
- roadmap/adapters/cli/issues/__init__.py +70 -0
- roadmap/adapters/cli/issues/archive.py +137 -0
- roadmap/adapters/cli/issues/archive_class.py +253 -0
- roadmap/adapters/cli/issues/block.py +39 -0
- roadmap/adapters/cli/issues/close.py +216 -0
- roadmap/adapters/cli/issues/comment.py +178 -0
- roadmap/adapters/cli/issues/create.py +162 -0
- roadmap/adapters/cli/issues/delete.py +31 -0
- roadmap/adapters/cli/issues/deps.py +161 -0
- roadmap/adapters/cli/issues/issue_status_helpers.py +111 -0
- roadmap/adapters/cli/issues/link.py +308 -0
- roadmap/adapters/cli/issues/list.py +402 -0
- roadmap/adapters/cli/issues/lookup.py +96 -0
- roadmap/adapters/cli/issues/progress.py +102 -0
- roadmap/adapters/cli/issues/restore.py +96 -0
- roadmap/adapters/cli/issues/restore_class.py +57 -0
- roadmap/adapters/cli/issues/start.py +165 -0
- roadmap/adapters/cli/issues/sync_status.py +374 -0
- roadmap/adapters/cli/issues/unblock.py +43 -0
- roadmap/adapters/cli/issues/unlink.py +104 -0
- roadmap/adapters/cli/issues/update.py +120 -0
- roadmap/adapters/cli/issues/view.py +36 -0
- roadmap/adapters/cli/layout.py +220 -0
- roadmap/adapters/cli/mappers.py +200 -0
- roadmap/adapters/cli/milestones/__init__.py +52 -0
- roadmap/adapters/cli/milestones/archive.py +125 -0
- roadmap/adapters/cli/milestones/archive_class.py +236 -0
- roadmap/adapters/cli/milestones/assign.py +62 -0
- roadmap/adapters/cli/milestones/close.py +177 -0
- roadmap/adapters/cli/milestones/create.py +131 -0
- roadmap/adapters/cli/milestones/delete.py +27 -0
- roadmap/adapters/cli/milestones/kanban.py +123 -0
- roadmap/adapters/cli/milestones/list.py +87 -0
- roadmap/adapters/cli/milestones/recalculate.py +79 -0
- roadmap/adapters/cli/milestones/restore.py +87 -0
- roadmap/adapters/cli/milestones/restore_class.py +99 -0
- roadmap/adapters/cli/milestones/update.py +61 -0
- roadmap/adapters/cli/milestones/view.py +142 -0
- roadmap/adapters/cli/output_manager.py +319 -0
- roadmap/adapters/cli/presentation/base_presenter.py +121 -0
- roadmap/adapters/cli/presentation/cleanup_presenter.py +235 -0
- roadmap/adapters/cli/presentation/core_initialization_presenter.py +277 -0
- roadmap/adapters/cli/presentation/crud_presenter.py +134 -0
- roadmap/adapters/cli/presentation/daily_summary_presenter.py +266 -0
- roadmap/adapters/cli/presentation/issue_presenter.py +258 -0
- roadmap/adapters/cli/presentation/milestone_list_presenter.py +135 -0
- roadmap/adapters/cli/presentation/milestone_presenter.py +297 -0
- roadmap/adapters/cli/presentation/project_presenter.py +233 -0
- roadmap/adapters/cli/presentation/project_status_presenter.py +186 -0
- roadmap/adapters/cli/presentation/table_builders.py +95 -0
- roadmap/adapters/cli/projects/__init__.py +42 -0
- roadmap/adapters/cli/projects/archive.py +127 -0
- roadmap/adapters/cli/projects/archive_class.py +96 -0
- roadmap/adapters/cli/projects/close.py +94 -0
- roadmap/adapters/cli/projects/create.py +50 -0
- roadmap/adapters/cli/projects/delete.py +27 -0
- roadmap/adapters/cli/projects/list.py +227 -0
- roadmap/adapters/cli/projects/restore.py +87 -0
- roadmap/adapters/cli/projects/restore_class.py +56 -0
- roadmap/adapters/cli/projects/update.py +57 -0
- roadmap/adapters/cli/projects/view.py +157 -0
- roadmap/adapters/cli/services/__init__.py +1 -0
- roadmap/adapters/cli/services/daily_summary_service.py +313 -0
- roadmap/adapters/cli/services/export_manager.py +268 -0
- roadmap/adapters/cli/services/milestone_list_service.py +266 -0
- roadmap/adapters/cli/services/project_initialization_service.py +29 -0
- roadmap/adapters/cli/services/project_status_service.py +462 -0
- roadmap/adapters/cli/services/sync_service.py +62 -0
- roadmap/adapters/cli/status.py +408 -0
- roadmap/adapters/cli/styling.py +21 -0
- roadmap/adapters/cli/sync.py +1117 -0
- roadmap/adapters/cli/sync_context.py +432 -0
- roadmap/adapters/cli/sync_handlers/__init__.py +77 -0
- roadmap/adapters/cli/sync_handlers/apply_ops.py +522 -0
- roadmap/adapters/cli/sync_handlers/baseline_ops.py +366 -0
- roadmap/adapters/cli/sync_handlers/conflict_ops.py +161 -0
- roadmap/adapters/cli/sync_handlers/dry_run_display.py +237 -0
- roadmap/adapters/cli/sync_handlers/interactive_resolver.py +396 -0
- roadmap/adapters/cli/sync_handlers/progress_tracker.py +128 -0
- roadmap/adapters/cli/sync_metrics_command.py +190 -0
- roadmap/adapters/cli/sync_presenter.py +58 -0
- roadmap/adapters/cli/sync_validation.py +295 -0
- roadmap/adapters/cli/today.py +52 -0
- roadmap/adapters/cli/utils/click_options.py +38 -0
- roadmap/adapters/git/__init__.py +1 -0
- roadmap/adapters/git/git.py +208 -0
- roadmap/adapters/git/git_branch_manager.py +400 -0
- roadmap/adapters/git/git_command_executor.py +56 -0
- roadmap/adapters/git/git_commit_analyzer.py +334 -0
- roadmap/adapters/git/git_hooks.py +22 -0
- roadmap/adapters/git/git_hooks_manager.py +455 -0
- roadmap/adapters/git/git_repository_info.py +65 -0
- roadmap/adapters/git/hook_installer.py +106 -0
- roadmap/adapters/git/hook_registry.py +97 -0
- roadmap/adapters/git/hook_script_generator.py +58 -0
- roadmap/adapters/git/sync_monitor.py +409 -0
- roadmap/adapters/git/workflow_automation.py +286 -0
- roadmap/adapters/github/__init__.py +1 -0
- roadmap/adapters/github/github.py +360 -0
- roadmap/adapters/github/handlers/__init__.py +17 -0
- roadmap/adapters/github/handlers/base.py +337 -0
- roadmap/adapters/github/handlers/collaborators.py +165 -0
- roadmap/adapters/github/handlers/comments.py +118 -0
- roadmap/adapters/github/handlers/issues.py +150 -0
- roadmap/adapters/github/handlers/labels.py +164 -0
- roadmap/adapters/github/handlers/milestones.py +104 -0
- roadmap/adapters/persistence/__init__.py +35 -0
- roadmap/adapters/persistence/conflict_resolver.py +190 -0
- roadmap/adapters/persistence/database_manager.py +492 -0
- roadmap/adapters/persistence/entity_sync_coordinators.py +672 -0
- roadmap/adapters/persistence/file_locking.py +348 -0
- roadmap/adapters/persistence/file_parser.py +92 -0
- roadmap/adapters/persistence/file_synchronizer.py +107 -0
- roadmap/adapters/persistence/focused_managers.py +140 -0
- roadmap/adapters/persistence/git_history.py +330 -0
- roadmap/adapters/persistence/parser/__init__.py +20 -0
- roadmap/adapters/persistence/parser/frontmatter.py +152 -0
- roadmap/adapters/persistence/parser/issue.py +245 -0
- roadmap/adapters/persistence/parser/milestone.py +146 -0
- roadmap/adapters/persistence/parser/project.py +106 -0
- roadmap/adapters/persistence/persistence.py +288 -0
- roadmap/adapters/persistence/repositories/__init__.py +15 -0
- roadmap/adapters/persistence/repositories/issue_repository.py +223 -0
- roadmap/adapters/persistence/repositories/milestone_repository.py +140 -0
- roadmap/adapters/persistence/repositories/project_repository.py +168 -0
- roadmap/adapters/persistence/repositories/remote_link_repository.py +355 -0
- roadmap/adapters/persistence/repositories/sync_state_repository.py +66 -0
- roadmap/adapters/persistence/storage/__init__.py +36 -0
- roadmap/adapters/persistence/storage/conflicts.py +101 -0
- roadmap/adapters/persistence/storage/connection_manager.py +79 -0
- roadmap/adapters/persistence/storage/issue_storage.py +89 -0
- roadmap/adapters/persistence/storage/milestone_storage.py +80 -0
- roadmap/adapters/persistence/storage/project_storage.py +102 -0
- roadmap/adapters/persistence/storage/queries.py +227 -0
- roadmap/adapters/persistence/storage/state_manager.py +652 -0
- roadmap/adapters/persistence/storage/sync_state_storage.py +207 -0
- roadmap/adapters/persistence/sync_metrics_repository.py +342 -0
- roadmap/adapters/persistence/sync_orchestrator.py +293 -0
- roadmap/adapters/persistence/sync_state_tracker.py +86 -0
- roadmap/adapters/persistence/yaml_repositories.py +711 -0
- roadmap/adapters/sync/__init__.py +21 -0
- roadmap/adapters/sync/backend_factory.py +108 -0
- roadmap/adapters/sync/backends/__init__.py +15 -0
- roadmap/adapters/sync/backends/converters.py +209 -0
- roadmap/adapters/sync/backends/github_backend_helpers.py +380 -0
- roadmap/adapters/sync/backends/github_client.py +99 -0
- roadmap/adapters/sync/backends/github_sync_backend.py +792 -0
- roadmap/adapters/sync/backends/github_sync_ops.py +908 -0
- roadmap/adapters/sync/backends/services/__init__.py +1 -0
- roadmap/adapters/sync/backends/services/github_authentication_service.py +105 -0
- roadmap/adapters/sync/backends/services/github_issue_delete_service.py +423 -0
- roadmap/adapters/sync/backends/services/github_issue_dependency_service.py +63 -0
- roadmap/adapters/sync/backends/services/github_issue_fetch_service.py +158 -0
- roadmap/adapters/sync/backends/services/github_label_sync_service.py +126 -0
- roadmap/adapters/sync/backends/services/github_local_issue_sync_service.py +229 -0
- roadmap/adapters/sync/backends/services/github_milestone_fetch_service.py +204 -0
- roadmap/adapters/sync/backends/vanilla_git_sync_backend.py +198 -0
- roadmap/adapters/sync/services/__init__.py +11 -0
- roadmap/adapters/sync/services/baseline_state_handler.py +83 -0
- roadmap/adapters/sync/services/conflict_converter.py +85 -0
- roadmap/adapters/sync/services/issue_persistence_service.py +263 -0
- roadmap/adapters/sync/services/issue_state_service.py +243 -0
- roadmap/adapters/sync/services/local_change_filter.py +129 -0
- roadmap/adapters/sync/services/pull_result_processor.py +71 -0
- roadmap/adapters/sync/services/remote_issue_creation_service.py +112 -0
- roadmap/adapters/sync/services/sync_analysis_service.py +250 -0
- roadmap/adapters/sync/services/sync_authentication_service.py +57 -0
- roadmap/adapters/sync/services/sync_data_fetch_service.py +212 -0
- roadmap/adapters/sync/services/sync_linking_service.py +329 -0
- roadmap/adapters/sync/services/sync_report_service.py +62 -0
- roadmap/adapters/sync/services/sync_state_update_service.py +51 -0
- roadmap/adapters/sync/sync_cache_orchestrator.py +454 -0
- roadmap/adapters/sync/sync_merge_engine.py +416 -0
- roadmap/adapters/sync/sync_merge_orchestrator.py +1313 -0
- roadmap/adapters/sync/sync_retrieval_orchestrator.py +810 -0
- roadmap/application/services/__init__.py +1 -0
- roadmap/application/services/deduplicate_service.py +517 -0
- roadmap/application/use_cases/__init__.py +1 -0
- roadmap/common/__init__.py +308 -0
- roadmap/common/cache.py +209 -0
- roadmap/common/cli_errors.py +147 -0
- roadmap/common/configuration/__init__.py +33 -0
- roadmap/common/configuration/config_loader.py +264 -0
- roadmap/common/configuration/config_manager.py +164 -0
- roadmap/common/configuration/config_schema.py +145 -0
- roadmap/common/configuration/github/__init__.py +9 -0
- roadmap/common/configuration/github/config_manager.py +154 -0
- roadmap/common/configuration/github/token_resolver.py +84 -0
- roadmap/common/console.py +184 -0
- roadmap/common/constants.py +134 -0
- roadmap/common/datetime_parser.py +319 -0
- roadmap/common/error_formatter.py +84 -0
- roadmap/common/errors/__init__.py +143 -0
- roadmap/common/errors/error_base.py +73 -0
- roadmap/common/errors/error_file.py +82 -0
- roadmap/common/errors/error_git.py +67 -0
- roadmap/common/errors/error_handler.py +166 -0
- roadmap/common/errors/error_network.py +90 -0
- roadmap/common/errors/error_security.py +78 -0
- roadmap/common/errors/error_standards.py +561 -0
- roadmap/common/errors/error_validation.py +111 -0
- roadmap/common/errors/exceptions.py +432 -0
- roadmap/common/formatters/__init__.py +29 -0
- roadmap/common/formatters/base_table_formatter.py +96 -0
- roadmap/common/formatters/export/__init__.py +7 -0
- roadmap/common/formatters/export/issue_exporter.py +97 -0
- roadmap/common/formatters/helpers.py +28 -0
- roadmap/common/formatters/kanban/__init__.py +9 -0
- roadmap/common/formatters/kanban/layout.py +48 -0
- roadmap/common/formatters/kanban/organizer.py +81 -0
- roadmap/common/formatters/output/__init__.py +15 -0
- roadmap/common/formatters/tables/__init__.py +11 -0
- roadmap/common/formatters/tables/column_factory.py +312 -0
- roadmap/common/formatters/tables/issue_table.py +276 -0
- roadmap/common/formatters/tables/milestone_table.py +247 -0
- roadmap/common/formatters/tables/project_table.py +195 -0
- roadmap/common/formatters/text/__init__.py +57 -0
- roadmap/common/formatters/text/basic.py +217 -0
- roadmap/common/formatters/text/display.py +42 -0
- roadmap/common/formatters/text/duration.py +36 -0
- roadmap/common/formatters/text/operations.py +325 -0
- roadmap/common/formatters/text/status_badges.py +57 -0
- roadmap/common/initialization/github/__init__.py +11 -0
- roadmap/common/initialization/github/setup_service.py +238 -0
- roadmap/common/initialization/github/setup_validator.py +78 -0
- roadmap/common/logging/__init__.py +113 -0
- roadmap/common/logging/audit_logging.py +5 -0
- roadmap/common/logging/correlation.py +45 -0
- roadmap/common/logging/decorators.py +267 -0
- roadmap/common/logging/error_logging.py +217 -0
- roadmap/common/logging/formatters.py +124 -0
- roadmap/common/logging/loggers.py +68 -0
- roadmap/common/logging/performance_tracking.py +267 -0
- roadmap/common/logging/utils.py +335 -0
- roadmap/common/models/__init__.py +44 -0
- roadmap/common/models/cli_models.py +118 -0
- roadmap/common/models/config_models.py +199 -0
- roadmap/common/models/output_models.py +381 -0
- roadmap/common/observability/__init__.py +28 -0
- roadmap/common/observability/instrumentation.py +103 -0
- roadmap/common/observability/observability.py +76 -0
- roadmap/common/observability/otel_init.py +109 -0
- roadmap/common/output_formatter.py +393 -0
- roadmap/common/progress.py +379 -0
- roadmap/common/result.py +396 -0
- roadmap/common/security/__init__.py +48 -0
- roadmap/common/security/exceptions.py +13 -0
- roadmap/common/security/export_cleanup.py +79 -0
- roadmap/common/security/file_operations.py +104 -0
- roadmap/common/security/filename_sanitization.py +54 -0
- roadmap/common/security/logging.py +27 -0
- roadmap/common/security/path_validation.py +137 -0
- roadmap/common/security/temp_files.py +41 -0
- roadmap/common/services/__init__.py +65 -0
- roadmap/common/services/decorators.py +183 -0
- roadmap/common/services/logging_utils.py +208 -0
- roadmap/common/services/metrics.py +161 -0
- roadmap/common/services/performance.py +219 -0
- roadmap/common/services/profiling.py +288 -0
- roadmap/common/services/retry.py +288 -0
- roadmap/common/status_style_manager.py +114 -0
- roadmap/common/union_find.py +88 -0
- roadmap/common/update_constants.py +13 -0
- roadmap/common/utils/__init__.py +65 -0
- roadmap/common/utils/cli_helpers.py +381 -0
- roadmap/common/utils/file_utils.py +440 -0
- roadmap/common/utils/path_utils.py +38 -0
- roadmap/common/utils/status_utils.py +130 -0
- roadmap/common/utils/timezone_utils.py +480 -0
- roadmap/common/validation/__init__.py +37 -0
- roadmap/common/validation/field_validator.py +104 -0
- roadmap/common/validation/result.py +37 -0
- roadmap/common/validation/roadmap_validator.py +310 -0
- roadmap/common/validation/schema_validator.py +36 -0
- roadmap/common/validation/validators.py +50 -0
- roadmap/core/__init__.py +1 -0
- roadmap/core/domain/__init__.py +30 -0
- roadmap/core/domain/comment.py +24 -0
- roadmap/core/domain/health.py +15 -0
- roadmap/core/domain/issue.py +274 -0
- roadmap/core/domain/milestone.py +173 -0
- roadmap/core/domain/ports/__init__.py +1 -0
- roadmap/core/domain/ports/baseline_repository.py +24 -0
- roadmap/core/domain/ports/issue_repository.py +34 -0
- roadmap/core/domain/ports/remote_backend_port.py +31 -0
- roadmap/core/domain/project.py +130 -0
- roadmap/core/interfaces/__init__.py +109 -0
- roadmap/core/interfaces/assignee_validator.py +40 -0
- roadmap/core/interfaces/backend_factory.py +175 -0
- roadmap/core/interfaces/github.py +102 -0
- roadmap/core/interfaces/parsers.py +140 -0
- roadmap/core/interfaces/persistence.py +45 -0
- roadmap/core/interfaces/repositories.py +174 -0
- roadmap/core/interfaces/state_managers.py +111 -0
- roadmap/core/interfaces/state_storage.py +64 -0
- roadmap/core/interfaces/sync_backend.py +275 -0
- roadmap/core/interfaces/sync_services.py +119 -0
- roadmap/core/interfaces/sync_validators.py +180 -0
- roadmap/core/models/__init__.py +31 -0
- roadmap/core/models/sync_models.py +162 -0
- roadmap/core/models.py +115 -0
- roadmap/core/observability/__init__.py +17 -0
- roadmap/core/observability/sync_metrics.py +699 -0
- roadmap/core/repositories.py +200 -0
- roadmap/core/services/__init__.py +313 -0
- roadmap/core/services/baseline/__init__.py +1 -0
- roadmap/core/services/baseline/baseline_builder_progress.py +274 -0
- roadmap/core/services/baseline/baseline_retriever.py +63 -0
- roadmap/core/services/baseline/baseline_selector.py +248 -0
- roadmap/core/services/baseline/baseline_state_retriever.py +284 -0
- roadmap/core/services/baseline/optimized_baseline_builder.py +425 -0
- roadmap/core/services/comment/__init__.py +1 -0
- roadmap/core/services/comment/comment_service.py +277 -0
- roadmap/core/services/git/__init__.py +1 -0
- roadmap/core/services/git/git_hook_auto_sync_service.py +403 -0
- roadmap/core/services/github/__init__.py +1 -0
- roadmap/core/services/github/github_change_detector.py +162 -0
- roadmap/core/services/github/github_config_validator.py +148 -0
- roadmap/core/services/github/github_conflict_detector.py +179 -0
- roadmap/core/services/github/github_entity_classifier.py +51 -0
- roadmap/core/services/github/github_integration_service.py +439 -0
- roadmap/core/services/github/github_issue_client.py +346 -0
- roadmap/core/services/health/__init__.py +1 -0
- roadmap/core/services/health/backup_cleanup_service.py +202 -0
- roadmap/core/services/health/data_integrity_validator_service.py +90 -0
- roadmap/core/services/health/entity_health_scanner.py +460 -0
- roadmap/core/services/health/file_repair_service.py +193 -0
- roadmap/core/services/health/health_check_service.py +166 -0
- roadmap/core/services/health/health_models.py +80 -0
- roadmap/core/services/health/infrastructure_validator_service.py +328 -0
- roadmap/core/services/health/issue_health_scanner.py +263 -0
- roadmap/core/services/helpers/__init__.py +18 -0
- roadmap/core/services/helpers/status_change_helpers.py +88 -0
- roadmap/core/services/initialization/__init__.py +19 -0
- roadmap/core/services/initialization/utils.py +104 -0
- roadmap/core/services/initialization/validator.py +78 -0
- roadmap/core/services/initialization/workflow.py +182 -0
- roadmap/core/services/initialization_service.py +111 -0
- roadmap/core/services/issue/__init__.py +1 -0
- roadmap/core/services/issue/assignee_validation_service.py +312 -0
- roadmap/core/services/issue/issue_creation_service.py +309 -0
- roadmap/core/services/issue/issue_filter_service.py +302 -0
- roadmap/core/services/issue/issue_matching_service.py +127 -0
- roadmap/core/services/issue/issue_service.py +765 -0
- roadmap/core/services/issue/issue_update_service.py +144 -0
- roadmap/core/services/issue/start_issue_service.py +174 -0
- roadmap/core/services/issue_helpers/__init__.py +18 -0
- roadmap/core/services/issue_helpers/issue_filters.py +296 -0
- roadmap/core/services/milestone_service.py +438 -0
- roadmap/core/services/project/__init__.py +1 -0
- roadmap/core/services/project/project_service.py +434 -0
- roadmap/core/services/project/project_status_service.py +125 -0
- roadmap/core/services/project_init/__init__.py +22 -0
- roadmap/core/services/project_init/context_detection.py +146 -0
- roadmap/core/services/project_init/creation.py +76 -0
- roadmap/core/services/project_init/detection.py +51 -0
- roadmap/core/services/project_init/template.py +228 -0
- roadmap/core/services/status_change_service.py +88 -0
- roadmap/core/services/sync/__init__.py +1 -0
- roadmap/core/services/sync/batch_processor.py +290 -0
- roadmap/core/services/sync/conflict_resolver.py +154 -0
- roadmap/core/services/sync/dependency_resolver.py +367 -0
- roadmap/core/services/sync/duplicate_detector.py +771 -0
- roadmap/core/services/sync/duplicate_resolver.py +315 -0
- roadmap/core/services/sync/error_classification.py +470 -0
- roadmap/core/services/sync/performance.py +263 -0
- roadmap/core/services/sync/sync_change_computer.py +211 -0
- roadmap/core/services/sync/sync_checkpoint.py +348 -0
- roadmap/core/services/sync/sync_conflict_detector.py +147 -0
- roadmap/core/services/sync/sync_conflict_resolver.py +448 -0
- roadmap/core/services/sync/sync_errors.py +383 -0
- roadmap/core/services/sync/sync_key_normalizer.py +222 -0
- roadmap/core/services/sync/sync_metadata_service.py +361 -0
- roadmap/core/services/sync/sync_plan.py +171 -0
- roadmap/core/services/sync/sync_plan_executor.py +447 -0
- roadmap/core/services/sync/sync_report.py +296 -0
- roadmap/core/services/sync/sync_state.py +173 -0
- roadmap/core/services/sync/sync_state_comparator.py +690 -0
- roadmap/core/services/sync/sync_state_manager.py +431 -0
- roadmap/core/services/sync/sync_state_normalizer.py +98 -0
- roadmap/core/services/sync/sync_three_way.py +78 -0
- roadmap/core/services/sync/three_way_merger.py +178 -0
- roadmap/core/services/utils/__init__.py +1 -0
- roadmap/core/services/utils/configuration_service.py +113 -0
- roadmap/core/services/utils/critical_path_calculator.py +418 -0
- roadmap/core/services/utils/dependency_analyzer.py +360 -0
- roadmap/core/services/utils/field_conflict_detector.py +126 -0
- roadmap/core/services/utils/remote_fetcher.py +202 -0
- roadmap/core/services/utils/remote_state_normalizer.py +110 -0
- roadmap/core/services/utils/retry_policy.py +51 -0
- roadmap/core/services/validator_base.py +130 -0
- roadmap/core/services/validators/__init__.py +28 -0
- roadmap/core/services/validators/_utils.py +20 -0
- roadmap/core/services/validators/archivable_issues_validator.py +71 -0
- roadmap/core/services/validators/archivable_milestones_validator.py +69 -0
- roadmap/core/services/validators/backup_validator.py +89 -0
- roadmap/core/services/validators/data_integrity_validator.py +84 -0
- roadmap/core/services/validators/duplicate_issues_validator.py +75 -0
- roadmap/core/services/validators/duplicate_milestones_validator.py +141 -0
- roadmap/core/services/validators/folder_structure_validator.py +165 -0
- roadmap/core/services/validators/health_status_utils.py +28 -0
- roadmap/core/services/validators/milestone_naming_validator.py +146 -0
- roadmap/core/services/validators/missing_headlines_validator.py +97 -0
- roadmap/core/services/validators/orphaned_issues_validator.py +142 -0
- roadmap/core/services/validators/orphaned_milestones_validator.py +85 -0
- roadmap/core/utils/git_remote_parser.py +83 -0
- roadmap/core/utils/github_urls.py +66 -0
- roadmap/domain/validation.py +30 -0
- roadmap/infrastructure/__init__.py +55 -0
- roadmap/infrastructure/coordination/__init__.py +8 -0
- roadmap/infrastructure/coordination/coordinator_params.py +82 -0
- roadmap/infrastructure/coordination/core.py +446 -0
- roadmap/infrastructure/coordination/git_coordinator.py +160 -0
- roadmap/infrastructure/coordination/initialization.py +348 -0
- roadmap/infrastructure/coordination/issue_coordinator.py +154 -0
- roadmap/infrastructure/coordination/issue_operations.py +456 -0
- roadmap/infrastructure/coordination/milestone_coordinator.py +135 -0
- roadmap/infrastructure/coordination/milestone_operations.py +201 -0
- roadmap/infrastructure/coordination/project_coordinator.py +113 -0
- roadmap/infrastructure/coordination/project_operations.py +144 -0
- roadmap/infrastructure/coordination/team_coordinator.py +107 -0
- roadmap/infrastructure/coordination/user_operations.py +150 -0
- roadmap/infrastructure/coordination/validation_coordinator.py +249 -0
- roadmap/infrastructure/coordination_gateway.py +152 -0
- roadmap/infrastructure/git/__init__.py +6 -0
- roadmap/infrastructure/git/git_integration_ops.py +234 -0
- roadmap/infrastructure/git_gateway.py +35 -0
- roadmap/infrastructure/github_gateway.py +52 -0
- roadmap/infrastructure/maintenance/__init__.py +5 -0
- roadmap/infrastructure/maintenance/cleanup.py +483 -0
- roadmap/infrastructure/observability/__init__.py +7 -0
- roadmap/infrastructure/observability/health.py +196 -0
- roadmap/infrastructure/observability/health_formatter.py +73 -0
- roadmap/infrastructure/observability/specialized_health_checkers.py +188 -0
- roadmap/infrastructure/persistence_gateway.py +164 -0
- roadmap/infrastructure/security/__init__.py +1 -0
- roadmap/infrastructure/security/credentials.py +489 -0
- roadmap/infrastructure/sync_gateway.py +94 -0
- roadmap/infrastructure/validation/__init__.py +7 -0
- roadmap/infrastructure/validation/file_enumeration.py +219 -0
- roadmap/infrastructure/validation/github_assignee_validator.py +47 -0
- roadmap/infrastructure/validation/github_validator.py +101 -0
- roadmap/infrastructure/validation/milestone_consistency_validator.py +96 -0
- roadmap/infrastructure/validation/vanilla_assignee_validator.py +37 -0
- roadmap/infrastructure/validation_gateway.py +96 -0
- roadmap/presentation/formatters/sync_metrics_formatter.py +355 -0
- roadmap/settings.py +345 -0
- roadmap/templates/github_workflows/ci-cd-roadmap.yml +241 -0
- roadmap/templates/github_workflows/issue-lifecycle.yml +236 -0
- roadmap/templates/github_workflows/roadmap-integration.yml +137 -0
- roadmap/templates/github_workflows/roadmap-starter.yml +59 -0
- roadmap/version.py +381 -0
- roadmap_cli-0.1.1.dist-info/METADATA +448 -0
- roadmap_cli-0.1.1.dist-info/RECORD +521 -0
- roadmap_cli-0.1.1.dist-info/WHEEL +4 -0
- roadmap_cli-0.1.1.dist-info/entry_points.txt +2 -0
- roadmap_cli-0.1.1.dist-info/licenses/LICENSE.md +21 -0
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"""Orchestrates sync merge operations with extracted service components.
|
|
2
|
+
|
|
3
|
+
This class coordinates the sync process by delegating to specialized services
|
|
4
|
+
for baseline management, pull processing, change filtering, and conflict conversion.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from structlog import get_logger
|
|
10
|
+
|
|
11
|
+
from roadmap.adapters.sync.services.baseline_state_handler import (
|
|
12
|
+
BaselineStateHandler,
|
|
13
|
+
)
|
|
14
|
+
from roadmap.adapters.sync.services.conflict_converter import ConflictConverter
|
|
15
|
+
from roadmap.adapters.sync.services.local_change_filter import LocalChangeFilter
|
|
16
|
+
from roadmap.adapters.sync.services.pull_result_processor import PullResultProcessor
|
|
17
|
+
from roadmap.adapters.sync.services.remote_issue_creation_service import (
|
|
18
|
+
RemoteIssueCreationService,
|
|
19
|
+
)
|
|
20
|
+
from roadmap.adapters.sync.services.sync_state_update_service import (
|
|
21
|
+
SyncStateUpdateService,
|
|
22
|
+
)
|
|
23
|
+
from roadmap.core.domain.issue import Issue
|
|
24
|
+
from roadmap.core.models.sync_models import SyncIssue
|
|
25
|
+
from roadmap.core.services.sync.sync_conflict_resolver import (
|
|
26
|
+
ConflictStrategy,
|
|
27
|
+
SyncConflictResolver,
|
|
28
|
+
)
|
|
29
|
+
from roadmap.core.services.sync.sync_plan import (
|
|
30
|
+
Action,
|
|
31
|
+
PushAction,
|
|
32
|
+
SyncPlan,
|
|
33
|
+
)
|
|
34
|
+
from roadmap.core.services.sync.sync_plan_executor import SyncPlanExecutor
|
|
35
|
+
from roadmap.core.services.sync.sync_report import SyncReport
|
|
36
|
+
from roadmap.core.services.sync.sync_state_comparator import SyncStateComparator
|
|
37
|
+
from roadmap.core.services.sync.sync_state_manager import SyncStateManager
|
|
38
|
+
|
|
39
|
+
logger = get_logger(__name__)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class SyncMergeEngine:
|
|
43
|
+
"""Orchestrates sync merge operations using specialized service components."""
|
|
44
|
+
|
|
45
|
+
def __init__(
|
|
46
|
+
self,
|
|
47
|
+
core: Any,
|
|
48
|
+
backend: Any,
|
|
49
|
+
state_comparator: SyncStateComparator,
|
|
50
|
+
conflict_resolver: SyncConflictResolver,
|
|
51
|
+
state_manager: SyncStateManager,
|
|
52
|
+
):
|
|
53
|
+
"""Initialize SyncMergeEngine.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
core: Core roadmap instance.
|
|
57
|
+
backend: Sync backend.
|
|
58
|
+
state_comparator: State comparator service.
|
|
59
|
+
conflict_resolver: Conflict resolver service.
|
|
60
|
+
state_manager: State manager service.
|
|
61
|
+
"""
|
|
62
|
+
self.core = core
|
|
63
|
+
self.backend = backend
|
|
64
|
+
self.state_comparator = state_comparator
|
|
65
|
+
self.conflict_resolver = conflict_resolver
|
|
66
|
+
self.state_manager = state_manager
|
|
67
|
+
|
|
68
|
+
# Initialize delegated services for specific concerns
|
|
69
|
+
self._issue_creation_service = RemoteIssueCreationService(core)
|
|
70
|
+
self._state_update_service = SyncStateUpdateService(state_manager)
|
|
71
|
+
self._baseline_handler = BaselineStateHandler(core, self._state_update_service)
|
|
72
|
+
self._conflict_converter = ConflictConverter(state_comparator)
|
|
73
|
+
|
|
74
|
+
def _load_baseline_state(self):
|
|
75
|
+
"""Load baseline state using the baseline handler."""
|
|
76
|
+
return self._baseline_handler.load_baseline_state()
|
|
77
|
+
|
|
78
|
+
def _process_fetched_pull_result(self, fetched):
|
|
79
|
+
"""Process pull result using the pull result processor."""
|
|
80
|
+
return PullResultProcessor.process_pull_result(fetched)
|
|
81
|
+
|
|
82
|
+
def _update_baseline_for_pulled(self, pulled_remote_ids: list[str]) -> None:
|
|
83
|
+
"""Update baseline after pulling using the baseline handler."""
|
|
84
|
+
self._baseline_handler.update_baseline_for_pulled(pulled_remote_ids)
|
|
85
|
+
|
|
86
|
+
def _filter_unchanged_issues_from_base(
|
|
87
|
+
self, issues: list, current_local: dict, base_state_issues: dict
|
|
88
|
+
) -> list:
|
|
89
|
+
"""Filter unchanged issues using the local change filter."""
|
|
90
|
+
return LocalChangeFilter.filter_unchanged_from_base(
|
|
91
|
+
issues, current_local, base_state_issues
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def _convert_issue_changes_to_conflicts(self, issue_changes: list) -> list:
|
|
95
|
+
"""Convert issue changes to conflicts using the conflict converter."""
|
|
96
|
+
return self._conflict_converter.convert_changes_to_conflicts(issue_changes)
|
|
97
|
+
|
|
98
|
+
def _create_issue_from_remote(
|
|
99
|
+
self, remote_id: str | int, remote_issue: SyncIssue
|
|
100
|
+
) -> Issue:
|
|
101
|
+
return self._issue_creation_service.create_issue_from_remote(
|
|
102
|
+
remote_id, remote_issue
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def _analyze_changes(self, local_issues_dict, remote_issues_data, base_state):
|
|
106
|
+
return self.state_comparator.analyze_three_way(
|
|
107
|
+
local_issues_dict,
|
|
108
|
+
remote_issues_data,
|
|
109
|
+
base_state.base_issues if base_state else None,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
def _analyze_and_classify(self, local_issues_dict, remote_issues_data, base_state):
|
|
113
|
+
changes = self._analyze_changes(
|
|
114
|
+
local_issues_dict, remote_issues_data, base_state
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
conflicts = [c for c in changes if c.has_conflict]
|
|
118
|
+
local_only_changes = [c for c in changes if c.is_local_only_change()]
|
|
119
|
+
remote_only_changes = [c for c in changes if c.is_remote_only_change()]
|
|
120
|
+
no_changes = [c for c in changes if c.conflict_type == "no_change"]
|
|
121
|
+
|
|
122
|
+
updates = [c.local_state for c in local_only_changes if c.local_state]
|
|
123
|
+
pulls = [c.issue_id for c in remote_only_changes]
|
|
124
|
+
up_to_date = [c.issue_id for c in no_changes]
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
changes,
|
|
128
|
+
conflicts,
|
|
129
|
+
local_only_changes,
|
|
130
|
+
remote_only_changes,
|
|
131
|
+
no_changes,
|
|
132
|
+
updates,
|
|
133
|
+
pulls,
|
|
134
|
+
up_to_date,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def _resolve_conflicts_if_needed(self, conflicts, force_local, force_remote):
|
|
138
|
+
if not conflicts:
|
|
139
|
+
return []
|
|
140
|
+
strategy = (
|
|
141
|
+
ConflictStrategy.KEEP_LOCAL
|
|
142
|
+
if force_local
|
|
143
|
+
else ConflictStrategy.KEEP_REMOTE
|
|
144
|
+
if force_remote
|
|
145
|
+
else ConflictStrategy.AUTO_MERGE
|
|
146
|
+
)
|
|
147
|
+
try:
|
|
148
|
+
conflict_objects = self._convert_issue_changes_to_conflicts(conflicts)
|
|
149
|
+
resolved_issues = self.conflict_resolver.resolve_batch(
|
|
150
|
+
conflict_objects, strategy
|
|
151
|
+
)
|
|
152
|
+
logger.info(
|
|
153
|
+
"conflicts_resolved",
|
|
154
|
+
count=len(resolved_issues),
|
|
155
|
+
strategy=strategy.value,
|
|
156
|
+
)
|
|
157
|
+
return resolved_issues
|
|
158
|
+
except Exception as e:
|
|
159
|
+
logger.warning(
|
|
160
|
+
"conflicts_resolution_failed",
|
|
161
|
+
error=str(e),
|
|
162
|
+
strategy=getattr(strategy, "value", None),
|
|
163
|
+
severity="operational",
|
|
164
|
+
)
|
|
165
|
+
return []
|
|
166
|
+
|
|
167
|
+
def _apply_plan(
|
|
168
|
+
self,
|
|
169
|
+
updates,
|
|
170
|
+
resolved_issues,
|
|
171
|
+
pulls,
|
|
172
|
+
dry_run,
|
|
173
|
+
push_only, # noqa: F841
|
|
174
|
+
pull_only, # noqa: F841
|
|
175
|
+
report: SyncReport,
|
|
176
|
+
):
|
|
177
|
+
plan = SyncPlan()
|
|
178
|
+
|
|
179
|
+
issues_to_push = updates + resolved_issues
|
|
180
|
+
if issues_to_push:
|
|
181
|
+
if len(issues_to_push) == 1:
|
|
182
|
+
issue = issues_to_push[0]
|
|
183
|
+
plan.add(PushAction(issue_id=issue.id, issue_payload=issue))
|
|
184
|
+
else:
|
|
185
|
+
plan.add(Action(action_type="push", payload={"issues": issues_to_push}))
|
|
186
|
+
|
|
187
|
+
if pulls:
|
|
188
|
+
plan.add(Action(action_type="pull", payload={"issue_ids": pulls}))
|
|
189
|
+
|
|
190
|
+
executor = SyncPlanExecutor(
|
|
191
|
+
transport_adapter=self.backend,
|
|
192
|
+
db_session=self.core.db if hasattr(self.core, "db") else None,
|
|
193
|
+
core=self.core,
|
|
194
|
+
)
|
|
195
|
+
exec_report = executor.execute(plan, dry_run=dry_run)
|
|
196
|
+
|
|
197
|
+
pushed_count = getattr(exec_report, "issues_pushed", 0)
|
|
198
|
+
pulled_count = getattr(exec_report, "issues_pulled", 0)
|
|
199
|
+
logger.info(
|
|
200
|
+
"executor_report_counts",
|
|
201
|
+
issues_pushed=pushed_count,
|
|
202
|
+
issues_pulled=pulled_count,
|
|
203
|
+
exec_report_type=type(exec_report).__name__,
|
|
204
|
+
)
|
|
205
|
+
report.issues_pushed = pushed_count
|
|
206
|
+
report.issues_pulled = pulled_count
|
|
207
|
+
if getattr(exec_report, "error", None):
|
|
208
|
+
report.error = exec_report.error
|
|
209
|
+
# Copy errors from executor report
|
|
210
|
+
if hasattr(exec_report, "errors") and exec_report.errors:
|
|
211
|
+
report.errors.update(exec_report.errors)
|
|
212
|
+
|
|
213
|
+
if (pushed_count > 0 or pulled_count > 0) and not dry_run:
|
|
214
|
+
report.issues_needs_push = max(0, report.issues_needs_push - pushed_count)
|
|
215
|
+
report.issues_up_to_date = report.issues_up_to_date + pushed_count
|
|
216
|
+
report.issues_needs_pull = max(0, report.issues_needs_pull - pulled_count)
|
|
217
|
+
report.issues_up_to_date = report.issues_up_to_date + pulled_count
|
|
218
|
+
|
|
219
|
+
return report
|
|
220
|
+
|
|
221
|
+
def _process_remote_issue(
|
|
222
|
+
self, remote_id: str, remote_issue, matcher, existing_links: dict, results: dict
|
|
223
|
+
) -> None:
|
|
224
|
+
"""Process a single remote issue: auto-link, mark as duplicate, or create locally."""
|
|
225
|
+
if remote_id in existing_links:
|
|
226
|
+
logger.debug(
|
|
227
|
+
"remote_issue_already_linked",
|
|
228
|
+
remote_id=remote_id,
|
|
229
|
+
issue_uuid=existing_links[remote_id],
|
|
230
|
+
)
|
|
231
|
+
return
|
|
232
|
+
|
|
233
|
+
matched_issue, score, match_type = matcher.find_best_match(remote_issue)
|
|
234
|
+
|
|
235
|
+
if match_type == "auto_link" and matched_issue:
|
|
236
|
+
try:
|
|
237
|
+
self.core.db.remote_links.link_issue(
|
|
238
|
+
issue_uuid=matched_issue.id,
|
|
239
|
+
backend_name="github",
|
|
240
|
+
remote_id=remote_id,
|
|
241
|
+
)
|
|
242
|
+
logger.info(
|
|
243
|
+
"remote_issue_auto_linked",
|
|
244
|
+
remote_id=remote_id,
|
|
245
|
+
issue_uuid=matched_issue.id,
|
|
246
|
+
score=round(score, 3),
|
|
247
|
+
)
|
|
248
|
+
results["auto_linked"].append(remote_id)
|
|
249
|
+
except Exception as e:
|
|
250
|
+
logger.warning(
|
|
251
|
+
"remote_link_creation_failed",
|
|
252
|
+
remote_id=remote_id,
|
|
253
|
+
issue_uuid=matched_issue.id,
|
|
254
|
+
error=str(e),
|
|
255
|
+
severity="operational",
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
elif match_type == "potential_duplicate" and matched_issue:
|
|
259
|
+
logger.debug(
|
|
260
|
+
"remote_issue_potential_duplicate",
|
|
261
|
+
remote_id=remote_id,
|
|
262
|
+
candidate_id=matched_issue.id,
|
|
263
|
+
score=round(score, 3),
|
|
264
|
+
)
|
|
265
|
+
results["potential_duplicates"].append(remote_id)
|
|
266
|
+
|
|
267
|
+
else:
|
|
268
|
+
logger.debug(
|
|
269
|
+
"remote_issue_no_match",
|
|
270
|
+
remote_id=remote_id,
|
|
271
|
+
best_score=round(score, 3) if score > 0 else 0,
|
|
272
|
+
)
|
|
273
|
+
try:
|
|
274
|
+
new_issue = self._create_issue_from_remote(
|
|
275
|
+
remote_id=remote_id, remote_issue=remote_issue
|
|
276
|
+
)
|
|
277
|
+
created_issue = self.core.issues.create(
|
|
278
|
+
title=new_issue.title,
|
|
279
|
+
status=new_issue.status,
|
|
280
|
+
labels=new_issue.labels,
|
|
281
|
+
milestone=new_issue.milestone,
|
|
282
|
+
assignee=new_issue.assignee,
|
|
283
|
+
content=new_issue.content,
|
|
284
|
+
)
|
|
285
|
+
if not created_issue:
|
|
286
|
+
raise Exception("Failed to create issue in repository")
|
|
287
|
+
self.core.db.remote_links.link_issue(
|
|
288
|
+
issue_uuid=created_issue.id,
|
|
289
|
+
backend_name="github",
|
|
290
|
+
remote_id=remote_id,
|
|
291
|
+
)
|
|
292
|
+
logger.info(
|
|
293
|
+
"remote_issue_created_locally",
|
|
294
|
+
remote_id=remote_id,
|
|
295
|
+
issue_uuid=created_issue.id,
|
|
296
|
+
title=created_issue.title,
|
|
297
|
+
milestone=created_issue.milestone,
|
|
298
|
+
)
|
|
299
|
+
results["new_remote"].append(remote_id)
|
|
300
|
+
except Exception as e:
|
|
301
|
+
logger.warning(
|
|
302
|
+
"remote_issue_creation_failed",
|
|
303
|
+
remote_id=remote_id,
|
|
304
|
+
error=str(e),
|
|
305
|
+
severity="operational",
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
def _match_and_link_remote_issues(
|
|
309
|
+
self, local_issues_dict: dict, remote_issues_data: dict, dry_run: bool = False
|
|
310
|
+
) -> dict[str, list[Any]]:
|
|
311
|
+
from roadmap.common.logging import get_stack_trace
|
|
312
|
+
|
|
313
|
+
logger.debug(
|
|
314
|
+
"match_and_link_remote_issues_start",
|
|
315
|
+
remote_count=len(remote_issues_data),
|
|
316
|
+
local_count=len(local_issues_dict),
|
|
317
|
+
dry_run=dry_run,
|
|
318
|
+
stack=get_stack_trace(depth=3),
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
results = {
|
|
322
|
+
"auto_linked": [],
|
|
323
|
+
"potential_duplicates": [],
|
|
324
|
+
"new_remote": [],
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if not remote_issues_data:
|
|
328
|
+
return results
|
|
329
|
+
|
|
330
|
+
try:
|
|
331
|
+
local_issues = list(local_issues_dict.values())
|
|
332
|
+
matcher = __import__(
|
|
333
|
+
"roadmap.core.services.issue.issue_matching_service",
|
|
334
|
+
fromlist=["IssueMatchingService"],
|
|
335
|
+
).IssueMatchingService(local_issues)
|
|
336
|
+
|
|
337
|
+
all_remote_ids = list(remote_issues_data.keys())
|
|
338
|
+
existing_links = {}
|
|
339
|
+
try:
|
|
340
|
+
for remote_id in all_remote_ids:
|
|
341
|
+
uuid = self.core.db.remote_links.get_issue_uuid(
|
|
342
|
+
backend_name="github", remote_id=remote_id
|
|
343
|
+
)
|
|
344
|
+
if uuid:
|
|
345
|
+
existing_links[remote_id] = uuid
|
|
346
|
+
except Exception as e:
|
|
347
|
+
logger.warning(
|
|
348
|
+
"batch_remote_links_lookup_failed",
|
|
349
|
+
error=str(e),
|
|
350
|
+
error_type=type(e).__name__,
|
|
351
|
+
severity="operational",
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
for remote_id, remote_issue in remote_issues_data.items():
|
|
355
|
+
self._process_remote_issue(
|
|
356
|
+
remote_id, remote_issue, matcher, existing_links, results
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
logger.info(
|
|
360
|
+
"remote_matching_complete",
|
|
361
|
+
auto_linked=len(results["auto_linked"]),
|
|
362
|
+
potential_duplicates=len(results["potential_duplicates"]),
|
|
363
|
+
new_remote=len(results["new_remote"]),
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
except Exception as e:
|
|
367
|
+
logger.error(
|
|
368
|
+
"remote_matching_failed",
|
|
369
|
+
error_type=type(e).__name__,
|
|
370
|
+
error=str(e),
|
|
371
|
+
severity="system_error",
|
|
372
|
+
)
|
|
373
|
+
for remote_id in remote_issues_data.keys():
|
|
374
|
+
existing_issue_uuid = self.core.db.remote_links.get_issue_uuid(
|
|
375
|
+
backend_name="github", remote_id=remote_id
|
|
376
|
+
)
|
|
377
|
+
if not existing_issue_uuid:
|
|
378
|
+
results["new_remote"].append(remote_id)
|
|
379
|
+
|
|
380
|
+
return results
|
|
381
|
+
|
|
382
|
+
def _count_remote_stats(self, remote_issues_data):
|
|
383
|
+
try:
|
|
384
|
+
remote_issues_count = len(remote_issues_data) if remote_issues_data else 0
|
|
385
|
+
remote_open_count = 0
|
|
386
|
+
remote_closed_count = 0
|
|
387
|
+
for issue_data in remote_issues_data.values() if remote_issues_data else []:
|
|
388
|
+
state = getattr(issue_data, "state", None) or getattr(
|
|
389
|
+
issue_data, "status", "open"
|
|
390
|
+
)
|
|
391
|
+
if state and state.lower() == "closed":
|
|
392
|
+
remote_closed_count += 1
|
|
393
|
+
else:
|
|
394
|
+
remote_open_count += 1
|
|
395
|
+
|
|
396
|
+
remote_milestones = self.backend.get_milestones()
|
|
397
|
+
remote_milestones_count = len(remote_milestones) if remote_milestones else 0
|
|
398
|
+
logger.debug(
|
|
399
|
+
"remote_items_counted",
|
|
400
|
+
remote_issues=remote_issues_count,
|
|
401
|
+
remote_open=remote_open_count,
|
|
402
|
+
remote_closed=remote_closed_count,
|
|
403
|
+
remote_milestones=remote_milestones_count,
|
|
404
|
+
)
|
|
405
|
+
except Exception:
|
|
406
|
+
remote_issues_count = 0
|
|
407
|
+
remote_open_count = 0
|
|
408
|
+
remote_closed_count = 0
|
|
409
|
+
remote_milestones_count = 0
|
|
410
|
+
|
|
411
|
+
return (
|
|
412
|
+
remote_issues_count,
|
|
413
|
+
remote_open_count,
|
|
414
|
+
remote_closed_count,
|
|
415
|
+
remote_milestones_count,
|
|
416
|
+
)
|