optikit 1.1.1 → 1.2.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 (79) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/CLAUDE.md +239 -0
  3. package/CODE_QUALITY.md +398 -0
  4. package/ENHANCEMENTS.md +310 -0
  5. package/FEATURE_ENHANCEMENTS.md +435 -0
  6. package/README.md +46 -13
  7. package/SAFETY_FEATURES.md +396 -0
  8. package/USAGE.md +225 -41
  9. package/VERSION_MANAGEMENT.md +438 -0
  10. package/dist/cli.js +116 -7
  11. package/dist/commands/build/releases.js +57 -0
  12. package/dist/commands/buildReleases.js +48 -74
  13. package/dist/commands/clean/flutter.js +51 -0
  14. package/dist/commands/clean/ios.js +109 -0
  15. package/dist/commands/cleanProject.js +34 -4
  16. package/dist/commands/cleanProjectIos.js +17 -7
  17. package/dist/commands/config/init.js +54 -0
  18. package/dist/commands/config/rollback.js +161 -0
  19. package/dist/commands/generateModule.js +39 -11
  20. package/dist/commands/init.js +54 -0
  21. package/dist/commands/openProject.js +17 -0
  22. package/dist/commands/project/devices.js +188 -0
  23. package/dist/commands/project/generate.js +143 -0
  24. package/dist/commands/project/open.js +63 -0
  25. package/dist/commands/project/setup.js +46 -0
  26. package/dist/commands/rollback.js +161 -0
  27. package/dist/commands/setupVSCode.js +27 -21
  28. package/dist/commands/updateVersions.js +13 -1
  29. package/dist/commands/version/bump.js +161 -0
  30. package/dist/commands/version/update.js +91 -0
  31. package/dist/commands/version.js +161 -0
  32. package/dist/constants.js +131 -0
  33. package/dist/utils/backupHelpers.js +88 -0
  34. package/dist/utils/buildHelpers.js +55 -0
  35. package/dist/utils/commandHelpers.js +51 -0
  36. package/dist/utils/configHelpers.js +80 -0
  37. package/dist/utils/dryRunHelpers.js +103 -0
  38. package/dist/utils/fileHelpers.js +2 -1
  39. package/dist/utils/helpers/build.js +55 -0
  40. package/dist/utils/helpers/dryRun.js +103 -0
  41. package/dist/utils/helpers/file.js +24 -0
  42. package/dist/utils/helpers/string.js +3 -0
  43. package/dist/utils/helpers/version.js +80 -0
  44. package/dist/utils/services/backup.js +88 -0
  45. package/dist/utils/services/command.js +51 -0
  46. package/dist/utils/services/config.js +80 -0
  47. package/dist/utils/services/exec.js +132 -0
  48. package/dist/utils/services/logger.js +15 -0
  49. package/dist/utils/validationHelpers.js +101 -0
  50. package/dist/utils/validators/validation.js +101 -0
  51. package/dist/utils/versionHelpers.js +80 -0
  52. package/package.json +1 -1
  53. package/src/cli.ts +165 -7
  54. package/src/commands/build/releases.ts +79 -0
  55. package/src/commands/clean/flutter.ts +58 -0
  56. package/src/commands/{cleanProjectIos.ts → clean/ios.ts} +19 -10
  57. package/src/commands/config/init.ts +63 -0
  58. package/src/commands/config/rollback.ts +200 -0
  59. package/src/commands/project/devices.ts +246 -0
  60. package/src/commands/{generateModule.ts → project/generate.ts} +47 -17
  61. package/src/commands/{openProject.ts → project/open.ts} +26 -5
  62. package/src/commands/project/setup.ts +50 -0
  63. package/src/commands/version/bump.ts +202 -0
  64. package/src/commands/{updateVersions.ts → version/update.ts} +22 -6
  65. package/src/constants.ts +144 -0
  66. package/src/utils/helpers/build.ts +80 -0
  67. package/src/utils/helpers/dryRun.ts +124 -0
  68. package/src/utils/{fileHelpers.ts → helpers/file.ts} +3 -2
  69. package/src/utils/helpers/version.ts +109 -0
  70. package/src/utils/services/backup.ts +109 -0
  71. package/src/utils/services/command.ts +76 -0
  72. package/src/utils/services/config.ts +106 -0
  73. package/src/utils/{execHelpers.ts → services/exec.ts} +1 -1
  74. package/src/utils/validators/validation.ts +122 -0
  75. package/src/commands/buildReleases.ts +0 -102
  76. package/src/commands/cleanProject.ts +0 -25
  77. package/src/commands/setupVSCode.ts +0 -44
  78. /package/src/utils/{stringHelpers.ts → helpers/string.ts} +0 -0
  79. /package/src/utils/{loggerHelpers.ts → services/logger.ts} +0 -0
