Finishes the in-progress rename so docs, configs, tests, and capability manifests all reference the current repo name consistently. Fixes two tests (test_roundtrip_consolidated.py, test_issue_140_roundtrip_simplified.py) whose hardcoded cwd paths would have broken under the renamed directory. Archival content under history/, reports/, and roadmap/eat-the-frog/, plus derived artifacts (.venv_old/, node_modules/, asset_registry.json) are intentionally left untouched. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
14 KiB
Release Management Capability Migration Plan
This document outlines the step-by-step plan to migrate all version management, packaging, and release publication functionality from the main MarkiTect project into the release-management capability.
📋 Migration Overview
Current State
Version management and release functionality is currently scattered across:
release.py(main release script)gitea/directory (package registry client)VERSION_MANAGEMENT.md(documentation)PACKAGE_PUBLISHING.md(documentation)- Makefile targets (release automation)
- setuptools-scm configuration in main
pyproject.toml
Target State
All release-related functionality consolidated into:
capabilities/release-management/(self-contained capability)- Main project depends on capability for release operations
- Makefile includes capability's release targets
- Clean separation of concerns
🚦 Migration Steps
Phase 1: Create Capability Structure ✅ COMPLETED
- Create directory structure
- Create
README.mdwith comprehensive documentation - Create
pyproject.tomlwith full configuration - Create main
__init__.pywith API exports - Create
release.mkfor Makefile integration
Phase 2: Move Core Files and Code
2.1 Move Release Script
Source: release.py → Target: src/release_management/cli/main.py
Steps:
- Copy
release.pytosrc/release_management/cli/main.py - Refactor into proper CLI module structure
- Extract core logic into separate modules:
SimpleReleaseManager→src/release_management/core/manager.py- Git operations →
src/release_management/git/manager.py - Package building →
src/release_management/core/builder.py - Publishing logic →
src/release_management/core/publisher.py
Refactoring Plan:
# Current: release.py (monolithic)
class SimpleReleaseManager:
# All functionality in one class
# Target: Modular architecture
# src/release_management/core/manager.py
class ReleaseManager:
def __init__(self):
self.git_manager = GitManager()
self.builder = PackageBuilder()
self.publisher = PublishManager()
# src/release_management/git/manager.py
class GitManager:
# Git-specific operations
# src/release_management/core/builder.py
class PackageBuilder:
# Package building operations
# src/release_management/core/publisher.py
class PublishManager:
# Publishing and upload operations
2.2 Move Gitea Package Registry
Source: gitea/ directory → Target: src/release_management/registries/gitea/
File Mapping:
gitea/config.py → src/release_management/registries/gitea/config.py
gitea/exceptions.py → src/release_management/registries/gitea/exceptions.py
gitea/package_registry.py → src/release_management/registries/gitea/registry.py
gitea/__init__.py → src/release_management/registries/gitea/__init__.py
Refactoring:
- Create base registry interface:
src/release_management/registries/base.py - Create registry factory:
src/release_management/registries/factory.py - Adapt GiteaPackageRegistry to implement base interface
- Add PyPI registry implementation for future use
2.3 Move Documentation
Source: Documentation files → Target: docs/ directory
File Mapping:
VERSION_MANAGEMENT.md → capabilities/release-management/docs/version_management.md
PACKAGE_PUBLISHING.md → capabilities/release-management/docs/package_publishing.md
Updates Required:
- Update paths and references in documentation
- Add API reference documentation
- Create examples directory with usage samples
Phase 3: Update Main Project Integration
3.1 Update Main Makefile
Target: Makefile in main project
Changes:
-
Include release management Makefile:
# Add at top of Makefile include capabilities/release-management/release.mk -
Update existing targets to use capability:
# Old targets release-status: python release.py status # New targets (provided by release.mk) release-status: release status -
Remove obsolete targets and replace with capability equivalents
3.2 Update Main pyproject.toml
Target: pyproject.toml in main project
Changes:
-
Add release-management as dependency:
[project.dependencies] release-management = {path = "capabilities/release-management", develop = true} -
Keep setuptools-scm configuration:
[tool.setuptools_scm] write_to = "markitect/_version.py" -
Remove release-specific configuration (moved to capability)
3.3 Update Main Project Structure
Cleanup Tasks:
- Remove
release.pyfrom root - Remove
gitea/directory - Move
VERSION_MANAGEMENT.mdandPACKAGE_PUBLISHING.mdto capability - Update
.gitignoreif needed - Update documentation references
Phase 4: Testing and Validation
4.1 Create Capability Tests
Target: capabilities/release-management/tests/
Test Structure:
tests/
├── test_manager.py # ReleaseManager tests
├── test_builder.py # PackageBuilder tests
├── test_publisher.py # PublishManager tests
├── test_git_manager.py # GitManager tests
├── test_gitea_registry.py # GiteaRegistry tests
├── test_cli.py # CLI command tests
├── test_integration.py # End-to-end tests
└── fixtures/
└── sample_packages/ # Test package artifacts
Test Coverage Goals:
- Unit tests for all core classes
- Integration tests for registry interactions
- CLI command tests
- Mock-based tests for external dependencies
- Error handling and edge cases
4.2 Validate Migration
Verification Steps:
- Install capability:
pip install -e capabilities/release-management/ - Run capability tests:
cd capabilities/release-management && pytest - Test CLI commands:
release --help,release status - Test Makefile integration:
make release-status - Perform test release workflow
- Verify all existing functionality works
Phase 5: Documentation and Examples
5.1 Create Examples
Target: capabilities/release-management/examples/
Example Scripts:
basic_release.py- Simple release workflowcustom_registry.py- Adding new registry typeci_integration.py- CI/CD pipeline integrationconfiguration_examples.py- Various configuration patterns
5.2 Update Documentation
Documentation Tasks:
- Update main project README to reference capability
- Create API reference documentation
- Add troubleshooting guide
- Document configuration options
- Provide migration guide for other projects
🎯 Detailed File Structure After Migration
markitect-main/
├── capabilities/
│ └── release-management/
│ ├── README.md ✅ CREATED
│ ├── pyproject.toml ✅ CREATED
│ ├── release.mk ✅ CREATED
│ ├── MIGRATION_PLAN.md ✅ CREATED
│ ├── src/release_management/
│ │ ├── __init__.py ✅ CREATED
│ │ ├── _version.py # Generated by setuptools-scm
│ │ ├── core/
│ │ │ ├── __init__.py
│ │ │ ├── manager.py # ReleaseManager class
│ │ │ ├── builder.py # PackageBuilder class
│ │ │ └── publisher.py # PublishManager class
│ │ ├── git/
│ │ │ ├── __init__.py
│ │ │ └── manager.py # GitManager class
│ │ ├── registries/
│ │ │ ├── __init__.py
│ │ │ ├── base.py # Registry interface
│ │ │ ├── factory.py # RegistryFactory
│ │ │ ├── gitea/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── config.py # From gitea/config.py
│ │ │ │ ├── exceptions.py # From gitea/exceptions.py
│ │ │ │ └── registry.py # From gitea/package_registry.py
│ │ │ └── pypi/
│ │ │ ├── __init__.py
│ │ │ └── registry.py # PyPI registry implementation
│ │ ├── cli/
│ │ │ ├── __init__.py
│ │ │ ├── main.py # From release.py
│ │ │ ├── commands.py # CLI command implementations
│ │ │ └── utils.py # CLI utilities
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── version.py # Version utilities
│ │ └── validation.py # Release validation
│ ├── tests/
│ │ ├── __init__.py
│ │ ├── test_manager.py
│ │ ├── test_builder.py
│ │ ├── test_publisher.py
│ │ ├── test_git_manager.py
│ │ ├── test_gitea_registry.py
│ │ ├── test_cli.py
│ │ └── fixtures/
│ ├── docs/
│ │ ├── version_management.md # From VERSION_MANAGEMENT.md
│ │ ├── package_publishing.md # From PACKAGE_PUBLISHING.md
│ │ ├── api_reference.md
│ │ └── troubleshooting.md
│ └── examples/
│ ├── basic_release.py
│ ├── custom_registry.py
│ └── ci_integration.py
├── Makefile # Updated to include release.mk
├── pyproject.toml # Updated with capability dependency
└── markitect/
└── _version.py # Still generated by setuptools-scm
📦 Files to Remove After Migration
Root Directory:
release.py(moved to capability CLI)gitea/directory (moved to capability registries)VERSION_MANAGEMENT.md(moved to capability docs)PACKAGE_PUBLISHING.md(moved to capability docs)
Makefile Targets to Update:
- Replace individual release targets with capability imports
- Keep legacy aliases for backward compatibility
- Update target documentation
🔧 API Design for Capability
Main API Classes
# Primary entry point
from release_management import ReleaseManager
manager = ReleaseManager()
success = manager.publish_release("1.0.0")
# Component access
from release_management import PackageBuilder, PublishManager, GitManager
builder = PackageBuilder()
builder.build_packages()
publisher = PublishManager()
publisher.upload_packages("gitea")
git = GitManager()
git.create_tag("v1.0.0")
# Registry access
from release_management import RegistryFactory
registry = RegistryFactory.create("gitea")
registry.upload_package("package.whl")
CLI Interface
# Main commands
release status # Show release status
release validate # Validate release state
release tag --version 1.0.0 # Create git tag
release build # Build packages
release publish --version 1.0.0 # Complete release workflow
release upload --registry gitea # Upload existing packages
# Registry management
release registry-info --registry gitea
release registry-list
🚀 Benefits After Migration
For MarkiTect Project
- Cleaner main project: Release logic separated from core functionality
- Better maintainability: Clear module boundaries and responsibilities
- Easier testing: Isolated testing of release functionality
- Reduced complexity: Main project focuses on core features
For Release Management Capability
- Reusability: Can be used in other Python projects
- Independent development: Own release cycle and versioning
- Comprehensive testing: Full test coverage for release functionality
- Documentation: Dedicated documentation and examples
- Extensibility: Easy to add new registries and features
For Users/Developers
- Consistent interface: Same commands across all projects using capability
- Better documentation: Comprehensive guides and API reference
- More features: Enhanced functionality and registry support
- Easier contribution: Clear structure for adding features
🎯 Success Criteria
Migration is considered successful when:
- ✅ All existing release functionality works through capability
- ✅ Main project Makefile targets work unchanged
- ✅ CLI commands provide same functionality as current
release.py - ✅ All tests pass for both capability and main project
- ✅ Documentation is complete and accurate
- ✅ Examples demonstrate capability usage
- ✅ No regression in release workflow functionality
🔄 Rollback Plan
If migration issues arise:
- Keep backup: Current files backed up before migration
- Incremental approach: Migrate one component at a time
- Parallel operation: Keep old and new systems running during transition
- Quick revert: Ability to restore original structure if needed
Rollback Steps:
- Remove capability dependency from main
pyproject.toml - Restore backed up files (
release.py,gitea/, docs) - Restore original Makefile targets
- Remove capability directory
- Test that original functionality works
📅 Migration Timeline
Estimated Duration: 1-2 weeks for complete migration
Phase Breakdown:
- Phase 1 (Directory Structure): ✅ COMPLETED
- Phase 2 (Code Migration): 2-3 days
- Phase 3 (Integration): 1-2 days
- Phase 4 (Testing): 2-3 days
- Phase 5 (Documentation): 1-2 days
Critical Path:
- Code refactoring and migration
- Testing and validation
- Documentation updates
- Final integration testing
This migration plan ensures a systematic, low-risk transition to the capability-based architecture while maintaining all existing functionality and improving the overall project structure.