agentic-mobile-kit 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/bin/cli.js +1 -1
- package/lib/init.js +70 -39
- package/package.json +4 -2
- package/stacks/react-native/expo/.agents/skills/LICENSE-expo +21 -0
- package/stacks/react-native/expo/.agents/skills/THIRD_PARTY.md +11 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/SKILL.md +151 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/agents/openai.yaml +4 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/config-plugin.md +90 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/create-expo-module.md +206 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/lifecycle.md +127 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/module-config.md +48 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/native-module.md +286 -0
- package/stacks/react-native/expo/.agents/skills/expo-module/references/native-view.md +171 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/SKILL.md +240 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/agents/openai.yaml +4 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/form-sheet.md +253 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/route-structure.md +229 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/search.md +248 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/tabs.md +433 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/toolbar-and-headers.md +284 -0
- package/stacks/react-native/expo/.agents/skills/expo-router/references/zoom-transitions.md +158 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/SKILL.md +150 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/agents/openai.yaml +4 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/expo-av-to-audio.md +132 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/expo-av-to-video.md +160 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/native-tabs.md +124 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/new-architecture.md +79 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/react-19.md +79 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/react-compiler.md +59 -0
- package/stacks/react-native/expo/.agents/skills/expo-upgrade/references/react-navigation-to-expo-router.md +61 -0
- package/stacks/react-native/expo/.rulesync/permissions.jsonc +40 -0
- package/stacks/react-native/expo/AGENTS.md +52 -0
- package/stacks/react-native/expo/docs/ai/expo.md +35 -0
- package/stacks/react-native/expo/docs/ai/known-issues.md +32 -0
- package/stacks/react-native/template/.agents/skills/m-release/SKILL.md +5 -5
- package/stacks/react-native/template/.github/workflows/e2e.yml +2 -0
- package/stacks/react-native/template/.github/workflows/ios.yml +2 -3
- package/stacks/react-native/template/AGENTS.md +1 -1
- package/stacks/react-native/template/codemagic.yaml +2 -1
- package/stacks/react-native/template/scripts/ai/pm-run.sh +12 -0
- package/stacks/react-native/template/scripts/ai/prebuild.sh +28 -0
- package/stacks/react-native/template/scripts/ai/release-build.sh +6 -2
- package/stacks/react-native/template/scripts/ai/release-check.js +69 -15
- package/stacks/react-native/template/scripts/ai/set-version.sh +19 -1
- package/stacks/react-native/template/scripts/ai/verify.sh +17 -4
- package/stacks/react-native/template/specs/_templates/flow.yaml +7 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# agentic-mobile-kit
|
|
2
2
|
|
|
3
|
-
One setup for AI-assisted development of
|
|
3
|
+
One setup for AI-assisted development of React Native apps, bare or Expo. Every AI tool on the team reads the same rules, project knowledge and workflows. Git hooks and CI check the work, whichever person or tool wrote it. A task started in one tool, or on one machine, carries on in another.
|
|
4
4
|
|
|
5
5
|
Tested with Claude Code, Codex and Antigravity. `--tools` also sets up Cursor, OpenCode and Kiro.
|
|
6
6
|
|
|
@@ -43,6 +43,10 @@ Invoke a skill with `/m-feature` in Claude Code and Antigravity, or `$m-feature`
|
|
|
43
43
|
|
|
44
44
|
Apps that already use Superpowers, BMAD, proAgents or similar keep them as they are. The kit adds its section next to theirs and links its skills into an existing `.claude/skills` folder. A task started with an `m-` skill follows the kit's steps, and everything else keeps working as before.
|
|
45
45
|
|
|
46
|
+
## Expo apps
|
|
47
|
+
|
|
48
|
+
`init` recognizes Expo apps that generate `ios/` and `android/` with `npx expo prebuild`. Agents get Expo's rules and skills, and never edit the generated folders. The kit's scripts generate them before each build, so device checks, release checks and signed builds work as they do in bare apps, with no Expo account. Teams that build with EAS run `eas build` and `eas submit` themselves. Expo apps that keep `ios/` and `android/` in git are set up like bare apps.
|
|
49
|
+
|
|
46
50
|
## Update or remove
|
|
47
51
|
|
|
48
52
|
```sh
|
package/bin/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ Usage:
|
|
|
19
19
|
npx agentic-mobile-kit doctor
|
|
20
20
|
|
|
21
21
|
Commands:
|
|
22
|
-
init Install the kit into a
|
|
22
|
+
init Install the kit into a React Native or Expo app (run in the app's root).
|
|
23
23
|
sync Update the kit's files to this version. Your own changes to them are merged in, not lost.
|
|
24
24
|
uninstall Remove the kit's files and sections. Files you changed are kept and listed.
|
|
25
25
|
doctor Check the project and this machine, with a fix for each problem.
|
package/lib/init.js
CHANGED
|
@@ -91,10 +91,33 @@ function checkProject(cwd) {
|
|
|
91
91
|
const pkg = readJson(pkgFile);
|
|
92
92
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
93
93
|
if (!deps['react-native']) throw new InitError('This is not a React Native project (no "react-native" dependency).');
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const stack = detectStack(cwd, deps);
|
|
95
|
+
if (stack === 'bare' && (!fs.existsSync(path.join(cwd, 'ios')) || !fs.existsSync(path.join(cwd, 'android')))) {
|
|
96
|
+
throw new InitError('No ios/ and android/ folders found, and this isn\'t an Expo app. The kit supports bare React Native and Expo apps.');
|
|
96
97
|
}
|
|
97
|
-
return { pkg, deps };
|
|
98
|
+
return { pkg, deps, stack };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Expo apps whose ios/ and android/ come from `expo prebuild` (Continuous Native Generation, not in git) get the
|
|
102
|
+
// Expo overlay. Expo apps that keep the native folders in git are set up like bare apps.
|
|
103
|
+
function detectStack(cwd, deps) {
|
|
104
|
+
return deps.expo && !git(cwd, 'ls-files', 'ios', 'android') ? 'expo' : 'bare';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// a stack's files, rel -> source: the template, and for Expo the overlay next to it, which replaces or adds files
|
|
108
|
+
const EXPO_LEAVES_OUT = ['docs/ai/react-native.md', '.agents/skills/upgrading-react-native/'];
|
|
109
|
+
function stackFiles(template, stack) {
|
|
110
|
+
const files = new Map(templateFiles(template).map(rel => [rel, path.join(template, rel)]));
|
|
111
|
+
if (stack !== 'expo') return files;
|
|
112
|
+
for (const rel of files.keys()) if (EXPO_LEAVES_OUT.some(f => (f.endsWith('/') ? rel.startsWith(f) : rel === f))) files.delete(rel);
|
|
113
|
+
const overlay = path.join(template, '..', 'expo');
|
|
114
|
+
if (fs.existsSync(overlay)) for (const rel of templateFiles(overlay)) files.set(rel, path.join(overlay, rel));
|
|
115
|
+
return files;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// app.json's expo section, for the values the kit fills in (app.config.* would need the Expo CLI to evaluate)
|
|
119
|
+
function expoConfig(cwd) {
|
|
120
|
+
try { return readJson(path.join(cwd, 'app.json')).expo || {}; } catch { return {}; }
|
|
98
121
|
}
|
|
99
122
|
|
|
100
123
|
// all files under dir, as relative paths with "/" on every OS (as git shows them), including dotfiles
|
|
@@ -124,15 +147,19 @@ function fillPlaceholders(text, values) {
|
|
|
124
147
|
function architecture(cwd, rnVersion) {
|
|
125
148
|
const [major, minor] = String(rnVersion).split('.').map(Number);
|
|
126
149
|
if (!(major === 0 && minor < 82)) return 'New Architecture';
|
|
127
|
-
|
|
150
|
+
// Expo apps without native folders set it in app.json
|
|
151
|
+
const flag = ((readIf(path.join(cwd, 'android', 'gradle.properties')) || '').match(/^\s*newArchEnabled\s*=\s*(true|false)/m) || [])[1]
|
|
152
|
+
|| (typeof expoConfig(cwd).newArchEnabled === 'boolean' ? String(expoConfig(cwd).newArchEnabled) : undefined);
|
|
128
153
|
return (flag ? flag === 'true' : minor >= 76) ? 'New Architecture' : 'Old Architecture: newArchEnabled=false';
|
|
129
154
|
}
|
|
130
155
|
|
|
131
|
-
function projectValues(cwd, pkg, deps, pm, ci) {
|
|
156
|
+
function projectValues(cwd, pkg, deps, pm, ci, stack) {
|
|
132
157
|
const rn = installedVersion(cwd, 'react-native', deps['react-native']);
|
|
133
158
|
return {
|
|
134
159
|
KIT_VERSION,
|
|
135
160
|
KIT_CI: ci.join(',') || 'none',
|
|
161
|
+
KIT_STACK: stack,
|
|
162
|
+
EXPO_SDK: deps.expo ? installedVersion(cwd, 'expo', deps.expo).split('.')[0] : '',
|
|
136
163
|
APP_NAME: pkg.name || path.basename(cwd),
|
|
137
164
|
RN_VERSION: rn,
|
|
138
165
|
RN_ARCH: architecture(cwd, rn),
|
|
@@ -141,13 +168,13 @@ function projectValues(cwd, pkg, deps, pm, ci) {
|
|
|
141
168
|
NODE_VERSION: (pkg.engines && pkg.engines.node) || `${process.versions.node.split('.')[0]}`,
|
|
142
169
|
PM: pm.name,
|
|
143
170
|
PM_RUN: pm.run,
|
|
144
|
-
IOS_BUNDLE_ID: iosBundleId(cwd),
|
|
171
|
+
IOS_BUNDLE_ID: stack === 'expo' ? (expoConfig(cwd).ios || {}).bundleIdentifier || 'com.example.app' : iosBundleId(cwd),
|
|
145
172
|
};
|
|
146
173
|
}
|
|
147
174
|
|
|
148
175
|
// a template file's text as the kit writes it into this project
|
|
149
|
-
function kitText(
|
|
150
|
-
const text = fs.readFileSync(
|
|
176
|
+
function kitText(src, rel, values, targets) {
|
|
177
|
+
const text = fs.readFileSync(src, 'utf8');
|
|
151
178
|
if (FILLED.includes(rel)) return fillPlaceholders(text, values);
|
|
152
179
|
if (rel === 'rulesync.jsonc') return setTargets(text, targets);
|
|
153
180
|
return text;
|
|
@@ -181,10 +208,10 @@ function installedTools(cwd) {
|
|
|
181
208
|
return tools.length ? tools : TESTED;
|
|
182
209
|
}
|
|
183
210
|
|
|
184
|
-
// what the kit marker in AGENTS.md records: the kit version since 0.4.0, the CI choice since 0.5.0
|
|
211
|
+
// what the kit marker in AGENTS.md records: the kit version since 0.4.0, the CI choice since 0.5.0, the stack since 0.6.0
|
|
185
212
|
function recorded(agents) {
|
|
186
|
-
const m = (agents || '').match(/KIT:START agentic-mobile-kit (\d[^\s>]*)(?: ci=([\w,]+))?/);
|
|
187
|
-
return { version: m ? m[1] : null, ci: m && m[2] ? m[2].split(',').filter(g => CI[g]) : null };
|
|
213
|
+
const m = (agents || '').match(/KIT:START agentic-mobile-kit (\d[^\s>]*)(?: ci=([\w,]+))?(?: stack=(\w+))?/);
|
|
214
|
+
return { version: m ? m[1] : null, ci: m && m[2] ? m[2].split(',').filter(g => CI[g]) : null, stack: m && m[3] ? m[3] : null };
|
|
188
215
|
}
|
|
189
216
|
|
|
190
217
|
// the CI parts a project has: as recorded, or (installs before 0.5.0 got them by default) recognized by the kit's own files
|
|
@@ -364,10 +391,10 @@ function dropHooksCmd(scripts) {
|
|
|
364
391
|
}
|
|
365
392
|
|
|
366
393
|
const SKILL_LINKS = [['.claude/skills', 'claude'], ['.kiro/skills', 'kiro']];
|
|
367
|
-
const kitSkills =
|
|
394
|
+
const kitSkills = files => [...files.keys()].filter(rel => /^\.agents\/skills\/[^/]+\/SKILL\.md$/.test(rel)).map(rel => rel.split('/')[2]);
|
|
368
395
|
|
|
369
396
|
// steps 2–6, shared by init and sync
|
|
370
|
-
function finish(cwd, { pkg, deps, tools,
|
|
397
|
+
function finish(cwd, { pkg, deps, tools, files, stack, skipGenerate }) {
|
|
371
398
|
const done = { created: [], merged: [], skipped: [], warnings: [] };
|
|
372
399
|
// Windows creates symbolic links only with Developer Mode on (or as admin)
|
|
373
400
|
const link = (target, p, label) => {
|
|
@@ -389,7 +416,7 @@ function finish(cwd, { pkg, deps, tools, template, skipGenerate }) {
|
|
|
389
416
|
}
|
|
390
417
|
if (isLink(dest) || !fs.statSync(dest).isDirectory()) { done.skipped.push(linkPath); continue; }
|
|
391
418
|
// the folder already holds another framework's skills: link each kit skill into it
|
|
392
|
-
for (const name of kitSkills(
|
|
419
|
+
for (const name of kitSkills(files)) {
|
|
393
420
|
const p = path.join(dest, name);
|
|
394
421
|
const target = `../../.agents/skills/${name}`;
|
|
395
422
|
if (isLink(p) && linkTarget(p) === target) continue;
|
|
@@ -402,9 +429,11 @@ function finish(cwd, { pkg, deps, tools, template, skipGenerate }) {
|
|
|
402
429
|
// 3. .gitignore: keep secrets out of git
|
|
403
430
|
const gi = path.join(cwd, '.gitignore');
|
|
404
431
|
const giText = readIf(gi) || '';
|
|
405
|
-
|
|
432
|
+
// Expo: ios/ and android/ are generated by prebuild, so they stay out of git too
|
|
433
|
+
const ignored = ['.env', '.env.*', '!.env.example', '.ai/', ...(stack === 'expo' ? ['/ios', '/android'] : [])];
|
|
434
|
+
const missing = ignored.filter(l => !giText.split('\n').includes(l));
|
|
406
435
|
if (missing.length) {
|
|
407
|
-
fs.writeFileSync(gi, `${giText.replace(/\n*$/, giText ? '\n' : '')}\n# agentic-mobile-kit: secrets stay out of git; .ai/ holds local evidence (screenshots, logs)\n${missing.join('\n')}\n`);
|
|
436
|
+
fs.writeFileSync(gi, `${giText.replace(/\n*$/, giText ? '\n' : '')}\n# agentic-mobile-kit: secrets stay out of git; .ai/ holds local evidence (screenshots, logs)${stack === 'expo' ? '; ios/ and android/ are generated' : ''}\n${missing.join('\n')}\n`);
|
|
408
437
|
done.merged.push('.gitignore');
|
|
409
438
|
}
|
|
410
439
|
|
|
@@ -466,21 +495,21 @@ function init(cwd, opts = {}) {
|
|
|
466
495
|
let prefix = '';
|
|
467
496
|
try { prefix = git(cwd, 'rev-parse', '--show-prefix').replace(/\/$/, ''); } catch {}
|
|
468
497
|
if (prefix) throw new InitError(`This app is in a subfolder of its git repository (${prefix}), as in a monorepo. The kit doesn't support that yet: git runs hooks from the repository root, and GitHub reads workflows only there.`);
|
|
469
|
-
const { pkg, deps } = checkProject(cwd);
|
|
498
|
+
const { pkg, deps, stack } = checkProject(cwd);
|
|
470
499
|
const pm = detectPm(cwd, opts.pm);
|
|
471
500
|
const tools = opts.tools || TESTED;
|
|
472
501
|
for (const t of tools) if (!TOOLS[t]) throw new InitError(`Unknown tool "${t}". Choose from: ${Object.keys(TOOLS).join(', ')}.`);
|
|
473
|
-
const
|
|
502
|
+
const files = stackFiles(opts.template || TEMPLATE, stack);
|
|
474
503
|
const ci = chooseCi(cwd, readIf(path.join(cwd, 'AGENTS.md')), opts.ci);
|
|
475
|
-
const values = projectValues(cwd, pkg, deps, pm, ci);
|
|
504
|
+
const values = projectValues(cwd, pkg, deps, pm, ci, stack);
|
|
476
505
|
const targets = tools.flatMap(t => TOOLS[t]);
|
|
477
506
|
const report = { created: [], merged: [], skipped: [] };
|
|
478
507
|
|
|
479
508
|
// 1. template files (never overwrite)
|
|
480
|
-
for (const rel of
|
|
509
|
+
for (const [rel, src] of files) {
|
|
481
510
|
if (ciGroup(rel) && !ci.includes(ciGroup(rel))) continue;
|
|
482
511
|
const dest = path.join(cwd, rel);
|
|
483
|
-
const text = kitText(
|
|
512
|
+
const text = kitText(src, rel, values, targets);
|
|
484
513
|
const current = readIf(dest);
|
|
485
514
|
if (current !== null && (rel === 'AGENTS.md' || rel === 'CLAUDE.md')) {
|
|
486
515
|
const next = rel === 'AGENTS.md' ? mergeAgents(current, text) : mergeClaude(current);
|
|
@@ -492,32 +521,33 @@ function init(cwd, opts = {}) {
|
|
|
492
521
|
report.created.push(rel);
|
|
493
522
|
}
|
|
494
523
|
|
|
495
|
-
const { done, generated, generateError } = finish(cwd, { pkg, deps, tools,
|
|
524
|
+
const { done, generated, generateError } = finish(cwd, { pkg, deps, tools, files, stack, skipGenerate: opts.skipGenerate });
|
|
496
525
|
for (const k of Object.keys(report)) report[k].push(...done[k]);
|
|
497
526
|
return { report, warnings: done.warnings, values, tools, ci, generated, generateError };
|
|
498
527
|
}
|
|
499
528
|
|
|
500
529
|
function sync(cwd, opts = {}) {
|
|
501
|
-
const { pkg, deps } = checkProject(cwd);
|
|
530
|
+
const { pkg, deps, stack: detected } = checkProject(cwd);
|
|
502
531
|
const agents = readIf(path.join(cwd, 'AGENTS.md'));
|
|
503
532
|
if (!agents || !MARKERS.test(agents)) throw new InitError('The kit isn\'t installed here (AGENTS.md has no KIT section). Run init instead.');
|
|
504
533
|
const { from, dir: oldDir, exact } = oldTemplate(agents, opts);
|
|
505
|
-
|
|
534
|
+
// installs before 0.6.0 don't record it, and were all bare
|
|
535
|
+
const stack = recorded(agents).stack || detected;
|
|
506
536
|
const ci = chooseCi(cwd, agents, opts.ci);
|
|
507
537
|
// a CI part chosen just now was never installed, so its files are new rather than deleted by the team
|
|
508
538
|
const hadCi = installedCi(cwd, agents);
|
|
509
539
|
const wasInstalled = rel => !ciGroup(rel) || hadCi.includes(ciGroup(rel));
|
|
510
|
-
const values = projectValues(cwd, pkg, deps, detectPm(cwd, opts.pm), ci);
|
|
540
|
+
const values = projectValues(cwd, pkg, deps, detectPm(cwd, opts.pm), ci, stack);
|
|
511
541
|
const tools = installedTools(cwd);
|
|
512
542
|
const targets = tools.flatMap(t => TOOLS[t]);
|
|
513
543
|
const report = { updated: [], added: [], merged: [], conflicts: [], removed: [], kept: [] };
|
|
514
|
-
const newFiles =
|
|
515
|
-
const oldFiles =
|
|
544
|
+
const newFiles = stackFiles(opts.template || TEMPLATE, stack);
|
|
545
|
+
const oldFiles = stackFiles(oldDir, stack);
|
|
516
546
|
|
|
517
|
-
for (const rel of newFiles) {
|
|
547
|
+
for (const [rel, src] of newFiles) {
|
|
518
548
|
if (ciGroup(rel) && !ci.includes(ciGroup(rel))) continue;
|
|
519
|
-
const kitNew = kitText(
|
|
520
|
-
const kitOld = oldFiles.has(rel) && wasInstalled(rel) ? kitText(
|
|
549
|
+
const kitNew = kitText(src, rel, values, targets);
|
|
550
|
+
const kitOld = oldFiles.has(rel) && wasInstalled(rel) ? kitText(oldFiles.get(rel), rel, values, targets) : null;
|
|
521
551
|
const current = projectText(cwd, rel, targets);
|
|
522
552
|
if (rel === 'AGENTS.md' || rel === 'CLAUDE.md') {
|
|
523
553
|
const next = current === null ? kitNew : rel === 'AGENTS.md' ? mergeAgents(current, kitNew) : mergeClaude(current);
|
|
@@ -539,14 +569,14 @@ function sync(cwd, opts = {}) {
|
|
|
539
569
|
(conflicts ? report.conflicts : report.merged).push(rel);
|
|
540
570
|
}
|
|
541
571
|
// files the kit no longer ships
|
|
542
|
-
for (const rel of oldFiles) {
|
|
543
|
-
if (newFiles.
|
|
572
|
+
for (const [rel, src] of oldFiles) {
|
|
573
|
+
if (newFiles.has(rel) || !wasInstalled(rel)) continue;
|
|
544
574
|
const current = projectText(cwd, rel, targets);
|
|
545
575
|
if (current === null) continue;
|
|
546
|
-
if (current === kitText(
|
|
576
|
+
if (current === kitText(src, rel, values, targets)) { fs.unlinkSync(path.join(cwd, rel)); report.removed.push(rel); } else report.kept.push(`${rel} (the kit dropped it; you changed it)`);
|
|
547
577
|
}
|
|
548
578
|
|
|
549
|
-
const { done, generated, generateError } = finish(cwd, { pkg, deps, tools,
|
|
579
|
+
const { done, generated, generateError } = finish(cwd, { pkg, deps, tools, files: newFiles, stack, skipGenerate: opts.skipGenerate });
|
|
550
580
|
report.added.push(...done.created);
|
|
551
581
|
report.updated.push(...done.merged);
|
|
552
582
|
return { report, warnings: done.warnings, from, to: KIT_VERSION, tools, generated, generateError };
|
|
@@ -566,18 +596,19 @@ function generatedFiles(cwd) {
|
|
|
566
596
|
}
|
|
567
597
|
|
|
568
598
|
function uninstall(cwd, opts = {}) {
|
|
569
|
-
const { pkg, deps } = checkProject(cwd);
|
|
599
|
+
const { pkg, deps, stack: detected } = checkProject(cwd);
|
|
570
600
|
const agents = readIf(path.join(cwd, 'AGENTS.md'));
|
|
571
601
|
if (!agents || !MARKERS.test(agents)) throw new InitError('The kit isn\'t installed here (AGENTS.md has no KIT section).');
|
|
572
602
|
const { from, dir: template } = oldTemplate(agents, opts);
|
|
573
|
-
const
|
|
603
|
+
const stack = recorded(agents).stack || detected;
|
|
604
|
+
const values = projectValues(cwd, pkg, deps, detectPm(cwd, opts.pm), installedCi(cwd, agents), stack);
|
|
574
605
|
const targets = installedTools(cwd).flatMap(t => TOOLS[t]);
|
|
575
606
|
const report = { removed: [], kept: [], left: [] };
|
|
576
607
|
const remove = rel => { fs.unlinkSync(path.join(cwd, rel)); report.removed.push(rel); };
|
|
577
608
|
// listed before their sources are removed
|
|
578
609
|
const generated = opts.skipGenerate ? [] : generatedFiles(cwd);
|
|
579
610
|
|
|
580
|
-
for (const rel of
|
|
611
|
+
for (const [rel, src] of stackFiles(template, stack)) {
|
|
581
612
|
const current = projectText(cwd, rel, targets);
|
|
582
613
|
if (current === null) continue;
|
|
583
614
|
if (rel === 'AGENTS.md' || rel === 'CLAUDE.md') {
|
|
@@ -586,7 +617,7 @@ function uninstall(cwd, opts = {}) {
|
|
|
586
617
|
else if (rest !== current) { fs.writeFileSync(path.join(cwd, rel), rest.replace(/\n+$/, '\n')); report.removed.push(`${rel} (the kit's part)`); }
|
|
587
618
|
continue;
|
|
588
619
|
}
|
|
589
|
-
if (current === kitText(
|
|
620
|
+
if (current === kitText(src, rel, values, targets)) remove(rel); else report.kept.push(rel);
|
|
590
621
|
}
|
|
591
622
|
for (const [rel, text] of generated) {
|
|
592
623
|
const current = readIf(path.join(cwd, rel));
|
|
@@ -624,7 +655,7 @@ function uninstall(cwd, opts = {}) {
|
|
|
624
655
|
}
|
|
625
656
|
|
|
626
657
|
function printSummary({ report, warnings = [], values, tools, ci, generated, generateError }, log = console.log) {
|
|
627
|
-
log(`agentic-mobile-kit installed for ${values.APP_NAME} (React Native ${values.RN_VERSION}, ${values.PM}).`);
|
|
658
|
+
log(`agentic-mobile-kit installed for ${values.APP_NAME} (${values.KIT_STACK === 'expo' ? `Expo SDK ${values.EXPO_SDK}, ` : ''}React Native ${values.RN_VERSION}, ${values.PM}).`);
|
|
628
659
|
log(`Tools: ${tools.join(', ')}${tools.some(t => !TESTED.includes(t)) ? ' (cursor, opencode and kiro are not tested yet)' : ''}`);
|
|
629
660
|
log(`CI: ${ci.length ? ci.join(', ') : 'none (add it any time with --ci github,codemagic)'}`);
|
|
630
661
|
log(` created: ${report.created.length} files`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-mobile-kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "One setup for AI-assisted development of
|
|
3
|
+
"version": "0.6.0",
|
|
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",
|
|
7
7
|
"repository": {
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"keywords": [
|
|
27
27
|
"react-native",
|
|
28
28
|
"bare-react-native",
|
|
29
|
+
"expo",
|
|
30
|
+
"expo-router",
|
|
29
31
|
"mobile",
|
|
30
32
|
"ios",
|
|
31
33
|
"android",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present 650 Industries, Inc. (aka Expo)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Third-party skills
|
|
2
|
+
|
|
3
|
+
| Skill | Source | Commit | License | Changes |
|
|
4
|
+
|---|---|---|---|---|
|
|
5
|
+
| expo-router | https://github.com/expo/skills | d4f484024fec15196bfd3c272e953e3f983972cf | MIT (`LICENSE-expo`) | Image files left out |
|
|
6
|
+
| expo-upgrade | same | same | MIT | Image files left out |
|
|
7
|
+
| expo-module | same | same | MIT | Image files left out |
|
|
8
|
+
| react-native-best-practices | https://github.com/callstackincubator/agent-skills | 61e6e7dfdf3a8ee862254c200d751fcb1fb863dc | MIT (`LICENSE-callstack`) | Image files left out |
|
|
9
|
+
| react-navigation | same | same | MIT | Image files left out |
|
|
10
|
+
|
|
11
|
+
Updated with `scripts/vendor-skills.sh` in the agentic-mobile-kit repo.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: expo-module
|
|
3
|
+
description: Guide for creating and writing Expo native modules and views using the Expo Modules API (Swift, Kotlin, TypeScript). Covers module definition DSL, native views, shared objects, config plugins, lifecycle hooks, autolinking, and type system. Use when building or modifying native modules for Expo. Not for migrating an existing Swift module from the definition DSL to the Expo Modules API 2.0 macros; use expo-migrate-module (from the expo-experiments plugin) for that.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
license: MIT
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Writing Expo Modules
|
|
9
|
+
|
|
10
|
+
Complete reference for building native modules and views using the Expo Modules API. Covers Swift (iOS), Kotlin (Android), and TypeScript.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Creating a new Expo native module or native view
|
|
15
|
+
- Adding native functionality (camera, sensors, system APIs) to an Expo app
|
|
16
|
+
- Wrapping platform SDKs for React Native consumption
|
|
17
|
+
- Building config plugins that modify native project files
|
|
18
|
+
- Adding Android, Apple, or web support to an existing Expo module
|
|
19
|
+
- Editing `expo-module.config.json`, config plugins, or lifecycle hooks
|
|
20
|
+
|
|
21
|
+
To migrate an existing Swift module from the definition DSL to the Expo Modules API 2.0 macros (`@ExpoModule`, `@JS`, `@Event`), use the `expo-migrate-module` skill (from the `expo-experiments` plugin) instead.
|
|
22
|
+
|
|
23
|
+
## References
|
|
24
|
+
|
|
25
|
+
Consult these resources as needed:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
references/
|
|
29
|
+
create-expo-module.md Scaffolding and add-platform-support workflow, defaults, and quirks
|
|
30
|
+
native-module.md Module definition DSL: Name, Function, AsyncFunction, Property, Constant, Events, type system, shared objects
|
|
31
|
+
native-view.md Native view components: View, Prop, EventDispatcher, view lifecycle, ref-based functions
|
|
32
|
+
lifecycle.md Lifecycle hooks: module, iOS app/AppDelegate, Android activity/application listeners
|
|
33
|
+
config-plugin.md Config plugins: modifying Info.plist, AndroidManifest.xml, reading values in native code
|
|
34
|
+
module-config.md expo-module.config.json fields, file placement, and autolinking behavior
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
Prefer `create-expo-module` over manually creating native module files and directories. In practice, the best path is usually to create the scaffold first and then build on top of it. The scaffold sets up the expected layout, `expo-module.config.json`, podspec or Gradle files, TypeScript bindings, and the standalone example app flow.
|
|
40
|
+
|
|
41
|
+
If an existing Expo module only needs another platform, use `create-expo-module add-platform-support` instead of manually copying native directories.
|
|
42
|
+
|
|
43
|
+
See [references/create-expo-module.md](references/create-expo-module.md) before scaffolding or extending a module. It covers:
|
|
44
|
+
|
|
45
|
+
- local vs standalone modules
|
|
46
|
+
- `--platform`, `--features`, `--barrel`, `--package-manager`, and non-interactive mode
|
|
47
|
+
- `expo.autolinking.nativeModulesDir`
|
|
48
|
+
- `add-platform-support` behavior and quirks
|
|
49
|
+
|
|
50
|
+
## Recommended Workflow
|
|
51
|
+
|
|
52
|
+
1. Choose the scaffold type first:
|
|
53
|
+
- **Local module** for one app
|
|
54
|
+
- **Standalone module** for reuse, monorepos, or publishing
|
|
55
|
+
2. Determine native `expo-module` features that you will need.
|
|
56
|
+
- Based on the user's instructions determine which feature scaffolding will be useful.
|
|
57
|
+
- Available features: `Constant`, `Function`, `AsyncFunction`, `Event`, `View`, `ViewEvent`, `SharedObject`
|
|
58
|
+
3. Scaffold deliberately:
|
|
59
|
+
- pass an explicit slug or path
|
|
60
|
+
- choose `--platform` intentionally instead of relying on defaults
|
|
61
|
+
- use `--features` to choose code samples which you will modify in the next step to match the real implementation.
|
|
62
|
+
4. Replace generated example code with the real implementation.
|
|
63
|
+
5. If you add a new platform later, prefer `add-platform-support` over manual file copying.
|
|
64
|
+
|
|
65
|
+
## Practical Scaffolding Rules
|
|
66
|
+
|
|
67
|
+
- Feature examples are **opt-in**. A newly scaffolded module may be minimal if no features were selected.
|
|
68
|
+
- `ViewEvent` implies `View`.
|
|
69
|
+
- Local modules do **not** generate an `index.ts` barrel by default. Use `--barrel` only if you want one.
|
|
70
|
+
- In non-interactive local scaffolding, pass the positional slug or path explicitly. `--name` changes the native class name, not the folder name.
|
|
71
|
+
- Local modules live in `expo.autolinking.nativeModulesDir` when configured, otherwise in `modules/`.
|
|
72
|
+
- Standalone modules have their own package metadata, scripts, and usually an example app. Local modules use the host app's tooling instead.
|
|
73
|
+
|
|
74
|
+
## Core File Shapes
|
|
75
|
+
|
|
76
|
+
The Swift and Kotlin DSL share the same structure. Swift is usually the clearest primary example; consult the references for feature-specific details.
|
|
77
|
+
|
|
78
|
+
## Module Structure Reference
|
|
79
|
+
|
|
80
|
+
The Swift and Kotlin DSL share the same structure. Both platforms are shown here for reference — in other reference files, Swift is shown as the primary language unless the Kotlin pattern meaningfully differs.
|
|
81
|
+
|
|
82
|
+
**Swift (iOS):**
|
|
83
|
+
|
|
84
|
+
```swift
|
|
85
|
+
import ExpoModulesCore
|
|
86
|
+
|
|
87
|
+
public class MyModule: Module {
|
|
88
|
+
public func definition() -> ModuleDefinition {
|
|
89
|
+
Name("MyModule")
|
|
90
|
+
|
|
91
|
+
Function("hello") { (name: String) -> String in
|
|
92
|
+
return "Hello \(name)!"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Kotlin (Android):**
|
|
99
|
+
|
|
100
|
+
```kotlin
|
|
101
|
+
package expo.modules.mymodule
|
|
102
|
+
|
|
103
|
+
import expo.modules.kotlin.modules.Module
|
|
104
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
105
|
+
|
|
106
|
+
class MyModule : Module() {
|
|
107
|
+
override fun definition() = ModuleDefinition {
|
|
108
|
+
Name("MyModule")
|
|
109
|
+
|
|
110
|
+
Function("hello") { name: String ->
|
|
111
|
+
"Hello $name!"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**TypeScript:**
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { requireNativeModule } from "expo";
|
|
121
|
+
|
|
122
|
+
const MyModule = requireNativeModule("MyModule");
|
|
123
|
+
|
|
124
|
+
export function hello(name: string): string {
|
|
125
|
+
return MyModule.hello(name);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### expo-module.config.json
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"platforms": ["android", "apple"],
|
|
134
|
+
"apple": {
|
|
135
|
+
"modules": ["MyModule"]
|
|
136
|
+
},
|
|
137
|
+
"android": {
|
|
138
|
+
"modules": ["expo.modules.mymodule.MyModule"]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Note: iOS uses just the class name; Android uses the fully-qualified class name (package + class). See `references/module-config.md` for all fields.
|
|
144
|
+
|
|
145
|
+
## Submitting Feedback
|
|
146
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
147
|
+
```bash
|
|
148
|
+
npx --yes submit-expo-feedback@latest --category skills --subject "expo-module" "<actionable feedback>"
|
|
149
|
+
```
|
|
150
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
151
|
+
If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Expo Module"
|
|
3
|
+
short_description: "Build Expo native modules and native views with Swift, Kotlin, TypeScript, autolinking, and config plugins"
|
|
4
|
+
default_prompt: "Use $expo-module to scaffold, implement, clean up, or review Expo native modules, native views, shared objects, lifecycle hooks, autolinking configuration, and config plugins."
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Config Plugins Reference
|
|
2
|
+
|
|
3
|
+
Config plugins customize native Android and iOS projects generated with `npx expo prebuild`. They are synchronous functions that accept an `ExpoConfig` and return a modified version.
|
|
4
|
+
|
|
5
|
+
## Plugin Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
my-module/
|
|
9
|
+
plugin/
|
|
10
|
+
tsconfig.json
|
|
11
|
+
src/
|
|
12
|
+
index.ts
|
|
13
|
+
app.plugin.js # Entry: module.exports = require('./plugin/build');
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Writing a Plugin
|
|
17
|
+
|
|
18
|
+
Plugin functions follow the `with` prefix naming convention.
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import {
|
|
22
|
+
ConfigPlugin,
|
|
23
|
+
withInfoPlist,
|
|
24
|
+
withAndroidManifest,
|
|
25
|
+
AndroidConfig,
|
|
26
|
+
} from "expo/config-plugins";
|
|
27
|
+
|
|
28
|
+
const withMyConfig: ConfigPlugin<{ apiKey: string }> = (config, { apiKey }) => {
|
|
29
|
+
// iOS: modify Info.plist
|
|
30
|
+
config = withInfoPlist(config, (config) => {
|
|
31
|
+
config.modResults["MY_API_KEY"] = apiKey;
|
|
32
|
+
return config;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Android: modify AndroidManifest.xml
|
|
36
|
+
config = withAndroidManifest(config, (config) => {
|
|
37
|
+
const mainApp =
|
|
38
|
+
AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
|
|
39
|
+
AndroidConfig.Manifest.addMetaDataItemToMainApplication(
|
|
40
|
+
mainApp,
|
|
41
|
+
"MY_API_KEY",
|
|
42
|
+
apiKey
|
|
43
|
+
);
|
|
44
|
+
return config;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return config;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default withMyConfig;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Using in app.json
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"expo": {
|
|
58
|
+
"plugins": [["my-module", { "apiKey": "secret_key" }]]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Reading Config Values in Native Code
|
|
64
|
+
|
|
65
|
+
**Swift:**
|
|
66
|
+
|
|
67
|
+
```swift
|
|
68
|
+
Function("getApiKey") {
|
|
69
|
+
return Bundle.main.object(forInfoDictionaryKey: "MY_API_KEY") as? String
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Kotlin:**
|
|
74
|
+
|
|
75
|
+
```kotlin
|
|
76
|
+
Function("getApiKey") {
|
|
77
|
+
val appInfo = appContext?.reactContext?.packageManager?.getApplicationInfo(
|
|
78
|
+
appContext?.reactContext?.packageName.toString(),
|
|
79
|
+
PackageManager.GET_META_DATA
|
|
80
|
+
)
|
|
81
|
+
return@Function appInfo?.metaData?.getString("MY_API_KEY")
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Key Rules
|
|
86
|
+
|
|
87
|
+
- Plugins must be synchronous; return values must be serializable (except `mods`)
|
|
88
|
+
- `Mods` are async functions invoked during the prebuild "syncing" phase
|
|
89
|
+
- Use `npm run build plugin` to compile TypeScript plugins
|
|
90
|
+
- Test with `npx expo prebuild --clean`
|