package/USAGE.md CHANGED
@@ -2,69 +2,205 @@
2
2
 
3
3
  The **OptiKit CLI Tool** provides several commands to help streamline your development workflow. This guide explains how to use the tool, including all available commands and their respective options.
4
4
 
5
- Each command is designed to simplify tasks like building Flutter projects, generating modules, and managing other aspects of your workflow. Below, you'll find detailed explanations and examples for each command supported by **OptiKit CLI**.
5
+ Each command is designed to simplify tasks like building Flutter projects, generating modules, managing versions, and automating other aspects of your workflow. Below, you'll find detailed explanations and examples for each command supported by **OptiKit CLI**.
6
6
 
7
7
  After installing OptiKit, you can use it directly from the command line.
8
8
 
9
9
  ---
10
10
 
11
- ## Command Usage
11
+ ## Table of Contents
12
12
 
13
- ### 1. Generate a New Module
14
- To generate a new module, run:
13
+ - [Configuration Commands](#configuration-commands)
14
+ - [Version Management Commands](#version-management-commands)
15
+ - [Device Management Commands](#device-management-commands)
16
+ - [Build Commands](#build-commands)
17
+ - [Clean Commands](#clean-commands)
18
+ - [Project Commands](#project-commands)
19
+
20
+ ---
21
+
22
+ ## Configuration Commands
23
+
24
+ ### Initialize OptiKit Configuration
25
+
26
+ Create `.optikitrc.json` configuration file in your project:
15
27
 
16
28
  ```bash
17
- optikit generate module <module_name>
29
+ optikit init
18
30
  ```
19
31
 
20
- Replace `<module_name>` with the desired name for your module.
32
+ **What it does:**
33
+
34
+ - Creates configuration file with default settings
35
+ - Adds `.optikit-backup/` to `.gitignore`
36
+ - Sets up automatic backups and retention policies
37
+
38
+ **Default configuration:**
39
+
40
+ ```json
41
+ {
42
+ "backupRetentionCount": 5,
43
+ "useFvmByDefault": false,
44
+ "autoBackup": true,
45
+ "verbose": false
46
+ }
47
+ ```
21
48
 
22
49
  ---
23
50
 
24
- ### 2. Clean Flutter Project
25
- - By default, the clean command will use FVM for Flutter commands:
51
+ ### Manage Backups
52
+
53
+ List all available backups:
26
54
 
27
55
  ```bash
28
- optikit clean-flutter
56
+ optikit rollback
29
57
  ```
30
58
 
31
- - To run the clean command without FVM, use the `--disable-fvm` flag:
59
+ Restore a specific backup:
32
60
 
33
61
  ```bash
34
- optikit clean-flutter --disable-fvm
62
+ optikit rollback --restore <number>
35
63
  ```
36
64
 
65
+ **What it does:**
66
+
67
+ - Recursively searches for all OptiKit backups
68
+ - Groups backups by original file
69
+ - Shows timestamps and file sizes
70
+ - Allows easy restoration by number
71
+
37
72
  ---
38
73
 
39
- ### 3. Clean the iOS Project
40
- - By default, the clean command will not clean CocoaPods cache:
74
+ ## Version Management Commands
75
+
76
+ For detailed version management strategies, see [VERSION_MANAGEMENT.md](VERSION_MANAGEMENT.md).
77
+
78
+ ### Show Current Version
79
+
80
+ Display current version information:
41
81
 
42
82
  ```bash
43
- optikit clean-ios
83
+ optikit version
84
+ ```
85
+
86
+ **Output:**
87
+
88
+ ```text
89
+ 📱 Current Version Information
90
+
91
+ Version: 1.2.3+45
92
+ Major: 1
93
+ Minor: 2
94
+ Patch: 3
95
+ Build: 45
96
+ ```
97
+
98
+ ---
99
+
100
+ ### Bump Version (Semantic Versioning)
101
+
102
+ Increment patch version (bug fixes):
103
+
104
+ ```bash
105
+ optikit version bump patch
44
106
  ```
45
107
 
46
- - To clean with CocoaPods cache, use the `--clean-cache` flag:
108
+ Increment minor version (new features):
47
109
 
48
110
  ```bash
49
- optikit clean-ios --clean-cache
111
+ optikit version bump minor
50
112
  ```
51
113
 
52
- - To update repositories during cleaning, use the `--repo-update` flag:
114
+ Increment major version (breaking changes):
53
115
 
54
116
  ```bash
55
- optikit clean-ios --repo-update
117
+ optikit version bump major
118
+ ```
119
+
120
+ **What it does:**
121
+
122
+ - Updates version in pubspec.yaml
123
+ - Increments Android build number
124
+ - **Resets iOS build number to 1** (new version = fresh start)
125
+ - Updates iOS project files (project.pbxproj, Info.plist)
126
+ - Creates automatic backups before changes
127
+
128
+ **Example:**
129
+
130
+ ```text
131
+ Current: 1.0.2+45
132
+ After `optikit version bump patch`:
133
+ New: 1.0.3+46 (iOS build: 1)
134
+ ```
135
+
136
+ ---
137
+
138
+ ### Bump iOS Build Only (TestFlight)
139
+
140
+ Increment only iOS build number without changing version:
141
+
142
+ ```bash
143
+ optikit version bump-ios
144
+ ```
145
+
146
+ **What it does:**
147
+
148
+ - Keeps version unchanged
149
+ - Keeps Android build number unchanged
150
+ - **Increments iOS build from current Android build number**
151
+ - Perfect for multiple TestFlight uploads
152
+
153
+ **Example:**
154
+
155
+ ```text
156
+ Before:
157
+ Version: 1.0.2+45
158
+ iOS build: 1
159
+
160
+ After:
161
+ Version: 1.0.2+45 (unchanged)
162
+ iOS build: 46 (incremented from 45)
56
163
  ```
57
164
 
58
165
  ---
59
166
 
60
- ### 4. Build Flutter APK for Release
61
- - By default, the build command will use FVM for Flutter commands:
167
+ ### Bump Android Build Only
168
+
169
+ Increment only Android build number:
170
+
171
+ ```bash
172
+ optikit version bump-android
173
+ ```
174
+
175
+ **What it does:**
176
+
177
+ - Keeps version unchanged
178
+ - Keeps iOS build number unchanged
179
+ - Increments Android build number
180
+ - Perfect for Google Play uploads
181
+
182
+ **Example:**
183
+
184
+ ```text
185
+ Before: 1.0.2+45 (iOS: 1)
186
+ After: 1.0.2+46 (iOS: 1 unchanged)
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Build Commands
192
+
193
+ All build commands support FVM and create automatic backups.
194
+
195
+ ### Build Flutter APK for Release
196
+
197
+ By default, the build command will use FVM for Flutter commands:
62
198
 
63
199
  ```bash
64
200
  optikit flutter-build-apk
65
201
  ```
66
202
 
67
- - To run the build command without FVM, use the `--disable-fvm` flag:
203
+ To run the build command without FVM, use the `--disable-fvm` flag:
68
204
 
69
205
  ```bash
70
206
  optikit flutter-build-apk --disable-fvm
@@ -72,14 +208,15 @@ optikit flutter-build-apk --disable-fvm
72
208
 
73
209
  ---
74
210
 
75
- ### 5. Build Flutter Bundle for Release
76
- - By default, the build command will use FVM for Flutter commands:
211
+ ### Build Flutter Bundle for Release
212
+
213
+ By default, the build command will use FVM for Flutter commands:
77
214
 
78
215
  ```bash
79
216
  optikit flutter-build-bundle
80
217
  ```
81
218
 
82
- - To run the build command without FVM, use the `--disable-fvm` flag:
219
+ To run the build command without FVM, use the `--disable-fvm` flag:
83
220
 
84
221
  ```bash
85
222
  optikit flutter-build-bundle --disable-fvm
@@ -87,14 +224,15 @@ optikit flutter-build-bundle --disable-fvm
87
224
 
88
225
  ---
89
226
 
90
- ### 6. Build Flutter iOS App for Release
91
- - By default, the build command will use FVM for Flutter commands:
227
+ ### Build Flutter iOS App for Release
228
+
229
+ By default, the build command will use FVM for Flutter commands:
92
230
 
93
231
  ```bash
94
232
  optikit flutter-build-ios
95
233
  ```
96
234
 
97
- - To run the build command without FVM, use the `--disable-fvm` flag:
235
+ To run the build command without FVM, use the `--disable-fvm` flag:
98
236
 
99
237
  ```bash
100
238
  optikit flutter-build-ios --disable-fvm
@@ -102,14 +240,15 @@ optikit flutter-build-ios --disable-fvm
102
240
 
103
241
  ---
104
242
 
105
- ### 7. Create a Release IPA for Flutter App
106
- - By default, the build command will use FVM for Flutter commands:
243
+ ### Create a Release IPA for Flutter App
244
+
245
+ By default, the build command will use FVM for Flutter commands:
107
246
 
108
247
  ```bash
109
248
  optikit flutter-build-ipa
110
249
  ```
111
250
 
112
- - To run the build command without FVM, use the `--disable-fvm` flag:
251
+ To run the build command without FVM, use the `--disable-fvm` flag:
113
252
 
114
253
  ```bash
115
254
  optikit flutter-build-ipa --disable-fvm
@@ -117,19 +256,63 @@ optikit flutter-build-ipa --disable-fvm
117
256
 
118
257
  ---
119
258
 
120
- ### 8. Update App Version and Build Numbers
121
- - To set version and build numbers for Android and iOS:
259
+ ## Clean Commands
260
+
261
+ ### Clean Flutter Project
262
+
263
+ By default, the clean command will use FVM for Flutter commands:
122
264
 
123
265
  ```bash
124
- optikit flutter-update-version --app-version <version> --android-build <android-build-number> --ios-build <ios-build-number>
266
+ optikit clean-flutter
125
267
  ```
126
268
 
127
- Replace `<version>`, `<android-build-number>`, and `<ios-build-number>` with your desired values.
269
+ To run the clean command without FVM, use the `--disable-fvm` flag:
270
+
271
+ ```bash
272
+ optikit clean-flutter --disable-fvm
273
+ ```
128
274
 
129
275
  ---
130
276
 
131
- ### 9. Open Android Project in Android Studio
132
- - Open the Android module of your Flutter project in Android Studio:
277
+ ### Clean the iOS Project
278
+
279
+ By default, the clean command will not clean CocoaPods cache:
280
+
281
+ ```bash
282
+ optikit clean-ios
283
+ ```
284
+
285
+ To clean with CocoaPods cache, use the `--clean-cache` flag:
286
+
287
+ ```bash
288
+ optikit clean-ios --clean-cache
289
+ ```
290
+
291
+ To update repositories during cleaning, use the `--repo-update` flag:
292
+
293
+ ```bash
294
+ optikit clean-ios --repo-update
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Project Commands
300
+
301
+ ### Generate a New Module
302
+
303
+ To generate a new module, run:
304
+
305
+ ```bash
306
+ optikit generate module <module_name>
307
+ ```
308
+
309
+ Replace `<module_name>` with the desired name for your module.
310
+
311
+ ---
312
+
313
+ ### Open Android Project in Android Studio
314
+
315
+ Open the Android module of your Flutter project in Android Studio:
133
316
 
134
317
  ```bash
135
318
  optikit open-android
@@ -137,8 +320,9 @@ optikit open-android
137
320
 
138
321
  ---
139
322
 
140
- ### 10. Open iOS Project in Xcode
141
- - Open the iOS module of your Flutter project in Xcode:
323
+ ### Open iOS Project in Xcode
324
+
325
+ Open the iOS module of your Flutter project in Xcode:
142
326
 
143
327
  ```bash
144
328
  optikit open-ios
@@ -146,8 +330,9 @@ optikit open-ios
146
330
 
147
331
  ---
148
332
 
149
- ### 11. VS Code Setup Command
150
- - Automatically create a `.vscode` folder with a `settings.json` file preconfigured for Flutter projects using FVM. This command streamlines your project setup by setting the Flutter SDK path to `.fvm/flutter_sdk`.
333
+ ### VS Code Setup Command
334
+
335
+ Automatically create a `.vscode` folder with a `settings.json` file preconfigured for Flutter projects using FVM. This command streamlines your project setup by setting the Flutter SDK path to `.fvm/flutter_sdk`.
151
336
 
152
337
  ```bash
153
338
  optikit setup-vscode
@@ -155,7 +340,6 @@ optikit setup-vscode
155
340
 
156
341
  ---
157
342
 
158
-
159
343
  ## Verification
160
344
 
161
345
  After running any command, you can verify its success by observing the output or using the `optikit --version` command to confirm the CLI's version.