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.
- package/.claude/commands/build.md +57 -0
- package/.claude/commands/clean.md +45 -0
- package/.claude/commands/generate.md +64 -0
- package/.claude/commands/rollback.md +67 -0
- package/.claude/commands/run.md +63 -0
- package/.claude/commands/setup.md +69 -0
- package/.claude/commands/sync-docs.md +148 -0
- package/.claude/commands/version.md +63 -0
- package/.claude/settings.local.json +28 -0
- package/.claude-plugin/marketplace.json +36 -0
- package/.claude-plugin/plugin.json +25 -0
- package/.history/README_20260325211923.md +268 -0
- package/.history/README_20260325212116.md +268 -0
- package/.history/README_20260325212234.md +266 -0
- package/.history/README_20260325221838.md +321 -0
- package/.history/README_20260325221920.md +327 -0
- package/.history/README_20260325222245.md +328 -0
- package/.history/README_20260325222247.md +328 -0
- package/.mcp.json +8 -0
- package/CHANGELOG.md +79 -46
- package/CLAUDE.md +57 -206
- package/OPTIKIT_AGENT.md +398 -0
- package/README.md +293 -60
- package/dist/cli.js +75 -241
- package/dist/commands/build/commands.js +146 -0
- package/dist/commands/build/testflight.js +14 -0
- package/dist/commands/clean/commands.js +41 -0
- package/dist/commands/clean/flutter.js +8 -14
- package/dist/commands/clean/ios.js +12 -15
- package/dist/commands/config/aliases.js +122 -0
- package/dist/commands/config/commands.js +49 -0
- package/dist/commands/config/initApp.js +191 -0
- package/dist/commands/config/rollback.js +15 -4
- package/dist/commands/config/upgrade.js +36 -0
- package/dist/commands/mcp/commands.js +21 -0
- package/dist/commands/mcp/server.js +27 -0
- package/dist/commands/mcp/setup.js +62 -0
- package/dist/commands/mcp/tools.js +359 -0
- package/dist/commands/project/commands.js +132 -0
- package/dist/commands/project/devices.js +10 -26
- package/dist/commands/project/doctor.js +58 -0
- package/dist/commands/project/generate.js +183 -30
- package/dist/commands/project/setup.js +10 -28
- package/dist/commands/project/status.js +65 -0
- package/dist/commands/version/bump.js +96 -82
- package/dist/commands/version/commands.js +63 -0
- package/dist/commands/version/update.js +36 -24
- package/dist/constants.js +6 -1
- package/dist/styles.js +42 -5
- package/dist/utils/helpers/error.js +14 -0
- package/dist/utils/helpers/file.js +1 -1
- package/dist/utils/helpers/version.js +2 -1
- package/dist/utils/services/backup.js +12 -1
- package/dist/utils/services/command.js +1 -34
- package/dist/utils/services/exec.js +76 -101
- package/dist/utils/services/logger.js +10 -4
- package/dist/utils/validators/validation.js +24 -12
- package/docs/INSTALLATION.md +72 -0
- package/docs/TROUBLESHOOT.md +140 -0
- package/docs/USAGE.md +185 -0
- package/docs/VERSION_MANAGEMENT.md +177 -0
- package/package.json +7 -11
- package/src/cli.ts +82 -362
- package/src/commands/build/commands.ts +169 -0
- package/src/commands/build/testflight.ts +18 -0
- package/src/commands/clean/commands.ts +43 -0
- package/src/commands/clean/flutter.ts +9 -13
- package/src/commands/clean/ios.ts +13 -13
- package/src/commands/config/aliases.ts +150 -0
- package/src/commands/config/commands.ts +50 -0
- package/src/commands/config/initApp.ts +213 -0
- package/src/commands/config/rollback.ts +16 -4
- package/src/commands/config/upgrade.ts +40 -0
- package/src/commands/mcp/commands.ts +23 -0
- package/src/commands/mcp/server.ts +35 -0
- package/src/commands/mcp/setup.ts +69 -0
- package/src/commands/mcp/tools.ts +365 -0
- package/src/commands/project/commands.ts +132 -0
- package/src/commands/project/devices.ts +11 -24
- package/src/commands/project/doctor.ts +81 -0
- package/src/commands/project/generate.ts +211 -32
- package/src/commands/project/setup.ts +13 -30
- package/src/commands/project/status.ts +72 -0
- package/src/commands/version/bump.ts +124 -85
- package/src/commands/version/commands.ts +76 -0
- package/src/commands/version/update.ts +86 -75
- package/src/constants.ts +7 -1
- package/src/styles.ts +49 -7
- package/src/utils/helpers/error.ts +16 -0
- package/src/utils/helpers/file.ts +1 -1
- package/src/utils/helpers/version.ts +2 -1
- package/src/utils/services/backup.ts +17 -1
- package/src/utils/services/command.ts +1 -58
- package/src/utils/services/exec.ts +92 -117
- package/src/utils/services/logger.ts +12 -4
- package/src/utils/validators/validation.ts +24 -12
- package/CODE_QUALITY.md +0 -398
- package/ENHANCEMENTS.md +0 -310
- package/FEATURE_ENHANCEMENTS.md +0 -435
- package/INSTALLATION.md +0 -118
- package/SAFETY_FEATURES.md +0 -396
- package/TROUBLESHOOT.md +0 -60
- package/USAGE.md +0 -388
- package/VERSION_MANAGEMENT.md +0 -438
package/OPTIKIT_AGENT.md
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
# OptiKit CLI — AI Agent Reference
|
|
2
|
+
|
|
3
|
+
Add this file to the root of any Flutter project and reference it in your AI assistant's context so it knows exactly how to use the OptiKit CLI.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What is OptiKit?
|
|
8
|
+
|
|
9
|
+
OptiKit (`optikit`) is a CLI tool for Flutter developers that automates:
|
|
10
|
+
- Module scaffolding (full BLoC pattern for the Opticore framework)
|
|
11
|
+
- Version and build number management (iOS + Android independently)
|
|
12
|
+
- Production builds (APK, AAB, IPA, iOS)
|
|
13
|
+
- Project cleaning (Flutter + iOS CocoaPods with automatic retry)
|
|
14
|
+
- Device management and app running
|
|
15
|
+
- Automatic timestamped backups before every destructive operation
|
|
16
|
+
- Config initialization and backup rollback
|
|
17
|
+
|
|
18
|
+
Install globally: `npm install -g optikit`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Non-Negotiable Rules
|
|
23
|
+
|
|
24
|
+
1. **Always run from Flutter project root** — the directory that contains `pubspec.yaml`
|
|
25
|
+
2. **FVM is on by default** — append `--disable-fvm` to any build/clean/run/devices command if the project has no `.fvm/flutter_sdk`
|
|
26
|
+
3. **Module names must be `snake_case`** — only lowercase letters, numbers, underscores (`^[a-z0-9_]+$`)
|
|
27
|
+
4. **Version format in `pubspec.yaml` must be `X.Y.Z+B`** — e.g. `1.2.3+45`
|
|
28
|
+
5. **All commands pre-validate** — they exit with code 1 and a clear error if the environment isn't valid
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Full Command Reference
|
|
33
|
+
|
|
34
|
+
### Configuration & Setup
|
|
35
|
+
|
|
36
|
+
| Command | What it does |
|
|
37
|
+
|---------|-------------|
|
|
38
|
+
| `optikit init` | Creates `.optikitrc.json`, adds `.optikit-backup/` to `.gitignore` |
|
|
39
|
+
| `optikit setup-vscode` | Creates `.vscode/settings.json` configured for FVM |
|
|
40
|
+
| `optikit rollback` | Lists all backups grouped by file with timestamps and sizes |
|
|
41
|
+
| `optikit rollback --restore <n>` | Restores backup number `n` from the list |
|
|
42
|
+
|
|
43
|
+
**Default `.optikitrc.json`** created by `optikit init`:
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"backupRetentionCount": 5,
|
|
47
|
+
"useFvmByDefault": true,
|
|
48
|
+
"autoBackup": true,
|
|
49
|
+
"verbose": false
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
Config lookup order: `./optikitrc.json` → `./.optikitrc` → `~/.optikitrc.json`
|
|
53
|
+
|
|
54
|
+
`optikit init` also appends `.optikit-backup/` to `.gitignore` automatically if `.gitignore` exists. If config already exists, it warns and exits without overwriting.
|
|
55
|
+
|
|
56
|
+
**VSCode `settings.json` template** (created by `setup-vscode`):
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"dart.flutterSdkPath": ".fvm/flutter_sdk",
|
|
60
|
+
"editor.formatOnSave": true,
|
|
61
|
+
"dart.previewFlutterUiGuides": true,
|
|
62
|
+
"files.exclude": {
|
|
63
|
+
"**/.git": true,
|
|
64
|
+
"**/.DS_Store": true,
|
|
65
|
+
"**/node_modules": true,
|
|
66
|
+
"**/build": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**`optikit rollback`** recursively searches for all `.optikit-backup/` directories (skips hidden dirs and `node_modules`), groups results by original file, shows index + timestamp + time-ago + file size in KB.
|
|
72
|
+
|
|
73
|
+
**`optikit rollback --restore <n>`** copies backup file `n` back to its original path.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Version & Build Number Management
|
|
78
|
+
|
|
79
|
+
Flutter has **two separate build numbers**:
|
|
80
|
+
- **Android**: the `+N` suffix in `pubspec.yaml` (`version: 1.2.3+45`) — must always increase on Google Play, never reset
|
|
81
|
+
- **iOS**: `CURRENT_PROJECT_VERSION` in `ios/Runner.xcodeproj/project.pbxproj` — resets to 1 per new version on App Store Connect
|
|
82
|
+
|
|
83
|
+
`optikit version` reads both independently and shows them:
|
|
84
|
+
```
|
|
85
|
+
📱 Current Version Information
|
|
86
|
+
|
|
87
|
+
Version: 1.2.3+45
|
|
88
|
+
Major: 1 Minor: 2 Patch: 3
|
|
89
|
+
Android Build: 45 ← from pubspec.yaml
|
|
90
|
+
iOS Build: 3 ← read directly from project.pbxproj
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Semantic Bump Commands
|
|
94
|
+
|
|
95
|
+
| Command | Version | Android Build | iOS Build | When to use |
|
|
96
|
+
|---------|---------|---------------|-----------|-------------|
|
|
97
|
+
| `optikit bump patch` | `+0.0.1` | `+1` | Reset to `1` | Bug fixes |
|
|
98
|
+
| `optikit bump minor` | `+0.1.0`, patch→0 | `+1` | Reset to `1` | New features |
|
|
99
|
+
| `optikit bump major` | `+1.0.0`, minor+patch→0 | `+1` | Reset to `1` | Breaking changes |
|
|
100
|
+
|
|
101
|
+
**Why iOS always resets to 1 on `bump`?**
|
|
102
|
+
App Store Connect requires unique build numbers *per version*. Build 1 of v1.0.0 and Build 1 of v1.0.1 are completely different submissions. This matches Apple's model.
|
|
103
|
+
|
|
104
|
+
**Why Android never resets?**
|
|
105
|
+
Google Play requires strictly increasing build numbers across all uploads ever. Resetting would reject the upload.
|
|
106
|
+
|
|
107
|
+
#### Build-Only Bump Commands
|
|
108
|
+
|
|
109
|
+
| Command | Version | Android Build | iOS Build | When to use |
|
|
110
|
+
|---------|---------|---------------|-----------|-------------|
|
|
111
|
+
| `optikit bump-ios` | unchanged | unchanged | reads actual iOS build from `project.pbxproj`, then `+1` | TestFlight re-upload |
|
|
112
|
+
| `optikit bump-android` | unchanged | `+1` | unchanged | Google Play re-upload |
|
|
113
|
+
| `optikit bump-build` | unchanged | `+1` | reads actual iOS build from `project.pbxproj`, then `+1` | Simultaneous re-upload both stores |
|
|
114
|
+
|
|
115
|
+
`bump-ios` and `bump-build` read the current iOS build from `ios/Runner.xcodeproj/project.pbxproj` (`CURRENT_PROJECT_VERSION`) — not from `pubspec.yaml`. If the file is missing, defaults to `1`.
|
|
116
|
+
|
|
117
|
+
#### Manual Version Override
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
optikit flutter-update-version \
|
|
121
|
+
--app-version 2.0.0 \
|
|
122
|
+
--android-build 100 \
|
|
123
|
+
--ios-build 5
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
All three flags are optional. Passing an empty string for `--android-build` or `--ios-build` skips that platform's update. Omitting a flag defaults to empty (skip).
|
|
127
|
+
|
|
128
|
+
**Exact files modified by ALL version commands (with backups created before each write):**
|
|
129
|
+
1. `pubspec.yaml` — regex-replaces `version: X.Y.Z+B`
|
|
130
|
+
2. `ios/Runner.xcodeproj/project.pbxproj` — replaces `MARKETING_VERSION = ...;` and `CURRENT_PROJECT_VERSION = ...;`
|
|
131
|
+
3. `ios/Runner/Info.plist` — replaces `CFBundleShortVersionString` and `CFBundleVersion` values
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### Build Commands
|
|
136
|
+
|
|
137
|
+
All builds run in `--release` mode. APK and Bundle also add `--obfuscate --split-debug-info=build/app/outputs/symbols`. Build commands do **not** modify source files and do **not** create backups.
|
|
138
|
+
|
|
139
|
+
| Command | Flutter command | Extra flags | Platform validation |
|
|
140
|
+
|---------|----------------|-------------|-------------------|
|
|
141
|
+
| `optikit flutter-build-apk` | `flutter build apk` | `--release --obfuscate --split-debug-info=build/app/outputs/symbols` | `android/` + `build.gradle` |
|
|
142
|
+
| `optikit flutter-build-bundle` | `flutter build appbundle` | `--release --obfuscate --split-debug-info=build/app/outputs/symbols` | `android/` + `build.gradle` |
|
|
143
|
+
| `optikit flutter-build-ios` | `flutter build ios` | `--release` | `ios/` + `Runner.xcodeproj` or `.xcworkspace` |
|
|
144
|
+
| `optikit flutter-build-ipa` | `flutter build ipa` | `--release` | `ios/` + `Runner.xcodeproj` or `.xcworkspace` |
|
|
145
|
+
|
|
146
|
+
All accept `--disable-fvm`. FVM versions prepend `fvm` to every flutter command.
|
|
147
|
+
|
|
148
|
+
**Build output paths:**
|
|
149
|
+
- APK: `build/app/outputs/flutter-apk/`
|
|
150
|
+
- Bundle: `build/app/outputs/bundle/release/`
|
|
151
|
+
- IPA: `build/ios/ipa/`
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### Open Outputs & IDEs
|
|
156
|
+
|
|
157
|
+
| Command | Opens |
|
|
158
|
+
|---------|-------|
|
|
159
|
+
| `optikit open-apk` | `build/app/outputs/flutter-apk/` |
|
|
160
|
+
| `optikit open-bundle` | `build/app/outputs/bundle/release/` |
|
|
161
|
+
| `optikit open-ipa` | `build/ios/ipa/` |
|
|
162
|
+
| `optikit open-ios` | Xcode via `open ios/Runner.xcworkspace` |
|
|
163
|
+
| `optikit open-android` | Android Studio (macOS: `open -a 'Android Studio' android`, Windows: `start android`, Linux: `xdg-open android`) |
|
|
164
|
+
|
|
165
|
+
All open commands validate Flutter project + platform project before opening. Cross-platform.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### Clean Commands
|
|
170
|
+
|
|
171
|
+
**`optikit clean-flutter`** runs 3 steps in sequence:
|
|
172
|
+
1. `fvm flutter clean` (or `flutter clean` with `--disable-fvm`)
|
|
173
|
+
2. Backs up `pubspec.lock` → deletes it
|
|
174
|
+
3. `fvm flutter pub get`
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
optikit clean-flutter
|
|
178
|
+
optikit clean-flutter --disable-fvm
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**`optikit clean-ios`** runs a deep CocoaPods reset:
|
|
182
|
+
1. Checks if `Flutter.xcframework` exists in the SDK cache — runs `fvm flutter precache --ios` if missing
|
|
183
|
+
2. Deletes `ios/Podfile.lock`
|
|
184
|
+
3. `pod deintegrate`
|
|
185
|
+
4. If `--clean-cache`: `pod cache clean --all`
|
|
186
|
+
5. If `--repo-update`: `pod repo update` (3 retries, 10s delay) → `pod update` (3 retries, 10s delay)
|
|
187
|
+
6. Otherwise: `pod install` (3 retries, 10s delay)
|
|
188
|
+
|
|
189
|
+
All pod operations run inside the `ios/` directory. **10-minute timeout** per operation. **3 retries with 10s delay** for network-sensitive operations.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
optikit clean-ios # basic: deintegrate + pod install
|
|
193
|
+
optikit clean-ios --clean-cache # + wipe pod cache
|
|
194
|
+
optikit clean-ios --repo-update # + update repos + pod update
|
|
195
|
+
optikit clean-ios --clean-cache --repo-update # full nuclear clean
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### Device & Run Commands
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
optikit devices # list all connected devices (numbered, with IDs)
|
|
204
|
+
optikit devices --disable-fvm
|
|
205
|
+
|
|
206
|
+
optikit run # run on default device
|
|
207
|
+
optikit run -d <device-id> # run on specific device (--device)
|
|
208
|
+
optikit run -r # run in release mode (--release)
|
|
209
|
+
optikit run -f <flavor> # run with flavor (--flavor)
|
|
210
|
+
optikit run --disable-fvm
|
|
211
|
+
|
|
212
|
+
optikit run-select # interactive: shows numbered device list, prompts for selection
|
|
213
|
+
optikit run-select -r # same but release mode
|
|
214
|
+
optikit run-select -f <flavor>
|
|
215
|
+
optikit run-select --disable-fvm
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
`optikit devices` uses `flutter devices --machine` (JSON), then displays: number, name, platform, `[Emulator]` or `[Physical]`, and device ID.
|
|
219
|
+
|
|
220
|
+
`optikit run-select` shows the same list, prompts for a number, then internally calls `runApp` with the selected device ID.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### Module Generation (Opticore BLoC Only)
|
|
225
|
+
|
|
226
|
+
> Only for projects using the [Opticore](https://pub.dev/packages/opticore) framework.
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
optikit generate module <module_name>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Validation:** name must match `^[a-z0-9_]+$`. Empty name exits with error. Existing module warns and overwrites.
|
|
233
|
+
|
|
234
|
+
**Generated structure under `lib/module/<module_name>/`:**
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
lib/module/user_profile/
|
|
238
|
+
├── import/ user_profile_import.dart ← central hub
|
|
239
|
+
├── bloc/ user_profile_bloc.dart
|
|
240
|
+
├── event/ user_profile_event.dart
|
|
241
|
+
├── state/ user_profile_state.dart
|
|
242
|
+
├── screen/ user_profile_screen.dart
|
|
243
|
+
└── factory/ user_profile_factory.dart
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Class naming rule:** `user_profile` → prefix `UserProfile` (snake_case words capitalized, joined). Suffix determined by file type:
|
|
247
|
+
- `user_profile_bloc.dart` → `UserProfileBloc`
|
|
248
|
+
- `user_profile_event.dart` → `UserProfileInitialEvent`
|
|
249
|
+
- `user_profile_state.dart` → `UserProfileInitialState`
|
|
250
|
+
- `user_profile_screen.dart` → `UserProfileScreen`
|
|
251
|
+
- `user_profile_factory.dart` → `UserProfileStateFactory`
|
|
252
|
+
|
|
253
|
+
**Generated `user_profile_import.dart`:**
|
|
254
|
+
```dart
|
|
255
|
+
import 'package:flutter/material.dart';
|
|
256
|
+
import 'package:opticore/opticore.dart';
|
|
257
|
+
|
|
258
|
+
part '../bloc/user_profile_bloc.dart';
|
|
259
|
+
part '../event/user_profile_event.dart';
|
|
260
|
+
part '../screen/user_profile_screen.dart';
|
|
261
|
+
part '../state/user_profile_state.dart';
|
|
262
|
+
part '../factory/user_profile_factory.dart';
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
All other files start with `part of '../import/user_profile_import.dart';`
|
|
266
|
+
|
|
267
|
+
**Bloc template:**
|
|
268
|
+
```dart
|
|
269
|
+
class UserProfileBloc extends BaseBloc {
|
|
270
|
+
UserProfileBloc() : super(UserProfileStateFactory(), initialState: UserProfileInitialState()) {}
|
|
271
|
+
@override void onDispose() {}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Screen template** extends `BaseScreen<Bloc, Widget, dynamic>` with `buildWidget` and `listenToState`.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Automatic Backup System (Deep Detail)
|
|
280
|
+
|
|
281
|
+
**Triggered by:** `flutter-update-version`, all `bump*` commands, `clean-flutter` (for `pubspec.lock`)
|
|
282
|
+
|
|
283
|
+
**Backup location:** `.optikit-backup/` directory **next to each original file**
|
|
284
|
+
|
|
285
|
+
**Naming:** `<filename>_<ISO8601>.<ext>` with `:` and `.` replaced by `-`
|
|
286
|
+
Example: `pubspec_2025-12-23T10-30-00-000Z.yaml`
|
|
287
|
+
|
|
288
|
+
**Retention:** Last 5 backups per directory kept (sorted by modification time, oldest deleted)
|
|
289
|
+
|
|
290
|
+
**Backup structure:**
|
|
291
|
+
```
|
|
292
|
+
your-flutter-project/
|
|
293
|
+
├── pubspec.yaml
|
|
294
|
+
├── .optikit-backup/
|
|
295
|
+
│ ├── pubspec_2025-12-23T10-30-00-000Z.yaml
|
|
296
|
+
│ └── pubspec_2025-12-23T11-00-00-000Z.yaml
|
|
297
|
+
└── ios/
|
|
298
|
+
├── Runner.xcodeproj/
|
|
299
|
+
│ └── .optikit-backup/
|
|
300
|
+
│ └── project_2025-12-23T10-30-00-000Z.pbxproj
|
|
301
|
+
└── Runner/
|
|
302
|
+
└── .optikit-backup/
|
|
303
|
+
└── Info_2025-12-23T10-30-00-000Z.plist
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`optikit rollback` searches recursively for `.optikit-backup/` dirs, skipping hidden dirs and `node_modules`. Groups results by original file (recovers original path by stripping timestamp from backup filename). Displays index, timestamp, time-ago string (e.g. `5m ago`), and file size in KB.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Pre-Flight Validation (All Commands)
|
|
311
|
+
|
|
312
|
+
| Check | How it validates |
|
|
313
|
+
|-------|-----------------|
|
|
314
|
+
| Flutter project | `pubspec.yaml` exists AND contains `flutter:` SDK reference |
|
|
315
|
+
| Flutter SDK (FVM mode) | `.fvm/flutter_sdk` dir exists AND `fvm` binary reachable |
|
|
316
|
+
| Flutter SDK (global mode) | `flutter` binary reachable in PATH |
|
|
317
|
+
| iOS project | `ios/` dir exists AND (`Runner.xcodeproj` OR `Runner.xcworkspace`) present |
|
|
318
|
+
| Android project | `android/` dir exists AND (`build.gradle` OR `build.gradle.kts`) present |
|
|
319
|
+
|
|
320
|
+
Failure = clear colored error message + `process.exit(1)`. No partial execution.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Common Workflows
|
|
325
|
+
|
|
326
|
+
### Release new version → both stores
|
|
327
|
+
```bash
|
|
328
|
+
optikit version
|
|
329
|
+
optikit bump patch # 1.2.3+45 → 1.2.4+46 (iOS: 1)
|
|
330
|
+
optikit flutter-build-ipa
|
|
331
|
+
optikit flutter-build-bundle
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Multiple TestFlight uploads (same version)
|
|
335
|
+
```bash
|
|
336
|
+
optikit bump-ios && optikit flutter-build-ipa # iOS: 2
|
|
337
|
+
optikit bump-ios && optikit flutter-build-ipa # iOS: 3
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Android hotfix only
|
|
341
|
+
```bash
|
|
342
|
+
optikit bump-android && optikit flutter-build-bundle
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Full nuclear iOS clean (CocoaPods issues)
|
|
346
|
+
```bash
|
|
347
|
+
optikit clean-flutter
|
|
348
|
+
optikit clean-ios --clean-cache --repo-update
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Scaffold new feature module
|
|
352
|
+
```bash
|
|
353
|
+
optikit generate module payment_gateway
|
|
354
|
+
# wire PaymentGatewayScreen into your router
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Recover from bad version bump
|
|
358
|
+
```bash
|
|
359
|
+
optikit rollback # numbered list
|
|
360
|
+
optikit rollback --restore 1 # restore most recent
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### New project onboarding
|
|
364
|
+
```bash
|
|
365
|
+
optikit init # .optikitrc.json + .gitignore entry
|
|
366
|
+
optikit setup-vscode # .vscode/settings.json
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## AI Decision Guide
|
|
372
|
+
|
|
373
|
+
| User says… | Command |
|
|
374
|
+
|---|---|
|
|
375
|
+
| "bump version" / "release a patch" | `optikit bump patch` |
|
|
376
|
+
| "new feature bump" | `optikit bump minor` |
|
|
377
|
+
| "breaking change" | `optikit bump major` |
|
|
378
|
+
| "TestFlight re-upload" / "another iOS build" | `optikit bump-ios` |
|
|
379
|
+
| "Play Store re-upload" / "another Android build" | `optikit bump-android` |
|
|
380
|
+
| "both stores, same version" | `optikit bump-build` |
|
|
381
|
+
| "what version are we on?" | `optikit version` |
|
|
382
|
+
| "set version manually to X.Y.Z" | `optikit flutter-update-version --app-version X.Y.Z --android-build N --ios-build N` |
|
|
383
|
+
| "build APK" | `optikit flutter-build-apk` |
|
|
384
|
+
| "build IPA" / "build for iOS" | `optikit flutter-build-ipa` |
|
|
385
|
+
| "build AAB" / "build bundle" | `optikit flutter-build-bundle` |
|
|
386
|
+
| "build iOS app" (no archive) | `optikit flutter-build-ios` |
|
|
387
|
+
| "open Xcode" | `optikit open-ios` |
|
|
388
|
+
| "open Android Studio" | `optikit open-android` |
|
|
389
|
+
| "find my APK / IPA / bundle" | `optikit open-apk` / `optikit open-ipa` / `optikit open-bundle` |
|
|
390
|
+
| "clean the project" | `optikit clean-flutter` |
|
|
391
|
+
| "pod issues" / "iOS clean" | `optikit clean-ios --clean-cache --repo-update` |
|
|
392
|
+
| "create module X" / "scaffold X" | `optikit generate module <snake_case_name>` |
|
|
393
|
+
| "what devices are connected" | `optikit devices` |
|
|
394
|
+
| "run the app" | `optikit run` or `optikit run-select` |
|
|
395
|
+
| "run on specific device" | `optikit run --device <device-id>` |
|
|
396
|
+
| "something broke after version bump" | `optikit rollback` → `optikit rollback --restore <n>` |
|
|
397
|
+
| "setup this project" | `optikit init` |
|
|
398
|
+
| "setup VSCode / FVM path" | `optikit setup-vscode` |
|