
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m0s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m34s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 7s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 7s
4.4 KiB
4.4 KiB
Implementation Plan
Based on analysis of the current codebase, the multi-server support feature needs to be built from scratch. The current implementation has a hardcoded SERVER_HOST = "getpkg.xyz"
in GetbinClient
and no server management infrastructure.
Core Infrastructure Tasks
-
1. Create ServerManager class and server configuration system
- Implement ServerManager class with server add/remove/list functionality
- Create server configuration JSON format and file handling
- Add server URL validation and reachability checks
- Implement write token management per server
- Requirements: 1.1, 1.2, 1.3, 5.1, 5.2, 5.4
-
2. Enhance GetbinClient for multi-server support
- Modify GetbinClient constructor to accept server list instead of hardcoded host
- Implement multi-server fallback logic for downloads
- Add server-specific upload and hash operations
- Create findPackageServer method for package discovery
- Requirements: 2.1, 2.2, 2.3, 2.4
-
3. Create enhanced package metadata system
- Design PackageMetadata structure with server source tracking
- Implement packages directory structure (~/.config/getpkg/packages/)
- Add JSON serialization/deserialization for enhanced metadata
- Create package metadata validation and error handling
- Requirements: 4.1, 4.2, 4.3
Migration and Compatibility Tasks
-
4. Implement migration system for existing installations
- Create MigrationManager class for legacy data handling
- Implement automatic migration from single-server to multi-server config
- Migrate existing package JSON files to packages subdirectory
- Update existing package metadata to include server source information
- Add migration error handling and rollback capabilities
- Requirements: 4.4, 4.5, 6.1, 6.2, 6.3, 6.5
-
5. Ensure backward compatibility
- Implement default server configuration (getpkg.xyz) when no config exists
- Maintain existing CLI behavior for users without custom server configuration
- Preserve existing token storage location compatibility
- Add graceful handling of missing or corrupted configuration files
- Requirements: 6.1, 6.4, 5.3
CLI Integration Tasks
-
6. Add server management commands to main.cpp
- Implement
getpkg server add <url>
command - Implement
getpkg server remove <url>
command - Implement
getpkg server list
command - Add server URL validation and user feedback
- Requirements: 1.1, 1.2, 1.3
- Implement
-
7. Update existing commands for multi-server support
- Modify install command to use ServerManager and multi-server GetbinClient
- Update publish command to support --server option and default server selection
- Update unpublish command to support --server option and default server selection
- Ensure update command works with multi-server package tracking
- Requirements: 2.1, 2.2, 2.3, 2.4, 3.1, 3.2, 3.3, 3.4, 3.5
Integration and Testing Tasks
-
8. Integrate all components in main application flow
- Initialize ServerManager in main.cpp startup
- Trigger migration process on first run with new version
- Update package installation flow to use enhanced metadata
- Ensure proper error handling and user messaging throughout
- Requirements: 6.1, 6.2, 6.3, 6.4, 6.5
-
9. Add comprehensive error handling and validation
- Implement network error handling with server fallback
- Add configuration file corruption recovery
- Create user-friendly error messages for server connectivity issues
- Add validation for server URLs and authentication tokens
- Requirements: 5.3, 5.4, 5.5
-
10. Create unit tests for new components
- Write unit tests for ServerManager class functionality
- Test GetbinClient multi-server operations and fallback logic
- Test PackageMetadata serialization and migration
- Test MigrationManager with various legacy data scenarios
- Create integration tests for complete multi-server workflows
- Requirements: All requirements validation
Notes
- Current codebase has
SERVER_HOST = "getpkg.xyz"
hardcoded in GetbinClient.cpp - No existing server management or configuration infrastructure
- Package metadata is currently stored as individual JSON files in ~/.config/getpkg/
- Token storage is in ~/.config/getpkg.xyz/write_token.txt (legacy format)
- All functionality needs to be built from scratch while maintaining backward compatibility