optikit 1.2.4 β†’ 1.3.0

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.
Files changed (104) hide show
  1. package/.claude/commands/build.md +57 -0
  2. package/.claude/commands/clean.md +45 -0
  3. package/.claude/commands/generate.md +64 -0
  4. package/.claude/commands/rollback.md +67 -0
  5. package/.claude/commands/run.md +63 -0
  6. package/.claude/commands/setup.md +69 -0
  7. package/.claude/commands/sync-docs.md +148 -0
  8. package/.claude/commands/version.md +63 -0
  9. package/.claude/settings.local.json +28 -0
  10. package/.claude-plugin/marketplace.json +36 -0
  11. package/.claude-plugin/plugin.json +25 -0
  12. package/.history/README_20260325211923.md +268 -0
  13. package/.history/README_20260325212116.md +268 -0
  14. package/.history/README_20260325212234.md +266 -0
  15. package/.history/README_20260325221838.md +321 -0
  16. package/.history/README_20260325221920.md +327 -0
  17. package/.history/README_20260325222245.md +328 -0
  18. package/.history/README_20260325222247.md +328 -0
  19. package/.mcp.json +8 -0
  20. package/CHANGELOG.md +79 -46
  21. package/CLAUDE.md +57 -206
  22. package/OPTIKIT_AGENT.md +398 -0
  23. package/README.md +293 -60
  24. package/dist/cli.js +75 -241
  25. package/dist/commands/build/commands.js +146 -0
  26. package/dist/commands/build/testflight.js +14 -0
  27. package/dist/commands/clean/commands.js +41 -0
  28. package/dist/commands/clean/flutter.js +8 -14
  29. package/dist/commands/clean/ios.js +12 -15
  30. package/dist/commands/config/aliases.js +122 -0
  31. package/dist/commands/config/commands.js +49 -0
  32. package/dist/commands/config/initApp.js +191 -0
  33. package/dist/commands/config/rollback.js +15 -4
  34. package/dist/commands/config/upgrade.js +36 -0
  35. package/dist/commands/mcp/commands.js +21 -0
  36. package/dist/commands/mcp/server.js +27 -0
  37. package/dist/commands/mcp/setup.js +62 -0
  38. package/dist/commands/mcp/tools.js +359 -0
  39. package/dist/commands/project/commands.js +132 -0
  40. package/dist/commands/project/devices.js +10 -26
  41. package/dist/commands/project/doctor.js +58 -0
  42. package/dist/commands/project/generate.js +183 -30
  43. package/dist/commands/project/setup.js +10 -28
  44. package/dist/commands/project/status.js +65 -0
  45. package/dist/commands/version/bump.js +96 -82
  46. package/dist/commands/version/commands.js +63 -0
  47. package/dist/commands/version/update.js +36 -24
  48. package/dist/constants.js +6 -1
  49. package/dist/styles.js +42 -5
  50. package/dist/utils/helpers/error.js +14 -0
  51. package/dist/utils/helpers/file.js +1 -1
  52. package/dist/utils/helpers/version.js +2 -1
  53. package/dist/utils/services/backup.js +12 -1
  54. package/dist/utils/services/command.js +1 -34
  55. package/dist/utils/services/exec.js +76 -101
  56. package/dist/utils/services/logger.js +10 -4
  57. package/dist/utils/validators/validation.js +24 -12
  58. package/docs/INSTALLATION.md +72 -0
  59. package/docs/TROUBLESHOOT.md +140 -0
  60. package/docs/USAGE.md +185 -0
  61. package/docs/VERSION_MANAGEMENT.md +177 -0
  62. package/package.json +7 -11
  63. package/src/cli.ts +82 -362
  64. package/src/commands/build/commands.ts +169 -0
  65. package/src/commands/build/testflight.ts +18 -0
  66. package/src/commands/clean/commands.ts +43 -0
  67. package/src/commands/clean/flutter.ts +9 -13
  68. package/src/commands/clean/ios.ts +13 -13
  69. package/src/commands/config/aliases.ts +150 -0
  70. package/src/commands/config/commands.ts +50 -0
  71. package/src/commands/config/initApp.ts +213 -0
  72. package/src/commands/config/rollback.ts +16 -4
  73. package/src/commands/config/upgrade.ts +40 -0
  74. package/src/commands/mcp/commands.ts +23 -0
  75. package/src/commands/mcp/server.ts +35 -0
  76. package/src/commands/mcp/setup.ts +69 -0
  77. package/src/commands/mcp/tools.ts +365 -0
  78. package/src/commands/project/commands.ts +132 -0
  79. package/src/commands/project/devices.ts +11 -24
  80. package/src/commands/project/doctor.ts +81 -0
  81. package/src/commands/project/generate.ts +211 -32
  82. package/src/commands/project/setup.ts +13 -30
  83. package/src/commands/project/status.ts +72 -0
  84. package/src/commands/version/bump.ts +124 -85
  85. package/src/commands/version/commands.ts +76 -0
  86. package/src/commands/version/update.ts +86 -75
  87. package/src/constants.ts +7 -1
  88. package/src/styles.ts +49 -7
  89. package/src/utils/helpers/error.ts +16 -0
  90. package/src/utils/helpers/file.ts +1 -1
  91. package/src/utils/helpers/version.ts +2 -1
  92. package/src/utils/services/backup.ts +17 -1
  93. package/src/utils/services/command.ts +1 -58
  94. package/src/utils/services/exec.ts +92 -117
  95. package/src/utils/services/logger.ts +12 -4
  96. package/src/utils/validators/validation.ts +24 -12
  97. package/CODE_QUALITY.md +0 -398
  98. package/ENHANCEMENTS.md +0 -310
  99. package/FEATURE_ENHANCEMENTS.md +0 -435
  100. package/INSTALLATION.md +0 -118
  101. package/SAFETY_FEATURES.md +0 -396
  102. package/TROUBLESHOOT.md +0 -60
  103. package/USAGE.md +0 -388
  104. package/VERSION_MANAGEMENT.md +0 -438
