agentic-mobile-kit 0.6.2 → 0.7.1
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 +3 -1
- package/lib/doctor.js +12 -7
- package/lib/init.js +60 -20
- package/package.json +1 -1
- package/stacks/react-native/expo/AGENTS.md +13 -13
- package/stacks/react-native/expo/docs/{ai → amk}/expo.md +1 -1
- package/stacks/react-native/template/.agents/skills/m-bugfix/SKILL.md +4 -4
- package/stacks/react-native/template/.agents/skills/m-continue/SKILL.md +1 -1
- package/stacks/react-native/template/.agents/skills/m-explore/SKILL.md +2 -2
- package/stacks/react-native/template/.agents/skills/m-feature/SKILL.md +5 -5
- package/stacks/react-native/template/.agents/skills/m-learn/SKILL.md +5 -5
- package/stacks/react-native/template/.agents/skills/m-onboard/SKILL.md +60 -0
- package/stacks/react-native/template/.agents/skills/m-pause/SKILL.md +2 -2
- package/stacks/react-native/template/.agents/skills/m-release/SKILL.md +5 -5
- package/stacks/react-native/template/.agents/skills/m-review/SKILL.md +1 -1
- package/stacks/react-native/template/.githooks/pre-commit +5 -5
- package/stacks/react-native/template/.githooks/pre-push +3 -3
- package/stacks/react-native/template/.github/workflows/ci.yml +5 -5
- package/stacks/react-native/template/.github/workflows/e2e.yml +5 -5
- package/stacks/react-native/template/.github/workflows/ios.yml +4 -4
- package/stacks/react-native/template/.rulesync/hooks.jsonc +2 -2
- package/stacks/react-native/template/AGENTS.md +15 -15
- package/stacks/react-native/template/codemagic.yaml +6 -6
- package/stacks/react-native/template/docs/{ai → amk}/codemagic.md +1 -1
- package/stacks/react-native/template/docs/{ai → amk}/known-issues.md +2 -2
- package/stacks/react-native/template/docs/{ai → amk}/react-native.md +1 -1
- package/stacks/react-native/template/docs/{ai → amk}/team-process.md +2 -2
- package/stacks/react-native/template/scripts/{ai → amk}/baseline.js +7 -6
- package/stacks/react-native/template/scripts/{ai → amk}/guard.js +1 -1
- package/stacks/react-native/template/scripts/{ai → amk}/handoff-check.js +1 -1
- package/stacks/react-native/template/scripts/{ai → amk}/ios-build.sh +1 -1
- package/stacks/react-native/template/scripts/{ai → amk}/pm-run.sh +1 -1
- package/stacks/react-native/template/scripts/{ai → amk}/pod-install.sh +1 -1
- package/stacks/react-native/template/scripts/{ai → amk}/prebuild.sh +1 -1
- package/stacks/react-native/template/scripts/{ai → amk}/release-build.sh +10 -10
- package/stacks/react-native/template/scripts/{ai → amk}/release-check.js +3 -3
- package/stacks/react-native/template/scripts/{ai → amk}/set-version.sh +2 -2
- package/stacks/react-native/template/scripts/{ai → amk}/specs.js +3 -3
- package/stacks/react-native/template/scripts/{ai → amk}/verify.sh +21 -16
- package/stacks/react-native/template/specs/current/README.md +2 -2
- /package/stacks/react-native/expo/docs/{ai → amk}/known-issues.md +0 -0
- /package/stacks/react-native/template/docs/{ai → amk}/conventions.md +0 -0
- /package/stacks/react-native/template/docs/{ai → amk}/decisions.md +0 -0
- /package/stacks/react-native/template/docs/{ai → amk}/product.md +0 -0
- /package/stacks/react-native/template/docs/{ai → amk}/structure.md +0 -0
- /package/stacks/react-native/template/docs/{ai → amk}/tech.md +0 -0
- /package/stacks/react-native/template/scripts/{ai → amk}/android-flavors.js +0 -0
- /package/stacks/react-native/template/scripts/{ai → amk}/case-check.js +0 -0
- /package/stacks/react-native/template/scripts/{ai → amk}/install-deps.sh +0 -0
- /package/stacks/react-native/template/scripts/{ai → amk}/maestro-env.sh +0 -0
|
@@ -31,7 +31,7 @@ if command -v plutil > /dev/null; then
|
|
|
31
31
|
fi
|
|
32
32
|
|
|
33
33
|
# 4. lint the staged JS/TS files with the project's own ESLint config (the kit's own scripts aren't the app's code)
|
|
34
|
-
files=$(echo "$staged" | grep -E '\.(js|jsx|ts|tsx)$' | grep -v '^scripts/
|
|
34
|
+
files=$(echo "$staged" | grep -E '\.(js|jsx|ts|tsx)$' | grep -v '^scripts/amk/' || true)
|
|
35
35
|
if [ -n "$files" ]; then
|
|
36
36
|
if [ -x node_modules/.bin/eslint ]; then
|
|
37
37
|
# ponytail: file names with spaces aren't supported here; split on newlines if that ever matters
|
|
@@ -43,13 +43,13 @@ fi
|
|
|
43
43
|
|
|
44
44
|
# 5. spec format: requirements in force need a SHALL and a scenario (format: specs/current/README.md)
|
|
45
45
|
specs=$(echo "$staged" | grep -E '^specs/([^_/][^/]*/requirements|current/[^/]+)\.md$' | grep -v '^specs/current/README\.md$' || true)
|
|
46
|
-
if [ -n "$specs" ] && [ -f scripts/
|
|
47
|
-
node scripts/
|
|
46
|
+
if [ -n "$specs" ] && [ -f scripts/amk/specs.js ]; then
|
|
47
|
+
node scripts/amk/specs.js check --skip-drafts $specs || fail "fix the spec format above (format: specs/current/README.md)"
|
|
48
48
|
fi
|
|
49
49
|
|
|
50
50
|
# 6. files renamed only in letter case on macOS or Windows: git still has the old name, so other machines can't find them
|
|
51
|
-
if [ -f scripts/
|
|
52
|
-
node scripts/
|
|
51
|
+
if [ -f scripts/amk/case-check.js ]; then
|
|
52
|
+
node scripts/amk/case-check.js || fail "rename them through git as shown above"
|
|
53
53
|
fi
|
|
54
54
|
|
|
55
55
|
# 7. warn about large commits (the PR size check in CI is the hard limit)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# agentic-mobile-kit pre-push: typecheck and tests before code leaves the machine.
|
|
3
3
|
set -eu
|
|
4
|
-
[ -d node_modules ] || { echo "pre-push: dependencies aren't installed; run: sh scripts/
|
|
4
|
+
[ -d node_modules ] || { echo "pre-push: dependencies aren't installed; run: sh scripts/amk/install-deps.sh" >&2; exit 1; }
|
|
5
5
|
# each passes when the app's script passes, or when all its failures were already on the base branch
|
|
6
|
-
node scripts/
|
|
7
|
-
node scripts/
|
|
6
|
+
node scripts/amk/baseline.js typecheck || { echo "pre-push: fix the new type errors above" >&2; exit 1; }
|
|
7
|
+
node scripts/amk/baseline.js test || { echo "pre-push: fix the new test failures above" >&2; exit 1; }
|
|
@@ -24,15 +24,15 @@ jobs:
|
|
|
24
24
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
25
25
|
with:
|
|
26
26
|
node-version: 24
|
|
27
|
-
- run: sh scripts/
|
|
27
|
+
- run: sh scripts/amk/install-deps.sh
|
|
28
28
|
# each passes when the app's script passes, or when all its failures were already on the base branch
|
|
29
29
|
- name: Lint, typecheck and tests
|
|
30
30
|
env:
|
|
31
31
|
AMK_BASE: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || github.event.before }}
|
|
32
32
|
run: |
|
|
33
|
-
node scripts/
|
|
34
|
-
node scripts/
|
|
35
|
-
node scripts/
|
|
33
|
+
node scripts/amk/baseline.js lint
|
|
34
|
+
node scripts/amk/baseline.js typecheck
|
|
35
|
+
node scripts/amk/baseline.js test
|
|
36
36
|
- name: Tool configs match .rulesync/ (run "npx -y rulesync@27.0.0 generate" and commit if this fails)
|
|
37
37
|
if: hashFiles('rulesync.jsonc') != ''
|
|
38
38
|
run: npx -y rulesync@27.0.0 generate > /dev/null && git diff --exit-code -- .claude .codex .agents .antigravity
|
|
@@ -57,7 +57,7 @@ jobs:
|
|
|
57
57
|
distribution: temurin
|
|
58
58
|
java-version: 17
|
|
59
59
|
cache: gradle
|
|
60
|
-
- run: sh scripts/
|
|
60
|
+
- run: sh scripts/amk/install-deps.sh
|
|
61
61
|
- name: Generate the native project (Expo apps without android/)
|
|
62
62
|
if: hashFiles('android/settings.gradle', 'android/settings.gradle.kts') == ''
|
|
63
63
|
run: npx expo prebuild --platform android --no-install
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# agentic-mobile-kit end-to-end check: runs the Maestro flows in .maestro/ on an Android emulator
|
|
2
|
-
# with a release build, the same way `sh scripts/
|
|
2
|
+
# with a release build, the same way `sh scripts/amk/verify.sh android` does locally.
|
|
3
3
|
# Runs nightly, on demand, and on pull requests labelled "e2e". Screenshots are uploaded as an artifact.
|
|
4
4
|
name: e2e
|
|
5
5
|
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
distribution: temurin
|
|
37
37
|
java-version: 17
|
|
38
38
|
cache: gradle
|
|
39
|
-
- run: sh scripts/
|
|
39
|
+
- run: sh scripts/amk/install-deps.sh
|
|
40
40
|
- name: Install Maestro (pinned version, checksum verified)
|
|
41
41
|
run: |
|
|
42
42
|
curl -fsSL -o maestro.zip "https://github.com/mobile-dev-inc/maestro/releases/download/cli-$MAESTRO_VERSION/maestro.zip"
|
|
@@ -44,7 +44,7 @@ jobs:
|
|
|
44
44
|
unzip -q maestro.zip -d "$HOME" && rm maestro.zip
|
|
45
45
|
echo "$HOME/maestro/bin" >> "$GITHUB_PATH"
|
|
46
46
|
- name: Generate the native project (Expo apps without android/ in git)
|
|
47
|
-
run: sh scripts/
|
|
47
|
+
run: sh scripts/amk/prebuild.sh android
|
|
48
48
|
- name: Build release APK
|
|
49
49
|
working-directory: android
|
|
50
50
|
run: ./gradlew assembleRelease --no-daemon
|
|
@@ -64,11 +64,11 @@ jobs:
|
|
|
64
64
|
cores: 4
|
|
65
65
|
disable-animations: true
|
|
66
66
|
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
67
|
-
script: sh scripts/
|
|
67
|
+
script: sh scripts/amk/verify.sh android --label ci
|
|
68
68
|
- name: Upload screenshots and logs
|
|
69
69
|
if: always()
|
|
70
70
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
71
71
|
with:
|
|
72
72
|
name: e2e-evidence
|
|
73
|
-
path: .
|
|
73
|
+
path: .amk/evidence/
|
|
74
74
|
if-no-files-found: ignore
|
|
@@ -32,10 +32,10 @@ jobs:
|
|
|
32
32
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
33
33
|
with:
|
|
34
34
|
node-version: 24
|
|
35
|
-
- run: sh scripts/
|
|
35
|
+
- run: sh scripts/amk/install-deps.sh
|
|
36
36
|
- name: Generate the native project (Expo apps without ios/ in git)
|
|
37
|
-
run: sh scripts/
|
|
37
|
+
run: sh scripts/amk/prebuild.sh ios
|
|
38
38
|
- name: Install pods
|
|
39
|
-
run: sh scripts/
|
|
39
|
+
run: sh scripts/amk/pod-install.sh
|
|
40
40
|
- name: Build for the simulator (no signing)
|
|
41
|
-
run: sh scripts/
|
|
41
|
+
run: sh scripts/amk/ios-build.sh
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"hooks": {
|
|
4
4
|
// no matcher: runs for every tool call; guard.js decides from the payload
|
|
5
|
-
"preToolUse": [{ "command": "node scripts/
|
|
6
|
-
"stop": [{ "command": "node scripts/
|
|
5
|
+
"preToolUse": [{ "command": "node scripts/amk/guard.js" }],
|
|
6
|
+
"stop": [{ "command": "node scripts/amk/handoff-check.js" }]
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
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
|
-
Read by Claude Code (through CLAUDE.md), Codex, Cursor, OpenCode, Kiro and Antigravity. Keep it short; details live in `docs/
|
|
4
|
+
Read by Claude Code (through CLAUDE.md), Codex, Cursor, OpenCode, Kiro and Antigravity. Keep it short; details live in `docs/amk/`.
|
|
5
5
|
|
|
6
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
7
|
|
|
8
8
|
## Project
|
|
9
9
|
|
|
10
|
-
- Bare React Native {{RN_VERSION}} ({{RN_ARCH}}), React {{REACT_VERSION}},
|
|
11
|
-
- What the app does: `docs/
|
|
10
|
+
- Bare React Native {{RN_VERSION}} ({{RN_ARCH}}), React {{REACT_VERSION}}, {{LANGUAGE}}, Node {{NODE_VERSION}}. Package manager: {{PM}}.
|
|
11
|
+
- What the app does: `docs/amk/product.md`, and requirement by requirement, as it works now: `specs/current/`. Stack and services: `docs/amk/tech.md`. Folders and layers: `docs/amk/structure.md`. Code style: `docs/amk/conventions.md`.
|
|
12
12
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
15
15
|
| Task | Command |
|
|
16
16
|
|---|---|
|
|
17
|
-
| Install dependencies | `sh scripts/
|
|
18
|
-
|
|
|
19
|
-
| iOS pods (after native dependency changes) | `sh scripts/
|
|
20
|
-
| iOS build (simulator, no signing) | `sh scripts/
|
|
17
|
+
| Install dependencies | `sh scripts/amk/install-deps.sh` |
|
|
18
|
+
| {{CHECK_TASKS}} | {{CHECK_COMMANDS}} |
|
|
19
|
+
| iOS pods (after native dependency changes) | `sh scripts/amk/pod-install.sh` |
|
|
20
|
+
| iOS build (simulator, no signing) | `sh scripts/amk/ios-build.sh` |
|
|
21
21
|
| Android build | `cd android && ./gradlew assembleDebug` |
|
|
22
|
-
| Check on devices (release builds, Maestro flows, screenshots) | `sh scripts/
|
|
23
|
-
| Specs: progress, format check, fold a finished feature into the living spec | `node scripts/
|
|
24
|
-
| Check a release before tagging it (versions, permission texts, debug leftovers) | `node scripts/
|
|
25
|
-
| Signed release builds (a person runs them: they use the signing keys) | `sh scripts/
|
|
22
|
+
| Check on devices (release builds, Maestro flows, screenshots) | `sh scripts/amk/verify.sh all --spec <id>`; with product flavors it checks the first unless `--flavor <name>`; another iOS scheme: `--scheme <name>` |
|
|
23
|
+
| Specs: progress, format check, fold a finished feature into the living spec | `node scripts/amk/specs.js status`, `node scripts/amk/specs.js check`, `node scripts/amk/specs.js merge <id>` |
|
|
24
|
+
| Check a release before tagging it (versions, permission texts, debug leftovers) | `node scripts/amk/release-check.js` |
|
|
25
|
+
| Signed release builds (a person runs them: they use the signing keys) | `sh scripts/amk/release-build.sh android [flavor]`, `sh scripts/amk/release-build.sh ios [scheme]` |
|
|
26
26
|
|
|
27
27
|
## Definition of done
|
|
28
28
|
|
|
29
29
|
A task is done only when:
|
|
30
|
-
1. `sh scripts/
|
|
31
|
-
2. UI changes were checked with `sh scripts/
|
|
30
|
+
1. `sh scripts/amk/verify.sh quick` passes (lint, typecheck, tests) and you show its output from this session. In an app whose base branch already fails some of them, it passes when your change adds no new failure, and lists the old ones: leave those alone unless the task is to fix them;
|
|
31
|
+
2. UI changes were checked with `sh scripts/amk/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
32
|
3. the change stays inside the task's scope;
|
|
33
33
|
4. `specs/<id>/progress.md` is updated, when working from a spec.
|
|
34
34
|
|
|
@@ -42,8 +42,8 @@ Never say a check passed unless you ran it in this session.
|
|
|
42
42
|
- Never read, print or commit `.env` files, keystores or signing files. Secrets don't belong in this repo.
|
|
43
43
|
- Never use `git commit --no-verify`, `git push --force`, `git reset --hard` or `rm -rf`.
|
|
44
44
|
- After 2 failed attempts at the same fix, stop and report what you found.
|
|
45
|
-
- Chat is not memory: write decisions into the spec or `docs/
|
|
46
|
-
- Follow `docs/
|
|
45
|
+
- Chat is not memory: write decisions into the spec or `docs/amk/decisions.md` straight away.
|
|
46
|
+
- Follow `docs/amk/react-native.md`. Before fixing a build error, check `docs/amk/known-issues.md`.
|
|
47
47
|
|
|
48
48
|
## Skills
|
|
49
49
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Signed release builds on Codemagic (codemagic.io). One-time setup for each app: docs/
|
|
1
|
+
# Signed release builds on Codemagic (codemagic.io). One-time setup for each app: docs/amk/codemagic.md
|
|
2
2
|
# Both workflows start when a version tag is pushed (git push origin v1.2.0); you can also start them in Codemagic.
|
|
3
3
|
# Build numbers are set on the build machine only (one more than the store's latest), so the repo never needs a bump for them.
|
|
4
4
|
workflows:
|
|
@@ -20,14 +20,14 @@ workflows:
|
|
|
20
20
|
java: 17
|
|
21
21
|
scripts:
|
|
22
22
|
- name: Release check
|
|
23
|
-
script: node scripts/
|
|
23
|
+
script: node scripts/amk/release-check.js
|
|
24
24
|
- name: Install dependencies
|
|
25
|
-
script: sh scripts/
|
|
25
|
+
script: sh scripts/amk/install-deps.sh
|
|
26
26
|
- name: Store release notes
|
|
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/
|
|
30
|
+
sh scripts/amk/prebuild.sh android # Expo apps without android/ in git
|
|
31
31
|
echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties
|
|
32
32
|
package=$(sed -n -E 's/.*applicationId( =)? "([^"]+)".*/\2/p' android/app/build.gradle* | head -1)
|
|
33
33
|
if last=$(google-play get-latest-build-number --package-name "$package") && [ -n "$last" ]; then code=$((last + 1)); else code=$BUILD_NUMBER; fi
|
|
@@ -65,9 +65,9 @@ workflows:
|
|
|
65
65
|
cocoapods: default
|
|
66
66
|
scripts:
|
|
67
67
|
- name: Release check
|
|
68
|
-
script: node scripts/
|
|
68
|
+
script: node scripts/amk/release-check.js
|
|
69
69
|
- name: Install dependencies
|
|
70
|
-
script: sh scripts/
|
|
70
|
+
script: sh scripts/amk/install-deps.sh && sh scripts/amk/prebuild.sh ios && sh scripts/amk/pod-install.sh
|
|
71
71
|
- name: Store release notes
|
|
72
72
|
script: |
|
|
73
73
|
notes="release-notes/${CM_TAG#v}/app-store.txt"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`codemagic.yaml` has two workflows. `android-release` builds a signed app bundle and uploads it to Google Play's internal track. `ios-release` builds a signed ipa and uploads it to TestFlight. Both start when a version tag is pushed (`git push origin v1.2.0`), and you can start either one by hand in Codemagic.
|
|
4
4
|
|
|
5
5
|
Each build:
|
|
6
|
-
1. runs `node scripts/
|
|
6
|
+
1. runs `node scripts/amk/release-check.js` and stops if it finds a problem;
|
|
7
7
|
2. sets the build number on the build machine: one more than the latest in the store, or Codemagic's build counter for a new app. Nothing is committed, so the repo keeps only the version name (for example 1.2.0), which you bump in the release PR;
|
|
8
8
|
3. uses `release-notes/<version>/play-store.txt` or `app-store.txt` as the store's "What's new" or TestFlight's "What to test", when the build comes from a tag;
|
|
9
9
|
4. signs with keys that Codemagic stores. The repo never holds them, and local release builds (`verify.sh`, the e2e CI) stay signed with the debug key.
|
|
@@ -13,8 +13,8 @@ Recurring errors and their fixes. Check here before debugging a build error. Rem
|
|
|
13
13
|
|
|
14
14
|
### iOS build fails right after a native dependency was added or removed
|
|
15
15
|
- **Cause:** `ios/Pods` is out of date.
|
|
16
|
-
- **Fix:** `sh scripts/
|
|
17
|
-
- **Prevention:** run `sh scripts/
|
|
16
|
+
- **Fix:** `sh scripts/amk/pod-install.sh`, then rebuild.
|
|
17
|
+
- **Prevention:** run `sh scripts/amk/pod-install.sh` in the same change that edits `package.json`.
|
|
18
18
|
|
|
19
19
|
### `./gradlew` fails with "no main manifest attribute, in …/gradle-wrapper.jar"
|
|
20
20
|
- **Cause:** a React Native upgrade updated `android/gradlew` (which now runs `java -jar gradle-wrapper.jar`) but not `android/gradle/wrapper/gradle-wrapper.jar`. The upgrade diff doesn't carry binary files.
|
|
@@ -18,7 +18,7 @@ Rules for things AI agents commonly get wrong in current React Native. Each one
|
|
|
18
18
|
|
|
19
19
|
## Native changes
|
|
20
20
|
|
|
21
|
-
- After adding or removing a native dependency: `sh scripts/
|
|
21
|
+
- After adding or removing a native dependency: `sh scripts/amk/pod-install.sh`, then rebuild both apps. Restart Metro with `--reset-cache` if the bundle looks stale.
|
|
22
22
|
- Don't hand-edit `project.pbxproj`. Let CocoaPods or Xcode change it.
|
|
23
23
|
- Don't bump the Android Gradle Plugin, Gradle, Kotlin or the iOS deployment target one by one. Upgrade React Native as a whole with the `upgrading-react-native` skill and the React Native Upgrade Helper.
|
|
24
24
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Team process for AI-assisted work
|
|
2
2
|
|
|
3
3
|
- The person who opens a PR owns it and must be able to explain every change without AI.
|
|
4
|
-
-
|
|
4
|
+
- A commit made for a spec ends with `Spec: specs/<id>`.
|
|
5
5
|
- Keep PRs under 600 changed lines (CI enforces it; the `large-pr` label overrides).
|
|
6
6
|
- Run at most 2 or 3 agents in parallel per person.
|
|
7
7
|
- Don't use "skip permissions", "YOLO" or auto-run modes in any tool.
|
|
8
8
|
- Keep secrets out of the repo folder; inject them at run time.
|
|
9
|
-
- Review the metrics and the `m-learn` changes (`git log --grep 'chore(learn)'`) once a month. Re-check `AGENTS.md` and `docs/
|
|
9
|
+
- Review the metrics and the `m-learn` changes (`git log --grep 'chore(learn)'`) once a month. Re-check `AGENTS.md` and `docs/amk/` after every React Native, Xcode or Android Gradle Plugin upgrade, and after switching AI models.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// test failing Jest tests and test files, compared with a test run of the base
|
|
8
8
|
// The base: AMK_BASE, else the remote's default branch, else main or master. Its merge base is checked out once
|
|
9
9
|
// into a temporary git worktree that shares node_modules, and its results are kept for the next run.
|
|
10
|
-
// Usage: node scripts/
|
|
10
|
+
// Usage: node scripts/amk/baseline.js lint|typecheck|test
|
|
11
11
|
'use strict';
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
const os = require('os');
|
|
@@ -17,7 +17,7 @@ const { spawnSync, execFileSync } = require('child_process');
|
|
|
17
17
|
|
|
18
18
|
const check = process.argv[2];
|
|
19
19
|
if (!['lint', 'typecheck', 'test'].includes(check)) {
|
|
20
|
-
console.error('usage: node scripts/
|
|
20
|
+
console.error('usage: node scripts/amk/baseline.js lint|typecheck|test');
|
|
21
21
|
process.exit(2);
|
|
22
22
|
}
|
|
23
23
|
const root = process.cwd();
|
|
@@ -50,7 +50,7 @@ function runScript(dir) {
|
|
|
50
50
|
fs.mkdirSync(scratch, { recursive: true });
|
|
51
51
|
const json = path.join(scratch, `jest-${hash(dir)}.json`);
|
|
52
52
|
fs.rmSync(json, { force: true });
|
|
53
|
-
const r = spawnSync('sh', [path.join(root, 'scripts/
|
|
53
|
+
const r = spawnSync('sh', [path.join(root, 'scripts/amk/pm-run.sh'), check, ...(jest ? ['--json', `--outputFile=${json}`] : [])],
|
|
54
54
|
{ cwd: dir, encoding: 'utf8', env: { ...process.env, CI: 'true' }, maxBuffer: 2 ** 28 });
|
|
55
55
|
return { code: r.status, out: `${r.stdout || ''}${r.stderr || ''}`, json, dir };
|
|
56
56
|
}
|
|
@@ -119,8 +119,9 @@ function baseProblems(sha, extract) {
|
|
|
119
119
|
function newLintErrors(sha) {
|
|
120
120
|
const changed = [...new Set([...git('diff', '--name-only', '--diff-filter=ACMR', sha).split('\n'),
|
|
121
121
|
...git('ls-files', '--others', '--exclude-standard').split('\n')])].filter(Boolean);
|
|
122
|
-
// the kit's own .eslintignore lines (for scripts/
|
|
123
|
-
|
|
122
|
+
// the kit's own .eslintignore lines (for scripts/amk/) don't change how the app's code is checked
|
|
123
|
+
// (scripts/ai/ until 0.7.0)
|
|
124
|
+
const withoutKit = t => t.split('\n').filter(l => !/^scripts\/(amk|ai)\/$/.test(l.trim()) && !l.startsWith('# agentic-mobile-kit')).join('\n').trim();
|
|
124
125
|
const setup = changed.filter(f => /(^|\/)(\.eslintrc(\.\w+)?|eslint\.config\.\w+|\.eslintignore)$/.test(f))
|
|
125
126
|
.filter(f => path.basename(f) !== '.eslintignore' || withoutKit(git('show', `${sha}:${f}`)) !== withoutKit(fs.readFileSync(path.join(root, f), 'utf8')));
|
|
126
127
|
if (setup.length) return { reason: `the change edits the ESLint setup (${setup.join(', ')}), so any error could be new` };
|
|
@@ -141,7 +142,7 @@ function newLintErrors(sha) {
|
|
|
141
142
|
}
|
|
142
143
|
};
|
|
143
144
|
const errors = results => (results || []).flatMap(f => f.messages.filter(m => m.severity === 2).map(m => `${m.ruleId || 'parsing'}: ${m.message}`));
|
|
144
|
-
const files = changed.filter(f => /\.(js|jsx|ts|tsx)$/.test(f) && !f.startsWith('scripts/
|
|
145
|
+
const files = changed.filter(f => /\.(js|jsx|ts|tsx)$/.test(f) && !f.startsWith('scripts/amk/') && fs.existsSync(path.join(root, f)));
|
|
145
146
|
const results = files.length ? lint(files) : [];
|
|
146
147
|
if (!results) return { reason: 'ESLint gave no report' };
|
|
147
148
|
const fresh = [];
|
|
@@ -25,7 +25,7 @@ const destructive = /\brm\s+(-[a-z]*r[a-z]*f|-[a-z]*f[a-z]*r|-r\s+-f|-f\s+-r)\b|
|
|
|
25
25
|
// example files (.env.example, .env.local.example, .env.sample, .env.template) aren't secrets
|
|
26
26
|
const secretFile = /(^|[\s/'"=])\.env(?![\w.-]*\.(?:example|sample|template)(?=$|[\s'";|&)]))(\.[\w.-]+)?(?=$|[\s'";|&)])|\.(keystore|jks|p8|p12|mobileprovision)\b/;
|
|
27
27
|
|
|
28
|
-
const block = reason => { process.stderr.write(`Blocked by scripts/
|
|
28
|
+
const block = reason => { process.stderr.write(`Blocked by scripts/amk/guard.js: ${reason}\n`); process.exit(2); };
|
|
29
29
|
for (const c of commands) {
|
|
30
30
|
if (destructive.test(c)) block(`destructive command: ${c}`);
|
|
31
31
|
if (secretFile.test(c)) block(`shell access to a secret file: ${c}`);
|
|
@@ -17,7 +17,7 @@ if (specs.length === 0) process.exit(0); // no spec in progress (quick change, b
|
|
|
17
17
|
|
|
18
18
|
const changed = execSync('git status --porcelain', { encoding: 'utf8' })
|
|
19
19
|
.split('\n').filter(Boolean).map(l => l.slice(3));
|
|
20
|
-
const codeChanged = changed.some(f => !f.startsWith('specs/') && !f.startsWith('.
|
|
20
|
+
const codeChanged = changed.some(f => !f.startsWith('specs/') && !f.startsWith('.amk/'));
|
|
21
21
|
const handoffUpdated = changed.some(f => /^specs\/[^/]+\/progress\.md$/.test(f));
|
|
22
22
|
|
|
23
23
|
if (codeChanged && !handoffUpdated) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
set -eu
|
|
8
8
|
config=${CONFIGURATION:-Debug}
|
|
9
9
|
workspace=$(ls -d ios/*.xcworkspace 2>/dev/null | head -n 1)
|
|
10
|
-
[ -n "$workspace" ] || { echo "No ios/*.xcworkspace found. Run sh scripts/
|
|
10
|
+
[ -n "$workspace" ] || { echo "No ios/*.xcworkspace found. Run sh scripts/amk/pod-install.sh first."; exit 1; }
|
|
11
11
|
scheme=${AMK_IOS_SCHEME:-$(basename "$workspace" .xcworkspace)}
|
|
12
12
|
if [ "$config" = Release ]; then
|
|
13
13
|
file=$(ls ios/*.xcodeproj/xcshareddata/xcschemes/"$scheme".xcscheme ios/*.xcworkspace/xcshareddata/xcschemes/"$scheme".xcscheme 2> /dev/null | head -n 1)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# Installs the iOS pods. With a Gemfile (React Native's template has one), it uses the CocoaPods version pinned there,
|
|
3
3
|
# so Podfile.lock doesn't change just because machines have different CocoaPods versions.
|
|
4
|
-
# Usage: sh scripts/
|
|
4
|
+
# Usage: sh scripts/amk/pod-install.sh [pod install options]
|
|
5
5
|
set -eu
|
|
6
6
|
cd ios
|
|
7
7
|
if [ -f ../Gemfile ] && command -v bundle > /dev/null && bundle check > /dev/null 2>&1; then
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# Expo apps whose ios/ and android/ aren't in git (Continuous Native Generation): generates the platform's native
|
|
3
3
|
# project with `expo prebuild`, so release builds can run. Does nothing for apps that keep the folders in git.
|
|
4
|
-
# Usage: sh scripts/
|
|
4
|
+
# Usage: sh scripts/amk/prebuild.sh ios|android
|
|
5
5
|
set -eu
|
|
6
6
|
platform=$1
|
|
7
7
|
[ -z "$(git ls-files -- "$platform")" ] || exit 0
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# Builds signed release apps on this Mac: for apps without CI, or to check a release by hand.
|
|
3
3
|
# A person runs it, because it uses the signing keys, which agents must never handle.
|
|
4
4
|
#
|
|
5
|
-
# sh scripts/
|
|
6
|
-
# sh scripts/
|
|
5
|
+
# sh scripts/amk/release-build.sh android [flavor] signed app bundle (.aab) for Google Play
|
|
6
|
+
# sh scripts/amk/release-build.sh ios [scheme] signed .ipa for App Store Connect, or as ios/ExportOptions.plist says
|
|
7
7
|
# Defaults: AMK_ANDROID_FLAVOR and AMK_IOS_SCHEME. An app with product flavors must name the one to build.
|
|
8
8
|
#
|
|
9
9
|
# Android signs with your upload key. Set its path in your shell, never in the repo:
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
# Expo apps without native folders in git: it generates them first (expo prebuild). iOS signing then needs the
|
|
18
18
|
# Apple team in app.json (expo.ios.appleTeamId).
|
|
19
19
|
# Version and build numbers come from the repo, so set them first (the m-release skill does).
|
|
20
|
-
# Output: .
|
|
20
|
+
# Output: .amk/release/
|
|
21
21
|
set -eu
|
|
22
22
|
platform=${1:-}
|
|
23
23
|
target=${2:-}
|
|
24
|
-
out=.
|
|
24
|
+
out=.amk/release
|
|
25
25
|
mkdir -p "$out"
|
|
26
26
|
|
|
27
27
|
# secret VAR "question": read it without echo, unless it's already set
|
|
@@ -34,17 +34,17 @@ secret() {
|
|
|
34
34
|
|
|
35
35
|
case "$platform" in
|
|
36
36
|
android)
|
|
37
|
-
sh scripts/
|
|
37
|
+
sh scripts/amk/prebuild.sh android
|
|
38
38
|
target=${target:-${AMK_ANDROID_FLAVOR:-}}
|
|
39
39
|
if [ -z "$target" ]; then
|
|
40
40
|
code=0
|
|
41
|
-
flavors=$(node scripts/
|
|
41
|
+
flavors=$(node scripts/amk/android-flavors.js) || code=$?
|
|
42
42
|
case $code in
|
|
43
43
|
0) ;;
|
|
44
|
-
2) echo "This app has several flavor dimensions: name the variant, for example: sh scripts/
|
|
44
|
+
2) echo "This app has several flavor dimensions: name the variant, for example: sh scripts/amk/release-build.sh android devFree" >&2; exit 1 ;;
|
|
45
45
|
*) echo "Couldn't read the product flavors from build.gradle (see the error above)." >&2; exit 1 ;;
|
|
46
46
|
esac
|
|
47
|
-
[ -z "$flavors" ] || { echo "This app has product flavors ($(echo $flavors)). Name the one to build, for example: sh scripts/
|
|
47
|
+
[ -z "$flavors" ] || { echo "This app has product flavors ($(echo $flavors)). Name the one to build, for example: sh scripts/amk/release-build.sh android $(echo "$flavors" | head -n 1)" >&2; exit 1; }
|
|
48
48
|
fi
|
|
49
49
|
flavor=$(printf %s "$target" | awk '{ print toupper(substr($0, 1, 1)) substr($0, 2) }')
|
|
50
50
|
if [ -n "${AMK_UPLOAD_KEYSTORE:-}" ]; then
|
|
@@ -71,8 +71,8 @@ android)
|
|
|
71
71
|
done
|
|
72
72
|
;;
|
|
73
73
|
ios)
|
|
74
|
-
sh scripts/
|
|
75
|
-
if [ ! -d ios/Pods ] || [ ios/Podfile -nt ios/Pods/Manifest.lock ]; then sh scripts/
|
|
74
|
+
sh scripts/amk/prebuild.sh ios
|
|
75
|
+
if [ ! -d ios/Pods ] || [ ios/Podfile -nt ios/Pods/Manifest.lock ]; then sh scripts/amk/pod-install.sh; fi
|
|
76
76
|
workspace=$(ls -d ios/*.xcworkspace | head -n 1)
|
|
77
77
|
scheme=${target:-${AMK_IOS_SCHEME:-$(basename "$workspace" .xcworkspace)}}
|
|
78
78
|
log="$out/$scheme-ios.log"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Release check for a bare React Native app: what App Store review, Play review or your users would catch.
|
|
3
|
-
// Usage: node scripts/
|
|
3
|
+
// Usage: node scripts/amk/release-check.js [--since <git ref>]
|
|
4
4
|
// --since the previous release to compare with (default: the latest git tag)
|
|
5
5
|
// Exits 1 when something would get the release rejected or broken; warnings don't fail it.
|
|
6
6
|
'use strict';
|
|
@@ -41,7 +41,7 @@ function expoConfig() {
|
|
|
41
41
|
const dir = path.dirname(require.resolve('expo/package.json', { paths: [process.cwd()] }));
|
|
42
42
|
cli = path.join(dir, require(path.join(dir, 'package.json')).bin.expo);
|
|
43
43
|
} catch {
|
|
44
|
-
fail('Expo isn\'t installed, so the app config can\'t be read', 'install dependencies first: sh scripts/
|
|
44
|
+
fail('Expo isn\'t installed, so the app config can\'t be read', 'install dependencies first: sh scripts/amk/install-deps.sh');
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
const r = spawnSync(process.execPath, [cli, 'config', '--type', 'introspect', '--json'], { encoding: 'utf8', maxBuffer: 2 ** 28 });
|
|
@@ -232,7 +232,7 @@ if (/debuggable\s*=?\s*true/.test(releaseBlock)) fail('Android release build is
|
|
|
232
232
|
if (/android\.injected\.signing/.test(codemagic)) ok('Android release signing', 'Codemagic signs with the upload key');
|
|
233
233
|
else if (/signingConfig\s*=?\s*signingConfigs\.debug/.test(releaseBlock)) {
|
|
234
234
|
// the kit's release-build.sh (and Codemagic) sign with the upload key, and Play rejects debug-signed uploads anyway
|
|
235
|
-
info('build.gradle signs release builds with the debug key', 'build store releases with sh scripts/
|
|
235
|
+
info('build.gradle signs release builds with the debug key', 'build store releases with sh scripts/amk/release-build.sh android, which signs with your upload key');
|
|
236
236
|
}
|
|
237
237
|
const cleartext = expo ? ((((expoManifest || {}).application || [])[0] || {}).$ || {})['android:usesCleartextTraffic'] === 'true'
|
|
238
238
|
: /android:usesCleartextTraffic="true"/.test(readNow(manifestPath) || '');
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# Sets the version users see on both platforms: iOS MARKETING_VERSION and Android versionName, or in Expo
|
|
3
3
|
# apps without native folders, expo.version in app.json.
|
|
4
4
|
# Build numbers are left alone (codemagic.yaml sets them at build time).
|
|
5
|
-
# Usage: sh scripts/
|
|
5
|
+
# Usage: sh scripts/amk/set-version.sh 1.4.0
|
|
6
6
|
set -eu
|
|
7
7
|
v=${1:-}
|
|
8
|
-
echo "$v" | grep -qE '^[0-9]+\.[0-9]+(\.[0-9]+)?$' || { echo "usage: sh scripts/
|
|
8
|
+
echo "$v" | grep -qE '^[0-9]+\.[0-9]+(\.[0-9]+)?$' || { echo "usage: sh scripts/amk/set-version.sh <version, e.g. 1.4.0>" >&2; exit 1; }
|
|
9
9
|
|
|
10
10
|
# Expo apps without native folders in git: the version is expo.version in the app config
|
|
11
11
|
if [ -z "$(git ls-files -- ios android 2> /dev/null)" ] &&
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Specs: check their format, fold a finished feature into the living spec, and show progress.
|
|
3
|
-
// node scripts/
|
|
3
|
+
// node scripts/amk/specs.js check [--skip-drafts] [files…] format of specs/<id>/requirements.md and specs/current/*.md
|
|
4
4
|
// (default: all; --skip-drafts leaves out specs whose work hasn't started)
|
|
5
|
-
// node scripts/
|
|
6
|
-
// node scripts/
|
|
5
|
+
// node scripts/amk/specs.js merge <id> apply specs/<id>/requirements.md's ADDED/MODIFIED/REMOVED sections to specs/current/
|
|
6
|
+
// node scripts/amk/specs.js status each spec's status and task progress, and the living spec's size
|
|
7
7
|
// A requirement is "### Requirement: <name>", a sentence with SHALL or MUST, and at least one
|
|
8
8
|
// "#### Scenario: <case>" with WHEN and THEN. Changes are "## ADDED Requirements: <area>" (and MODIFIED, REMOVED),
|
|
9
9
|
// where <area> names the file specs/current/<area>.md. Format: specs/current/README.md.
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
# Checks the app the way a user would: lint, typecheck and tests, then release builds on the iOS simulator
|
|
3
3
|
# and Android emulator, running Maestro flows and saving screenshots as evidence.
|
|
4
4
|
#
|
|
5
|
-
# Usage: sh scripts/
|
|
5
|
+
# Usage: sh scripts/amk/verify.sh [quick|ios|android|all] [--spec <id>] [--flow <file>] [--label <name>]
|
|
6
6
|
# [--flavor <name>] [--scheme <name>]
|
|
7
7
|
# quick lint, typecheck, tests
|
|
8
8
|
# ios|android release build, install, run flows, screenshots
|
|
9
9
|
# all everything (default)
|
|
10
|
-
# --spec <id> run .maestro/<id>*.yaml and save evidence in .
|
|
10
|
+
# --spec <id> run .maestro/<id>*.yaml and save evidence in .amk/evidence/<id>/
|
|
11
11
|
# --label <n> evidence folder name (default: the spec id, or a timestamp)
|
|
12
12
|
# --flavor <name> Android product flavor to check (default: the first one in build.gradle)
|
|
13
13
|
# --scheme <name> iOS scheme to check (default: the one named like the workspace)
|
|
@@ -35,8 +35,8 @@ while [ $# -gt 0 ]; do
|
|
|
35
35
|
done
|
|
36
36
|
|
|
37
37
|
root=$(pwd)
|
|
38
|
-
. scripts/
|
|
39
|
-
evidence="$root/.
|
|
38
|
+
. scripts/amk/maestro-env.sh
|
|
39
|
+
evidence="$root/.amk/evidence/${label:-${spec:-$(date +%Y%m%d-%H%M%S)}}"
|
|
40
40
|
mkdir -p "$evidence"
|
|
41
41
|
status=0
|
|
42
42
|
|
|
@@ -80,9 +80,9 @@ run_flows() { # platform device app_id
|
|
|
80
80
|
|
|
81
81
|
quick() {
|
|
82
82
|
# each one passes when the app's script passes, or when all its failures were already on the base branch
|
|
83
|
-
if node scripts/
|
|
84
|
-
node scripts/
|
|
85
|
-
node scripts/
|
|
83
|
+
if node scripts/amk/baseline.js lint > "$evidence/lint.log" 2>&1 &&
|
|
84
|
+
node scripts/amk/baseline.js typecheck > "$evidence/typecheck.log" 2>&1 &&
|
|
85
|
+
node scripts/amk/baseline.js test > "$evidence/test.log" 2>&1; then
|
|
86
86
|
echo "quick: lint, typecheck and tests passed"
|
|
87
87
|
# what didn't run (no such script, or an Expo app without ESLint yet), and failures the base branch already had
|
|
88
88
|
cat "$evidence/lint.log" "$evidence/typecheck.log" "$evidence/test.log" |
|
|
@@ -97,20 +97,20 @@ quick() {
|
|
|
97
97
|
ios() {
|
|
98
98
|
# iOS builds need Xcode, so off a Mac "all" checks Android and says who has to check iOS
|
|
99
99
|
if [ "$(uname -s)" != Darwin ]; then
|
|
100
|
-
echo "ios: not checked here: iOS builds need a Mac with Xcode. A teammate with a Mac runs: sh scripts/
|
|
100
|
+
echo "ios: not checked here: iOS builds need a Mac with Xcode. A teammate with a Mac runs: sh scripts/amk/verify.sh ios${spec:+ --spec $spec}"
|
|
101
101
|
[ "$mode" = ios ] && status=1
|
|
102
102
|
return
|
|
103
103
|
fi
|
|
104
104
|
command -v maestro > /dev/null || { echo "ios: Maestro isn't installed (https://maestro.dev)"; status=1; return; }
|
|
105
105
|
# Expo apps without native folders in git: generate ios/ first
|
|
106
|
-
if ! sh scripts/
|
|
106
|
+
if ! sh scripts/amk/prebuild.sh ios > "$evidence/prebuild-ios.log" 2>&1; then
|
|
107
107
|
echo "ios: expo prebuild FAILED, see ${evidence#"$root"/}/prebuild-ios.log"; status=1; return
|
|
108
108
|
fi
|
|
109
109
|
# pod install also generates React Native codegen files into ios/build/generated; a newer Podfile needs it again
|
|
110
110
|
if [ ! -d ios/Pods ] || [ ! -d ios/build/generated ] || [ ios/Podfile -nt ios/Pods/Manifest.lock ]; then
|
|
111
|
-
sh scripts/
|
|
111
|
+
sh scripts/amk/pod-install.sh > "$evidence/pod-install.log" 2>&1
|
|
112
112
|
fi
|
|
113
|
-
if ! CONFIGURATION=Release sh scripts/
|
|
113
|
+
if ! CONFIGURATION=Release sh scripts/amk/ios-build.sh > "$evidence/ios-build.log" 2>&1; then
|
|
114
114
|
echo "ios: release build FAILED, see ${evidence#"$root"/}/ios-build.log"; status=1; return
|
|
115
115
|
fi
|
|
116
116
|
# the newest app: the scheme just built (another scheme's app may still be there from an earlier build)
|
|
@@ -119,12 +119,17 @@ ios() {
|
|
|
119
119
|
device=$(xcrun simctl list devices available -j | node -e '
|
|
120
120
|
const all = Object.entries(JSON.parse(require("fs").readFileSync(0, "utf8")).devices)
|
|
121
121
|
.flatMap(([rt, ds]) => ds.map(d => ({ ...d, v: (rt.match(/iOS-(\d+)-(\d+)/) || []).slice(1).map(Number) })))
|
|
122
|
-
.filter(d => d.v.length
|
|
122
|
+
.filter(d => d.v.length);
|
|
123
123
|
const want = process.env.AMK_IOS_DEVICE;
|
|
124
|
+
// an iPhone by its device type: a simulator can have any name, such as a separate one kept for tests
|
|
125
|
+
const iphones = all.filter(d => /iPhone/.test(d.deviceTypeIdentifier || d.name));
|
|
124
126
|
const pick = want ? all.find(d => d.udid === want || d.name === want)
|
|
125
|
-
:
|
|
127
|
+
: iphones.find(d => d.state === "Booted") || iphones.sort((a, b) => b.v[0] - a.v[0] || b.v[1] - a.v[1])[0];
|
|
126
128
|
console.log(pick ? pick.udid : "");')
|
|
127
|
-
[ -
|
|
129
|
+
if [ -z "$device" ]; then
|
|
130
|
+
if [ -n "${AMK_IOS_DEVICE:-}" ]; then echo "ios: no simulator has the name or UDID \"$AMK_IOS_DEVICE\""; else echo "ios: no iPhone simulator found (set AMK_IOS_DEVICE)"; fi
|
|
131
|
+
status=1; return
|
|
132
|
+
fi
|
|
128
133
|
xcrun simctl boot "$device" 2> /dev/null || true
|
|
129
134
|
xcrun simctl bootstatus "$device" -b > /dev/null
|
|
130
135
|
xcrun simctl install "$device" "$app"
|
|
@@ -141,13 +146,13 @@ android() {
|
|
|
141
146
|
sdk=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$default_sdk}}
|
|
142
147
|
adb="$sdk/platform-tools/adb"
|
|
143
148
|
# Expo apps without native folders in git: generate android/ first
|
|
144
|
-
if ! sh scripts/
|
|
149
|
+
if ! sh scripts/amk/prebuild.sh android > "$evidence/prebuild-android.log" 2>&1; then
|
|
145
150
|
echo "android: expo prebuild FAILED, see ${evidence#"$root"/}/prebuild-android.log"; status=1; return
|
|
146
151
|
fi
|
|
147
152
|
# apps with product flavors: check one, the first in build.gradle unless --flavor names another
|
|
148
153
|
if [ -z "$flavor" ]; then
|
|
149
154
|
code=0
|
|
150
|
-
flavors=$(node scripts/
|
|
155
|
+
flavors=$(node scripts/amk/android-flavors.js) || code=$?
|
|
151
156
|
case $code in
|
|
152
157
|
0) ;;
|
|
153
158
|
2) echo "android: the app has several flavor dimensions; name the variant with --flavor (for example devFree)"; status=1; return ;;
|