agentic-mobile-kit 0.14.1 → 0.14.2
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/lib/init.js +26 -4
- package/package.json +1 -1
- package/stacks/react-native/expo/docs/amk/expo.md +1 -0
- package/stacks/react-native/expo/docs/amk/known-issues.md +5 -0
- package/stacks/react-native/template/.githooks/pre-commit +1 -1
- package/stacks/react-native/template/.github/workflows/ci.yml +3 -1
- package/stacks/react-native/template/docs/amk/known-issues.md +5 -0
- package/stacks/react-native/template/docs/amk/react-native.md +1 -0
- package/stacks/react-native/template/scripts/amk/autopilot.js +1 -1
- package/stacks/react-native/template/scripts/amk/guard.js +1 -1
- package/stacks/react-native/template/scripts/amk/handoff-check.js +5 -2
- package/stacks/react-native/template/scripts/amk/screens.js +30 -8
- package/stacks/react-native/template/scripts/amk/verify.sh +16 -6
package/lib/init.js
CHANGED
|
@@ -464,12 +464,28 @@ function oldTemplate(agents, opts) {
|
|
|
464
464
|
function fetchTemplate(version) {
|
|
465
465
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'amk-kit-'));
|
|
466
466
|
process.on('exit', () => fs.rmSync(dir, { recursive: true, force: true }));
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
// errors only: --silent hid npm's reason too (a version npm hasn't got, no network)
|
|
468
|
+
const r = tool('npm', ['pack', `agentic-mobile-kit@${version}`, '--pack-destination', dir, '--loglevel=error'], { cwd: dir, env: cleanEnv(), encoding: 'utf8' });
|
|
469
|
+
if (r.status !== 0) {
|
|
470
|
+
const why = (r.stderr || '').split('\n').map(l => l.replace(/^npm (?:error|ERR!)\s*/, '').replace(/^(?:notarget|network)\s+/, '').trim())
|
|
471
|
+
.find(l => l && !/^(?:code|errno|syscall)\b/.test(l)) || `npm exited with ${r.status}`;
|
|
472
|
+
throw new InitError(`Couldn't download agentic-mobile-kit@${version} from npm: ${why}`);
|
|
473
|
+
}
|
|
469
474
|
execFileSync('tar', ['-xzf', path.join(dir, r.stdout.trim().split('\n').pop()), '-C', dir]);
|
|
470
475
|
return path.join(dir, 'package', 'stacks', 'react-native', 'template');
|
|
471
476
|
}
|
|
472
477
|
|
|
478
|
+
// a list's entries: each "### " heading with its lines, up to the next heading
|
|
479
|
+
const entries = text => text.match(/^### [^\n]*\n[\s\S]*?(?=^#{2,3} |(?![\s\S]))/gm) || [];
|
|
480
|
+
// the team's list with the entries the kit added since the old version (not those the team has too), after its heading
|
|
481
|
+
function withNewEntries(current, kitOld, kitNew) {
|
|
482
|
+
const heads = text => new Set(entries(text).map(e => e.split('\n')[0].trim()));
|
|
483
|
+
const known = new Set([...heads(kitOld), ...heads(current)]);
|
|
484
|
+
const added = entries(kitNew).filter(e => !known.has(e.split('\n')[0].trim()));
|
|
485
|
+
if (!/^## Entries\n\n/m.test(current)) return null;
|
|
486
|
+
return current.replace(/^## Entries\n\n/m, m => `${m}${added.map(e => `${e.replace(/\n*$/, '')}\n\n`).join('')}`);
|
|
487
|
+
}
|
|
488
|
+
|
|
473
489
|
// three-way merge: your changes and the kit's changes since the old version, both kept
|
|
474
490
|
function merge3(current, base, kitNew, from) {
|
|
475
491
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'amk-merge-'));
|
|
@@ -704,10 +720,12 @@ function finish(cwd, { pkg, deps, tools, files, stack, skipGenerate }) {
|
|
|
704
720
|
const giText = readIf(gi) || '';
|
|
705
721
|
// Expo: ios/ and android/ are generated by prebuild, so they stay out of git too
|
|
706
722
|
// .maestro/.amk-*: the copies of flows with view-tree steps that verify.sh runs on Android, there only while they run
|
|
707
|
-
|
|
723
|
+
// node_modules without the slash: a git worktree often links the project's node_modules, and node_modules/ matches
|
|
724
|
+
// only a folder, so git add -A would commit the link
|
|
725
|
+
const ignored = ['.env', '.env.*', '!.env*.example', '!.env*.sample', '!.env*.template', '.amk/', '.maestro/.amk-*', 'node_modules', ...(stack === 'expo' ? ['/ios', '/android'] : [])];
|
|
708
726
|
const missing = ignored.filter(l => !giText.split('\n').includes(l));
|
|
709
727
|
if (missing.length) {
|
|
710
|
-
fs.writeFileSync(gi, `${giText.replace(/\n*$/, giText ? '\n' : '')}\n# agentic-mobile-kit: secrets stay out of git; .amk/ holds local evidence (screenshots, logs), .maestro/.amk-* the flows verify.sh is running${stack === 'expo' ? '; ios/ and android/ are generated' : ''}\n${missing.join('\n')}\n`);
|
|
728
|
+
fs.writeFileSync(gi, `${giText.replace(/\n*$/, giText ? '\n' : '')}\n# agentic-mobile-kit: secrets stay out of git; .amk/ holds local evidence (screenshots, logs), .maestro/.amk-* the flows verify.sh is running; node_modules also as a link (a worktree's)${stack === 'expo' ? '; ios/ and android/ are generated' : ''}\n${missing.join('\n')}\n`);
|
|
711
729
|
done.merged.push('.gitignore');
|
|
712
730
|
}
|
|
713
731
|
|
|
@@ -912,6 +930,10 @@ function sync(cwd, opts = {}) {
|
|
|
912
930
|
if (kitOld === kitNew || PROJECT_DOCS.includes(rel)) continue;
|
|
913
931
|
// without an exact base, an old unchanged file would look like your edit and be kept: show every difference instead
|
|
914
932
|
const { text, conflicts } = merge3(current, exact ? kitOld : '', kitNew, from);
|
|
933
|
+
// the known issues are the team's list too: when both added entries in one place, the team's file gets the kit's
|
|
934
|
+
// new entries, by heading, at the top of the list, rather than conflict markers
|
|
935
|
+
const listed = conflicts && rel === 'docs/amk/known-issues.md' && withNewEntries(current, kitOld, kitNew);
|
|
936
|
+
if (listed) { writeKitFile(cwd, rel, listed); report.merged.push(rel); continue; }
|
|
915
937
|
// markers, or a merge that no longer parses, would stop a script, a hook, a workflow or a config from working (and
|
|
916
938
|
// every check with it): those get the kit's version, and the team's goes beside it to bring its changes back
|
|
917
939
|
if (!rel.endsWith('.md') && (conflicts || !parses(rel, text))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-mobile-kit",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "One setup for AI-assisted development of React Native apps, bare or Expo: shared rules and workflows for Claude Code, Codex and Antigravity, git hooks, device checks with screenshots, and release tooling for the App Store and Google Play.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "prakashpro1",
|
|
@@ -51,6 +51,7 @@ Rules for things AI agents commonly get wrong in Expo apps. Each one comes from
|
|
|
51
51
|
- Landscape leaves little height: screens scroll, the keyboard covers more, and the safe-area insets include the left and right edges (the notch or Dynamic Island side).
|
|
52
52
|
- Android ignores orientation and size locks on tablets and foldables (600 dp wide and up) for apps targeting Android 16 (API 36), and from Android 17 (API 37) apps can't opt out. Apple deprecated `UIRequiresFullScreen` with iPadOS 26, so iPad windows resize too, and on iOS 27 `ScreenOrientation.lockAsync` may do nothing. Every screen has to work at any window size and turned, whatever the app's settings say.
|
|
53
53
|
- Don't lock the orientation in code to avoid layout work. Which orientations the app supports is a product decision, set in `app.json`: `orientation` (`default` turns, `portrait` or `landscape` locks) and `ios.supportsTablet` for the iPad app.
|
|
54
|
+
- A team that checks fewer screens than the app supports (phones only, say) lists them in `.amk-screens`, as `--screens` takes them: `phone`. `verify.sh` then never checks the others, whatever `--screens` asks (`portrait` and `landscape` otherwise include the tablet's), and `node scripts/amk/screens.js` prints the sentence for `AGENTS.md`'s Screens line.
|
|
54
55
|
|
|
55
56
|
## Current Expo, React Native and React
|
|
56
57
|
|
|
@@ -11,6 +11,11 @@ Recurring errors and their fixes. Check here before debugging a build error. Rem
|
|
|
11
11
|
|
|
12
12
|
## Entries
|
|
13
13
|
|
|
14
|
+
### iOS build: "unable to initiate PIF transfer session (operation in progress?)"
|
|
15
|
+
- **Cause:** two builds of the same project at once: a build from the command line (`verify.sh`, `ios-build.sh`) while Xcode builds or indexes it. No `xcodebuild` needs to be running: Xcode's build service holds the project.
|
|
16
|
+
- **Fix:** let Xcode finish, or quit it, then build again. If it stays stuck: `pkill -f SWBBuildService` (Xcode's build service, which starts again when needed), then build again.
|
|
17
|
+
- **Prevention:** don't start a command-line build while Xcode builds or indexes the same project.
|
|
18
|
+
|
|
14
19
|
### A native change doesn't show up in the build
|
|
15
20
|
- **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
21
|
- **Fix:** delete `ios/.amk-fingerprint` and `android/.amk-fingerprint`, then check again. The next build regenerates both folders and takes longer.
|
|
@@ -7,7 +7,7 @@ set -eu
|
|
|
7
7
|
# settings, the workflows, the agents' instructions, the coverage floors and size caps, and the code owners (the same
|
|
8
8
|
# list as autopilot.js and guard.js). A person changes them, in a reviewed pull request
|
|
9
9
|
if [ -n "${AMK_AUTOPILOT:-}" ]; then
|
|
10
|
-
kept=$(git diff --cached --name-only | grep -E '^(scripts/amk/|\.rulesync/|\.githooks/|\.github/workflows/|\.agents/|\.claude/|\.codex/|((\.github|docs)/)?CODEOWNERS$|AGENTS\.md$|CLAUDE\.md$|rulesync\.jsonc$|\.amk-(coverage|size-caps|secrets)$)' || true)
|
|
10
|
+
kept=$(git diff --cached --name-only | grep -E '^(scripts/amk/|\.rulesync/|\.githooks/|\.github/workflows/|\.agents/|\.claude/|\.codex/|((\.github|docs)/)?CODEOWNERS$|AGENTS\.md$|CLAUDE\.md$|rulesync\.jsonc$|\.amk-(coverage|size-caps|secrets|screens)$)' || true)
|
|
11
11
|
# merging main in brings its versions (a kit update there): only a file that differs from the merged branch's is a change
|
|
12
12
|
if [ -n "$kept" ] && git rev-parse -q --verify MERGE_HEAD > /dev/null; then
|
|
13
13
|
kept=$(for f in $kept; do [ "$(git rev-parse -q ":$f" 2> /dev/null)" = "$(git rev-parse -q "MERGE_HEAD:$f" 2> /dev/null)" ] || echo "$f"; done)
|
|
@@ -48,8 +48,10 @@ jobs:
|
|
|
48
48
|
run: npx -y rulesync@27.0.0 generate > /dev/null && node scripts/amk/tool-configs.js && git diff --exit-code -- .claude .codex .agents .antigravity
|
|
49
49
|
- name: Secret scan
|
|
50
50
|
run: docker run --rm -v "$PWD:/repo" ghcr.io/gitleaks/gitleaks:v8.30.1 git /repo --no-banner --redact
|
|
51
|
+
# the weekly kit update (amk-kit-update.yml, on amk/kit-<version>) is mostly the kit's own files, read from its
|
|
52
|
+
# release notes rather than line by line: no size limit there
|
|
51
53
|
- name: PR size (max 600 changed lines; label "large-pr" to override)
|
|
52
|
-
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'large-pr')
|
|
54
|
+
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'large-pr') && !startsWith(github.head_ref, 'amk/kit-')
|
|
53
55
|
run: |
|
|
54
56
|
lines=$(git diff --numstat "origin/${{ github.base_ref }}...HEAD" -- . ':(exclude)*.lock' ':(exclude)package-lock.json' ':(exclude)pnpm-lock.yaml' ':(exclude)*.snap' | awk '{ s += $1 + $2 } END { print s + 0 }')
|
|
55
57
|
echo "$lines changed lines"
|
|
@@ -11,6 +11,11 @@ Recurring errors and their fixes. Check here before debugging a build error. Rem
|
|
|
11
11
|
|
|
12
12
|
## Entries
|
|
13
13
|
|
|
14
|
+
### iOS build: "unable to initiate PIF transfer session (operation in progress?)"
|
|
15
|
+
- **Cause:** two builds of the same project at once: a build from the command line (`verify.sh`, `ios-build.sh`) while Xcode builds or indexes it. No `xcodebuild` needs to be running: Xcode's build service holds the project.
|
|
16
|
+
- **Fix:** let Xcode finish, or quit it, then build again. If it stays stuck: `pkill -f SWBBuildService` (Xcode's build service, which starts again when needed), then build again.
|
|
17
|
+
- **Prevention:** don't start a command-line build while Xcode builds or indexes the same project.
|
|
18
|
+
|
|
14
19
|
### iOS build fails right after a native dependency was added or removed
|
|
15
20
|
- **Cause:** `ios/Pods` is out of date.
|
|
16
21
|
- **Fix:** `sh scripts/amk/pod-install.sh`, then rebuild.
|
|
@@ -37,6 +37,7 @@ Rules for things AI agents commonly get wrong in current React Native. Each one
|
|
|
37
37
|
- Landscape leaves little height: screens scroll, the keyboard covers more, and the safe-area insets include the left and right edges (the notch or Dynamic Island side).
|
|
38
38
|
- Android ignores orientation and size locks on tablets and foldables (600 dp wide and up) for apps targeting Android 16 (API 36), and from Android 17 (API 37) apps can't opt out. Apple deprecated `UIRequiresFullScreen` with iPadOS 26, so iPad windows resize too. Every screen has to work at any window size and turned, whatever the app's settings say.
|
|
39
39
|
- Don't lock the orientation in code to avoid layout work. Which orientations the app supports is a product decision, set in `Info.plist` (`UISupportedInterfaceOrientations`, and `~ipad` for iPads) and the Android manifest (`android:screenOrientation`); the iPad app itself is the Xcode target's device family.
|
|
40
|
+
- A team that checks fewer screens than the app supports (phones only, say) lists them in `.amk-screens`, as `--screens` takes them: `phone`. `verify.sh` then never checks the others, whatever `--screens` asks (`portrait` and `landscape` otherwise include the tablet's), and `node scripts/amk/screens.js` prints the sentence for `AGENTS.md`'s Screens line.
|
|
40
41
|
|
|
41
42
|
## Current React Native and React
|
|
42
43
|
|
|
@@ -94,7 +94,7 @@ const COMMANDS = pm => ['sh scripts/amk/verify.sh', 'node scripts/amk/specs.js',
|
|
|
94
94
|
// what an unattended run never changes (guard.js and the pre-commit hook hold the same list): the kit's scripts, hooks
|
|
95
95
|
// and tool settings, the workflows, the agents' instructions, the coverage floors and size caps, and the code owners
|
|
96
96
|
const GUARDRAILS = ['scripts/amk/', '.rulesync/', '.githooks/', '.github/workflows/', '.agents/', '.claude/', '.codex/', 'AGENTS.md',
|
|
97
|
-
'CLAUDE.md', 'rulesync.jsonc', '.amk-coverage', '.amk-size-caps', '.amk-secrets', 'CODEOWNERS', '.github/CODEOWNERS', 'docs/CODEOWNERS'];
|
|
97
|
+
'CLAUDE.md', 'rulesync.jsonc', '.amk-coverage', '.amk-size-caps', '.amk-secrets', '.amk-screens', 'CODEOWNERS', '.github/CODEOWNERS', 'docs/CODEOWNERS'];
|
|
98
98
|
// a path as Claude Code's rules write an absolute one: //Users/…, or //c/Users/… on Windows
|
|
99
99
|
const rulePath = p => `/${process.platform === 'win32' ? p.replace(/\\/g, '/').replace(/^([A-Za-z]):/, (_, d) => `/${d.toLowerCase()}`) : p}`;
|
|
100
100
|
// Claude Code: --permission-mode dontAsk refuses what isn't allowed rather than asking, and what the project's settings
|
|
@@ -70,7 +70,7 @@ for (const p of paths) {
|
|
|
70
70
|
// auto-merge, touch the trigger labels, push anything but a feature/ or fix/ branch by name, or change the guardrails
|
|
71
71
|
// (autopilot.js and the pre-commit hook hold the same list)
|
|
72
72
|
if (process.env.AMK_AUTOPILOT) {
|
|
73
|
-
const GUARDRAILS = /^(?:scripts\/amk\/|\.rulesync\/|\.githooks\/|\.github\/workflows\/|\.agents\/|\.claude\/|\.codex\/|(?:\.github\/|docs\/)?CODEOWNERS$|AGENTS\.md$|CLAUDE\.md$|rulesync\.jsonc$|\.amk-(?:coverage|size-caps|secrets)$)/;
|
|
73
|
+
const GUARDRAILS = /^(?:scripts\/amk\/|\.rulesync\/|\.githooks\/|\.github\/workflows\/|\.agents\/|\.claude\/|\.codex\/|(?:\.github\/|docs\/)?CODEOWNERS$|AGENTS\.md$|CLAUDE\.md$|rulesync\.jsonc$|\.amk-(?:coverage|size-caps|secrets|screens)$)/;
|
|
74
74
|
const roots = [root, fs.realpathSync(root)];
|
|
75
75
|
const rel = p => roots.map(r => path.relative(r, path.resolve(r, p)).replace(/\\/g, '/')).find(x => !x.startsWith('..')) || '';
|
|
76
76
|
// relative to the project, or as written without leading ../ (after a cd the guard doesn't follow)
|
|
@@ -52,8 +52,11 @@ const state = progress === null ? null : JSON.stringify([sh('git rev-parse HEAD'
|
|
|
52
52
|
|
|
53
53
|
// code changed without the handoff: asked once (stop_hook_active: the agent goes on because of an earlier ask)
|
|
54
54
|
if ((working.length || progress !== null) && !payload.stop_hook_active) {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// every new file, not just its new folder; but not a new link, such as the project's node_modules linked into a git
|
|
56
|
+
// worktree: no session writes code that way, and it would ask at every stop
|
|
57
|
+
const link = f => { try { return fs.lstatSync(path.join(root, f)).isSymbolicLink(); } catch { return false; } };
|
|
58
|
+
const changed = sh('git status --porcelain --untracked-files=all')
|
|
59
|
+
.split('\n').filter(Boolean).filter(l => !(l.startsWith('?? ') && link(l.slice(3)))).map(l => l.slice(3));
|
|
57
60
|
const codeChanged = changed.some(f => !f.startsWith('specs/') && !f.startsWith('.amk/'));
|
|
58
61
|
const handoffUpdated = changed.some(f => /^specs\/[^/]+\/progress\.md$/.test(f));
|
|
59
62
|
if (codeChanged && !handoffUpdated) {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// The screens the app supports: phones and tablets, portrait and landscape, on iOS and Android. Read from the native
|
|
3
3
|
// projects (app.json in an Expo app that doesn't have them yet), so agents build for them and verify.sh checks them.
|
|
4
4
|
// The app runs on tablets when its iOS app runs on iPad; Android runs every app on tablets, but the kit checks
|
|
5
|
-
// Android tablets only for apps made for tablets.
|
|
5
|
+
// Android tablets only for apps made for tablets. A team that checks fewer screens than the app supports (phones only,
|
|
6
|
+
// say) writes them in .amk-screens, as --screens takes them: "phone". The kit then never checks the others.
|
|
6
7
|
// Usage: node scripts/amk/screens.js one sentence, as AGENTS.md says it
|
|
7
8
|
// node scripts/amk/screens.js ios|android the screens to check, one per line: phone-portrait, tablet-landscape, …
|
|
8
9
|
'use strict';
|
|
@@ -59,14 +60,31 @@ function expo(cwd) {
|
|
|
59
60
|
return { ios: { phone, tablet: config.ios && config.ios.supportsTablet ? phone : null }, android: { phone, tablet: BOTH } };
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
// .amk-screens: the screens the team checks, comma or space separated, as --screens takes them (phone, tablet,
|
|
64
|
+
// portrait, landscape, tablet-landscape, …); # starts a comment. Without it, every screen the app supports
|
|
65
|
+
function capOf(cwd) {
|
|
66
|
+
const words = (read(path.join(cwd, '.amk-screens')) || '').replace(/#.*$/gm, '').split(/[\s,]+/).filter(Boolean);
|
|
67
|
+
return words.length ? words : null;
|
|
68
|
+
}
|
|
69
|
+
// a screen a word names: the word itself, or one of its two parts (phone, landscape, …)
|
|
70
|
+
const named = (screen, words) => words.some(w => screen === w || screen.startsWith(`${w}-`) || screen.endsWith(`-${w}`));
|
|
71
|
+
function capped(p, words) {
|
|
72
|
+
if (!p || !words) return p;
|
|
73
|
+
const keep = kind => (p[kind] || []).filter(o => named(`${kind}-${o}`, words));
|
|
74
|
+
const tablet = keep('tablet');
|
|
75
|
+
return { phone: keep('phone'), tablet: tablet.length ? tablet : null };
|
|
76
|
+
}
|
|
77
|
+
|
|
62
78
|
function screens(cwd) {
|
|
63
79
|
const fromExpo = expo(cwd);
|
|
64
80
|
const i = ios(cwd) || (fromExpo && fromExpo.ios);
|
|
65
81
|
const a = android(cwd) || (fromExpo && fromExpo.android);
|
|
66
82
|
const tablets = Boolean(i && i.tablet);
|
|
83
|
+
const cap = capOf(cwd);
|
|
67
84
|
return {
|
|
68
|
-
ios: i && { phone: i.phone, tablet: tablets ? i.tablet : null },
|
|
69
|
-
android: a && { phone: a.phone, tablet: tablets ? a.tablet : null },
|
|
85
|
+
ios: capped(i && { phone: i.phone, tablet: tablets ? i.tablet : null }, cap),
|
|
86
|
+
android: capped(a && { phone: a.phone, tablet: tablets ? a.tablet : null }, cap),
|
|
87
|
+
cap,
|
|
70
88
|
};
|
|
71
89
|
}
|
|
72
90
|
|
|
@@ -78,16 +96,20 @@ function list(s, platform) {
|
|
|
78
96
|
|
|
79
97
|
function describe(s) {
|
|
80
98
|
const say = o => (o.length === 2 ? 'portrait and landscape' : `${o[0]} only`);
|
|
99
|
+
const of = (platform, kind) => { const o = s[platform] && s[platform][kind]; return o && o.length ? o : null; };
|
|
81
100
|
const part = (kind, apple) => {
|
|
82
|
-
const i =
|
|
83
|
-
const a =
|
|
101
|
+
const i = of('ios', kind);
|
|
102
|
+
const a = of('android', kind);
|
|
84
103
|
if (i && a && say(i) !== say(a)) return `${say(i)} on ${apple}, ${say(a)} on Android`;
|
|
85
104
|
return say(i || a || ['portrait']);
|
|
86
105
|
};
|
|
87
|
-
const tablets = (
|
|
106
|
+
const tablets = of('ios', 'tablet') || of('android', 'tablet');
|
|
107
|
+
const phones = of('ios', 'phone') || of('android', 'phone') || !tablets;
|
|
108
|
+
const why = s.cap ? ', as .amk-screens says' : '';
|
|
109
|
+
if (!phones) return `tablets only (${part('tablet', 'iPad')})${why}`;
|
|
88
110
|
return tablets
|
|
89
|
-
? `phones (${part('phone', 'iPhone')}) and tablets (${part('tablet', 'iPad')})`
|
|
90
|
-
: `phones only (${part('phone', 'iPhone')}), no iPad app`;
|
|
111
|
+
? `phones (${part('phone', 'iPhone')}) and tablets (${part('tablet', 'iPad')})${why}`
|
|
112
|
+
: `phones only (${part('phone', 'iPhone')})${why || ', no iPad app'}`;
|
|
91
113
|
}
|
|
92
114
|
|
|
93
115
|
if (require.main === module) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/bin/sh
|
|
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. Apps that support tablets or
|
|
4
|
-
# landscape (scripts/amk/screens.js) are checked on each: an iPad simulator and a tablet emulator, and turned.
|
|
4
|
+
# landscape (scripts/amk/screens.js) are checked on each: an iPad simulator and a tablet emulator, and turned. A team
|
|
5
|
+
# that checks fewer (phones only) lists them in .amk-screens, and the others are never checked.
|
|
5
6
|
#
|
|
6
7
|
# Usage: sh scripts/amk/verify.sh [quick|ios|android|all|build|plan|approve] [--spec <ids>] [--flow <file>] [--label <name>]
|
|
7
8
|
# [--flavor <name>] [--scheme <name>] [--screens <list>] [--no-build] [--related] [--mock]
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
# --flavor <name> Android product flavor to check (default: the first one in build.gradle)
|
|
24
25
|
# --scheme <name> iOS scheme to check (default: the one named like the workspace)
|
|
25
26
|
# --screens <l> only these of the screens the app supports, comma-separated: phone, tablet, portrait,
|
|
26
|
-
# landscape, or one such as tablet-landscape
|
|
27
|
+
# landscape, or one such as tablet-landscape (portrait and landscape include the tablet's)
|
|
27
28
|
# --no-build check the last build instead of building again (after `build`), when it has the same API (--mock)
|
|
28
29
|
# --mock build with the app's mock API on: the variables in .amk-mock (a NAME=value line each) switch it on, the
|
|
29
30
|
# way the app reads its other settings. Its evidence goes in <label>-mock/, and its report says so
|
|
@@ -185,7 +186,14 @@ with_tags() {
|
|
|
185
186
|
}'
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
# the
|
|
189
|
+
# Xcode building or indexing the same project holds its build service: a build from here then can't start
|
|
190
|
+
xcode_busy() {
|
|
191
|
+
! grep -q 'unable to initiate PIF transfer session' "$1" 2> /dev/null ||
|
|
192
|
+
echo " Xcode is building or indexing this project too: let it finish or quit it (if it stays stuck: pkill -f SWBBuildService), then run this again (docs/amk/known-issues.md)"
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
# the screens to check on a platform: the ones the app supports (as far as .amk-screens lets), narrowed by --screens
|
|
196
|
+
capped() { [ ! -f .amk-screens ] || echo " (.amk-screens limits the screens to check)"; }
|
|
189
197
|
screens_for() {
|
|
190
198
|
for s in $(node scripts/amk/screens.js "$1"); do
|
|
191
199
|
[ -n "$only" ] || { echo "$s"; continue; }
|
|
@@ -630,7 +638,8 @@ ios() {
|
|
|
630
638
|
device="" tablet=""
|
|
631
639
|
if [ "$build_only" = 0 ]; then
|
|
632
640
|
screens=$(screens_for ios)
|
|
633
|
-
[ -n "$screens" ] || { echo "ios: none of the app's screens is $only"; return; }
|
|
641
|
+
[ -n "$screens" ] || { echo "ios: none of the app's screens is $only$(capped)"; return; }
|
|
642
|
+
echo "ios: checking" $screens
|
|
634
643
|
if echo "$screens" | grep -q '^phone-'; then
|
|
635
644
|
take_simulator iPhone "${AMK_IOS_DEVICE:-}" || { status=1; return; }
|
|
636
645
|
device=$taken
|
|
@@ -667,7 +676,7 @@ ios() {
|
|
|
667
676
|
claim_wait "build-ios-$project" "" "the iOS build of this project" || { status=1; return; }
|
|
668
677
|
if [ "$no_build" = 0 ]; then
|
|
669
678
|
if [ "$sims" = 1 ] && ! CONFIGURATION=Release sh scripts/amk/ios-build.sh > "$evidence/ios-build.log" 2>&1; then
|
|
670
|
-
echo "ios: release build FAILED, see ${evidence#"$root"/}/ios-build.log"; status=1; return
|
|
679
|
+
echo "ios: release build FAILED, see ${evidence#"$root"/}/ios-build.log"; xcode_busy "$evidence/ios-build.log"; status=1; return
|
|
671
680
|
fi
|
|
672
681
|
for d in $reals; do
|
|
673
682
|
if ! CONFIGURATION=Release AMK_IOS_TEAM=$team sh scripts/amk/ios-build.sh device "$d" > "$evidence/ios-device-build.log" 2>&1; then
|
|
@@ -999,7 +1008,8 @@ android() {
|
|
|
999
1008
|
# the devices first: the build only needs the CPU type, and emulators boot while Gradle builds.
|
|
1000
1009
|
# The flows clear the app's data, so a phone plugged in over USB is used only when AMK_ANDROID_DEVICE names it
|
|
1001
1010
|
screens=$(screens_for android)
|
|
1002
|
-
[ -n "$screens" ] || { echo "android: none of the app's screens is $only"; return; }
|
|
1011
|
+
[ -n "$screens" ] || { echo "android: none of the app's screens is $only$(capped)"; return; }
|
|
1012
|
+
echo "android: checking" $screens
|
|
1003
1013
|
avds=$("$sdk/emulator/emulator" -list-avds 2> /dev/null || true)
|
|
1004
1014
|
if echo "$screens" | grep -q '^phone-'; then
|
|
1005
1015
|
take_android phone "${AMK_ANDROID_DEVICE:-}" "${AMK_ANDROID_AVD:-}" || { status=1; return; }
|