@khoaha/spek-cli 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/svg-to-vd/handler.d.ts +14 -0
- package/dist/commands/svg-to-vd/handler.d.ts.map +1 -0
- package/dist/commands/svg-to-vd/handler.js +119 -0
- package/dist/commands/svg-to-vd/handler.js.map +1 -0
- package/dist/config/manager.d.ts +18 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +53 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/directus/client.d.ts +14 -0
- package/dist/directus/client.d.ts.map +1 -0
- package/dist/directus/client.js +81 -0
- package/dist/directus/client.js.map +1 -0
- package/dist/download/handler.d.ts +6 -0
- package/dist/download/handler.d.ts.map +1 -0
- package/dist/download/handler.js +100 -0
- package/dist/download/handler.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +209 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +14 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +69 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/types/index.d.ts +67 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/file-utils.d.ts +28 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +61 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/svg-converter.d.ts +44 -0
- package/dist/utils/svg-converter.d.ts.map +1 -0
- package/dist/utils/svg-converter.js +149 -0
- package/dist/utils/svg-converter.js.map +1 -0
- package/package.json +7 -1
- package/docs/ARCHITECTURE.md +0 -286
- package/docs/PUBLISH_QUICK_REFERENCE.md +0 -135
- package/docs/SVG_TO_VECTOR_DRAWABLE.md +0 -186
- package/docs/TESTING.md +0 -429
- package/docs/USAGE_EXAMPLES.md +0 -520
- package/docs/WINDOWS_DEVELOPMENT.md +0 -487
- package/docs/WORKFLOW.md +0 -479
- package/scripts/publish.ps1 +0 -193
- package/scripts/publish.sh +0 -170
- package/src/commands/svg-to-vd/handler.ts +0 -131
- package/src/config/manager.ts +0 -58
- package/src/directus/client.ts +0 -101
- package/src/download/handler.ts +0 -116
- package/src/index.ts +0 -231
- package/src/prompts/index.ts +0 -76
- package/src/types/index.ts +0 -72
- package/src/utils/file-utils.ts +0 -69
- package/src/utils/svg-converter.ts +0 -196
- package/tsconfig.json +0 -20
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
# SVG to Vector Drawable Conversion Feature
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
Added SVG to Android Vector Drawable XML conversion feature to the `spek-cli` CLI tool using `vd-tool` library.
|
|
5
|
-
|
|
6
|
-
## Command Usage
|
|
7
|
-
|
|
8
|
-
### Basic Conversion
|
|
9
|
-
```bash
|
|
10
|
-
npx spek-cli svg-to-vd -i <input> -o <output>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### With Tint Color
|
|
14
|
-
```bash
|
|
15
|
-
npx spek-cli svg-to-vd -i icon.svg -o icon.xml --tint "#FF5722"
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Examples
|
|
19
|
-
```bash
|
|
20
|
-
# Convert SVG file
|
|
21
|
-
npx spek-cli svg-to-vd -i ./icons/heart.svg -o ./drawables/heart.xml
|
|
22
|
-
|
|
23
|
-
# With tint color
|
|
24
|
-
npx spek-cli svg-to-vd -i icon.svg -o icon.xml --tint "#FF5722"
|
|
25
|
-
|
|
26
|
-
# Using raw SVG content
|
|
27
|
-
npx spek-cli svg-to-vd -i "<svg>...</svg>" -o output.xml
|
|
28
|
-
|
|
29
|
-
# Output to nested directory (auto-creates directories)
|
|
30
|
-
npx spek-cli svg-to-vd -i icon.svg -o res/drawable/icon.xml
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Options
|
|
34
|
-
|
|
35
|
-
### Required
|
|
36
|
-
- `-i, --input <input>` - SVG file path or raw SVG content (auto-detected)
|
|
37
|
-
- `-o, --output <output>` - Output Vector Drawable XML file path
|
|
38
|
-
|
|
39
|
-
### Optional
|
|
40
|
-
- `--tint <color>` - Tint color to apply (e.g., "#FF5722")
|
|
41
|
-
- `-h, --help` - Show help message
|
|
42
|
-
|
|
43
|
-
## Features
|
|
44
|
-
|
|
45
|
-
### Auto-detection
|
|
46
|
-
The tool automatically detects whether the input is:
|
|
47
|
-
1. **SVG content** - If starts with `<svg`
|
|
48
|
-
2. **File path** - If file exists at the path
|
|
49
|
-
3. **Fallback** - Treats as SVG content
|
|
50
|
-
|
|
51
|
-
### Error Handling
|
|
52
|
-
Comprehensive error messages with suggestions:
|
|
53
|
-
- Missing required parameters
|
|
54
|
-
- Invalid SVG format
|
|
55
|
-
- File read errors
|
|
56
|
-
- Conversion failures
|
|
57
|
-
- Write permission issues
|
|
58
|
-
|
|
59
|
-
### Smart Output
|
|
60
|
-
- **Directory creation** - Automatically creates output directories if they don't exist
|
|
61
|
-
- **Overwrite** - Silently overwrites existing files
|
|
62
|
-
- **Validation** - Validates SVG content before conversion
|
|
63
|
-
- **Progress feedback** - Shows step-by-step progress with emojis
|
|
64
|
-
|
|
65
|
-
## Architecture
|
|
66
|
-
|
|
67
|
-
### File Structure
|
|
68
|
-
```
|
|
69
|
-
cli-tool/src/
|
|
70
|
-
├── commands/
|
|
71
|
-
│ └── svg-to-vd/
|
|
72
|
-
│ └── handler.ts # Command handler with error handling
|
|
73
|
-
├── utils/
|
|
74
|
-
│ ├── svg-converter.ts # Core conversion logic using vd-tool
|
|
75
|
-
│ └── file-utils.ts # File I/O utilities
|
|
76
|
-
├── types/
|
|
77
|
-
│ └── index.ts # TypeScript interfaces
|
|
78
|
-
└── index.ts # Main CLI entry point
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Key Components
|
|
82
|
-
|
|
83
|
-
#### 1. SVG Converter (`utils/svg-converter.ts`)
|
|
84
|
-
- `convertSvgToVectorDrawable()` - Main conversion function
|
|
85
|
-
- `validateSvgContent()` - SVG format validation
|
|
86
|
-
- Uses temporary files for vd-tool processing
|
|
87
|
-
- Applies customizations (tint)
|
|
88
|
-
- Automatic cleanup
|
|
89
|
-
|
|
90
|
-
#### 2. File Utilities (`utils/file-utils.ts`)
|
|
91
|
-
- `detectInputType()` - Auto-detect file vs content
|
|
92
|
-
- `fileExists()` - Check file existence
|
|
93
|
-
- `readFileContent()` - Read SVG file
|
|
94
|
-
- `writeFileContent()` - Write XML with directory creation
|
|
95
|
-
|
|
96
|
-
#### 3. Command Handler (`commands/svg-to-vd/handler.ts`)
|
|
97
|
-
- Validates required options
|
|
98
|
-
- Orchestrates conversion flow
|
|
99
|
-
- Provides user-friendly error messages
|
|
100
|
-
- Shows progress feedback
|
|
101
|
-
|
|
102
|
-
#### 4. Type Definitions (`types/index.ts`)
|
|
103
|
-
- `SvgToVdOptions` - Command options
|
|
104
|
-
- `SvgConversionResult` - Conversion result
|
|
105
|
-
- Extended `CliOptions` for command routing
|
|
106
|
-
|
|
107
|
-
## Implementation Details
|
|
108
|
-
|
|
109
|
-
### Technology Stack
|
|
110
|
-
- **TypeScript 5.x** - Type-safe implementation
|
|
111
|
-
- **vd-tool 4.0.2** - SVG to Vector Drawable conversion
|
|
112
|
-
- **Node.js 18+** - ES Modules support
|
|
113
|
-
- **chalk 5.x** - Colored terminal output
|
|
114
|
-
|
|
115
|
-
### Detection Priority
|
|
116
|
-
```typescript
|
|
117
|
-
1. Check if input starts with '<svg' → Treat as SVG content
|
|
118
|
-
2. Check if file exists at path → Read file
|
|
119
|
-
3. Fallback → Treat as SVG content
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Error Messages
|
|
123
|
-
All errors include:
|
|
124
|
-
- Clear description of the problem
|
|
125
|
-
- Helpful tip or suggestion
|
|
126
|
-
- Example usage when relevant
|
|
127
|
-
|
|
128
|
-
### Conversion Process
|
|
129
|
-
```
|
|
130
|
-
1. Parse command arguments
|
|
131
|
-
2. Auto-detect input type (file vs content)
|
|
132
|
-
3. Read SVG content
|
|
133
|
-
4. Validate SVG format
|
|
134
|
-
5. Convert using vd-tool
|
|
135
|
-
6. Apply customizations (tint if specified)
|
|
136
|
-
7. Create output directory if needed
|
|
137
|
-
8. Write Vector Drawable XML
|
|
138
|
-
9. Show success message
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## Testing Results
|
|
142
|
-
|
|
143
|
-
### ✅ Tested Scenarios
|
|
144
|
-
1. **File conversion** - Successfully converts SVG files
|
|
145
|
-
2. **Tint application** - Correctly applies tint color
|
|
146
|
-
3. **Nested directories** - Auto-creates output directories
|
|
147
|
-
4. **Missing output** - Shows error with suggestion
|
|
148
|
-
5. **Invalid input** - Validates and shows helpful error
|
|
149
|
-
6. **Help text** - Both main and command-specific help work
|
|
150
|
-
|
|
151
|
-
### Sample Output
|
|
152
|
-
```xml
|
|
153
|
-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
154
|
-
android:width="24dp"
|
|
155
|
-
android:height="24dp"
|
|
156
|
-
android:viewportWidth="24"
|
|
157
|
-
android:viewportHeight="24">
|
|
158
|
-
<path
|
|
159
|
-
android:pathData="M20.84,4.61a5.5,5.5..."
|
|
160
|
-
android:strokeLineJoin="round"
|
|
161
|
-
android:strokeWidth="2"
|
|
162
|
-
android:fillColor="#00000000"
|
|
163
|
-
android:strokeColor="currentColor"
|
|
164
|
-
android:strokeLineCap="round"/>
|
|
165
|
-
</vector>
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Dependencies Added
|
|
169
|
-
```json
|
|
170
|
-
{
|
|
171
|
-
"vd-tool": "^4.0.2"
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Notes
|
|
176
|
-
- Complex SVG features may not be fully supported by vd-tool
|
|
177
|
-
- Output files are overwritten without confirmation
|
|
178
|
-
- Temporary files are automatically cleaned up after conversion
|
|
179
|
-
- Works on Windows, macOS, and Linux
|
|
180
|
-
|
|
181
|
-
## Future Enhancements (Potential)
|
|
182
|
-
- Batch conversion support (multiple files)
|
|
183
|
-
- Custom naming patterns
|
|
184
|
-
- SVG optimization before conversion
|
|
185
|
-
- Preview mode (show output without writing)
|
|
186
|
-
- Configuration file support
|
package/docs/TESTING.md
DELETED
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
# Testing Guide
|
|
2
|
-
|
|
3
|
-
## Prerequisites
|
|
4
|
-
|
|
5
|
-
1. **Directus Instance:** You need access to a Directus instance with the Vault Export feature
|
|
6
|
-
2. **Access Token:** Generate an access token from your Directus instance
|
|
7
|
-
3. **Test File:** Have a file ID from a Vault Export ready for testing
|
|
8
|
-
|
|
9
|
-
## Getting Test Data
|
|
10
|
-
|
|
11
|
-
### From Figma Plugin
|
|
12
|
-
|
|
13
|
-
1. Open the SpeX Figma plugin
|
|
14
|
-
2. Go to "Vault Export" tab
|
|
15
|
-
3. Configure your Directus connection
|
|
16
|
-
4. Export specs to vault
|
|
17
|
-
5. Copy the file ID from the success dialog
|
|
18
|
-
|
|
19
|
-
### File ID Format
|
|
20
|
-
|
|
21
|
-
File IDs are UUIDs, typically in this format:
|
|
22
|
-
```
|
|
23
|
-
abc123-def456-ghi789-jkl012
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Local Testing
|
|
27
|
-
|
|
28
|
-
### 1. Build the CLI Tool
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# From monorepo root
|
|
32
|
-
npm run cli:build
|
|
33
|
-
|
|
34
|
-
# Or from cli-tool directory
|
|
35
|
-
cd cli-tool
|
|
36
|
-
npm run build
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### 2. Test Locally (Without Publishing)
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# From cli-tool directory
|
|
43
|
-
node dist/index.js --help
|
|
44
|
-
node dist/index.js -d <your-file-id>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### 3. Test with npx (Local Link)
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# From cli-tool directory
|
|
51
|
-
npm link
|
|
52
|
-
|
|
53
|
-
# Now you can use it globally
|
|
54
|
-
spek-cli -d <your-file-id>
|
|
55
|
-
|
|
56
|
-
# Unlink when done
|
|
57
|
-
npm unlink -g spek-cli
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Test Scenarios
|
|
61
|
-
|
|
62
|
-
### Scenario 1: First Run (No Config)
|
|
63
|
-
|
|
64
|
-
**Expected Behavior:**
|
|
65
|
-
1. CLI prompts for Directus URL
|
|
66
|
-
2. CLI prompts for access token
|
|
67
|
-
3. Config is saved to `~/.spek-cli/config.json`
|
|
68
|
-
4. CLI prompts for file ID (if not provided)
|
|
69
|
-
5. Download and extraction proceeds
|
|
70
|
-
|
|
71
|
-
**Test Commands:**
|
|
72
|
-
```bash
|
|
73
|
-
# Interactive mode (prompts for everything)
|
|
74
|
-
spek-cli
|
|
75
|
-
|
|
76
|
-
# Direct mode (prompts for config only)
|
|
77
|
-
spek-cli -d <file-id>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Validation:**
|
|
81
|
-
- [ ] Config file created at `~/.spek-cli/config.json`
|
|
82
|
-
- [ ] Config contains correct URL and token
|
|
83
|
-
- [ ] Success message displayed
|
|
84
|
-
- [ ] Files extracted to current directory
|
|
85
|
-
|
|
86
|
-
### Scenario 2: Subsequent Runs (Config Exists)
|
|
87
|
-
|
|
88
|
-
**Expected Behavior:**
|
|
89
|
-
1. Config loaded from file
|
|
90
|
-
2. No prompts for URL/token
|
|
91
|
-
3. Prompts for file ID if not provided
|
|
92
|
-
4. Download and extraction proceeds
|
|
93
|
-
|
|
94
|
-
**Test Commands:**
|
|
95
|
-
```bash
|
|
96
|
-
# Interactive mode
|
|
97
|
-
spek-cli
|
|
98
|
-
|
|
99
|
-
# Direct mode
|
|
100
|
-
spek-cli -d <file-id>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**Validation:**
|
|
104
|
-
- [ ] No config prompts shown
|
|
105
|
-
- [ ] Download proceeds immediately
|
|
106
|
-
- [ ] Files extracted successfully
|
|
107
|
-
|
|
108
|
-
### Scenario 3: Overwrite Existing Files
|
|
109
|
-
|
|
110
|
-
**Setup:**
|
|
111
|
-
```bash
|
|
112
|
-
# First download
|
|
113
|
-
spek-cli -d <file-id>
|
|
114
|
-
|
|
115
|
-
# Second download (same file)
|
|
116
|
-
spek-cli -d <file-id>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Expected Behavior:**
|
|
120
|
-
1. CLI detects existing files
|
|
121
|
-
2. Prompts: "Files already exist. Overwrite?"
|
|
122
|
-
3. If Yes → Overwrites files
|
|
123
|
-
4. If No → Cancels operation
|
|
124
|
-
|
|
125
|
-
**Validation:**
|
|
126
|
-
- [ ] Warning message shown
|
|
127
|
-
- [ ] Overwrite prompt appears
|
|
128
|
-
- [ ] Choosing "Yes" overwrites files
|
|
129
|
-
- [ ] Choosing "No" cancels without changes
|
|
130
|
-
|
|
131
|
-
### Scenario 4: Invalid Authentication
|
|
132
|
-
|
|
133
|
-
**Setup:**
|
|
134
|
-
```bash
|
|
135
|
-
# Edit config file with invalid token
|
|
136
|
-
# ~/.spek-cli/config.json
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
**Expected Behavior:**
|
|
140
|
-
1. Download attempt fails
|
|
141
|
-
2. Error message: "Authentication failed. Please check your access token."
|
|
142
|
-
3. Suggests checking config
|
|
143
|
-
|
|
144
|
-
**Test Commands:**
|
|
145
|
-
```bash
|
|
146
|
-
spek-cli -d <file-id>
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**Validation:**
|
|
150
|
-
- [ ] Clear error message
|
|
151
|
-
- [ ] No partial downloads
|
|
152
|
-
- [ ] Temp files cleaned up
|
|
153
|
-
|
|
154
|
-
### Scenario 5: File Not Found
|
|
155
|
-
|
|
156
|
-
**Test Commands:**
|
|
157
|
-
```bash
|
|
158
|
-
spek-cli -d invalid-file-id-12345
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**Expected Behavior:**
|
|
162
|
-
1. Download attempt fails
|
|
163
|
-
2. Error message: "File not found: invalid-file-id-12345"
|
|
164
|
-
|
|
165
|
-
**Validation:**
|
|
166
|
-
- [ ] Clear error message
|
|
167
|
-
- [ ] No partial extraction
|
|
168
|
-
- [ ] Temp files cleaned up
|
|
169
|
-
|
|
170
|
-
### Scenario 6: Network Errors
|
|
171
|
-
|
|
172
|
-
**Setup:**
|
|
173
|
-
- Disconnect internet or use invalid Directus URL
|
|
174
|
-
|
|
175
|
-
**Expected Behavior:**
|
|
176
|
-
1. Connection fails
|
|
177
|
-
2. Error message with network details
|
|
178
|
-
|
|
179
|
-
**Validation:**
|
|
180
|
-
- [ ] Graceful error handling
|
|
181
|
-
- [ ] No hanging processes
|
|
182
|
-
- [ ] Temp files cleaned up
|
|
183
|
-
|
|
184
|
-
### Scenario 7: Corrupted ZIP File
|
|
185
|
-
|
|
186
|
-
**Note:** This is difficult to test without modifying the Directus server response.
|
|
187
|
-
|
|
188
|
-
**Expected Behavior:**
|
|
189
|
-
1. Download completes
|
|
190
|
-
2. ZIP validation fails
|
|
191
|
-
3. Error message: "Invalid or corrupted ZIP file"
|
|
192
|
-
|
|
193
|
-
**Validation:**
|
|
194
|
-
- [ ] No extraction attempted
|
|
195
|
-
- [ ] Temp files cleaned up
|
|
196
|
-
|
|
197
|
-
### Scenario 8: User Cancellation
|
|
198
|
-
|
|
199
|
-
**Test Commands:**
|
|
200
|
-
```bash
|
|
201
|
-
spek-cli
|
|
202
|
-
# Press Ctrl+C during any prompt
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Expected Behavior:**
|
|
206
|
-
1. Graceful exit
|
|
207
|
-
2. No partial operations
|
|
208
|
-
3. No temp files left behind
|
|
209
|
-
|
|
210
|
-
**Validation:**
|
|
211
|
-
- [ ] Clean exit
|
|
212
|
-
- [ ] No error messages
|
|
213
|
-
- [ ] No temp files
|
|
214
|
-
|
|
215
|
-
### Scenario 9: Help and Version
|
|
216
|
-
|
|
217
|
-
**Test Commands:**
|
|
218
|
-
```bash
|
|
219
|
-
spek-cli --help
|
|
220
|
-
spek-cli -h
|
|
221
|
-
spek-cli --version
|
|
222
|
-
spek-cli -v
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
**Expected Behavior:**
|
|
226
|
-
- Help shows usage, options, examples
|
|
227
|
-
- Version shows current version number
|
|
228
|
-
|
|
229
|
-
**Validation:**
|
|
230
|
-
- [ ] Help is clear and comprehensive
|
|
231
|
-
- [ ] Version matches package.json
|
|
232
|
-
|
|
233
|
-
### Scenario 10: Empty Directory vs. Non-Empty
|
|
234
|
-
|
|
235
|
-
**Test A: Empty Directory**
|
|
236
|
-
```bash
|
|
237
|
-
mkdir test-empty
|
|
238
|
-
cd test-empty
|
|
239
|
-
spek-cli -d <file-id>
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
**Expected:** Direct extraction, no overwrite prompt
|
|
243
|
-
|
|
244
|
-
**Test B: Non-Empty Directory**
|
|
245
|
-
```bash
|
|
246
|
-
mkdir test-non-empty
|
|
247
|
-
cd test-non-empty
|
|
248
|
-
echo "test" > README.md
|
|
249
|
-
spek-cli -d <file-id>
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Expected:** Overwrite prompt only if ZIP contains README.md
|
|
253
|
-
|
|
254
|
-
**Validation:**
|
|
255
|
-
- [ ] Empty dir: No prompt
|
|
256
|
-
- [ ] Non-empty dir with conflicts: Prompt shown
|
|
257
|
-
- [ ] Non-empty dir without conflicts: No prompt
|
|
258
|
-
|
|
259
|
-
## Manual Testing Checklist
|
|
260
|
-
|
|
261
|
-
### Setup Phase
|
|
262
|
-
- [ ] Build succeeds without errors
|
|
263
|
-
- [ ] TypeScript compilation clean
|
|
264
|
-
- [ ] All dependencies installed
|
|
265
|
-
|
|
266
|
-
### Configuration
|
|
267
|
-
- [ ] First run prompts for config
|
|
268
|
-
- [ ] Config saved correctly
|
|
269
|
-
- [ ] Config loaded on subsequent runs
|
|
270
|
-
- [ ] Invalid URL rejected during setup
|
|
271
|
-
- [ ] Empty token rejected during setup
|
|
272
|
-
|
|
273
|
-
### Download
|
|
274
|
-
- [ ] Valid file ID downloads successfully
|
|
275
|
-
- [ ] Invalid file ID shows error
|
|
276
|
-
- [ ] Network errors handled gracefully
|
|
277
|
-
- [ ] Authentication errors clear
|
|
278
|
-
|
|
279
|
-
### Extraction
|
|
280
|
-
- [ ] Files extracted to CWD
|
|
281
|
-
- [ ] Directory structure preserved
|
|
282
|
-
- [ ] Overwrite prompt works
|
|
283
|
-
- [ ] Cancellation works
|
|
284
|
-
- [ ] Temp files cleaned up
|
|
285
|
-
|
|
286
|
-
### User Experience
|
|
287
|
-
- [ ] Help message clear
|
|
288
|
-
- [ ] Version displayed correctly
|
|
289
|
-
- [ ] Error messages helpful
|
|
290
|
-
- [ ] Success messages clear
|
|
291
|
-
- [ ] Colors enhance readability
|
|
292
|
-
|
|
293
|
-
### Edge Cases
|
|
294
|
-
- [ ] Very large files (>100MB)
|
|
295
|
-
- [ ] Files with special characters
|
|
296
|
-
- [ ] Deeply nested directory structures
|
|
297
|
-
- [ ] Empty ZIP files
|
|
298
|
-
- [ ] ZIP with single file
|
|
299
|
-
- [ ] ZIP with many files (>1000)
|
|
300
|
-
|
|
301
|
-
## Automated Testing (Future)
|
|
302
|
-
|
|
303
|
-
### Unit Tests
|
|
304
|
-
|
|
305
|
-
```typescript
|
|
306
|
-
// Example test structure
|
|
307
|
-
describe('Config Manager', () => {
|
|
308
|
-
it('should create config directory if not exists', () => {});
|
|
309
|
-
it('should save config with timestamp', () => {});
|
|
310
|
-
it('should load existing config', () => {});
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
describe('Download Handler', () => {
|
|
314
|
-
it('should detect existing files', () => {});
|
|
315
|
-
it('should validate ZIP files', () => {});
|
|
316
|
-
it('should cleanup temp files on error', () => {});
|
|
317
|
-
});
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### Integration Tests
|
|
321
|
-
|
|
322
|
-
```typescript
|
|
323
|
-
describe('Full Download Flow', () => {
|
|
324
|
-
it('should download and extract valid file', async () => {});
|
|
325
|
-
it('should handle authentication errors', async () => {});
|
|
326
|
-
it('should handle file not found', async () => {});
|
|
327
|
-
});
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
## Performance Testing
|
|
331
|
-
|
|
332
|
-
### Metrics to Track
|
|
333
|
-
|
|
334
|
-
1. **Startup Time:** Time from command to first prompt
|
|
335
|
-
2. **Download Speed:** MB/s for various file sizes
|
|
336
|
-
3. **Extraction Time:** Time to extract various ZIP sizes
|
|
337
|
-
4. **Memory Usage:** Peak memory during download/extraction
|
|
338
|
-
|
|
339
|
-
### Test Files
|
|
340
|
-
|
|
341
|
-
- Small: <1MB
|
|
342
|
-
- Medium: 1-10MB
|
|
343
|
-
- Large: 10-100MB
|
|
344
|
-
- Very Large: >100MB
|
|
345
|
-
|
|
346
|
-
## Troubleshooting
|
|
347
|
-
|
|
348
|
-
### Build Fails
|
|
349
|
-
|
|
350
|
-
```bash
|
|
351
|
-
# Clean and rebuild
|
|
352
|
-
rm -rf dist node_modules
|
|
353
|
-
npm install
|
|
354
|
-
npm run build
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### Config Issues
|
|
358
|
-
|
|
359
|
-
```bash
|
|
360
|
-
# View config
|
|
361
|
-
cat ~/.spek-cli/config.json
|
|
362
|
-
|
|
363
|
-
# Delete config (forces re-setup)
|
|
364
|
-
rm ~/.spek-cli/config.json
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Temp Files Not Cleaned
|
|
368
|
-
|
|
369
|
-
```bash
|
|
370
|
-
# Check temp directory
|
|
371
|
-
ls /tmp/spek-cli-*
|
|
372
|
-
|
|
373
|
-
# Manual cleanup
|
|
374
|
-
rm /tmp/spek-cli-*
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Permission Errors
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
# Check config directory permissions
|
|
381
|
-
ls -la ~/.spek-cli
|
|
382
|
-
|
|
383
|
-
# Fix permissions
|
|
384
|
-
chmod 700 ~/.spek-cli
|
|
385
|
-
chmod 600 ~/.spek-cli/config.json
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
## Reporting Issues
|
|
389
|
-
|
|
390
|
-
When reporting issues, include:
|
|
391
|
-
|
|
392
|
-
1. **Command used:** Full command with arguments
|
|
393
|
-
2. **Error message:** Complete error output
|
|
394
|
-
3. **Environment:**
|
|
395
|
-
- OS and version
|
|
396
|
-
- Node.js version
|
|
397
|
-
- npm version
|
|
398
|
-
4. **Config:** Directus URL (redact token)
|
|
399
|
-
5. **File ID:** If applicable (redact if sensitive)
|
|
400
|
-
6. **Steps to reproduce:** Detailed steps
|
|
401
|
-
|
|
402
|
-
## Test Results Template
|
|
403
|
-
|
|
404
|
-
```markdown
|
|
405
|
-
## Test Results - [Date]
|
|
406
|
-
|
|
407
|
-
**Environment:**
|
|
408
|
-
- OS: Windows 10 / macOS 14 / Ubuntu 22.04
|
|
409
|
-
- Node.js: v20.11.0
|
|
410
|
-
- npm: v10.2.4
|
|
411
|
-
|
|
412
|
-
**Test Scenarios:**
|
|
413
|
-
- [ ] First run setup
|
|
414
|
-
- [ ] Subsequent runs
|
|
415
|
-
- [ ] Overwrite prompt
|
|
416
|
-
- [ ] Invalid auth
|
|
417
|
-
- [ ] File not found
|
|
418
|
-
- [ ] Network errors
|
|
419
|
-
- [ ] User cancellation
|
|
420
|
-
- [ ] Help/Version
|
|
421
|
-
- [ ] Empty directory
|
|
422
|
-
- [ ] Non-empty directory
|
|
423
|
-
|
|
424
|
-
**Issues Found:**
|
|
425
|
-
1. [Issue description]
|
|
426
|
-
2. [Issue description]
|
|
427
|
-
|
|
428
|
-
**Overall Status:** ✅ Pass / ❌ Fail
|
|
429
|
-
```
|