@geastack/cli 0.1.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/docs/SETUP.md ADDED
@@ -0,0 +1,276 @@
1
+ # GeaStack Setup
2
+
3
+ This guide gets a fresh machine ready to create, build, simulate, and flash Gea
4
+ apps through the npm-first GeaStack flow.
5
+
6
+ Start by running:
7
+
8
+ ```sh
9
+ npx gea doctor
10
+ ```
11
+
12
+ `doctor` checks the active app, board configuration, and the toolchains below.
13
+
14
+ ## Minimum Setup
15
+
16
+ Private npmjs command shape:
17
+
18
+ ```sh
19
+ npm login
20
+ npx @geastack/create-geastack my-app
21
+ cd my-app
22
+ npx gea setup
23
+ ```
24
+
25
+ For simulator-only development:
26
+
27
+ - Node.js 20.19 or newer.
28
+ - npm.
29
+ - Emscripten SDK if you want `npx gea build --target web` and the WASM simulator
30
+ bundle path.
31
+
32
+ For ESP32 hardware:
33
+
34
+ - Node.js 20.19 or newer.
35
+ - npm.
36
+ - Python 3.
37
+ - ESP-IDF v6.0.1.
38
+ - `.gea/boards.json` configured for your board.
39
+
40
+ For the Waveshare ESP32-S3 AMOLED board, use
41
+ [ESP32-WAVESHARE-AMOLED-QUICKSTART.md](ESP32-WAVESHARE-AMOLED-QUICKSTART.md).
42
+
43
+ For Apple targets:
44
+
45
+ - macOS.
46
+ - Xcode with iOS/macOS SDKs.
47
+ - Xcode command line tools.
48
+ - iOS Simulator runtime if building/running iOS simulator apps.
49
+
50
+ For Android targets:
51
+
52
+ - Android SDK command-line tools and platform tools.
53
+ - `adb` on `PATH`.
54
+ - A Java JDK with `javac`.
55
+ - `ANDROID_HOME` or `ANDROID_SDK_ROOT` pointing at the Android SDK.
56
+
57
+ ## Node And npm
58
+
59
+ Install Node.js from the official download page or your normal version manager.
60
+ GeaStack currently requires Node.js 20.19 or newer. Node 24 LTS is a good
61
+ default on new machines.
62
+
63
+ Verify:
64
+
65
+ ```sh
66
+ node --version
67
+ npm --version
68
+ ```
69
+
70
+ ## ESP-IDF For ESP32 Targets
71
+
72
+ The embedded board scripts currently target ESP-IDF v6.0.1. Newer ESP-IDF
73
+ 6.0.x releases may work, but v6.0.1 is the known target until the board scripts
74
+ are updated.
75
+
76
+ Command-line install:
77
+
78
+ ```sh
79
+ npx gea setup --esp-idf
80
+ ```
81
+
82
+ Equivalent manual install:
83
+
84
+ ```sh
85
+ mkdir -p "$HOME/esp"
86
+ cd "$HOME/esp"
87
+ git clone -b v6.0.1 --recursive https://github.com/espressif/esp-idf.git
88
+ cd esp-idf
89
+ ./install.sh esp32,esp32s3,esp32p4
90
+ . ./export.sh
91
+ idf.py --version
92
+ ```
93
+
94
+ For every new shell where you build or flash ESP32 firmware, source the export
95
+ script:
96
+
97
+ ```sh
98
+ . "$HOME/esp/esp-idf/export.sh"
99
+ ```
100
+
101
+ If ESP-IDF lives somewhere else, either source that location's `export.sh` before
102
+ running Gea commands or set:
103
+
104
+ ```sh
105
+ export GEA_EMBEDDED_IDF_EXPORT="/path/to/esp-idf/export.sh"
106
+ ```
107
+
108
+ The board script also checks common locations such as `$HOME/esp/esp-idf`,
109
+ `$HOME/esp32/esp-idf`, and `$HOME/esp32/esp-idf-v6.0.1`.
110
+
111
+ Verify through GeaStack:
112
+
113
+ ```sh
114
+ npx gea doctor
115
+ npx gea setup
116
+ npx gea build --board amoled --dry-run
117
+ ```
118
+
119
+ Remove `--dry-run` when your board config is ready.
120
+
121
+ ## Emscripten For Web/WASM Simulator Builds
122
+
123
+ The live web dev loop uses Vite. The WASM simulator build path additionally
124
+ needs `emcc` from the Emscripten SDK.
125
+
126
+ Install with `emsdk`:
127
+
128
+ ```sh
129
+ git clone https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
130
+ cd "$HOME/emsdk"
131
+ ./emsdk install latest
132
+ ./emsdk activate latest
133
+ . ./emsdk_env.sh
134
+ emcc --version
135
+ ```
136
+
137
+ For every new shell where you run `npx gea build --target web`, source:
138
+
139
+ ```sh
140
+ . "$HOME/emsdk/emsdk_env.sh"
141
+ ```
142
+
143
+ Verify:
144
+
145
+ ```sh
146
+ npx gea doctor
147
+ npx gea build --target web
148
+ ```
149
+
150
+ ## Xcode For Apple Targets
151
+
152
+ Install Xcode from the Mac App Store or Apple Developer resources. Then make
153
+ sure command line tools point at the Xcode installation:
154
+
155
+ ```sh
156
+ xcode-select --install
157
+ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
158
+ xcodebuild -version
159
+ ```
160
+
161
+ Open Xcode once to finish first-run setup and install any required simulator
162
+ runtimes from Xcode Settings > Platforms.
163
+
164
+ For signed iOS device builds, set your Apple development team:
165
+
166
+ ```sh
167
+ export GEA_IOS_DEVELOPMENT_TEAM=ABCDE12345
168
+ ```
169
+
170
+ Verify:
171
+
172
+ ```sh
173
+ npx gea doctor
174
+ npx gea build --target macos
175
+ npx gea build --target ios --mode simulator
176
+ ```
177
+
178
+ ## Android SDK
179
+
180
+ Install Android Studio or the Android SDK command-line tools. Make sure the SDK
181
+ has at least one platform and build-tools package installed, then export:
182
+
183
+ ```sh
184
+ export ANDROID_HOME="$HOME/Library/Android/sdk"
185
+ export PATH="$ANDROID_HOME/platform-tools:$PATH"
186
+ ```
187
+
188
+ Verify:
189
+
190
+ ```sh
191
+ adb version
192
+ javac --version
193
+ npx gea doctor
194
+ npx gea build css-3d-cube --target android
195
+ ```
196
+
197
+ For an attached Android device or board with USB debugging enabled:
198
+
199
+ ```sh
200
+ npx gea build css-3d-cube --target android --mode device
201
+ ```
202
+
203
+ If more than one adb is installed, point Gea at the one you want:
204
+
205
+ ```sh
206
+ GEA_ANDROID_ADB="$ANDROID_HOME/platform-tools/adb" \
207
+ GEA_ANDROID_SERIAL="<adb-serial>" \
208
+ npx gea build css-3d-cube --target android --mode device
209
+ ```
210
+
211
+ ## Python
212
+
213
+ Python 3 is used by device helpers, serial helpers, screenshots, and GeaOS
214
+ device scripts.
215
+
216
+ Verify:
217
+
218
+ ```sh
219
+ python3 --version
220
+ ```
221
+
222
+ If your platform does not provide Python 3, install it with your OS package
223
+ manager or from python.org.
224
+
225
+ ## Board Configuration
226
+
227
+ Board aliases are project-local machine configuration. `create-geastack`
228
+ creates an empty `.gea/boards.json`, and `npx gea setup` writes aliases there.
229
+ Example:
230
+
231
+ ```json
232
+ {
233
+ "amoled": {
234
+ "target": "esp32-s3-touch-amoled-2.06",
235
+ "adapter": "esp32-idf",
236
+ "transports": {
237
+ "usbSerial": {
238
+ "serial": "YOUR_BOARD_USB_SERIAL"
239
+ }
240
+ }
241
+ }
242
+ }
243
+ ```
244
+
245
+ Then check discovery:
246
+
247
+ ```sh
248
+ npx gea setup
249
+ npx gea list boards
250
+ npx gea list targets
251
+ npx gea doctor
252
+ ```
253
+
254
+ ## Common Verification Flow
255
+
256
+ After installing tools:
257
+
258
+ ```sh
259
+ npx gea doctor
260
+ npx gea inspect
261
+ npx gea dev
262
+ npx gea build --target web
263
+ npx gea setup
264
+ npx gea build --board amoled --dry-run
265
+ npx gea flash --board amoled --monitor
266
+ ```
267
+
268
+ Use `--dry-run` first when checking command routing. Remove it when the target
269
+ toolchain and board config are ready.
270
+
271
+ ## Useful References
272
+
273
+ - ESP-IDF Programming Guide: https://docs.espressif.com/projects/esp-idf/
274
+ - Emscripten SDK downloads: https://emscripten.org/docs/getting_started/downloads.html
275
+ - Node.js downloads: https://nodejs.org/en/download
276
+ - Xcode resources: https://developer.apple.com/xcode/resources/
package/docs/SPEC.md ADDED
@@ -0,0 +1,217 @@
1
+ # Gea CLI Specification
2
+
3
+ This document captures the first useful shape of the `gea` command. The first
4
+ implementation now ships in this repo; keep this spec aligned as the command
5
+ surface grows.
6
+
7
+ ## Goals
8
+
9
+ The CLI should make GeaStack feel like one npm-first toolchain:
10
+
11
+ - start a web simulator for an app;
12
+ - build an app for a selected target;
13
+ - flash or install an app on hardware;
14
+ - monitor logs;
15
+ - diagnose missing toolchains, target backends, and board configuration;
16
+ - scaffold a new app with a valid `gea` manifest.
17
+
18
+ ## Non-Goals
19
+
20
+ The CLI should not duplicate target internals. It should delegate to stable
21
+ backend commands owned by target repos.
22
+
23
+ Examples:
24
+
25
+ - ESP32 board flashing stays in `targets`.
26
+ - Web simulator launch stays in `simulator`.
27
+ - Apple project generation stays in `apple`.
28
+ - Android APK packaging stays in `android`.
29
+ - GeaOS image and device helpers stay in `geaos`.
30
+
31
+ ## Command Surface
32
+
33
+ ### `gea dev`
34
+
35
+ Starts the fastest local development loop for an app.
36
+
37
+ Expected behavior:
38
+
39
+ - Resolve the app from the current folder, `--app`, or `package.json`.
40
+ - Pick a default target of `web` unless `--target` says otherwise.
41
+ - For web, delegate to `simulator/targets/web/dev-web.mjs`.
42
+ - For hardware targets, print the intended build/deploy path and recommend
43
+ `gea flash` when live dev is not available.
44
+
45
+ ### `gea build`
46
+
47
+ Builds an app for a target without mutating hardware.
48
+
49
+ Expected options:
50
+
51
+ ```sh
52
+ gea build --app bouncing-balls-jsx --target web
53
+ gea build --app bouncing-balls-jsx --target esp32-s3-touch-amoled-2.06
54
+ gea build --app notes-native --target macos
55
+ gea build --app css-3d-cube --target android
56
+ ```
57
+
58
+ ### `gea setup`
59
+
60
+ Runs one-time target initialization for a board or built-in target.
61
+
62
+ Expected options:
63
+
64
+ ```sh
65
+ gea setup --board amoled
66
+ gea setup --target esp32-s3-touch-amoled-2.06
67
+ ```
68
+
69
+ Without `--board` or `--target`, `gea setup` opens the interactive setup wizard.
70
+ The wizard should support known boards and rich custom board profiles. When the
71
+ selected profile is flash-ready, the wizard initializes the board target before
72
+ returning.
73
+
74
+ ### `gea flash`
75
+
76
+ Builds and deploys an app to a physical target.
77
+
78
+ Expected options:
79
+
80
+ ```sh
81
+ gea flash --app bouncing-balls-jsx --board amoled
82
+ gea flash --app bouncing-balls-jsx --board amoled --monitor
83
+ gea flash --app css-3d-cube --target android
84
+ ```
85
+
86
+ The CLI should pass through board aliases from the active board config. A project
87
+ uses its own `.gea/boards.json`; otherwise the CLI reads the board catalog shipped
88
+ by the installed `@geastack/targets` package.
89
+
90
+ ### `gea monitor`
91
+
92
+ Starts a log monitor for a configured board or target.
93
+
94
+ Expected options:
95
+
96
+ ```sh
97
+ gea monitor --board amoled
98
+ gea monitor --target esp32-s3-touch-amoled-2.06
99
+ ```
100
+
101
+ ### `gea doctor`
102
+
103
+ Checks the local environment.
104
+
105
+ Minimum checks:
106
+
107
+ - Node/npm availability where required;
108
+ - ESP-IDF availability for ESP32 targets;
109
+ - Xcode availability for Apple targets;
110
+ - Android SDK and adb availability for Android targets;
111
+ - Python availability for device helpers;
112
+ - configured boards file validity;
113
+ - app manifest validity for the current folder.
114
+
115
+ Human-readable output should point to [SETUP.md](SETUP.md) whenever a required
116
+ or optional dependency is missing.
117
+
118
+ ### `create-geastack`
119
+
120
+ Scaffolds a new app folder with:
121
+
122
+ - `package.json` containing a `gea` manifest;
123
+ - a bundled counter starter, an empty starter, or a selected GitHub example;
124
+ - `index.tsx` or `index.ts`;
125
+ - `tsconfig.json`;
126
+ - `vite.config.ts`;
127
+ - `.gea/boards.json`;
128
+ - optional icons;
129
+ - target compatibility flags.
130
+
131
+ Interactive starter choices must explain the tradeoff in-line:
132
+
133
+ - `Counter starter`: copy the bundled minimal JSX counter with one tiny store.
134
+ - `Empty app`: generate the smallest blank app with no example-specific code.
135
+ - `Rich example`: fetch a selected app from `geastack/examples`, then rewrite
136
+ package name, app id, dependencies, and board config for the new project.
137
+
138
+ Rich example choices come from the hard-coded `examples/catalog.json`
139
+ included in the `@geastack/cli` package. The package does not vendor rich
140
+ example source files; it fetches the selected example from GitHub when the user
141
+ chooses it. Native examples are first-class catalog entries: an iOS example must
142
+ preserve `gea.targets.ios: true` so `npx gea build --target ios` routes through
143
+ the Apple backend, and a macOS example must preserve `gea.targets.macos: true`.
144
+
145
+ ## App Manifest
146
+
147
+ The CLI should recognize the `gea` field in `package.json`.
148
+
149
+ Core fields:
150
+
151
+ ```json
152
+ {
153
+ "gea": {
154
+ "id": "bouncing-balls-jsx",
155
+ "name": "Balls JSX",
156
+ "entry": "index.tsx",
157
+ "runtime": "gea",
158
+ "targets": {
159
+ "web": true,
160
+ "esp32": true,
161
+ "geaos": true,
162
+ "macos": false,
163
+ "ios": false,
164
+ "android": false
165
+ }
166
+ }
167
+ }
168
+ ```
169
+
170
+ Validation rules:
171
+
172
+ - `id` is required and should be stable.
173
+ - `entry` is required and must exist.
174
+ - `runtime` defaults to `gea` when omitted.
175
+ - `targets` must be explicit for generated apps.
176
+ - target backends may reject apps whose runtime or capabilities they do not
177
+ support.
178
+
179
+ ## Backend Contract
180
+
181
+ Each target backend should expose enough metadata for the CLI to:
182
+
183
+ - list target id, display name, platform, and capabilities;
184
+ - check local prerequisites;
185
+ - build one app;
186
+ - deploy one app when supported;
187
+ - monitor logs when supported;
188
+ - report useful errors in a structured way.
189
+
190
+ A backend command can be a script, Node module, or binary. The CLI should keep
191
+ the user-facing command stable even if a backend changes implementation
192
+ language.
193
+
194
+ ## Exit Codes
195
+
196
+ Use predictable exit codes:
197
+
198
+ | Code | Meaning |
199
+ | --- | --- |
200
+ | `0` | Success. |
201
+ | `1` | Generic command failure. |
202
+ | `2` | Invalid CLI usage or manifest. |
203
+ | `3` | Missing local dependency. |
204
+ | `4` | Target/backend unavailable. |
205
+ | `5` | Build failed. |
206
+ | `6` | Deploy or monitor failed. |
207
+
208
+ ## First Implementation Slice
209
+
210
+ 1. Implement `gea doctor` for toolchain discovery and app manifest validation.
211
+ 2. Implement `gea dev --target web` by delegating to the simulator repo.
212
+ 3. Implement `gea build --target web`.
213
+ 4. Implement `gea flash --board <alias>` by delegating to
214
+ `targets/scripts/board`.
215
+ 5. Add `create-geastack` with one JSX app template.
216
+
217
+ Status: implemented.