Refactor component installation architecture to eliminate main composer.json pollution and implement proper component isolation with git-tag based versioning.
π¨ Current Problem
The current component installation system has critical architectural flaws identified in PR #75 analysis:
Issues:
- β Components modify main
composer.json via composer require
- β Dual storage anti-pattern (JSON + database registry)
- β Components ship with core Conduit product
- β No proper versioning or rollback capability
- β Security vulnerabilities in package installation
π― Proposed Architecture: Isolated Component System
Component Isolation Pattern:
conduit/
βββ composer.json β Clean\! Only core dependencies
βββ vendor/ β Only core dependencies
βββ conduit-components/
βββ components.json β Version registry
βββ env-manager/ β Git repo at specific tag
β βββ .git/
β βββ composer.json β Component's own deps
β βββ vendor/ β Isolated component deps
β βββ src/
βββ docker/ β Git repo at specific tag
βββ .git/
βββ composer.json
βββ vendor/
βββ src/
Version Registry System:
{
"registry": {
"env-manager": {
"package": "jordanpartridge/conduit-env-manager",
"version": "v1.2.3",
"git_url": "https://github.com/jordanpartridge/conduit-env-manager.git",
"installed_at": "2025-01-28T10:30:00Z",
"status": "active"
}
}
}
π§ Implementation Plan
Phase 1: Git-Tag Based Installation
class ComponentInstaller
{
public function install(string $componentName, string $version = 'latest'): ComponentResult
{
// 1. Resolve version to specific tag
$resolvedVersion = $this->resolveVersion($componentName, $version);
// 2. Clone component at specific tag
$componentPath = $this->cloneComponent($componentName, $resolvedVersion);
// 3. Run composer install in component directory
$this->installComponentDependencies($componentPath);
// 4. Register in local registry
$this->registerComponent($componentName, $resolvedVersion);
// 5. Register autoloader
$this->registerComponentAutoloader($componentPath);
}
}
Phase 2: Version Resolution
// Support composer-like version constraints
conduit components install env-manager // latest
conduit components install env-manager@v1.2.3 // exact
conduit components install env-manager@^1.0 // semver range
conduit components install env-manager@~1.2.0 // patch range
Phase 3: Runtime Component Loading
class ComponentLoader
{
public function loadActiveComponents(): void
{
foreach ($this->getActiveComponents() as $component) {
$componentPath = base_path("conduit-components/{$component}");
// Load component's isolated autoloader
$autoloadFile = "{$componentPath}/vendor/autoload.php";
if (file_exists($autoloadFile)) {
require_once $autoloadFile;
}
// Register service provider
$this->app->register($component['service_provider']);
}
}
}
β
Benefits
- β
Clean Core: Main composer.json never touched
- β
Proper Versioning: Git tags with semver support
- β
Isolated Dependencies: Each component manages its own deps
- β
Easy Updates:
git fetch && git checkout v1.3.0
- β
Rollback Capability: Switch between any tagged version
- β
True Microkernel: Components are completely optional
- β
Security: No main project pollution
π― User Experience
# Clean, familiar commands
conduit components install env-manager@^1.0
conduit components update env-manager
conduit components list
conduit components remove env-manager
# Version-aware operations
conduit components history env-manager
conduit components rollback env-manager v1.1.0
π Security Improvements
- Remove hardcoded package whitelist
- Implement proper path validation
- Add component signing verification
- Comprehensive input sanitization
π Acceptance Criteria
π Dependencies
β οΈ Breaking Changes
This will require migrating existing component installations. Plan proper migration strategy and documentation.
Priority: High - Foundational architecture that enables proper component ecosystem.
Refactor component installation architecture to eliminate main composer.json pollution and implement proper component isolation with git-tag based versioning.
π¨ Current Problem
The current component installation system has critical architectural flaws identified in PR #75 analysis:
Issues:
composer.jsonviacomposer requireπ― Proposed Architecture: Isolated Component System
Component Isolation Pattern:
Version Registry System:
{ "registry": { "env-manager": { "package": "jordanpartridge/conduit-env-manager", "version": "v1.2.3", "git_url": "https://github.com/jordanpartridge/conduit-env-manager.git", "installed_at": "2025-01-28T10:30:00Z", "status": "active" } } }π§ Implementation Plan
Phase 1: Git-Tag Based Installation
Phase 2: Version Resolution
Phase 3: Runtime Component Loading
β Benefits
git fetch && git checkout v1.3.0π― User Experience
π Security Improvements
π Acceptance Criteria
π Dependencies
This will require migrating existing component installations. Plan proper migration strategy and documentation.
Priority: High - Foundational architecture that enables proper component ecosystem.