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