Feature Complete (Untested)
This commit is contained in:
@@ -77,7 +77,7 @@
|
|||||||
- Test system behavior with distant future dates and warning display
|
- Test system behavior with distant future dates and warning display
|
||||||
- _Requirements: 1.4, 4.3, 4.4, 5.3_
|
- _Requirements: 1.4, 4.3, 4.4, 5.3_
|
||||||
|
|
||||||
- [ ] 12. Update package.json scripts for scheduled operations
|
- [x] 12. Update package.json scripts for scheduled operations
|
||||||
|
|
||||||
- Add npm scripts for common scheduling scenarios (e.g., schedule-update, schedule-rollback)
|
- Add npm scripts for common scheduling scenarios (e.g., schedule-update, schedule-rollback)
|
||||||
- Include examples in script comments for typical scheduling use cases
|
- Include examples in script comments for typical scheduling use cases
|
||||||
|
|||||||
388
.kiro/specs/shopify-tui/design.md
Normal file
388
.kiro/specs/shopify-tui/design.md
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
# Design Document
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The Shopify Price Updater TUI will be built as a Node.js terminal user interface that provides an interactive, menu-driven experience for all existing functionality. The design leverages the `blessed` library for robust terminal UI components and maintains complete integration with the existing service layer architecture. The TUI will serve as an alternative interface to the CLI while preserving all existing functionality and logging behavior.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
### High-Level Architecture
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
graph TB
|
||||||
|
A[TUI Entry Point] --> B[TUI Application Controller]
|
||||||
|
B --> C[Screen Manager]
|
||||||
|
C --> D[Main Menu Screen]
|
||||||
|
C --> E[Configuration Screen]
|
||||||
|
C --> F[Operations Screen]
|
||||||
|
C --> G[Scheduling Screen]
|
||||||
|
C --> H[Logs Screen]
|
||||||
|
C --> I[Tag Analysis Screen]
|
||||||
|
|
||||||
|
B --> J[State Manager]
|
||||||
|
B --> K[Existing Services Layer]
|
||||||
|
|
||||||
|
K --> L[ProductService]
|
||||||
|
K --> M[ShopifyService]
|
||||||
|
K --> N[ProgressService]
|
||||||
|
K --> O[ScheduleService]
|
||||||
|
|
||||||
|
J --> P[Configuration State]
|
||||||
|
J --> Q[Operation State]
|
||||||
|
J --> R[UI State]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Component Layers
|
||||||
|
|
||||||
|
1. **TUI Layer**: User interface components and screen management
|
||||||
|
2. **State Management Layer**: Application state and configuration management
|
||||||
|
3. **Integration Layer**: Bridges TUI with existing services
|
||||||
|
4. **Service Layer**: Existing business logic (unchanged)
|
||||||
|
|
||||||
|
## Components and Interfaces
|
||||||
|
|
||||||
|
### Core TUI Components
|
||||||
|
|
||||||
|
#### TUIApplication
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
class TUIApplication {
|
||||||
|
constructor()
|
||||||
|
initialize()
|
||||||
|
run()
|
||||||
|
shutdown()
|
||||||
|
handleGlobalKeypress(key)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Responsibilities:**
|
||||||
|
|
||||||
|
- Application lifecycle management
|
||||||
|
- Global keyboard shortcuts
|
||||||
|
- Screen routing and navigation
|
||||||
|
- Integration with existing services
|
||||||
|
|
||||||
|
#### ScreenManager
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
class ScreenManager {
|
||||||
|
constructor(blessed, stateManager)
|
||||||
|
registerScreen(name, screenClass)
|
||||||
|
showScreen(name, params)
|
||||||
|
getCurrentScreen()
|
||||||
|
goBack()
|
||||||
|
showModal(content, options)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Responsibilities:**
|
||||||
|
|
||||||
|
- Screen lifecycle management
|
||||||
|
- Navigation history
|
||||||
|
- Modal dialog management
|
||||||
|
- Screen transitions
|
||||||
|
|
||||||
|
#### StateManager
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
class StateManager {
|
||||||
|
constructor()
|
||||||
|
getConfiguration()
|
||||||
|
updateConfiguration(key, value)
|
||||||
|
validateConfiguration()
|
||||||
|
saveConfiguration()
|
||||||
|
getOperationState()
|
||||||
|
updateOperationState(state)
|
||||||
|
subscribe(event, callback)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Responsibilities:**
|
||||||
|
|
||||||
|
- Centralized state management
|
||||||
|
- Configuration persistence
|
||||||
|
- State change notifications
|
||||||
|
- Validation coordination
|
||||||
|
|
||||||
|
### Screen Components
|
||||||
|
|
||||||
|
#### MainMenuScreen
|
||||||
|
|
||||||
|
- **Purpose**: Primary navigation hub
|
||||||
|
- **Features**: Menu options, status indicators, quick actions
|
||||||
|
- **Navigation**: Routes to all other screens
|
||||||
|
|
||||||
|
#### ConfigurationScreen
|
||||||
|
|
||||||
|
- **Purpose**: Environment variable management
|
||||||
|
- **Features**: Form inputs, validation, API testing
|
||||||
|
- **Components**: Input fields, validation messages, save/cancel buttons
|
||||||
|
|
||||||
|
#### OperationsScreen
|
||||||
|
|
||||||
|
- **Purpose**: Price update and rollback execution
|
||||||
|
- **Features**: Operation selection, progress tracking, results display
|
||||||
|
- **Components**: Progress bars, product lists, error panels
|
||||||
|
|
||||||
|
#### SchedulingScreen
|
||||||
|
|
||||||
|
- **Purpose**: Scheduled operation management
|
||||||
|
- **Features**: Date/time picker, countdown display, cancellation
|
||||||
|
- **Components**: Calendar widget, time input, countdown timer
|
||||||
|
|
||||||
|
#### LogsScreen
|
||||||
|
|
||||||
|
- **Purpose**: Operation history and log viewing
|
||||||
|
- **Features**: Log filtering, search, pagination
|
||||||
|
- **Components**: Log list, search bar, filter controls
|
||||||
|
|
||||||
|
#### TagAnalysisScreen
|
||||||
|
|
||||||
|
- **Purpose**: Product tag debugging and analysis
|
||||||
|
- **Features**: Tag listing, product counts, sample display
|
||||||
|
- **Components**: Tag tree, product preview, statistics panel
|
||||||
|
|
||||||
|
### UI Component Library
|
||||||
|
|
||||||
|
#### Common Components
|
||||||
|
|
||||||
|
- **FormField**: Reusable input component with validation
|
||||||
|
- **ProgressBar**: Animated progress indicator
|
||||||
|
- **StatusBar**: Global status and connection indicator
|
||||||
|
- **ErrorPanel**: Error display with retry options
|
||||||
|
- **ConfirmDialog**: Modal confirmation dialogs
|
||||||
|
- **HelpOverlay**: Context-sensitive help system
|
||||||
|
|
||||||
|
## Data Models
|
||||||
|
|
||||||
|
### Configuration Model
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
shopifyShopDomain: string,
|
||||||
|
shopifyAccessToken: string,
|
||||||
|
targetTag: string,
|
||||||
|
priceAdjustmentPercentage: number,
|
||||||
|
operationMode: 'update' | 'rollback',
|
||||||
|
isScheduled: boolean,
|
||||||
|
scheduledExecutionTime: Date,
|
||||||
|
isValid: boolean,
|
||||||
|
validationErrors: string[]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Operation State Model
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
currentOperation: 'idle' | 'fetching' | 'updating' | 'rollback' | 'scheduled',
|
||||||
|
progress: {
|
||||||
|
current: number,
|
||||||
|
total: number,
|
||||||
|
percentage: number,
|
||||||
|
currentProduct: string
|
||||||
|
},
|
||||||
|
results: {
|
||||||
|
totalProducts: number,
|
||||||
|
totalVariants: number,
|
||||||
|
successfulUpdates: number,
|
||||||
|
failedUpdates: number,
|
||||||
|
errors: Array
|
||||||
|
},
|
||||||
|
canCancel: boolean
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### UI State Model
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
currentScreen: string,
|
||||||
|
navigationHistory: string[],
|
||||||
|
modalStack: Array,
|
||||||
|
globalMessages: Array,
|
||||||
|
keyboardShortcuts: Object,
|
||||||
|
theme: Object
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Handling
|
||||||
|
|
||||||
|
### Error Categories
|
||||||
|
|
||||||
|
1. **Configuration Errors**: Invalid environment variables, API credentials
|
||||||
|
2. **Network Errors**: Shopify API connectivity issues
|
||||||
|
3. **Operation Errors**: Price update failures, validation errors
|
||||||
|
4. **UI Errors**: Screen rendering issues, input validation
|
||||||
|
|
||||||
|
### Error Handling Strategy
|
||||||
|
|
||||||
|
- **Graceful Degradation**: UI remains functional during errors
|
||||||
|
- **User-Friendly Messages**: Technical errors translated to user language
|
||||||
|
- **Recovery Options**: Retry mechanisms and alternative actions
|
||||||
|
- **Error Logging**: All errors logged to existing progress system
|
||||||
|
|
||||||
|
### Error Display Components
|
||||||
|
|
||||||
|
- **Inline Validation**: Real-time input validation feedback
|
||||||
|
- **Error Panels**: Dedicated error display areas
|
||||||
|
- **Toast Notifications**: Temporary error messages
|
||||||
|
- **Modal Dialogs**: Critical error handling
|
||||||
|
|
||||||
|
## Testing Strategy
|
||||||
|
|
||||||
|
### Unit Testing
|
||||||
|
|
||||||
|
- **Component Testing**: Individual screen and component functionality
|
||||||
|
- **State Management Testing**: Configuration and state transitions
|
||||||
|
- **Integration Testing**: TUI-to-service layer integration
|
||||||
|
- **Mock Testing**: Shopify API interactions
|
||||||
|
|
||||||
|
### Test Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
tests/
|
||||||
|
├── tui/
|
||||||
|
│ ├── components/
|
||||||
|
│ │ ├── screens/
|
||||||
|
│ │ └── common/
|
||||||
|
│ ├── state/
|
||||||
|
│ └── integration/
|
||||||
|
└── fixtures/
|
||||||
|
└── tui-test-data.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing Approach
|
||||||
|
|
||||||
|
- **Blessed Testing**: Use blessed's testing utilities for UI components
|
||||||
|
- **State Testing**: Verify state transitions and persistence
|
||||||
|
- **Service Integration**: Ensure existing services work unchanged
|
||||||
|
- **User Journey Testing**: End-to-end workflow validation
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
|
||||||
|
### Technology Stack
|
||||||
|
|
||||||
|
- **UI Framework**: `blessed` - Mature, feature-rich terminal UI library
|
||||||
|
- **State Management**: Custom implementation using EventEmitter pattern
|
||||||
|
- **Configuration**: Extend existing environment.js configuration system
|
||||||
|
- **Logging**: Integrate with existing ProgressService for consistent logging
|
||||||
|
|
||||||
|
### Key Design Decisions
|
||||||
|
|
||||||
|
#### Choice of Blessed Library
|
||||||
|
|
||||||
|
- **Rationale**: Mature, well-documented, extensive widget library
|
||||||
|
- **Benefits**: Rich component set, event handling, layout management
|
||||||
|
- **Alternatives Considered**: Ink (React-based), terminal-kit, raw ANSI
|
||||||
|
|
||||||
|
#### State Management Pattern
|
||||||
|
|
||||||
|
- **Rationale**: Centralized state with event-driven updates
|
||||||
|
- **Benefits**: Predictable state changes, easy debugging, component isolation
|
||||||
|
- **Implementation**: Custom StateManager with EventEmitter for notifications
|
||||||
|
|
||||||
|
#### Service Integration Strategy
|
||||||
|
|
||||||
|
- **Rationale**: Preserve existing service layer without modifications
|
||||||
|
- **Benefits**: Maintains existing functionality, easier testing, reduced risk
|
||||||
|
- **Implementation**: TUI acts as alternative controller layer
|
||||||
|
|
||||||
|
### Screen Layout Design
|
||||||
|
|
||||||
|
#### Main Menu Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─ Shopify Price Updater TUI ─────────────────────────────────┐
|
||||||
|
│ Status: Connected ✓ | Config: Valid ✓ | Last Run: 2h ago │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ │
|
||||||
|
│ 1. Configure Settings │
|
||||||
|
│ 2. Update Prices │
|
||||||
|
│ 3. Rollback Prices │
|
||||||
|
│ 4. Schedule Operation │
|
||||||
|
│ 5. View Logs │
|
||||||
|
│ 6. Analyze Tags │
|
||||||
|
│ 7. Help │
|
||||||
|
│ 8. Exit │
|
||||||
|
│ │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ Press number key or use arrows + Enter | F1: Help | Q: Quit │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Operations Screen Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─ Price Update Operation ────────────────────────────────────┐
|
||||||
|
│ Target Tag: sale-items | Adjustment: +15% | Mode: Update │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ Progress: [████████████████████████████████████████] 85% │
|
||||||
|
│ Products: 127/150 | Variants: 342/400 | Errors: 3 │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ Current Product: "Premium Widget Set" │
|
||||||
|
│ Status: Updating variant prices... │
|
||||||
|
│ │
|
||||||
|
│ Recent Errors: │
|
||||||
|
│ • Product "Basic Kit": Invalid price format │
|
||||||
|
│ • Product "Deluxe Set": API rate limit (retrying...) │
|
||||||
|
│ │
|
||||||
|
├─────────────────────────────────────────────────────────────┤
|
||||||
|
│ ESC: Cancel (if safe) | F1: Help | Space: Pause/Resume │
|
||||||
|
└─────────────────────────────────────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Keyboard Navigation Design
|
||||||
|
|
||||||
|
- **Global Shortcuts**: F1 (Help), ESC (Back/Cancel), Q (Quit)
|
||||||
|
- **Menu Navigation**: Arrow keys, Tab, Enter, Number keys
|
||||||
|
- **Form Navigation**: Tab/Shift+Tab, Enter (submit), ESC (cancel)
|
||||||
|
- **List Navigation**: Arrow keys, Page Up/Down, Home/End
|
||||||
|
|
||||||
|
### Theme and Styling
|
||||||
|
|
||||||
|
- **Color Scheme**: Terminal-friendly colors with fallbacks
|
||||||
|
- **Status Indicators**: Unicode symbols with text alternatives
|
||||||
|
- **Progress Indicators**: ASCII progress bars with percentage
|
||||||
|
- **Responsive Design**: Adapts to different terminal sizes
|
||||||
|
|
||||||
|
## Integration Points
|
||||||
|
|
||||||
|
### Existing Service Integration
|
||||||
|
|
||||||
|
- **ProductService**: Direct integration for all product operations
|
||||||
|
- **ShopifyService**: API connectivity and authentication
|
||||||
|
- **ProgressService**: Logging integration for audit trail
|
||||||
|
- **ScheduleService**: Scheduling functionality integration
|
||||||
|
|
||||||
|
### Configuration Integration
|
||||||
|
|
||||||
|
- **Environment Variables**: Read/write to existing .env system
|
||||||
|
- **Validation**: Use existing configuration validation logic
|
||||||
|
- **Persistence**: Maintain compatibility with CLI configuration
|
||||||
|
|
||||||
|
### Logging Integration
|
||||||
|
|
||||||
|
- **Progress.md**: Continue writing to existing log file
|
||||||
|
- **Console Output**: Maintain existing log format for compatibility
|
||||||
|
- **Error Tracking**: Use existing error categorization and handling
|
||||||
|
|
||||||
|
## Performance Considerations
|
||||||
|
|
||||||
|
### Memory Management
|
||||||
|
|
||||||
|
- **Screen Caching**: Cache frequently used screens
|
||||||
|
- **Event Cleanup**: Proper event listener cleanup on screen changes
|
||||||
|
- **Large Data Sets**: Pagination for large product lists and logs
|
||||||
|
|
||||||
|
### Responsiveness
|
||||||
|
|
||||||
|
- **Async Operations**: Non-blocking UI during API calls
|
||||||
|
- **Progress Feedback**: Real-time progress updates
|
||||||
|
- **Cancellation**: Safe operation cancellation where possible
|
||||||
|
|
||||||
|
### Terminal Compatibility
|
||||||
|
|
||||||
|
- **Size Adaptation**: Responsive layout for different terminal sizes
|
||||||
|
- **Color Support**: Graceful fallback for terminals without color
|
||||||
|
- **Unicode Support**: ASCII alternatives for Unicode characters
|
||||||
147
.kiro/specs/shopify-tui/requirements.md
Normal file
147
.kiro/specs/shopify-tui/requirements.md
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# Requirements Document
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This document outlines the requirements for building a Terminal User Interface (TUI) for the Shopify Price Updater script. The TUI will provide an interactive, menu-driven interface that allows users to configure settings, execute operations, schedule price updates, and monitor progress without needing to use command-line arguments or edit environment files directly. The interface will make the tool more accessible to non-technical users while maintaining all existing functionality.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
### Requirement 1
|
||||||
|
|
||||||
|
**User Story:** As a store owner, I want a visual terminal interface to interact with the price updater, so that I can easily access all features without memorizing command-line options.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN the TUI is launched THEN the system SHALL display a main menu with clearly labeled options
|
||||||
|
2. WHEN a user navigates the interface THEN the system SHALL provide keyboard shortcuts and arrow key navigation
|
||||||
|
3. WHEN a user selects an option THEN the system SHALL provide immediate visual feedback
|
||||||
|
4. WHEN the interface is displayed THEN the system SHALL show the current configuration status
|
||||||
|
|
||||||
|
### Requirement 2
|
||||||
|
|
||||||
|
**User Story:** As a user, I want to configure all environment variables through the TUI, so that I don't need to manually edit .env files.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN a user selects configuration settings THEN the system SHALL display all current environment variables
|
||||||
|
2. WHEN a user modifies a setting THEN the system SHALL validate the input before saving
|
||||||
|
3. WHEN configuration is saved THEN the system SHALL update the .env file automatically
|
||||||
|
4. WHEN invalid configuration is entered THEN the system SHALL display clear error messages
|
||||||
|
5. WHEN configuration is complete THEN the system SHALL test the Shopify API connection
|
||||||
|
|
||||||
|
### Requirement 3
|
||||||
|
|
||||||
|
**User Story:** As a user, I want to execute price update operations from the TUI, so that I can run operations with visual progress feedback.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN a user selects price update THEN the system SHALL display current configuration summary
|
||||||
|
2. WHEN an operation starts THEN the system SHALL show real-time progress indicators
|
||||||
|
3. WHEN products are being processed THEN the system SHALL display current product information
|
||||||
|
4. WHEN an operation completes THEN the system SHALL show detailed results summary
|
||||||
|
5. WHEN errors occur THEN the system SHALL display them in a dedicated error panel
|
||||||
|
|
||||||
|
### Requirement 4
|
||||||
|
|
||||||
|
**User Story:** As a user, I want to execute rollback operations from the TUI, so that I can easily revert price changes with visual confirmation.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN a user selects rollback THEN the system SHALL display eligible products for rollback
|
||||||
|
2. WHEN rollback starts THEN the system SHALL show progress with rollback-specific indicators
|
||||||
|
3. WHEN rollback completes THEN the system SHALL display rollback-specific results
|
||||||
|
4. WHEN no eligible products exist THEN the system SHALL clearly inform the user
|
||||||
|
|
||||||
|
### Requirement 5
|
||||||
|
|
||||||
|
**User Story:** As a user, I want to schedule price updates through the TUI, so that I can set up automated operations with a visual interface.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN a user selects scheduling THEN the system SHALL provide date/time picker interface
|
||||||
|
2. WHEN a schedule is set THEN the system SHALL display countdown timer with cancellation option
|
||||||
|
3. WHEN scheduled time approaches THEN the system SHALL provide visual and audio notifications
|
||||||
|
4. WHEN a scheduled operation is cancelled THEN the system SHALL confirm cancellation clearly
|
||||||
|
5. WHEN scheduling is active THEN the system SHALL prevent conflicting operations
|
||||||
|
|
||||||
|
### Requirement 6
|
||||||
|
|
||||||
|
**User Story:** As a user, I want to view operation logs and history through the TUI, so that I can review past operations without opening external files.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN a user selects log viewer THEN the system SHALL display recent operation history
|
||||||
|
2. WHEN logs are displayed THEN the system SHALL provide filtering and search capabilities
|
||||||
|
3. WHEN log entries are selected THEN the system SHALL show detailed operation information
|
||||||
|
4. WHEN logs are extensive THEN the system SHALL provide pagination controls
|
||||||
|
5. WHEN logs are updated THEN the system SHALL refresh the display automatically
|
||||||
|
|
||||||
|
### Requirement 7
|
||||||
|
|
||||||
|
**User Story:** As a user, I want to debug and analyze product tags through the TUI, so that I can troubleshoot issues without using separate scripts.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN a user selects tag analysis THEN the system SHALL display available product tags
|
||||||
|
2. WHEN tags are analyzed THEN the system SHALL show product counts per tag
|
||||||
|
3. WHEN a tag is selected THEN the system SHALL display sample products with that tag
|
||||||
|
4. WHEN analysis completes THEN the system SHALL provide recommendations for target tags
|
||||||
|
|
||||||
|
### Requirement 8
|
||||||
|
|
||||||
|
**User Story:** As a user, I want real-time status monitoring in the TUI, so that I can see system health and operation progress at all times.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN the TUI is active THEN the system SHALL display connection status to Shopify API
|
||||||
|
2. WHEN operations are running THEN the system SHALL show progress bars and completion percentages
|
||||||
|
3. WHEN errors occur THEN the system SHALL display error indicators in the status bar
|
||||||
|
4. WHEN system resources are constrained THEN the system SHALL show performance warnings
|
||||||
|
|
||||||
|
### Requirement 9
|
||||||
|
|
||||||
|
**User Story:** As a user, I want keyboard shortcuts and navigation aids in the TUI, so that I can efficiently operate the interface.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN the interface is displayed THEN the system SHALL show available keyboard shortcuts
|
||||||
|
2. WHEN a user presses help key THEN the system SHALL display comprehensive help overlay
|
||||||
|
3. WHEN navigating menus THEN the system SHALL support arrow keys, tab, and enter
|
||||||
|
4. WHEN in any screen THEN the system SHALL provide consistent back/exit options
|
||||||
|
5. WHEN shortcuts are used THEN the system SHALL provide immediate response
|
||||||
|
|
||||||
|
### Requirement 10
|
||||||
|
|
||||||
|
**User Story:** As a user, I want the TUI to handle errors gracefully, so that the interface remains stable and informative during issues.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN API errors occur THEN the system SHALL display user-friendly error messages
|
||||||
|
2. WHEN network issues happen THEN the system SHALL show retry options and status
|
||||||
|
3. WHEN configuration errors exist THEN the system SHALL guide users to corrections
|
||||||
|
4. WHEN unexpected errors occur THEN the system SHALL log details while maintaining interface stability
|
||||||
|
5. WHEN errors are resolved THEN the system SHALL automatically return to normal operation
|
||||||
|
|
||||||
|
### Requirement 11
|
||||||
|
|
||||||
|
**User Story:** As a user, I want the TUI to preserve my session and settings, so that I don't lose progress when switching between operations.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN switching between screens THEN the system SHALL maintain current configuration state
|
||||||
|
2. WHEN operations are interrupted THEN the system SHALL preserve partial progress where possible
|
||||||
|
3. WHEN returning to previous screens THEN the system SHALL restore previous selections
|
||||||
|
4. WHEN the TUI is restarted THEN the system SHALL load the last saved configuration
|
||||||
|
5. WHEN session data exists THEN the system SHALL offer to resume previous operations
|
||||||
|
|
||||||
|
### Requirement 12
|
||||||
|
|
||||||
|
**User Story:** As a developer, I want the TUI to integrate seamlessly with existing codebase, so that maintenance and updates remain straightforward.
|
||||||
|
|
||||||
|
#### Acceptance Criteria
|
||||||
|
|
||||||
|
1. WHEN TUI is implemented THEN the system SHALL reuse existing service classes without modification
|
||||||
|
2. WHEN TUI operations run THEN the system SHALL generate the same logs as CLI operations
|
||||||
|
3. WHEN TUI is added THEN the system SHALL maintain backward compatibility with existing CLI interface
|
||||||
|
4. WHEN configuration changes THEN the system SHALL use the same validation logic as CLI version
|
||||||
|
5. WHEN TUI components are updated THEN the system SHALL follow existing code organization patterns
|
||||||
0
.kiro/specs/shopify-tui/tasks.md
Normal file
0
.kiro/specs/shopify-tui/tasks.md
Normal file
52
README.md
52
README.md
@@ -323,12 +323,64 @@ shopify-price-updater/
|
|||||||
|
|
||||||
## Available Scripts
|
## Available Scripts
|
||||||
|
|
||||||
|
### Immediate Execution Scripts
|
||||||
|
|
||||||
- `npm start` - Run the price updater (defaults to update mode for backward compatibility)
|
- `npm start` - Run the price updater (defaults to update mode for backward compatibility)
|
||||||
- `npm run update` - Run the price update script (explicitly set to update mode)
|
- `npm run update` - Run the price update script (explicitly set to update mode)
|
||||||
- `npm run rollback` - Run the price rollback script (set prices to compare-at prices)
|
- `npm run rollback` - Run the price rollback script (set prices to compare-at prices)
|
||||||
- `npm run debug-tags` - Analyze all product tags in your store
|
- `npm run debug-tags` - Analyze all product tags in your store
|
||||||
- `npm test` - Run the test suite (if implemented)
|
- `npm test` - Run the test suite (if implemented)
|
||||||
|
|
||||||
|
### Scheduled Execution Scripts
|
||||||
|
|
||||||
|
- `npm run schedule-update` - Run scheduled price update (requires SCHEDULED_EXECUTION_TIME environment variable)
|
||||||
|
- `npm run schedule-rollback` - Run scheduled price rollback (requires SCHEDULED_EXECUTION_TIME environment variable)
|
||||||
|
|
||||||
|
#### Scheduling Examples
|
||||||
|
|
||||||
|
**Schedule a sale to start at 10:30 AM on December 25th:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set environment variable and run
|
||||||
|
set SCHEDULED_EXECUTION_TIME=2024-12-25T10:30:00 && npm run schedule-update
|
||||||
|
```
|
||||||
|
|
||||||
|
**Schedule a sale to end (rollback) at midnight on January 1st:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set environment variable and run
|
||||||
|
set SCHEDULED_EXECUTION_TIME=2025-01-01T00:00:00 && npm run schedule-rollback
|
||||||
|
```
|
||||||
|
|
||||||
|
**Schedule with specific timezone (EST):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Set environment variable with timezone and run
|
||||||
|
set SCHEDULED_EXECUTION_TIME=2024-12-25T10:30:00-05:00 && npm run schedule-update
|
||||||
|
```
|
||||||
|
|
||||||
|
**Using .env file for scheduling:**
|
||||||
|
|
||||||
|
```env
|
||||||
|
# Add to your .env file
|
||||||
|
SCHEDULED_EXECUTION_TIME=2024-12-25T10:30:00
|
||||||
|
OPERATION_MODE=update
|
||||||
|
TARGET_TAG=sale
|
||||||
|
PRICE_ADJUSTMENT_PERCENTAGE=10
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run: `npm run schedule-update`
|
||||||
|
|
||||||
|
**Common scheduling scenarios:**
|
||||||
|
|
||||||
|
- **Black Friday sale start**: Schedule price decreases for Friday morning
|
||||||
|
- **Sale end**: Schedule rollback to original prices after promotion period
|
||||||
|
- **Seasonal pricing**: Schedule price adjustments for seasonal campaigns
|
||||||
|
- **Flash sales**: Schedule short-term promotional pricing
|
||||||
|
- **Holiday promotions**: Schedule price changes for specific holidays
|
||||||
|
|
||||||
|
**Note**: When using scheduled execution, the script will display a countdown and wait until the specified time before executing the price updates. You can cancel the scheduled operation by pressing Ctrl+C during the waiting period.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is provided as-is for educational and commercial use. Please test thoroughly before using in production environments.
|
This project is provided as-is for educational and commercial use. Please test thoroughly before using in production environments.
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
"start": "node src/index.js",
|
"start": "node src/index.js",
|
||||||
"update": "set OPERATION_MODE=update && node src/index.js",
|
"update": "set OPERATION_MODE=update && node src/index.js",
|
||||||
"rollback": "set OPERATION_MODE=rollback && node src/index.js",
|
"rollback": "set OPERATION_MODE=rollback && node src/index.js",
|
||||||
|
"schedule-update": "set OPERATION_MODE=update && node src/index.js",
|
||||||
|
"schedule-rollback": "set OPERATION_MODE=rollback && node src/index.js",
|
||||||
"debug-tags": "node debug-tags.js",
|
"debug-tags": "node debug-tags.js",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user