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
@@ -0,0 +1,266 @@
1
+ <h1 align="center">OptiKit CLI</h1>
2
+
3
+ <p align="center">
4
+ <strong>The command-line toolkit for Flutter & Opticore developers.</strong><br/>
5
+ Build &middot; Version &middot; Clean &middot; Generate &middot; Ship
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/optikit"><img src="https://img.shields.io/npm/v/optikit?style=flat-square&color=cyan&label=npm" alt="npm"/></a>
10
+ <img src="https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20Windows-blue?style=flat-square" alt="Platform"/>
11
+ <a href="https://pub.dev/packages/opticore"><img src="https://img.shields.io/badge/Opticore-pub.dev-teal?style=flat-square" alt="Opticore"/></a>
12
+ <a href="https://www.linkedin.com/in/dev-mahmoud-elshenawy/"><img src="https://img.shields.io/badge/Creator-Mahmoud%20El%20Shenawy-blue?style=flat-square" alt="Creator"/></a>
13
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow?style=flat-square" alt="License"/></a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://www.buymeacoffee.com/m.elshen]awy">
18
+ <img src="https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support%20My%20Work-FFDD00?style=for-the-badge&logo=buymeacoffee&logoColor=0D1117" alt="Buy Me A Coffee"/>
19
+ </a>
20
+ </p>
21
+
22
+ ---
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ npm install -g optikit
28
+ ```
29
+
30
+ That's it. You get two commands:
31
+ - `optikit` โ€” full name
32
+ - `ok` โ€” shorthand
33
+
34
+ Both work identically. All examples below use `ok`.
35
+
36
+ ---
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ ok init # Setup OptiKit in your project
42
+ ok v # Show current version
43
+ ok bump patch # 1.0.0 -> 1.0.1
44
+ ok apk # Build release APK
45
+ ok ipa --clean -o # Clean, build IPA, open output
46
+ ok tf # TestFlight: bump iOS + build IPA
47
+ ok gen module login -r # Generate BLoC module with route
48
+ ok aliases # See all commands & shortcuts
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Commands
54
+
55
+ Every command has a **short alias**. Use whichever you prefer.
56
+
57
+ ### Build
58
+
59
+ | Alias | Command | What it does |
60
+ |-------|---------|-------------|
61
+ | `ok apk` | `flutter-build-apk` | Build release APK |
62
+ | `ok aab` | `flutter-build-bundle` | Build release AAB |
63
+ | `ok ios` | `flutter-build-ios` | Build iOS app |
64
+ | `ok ipa` | `flutter-build-ipa` | Build release IPA |
65
+ | `ok tf` | `testflight` | Bump iOS build + build IPA |
66
+
67
+ **Build flags** โ€” combine freely:
68
+
69
+ | Flag | Short | What it does |
70
+ |------|-------|-------------|
71
+ | `--clean` | | Clean before building |
72
+ | `--open` | `-o` | Open output folder after build |
73
+ | `--bump <type>` | `-b` | Bump version before build (major/minor/patch) |
74
+ | `--bump-ios` | `-i` | Bump iOS build number before build (IPA only) |
75
+ | `--disable-fvm` | `-f` | Use global Flutter SDK |
76
+
77
+ ```bash
78
+ ok apk --clean # Clean + build APK
79
+ ok ipa -b patch -o # Bump patch + build IPA + open
80
+ ok ipa --clean -i -o # Clean + bump iOS + build IPA + open
81
+ ok tf -o # TestFlight + open output
82
+ ```
83
+
84
+ ### Clean
85
+
86
+ | Alias | Command | What it does |
87
+ |-------|---------|-------------|
88
+ | `ok c` | `clean` | Clean Flutter project |
89
+ | `ok cf` | `clean-flutter` | Clean Flutter (explicit) |
90
+ | `ok ci` | `clean-ios` | Clean iOS / CocoaPods |
91
+
92
+ ```bash
93
+ ok c -a # Clean Flutter + iOS (all)
94
+ ok ci -c # Clean iOS + clear cache
95
+ ok ci -u # Clean iOS + update repo
96
+ ok ci -cu # Clean iOS + cache + repo update
97
+ ```
98
+
99
+ ### Version & Bump
100
+
101
+ | Alias | Command | What it does |
102
+ |-------|---------|-------------|
103
+ | `ok v` | `version` | Show current version info |
104
+ | `ok bump patch` | `bump patch` | Bump patch (1.0.0 -> 1.0.1) |
105
+ | `ok bump minor` | `bump minor` | Bump minor (1.0.0 -> 1.1.0) |
106
+ | `ok bump major` | `bump major` | Bump major (1.0.0 -> 2.0.0) |
107
+ | `ok bi` | `bump-ios` | Bump iOS build number only |
108
+ | `ok ba` | `bump-android` | Bump Android build number only |
109
+ | `ok bb` | `bump-build` | Bump both build numbers |
110
+ | `ok vset` | `flutter-update-version` | Set version manually |
111
+
112
+ > Version bumps auto-backup files and update `pubspec.yaml` + iOS project files.
113
+ > See [Version Management](docs/VERSION_MANAGEMENT.md) for the full strategy.
114
+
115
+ ### Generate
116
+
117
+ | Alias | Command | What it does |
118
+ |-------|---------|-------------|
119
+ | `ok gen module <name>` | `generate module` | Scaffold BLoC module (bloc, event, state, screen, factory) |
120
+ | `ok gen repo <name>` | `generate repo` | Generate repository file |
121
+ | `ok route <name>` | `add-route` | Add route to `app_router.dart` |
122
+
123
+ ```bash
124
+ ok gen module login -r # Generate module + register route
125
+ ```
126
+
127
+ ### Run & Devices
128
+
129
+ | Alias | Command | What it does |
130
+ |-------|---------|-------------|
131
+ | `ok run` | `run` | Run app on connected device |
132
+ | `ok rs` | `run-select` | Interactive device picker |
133
+ | `ok devs` | `devices` | List connected devices |
134
+
135
+ ```bash
136
+ ok run -r # Run in release mode
137
+ ok run -d <device-id> # Run on specific device
138
+ ok rs -r # Pick device + release mode
139
+ ```
140
+
141
+ ### Open
142
+
143
+ | Alias | Command | What it does |
144
+ |-------|---------|-------------|
145
+ | `ok xcode` | `open-ios` | Open in Xcode |
146
+ | `ok studio` | `open-android` | Open in Android Studio |
147
+ | `ok open-ipa` | `open-ipa` | Open IPA output folder |
148
+ | `ok open-apk` | `open-apk` | Open APK output folder |
149
+ | `ok open-bundle` | `open-bundle` | Open AAB output folder |
150
+
151
+ > Tip: Use `ok ipa -o` or `ok apk -o` to build and open in one step.
152
+
153
+ ### Config & Tools
154
+
155
+ | Alias | Command | What it does |
156
+ |-------|---------|-------------|
157
+ | `ok init` | `init` | Initialize OptiKit config |
158
+ | `ok init-app` | `init-app` | Scaffold Opticore app structure |
159
+ | `ok vscode` | `setup-vscode` | Create VS Code Flutter settings |
160
+ | `ok undo` | `rollback` | List/restore file backups |
161
+ | `ok info` | `status` | Project status snapshot |
162
+ | `ok dr` | `doctor` | Check environment health |
163
+ | `ok up` | `upgrade` | Check for CLI updates |
164
+ | `ok aliases` | `aliases` | Show all aliases & shortcuts |
165
+
166
+ ---
167
+
168
+ ## Common Workflows
169
+
170
+ **Release an APK:**
171
+ ```bash
172
+ ok bump patch && ok apk # or: ok apk -b patch
173
+ ```
174
+
175
+ **TestFlight upload:**
176
+ ```bash
177
+ ok tf -o # Bump iOS + build IPA + open output
178
+ ```
179
+
180
+ **Full clean rebuild (iOS):**
181
+ ```bash
182
+ ok ipa --clean -o # Clean + build IPA + open
183
+ ```
184
+
185
+ **New module:**
186
+ ```bash
187
+ ok gen module user_profile -r # Generate + auto-route
188
+ ```
189
+
190
+ **Check everything:**
191
+ ```bash
192
+ ok info # Version, config, platforms
193
+ ok dr # Environment health check
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Configuration
199
+
200
+ Initialize with `ok init`. This creates `.optikitrc.json`:
201
+
202
+ ```json
203
+ {
204
+ "backupRetentionCount": 5,
205
+ "useFvmByDefault": true,
206
+ "autoBackup": true,
207
+ "verbose": false
208
+ }
209
+ ```
210
+
211
+ **FVM:** All Flutter commands use FVM by default. Disable per-command with `-f` or set `"useFvmByDefault": false` in config.
212
+
213
+ **Backups:** Version files are backed up automatically before changes. Use `ok undo` to list and restore.
214
+
215
+ ---
216
+
217
+ ## Tab Completion
218
+
219
+ ```bash
220
+ optikit completion >> ~/.zshrc
221
+ source ~/.zshrc
222
+ ```
223
+
224
+ Now press Tab to autocomplete commands and flags.
225
+
226
+ ---
227
+
228
+ ## Documentation
229
+
230
+ | Doc | What it covers |
231
+ |-----|---------------|
232
+ | **[Command Reference](docs/USAGE.md)** | All commands with flags and examples |
233
+ | **[Version Management](docs/VERSION_MANAGEMENT.md)** | Dual build number strategy, iOS/Android workflows |
234
+ | **[Installation](docs/INSTALLATION.md)** | NPM, Homebrew, and source install |
235
+
236
+ ---
237
+
238
+ ## Built for Opticore
239
+
240
+ OptiKit is the companion CLI for the **[Opticore](https://pub.dev/packages/opticore)** Flutter micro-framework. Module generation scaffolds the full BLoC pattern that Opticore expects.
241
+
242
+ Not using Opticore? OptiKit's build, version, and clean commands work with **any Flutter project**.
243
+
244
+ ---
245
+
246
+ ## Created By
247
+
248
+ <div align="center">
249
+
250
+ ### Built with โค๏ธ by [Mahmoud El Shenawy](https://github.com/dev-mahmoud-elshenawy)
251
+
252
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?logo=linkedin&logoColor=white&style=for-the-badge)](https://www.linkedin.com/in/dev-mahmoud-elshenawy)
253
+ [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white&style=for-the-badge)](https://github.com/dev-mahmoud-elshenawy)
254
+ [![Medium](https://img.shields.io/badge/Medium-000000?logo=medium&logoColor=white&style=for-the-badge)](https://medium.com/@dev-mahmoud-elshenawy)
255
+
256
+ </div>
257
+
258
+ ---
259
+
260
+ ## License
261
+
262
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](./LICENSE)
263
+
264
+ **OptiKit** is open-source software released under the **[MIT License](./LICENSE)**.
265
+
266
+ Free to use, modify, and distribute โ€” in personal and commercial projects.
@@ -0,0 +1,321 @@
1
+ <h1 align="center">๐Ÿš€ OptiKit CLI</h1>
2
+
3
+ <p align="center">
4
+ <strong>Build, version, and deploy Flutter apps in one CLI.</strong><br/>
5
+ The command-line toolkit for Flutter & Opticore developers.
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/optikit"><img src="https://img.shields.io/npm/v/optikit?style=flat-square&color=cyan&label=npm" alt="npm"/></a>
10
+ <img src="https://img.shields.io/badge/MCP-Supported-orange?style=flat-square" alt="MCP Supported"/>
11
+ <img src="https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20Windows-blue?style=flat-square" alt="Platform"/>
12
+ <a href="https://pub.dev/packages/opticore"><img src="https://img.shields.io/badge/Opticore-pub.dev-teal?style=flat-square" alt="Opticore"/></a>
13
+ <a href="https://www.linkedin.com/in/dev-mahmoud-elshenawy/"><img src="https://img.shields.io/badge/Creator-Mahmoud%20El%20Shenawy-blue?style=flat-square" alt="Creator"/></a>
14
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow?style=flat-square" alt="License"/></a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://www.buymeacoffee.com/m.elshenawy">
19
+ <img src="https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support%20My%20Work-FFDD00?style=for-the-badge&logo=buymeacoffee&logoColor=0D1117" alt="Buy Me A Coffee"/>
20
+ </a>
21
+ </p>
22
+
23
+ ---
24
+
25
+ ## โšก Install & Go
26
+
27
+ ```bash
28
+ npm install -g optikit
29
+ ```
30
+
31
+ You get two commands โ€” `optikit` (full name) and `ok` (shorthand). Both work identically.
32
+
33
+ ```bash
34
+ optikit init # ๐Ÿ”ง Setup OptiKit in your project
35
+ optikit bump patch # ๐Ÿ“ฆ 1.0.0 โ†’ 1.0.1
36
+ optikit apk # ๐Ÿ—๏ธ Build release APK
37
+ optikit tf -o # ๐Ÿš€ TestFlight: bump iOS + build IPA + open
38
+ optikit gen module login -r # ๐Ÿงฉ Generate BLoC module with route
39
+ optikit aliases # ๐Ÿ“‹ See all shortcuts
40
+ ```
41
+
42
+ > ๐Ÿ’ก Prefer shorter commands? Use `ok` instead of `optikit` โ€” every example above works with both.
43
+
44
+ ---
45
+
46
+ ## ๐Ÿ”ฅ Why OptiKit?
47
+
48
+ | Feature | Description |
49
+ |---------|-------------|
50
+ | ๐Ÿค– **Claude Code Plugin** | AI understands your project and acts on it via MCP |
51
+ | โœ… **Short aliases** | Every command has a memorable shortcut |
52
+ | โœ… **Combo flags** | Clean, bump, build, and open in one command |
53
+ | โœ… **Smart versioning** | Dual iOS/Android build numbers handled automatically |
54
+ | โœ… **Auto backups** | Version files backed up before every change |
55
+ | โœ… **Module scaffolding** | Full BLoC pattern generated in one command |
56
+ | โœ… **FVM support** | Built-in Flutter Version Manager integration |
57
+
58
+ ---
59
+
60
+ ## ๐Ÿ“– Commands at a Glance
61
+
62
+ > Every command has a short alias. Run `optikit aliases` to see the full list in your terminal.
63
+
64
+ ### ๐Ÿ—๏ธ Build
65
+
66
+ | Command | Alias | What it does |
67
+ |---------|-------|-------------|
68
+ | `optikit flutter-build-apk` | `apk` | Build release APK |
69
+ | `optikit flutter-build-bundle` | `aab` | Build release AAB |
70
+ | `optikit flutter-build-ios` | `ios` | Build iOS app |
71
+ | `optikit flutter-build-ipa` | `ipa` | Build release IPA |
72
+ | `optikit testflight` | `tf` | Bump iOS build + build IPA |
73
+
74
+ **Combo flags** โ€” mix and match on any build command:
75
+
76
+ ```bash
77
+ optikit apk --clean # ๐Ÿงน Clean โ†’ build
78
+ optikit ipa -b patch -o # ๐Ÿ“ฆ Bump โ†’ build โ†’ open output
79
+ optikit ipa --clean -i -o # ๐Ÿงน Clean โ†’ bump iOS โ†’ build โ†’ open
80
+ optikit tf -o # ๐Ÿš€ TestFlight โ†’ open output
81
+ ```
82
+
83
+ ### ๐Ÿงน Clean
84
+
85
+ | Command | Alias | What it does |
86
+ |---------|-------|-------------|
87
+ | `optikit clean` | `c` | Clean Flutter project |
88
+ | `optikit clean-flutter` | `cf` | Clean Flutter (explicit) |
89
+ | `optikit clean-ios` | `ci` | Clean iOS / CocoaPods |
90
+
91
+ ```bash
92
+ optikit clean -a # Clean all (Flutter + iOS)
93
+ optikit ci -cu # Clean iOS + cache + repo update
94
+ ```
95
+
96
+ ### ๐Ÿ“ฆ Version
97
+
98
+ | Command | Alias | What it does |
99
+ |---------|-------|-------------|
100
+ | `optikit version` | `v` | Show current version |
101
+ | `optikit bump patch` | | Bug fix: 1.0.0 โ†’ 1.0.1 |
102
+ | `optikit bump minor` | | Feature: 1.0.0 โ†’ 1.1.0 |
103
+ | `optikit bump major` | | Breaking: 1.0.0 โ†’ 2.0.0 |
104
+ | `optikit bump-ios` | `bi` | Bump iOS build only |
105
+ | `optikit bump-android` | `ba` | Bump Android build only |
106
+ | `optikit bump-build` | `bb` | Bump both build numbers |
107
+
108
+ > ๐Ÿ“˜ Deep dive: **[Version Management](docs/VERSION_MANAGEMENT.md)**
109
+
110
+ ### ๐Ÿงฉ Generate
111
+
112
+ ```bash
113
+ optikit gen module login # Scaffold BLoC module
114
+ optikit gen module login -r # Scaffold + register route
115
+ optikit gen repo user # Generate repository
116
+ optikit route settings # Add route to app_router.dart
117
+ ```
118
+
119
+ ### ๐Ÿ“ฑ Run & Open
120
+
121
+ ```bash
122
+ optikit run # Run app on device
123
+ optikit rs # Interactive device picker
124
+ optikit devs # List connected devices
125
+ optikit xcode # Open in Xcode
126
+ optikit studio # Open in Android Studio
127
+ ```
128
+
129
+ ### ๐Ÿ”ง Tools
130
+
131
+ ```bash
132
+ optikit info # Project status snapshot
133
+ optikit dr # Environment health check
134
+ optikit undo # List/restore backups
135
+ optikit up # Check for CLI updates
136
+ optikit vscode # Setup VS Code settings
137
+ ```
138
+
139
+ ---
140
+
141
+ ## ๐ŸŽฏ Common Workflows
142
+
143
+ ```bash
144
+ # ๐Ÿš€ TestFlight upload
145
+ optikit tf -o
146
+
147
+ # ๐Ÿ“ฆ Release APK with version bump
148
+ optikit apk -b patch -o
149
+
150
+ # ๐Ÿงน Full clean rebuild
151
+ optikit ipa --clean -o
152
+
153
+ # ๐Ÿงฉ New feature module
154
+ optikit gen module user_profile -r
155
+
156
+ # ๐Ÿ” Check project state
157
+ optikit info
158
+ ```
159
+
160
+ ---
161
+
162
+ ## โš™๏ธ Configuration
163
+
164
+ ```bash
165
+ optikit init # Creates .optikitrc.json
166
+ ```
167
+
168
+ ```json
169
+ {
170
+ "backupRetentionCount": 5,
171
+ "useFvmByDefault": true,
172
+ "autoBackup": true
173
+ }
174
+ ```
175
+
176
+ | Option | Default | Description |
177
+ |--------|---------|-------------|
178
+ | `backupRetentionCount` | `5` | Number of backups to keep per file |
179
+ | `useFvmByDefault` | `true` | Use FVM for all Flutter commands |
180
+ | `autoBackup` | `true` | Backup files before version changes |
181
+
182
+ ---
183
+
184
+ ## ๐Ÿ’พ Backups & Rollback
185
+
186
+ OptiKit **automatically backs up** version files before any modification:
187
+
188
+ | File | Backed up before |
189
+ |------|-----------------|
190
+ | `pubspec.yaml` | Version bumps, clean |
191
+ | `ios/Runner.xcodeproj/project.pbxproj` | Version bumps |
192
+ | `ios/Runner/Info.plist` | Version bumps |
193
+
194
+ Backups are stored in `.optikit-backup/` directories next to the original files with timestamps:
195
+
196
+ ```
197
+ your-project/
198
+ โ”œโ”€โ”€ pubspec.yaml
199
+ โ”œโ”€โ”€ .optikit-backup/
200
+ โ”‚ โ”œโ”€โ”€ pubspec_2026-03-25T10-30-00-000Z.yaml
201
+ โ”‚ โ””โ”€โ”€ pubspec_2026-03-25T11-15-30-000Z.yaml
202
+ โ””โ”€โ”€ ios/Runner.xcodeproj/
203
+ โ”œโ”€โ”€ project.pbxproj
204
+ โ””โ”€โ”€ .optikit-backup/
205
+ โ””โ”€โ”€ project_2026-03-25T10-30-00-000Z.pbxproj
206
+ ```
207
+
208
+ **Manage backups:**
209
+
210
+ ```bash
211
+ optikit undo # ๐Ÿ“‹ List all backups
212
+ optikit undo --restore 1 # โ™ป๏ธ Restore backup #1
213
+ optikit undo --before 2026-03-20 # ๐Ÿ“… Filter backups by date
214
+ ```
215
+
216
+ Old backups are automatically cleaned up (keeps last 5 by default, configurable via `backupRetentionCount`).
217
+
218
+ > ๐Ÿ’ก `.optikit-backup/` is added to `.gitignore` during `optikit init`.
219
+
220
+ ---
221
+
222
+ ## ๐Ÿค– Claude Code Integration
223
+
224
+ OptiKit ships as a **Claude Code plugin** powered by the **Model Context Protocol (MCP)**. Claude doesn't just run commands โ€” it **understands your Flutter project** and makes intelligent decisions.
225
+
226
+ ### ๐Ÿง  How It Works
227
+
228
+ You describe what you need. Claude **picks the right tools automatically**:
229
+
230
+ | You say | Claude does |
231
+ |---------|-----------|
232
+ | *"Fix this build error"* | Runs `clean` โ†’ `build` automatically |
233
+ | *"Prepare a TestFlight build"* | Runs `testflight` (bump iOS + build IPA) |
234
+ | *"Create a login feature"* | Generates BLoC module + registers route |
235
+ | *"We need to release v2.0"* | Bumps major version + builds both platforms |
236
+ | *"What version are we on?"* | Shows version with iOS & Android build numbers |
237
+ | *"Undo the last version bump"* | Lists backups and restores the right one |
238
+
239
+ ### โšก Setup in Seconds
240
+
241
+ **Option 1 โ€” Plugin Marketplace:**
242
+ ```bash
243
+ /plugin marketplace add dev-mahmoud-elshenawy/optikit
244
+ /plugin install optikit
245
+ ```
246
+
247
+ **Option 2 โ€” One Command:**
248
+ ```bash
249
+ optikit setup-claude
250
+ ```
251
+
252
+ That's it. All OptiKit tools are instantly available to Claude.
253
+
254
+ ### ๐Ÿ› ๏ธ Available Tool Categories
255
+
256
+ | Category | What Claude can do |
257
+ |----------|--------------------|
258
+ | ๐Ÿ—๏ธ **Build** | Build APK, AAB, iOS, IPA with clean/bump/open combos |
259
+ | ๐Ÿงน **Clean** | Fix stale caches, CocoaPods issues, full project cleanup |
260
+ | ๐Ÿ“ฆ **Version** | Bump versions, manage iOS/Android build numbers independently |
261
+ | ๐Ÿงฉ **Generate** | Scaffold BLoC modules, repositories, and auto-register routes |
262
+ | ๐Ÿ“ฑ **Run** | Launch app on devices, list connected devices |
263
+ | ๐Ÿ”ง **Diagnostics** | Health checks, project status, backup management |
264
+ | โš™๏ธ **Config** | Project setup, VS Code config, upgrade checks |
265
+
266
+ The MCP server runs locally via stdio โ€” fast, private, no cloud dependency.
267
+
268
+ ```bash
269
+ optikit setup-claude # โœ… Register with Claude Code
270
+ optikit setup-claude --uninstall # โŒ Remove when needed
271
+ ```
272
+
273
+ ---
274
+
275
+ ## ๐Ÿ“˜ Documentation
276
+
277
+ | Doc | Description |
278
+ |-----|-------------|
279
+ | ๐Ÿ“– **[Command Reference](docs/USAGE.md)** | All commands, flags, and examples |
280
+ | ๐Ÿ“ฆ **[Version Management](docs/VERSION_MANAGEMENT.md)** | iOS/Android dual build strategy |
281
+ | ๐Ÿ”ง **[Installation Guide](docs/INSTALLATION.md)** | NPM, Homebrew, source install |
282
+ | ๐Ÿ” **[Troubleshooting](docs/TROUBLESHOOT.md)** | Common issues and quick fixes |
283
+
284
+ ---
285
+
286
+ ## โšก Supercharge Development with Opticore
287
+
288
+ **OptiKit CLI** is the companion tool for **[Opticore](https://pub.dev/packages/opticore)** โ€” a lightweight BLoC-based micro-framework for Flutter.
289
+
290
+ | Together they give you | |
291
+ |---|---|
292
+ | ๐Ÿงฉ **Module scaffolding** | Generate full BLoC modules that plug directly into Opticore |
293
+ | ๐Ÿ›ฃ๏ธ **Auto-routing** | Register routes in `app_router.dart` with one flag |
294
+ | ๐Ÿ—๏ธ **App initialization** | Scaffold `main.dart`, config, and router for Opticore projects |
295
+ | ๐Ÿ“ฆ **Smart builds** | Build, version, and clean with short commands and combo flags |
296
+
297
+ > ๐Ÿ’ก **Not using Opticore?** No problem โ€” build, version, clean, and run commands work with **any Flutter project**.
298
+
299
+ ๐Ÿ“ฆ **[OptiKit on NPM](https://www.npmjs.com/package/optikit)** | ๐Ÿ”— **[GitHub](https://github.com/dev-mahmoud-elshenawy/optikit)** | ๐Ÿ”— **[Opticore on pub.dev](https://pub.dev/packages/opticore)**
300
+
301
+ ---
302
+
303
+ ## ๐Ÿ‘ค Created By
304
+
305
+ <div align="center">
306
+
307
+ ### Built with โค๏ธ by [Mahmoud El Shenawy](https://github.com/dev-mahmoud-elshenawy)
308
+
309
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?logo=linkedin&logoColor=white&style=for-the-badge)](https://www.linkedin.com/in/dev-mahmoud-elshenawy)
310
+ [![GitHub](https://img.shields.io/badge/GitHub-181717?logo=github&logoColor=white&style=for-the-badge)](https://github.com/dev-mahmoud-elshenawy)
311
+ [![Medium](https://img.shields.io/badge/Medium-000000?logo=medium&logoColor=white&style=for-the-badge)](https://medium.com/@dev-mahmoud-elshenawy)
312
+
313
+ </div>
314
+
315
+ ---
316
+
317
+ ## ๐Ÿ“œ License
318
+
319
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](./LICENSE)
320
+
321
+ **OptiKit** is open-source under the **[MIT License](./LICENSE)**. Free for personal and commercial use.