@@ -1,435 +0,0 @@
1
- # OptiKit CLI - Feature Enhancements
2
-
3
- ## Overview
4
-
5
- This document details the new features added to OptiKit CLI to improve user experience, provide better control, and make the tool more powerful and flexible.
6
-
7
- ---
8
-
9
- ## πŸ†• New Commands
10
-
11
- ### 1. Init Command (`optikit init`)
12
-
13
- **Purpose:** Initialize OptiKit configuration in your project
14
-
15
- **Usage:**
16
- ```bash
17
- optikit init
18
- ```
19
-
20
- **What it does:**
21
- - Creates `.optikitrc.json` with default configuration
22
- - Adds `.optikit-backup/` to `.gitignore` (if .gitignore exists)
23
- - Displays the created configuration
24
-
25
- **Example Output:**
26
- ```bash
27
- $ optikit init
28
- ℹ️ Initializing OptiKit in this project...
29
- βœ… Configuration saved to /path/to/project/.optikitrc.json
30
- βœ… OptiKit initialized successfully!
31
-
32
- Default configuration:
33
- {
34
- "backupRetentionCount": 5,
35
- "useFvmByDefault": false,
36
- "autoBackup": true,
37
- "verbose": false
38
- }
39
-
40
- You can modify .optikitrc.json to customize these settings.
41
-
42
- βœ… Added .optikit-backup/ to .gitignore
43
- ```
44
-
45
- **Configuration Options:**
46
- - `backupRetentionCount` - Number of backups to keep (default: 5)
47
- - `useFvmByDefault` - Use FVM for all commands by default (default: false)
48
- - `autoBackup` - Automatically backup files before modification (default: true)
49
- - `verbose` - Enable verbose logging (default: false)
50
-
51
- ---
52
-
53
- ### 2. Rollback Command (`optikit rollback`)
54
-
55
- **Purpose:** List and restore files from OptiKit backups
56
-
57
- **Usage:**
58
- ```bash
59
- # List all available backups
60
- optikit rollback
61
-
62
- # Restore a specific backup
63
- optikit rollback --restore 1
64
- ```
65
-
66
- **List Mode Example:**
67
- ```bash
68
- $ optikit rollback
69
- ℹ️ Searching for OptiKit backups...
70
-
71
- Found 6 backup(s):
72
-
73
- pubspec.yaml
74
- [1] 12/23/2025, 3:45:30 PM (5m ago, 2.34 KB)
75
- [2] 12/23/2025, 2:30:15 PM (1h ago, 2.31 KB)
76
-
77
- ios/Runner.xcodeproj/project.pbxproj
78
- [3] 12/23/2025, 3:40:20 PM (10m ago, 45.67 KB)
79
- [4] 12/23/2025, 1:15:00 PM (3h ago, 45.12 KB)
80
-
81
- ios/Runner/Info.plist
82
- [5] 12/23/2025, 3:40:25 PM (10m ago, 1.23 KB)
83
- [6] 12/23/2025, 1:15:05 PM (3h ago, 1.20 KB)
84
-
85
- ============================================================
86
- To restore a backup, run:
87
- optikit rollback --restore <number>
88
-
89
- Example:
90
- optikit rollback --restore 1
91
- ============================================================
92
- ```
93
-
94
- **Restore Mode Example:**
95
- ```bash
96
- $ optikit rollback --restore 1
97
- ℹ️ Restoring: pubspec.yaml
98
- ℹ️ From backup: 12/23/2025, 3:45:30 PM
99
- βœ… Restored from backup: pubspec.yaml
100
- βœ… Backup restored successfully!
101
- ```
102
-
103
- **Features:**
104
- - Recursively searches entire project for backups
105
- - Groups backups by original file
106
- - Sorts by timestamp (newest first)
107
- - Shows human-readable time ago (5m ago, 1h ago, etc.)
108
- - Displays file sizes
109
- - Simple numeric index for restoration
110
-
111
- ---
112
-
113
- ## πŸ”§ Configuration System
114
-
115
- ### Configuration File (`.optikitrc.json`)
116
-
117
- OptiKit now supports project-level and user-level configuration files.
118
-
119
- **File Locations** (priority order):
120
- 1. `.optikitrc` in current directory
121
- 2. `.optikitrc.json` in current directory
122
- 3. `.optikitrc` in home directory
123
- 4. `.optikitrc.json` in home directory
124
-
125
- **Configuration Schema:**
126
- ```typescript
127
- interface OptiKitConfig {
128
- backupRetentionCount?: number; // Number of backups to keep
129
- useFvmByDefault?: boolean; // Use FVM by default
130
- autoBackup?: boolean; // Auto-backup before changes
131
- verbose?: boolean; // Verbose logging
132
- }
133
- ```
134
-
135
- **Example `.optikitrc.json`:**
136
- ```json
137
- {
138
- "backupRetentionCount": 10,
139
- "useFvmByDefault": true,
140
- "autoBackup": true,
141
- "verbose": false
142
- }
143
- ```
144
-
145
- **Defaults:**
146
- ```json
147
- {
148
- "backupRetentionCount": 5,
149
- "useFvmByDefault": false,
150
- "autoBackup": true,
151
- "verbose": false
152
- }
153
- ```
154
-
155
- ---
156
-
157
- ## 🎨 Dry-Run Mode (Coming Soon)
158
-
159
- **Purpose:** Preview commands without executing them
160
-
161
- **Usage:**
162
- ```bash
163
- optikit flutter-build-apk --dry-run
164
- optikit clean-flutter --dry-run
165
- ```
166
-
167
- **Features:**
168
- - Shows all validation checks
169
- - Displays commands that would be executed
170
- - Lists files that would be modified
171
- - No actual changes to system
172
- - Perfect for learning and testing
173
-
174
- **Example Output:**
175
- ```bash
176
- $ optikit flutter-build-apk --dry-run
177
- πŸ” DRY-RUN MODE ENABLED - No commands will be executed
178
- Commands will be displayed but not run
179
-
180
- βœ“ Validating Flutter project PASS
181
- βœ“ Validating Flutter SDK PASS
182
- βœ“ Validating Android project PASS
183
-
184
- β†’ Build Flutter APK
185
- Command: fvm flutter build apk --release --obfuscate --split-debug-info=build/app/outputs/symbols
186
-
187
- ============================================================
188
- DRY-RUN SUMMARY
189
- ============================================================
190
-
191
- Total operations: 1
192
- Commands: 1
193
- File operations: 0
194
-
195
- ============================================================
196
- No actual changes were made to your system.
197
- Run without --dry-run to execute these operations.
198
- ```
199
-
200
- ---
201
-
202
- ## 🎯 Use Cases
203
-
204
- ### Use Case 1: New Project Setup
205
-
206
- ```bash
207
- # Initialize OptiKit in your Flutter project
208
- cd my-flutter-app
209
- optikit init
210
-
211
- # Customize configuration
212
- vim .optikitrc.json
213
-
214
- # Use OptiKit commands
215
- optikit clean-flutter
216
- optikit flutter-build-apk
217
- ```
218
-
219
- ### Use Case 2: Version Recovery
220
-
221
- ```bash
222
- # Made a mistake updating version?
223
- optikit flutter-update-version --app-version 2.0.0 --android-build 10
224
-
225
- # Oops! Wrong version. Let's check backups
226
- optikit rollback
227
-
228
- # Restore the old pubspec.yaml
229
- optikit rollback --restore 1
230
- ```
231
-
232
- ### Use Case 3: Team Configuration
233
-
234
- ```bash
235
- # Create team-wide configuration
236
- cat > .optikitrc.json << EOF
237
- {
238
- "backupRetentionCount": 10,
239
- "useFvmByDefault": true,
240
- "autoBackup": true
241
- }
242
- EOF
243
-
244
- # Commit to repository
245
- git add .optikitrc.json
246
- git commit -m "Add OptiKit configuration"
247
-
248
- # Team members automatically use same settings
249
- ```
250
-
251
- ### Use Case 4: Backup Management
252
-
253
- ```bash
254
- # Check all backups periodically
255
- optikit rollback
256
-
257
- # Restore specific file versions as needed
258
- optikit rollback --restore 3
259
-
260
- # Backups are automatically cleaned up (keeps last 5)
261
- ```
262
-
263
- ---
264
-
265
- ## πŸ“Š Benefits
266
-
267
- ### For Individual Developers
268
-
269
- 1. **Easy Setup:** `optikit init` gets you started instantly
270
- 2. **Safety Net:** Automatic backups with easy restoration
271
- 3. **Customization:** Configure behavior per-project
272
- 4. **Recovery:** Rollback mistakes quickly
273
-
274
- ### For Teams
275
-
276
- 1. **Consistency:** Share configuration across team
277
- 2. **Standardization:** Everyone uses same settings
278
- 3. **Documentation:** Configuration file self-documents preferences
279
- 4. **Version Control:** Config can be committed to Git
280
-
281
- ### For DevOps/CI
282
-
283
- 1. **Scriptable:** Configuration via files, not command-line flags
284
- 2. **Predictable:** Same behavior across environments
285
- 3. **Auditable:** Configuration changes tracked in Git
286
- 4. **Flexible:** Different configs for dev/staging/prod
287
-
288
- ---
289
-
290
- ## πŸ”„ Migration Guide
291
-
292
- ### From Manual Configuration to OptiKit Config
293
-
294
- **Before:**
295
- ```bash
296
- # Remember to use --disable-fvm on this project
297
- optikit flutter-build-apk --disable-fvm
298
-
299
- # Remember to keep more backups
300
- # (no way to configure this)
301
- ```
302
-
303
- **After:**
304
- ```bash
305
- # One-time setup
306
- optikit init
307
- echo '{"useFvmByDefault": false, "backupRetentionCount": 10}' > .optikitrc.json
308
-
309
- # Now just use commands normally
310
- optikit flutter-build-apk # Uses config automatically
311
- ```
312
-
313
- ---
314
-
315
- ## πŸŽ“ Best Practices
316
-
317
- ### 1. Initialize Early
318
- ```bash
319
- # First thing when starting a project
320
- optikit init
321
- ```
322
-
323
- ### 2. Commit Configuration
324
- ```bash
325
- # Share team settings
326
- git add .optikitrc.json
327
- git commit -m "Add OptiKit configuration"
328
- ```
329
-
330
- ### 3. Regular Backup Checks
331
- ```bash
332
- # Weekly or monthly
333
- optikit rollback # Review available backups
334
- ```
335
-
336
- ### 4. Document Custom Settings
337
- ```json
338
- {
339
- "backupRetentionCount": 10, // Keep more for this critical project
340
- "useFvmByDefault": true, // Team uses FVM
341
- "autoBackup": true, // Always backup
342
- "verbose": false // Quiet output for CI
343
- }
344
- ```
345
-
346
- ---
347
-
348
- ## πŸ“‹ Command Reference
349
-
350
- ### All New Commands
351
-
352
- | Command | Description | Options |
353
- |---------|-------------|---------|
354
- | `optikit init` | Initialize configuration | None |
355
- | `optikit rollback` | List backups | None |
356
- | `optikit rollback --restore N` | Restore backup #N | `--restore <number>` |
357
-
358
- ### Configuration Options
359
-
360
- | Option | Type | Default | Description |
361
- |--------|------|---------|-------------|
362
- | `backupRetentionCount` | number | 5 | Backups to keep |
363
- | `useFvmByDefault` | boolean | false | Use FVM by default |
364
- | `autoBackup` | boolean | true | Auto-backup files |
365
- | `verbose` | boolean | false | Verbose logging |
366
-
367
- ---
368
-
369
- ## πŸš€ Future Enhancements
370
-
371
- ### Planned Features
372
-
373
- 1. **Dry-Run Mode**
374
- - Preview all operations
375
- - See validation results
376
- - Perfect for learning
377
-
378
- 2. **Verbose Mode**
379
- - Detailed operation logs
380
- - Debug information
381
- - Command execution details
382
-
383
- 3. **Progress Indicators**
384
- - Spinners for long operations
385
- - Progress bars for builds
386
- - Time estimates
387
-
388
- 4. **Config Command**
389
- ```bash
390
- optikit config set backupRetentionCount 10
391
- optikit config get
392
- optikit config list
393
- ```
394
-
395
- 5. **Backup Export**
396
- ```bash
397
- optikit backup export ./backup-archive
398
- ```
399
-
400
- ---
401
-
402
- ## πŸ“– Related Documentation
403
-
404
- - [CODE_QUALITY.md](CODE_QUALITY.md) - Architecture improvements
405
- - [SAFETY_FEATURES.md](SAFETY_FEATURES.md) - Validation and backups
406
- - [ENHANCEMENTS.md](ENHANCEMENTS.md) - Critical bug fixes
407
- - [CLAUDE.md](CLAUDE.md) - Development guide
408
-
409
- ---
410
-
411
- ## πŸŽ‰ Summary
412
-
413
- ### New Capabilities
414
-
415
- - βœ… **2 new commands** (init, rollback)
416
- - βœ… **Configuration system** (.optikitrc.json)
417
- - βœ… **Backup management** (list and restore)
418
- - βœ… **Project initialization** (quick setup)
419
- - βœ… **Team settings** (shareable config)
420
-
421
- ### Developer Experience
422
-
423
- | Aspect | Before | After |
424
- |--------|--------|-------|
425
- | Setup | Manual | `optikit init` |
426
- | Configuration | Command-line flags | Config file |
427
- | Backup Management | Manual file browsing | `optikit rollback` |
428
- | Recovery | Manual copy | `optikit rollback --restore N` |
429
- | Team Sharing | Documentation | Committed config |
430
-
431
- ---
432
-
433
- **Version:** 1.1.1+features
434
- **Last Updated:** December 23, 2025
435
- **Status:** βœ… Production Ready
package/INSTALLATION.md DELETED
@@ -1,118 +0,0 @@
1
- # Installation Guide for OptiKit CLI
2
-
3
- This guide provides various methods to install the **OptiKit CLI Tool**. Whether you prefer installing via NPM, cloning the repository, or using Homebrew, choose the method that best suits your setup.
4
-
5
- ---
6
-
7
- ## Install via NPM
8
-
9
- The easiest and most straightforward way to install the **OptiKit CLI** is by using NPM. This method works on all platforms (macOS, Linux, and Windows).
10
-
11
- ### Steps:
12
- 1. Run the following command to install the CLI globally:
13
- ```bash
14
- npm install -g optikit
15
- ```
16
-
17
- 2. Verify the installation:
18
- ```bash
19
- optikit --version
20
- ```
21
-
22
- ---
23
-
24
- ## Install via Repository Clone
25
-
26
- For users who want to work with the source code directly, you can clone the repository and build it locally.
27
-
28
- ### Steps:
29
- 1. Clone the repository:
30
- ```bash
31
- git clone https://github.com/dev-mahmoud-elshenawy/optikit.git
32
- cd optikit
33
- ```
34
-
35
- 2. Install dependencies and build the project:
36
- ```bash
37
- npm install && npm run build
38
- ```
39
-
40
- 3. Add the CLI to your PATH (based on your operating system):
41
- - **macOS**:
42
- ```bash
43
- echo 'export PATH="$PATH:/your_path/optikit"' >> ~/.zshrc
44
- source ~/.zshrc
45
- ```
46
- - **Linux**:
47
- ```bash
48
- echo 'export PATH="$PATH:/your_path/optikit"' >> ~/.bashrc
49
- source ~/.bashrc
50
- ```
51
- - **Windows**:
52
- - Search for "Environment Variables" in the Start menu.
53
- - Click on "Environment Variables".
54
- - Under "System variables", find the `Path` variable and click "Edit".
55
- - Add the path to your npm global binaries (you can find this by running `npm bin -g` in your command prompt).
56
- - Click OK to save your changes.
57
-
58
- 4. Verify the installation:
59
- ```bash
60
- optikit --version
61
- ```
62
-
63
- ---
64
-
65
- ## Install via Homebrew
66
-
67
- If you prefer using Homebrew to manage installations, follow these steps:
68
-
69
- ### HTTPS (Default)
70
-
71
- If you don’t mind entering your GitHub credentials when prompted, you can tap the formula using HTTPS.
72
-
73
- 1. Tap the formula:
74
- ```bash
75
- brew tap dev-mahmoud-elshenawy/optikit
76
- ```
77
-
78
- 2. Install the CLI:
79
- ```bash
80
- brew install optikit
81
- ```
82
-
83
- 3. Use a Personal Access Token (PAT) for authentication if 2FA is enabled on your GitHub account:
84
- - Generate a PAT from your GitHub account under **Settings > Developer settings > Personal access tokens**.
85
- - Use your GitHub username and PAT as the password when prompted.
86
-
87
- ### SSH (Recommended)
88
-
89
- SSH authentication is recommended as it eliminates the need to enter your username and password each time.
90
-
91
- 1. Tap the formula using SSH:
92
- ```bash
93
- brew tap dev-mahmoud-elshenawy/optikit git@github.com:dev-mahmoud-elshenawy/optikit.git
94
- ```
95
-
96
- 2. Install the CLI:
97
- ```bash
98
- brew install optikit
99
- ```
100
-
101
- 3. Install dependencies and build the project:
102
- ```bash
103
- npm install && npm run build
104
- ```
105
-
106
- ---
107
-
108
- ### Verifying Installation
109
-
110
- For all installation methods, verify that the CLI is installed correctly by running:
111
-
112
- ```bash
113
- optikit --version
114
- ```
115
-
116
- ---
117
-
118
- Enjoy using the **OptiKit CLI Tool** to simplify your workflows!