agentic-mobile-kit 0.5.6 → 0.6.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 +5 -1
- package/bin/cli.js +1 -1
- package/lib/doctor.js +1 -1
- package/lib/init.js +91 -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-bugfix/SKILL.md +1 -1
- package/stacks/react-native/template/.agents/skills/m-continue/SKILL.md +1 -1
- package/stacks/react-native/template/.agents/skills/m-feature/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 -2
- package/stacks/react-native/template/.github/workflows/ci.yml +8 -3
- 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 +3 -3
- package/stacks/react-native/template/codemagic.yaml +2 -1
- package/stacks/react-native/template/scripts/ai/baseline.js +201 -0
- package/stacks/react-native/template/scripts/ai/case-check.js +1 -1
- package/stacks/react-native/template/scripts/ai/guard.js +2 -1
- package/stacks/react-native/template/scripts/ai/ios-build.sh +9 -1
- package/stacks/react-native/template/scripts/ai/maestro-env.sh +20 -0
- 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/{spec.js → specs.js} +5 -6
- package/stacks/react-native/template/scripts/ai/verify.sh +25 -7
- package/stacks/react-native/template/specs/_templates/flow.yaml +8 -0
- package/stacks/react-native/template/specs/current/README.md +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Sourced by verify.sh. Test logins and other values that Maestro flows read as ${MAESTRO_…} come from a local,
|
|
2
|
+
# gitignored .maestro/.env.local (or .maestro/.env), as KEY=value lines. Only MAESTRO_ keys are read: the values
|
|
3
|
+
# are never evaluated or printed, and a value already set in the shell wins. Maestro passes MAESTRO_ variables to flows.
|
|
4
|
+
for amk_file in .maestro/.env.local .maestro/.env; do
|
|
5
|
+
[ -f "$amk_file" ] || continue
|
|
6
|
+
while IFS= read -r amk_line || [ -n "$amk_line" ]; do
|
|
7
|
+
amk_line=$(printf %s "$amk_line" | tr -d '\r')
|
|
8
|
+
case $amk_line in MAESTRO_*=*) ;; *) continue ;; esac
|
|
9
|
+
amk_key=${amk_line%%=*}
|
|
10
|
+
amk_value=${amk_line#*=}
|
|
11
|
+
case $amk_key in *[!A-Za-z0-9_]*) continue ;; esac
|
|
12
|
+
[ -z "$(printenv "$amk_key")" ] || continue
|
|
13
|
+
case $amk_value in
|
|
14
|
+
\"*\") amk_value=${amk_value#\"}; amk_value=${amk_value%\"} ;;
|
|
15
|
+
\'*\') amk_value=${amk_value#\'}; amk_value=${amk_value%\'} ;;
|
|
16
|
+
esac
|
|
17
|
+
export "$amk_key=$amk_value"
|
|
18
|
+
done < "$amk_file"
|
|
19
|
+
done
|
|
20
|
+
unset amk_file amk_line amk_key amk_value
|
|
@@ -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: 2 ** 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
|
|
|
@@ -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/ai/
|
|
4
|
-
//
|
|
5
|
-
// node scripts/ai/
|
|
6
|
-
// node scripts/ai/
|
|
3
|
+
// node scripts/ai/specs.js check [--skip-drafts] [files…] format of specs/<id>/requirements.md and specs/current/*.md
|
|
4
|
+
// (default: all; --skip-drafts leaves out specs whose work hasn't started)
|
|
5
|
+
// node scripts/ai/specs.js merge <id> apply specs/<id>/requirements.md's ADDED/MODIFIED/REMOVED sections to specs/current/
|
|
6
|
+
// node scripts/ai/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.
|
|
@@ -14,7 +14,6 @@ const path = require('path');
|
|
|
14
14
|
const [cmd, ...args] = process.argv.slice(2);
|
|
15
15
|
const read = f => { try { return fs.readFileSync(f, 'utf8').replace(/\r\n/g, '\n'); } catch { return null; } };
|
|
16
16
|
const key = name => name.trim().toLowerCase();
|
|
17
|
-
const isRequirement = l => /^### Requirement:/.test(l);
|
|
18
17
|
|
|
19
18
|
// "### Requirement:" blocks between lines [from, to): each runs to the next heading of level 1-3
|
|
20
19
|
function blocks(lines, from = 0, to = lines.length) {
|
|
@@ -214,6 +213,6 @@ if (cmd === 'check') {
|
|
|
214
213
|
} else if (cmd === 'status') {
|
|
215
214
|
process.exitCode = status();
|
|
216
215
|
} else {
|
|
217
|
-
console.log(fs.readFileSync(
|
|
216
|
+
console.log(fs.readFileSync(process.argv[1], 'utf8').split('\n').slice(1, 9).map(l => l.replace(/^\/\/ ?/, '')).join('\n'));
|
|
218
217
|
process.exitCode = 1;
|
|
219
218
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
# (no flows found: a smoke check that launches the app and takes a screenshot)
|
|
15
15
|
# Env: AMK_ANDROID_FLAVOR, AMK_IOS_SCHEME (defaults for the two options), AMK_IOS_DEVICE (simulator name
|
|
16
16
|
# or UDID), AMK_ANDROID_DEVICE (adb serial, when several are connected), AMK_ANDROID_AVD (emulator to start)
|
|
17
|
+
# Flows that log in read ${MAESTRO_EMAIL} and the like from a local, gitignored .maestro/.env.local (never committed).
|
|
17
18
|
set -eu
|
|
18
19
|
|
|
19
20
|
mode=${1:-all}
|
|
@@ -34,6 +35,7 @@ while [ $# -gt 0 ]; do
|
|
|
34
35
|
done
|
|
35
36
|
|
|
36
37
|
root=$(pwd)
|
|
38
|
+
. scripts/ai/maestro-env.sh
|
|
37
39
|
evidence="$root/.ai/evidence/${label:-${spec:-$(date +%Y%m%d-%H%M%S)}}"
|
|
38
40
|
mkdir -p "$evidence"
|
|
39
41
|
status=0
|
|
@@ -50,8 +52,9 @@ run_flows() { # platform device app_id
|
|
|
50
52
|
mkdir -p "$out"
|
|
51
53
|
files=$(flow_files)
|
|
52
54
|
if [ -z "$files" ]; then
|
|
53
|
-
# launchApp returns before the app has drawn
|
|
54
|
-
|
|
55
|
+
# launchApp returns before the app has drawn, and a splash screen stays up until the JavaScript has loaded:
|
|
56
|
+
# a fixed wait (for text that never appears), then for the screen to settle, so the screenshot shows the app
|
|
57
|
+
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
58
|
files="$out/smoke.yaml"
|
|
56
59
|
fi
|
|
57
60
|
passed=0
|
|
@@ -76,12 +79,17 @@ run_flows() { # platform device app_id
|
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
quick() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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/ai/baseline.js lint > "$evidence/lint.log" 2>&1 &&
|
|
84
|
+
node scripts/ai/baseline.js typecheck > "$evidence/typecheck.log" 2>&1 &&
|
|
85
|
+
node scripts/ai/baseline.js test > "$evidence/test.log" 2>&1; then
|
|
82
86
|
echo "quick: lint, typecheck and tests passed"
|
|
87
|
+
# what didn't run (no such script, or an Expo app without ESLint yet), and failures the base branch already had
|
|
88
|
+
cat "$evidence/lint.log" "$evidence/typecheck.log" "$evidence/test.log" |
|
|
89
|
+
sed -n -E -e 's/^skip: / skipped: /p' -e 's/^(lint|typecheck|test): / \1: /p'
|
|
83
90
|
else
|
|
84
91
|
echo "quick: FAILED, see the logs in ${evidence#"$root"/}"
|
|
92
|
+
cat "$evidence/lint.log" "$evidence/typecheck.log" "$evidence/test.log" 2> /dev/null | sed -n -E '/^(lint|typecheck|test): /,/^[^ ]/p' | head -n 20
|
|
85
93
|
status=1
|
|
86
94
|
fi
|
|
87
95
|
}
|
|
@@ -94,8 +102,14 @@ ios() {
|
|
|
94
102
|
return
|
|
95
103
|
fi
|
|
96
104
|
command -v maestro > /dev/null || { echo "ios: Maestro isn't installed (https://maestro.dev)"; status=1; return; }
|
|
97
|
-
#
|
|
98
|
-
if
|
|
105
|
+
# Expo apps without native folders in git: generate ios/ first
|
|
106
|
+
if ! sh scripts/ai/prebuild.sh ios > "$evidence/prebuild-ios.log" 2>&1; then
|
|
107
|
+
echo "ios: expo prebuild FAILED, see ${evidence#"$root"/}/prebuild-ios.log"; status=1; return
|
|
108
|
+
fi
|
|
109
|
+
# pod install also generates React Native codegen files into ios/build/generated; a newer Podfile needs it again
|
|
110
|
+
if [ ! -d ios/Pods ] || [ ! -d ios/build/generated ] || [ ios/Podfile -nt ios/Pods/Manifest.lock ]; then
|
|
111
|
+
sh scripts/ai/pod-install.sh > "$evidence/pod-install.log" 2>&1
|
|
112
|
+
fi
|
|
99
113
|
if ! CONFIGURATION=Release sh scripts/ai/ios-build.sh > "$evidence/ios-build.log" 2>&1; then
|
|
100
114
|
echo "ios: release build FAILED, see ${evidence#"$root"/}/ios-build.log"; status=1; return
|
|
101
115
|
fi
|
|
@@ -126,6 +140,10 @@ android() {
|
|
|
126
140
|
esac
|
|
127
141
|
sdk=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$default_sdk}}
|
|
128
142
|
adb="$sdk/platform-tools/adb"
|
|
143
|
+
# Expo apps without native folders in git: generate android/ first
|
|
144
|
+
if ! sh scripts/ai/prebuild.sh android > "$evidence/prebuild-android.log" 2>&1; then
|
|
145
|
+
echo "android: expo prebuild FAILED, see ${evidence#"$root"/}/prebuild-android.log"; status=1; return
|
|
146
|
+
fi
|
|
129
147
|
# apps with product flavors: check one, the first in build.gradle unless --flavor names another
|
|
130
148
|
if [ -z "$flavor" ]; then
|
|
131
149
|
code=0
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# Copy to .maestro/<id>.yaml. verify.sh runs it on iOS and Android and keeps the screenshots as evidence.
|
|
2
2
|
# Tap by testID (give every interactive element one); tapping by text can hit a label instead of the control.
|
|
3
|
+
# Test logins: ${MAESTRO_EMAIL}, ${MAESTRO_PASSWORD} and the like, set in .maestro/.env.local, which isn't committed.
|
|
3
4
|
appId: ${APP_ID} # set by verify.sh
|
|
4
5
|
---
|
|
5
6
|
- launchApp:
|
|
6
7
|
clearState: true
|
|
8
|
+
# After every launchApp: a splash screen can still cover the app while assertions already pass (the app's views
|
|
9
|
+
# exist under it), so wait a moment (for text that never appears), then for the screen to settle.
|
|
10
|
+
- extendedWaitUntil:
|
|
11
|
+
visible: "flow: waiting for the app to draw"
|
|
12
|
+
timeout: 3000
|
|
13
|
+
optional: true
|
|
14
|
+
- waitForAnimationToEnd
|
|
7
15
|
# Scenario 1: <scenario name from requirements.md>
|
|
8
16
|
- assertVisible:
|
|
9
17
|
id: "<testID of the element>"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
One file per area of the app (for example `login.md` or `tasks.md`) that describes how the app behaves today, requirement by requirement. AI tools read it before they change an area, so they don't have to work out the current behavior from the code.
|
|
4
4
|
|
|
5
|
-
It starts empty and grows one change at a time; there's no need to describe the whole app up front. Each feature's `specs/<id>/requirements.md` lists what it adds, changes and removes, and when the feature is done, `node scripts/ai/
|
|
5
|
+
It starts empty and grows one change at a time; there's no need to describe the whole app up front. Each feature's `specs/<id>/requirements.md` lists what it adds, changes and removes, and when the feature is done, `node scripts/ai/specs.js merge <id>` applies those changes here. People can edit these files too.
|
|
6
6
|
|
|
7
7
|
## Format
|
|
8
8
|
|
|
@@ -37,4 +37,4 @@ A feature's `requirements.md` groups its requirements under these headings, wher
|
|
|
37
37
|
- `## MODIFIED Requirements: <area>`: behavior that changes. Copy the current requirement, keep its name, and edit it. Merging replaces the old one.
|
|
38
38
|
- `## REMOVED Requirements: <area>`: behavior that goes away, with a line on why. Merging deletes it, and deletes the file when its last requirement goes.
|
|
39
39
|
|
|
40
|
-
`node scripts/ai/
|
|
40
|
+
`node scripts/ai/specs.js check` checks the format; the git pre-commit hook runs it on staged specs once their work has started. `node scripts/ai/specs.js status` lists every feature's state and task progress.
|