Starting Over with Ink
This commit is contained in:
477
.kiro/specs/windows-compatible-tui/design.md
Normal file
477
.kiro/specs/windows-compatible-tui/design.md
Normal file
@@ -0,0 +1,477 @@
|
||||
# Design Document
|
||||
|
||||
## Overview
|
||||
|
||||
This design document outlines the replacement of the Blessed-based TUI with a Windows-compatible alternative using **Ink** (React for CLI) as the primary library choice. Ink provides excellent cross-platform support, modern React-based component architecture, and superior Windows compatibility compared to Blessed. The design maintains all existing functionality while improving performance, maintainability, and user experience across all platforms.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Library Selection: Ink (React for CLI)
|
||||
|
||||
**Primary Choice: Ink v4.x**
|
||||
|
||||
- **Rationale**: Ink is built on React principles, providing a modern component-based architecture
|
||||
- **Windows Compatibility**: Excellent support for Windows Terminal, Command Prompt, and PowerShell
|
||||
- **Performance**: Uses React's reconciliation for efficient updates, reducing flicker
|
||||
- **Ecosystem**: Large ecosystem of pre-built components and utilities
|
||||
- **Maintenance**: Actively maintained by Vercel with strong community support
|
||||
|
||||
**Alternative Considerations**:
|
||||
|
||||
- **Blessed**: Current library with Windows issues (being replaced)
|
||||
- **Terminal-kit**: Good Windows support but more complex API
|
||||
- **Enquirer**: Limited to prompts, not full TUI applications
|
||||
- **Neo-blessed**: Fork of Blessed with some improvements but still has Windows issues
|
||||
|
||||
### Component Architecture
|
||||
|
||||
```
|
||||
TuiApplication (Root)
|
||||
├── AppProvider (Context/State Management)
|
||||
├── Router (Screen Management)
|
||||
├── StatusBar (Global Status)
|
||||
└── Screens/
|
||||
├── MainMenuScreen
|
||||
├── ConfigurationScreen
|
||||
├── OperationScreen
|
||||
├── SchedulingScreen
|
||||
├── LogViewerScreen
|
||||
└── TagAnalysisScreen
|
||||
```
|
||||
|
||||
### State Management
|
||||
|
||||
Using React Context API with custom hooks for:
|
||||
|
||||
- Application state (current screen, navigation history)
|
||||
- Configuration state (environment variables, settings)
|
||||
- Operation state (progress, results, errors)
|
||||
- UI state (focus, selections, modal states)
|
||||
|
||||
## Components and Interfaces
|
||||
|
||||
### Core Components
|
||||
|
||||
#### 1. TuiApplication (Root Component)
|
||||
|
||||
```javascript
|
||||
const TuiApplication = () => {
|
||||
return (
|
||||
<AppProvider>
|
||||
<Box flexDirection="column" height="100%">
|
||||
<StatusBar />
|
||||
<Router />
|
||||
</Box>
|
||||
</AppProvider>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
#### 2. AppProvider (State Management)
|
||||
|
||||
```javascript
|
||||
const AppProvider = ({ children }) => {
|
||||
const [appState, setAppState] = useState({
|
||||
currentScreen: "main-menu",
|
||||
navigationHistory: [],
|
||||
configuration: {},
|
||||
operationState: null,
|
||||
});
|
||||
|
||||
return (
|
||||
<AppContext.Provider value={{ appState, setAppState }}>
|
||||
{children}
|
||||
</AppContext.Provider>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
#### 3. Router (Screen Management)
|
||||
|
||||
```javascript
|
||||
const Router = () => {
|
||||
const { appState } = useContext(AppContext);
|
||||
|
||||
const screens = {
|
||||
"main-menu": MainMenuScreen,
|
||||
configuration: ConfigurationScreen,
|
||||
operation: OperationScreen,
|
||||
scheduling: SchedulingScreen,
|
||||
logs: LogViewerScreen,
|
||||
"tag-analysis": TagAnalysisScreen,
|
||||
};
|
||||
|
||||
const CurrentScreen = screens[appState.currentScreen];
|
||||
return <CurrentScreen />;
|
||||
};
|
||||
```
|
||||
|
||||
#### 4. StatusBar (Global Status Display)
|
||||
|
||||
```javascript
|
||||
const StatusBar = () => {
|
||||
const { connectionStatus, operationProgress } = useAppState();
|
||||
|
||||
return (
|
||||
<Box borderStyle="single" paddingX={1}>
|
||||
<Text color="green">● Connected</Text>
|
||||
<Text> | </Text>
|
||||
<Text>Progress: {operationProgress}%</Text>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### Screen Components
|
||||
|
||||
#### MainMenuScreen
|
||||
|
||||
- Navigation menu with keyboard shortcuts
|
||||
- Current configuration summary
|
||||
- Quick action buttons
|
||||
- Help information
|
||||
|
||||
#### ConfigurationScreen
|
||||
|
||||
- Environment variable editor
|
||||
- Input validation with real-time feedback
|
||||
- API connection testing
|
||||
- Save/cancel operations
|
||||
|
||||
#### OperationScreen
|
||||
|
||||
- Operation type selection (update/rollback)
|
||||
- Real-time progress display
|
||||
- Product processing information
|
||||
- Error handling and display
|
||||
|
||||
#### SchedulingScreen
|
||||
|
||||
- Date/time picker interface
|
||||
- Schedule management
|
||||
- Countdown display
|
||||
- Cancellation controls
|
||||
|
||||
#### LogViewerScreen
|
||||
|
||||
- Paginated log display
|
||||
- Search and filtering
|
||||
- Log entry details
|
||||
- Export functionality
|
||||
|
||||
#### TagAnalysisScreen
|
||||
|
||||
- Tag listing and statistics
|
||||
- Product count per tag
|
||||
- Sample product display
|
||||
- Recommendations
|
||||
|
||||
### Reusable UI Components
|
||||
|
||||
#### ProgressBar
|
||||
|
||||
```javascript
|
||||
const ProgressBar = ({ progress, label, color = "blue" }) => {
|
||||
const width = 40;
|
||||
const filled = Math.round((progress / 100) * width);
|
||||
|
||||
return (
|
||||
<Box flexDirection="column">
|
||||
<Text>{label}</Text>
|
||||
<Box>
|
||||
<Text color={color}>{"█".repeat(filled)}</Text>
|
||||
<Text color="gray">{"░".repeat(width - filled)}</Text>
|
||||
<Text> {progress}%</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
#### InputField
|
||||
|
||||
```javascript
|
||||
const InputField = ({ label, value, onChange, validation, placeholder }) => {
|
||||
const [isValid, setIsValid] = useState(true);
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" marginY={1}>
|
||||
<Text>{label}:</Text>
|
||||
<TextInput
|
||||
value={value}
|
||||
onChange={(val) => {
|
||||
onChange(val);
|
||||
setIsValid(validation ? validation(val) : true);
|
||||
}}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
{!isValid && <Text color="red">Invalid input</Text>}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
#### MenuList
|
||||
|
||||
```javascript
|
||||
const MenuList = ({ items, selectedIndex, onSelect }) => {
|
||||
return (
|
||||
<Box flexDirection="column">
|
||||
{items.map((item, index) => (
|
||||
<Box key={index} paddingX={2}>
|
||||
<Text color={index === selectedIndex ? "blue" : "white"}>
|
||||
{index === selectedIndex ? "► " : " "}
|
||||
{item.label}
|
||||
</Text>
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
## Data Models
|
||||
|
||||
### Application State
|
||||
|
||||
```javascript
|
||||
interface AppState {
|
||||
currentScreen: string;
|
||||
navigationHistory: string[];
|
||||
configuration: ConfigurationState;
|
||||
operationState: OperationState | null;
|
||||
uiState: UIState;
|
||||
}
|
||||
|
||||
interface ConfigurationState {
|
||||
shopifyDomain: string;
|
||||
accessToken: string;
|
||||
targetTag: string;
|
||||
priceAdjustment: number;
|
||||
operationMode: "update" | "rollback";
|
||||
isValid: boolean;
|
||||
lastTested: Date | null;
|
||||
}
|
||||
|
||||
interface OperationState {
|
||||
type: "update" | "rollback" | "scheduled";
|
||||
status: "idle" | "running" | "completed" | "error";
|
||||
progress: number;
|
||||
currentProduct: string | null;
|
||||
results: OperationResults | null;
|
||||
errors: Error[];
|
||||
}
|
||||
|
||||
interface UIState {
|
||||
focusedComponent: string;
|
||||
modalOpen: boolean;
|
||||
selectedMenuIndex: number;
|
||||
scrollPosition: number;
|
||||
}
|
||||
```
|
||||
|
||||
### Service Integration
|
||||
|
||||
```javascript
|
||||
interface ServiceIntegration {
|
||||
shopifyService: ShopifyService;
|
||||
productService: ProductService;
|
||||
progressService: ProgressService;
|
||||
configService: ConfigurationService;
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Error Categories
|
||||
|
||||
1. **Configuration Errors**: Invalid environment variables, API credentials
|
||||
2. **Network Errors**: Connection failures, timeout issues
|
||||
3. **API Errors**: Shopify API rate limits, authentication failures
|
||||
4. **UI Errors**: Component rendering issues, state inconsistencies
|
||||
5. **System Errors**: File system access, permission issues
|
||||
|
||||
### Error Display Strategy
|
||||
|
||||
```javascript
|
||||
const ErrorBoundary = ({ children }) => {
|
||||
const [error, setError] = useState(null);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Box
|
||||
flexDirection="column"
|
||||
padding={2}
|
||||
borderStyle="single"
|
||||
borderColor="red"
|
||||
>
|
||||
<Text color="red" bold>
|
||||
Error Occurred
|
||||
</Text>
|
||||
<Text>{error.message}</Text>
|
||||
<Text color="gray">Press 'r' to retry or 'q' to quit</Text>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return children;
|
||||
};
|
||||
```
|
||||
|
||||
### Graceful Degradation
|
||||
|
||||
- Fallback to basic text display if advanced features fail
|
||||
- Automatic retry mechanisms for network operations
|
||||
- State persistence to recover from crashes
|
||||
- Clear error messages with suggested actions
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Component Testing
|
||||
|
||||
```javascript
|
||||
// Example test using Ink's testing utilities
|
||||
import { render } from "ink-testing-library";
|
||||
import { MainMenuScreen } from "../screens/MainMenuScreen";
|
||||
|
||||
test("renders main menu with correct options", () => {
|
||||
const { lastFrame } = render(<MainMenuScreen />);
|
||||
expect(lastFrame()).toContain("Price Update Operations");
|
||||
expect(lastFrame()).toContain("Configuration");
|
||||
expect(lastFrame()).toContain("View Logs");
|
||||
});
|
||||
```
|
||||
|
||||
### Integration Testing
|
||||
|
||||
- Test service integration with mock services
|
||||
- Verify state management across screen transitions
|
||||
- Test keyboard navigation and input handling
|
||||
- Validate error handling scenarios
|
||||
|
||||
### Cross-Platform Testing
|
||||
|
||||
- Automated testing on Windows, macOS, and Linux
|
||||
- Terminal compatibility testing (Windows Terminal, Command Prompt, PowerShell)
|
||||
- Unicode and color support verification
|
||||
- Performance testing with large datasets
|
||||
|
||||
## Migration Strategy
|
||||
|
||||
### Phase 1: Setup and Core Infrastructure
|
||||
|
||||
1. Install Ink and related dependencies
|
||||
2. Create basic application structure
|
||||
3. Implement state management system
|
||||
4. Set up routing and navigation
|
||||
|
||||
### Phase 2: Screen Implementation
|
||||
|
||||
1. Implement MainMenuScreen (simplest)
|
||||
2. Create ConfigurationScreen with form handling
|
||||
3. Build OperationScreen with progress display
|
||||
4. Add remaining screens (Scheduling, Logs, TagAnalysis)
|
||||
|
||||
### Phase 3: Component Migration
|
||||
|
||||
1. Replace Blessed ProgressBar with Ink version
|
||||
2. Migrate form components and input handling
|
||||
3. Update navigation and keyboard shortcuts
|
||||
4. Implement error handling and validation
|
||||
|
||||
### Phase 4: Testing and Refinement
|
||||
|
||||
1. Comprehensive testing on Windows systems
|
||||
2. Performance optimization and bug fixes
|
||||
3. Documentation updates
|
||||
4. Legacy code cleanup
|
||||
|
||||
### Dependency Changes
|
||||
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"ink": "^4.4.1",
|
||||
"react": "^18.2.0",
|
||||
"@ink/text-input": "^5.0.1",
|
||||
"@ink/select-input": "^5.0.1",
|
||||
"@ink/spinner": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ink-testing-library": "^3.0.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### File Structure Changes
|
||||
|
||||
```
|
||||
src/
|
||||
├── tui/
|
||||
│ ├── components/
|
||||
│ │ ├── common/
|
||||
│ │ │ ├── ProgressBar.jsx
|
||||
│ │ │ ├── InputField.jsx
|
||||
│ │ │ ├── MenuList.jsx
|
||||
│ │ │ └── ErrorBoundary.jsx
|
||||
│ │ ├── screens/
|
||||
│ │ │ ├── MainMenuScreen.jsx
|
||||
│ │ │ ├── ConfigurationScreen.jsx
|
||||
│ │ │ ├── OperationScreen.jsx
|
||||
│ │ │ ├── SchedulingScreen.jsx
|
||||
│ │ │ ├── LogViewerScreen.jsx
|
||||
│ │ │ └── TagAnalysisScreen.jsx
|
||||
│ │ └── providers/
|
||||
│ │ ├── AppProvider.jsx
|
||||
│ │ └── ServiceProvider.jsx
|
||||
│ ├── hooks/
|
||||
│ │ ├── useAppState.js
|
||||
│ │ ├── useNavigation.js
|
||||
│ │ └── useServices.js
|
||||
│ ├── utils/
|
||||
│ │ ├── keyboardHandlers.js
|
||||
│ │ └── validation.js
|
||||
│ └── TuiApplication.jsx
|
||||
└── tui-entry.js (new entry point)
|
||||
```
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
### Rendering Optimization
|
||||
|
||||
- Use React.memo for expensive components
|
||||
- Implement virtual scrolling for large lists
|
||||
- Debounce rapid state updates
|
||||
- Minimize re-renders with proper state structure
|
||||
|
||||
### Memory Management
|
||||
|
||||
- Clean up event listeners and timers
|
||||
- Implement proper component unmounting
|
||||
- Use weak references for large data structures
|
||||
- Monitor memory usage during long operations
|
||||
|
||||
### Windows-Specific Optimizations
|
||||
|
||||
- Use Windows-compatible Unicode characters
|
||||
- Optimize for Windows Terminal performance
|
||||
- Handle Windows-specific keyboard events
|
||||
- Ensure proper color rendering in different terminals
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Input Validation
|
||||
|
||||
- Sanitize all user inputs
|
||||
- Validate configuration values
|
||||
- Prevent injection attacks through input fields
|
||||
- Secure handling of API credentials
|
||||
|
||||
### State Security
|
||||
|
||||
- Encrypt sensitive data in state
|
||||
- Clear sensitive information on exit
|
||||
- Prevent credential logging
|
||||
- Secure temporary file handling
|
||||
|
||||
This design provides a robust foundation for replacing Blessed with Ink, ensuring excellent Windows compatibility while maintaining all existing functionality and improving the overall user experience.
|
||||
151
.kiro/specs/windows-compatible-tui/requirements.md
Normal file
151
.kiro/specs/windows-compatible-tui/requirements.md
Normal file
@@ -0,0 +1,151 @@
|
||||
# Requirements Document
|
||||
|
||||
## Introduction
|
||||
|
||||
This document outlines the requirements for replacing the existing Blessed-based Terminal User Interface (TUI) with a Windows-compatible alternative. The current TUI implementation using the Blessed library has compatibility issues on Windows systems, requiring a migration to a more robust, cross-platform TUI library that provides better Windows support while maintaining all existing functionality and user experience expectations.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement 1
|
||||
|
||||
**User Story:** As a Windows user, I want a TUI that works reliably on my system, so that I can use the interactive interface without compatibility issues.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the TUI is launched on Windows THEN the system SHALL display correctly without rendering artifacts
|
||||
2. WHEN using Windows Terminal or Command Prompt THEN the system SHALL handle keyboard input properly
|
||||
3. WHEN the interface renders THEN the system SHALL display Unicode characters and colors correctly on Windows
|
||||
4. WHEN resizing the terminal window THEN the system SHALL adapt the layout appropriately
|
||||
5. WHEN using different Windows terminal emulators THEN the system SHALL maintain consistent behavior
|
||||
|
||||
### Requirement 2
|
||||
|
||||
**User Story:** As a developer, I want to replace Blessed with a better cross-platform TUI library, so that the application works consistently across all operating systems.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN selecting a replacement library THEN the system SHALL prioritize Windows compatibility
|
||||
2. WHEN the new library is integrated THEN the system SHALL maintain feature parity with the Blessed implementation
|
||||
3. WHEN the library is chosen THEN the system SHALL have active maintenance and good documentation
|
||||
4. WHEN implementing the replacement THEN the system SHALL support modern terminal features
|
||||
5. WHEN the migration is complete THEN the system SHALL remove all Blessed dependencies
|
||||
|
||||
### Requirement 3
|
||||
|
||||
**User Story:** As a user, I want the same TUI functionality after the library replacement, so that my workflow remains unchanged.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the new TUI loads THEN the system SHALL display the same main menu structure
|
||||
2. WHEN navigating the interface THEN the system SHALL support the same keyboard shortcuts
|
||||
3. WHEN configuring settings THEN the system SHALL provide the same configuration options
|
||||
4. WHEN running operations THEN the system SHALL show the same progress indicators
|
||||
5. WHEN viewing logs THEN the system SHALL display the same information format
|
||||
|
||||
### Requirement 4
|
||||
|
||||
**User Story:** As a user, I want improved performance and responsiveness in the new TUI, so that the interface feels more fluid and responsive.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the TUI starts THEN the system SHALL load faster than the Blessed version
|
||||
2. WHEN updating progress displays THEN the system SHALL render smoothly without flickering
|
||||
3. WHEN handling large amounts of log data THEN the system SHALL maintain responsive scrolling
|
||||
4. WHEN switching between screens THEN the system SHALL transition quickly
|
||||
5. WHEN processing user input THEN the system SHALL respond immediately
|
||||
|
||||
### Requirement 5
|
||||
|
||||
**User Story:** As a developer, I want the new TUI implementation to follow modern JavaScript patterns, so that the code is maintainable and extensible.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN implementing components THEN the system SHALL use ES6+ features and modern patterns
|
||||
2. WHEN structuring the code THEN the system SHALL follow the existing project architecture
|
||||
3. WHEN handling state THEN the system SHALL use clear state management patterns
|
||||
4. WHEN implementing event handling THEN the system SHALL use consistent event patterns
|
||||
5. WHEN writing tests THEN the system SHALL provide good test coverage for TUI components
|
||||
|
||||
### Requirement 6
|
||||
|
||||
**User Story:** As a user, I want enhanced visual feedback and better error handling in the new TUI, so that I have a clearer understanding of system status.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN errors occur THEN the system SHALL display more informative error messages
|
||||
2. WHEN operations are running THEN the system SHALL provide clearer progress visualization
|
||||
3. WHEN configuration is invalid THEN the system SHALL highlight specific issues
|
||||
4. WHEN API calls fail THEN the system SHALL show detailed connection status
|
||||
5. WHEN the system is busy THEN the system SHALL provide appropriate loading indicators
|
||||
|
||||
### Requirement 7
|
||||
|
||||
**User Story:** As a developer, I want the migration to preserve all existing service integrations, so that business logic remains unchanged.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the new TUI is implemented THEN the system SHALL reuse existing ShopifyService without changes
|
||||
2. WHEN operations run THEN the system SHALL use existing ProductService and ProgressService
|
||||
3. WHEN configuration is managed THEN the system SHALL use existing environment configuration
|
||||
4. WHEN logs are generated THEN the system SHALL maintain compatibility with existing log formats
|
||||
5. WHEN the migration is complete THEN the system SHALL pass all existing integration tests
|
||||
|
||||
### Requirement 8
|
||||
|
||||
**User Story:** As a user, I want better accessibility features in the new TUI, so that the interface is more inclusive and easier to use.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN using screen readers THEN the system SHALL provide appropriate text descriptions
|
||||
2. WHEN using high contrast mode THEN the system SHALL adapt color schemes appropriately
|
||||
3. WHEN using keyboard-only navigation THEN the system SHALL provide clear focus indicators
|
||||
4. WHEN text is displayed THEN the system SHALL support different font sizes and terminal settings
|
||||
5. WHEN colors are used THEN the system SHALL ensure sufficient contrast ratios
|
||||
|
||||
### Requirement 9
|
||||
|
||||
**User Story:** As a developer, I want comprehensive documentation for the new TUI library choice, so that future maintenance is straightforward.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the library is selected THEN the system SHALL document the selection rationale
|
||||
2. WHEN implementation patterns are established THEN the system SHALL document coding conventions
|
||||
3. WHEN components are created THEN the system SHALL include inline documentation
|
||||
4. WHEN the migration is complete THEN the system SHALL update all relevant README files
|
||||
5. WHEN troubleshooting guides are needed THEN the system SHALL provide Windows-specific guidance
|
||||
|
||||
### Requirement 10
|
||||
|
||||
**User Story:** As a user, I want the new TUI to handle terminal resizing and different screen sizes better, so that I can use it on various display configurations.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the terminal is resized THEN the system SHALL automatically adjust layout proportions
|
||||
2. WHEN using small terminal windows THEN the system SHALL provide appropriate scrolling
|
||||
3. WHEN using large displays THEN the system SHALL utilize available space effectively
|
||||
4. WHEN switching between portrait and landscape orientations THEN the system SHALL adapt accordingly
|
||||
5. WHEN minimum size requirements aren't met THEN the system SHALL display helpful guidance
|
||||
|
||||
### Requirement 11
|
||||
|
||||
**User Story:** As a developer, I want a smooth migration path from Blessed to the new library, so that the transition minimizes disruption.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN planning the migration THEN the system SHALL identify all Blessed-specific code
|
||||
2. WHEN implementing replacements THEN the system SHALL maintain API compatibility where possible
|
||||
3. WHEN testing the migration THEN the system SHALL verify functionality on multiple Windows versions
|
||||
4. WHEN deploying the changes THEN the system SHALL provide fallback options if issues arise
|
||||
5. WHEN the migration is complete THEN the system SHALL clean up all legacy Blessed code
|
||||
|
||||
### Requirement 12
|
||||
|
||||
**User Story:** As a user, I want the new TUI to support modern terminal features, so that I can take advantage of enhanced terminal capabilities.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN using modern terminals THEN the system SHALL support true color (24-bit) display
|
||||
2. WHEN terminals support it THEN the system SHALL use enhanced Unicode characters
|
||||
3. WHEN available THEN the system SHALL support mouse interaction for navigation
|
||||
4. WHEN terminals provide it THEN the system SHALL use improved cursor positioning
|
||||
5. WHEN modern features are unavailable THEN the system SHALL gracefully degrade functionality
|
||||
268
.kiro/specs/windows-compatible-tui/tasks.md
Normal file
268
.kiro/specs/windows-compatible-tui/tasks.md
Normal file
@@ -0,0 +1,268 @@
|
||||
# Implementation Plan
|
||||
|
||||
- [ ] 1. Setup Ink infrastructure and remove Blessed dependencies
|
||||
|
||||
- Remove blessed dependency from package.json and install Ink dependencies
|
||||
- Create new TUI entry point file that initializes Ink application
|
||||
- Set up basic React component structure with JSX support
|
||||
- _Requirements: 2.2, 2.5_
|
||||
|
||||
- [ ] 2. Implement core application structure and state management
|
||||
|
||||
- Create AppProvider component with React Context for global state management
|
||||
- Implement Router component for screen navigation and history management
|
||||
- Create useAppState and useNavigation custom hooks for state access
|
||||
- Write unit tests for state management and navigation logic
|
||||
- _Requirements: 5.1, 5.3, 7.1_
|
||||
|
||||
- [ ] 3. Build reusable UI components
|
||||
- [ ] 3.1 Create ProgressBar component with Ink
|
||||
|
||||
- Replace Blessed ProgressBar with Ink-based implementation using Box and Text components
|
||||
- Add support for different colors, labels, and progress indicators
|
||||
- Write unit tests for ProgressBar component rendering and updates
|
||||
- _Requirements: 3.1, 4.2, 6.2_
|
||||
|
||||
- [ ] 3.2 Implement InputField component with validation
|
||||
|
||||
- Create InputField component using Ink's TextInput with validation support
|
||||
- Add real-time validation feedback and error message display
|
||||
- Write unit tests for input validation and error handling
|
||||
- _Requirements: 3.2, 6.3, 8.3_
|
||||
|
||||
- [ ] 3.3 Create MenuList component for navigation
|
||||
|
||||
- Implement MenuList component with keyboard navigation support
|
||||
- Add selection highlighting and keyboard shortcut display
|
||||
- Write unit tests for menu navigation and selection handling
|
||||
- _Requirements: 1.2, 9.3, 9.4_
|
||||
|
||||
- [ ] 3.4 Build ErrorBoundary component for error handling
|
||||
|
||||
- Create ErrorBoundary component to catch and display React errors gracefully
|
||||
- Implement error recovery mechanisms and user-friendly error messages
|
||||
- Write unit tests for error boundary functionality
|
||||
- _Requirements: 6.1, 10.4, 11.4_
|
||||
|
||||
- [ ] 4. Implement StatusBar component
|
||||
|
||||
- Create StatusBar component showing connection status and operation progress
|
||||
- Integrate with existing services to display real-time system status
|
||||
- Add support for different status indicators and colors
|
||||
- Write unit tests for status display and updates
|
||||
- _Requirements: 8.1, 8.2, 8.3_
|
||||
|
||||
- [ ] 5. Create MainMenuScreen component
|
||||
|
||||
- Implement MainMenuScreen as the primary navigation interface
|
||||
- Add keyboard shortcuts and menu options matching existing TUI requirements
|
||||
- Integrate with navigation system for screen transitions
|
||||
- Write unit tests for menu functionality and navigation
|
||||
- _Requirements: 1.1, 1.3, 3.1, 9.1_
|
||||
|
||||
- [ ] 6. Build ConfigurationScreen component
|
||||
- [ ] 6.1 Create configuration form interface
|
||||
|
||||
- Implement ConfigurationScreen with form fields for all environment variables
|
||||
- Add input validation and real-time feedback for configuration values
|
||||
- Write unit tests for form validation and state management
|
||||
- _Requirements: 2.1, 2.2, 2.4_
|
||||
|
||||
- [ ] 6.2 Implement configuration persistence
|
||||
|
||||
- Add functionality to save configuration changes to .env file
|
||||
- Implement configuration loading and validation on screen load
|
||||
- Write unit tests for configuration file operations
|
||||
- _Requirements: 2.3, 7.4, 11.4_
|
||||
|
||||
- [ ] 6.3 Add API connection testing
|
||||
|
||||
- Integrate Shopify API connection testing within configuration screen
|
||||
- Display connection status and error messages for failed connections
|
||||
- Write unit tests for API connection testing functionality
|
||||
- _Requirements: 2.5, 6.4, 8.1_
|
||||
|
||||
- [ ] 7. Implement OperationScreen component
|
||||
- [ ] 7.1 Create operation selection interface
|
||||
|
||||
- Build OperationScreen with update/rollback operation selection
|
||||
- Display current configuration summary before operation execution
|
||||
- Write unit tests for operation selection and configuration display
|
||||
- _Requirements: 3.1, 4.1, 7.2_
|
||||
|
||||
- [ ] 7.2 Add real-time progress display
|
||||
|
||||
- Implement real-time progress indicators using ProgressBar component
|
||||
- Display current product information and processing status
|
||||
- Write unit tests for progress display and updates
|
||||
- _Requirements: 3.2, 3.3, 4.2, 8.2_
|
||||
|
||||
- [ ] 7.3 Integrate operation results display
|
||||
|
||||
- Add results summary display for completed operations
|
||||
- Implement error display panel for operation failures
|
||||
- Write unit tests for results display and error handling
|
||||
- _Requirements: 3.4, 3.5, 4.3, 6.1_
|
||||
|
||||
- [ ] 8. Build SchedulingScreen component
|
||||
- [ ] 8.1 Create scheduling interface
|
||||
|
||||
- Implement SchedulingScreen with date/time picker functionality
|
||||
- Add schedule management and countdown timer display
|
||||
- Write unit tests for scheduling interface and timer functionality
|
||||
- _Requirements: 5.1, 5.2, 5.3_
|
||||
|
||||
- [ ] 8.2 Add schedule cancellation and notifications
|
||||
|
||||
- Implement schedule cancellation with confirmation dialog
|
||||
- Add visual notifications for approaching scheduled operations
|
||||
- Write unit tests for cancellation and notification systems
|
||||
- _Requirements: 5.4, 5.5_
|
||||
|
||||
- [ ] 9. Create LogViewerScreen component
|
||||
- [ ] 9.1 Implement log display with pagination
|
||||
|
||||
- Build LogViewerScreen with paginated log entry display
|
||||
- Add scrolling support for large log files
|
||||
- Write unit tests for log display and pagination
|
||||
- _Requirements: 6.1, 6.4, 10.3_
|
||||
|
||||
- [ ] 9.2 Add log filtering and search functionality
|
||||
|
||||
- Implement search and filtering capabilities for log entries
|
||||
- Add detailed view for selected log entries
|
||||
- Write unit tests for search and filtering functionality
|
||||
- _Requirements: 6.2, 6.3_
|
||||
|
||||
- [ ] 9.3 Integrate automatic log refresh
|
||||
|
||||
- Add automatic refresh functionality for active log monitoring
|
||||
- Implement efficient update mechanisms to avoid performance issues
|
||||
- Write unit tests for automatic refresh and performance
|
||||
- _Requirements: 6.5, 4.3_
|
||||
|
||||
- [ ] 10. Build TagAnalysisScreen component
|
||||
- [ ] 10.1 Create tag analysis interface
|
||||
|
||||
- Implement TagAnalysisScreen displaying available product tags and counts
|
||||
- Add sample product display for selected tags
|
||||
- Write unit tests for tag analysis display and selection
|
||||
- _Requirements: 7.1, 7.2, 7.3_
|
||||
|
||||
- [ ] 10.2 Add tag recommendations
|
||||
|
||||
- Implement recommendation system for optimal target tags
|
||||
- Display analysis results and suggestions to users
|
||||
- Write unit tests for recommendation logic and display
|
||||
- _Requirements: 7.4_
|
||||
|
||||
- [ ] 11. Implement keyboard navigation and shortcuts
|
||||
- [ ] 11.1 Add global keyboard handlers
|
||||
|
||||
- Create keyboard event handlers for navigation and shortcuts
|
||||
- Implement consistent back/exit functionality across all screens
|
||||
- Write unit tests for keyboard navigation and event handling
|
||||
- _Requirements: 9.1, 9.3, 9.4_
|
||||
|
||||
- [ ] 11.2 Create help system
|
||||
|
||||
- Implement help overlay displaying available shortcuts and navigation
|
||||
- Add context-sensitive help for different screens
|
||||
- Write unit tests for help system functionality
|
||||
- _Requirements: 9.2, 9.5_
|
||||
|
||||
- [ ] 12. Integrate with existing services
|
||||
- [ ] 12.1 Connect TUI to ShopifyService
|
||||
|
||||
- Integrate TUI components with existing ShopifyService for API operations
|
||||
- Ensure all API calls use existing service methods without modification
|
||||
- Write integration tests for service connectivity
|
||||
- _Requirements: 7.1, 12.1_
|
||||
|
||||
- [ ] 12.2 Connect TUI to ProductService and ProgressService
|
||||
|
||||
- Integrate TUI with existing ProductService for product operations
|
||||
- Connect ProgressService for logging and progress tracking
|
||||
- Write integration tests for service integration
|
||||
- _Requirements: 7.2, 12.2, 12.3_
|
||||
|
||||
- [ ] 12.3 Maintain CLI compatibility
|
||||
|
||||
- Ensure TUI implementation doesn't break existing CLI functionality
|
||||
- Verify that both interfaces can coexist and use same configuration
|
||||
- Write integration tests for CLI/TUI compatibility
|
||||
- _Requirements: 12.3, 12.4_
|
||||
|
||||
- [ ] 13. Implement responsive layout and terminal handling
|
||||
- [ ] 13.1 Add terminal resize handling
|
||||
|
||||
- Implement automatic layout adjustment for terminal resize events
|
||||
- Add minimum size requirements and appropriate messaging
|
||||
- Write unit tests for resize handling and layout adaptation
|
||||
- _Requirements: 10.1, 10.2, 10.5_
|
||||
|
||||
- [ ] 13.2 Optimize for different screen sizes
|
||||
|
||||
- Implement responsive design for small and large terminal windows
|
||||
- Add scrolling support where needed for content overflow
|
||||
- Write unit tests for different screen size scenarios
|
||||
- _Requirements: 10.2, 10.3, 10.4_
|
||||
|
||||
- [ ] 14. Add accessibility and modern terminal features
|
||||
- [ ] 14.1 Implement accessibility features
|
||||
|
||||
- Add screen reader support and high contrast mode compatibility
|
||||
- Implement clear focus indicators for keyboard navigation
|
||||
- Write tests for accessibility features
|
||||
- _Requirements: 8.1, 8.2, 8.3_
|
||||
|
||||
- [ ] 14.2 Add modern terminal feature support
|
||||
|
||||
- Implement true color support and enhanced Unicode character usage
|
||||
- Add mouse interaction support where appropriate
|
||||
- Write tests for modern terminal feature detection and usage
|
||||
- _Requirements: 12.1, 12.2, 12.3_
|
||||
|
||||
- [ ] 15. Performance optimization and testing
|
||||
- [ ] 15.1 Optimize rendering performance
|
||||
|
||||
- Implement React.memo for expensive components and virtual scrolling for large lists
|
||||
- Add debouncing for rapid state updates and minimize unnecessary re-renders
|
||||
- Write performance tests and benchmarks
|
||||
- _Requirements: 4.1, 4.3, 4.4_
|
||||
|
||||
- [ ] 15.2 Add memory management
|
||||
|
||||
- Implement proper cleanup for event listeners and timers
|
||||
- Add memory usage monitoring for long-running operations
|
||||
- Write tests for memory leak detection and cleanup
|
||||
- _Requirements: 4.2, 4.5_
|
||||
|
||||
- [ ] 16. Cross-platform testing and Windows optimization
|
||||
- [ ] 16.1 Test Windows compatibility
|
||||
|
||||
- Run comprehensive tests on Windows Terminal, Command Prompt, and PowerShell
|
||||
- Verify Unicode character rendering and color support on Windows
|
||||
- Write Windows-specific integration tests
|
||||
- _Requirements: 1.1, 1.2, 1.3, 1.4_
|
||||
|
||||
- [ ] 16.2 Optimize for Windows performance
|
||||
|
||||
- Implement Windows-specific optimizations for terminal rendering
|
||||
- Add Windows-specific keyboard event handling
|
||||
- Write performance tests specifically for Windows environments
|
||||
- _Requirements: 1.5, 4.4_
|
||||
|
||||
- [ ] 17. Documentation and migration cleanup
|
||||
- [ ] 17.1 Update documentation
|
||||
|
||||
- Update README files with new TUI library information and setup instructions
|
||||
- Document new component architecture and development patterns
|
||||
- Create troubleshooting guide for Windows-specific issues
|
||||
- _Requirements: 9.1, 9.2, 9.4_
|
||||
|
||||
- [ ] 17.2 Clean up legacy Blessed code
|
||||
- Remove all Blessed dependencies and related code files
|
||||
- Clean up any remaining references to Blessed in documentation
|
||||
- Verify complete migration through final testing
|
||||
- _Requirements: 2.5, 11.5_
|
||||
Reference in New Issue
Block a user