|
1 | 1 | # Implementation Plan |
2 | 2 |
|
3 | | -- [x] 1. Set up Go project structure and core dependencies |
4 | | - - Initialize Go module with proper project structure (cmd/, internal/, pkg/) |
5 | | - - Add Cobra CLI framework, YAML parsing (gopkg.in/yaml.v3), and logging dependencies |
6 | | - - Create main.go entry point and basic CLI structure |
7 | | - - Set up build configuration (Makefile) for cross-platform compilation |
8 | | - - _Requirements: 7.1, 7.2, 8.1_ |
| 3 | +## Phase 1: Fix Core Functionality (Critical) |
| 4 | + |
| 5 | +- [x] 1. Diagnose and fix template resolution system |
| 6 | + - Analyze current template engine implementation and identify why sai_package(), sai_service() functions fail |
| 7 | + - Fix template function registration and context passing to ensure saidata is available |
| 8 | + - Update template functions to properly access package_name field instead of name field |
| 9 | + - Add comprehensive error handling for template resolution failures with clear error messages |
| 10 | + - Create unit tests that verify template functions work with existing saidata samples |
| 11 | + - _Requirements: 16.2, 16.3, 17.2, 17.3_ |
| 12 | + |
| 13 | +- [x] 2. Fix provider loading and validation system |
| 14 | + - Debug current provider YAML loading to identify parsing failures |
| 15 | + - Fix YAML unmarshaling for all existing provider files (apt.yaml, brew.yaml, docker.yaml, etc.) |
| 16 | + - Implement proper schema validation against providerdata-0.1-schema.json |
| 17 | + - Add error handling for malformed provider files with specific error messages |
| 18 | + - Verify all existing providers load correctly and actions are accessible |
| 19 | + - _Requirements: 16.4, 16.5_ |
| 20 | + |
| 21 | +- [x] 3. Fix saidata loading and parsing system |
| 22 | + - Debug current saidata loading from docs/saidata_samples/ directory |
| 23 | + - Fix hierarchical loading (software/{prefix}/{software}/default.yaml pattern) |
| 24 | + - Implement proper OS-specific override loading and merging |
| 25 | + - Add schema validation against saidata-0.2-schema.json with clear error messages |
| 26 | + - Verify existing saidata samples (apache, elasticsearch, etc.) load correctly |
| 27 | + - _Requirements: 16.4, 16.5_ |
| 28 | + |
| 29 | +- [x] 4. Fix command execution and provider action system |
| 30 | + - Debug why provider actions fail to execute properly |
| 31 | + - Fix command template rendering with proper saidata context |
| 32 | + - Implement proper command execution with error handling and output capture |
| 33 | + - Add validation to ensure commands are executable before attempting to run them |
| 34 | + - Create comprehensive logging for command execution failures |
| 35 | + - _Requirements: 16.1, 16.3, 16.6_ |
| 36 | + |
| 37 | +## Phase 2: Implement Missing Core Features |
| 38 | + |
| 39 | +- [x] 5. Implement automatic saidata management |
| 40 | + - Create saidata bootstrap system that detects first-time usage |
| 41 | + - Implement automatic download to $HOME/.sai/saidata (user) or /etc/sai/saidata (root) |
| 42 | + - Add Git clone functionality with zip download fallback |
| 43 | + - Create welcome message display for first-time users |
| 44 | + - Implement `sai saidata` command for repository management (update, status, sync) |
| 45 | + - _Requirements: 11.1, 11.2, 11.3, 11.4, 11.5_ |
| 46 | + |
| 47 | +- [x] 6. Fix provider detection system |
| 48 | + - Implement proper executable-based provider detection using provider.executable field |
| 49 | + - Fix provider availability checking to prevent showing unavailable providers (like apt on macOS) |
| 50 | + - Update `sai stats` command to only show actually available providers |
| 51 | + - Add provider detection caching for performance |
| 52 | + - Create comprehensive provider detection logging for debugging |
| 53 | + - _Requirements: 13.1, 13.2, 13.3, 13.4_ |
| 54 | + |
| 55 | +- [x] 7. Implement debug system |
| 56 | + - Add --debug flag to root command with comprehensive debug logging |
| 57 | + - Implement debug logging for provider detection, template resolution, command execution |
| 58 | + - Add performance timing and metrics collection in debug mode |
| 59 | + - Create debug output for configuration loading and decision-making processes |
| 60 | + - Add internal state logging for troubleshooting complex issues |
| 61 | + - _Requirements: 12.1, 12.2, 12.3, 12.4_ |
| 62 | + |
| 63 | +## Phase 3: Improve User Experience |
| 64 | + |
| 65 | +- [x] 8. Fix and improve version command functionality |
| 66 | + - Separate `sai --version` (SAI version) from `sai version <software>` (software version) |
| 67 | + - Implement proper software version checking using provider version actions |
| 68 | + - Add support for showing version across all available providers |
| 69 | + - Display installation status alongside version information |
| 70 | + - Add proper error handling when version information cannot be retrieved |
| 71 | + - _Requirements: 14.1, 14.2, 14.3, 14.4, 14.5_ |
| 72 | + |
| 73 | +- [x] 9. Improve output formatting and provider selection |
| 74 | + - Update provider selection UI to show actual commands instead of package details |
| 75 | + - Implement automatic execution for information-only commands (search, info, status, etc.) |
| 76 | + - Add compact output format showing "Command: (full command)" for each provider |
| 77 | + - Maintain provider selection prompts only for system-changing operations |
| 78 | + - Update output formatting to be more concise and informative |
| 79 | + - _Requirements: 15.1, 15.2, 15.3, 15.4, 15.5_ |
| 80 | + |
| 81 | +## Phase 4: Data Structure Consistency |
| 82 | + |
| 83 | +- [ ] 10. Standardize package naming across all components |
| 84 | + - Update saidata-0.2-schema.json to require package_name field for packages |
| 85 | + - Update all existing saidata samples to use package_name instead of name |
| 86 | + - Update all provider templates to reference package_name consistently |
| 87 | + - Update template functions to use package_name field for package resolution |
| 88 | + - Verify all existing providers work with updated package_name structure |
| 89 | + - _Requirements: 17.1, 17.2, 17.4, 17.5_ |
| 90 | + |
| 91 | +## Phase 5: Testing and Validation |
| 92 | + |
| 93 | +- [ ] 11. Create comprehensive test suite for fixed functionality |
| 94 | + - Write integration tests that verify all basic SAI commands work (install, status, version, etc.) |
| 95 | + - Create tests using existing provider files and saidata samples |
| 96 | + - Add tests for template resolution with real saidata |
| 97 | + - Implement tests for provider detection across different platforms |
| 98 | + - Create end-to-end tests that verify complete workflows work correctly |
| 99 | + - _Requirements: 16.1, 16.2, 16.3, 16.4, 16.5, 16.6_ |
| 100 | + |
| 101 | +- [ ] 12. Add error handling and recovery systems |
| 102 | + - Implement comprehensive error handling with clear, actionable error messages |
| 103 | + - Add error context and suggestions for common failure scenarios |
| 104 | + - Create recovery mechanisms for transient failures |
| 105 | + - Add validation systems that prevent execution when resources don't exist |
| 106 | + - Implement graceful degradation when providers or saidata are unavailable |
| 107 | + - _Requirements: 16.6_ |
9 | 108 |
|
10 | 109 | - [x] 2. Implement core data structures and YAML parsing |
11 | 110 | - [x] 2.1 Create provider data structures matching existing YAML files |
|
0 commit comments