agentic-mobile-kit 0.5.6 → 0.6.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/README.md +5 -1
- package/bin/cli.js +1 -1
- package/lib/init.js +70 -39
- package/package.json +4 -2
- package/stacks/react-native/expo/.agents/skills/LICENSE-expo +21 -0
- package/stacks/react-native/expo/.agents/skills/THIRD_PARTY.md +11 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/SKILL.md +151 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/agents/openai.yaml +4 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/config-plugin.md +90 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/create-expo-module.md +206 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/lifecycle.md +127 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/module-config.md +48 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/native-module.md +286 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/native-view.md +171 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/SKILL.md +240 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/agents/openai.yaml +4 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/form-sheet.md +253 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/route-structure.md +229 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/search.md +248 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/tabs.md +433 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/toolbar-and-headers.md +284 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/zoom-transitions.md +158 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/SKILL.md +150 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/agents/openai.yaml +4 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/expo-av-to-audio.md +132 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/expo-av-to-video.md +160 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/native-tabs.md +124 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/new-architecture.md +79 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/react-19.md +79 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/react-compiler.md +59 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/react-navigation-to-expo-router.md +61 -0
- package/stacks/react-native/expo/.rulesync/permissions.jsonc +40 -0
- package/stacks/react-native/expo/AGENTS.md +52 -0
- package/stacks/react-native/expo/docs/ai/expo.md +35 -0
- package/stacks/react-native/expo/docs/ai/known-issues.md +32 -0
- package/stacks/react-native/template/.agents/skills/m-release/SKILL.md +5 -5
- package/stacks/react-native/template/.github/workflows/e2e.yml +2 -0
- package/stacks/react-native/template/.github/workflows/ios.yml +2 -3
- package/stacks/react-native/template/AGENTS.md +1 -1
- package/stacks/react-native/template/codemagic.yaml +2 -1
- package/stacks/react-native/template/scripts/ai/pm-run.sh +12 -0
- package/stacks/react-native/template/scripts/ai/prebuild.sh +28 -0
- package/stacks/react-native/template/scripts/ai/release-build.sh +6 -2
- package/stacks/react-native/template/scripts/ai/release-check.js +69 -15
- package/stacks/react-native/template/scripts/ai/set-version.sh +19 -1
- package/stacks/react-native/template/scripts/ai/verify.sh +17 -4
- package/stacks/react-native/template/specs/_templates/flow.yaml +7 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Per-tool permission rules, generated by rulesync. A second layer: git hooks and CI are the real backstop,
|
|
2
|
+
// and Phase 0 showed Codex and the Antigravity CLI can still read .env, so keep real secrets out of the repo.
|
|
3
|
+
// Expo apps: ios/ and android/ are generated by `expo prebuild`, so they're never edited by hand.
|
|
4
|
+
{
|
|
5
|
+
"permission": {
|
|
6
|
+
"bash": {
|
|
7
|
+
"rm -rf*": "deny",
|
|
8
|
+
"git reset --hard*": "deny",
|
|
9
|
+
"git push --force*": "deny",
|
|
10
|
+
"git push -f*": "deny",
|
|
11
|
+
"git clean -f*": "deny",
|
|
12
|
+
"git commit --no-verify*": "deny",
|
|
13
|
+
"xcrun simctl erase*": "deny",
|
|
14
|
+
"npm install *": "ask",
|
|
15
|
+
"yarn add*": "ask",
|
|
16
|
+
"pnpm add*": "ask",
|
|
17
|
+
"npx expo install *": "ask",
|
|
18
|
+
"eas *": "ask",
|
|
19
|
+
"npx eas-cli*": "ask"
|
|
20
|
+
},
|
|
21
|
+
"read": {
|
|
22
|
+
".env": "deny",
|
|
23
|
+
".env.*": "deny",
|
|
24
|
+
"**/*.keystore": "deny",
|
|
25
|
+
"**/*.jks": "deny",
|
|
26
|
+
"**/*.p8": "deny",
|
|
27
|
+
"**/*.p12": "deny",
|
|
28
|
+
"**/*.mobileprovision": "deny"
|
|
29
|
+
},
|
|
30
|
+
"edit": {
|
|
31
|
+
"ios/**": "deny",
|
|
32
|
+
"android/**": "deny",
|
|
33
|
+
"package.json": "ask",
|
|
34
|
+
"app.json": "ask",
|
|
35
|
+
"app.config.*": "ask",
|
|
36
|
+
"eas.json": "ask",
|
|
37
|
+
".github/workflows/**": "ask"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- KIT:START agentic-mobile-kit {{KIT_VERSION}} ci={{KIT_CI}} stack={{KIT_STACK}} (edit outside these markers; the kit updates what's inside) -->
|
|
2
|
+
# {{APP_NAME}}: instructions for AI agents
|
|
3
|
+
|
|
4
|
+
Read by Claude Code (through CLAUDE.md), Codex, Cursor, OpenCode, Kiro and Antigravity. Keep it short; details live in `docs/ai/`.
|
|
5
|
+
|
|
6
|
+
This project may also use other AI workflow frameworks (for example Superpowers, BMAD or proAgents). They keep working for everything else. When the user starts a task with an `m-` skill (`/m-feature`, `$m-feature`, …), follow that skill's steps for the whole task; where another framework's instructions differ, the `m-` skill wins.
|
|
7
|
+
|
|
8
|
+
## Project
|
|
9
|
+
|
|
10
|
+
- Expo SDK {{EXPO_SDK}}, React Native {{RN_VERSION}} ({{RN_ARCH}}), React {{REACT_VERSION}}, TypeScript {{TS_VERSION}}, Node {{NODE_VERSION}}. Package manager: {{PM}}.
|
|
11
|
+
- `ios/` and `android/` are generated by `npx expo prebuild` and aren't in git (Continuous Native Generation). The kit's scripts generate them when they need them.
|
|
12
|
+
- What the app does: `docs/ai/product.md`, and requirement by requirement, as it works now: `specs/current/`. Stack and services: `docs/ai/tech.md`. Folders and layers: `docs/ai/structure.md`. Code style: `docs/ai/conventions.md`.
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
| Task | Command |
|
|
17
|
+
|---|---|
|
|
18
|
+
| Install dependencies | `sh scripts/ai/install-deps.sh` |
|
|
19
|
+
| Add a library (ask first) | `npx expo install <package>`: the version that matches the SDK |
|
|
20
|
+
| Lint, typecheck, test (each skips what the app doesn't have yet) | `sh scripts/ai/pm-run.sh lint`, `sh scripts/ai/pm-run.sh typecheck`, `sh scripts/ai/pm-run.sh test` |
|
|
21
|
+
| Check dependency versions and the app config | `npx expo install --check`, `npx expo-doctor` |
|
|
22
|
+
| Check on devices (release builds, Maestro flows, screenshots) | `sh scripts/ai/verify.sh all --spec <id>`; another iOS scheme: `--scheme <name>` |
|
|
23
|
+
| Specs: progress, format check, fold a finished feature into the living spec | `node scripts/ai/spec.js status`, `node scripts/ai/spec.js check`, `node scripts/ai/spec.js merge <id>` |
|
|
24
|
+
| Check a release before tagging it (versions, permission texts, debug leftovers) | `node scripts/ai/release-check.js` |
|
|
25
|
+
| Signed release builds (a person runs them: they use the signing keys) | `sh scripts/ai/release-build.sh android`, `sh scripts/ai/release-build.sh ios` |
|
|
26
|
+
|
|
27
|
+
## Definition of done
|
|
28
|
+
|
|
29
|
+
A task is done only when:
|
|
30
|
+
1. lint, typecheck and tests pass, and you show the command output from this session;
|
|
31
|
+
2. UI changes were checked with `sh scripts/ai/verify.sh all --spec <id>` on both iOS and Android, and you looked at the screenshots. On Windows or Linux, that covers Android only: write in `progress.md` and the PR that iOS still needs checking on a Mac, and the PR isn't merged until a teammate with a Mac has done it;
|
|
32
|
+
3. the change stays inside the task's scope;
|
|
33
|
+
4. `specs/<id>/progress.md` is updated, when working from a spec.
|
|
34
|
+
|
|
35
|
+
Never say a check passed unless you ran it in this session.
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
|
|
39
|
+
- Stay inside the task. Ask before touching unrelated files.
|
|
40
|
+
- Ask before adding or upgrading dependencies, and before editing `package.json`, lockfiles, `app.json`, `app.config.*`, `eas.json` or `.github/workflows/`.
|
|
41
|
+
- Never edit `ios/` or `android/`: the next prebuild overwrites them. Native settings go in `app.json` or `app.config.*`, through config plugins; native code goes in an Expo module (`expo-module` skill). Ask before adding a config plugin.
|
|
42
|
+
- Never run `eas build`, `eas submit` or `eas update`: they build, ship or publish with the team's accounts, so a person runs them.
|
|
43
|
+
- Never read, print or commit `.env` files, keystores or signing files. Secrets don't belong in this repo.
|
|
44
|
+
- Never use `git commit --no-verify`, `git push --force`, `git reset --hard` or `rm -rf`.
|
|
45
|
+
- After 2 failed attempts at the same fix, stop and report what you found.
|
|
46
|
+
- Chat is not memory: write decisions into the spec or `docs/ai/decisions.md` straight away.
|
|
47
|
+
- Follow `docs/ai/expo.md`. Before fixing a build error, check `docs/ai/known-issues.md`.
|
|
48
|
+
|
|
49
|
+
## Skills
|
|
50
|
+
|
|
51
|
+
`expo-router`, `expo-upgrade`, `expo-module` (from Expo), `react-native-best-practices`, `react-navigation` (from Callstack), in `.agents/skills/`.
|
|
52
|
+
<!-- KIT:END agentic-mobile-kit -->
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Expo rules
|
|
2
|
+
|
|
3
|
+
Rules for things AI agents commonly get wrong in Expo apps. Each one comes from a documented platform change.
|
|
4
|
+
|
|
5
|
+
## Expo changes with every SDK
|
|
6
|
+
|
|
7
|
+
- Expo APIs are renamed and moved between SDKs, so don't write them from memory. Use the docs for this app's SDK (the version is in `AGENTS.md`): `https://docs.expo.dev/versions/v<SDK>.0.0/`. `https://docs.expo.dev/llms.txt` indexes all of Expo's docs.
|
|
8
|
+
- Add libraries with `npx expo install <package>`: it picks the version that matches the SDK. `npx expo install --check` lists the ones that don't match.
|
|
9
|
+
- Upgrade the SDK as a whole with the `expo-upgrade` skill, never one Expo package at a time.
|
|
10
|
+
- Without an ESLint config (`eslint.config.js`), the first `npx expo lint` installs ESLint and writes one, changing `package.json`. Ask before running it then.
|
|
11
|
+
|
|
12
|
+
## Native projects
|
|
13
|
+
|
|
14
|
+
- `ios/` and `android/` are generated by `npx expo prebuild` and aren't in git. Never edit them: the next prebuild overwrites the change.
|
|
15
|
+
- Native settings (permissions and their texts, bundle ID, entitlements) go in `app.json` or `app.config.*`. Libraries with native setup bring a config plugin; add it to `plugins`.
|
|
16
|
+
- Native code of the app's own goes in an Expo module (`expo-module` skill), not into the generated folders.
|
|
17
|
+
- A library with native code needs a new native build: Expo Go doesn't include it. `sh scripts/ai/verify.sh` makes release builds with the current native code.
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
- React Native 0.82 and later run only the New Architecture, and so does Expo. Libraries must support it.
|
|
22
|
+
|
|
23
|
+
## Screens and layout
|
|
24
|
+
|
|
25
|
+
- Use Expo Router for navigation (`expo-router` skill). Every file in the routes folder is a screen; keep components, hooks and utilities outside it.
|
|
26
|
+
- Use `react-native-safe-area-context` for safe areas. React Native's built-in `SafeAreaView` is deprecated and iOS-only.
|
|
27
|
+
- Android draws edge to edge (Android 15 and later), so handle top and bottom insets on every screen.
|
|
28
|
+
- For apps targeting Android 16 (API 36), `onBackPressed` is no longer called. Handle back with `BackHandler` in JS.
|
|
29
|
+
- Check every UI change on both iOS and Android; behavior differs (keyboard, insets, fonts, permissions).
|
|
30
|
+
- Give every interactive element a `testID` (kebab-case, for example `dark-mode-switch`). End-to-end tools tap by `testID`. On iOS, React Native exposes a label and its control as duplicate accessibility elements, so tapping by text can hit the label: nothing happens, yet the tool reports success.
|
|
31
|
+
|
|
32
|
+
## Performance and libraries
|
|
33
|
+
|
|
34
|
+
- Prefer Expo's own modules (`expo-image`, `expo-file-system`, `expo-secure-store`, …) when one fits.
|
|
35
|
+
- Follow the `react-native-best-practices` skill for lists, re-renders, startup time and bundle size.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Known issues
|
|
2
|
+
|
|
3
|
+
Recurring errors and their fixes. Check here before debugging a build error. Remove entries that no longer apply.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
### <short error text>
|
|
8
|
+
- **Cause:**
|
|
9
|
+
- **Fix:**
|
|
10
|
+
- **Prevention:**
|
|
11
|
+
|
|
12
|
+
## Entries
|
|
13
|
+
|
|
14
|
+
### A native change doesn't show up in the build
|
|
15
|
+
- **Cause:** the kit's scripts regenerate `ios/` and `android/` only when Expo's fingerprint changes. It covers the app config, config plugins and native libraries, but not, for example, a file that a config plugin reads.
|
|
16
|
+
- **Fix:** delete `ios/.amk-fingerprint` and `android/.amk-fingerprint`, then check again. The next build regenerates both folders and takes longer.
|
|
17
|
+
- **Prevention:** none needed for app config, plugin and library changes.
|
|
18
|
+
|
|
19
|
+
### Expo SDK 55: the Android release build fails with "libworklets.so … missing and no known rule to make it"
|
|
20
|
+
- **Cause:** SDK 55's `expo-modules-core` looks for `libworklets.so` in an older build-output folder (`node_modules/react-native-worklets/android/build/intermediates/cmake/release/obj/<abi>/`). `react-native-worklets` 0.7 builds it into `intermediates/cxx/RelWithDebInfo/<hash>/obj/<abi>/`. It fails without the kit too.
|
|
21
|
+
- **Fix:** move to a later Expo SDK (SDK 57 builds). Until then: build worklets once (`cd android && ./gradlew :react-native-worklets:assembleRelease`), copy each `libworklets.so` from `cxx/RelWithDebInfo/*/obj/<abi>/` to `cmake/release/obj/<abi>/`, and build again. The copy stays until `node_modules` is reinstalled.
|
|
22
|
+
- **Prevention:** upgrade the SDK.
|
|
23
|
+
|
|
24
|
+
### A library fails at build or run time right after it was added
|
|
25
|
+
- **Cause:** it was added with `npm install` or `yarn add`, so its version may not match the Expo SDK.
|
|
26
|
+
- **Fix:** `npx expo install --fix`, then `npx expo-doctor`.
|
|
27
|
+
- **Prevention:** add libraries with `npx expo install <package>`.
|
|
28
|
+
|
|
29
|
+
### "Unable to resolve module ./Name" in CI or a fresh clone, while it builds on your machine
|
|
30
|
+
- **Cause:** a file was renamed only in letter case (for example `storage.ts` to `Storage.ts`). macOS and Windows treat both names as the same file, so git kept the old name; Metro and Linux CI machines don't.
|
|
31
|
+
- **Fix:** rename it through git in two steps, then commit: `git mv src/utils/storage.ts src/utils/tmp.ts && git mv src/utils/tmp.ts src/utils/Storage.ts`.
|
|
32
|
+
- **Prevention:** rename files with `git mv`, not only in Finder or the editor.
|
|
@@ -21,12 +21,12 @@ Input: $ARGUMENTS (the new version such as 1.4.0, or patch, minor or major; whic
|
|
|
21
21
|
- `client.md`: for the client or product owner. Cover what's new, what's fixed, what they should test or do, and known issues.
|
|
22
22
|
|
|
23
23
|
Show all three files to the user and wait for their approval.
|
|
24
|
-
5. **Version and build numbers:** `sh scripts/ai/set-version.sh <version>` sets the iOS and Android version names. If the script stops because the project ships several apps, ask the user
|
|
25
|
-
- When CI or
|
|
26
|
-
- Otherwise every store upload needs a higher build number. Ask before changing native files. Then raise Android's `versionCode` in `android/app/build.gradle`, and set iOS with `cd ios && agvtool new-version -all <number>`. Never edit `project.pbxproj` by hand. iOS may keep its build number when the version name changes, if that's how the team works.
|
|
24
|
+
5. **Version and build numbers:** `sh scripts/ai/set-version.sh <version>` sets the iOS and Android version names; in Expo apps without native folders, `expo.version` in `app.json`. If the script stops because the project ships several apps, or computes its config in `app.config.*`, ask the user how to set each version, and set them after they confirm.
|
|
25
|
+
- When CI, fastlane or EAS sets the build numbers at build time (`release-check.js` in step 6 says so), leave them alone.
|
|
26
|
+
- Otherwise every store upload needs a higher build number. Ask before changing native files. Then raise Android's `versionCode` in `android/app/build.gradle`, and set iOS with `cd ios && agvtool new-version -all <number>`. Never edit `project.pbxproj` by hand. In Expo apps without native folders, raise `expo.ios.buildNumber` and `expo.android.versionCode` in `app.json` instead. iOS may keep its build number when the version name changes, if that's how the team works.
|
|
27
27
|
6. **Release check:** `node scripts/ai/release-check.js`. Show the output. Fix each ✗, asking first when the fix touches native config. List each ! for the user to decide.
|
|
28
28
|
7. **Release PR:** commit as `chore(release): <version>` (so the next changelog leaves it out), with `Assisted-by: <tool>/<model>`. Ask before pushing. Open a PR titled `Release <version>` with the changelog and the release-check output.
|
|
29
29
|
8. **Tag and build, after the merge.** Once the PR is merged, ask the user before tagging. Then run `git switch main && git pull && git tag v<version> && git push origin v<version>`.
|
|
30
30
|
- With Codemagic (`codemagic.yaml`; see `docs/ai/codemagic.md`), the tag starts the signed builds.
|
|
31
|
-
- With the team's own release tooling (fastlane lanes in `fastlane/`, `ios/fastlane/` or `android/fastlane/`, or release scripts in `package.json`), the user runs the lane or script that builds and uploads the release, instead of `release-build.sh`. Tell them which one; if it isn't clear, ask.
|
|
32
|
-
- Without CI, the user builds signed apps on their Mac, because signing keys stay with people. Tell them to run `sh scripts/ai/release-build.sh android [flavor]` and `sh scripts/ai/release-build.sh ios [scheme]`, and to upload the results from `.ai/release/` (Play Console, and Xcode's Organizer or Transporter). Never run these yourself or ask for the keys.
|
|
31
|
+
- With the team's own release tooling (fastlane lanes in `fastlane/`, `ios/fastlane/` or `android/fastlane/`, EAS builds set up in `eas.json`, or release scripts in `package.json`), the user runs the lane, `eas build` and `eas submit`, or the script that builds and uploads the release, instead of `release-build.sh`. Tell them which one; if it isn't clear, ask.
|
|
32
|
+
- Without CI, the user builds signed apps on their Mac, because signing keys stay with people. Tell them to run `sh scripts/ai/release-build.sh android [flavor]` and `sh scripts/ai/release-build.sh ios [scheme]`, and to upload the results from `.ai/release/` (Play Console, and Xcode's Organizer or Transporter). In Expo apps the script generates the native projects first, and iOS signing needs the Apple team in `app.json` (`expo.ios.appleTeamId`). Never run these yourself or ask for the keys.
|
|
@@ -43,6 +43,8 @@ jobs:
|
|
|
43
43
|
echo "$MAESTRO_SHA256 maestro.zip" | sha256sum -c -
|
|
44
44
|
unzip -q maestro.zip -d "$HOME" && rm maestro.zip
|
|
45
45
|
echo "$HOME/maestro/bin" >> "$GITHUB_PATH"
|
|
46
|
+
- name: Generate the native project (Expo apps without android/ in git)
|
|
47
|
+
run: sh scripts/ai/prebuild.sh android
|
|
46
48
|
- name: Build release APK
|
|
47
49
|
working-directory: android
|
|
48
50
|
run: ./gradlew assembleRelease --no-daemon
|
|
@@ -33,9 +33,8 @@ jobs:
|
|
|
33
33
|
with:
|
|
34
34
|
node-version: 24
|
|
35
35
|
- run: sh scripts/ai/install-deps.sh
|
|
36
|
-
- name: Generate the native project (Expo apps without ios/)
|
|
37
|
-
|
|
38
|
-
run: npx expo prebuild --platform ios --no-install
|
|
36
|
+
- name: Generate the native project (Expo apps without ios/ in git)
|
|
37
|
+
run: sh scripts/ai/prebuild.sh ios
|
|
39
38
|
- name: Install pods
|
|
40
39
|
run: sh scripts/ai/pod-install.sh
|
|
41
40
|
- name: Build for the simulator (no signing)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- KIT:START agentic-mobile-kit {{KIT_VERSION}} ci={{KIT_CI}} (edit outside these markers; the kit updates what's inside) -->
|
|
1
|
+
<!-- KIT:START agentic-mobile-kit {{KIT_VERSION}} ci={{KIT_CI}} stack={{KIT_STACK}} (edit outside these markers; the kit updates what's inside) -->
|
|
2
2
|
# {{APP_NAME}}: instructions for AI agents
|
|
3
3
|
|
|
4
4
|
Read by Claude Code (through CLAUDE.md), Codex, Cursor, OpenCode, Kiro and Antigravity. Keep it short; details live in `docs/ai/`.
|
|
@@ -27,6 +27,7 @@ workflows:
|
|
|
27
27
|
script: cp "release-notes/${CM_TAG#v}/play-store.txt" release_notes.txt 2>/dev/null || true
|
|
28
28
|
- name: Build the signed app bundle
|
|
29
29
|
script: |
|
|
30
|
+
sh scripts/ai/prebuild.sh android # Expo apps without android/ in git
|
|
30
31
|
echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties
|
|
31
32
|
package=$(sed -n -E 's/.*applicationId( =)? "([^"]+)".*/\2/p' android/app/build.gradle* | head -1)
|
|
32
33
|
if last=$(google-play get-latest-build-number --package-name "$package") && [ -n "$last" ]; then code=$((last + 1)); else code=$BUILD_NUMBER; fi
|
|
@@ -66,7 +67,7 @@ workflows:
|
|
|
66
67
|
- name: Release check
|
|
67
68
|
script: node scripts/ai/release-check.js
|
|
68
69
|
- name: Install dependencies
|
|
69
|
-
script: sh scripts/ai/install-deps.sh && sh scripts/ai/pod-install.sh
|
|
70
|
+
script: sh scripts/ai/install-deps.sh && sh scripts/ai/prebuild.sh ios && sh scripts/ai/pod-install.sh
|
|
70
71
|
- name: Store release notes
|
|
71
72
|
script: |
|
|
72
73
|
notes="release-notes/${CM_TAG#v}/app-store.txt"
|
|
@@ -9,6 +9,18 @@ if ! node -e "process.exit(require('./package.json').scripts?.[process.argv[1]]
|
|
|
9
9
|
exit 0
|
|
10
10
|
fi
|
|
11
11
|
|
|
12
|
+
# Expo apps: the first `expo lint` installs ESLint and changes package.json, which is the team's decision, not a check
|
|
13
|
+
if [ "$script" = lint ] && node -e "process.exit(/^expo lint/.test(require('./package.json').scripts.lint) ? 0 : 1)" &&
|
|
14
|
+
[ -z "$(ls eslint.config.* .eslintrc* 2> /dev/null)" ]; then
|
|
15
|
+
echo "skip: lint: ESLint isn't set up yet. Run npx expo lint once (it installs ESLint) and commit what it adds"
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
# Expo apps: `expo start` writes expo-env.d.ts (gitignored) with the types of Expo's CSS and asset imports.
|
|
19
|
+
# Fresh clones and CI haven't run it, so write the same file.
|
|
20
|
+
if [ "$script" = typecheck ] && [ ! -f expo-env.d.ts ] && grep -q 'expo-env\.d\.ts' tsconfig.json 2> /dev/null; then
|
|
21
|
+
printf '/// <reference types="expo/types" />\n\n// NOTE: This file should not be edited and should be in your git ignore' > expo-env.d.ts
|
|
22
|
+
fi
|
|
23
|
+
|
|
12
24
|
if [ -f yarn.lock ]; then yarn run "$script" "$@" # works on Yarn 1 and Yarn Berry
|
|
13
25
|
elif [ -f pnpm-lock.yaml ]; then pnpm -s "$script" "$@"
|
|
14
26
|
elif [ -f bun.lock ] || [ -f bun.lockb ]; then bun run "$script" "$@"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Expo apps whose ios/ and android/ aren't in git (Continuous Native Generation): generates the platform's native
|
|
3
|
+
# project with `expo prebuild`, so release builds can run. Does nothing for apps that keep the folders in git.
|
|
4
|
+
# Usage: sh scripts/ai/prebuild.sh ios|android
|
|
5
|
+
set -eu
|
|
6
|
+
platform=$1
|
|
7
|
+
[ -z "$(git ls-files -- "$platform")" ] || exit 0
|
|
8
|
+
node -e "const p = require('./package.json'); process.exit({ ...p.dependencies, ...p.devDependencies }.expo ? 0 : 1)" 2> /dev/null || exit 0
|
|
9
|
+
|
|
10
|
+
# prebuild recreates the folder, which throws away its pods and build caches. Expo's fingerprint covers everything
|
|
11
|
+
# the native project is generated from (app config, config plugins, native libraries): while it's unchanged since
|
|
12
|
+
# the last prebuild, the generated project is still right and the next build stays incremental.
|
|
13
|
+
stamp="$platform/.amk-fingerprint"
|
|
14
|
+
hash=$(node node_modules/expo/bin/fingerprint fingerprint:generate --platform "$platform" 2> /dev/null |
|
|
15
|
+
node -e 'try { console.log(JSON.parse(require("fs").readFileSync(0, "utf8")).hash) } catch {}') || hash=""
|
|
16
|
+
if [ -n "$hash" ] && [ "$(cat "$stamp" 2> /dev/null)" = "$hash" ]; then
|
|
17
|
+
echo "prebuild: $platform/ already matches the app config"
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# the first prebuild also writes into package.json (run scripts) and app.json (a placeholder bundle ID):
|
|
22
|
+
# put those files back, unless they already had changes of the team's
|
|
23
|
+
clean=$(for f in package.json app.json; do
|
|
24
|
+
if git ls-files --error-unmatch "$f" > /dev/null 2>&1 && git diff --quiet HEAD -- "$f"; then echo "$f"; fi
|
|
25
|
+
done)
|
|
26
|
+
CI=1 npx expo prebuild --platform "$platform" --no-install
|
|
27
|
+
for f in $clean; do git checkout -q HEAD -- "$f"; done
|
|
28
|
+
[ -z "$hash" ] || echo "$hash" > "$stamp"
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
# (or the one AMK_IOS_EXPORT_OPTIONS names): manual signing, ad hoc or enterprise. Without one, it exports for
|
|
15
15
|
# App Store Connect with automatic signing, using the Apple account in Xcode (Settings > Accounts); Xcode may
|
|
16
16
|
# create a distribution certificate or profile in that team if one is missing.
|
|
17
|
+
# Expo apps without native folders in git: it generates them first (expo prebuild). iOS signing then needs the
|
|
18
|
+
# Apple team in app.json (expo.ios.appleTeamId).
|
|
17
19
|
# Version and build numbers come from the repo, so set them first (the m-release skill does).
|
|
18
20
|
# Output: .ai/release/
|
|
19
21
|
set -eu
|
|
@@ -32,6 +34,7 @@ secret() {
|
|
|
32
34
|
|
|
33
35
|
case "$platform" in
|
|
34
36
|
android)
|
|
37
|
+
sh scripts/ai/prebuild.sh android
|
|
35
38
|
target=${target:-${AMK_ANDROID_FLAVOR:-}}
|
|
36
39
|
if [ -z "$target" ]; then
|
|
37
40
|
code=0
|
|
@@ -68,9 +71,10 @@ android)
|
|
|
68
71
|
done
|
|
69
72
|
;;
|
|
70
73
|
ios)
|
|
74
|
+
sh scripts/ai/prebuild.sh ios
|
|
75
|
+
if [ ! -d ios/Pods ] || [ ios/Podfile -nt ios/Pods/Manifest.lock ]; then sh scripts/ai/pod-install.sh; fi
|
|
71
76
|
workspace=$(ls -d ios/*.xcworkspace | head -n 1)
|
|
72
77
|
scheme=${target:-${AMK_IOS_SCHEME:-$(basename "$workspace" .xcworkspace)}}
|
|
73
|
-
[ -d ios/Pods ] || sh scripts/ai/pod-install.sh
|
|
74
78
|
log="$out/$scheme-ios.log"
|
|
75
79
|
echo "Archiving $scheme (several minutes; log: $log)"
|
|
76
80
|
xcodebuild -workspace "$workspace" -scheme "$scheme" -destination 'generic/platform=iOS' \
|
|
@@ -101,7 +105,7 @@ PLIST
|
|
|
101
105
|
echo "$ipa"
|
|
102
106
|
;;
|
|
103
107
|
*)
|
|
104
|
-
sed -n '2,
|
|
108
|
+
sed -n '2,20p' "$0"
|
|
105
109
|
exit 1
|
|
106
110
|
;;
|
|
107
111
|
esac
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
'use strict';
|
|
7
7
|
const fs = require('fs');
|
|
8
8
|
const path = require('path');
|
|
9
|
-
const { execFileSync } = require('child_process');
|
|
9
|
+
const { execFileSync, spawnSync } = require('child_process');
|
|
10
10
|
|
|
11
11
|
const args = process.argv.slice(2);
|
|
12
12
|
const argSince = args.includes('--since') ? args[args.indexOf('--since') + 1] : null;
|
|
@@ -30,14 +30,34 @@ const atTag = git('tag', '--points-at', 'HEAD') && git('status', '--porcelain')
|
|
|
30
30
|
const since = argSince || git('describe', '--tags', '--abbrev=0', ...(atTag ? ['HEAD^'] : []));
|
|
31
31
|
|
|
32
32
|
// ---------- files ----------
|
|
33
|
-
const
|
|
33
|
+
const pkg = JSON.parse(readNow('package.json') || '{}');
|
|
34
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
35
|
+
// Expo apps without native folders in git: ios/ and android/ are generated (and may be stale), so the checks read
|
|
36
|
+
// the app config instead, as `expo prebuild` applies it, with every config plugin
|
|
37
|
+
const expo = deps.expo && !git('ls-files', 'ios', 'android') ? expoConfig() : null;
|
|
38
|
+
function expoConfig() {
|
|
39
|
+
let cli;
|
|
40
|
+
try {
|
|
41
|
+
const dir = path.dirname(require.resolve('expo/package.json', { paths: [process.cwd()] }));
|
|
42
|
+
cli = path.join(dir, require(path.join(dir, 'package.json')).bin.expo);
|
|
43
|
+
} catch {
|
|
44
|
+
fail('Expo isn\'t installed, so the app config can\'t be read', 'install dependencies first: sh scripts/ai/install-deps.sh');
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const r = spawnSync(process.execPath, [cli, 'config', '--type', 'introspect', '--json'], { encoding: 'utf8', maxBuffer: 1 << 28 });
|
|
48
|
+
try { return JSON.parse(r.stdout); } catch {
|
|
49
|
+
fail('Couldn\'t read the Expo app config', (r.stderr || '').trim().split('\n').pop() || 'run: npx expo config');
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const expoResults = ((expo || {})._internal || {}).modResults || {};
|
|
54
|
+
const xcodeproj = !expo && fs.existsSync('ios') ? (fs.readdirSync('ios', { withFileTypes: true }).find(e => e.isDirectory() && e.name.endsWith('.xcodeproj')) || {}).name : null;
|
|
34
55
|
const pbxPath = xcodeproj ? `ios/${xcodeproj}/project.pbxproj` : null;
|
|
35
56
|
const pbx = pbxPath ? readNow(pbxPath) : null;
|
|
36
57
|
const plists = all(/INFOPLIST_FILE = ([^;]+);/g, pbx).map(p => `ios/${p}`).filter(p => fs.existsSync(p));
|
|
37
|
-
const gradlePath = ['android/app/build.gradle', 'android/app/build.gradle.kts'].find(f => fs.existsSync(f));
|
|
58
|
+
const gradlePath = expo ? null : ['android/app/build.gradle', 'android/app/build.gradle.kts'].find(f => fs.existsSync(f));
|
|
38
59
|
const gradle = stripComments(readNow(gradlePath));
|
|
39
|
-
const manifestPath = 'android/app/src/main/AndroidManifest.xml';
|
|
40
|
-
const pkg = JSON.parse(readNow('package.json') || '{}');
|
|
60
|
+
const manifestPath = expo ? null : 'android/app/src/main/AndroidManifest.xml';
|
|
41
61
|
// this kit's codemagic.yaml sets build numbers and the Android upload key on the build machine
|
|
42
62
|
const codemagic = readNow('codemagic.yaml') || '';
|
|
43
63
|
// build numbers set at build time (by CI or fastlane, as this kit's codemagic.yaml does) never change in the repo
|
|
@@ -49,7 +69,11 @@ const setsBuild = {
|
|
|
49
69
|
Android: /versionCode[^\n]*\$|increment_version_code|android_set_version_code|change-android-versioncode/,
|
|
50
70
|
};
|
|
51
71
|
const ciBuildNumber = Object.fromEntries(Object.entries(setsBuild).map(([p, re]) => [p, buildFiles.find(f => re.test(readNow(f) || ''))]));
|
|
52
|
-
|
|
72
|
+
// EAS sets them itself with autoIncrement, or keeps them on its servers (appVersionSource: remote)
|
|
73
|
+
const eas = (() => { try { return JSON.parse(readNow('eas.json') || '{}'); } catch { return {}; } })();
|
|
74
|
+
if ((eas.cli || {}).appVersionSource === 'remote' || Object.values(eas.build || {}).some(b => b && b.autoIncrement)) {
|
|
75
|
+
for (const p of ['iOS', 'Android']) ciBuildNumber[p] = ciBuildNumber[p] || 'eas.json';
|
|
76
|
+
}
|
|
53
77
|
|
|
54
78
|
// ---------- 1. versions ----------
|
|
55
79
|
const iosVersions = t => all(/MARKETING_VERSION = ([^;]+);/g, t);
|
|
@@ -85,6 +109,17 @@ if (gradle) {
|
|
|
85
109
|
compare('Android', androidVersions(gradle), since && androidVersions(readAt(since, gradlePath)), 'version');
|
|
86
110
|
compare('Android', androidBuilds(gradle), since && androidBuilds(readAt(since, gradlePath)), 'build number');
|
|
87
111
|
}
|
|
112
|
+
if (expo) {
|
|
113
|
+
// the release before, from app.json at its tag (an app.config.* can't be evaluated at an old commit)
|
|
114
|
+
let old = null;
|
|
115
|
+
try { const j = JSON.parse(readAt(since, 'app.json')); old = j.expo || j; } catch {}
|
|
116
|
+
const now = [expo.version].filter(Boolean);
|
|
117
|
+
const before = since && (old ? [old.version].filter(Boolean) : null);
|
|
118
|
+
compare('App', now, before, 'version');
|
|
119
|
+
const builds = c => c && { iOS: [String((c.ios || {}).buildNumber || 1)], Android: [String((c.android || {}).versionCode || 1)] };
|
|
120
|
+
compare('iOS', builds(expo).iOS, since && old && builds(old).iOS, 'build number', before && now.join() !== before.join());
|
|
121
|
+
compare('Android', builds(expo).Android, since && old && builds(old).Android, 'build number');
|
|
122
|
+
}
|
|
88
123
|
if (pbx && gradle) {
|
|
89
124
|
const a = iosVersions(pbx), b = androidVersions(gradle);
|
|
90
125
|
if (a.length && b.length && !a.some(v => b.includes(v))) {
|
|
@@ -120,12 +155,23 @@ const NEEDS = {
|
|
|
120
155
|
'react-native-touch-id': ['NSFaceIDUsageDescription'],
|
|
121
156
|
'react-native-audio-recorder-player': ['NSMicrophoneUsageDescription'],
|
|
122
157
|
'@react-native-voice/voice': ['NSMicrophoneUsageDescription', 'NSSpeechRecognitionUsageDescription'],
|
|
158
|
+
'expo-camera': ['NSCameraUsageDescription'],
|
|
159
|
+
'expo-image-picker': ['NSPhotoLibraryUsageDescription'],
|
|
160
|
+
'expo-media-library': ['NSPhotoLibraryUsageDescription'],
|
|
161
|
+
'expo-location': ['NSLocationWhenInUseUsageDescription'],
|
|
162
|
+
'expo-contacts': ['NSContactsUsageDescription'],
|
|
163
|
+
'expo-local-authentication': ['NSFaceIDUsageDescription'],
|
|
123
164
|
};
|
|
165
|
+
// the texts Expo's config plugins write when app.json gives none: too vague for App Review
|
|
166
|
+
const EXPO_DEFAULT = /^Allow \$\(PRODUCT_NAME\) to /;
|
|
124
167
|
const PLACEHOLDER = /^\s*$|\b(todo|tbd|lorem|placeholder|description here|your text)\b/i;
|
|
125
168
|
const usageTexts = f => Object.fromEntries([...(readNow(f) || '').matchAll(/<key>(\w+UsageDescription)<\/key>\s*<string>([^<]*)<\/string>/g)].map(m => [m[1], m[2]]));
|
|
126
|
-
const
|
|
169
|
+
const expoPlist = (expoResults.ios || {}).infoPlist || {};
|
|
170
|
+
const textsByPlist = expo
|
|
171
|
+
? { 'app config (ios.infoPlist)': Object.fromEntries(Object.entries(expoPlist).filter(([k, v]) => /UsageDescription$/.test(k) && typeof v === 'string')) }
|
|
172
|
+
: Object.fromEntries(plists.map(f => [f, usageTexts(f)]));
|
|
127
173
|
const needed = Object.entries(NEEDS).filter(([lib]) => deps[lib]).flatMap(([lib, keys]) => keys.map(key => ({ lib, key })));
|
|
128
|
-
for (const plistPath of
|
|
174
|
+
for (const plistPath of Object.keys(textsByPlist)) {
|
|
129
175
|
const texts = textsByPlist[plistPath];
|
|
130
176
|
const problems = [];
|
|
131
177
|
for (const { lib, key } of needed) {
|
|
@@ -141,9 +187,12 @@ for (const plistPath of plists) {
|
|
|
141
187
|
if (neededKeys.includes(key)) fail(`${plistPath}: ${key} is ${text.trim() ? `a placeholder ("${text.trim()}")` : 'empty'}`, 'write a real reason users can understand');
|
|
142
188
|
else warn(`${plistPath}: ${key} is ${text.trim() ? 'a placeholder' : 'empty'}`, 'remove the key if the app doesn\'t use this permission; otherwise write a real reason');
|
|
143
189
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (
|
|
190
|
+
const vague = Object.entries(texts).filter(([, t]) => EXPO_DEFAULT.test(t)).map(([k]) => k);
|
|
191
|
+
if (vague.length) warn(`${plistPath}: Expo's default text for ${vague.join(', ')}`, 'App Review asks why the app needs each permission: set the text in the library\'s plugin options or ios.infoPlist in app.json');
|
|
192
|
+
if (!problems.length && !vague.length && !Object.values(texts).some(t => PLACEHOLDER.test(t))) ok(`${plistPath}: permission texts`, `${Object.keys(texts).length} present`);
|
|
193
|
+
const arbitrary = expo ? (expoPlist.NSAppTransportSecurity || {}).NSAllowsArbitraryLoads === true
|
|
194
|
+
: /<key>NSAllowsArbitraryLoads<\/key>\s*<true\s*\/>/.test(readNow(plistPath) || '');
|
|
195
|
+
if (arbitrary) {
|
|
147
196
|
warn(`${plistPath}: NSAllowsArbitraryLoads is true (any HTTP allowed)`, 'App Review may ask why; allow only the domains that need it (NSExceptionDomains)');
|
|
148
197
|
}
|
|
149
198
|
}
|
|
@@ -151,8 +200,10 @@ for (const plistPath of plists) {
|
|
|
151
200
|
// ---------- 4. Android permissions ----------
|
|
152
201
|
const SENSITIVE = /\.(ACCESS_(FINE|COARSE|BACKGROUND)_LOCATION|CAMERA|RECORD_AUDIO|READ_CONTACTS|WRITE_CONTACTS|READ_EXTERNAL_STORAGE|WRITE_EXTERNAL_STORAGE|READ_MEDIA_\w+|BLUETOOTH_SCAN|BLUETOOTH_CONNECT|POST_NOTIFICATIONS|READ_PHONE_STATE|BODY_SENSORS|READ_CALENDAR|WRITE_CALENDAR|ACCESS_MEDIA_LOCATION)$/;
|
|
153
202
|
const perms = t => all(/<uses-permission[^>]*android:name="([^"]+)"/g, t);
|
|
154
|
-
|
|
155
|
-
|
|
203
|
+
// Expo: the manifest prebuild would write, as JSON
|
|
204
|
+
const expoManifest = ((expoResults.android || {}).manifest || {}).manifest;
|
|
205
|
+
const permsNow = expo ? uniq(((expoManifest || {})['uses-permission'] || []).map(p => p.$['android:name'])) : perms(readNow(manifestPath));
|
|
206
|
+
if (manifestPath && since && readAt(since, manifestPath) !== null) {
|
|
156
207
|
const before = perms(readAt(since, manifestPath));
|
|
157
208
|
const added = permsNow.filter(p => !before.includes(p));
|
|
158
209
|
const removed = before.filter(p => !permsNow.includes(p));
|
|
@@ -183,7 +234,9 @@ else if (/signingConfig\s*=?\s*signingConfigs\.debug/.test(releaseBlock)) {
|
|
|
183
234
|
// the kit's release-build.sh (and Codemagic) sign with the upload key, and Play rejects debug-signed uploads anyway
|
|
184
235
|
info('build.gradle signs release builds with the debug key', 'build store releases with sh scripts/ai/release-build.sh android, which signs with your upload key');
|
|
185
236
|
}
|
|
186
|
-
|
|
237
|
+
const cleartext = expo ? ((((expoManifest || {}).application || [])[0] || {}).$ || {})['android:usesCleartextTraffic'] === 'true'
|
|
238
|
+
: /android:usesCleartextTraffic="true"/.test(readNow(manifestPath) || '');
|
|
239
|
+
if (cleartext) {
|
|
187
240
|
warn('Android allows cleartext (HTTP) traffic', 'allow only the domains that need it (network security config)');
|
|
188
241
|
}
|
|
189
242
|
const debuggers = (git('grep', '-n', '-E', '^[[:space:]]*debugger;?[[:space:]]*$', '--', '*.js', '*.jsx', '*.ts', '*.tsx') || '').split('\n').filter(Boolean);
|
|
@@ -198,7 +251,8 @@ const storeFiles = [
|
|
|
198
251
|
...all(/storeFile\s*=?\s*file\(\s*["']([^"']+)["']\s*\)/g, gradleCode).map(f => path.posix.join('android/app', f)),
|
|
199
252
|
...all(/storeFile\s*=?\s*rootProject\.file\(\s*["']([^"']+)["']\s*\)/g, gradleCode).map(f => path.posix.join('android', f)),
|
|
200
253
|
];
|
|
201
|
-
|
|
254
|
+
// credentials.json: EAS's local credentials, with the keystore passwords
|
|
255
|
+
const keys = tracked.filter(f => (/\.(jks|keystore|p12|p8|mobileprovision)$/.test(f) || storeFiles.includes(f) || f === 'credentials.json') && path.basename(f) !== 'debug.keystore');
|
|
202
256
|
// React Native's docs suggest android/gradle.properties for these passwords, and that file is usually committed
|
|
203
257
|
const propsPasswords = tracked.includes('android/gradle.properties')
|
|
204
258
|
? (readNow('android/gradle.properties') || '').split('\n').filter(l => /^[^#]*password[^=]*=\s*\S/i.test(l)).length : 0;
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
# Sets the version users see on both platforms: iOS MARKETING_VERSION and Android versionName
|
|
2
|
+
# Sets the version users see on both platforms: iOS MARKETING_VERSION and Android versionName, or in Expo
|
|
3
|
+
# apps without native folders, expo.version in app.json.
|
|
3
4
|
# Build numbers are left alone (codemagic.yaml sets them at build time).
|
|
4
5
|
# Usage: sh scripts/ai/set-version.sh 1.4.0
|
|
5
6
|
set -eu
|
|
6
7
|
v=${1:-}
|
|
7
8
|
echo "$v" | grep -qE '^[0-9]+\.[0-9]+(\.[0-9]+)?$' || { echo "usage: sh scripts/ai/set-version.sh <version, e.g. 1.4.0>" >&2; exit 1; }
|
|
9
|
+
|
|
10
|
+
# Expo apps without native folders in git: the version is expo.version in the app config
|
|
11
|
+
if [ -z "$(git ls-files -- ios android 2> /dev/null)" ] &&
|
|
12
|
+
node -e "const p = require('./package.json'); process.exit({ ...p.dependencies, ...p.devDependencies }.expo ? 0 : 1)" 2> /dev/null; then
|
|
13
|
+
config=$(ls app.config.js app.config.ts app.config.mjs app.config.cjs 2> /dev/null | head -1)
|
|
14
|
+
[ -z "$config" ] || { echo "This app computes its config in $config: set the version there by hand" >&2; exit 1; }
|
|
15
|
+
node -e '
|
|
16
|
+
const fs = require("fs");
|
|
17
|
+
const text = fs.readFileSync("app.json", "utf8");
|
|
18
|
+
const json = JSON.parse(text);
|
|
19
|
+
(json.expo || json).version = process.argv[1];
|
|
20
|
+
const indent = (text.match(/^[ \t]+(?=")/m) || [" "])[0];
|
|
21
|
+
fs.writeFileSync("app.json", `${JSON.stringify(json, null, indent)}\n`);
|
|
22
|
+
' "$v"
|
|
23
|
+
echo "Version $v set in app.json."
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
8
26
|
pbx=$(ls ios/*.xcodeproj/project.pbxproj | head -1)
|
|
9
27
|
gradle=$(ls android/app/build.gradle android/app/build.gradle.kts 2>/dev/null | head -1)
|
|
10
28
|
|
|
@@ -50,8 +50,9 @@ run_flows() { # platform device app_id
|
|
|
50
50
|
mkdir -p "$out"
|
|
51
51
|
files=$(flow_files)
|
|
52
52
|
if [ -z "$files" ]; then
|
|
53
|
-
# launchApp returns before the app has drawn
|
|
54
|
-
|
|
53
|
+
# launchApp returns before the app has drawn, and a splash screen stays up until the JavaScript has loaded:
|
|
54
|
+
# a fixed wait (for text that never appears), then for the screen to settle, so the screenshot shows the app
|
|
55
|
+
printf 'appId: %s\n---\n- launchApp\n- extendedWaitUntil:\n visible: "agentic-mobile-kit: waiting for the app to draw"\n timeout: 5000\n optional: true\n- waitForAnimationToEnd\n- takeScreenshot: smoke-launch\n' "$3" > "$out/smoke.yaml"
|
|
55
56
|
files="$out/smoke.yaml"
|
|
56
57
|
fi
|
|
57
58
|
passed=0
|
|
@@ -80,6 +81,8 @@ quick() {
|
|
|
80
81
|
sh scripts/ai/pm-run.sh typecheck > "$evidence/typecheck.log" 2>&1 &&
|
|
81
82
|
CI=true sh scripts/ai/pm-run.sh test > "$evidence/test.log" 2>&1; then
|
|
82
83
|
echo "quick: lint, typecheck and tests passed"
|
|
84
|
+
# what didn't run (no such script, or an Expo app without ESLint yet)
|
|
85
|
+
cat "$evidence/lint.log" "$evidence/typecheck.log" "$evidence/test.log" | sed -n 's/^skip: / skipped: /p'
|
|
83
86
|
else
|
|
84
87
|
echo "quick: FAILED, see the logs in ${evidence#"$root"/}"
|
|
85
88
|
status=1
|
|
@@ -94,8 +97,14 @@ ios() {
|
|
|
94
97
|
return
|
|
95
98
|
fi
|
|
96
99
|
command -v maestro > /dev/null || { echo "ios: Maestro isn't installed (https://maestro.dev)"; status=1; return; }
|
|
97
|
-
#
|
|
98
|
-
if
|
|
100
|
+
# Expo apps without native folders in git: generate ios/ first
|
|
101
|
+
if ! sh scripts/ai/prebuild.sh ios > "$evidence/prebuild-ios.log" 2>&1; then
|
|
102
|
+
echo "ios: expo prebuild FAILED, see ${evidence#"$root"/}/prebuild-ios.log"; status=1; return
|
|
103
|
+
fi
|
|
104
|
+
# pod install also generates React Native codegen files into ios/build/generated; a newer Podfile needs it again
|
|
105
|
+
if [ ! -d ios/Pods ] || [ ! -d ios/build/generated ] || [ ios/Podfile -nt ios/Pods/Manifest.lock ]; then
|
|
106
|
+
sh scripts/ai/pod-install.sh > "$evidence/pod-install.log" 2>&1
|
|
107
|
+
fi
|
|
99
108
|
if ! CONFIGURATION=Release sh scripts/ai/ios-build.sh > "$evidence/ios-build.log" 2>&1; then
|
|
100
109
|
echo "ios: release build FAILED, see ${evidence#"$root"/}/ios-build.log"; status=1; return
|
|
101
110
|
fi
|
|
@@ -126,6 +135,10 @@ android() {
|
|
|
126
135
|
esac
|
|
127
136
|
sdk=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$default_sdk}}
|
|
128
137
|
adb="$sdk/platform-tools/adb"
|
|
138
|
+
# Expo apps without native folders in git: generate android/ first
|
|
139
|
+
if ! sh scripts/ai/prebuild.sh android > "$evidence/prebuild-android.log" 2>&1; then
|
|
140
|
+
echo "android: expo prebuild FAILED, see ${evidence#"$root"/}/prebuild-android.log"; status=1; return
|
|
141
|
+
fi
|
|
129
142
|
# apps with product flavors: check one, the first in build.gradle unless --flavor names another
|
|
130
143
|
if [ -z "$flavor" ]; then
|
|
131
144
|
code=0
|
|
@@ -4,6 +4,13 @@ appId: ${APP_ID} # set by verify.sh
|
|
|
4
4
|
---
|
|
5
5
|
- launchApp:
|
|
6
6
|
clearState: true
|
|
7
|
+
# After every launchApp: a splash screen can still cover the app while assertions already pass (the app's views
|
|
8
|
+
# exist under it), so wait a moment (for text that never appears), then for the screen to settle.
|
|
9
|
+
- extendedWaitUntil:
|
|
10
|
+
visible: "flow: waiting for the app to draw"
|
|
11
|
+
timeout: 3000
|
|
12
|
+
optional: true
|
|
13
|
+
- waitForAnimationToEnd
|
|
7
14
|
# Scenario 1: <scenario name from requirements.md>
|
|
8
15
|
- assertVisible:
|
|
9
16
|
id: "<testID of the element>"
|