agentic-mobile-kit 0.7.13 → 0.7.14
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/doctor.js
CHANGED
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const os = require('os');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { spawnSync } = require('child_process');
|
|
7
|
-
const { tool, hookManager, hooksWired, kitRun, checkProject, emptyFolder } = require('./init');
|
|
7
|
+
const { tool, hookManager, hooksWired, kitRun, ignoredByGit, checkProject, emptyFolder } = require('./init');
|
|
8
8
|
const screens = require('../stacks/react-native/template/scripts/amk/screens.js');
|
|
9
9
|
|
|
10
10
|
const RULESYNC = 'rulesync@27.0.0';
|
|
@@ -55,7 +55,8 @@ function projectChecks(cwd, opts) {
|
|
|
55
55
|
const hooksPath = run('git', ['config', 'core.hooksPath'], { cwd });
|
|
56
56
|
out.push(hooksPath === '.githooks'
|
|
57
57
|
? ok('Git hooks active')
|
|
58
|
-
|
|
58
|
+
// with .githooks kept out of git, install doesn't turn them on: sync does, as it puts the folder back
|
|
59
|
+
: fail('Git hooks not active on this clone', ignoredByGit(cwd, '.githooks/pre-commit') ? 'run: npx agentic-mobile-kit sync' : 'run: git config core.hooksPath .githooks (your package manager\'s install does this too)'));
|
|
59
60
|
} else if (manager.manual) {
|
|
60
61
|
out.push(warn(`Git hooks run from ${manager.name}, without the kit's checks`, `add "${kitRun('pre-commit')}" and "${kitRun('pre-push')}" to those hooks`));
|
|
61
62
|
} else if (!hooksWired(cwd, manager)) {
|
package/lib/init.js
CHANGED
|
@@ -653,13 +653,19 @@ function finish(cwd, { pkg, deps, tools, files, stack, skipGenerate }) {
|
|
|
653
653
|
// only TypeScript projects get typecheck: tsc fails ("no inputs") in JavaScript apps that merely have typescript installed
|
|
654
654
|
if (!scripts.typecheck && deps.typescript && usesTs(cwd)) { scripts.typecheck = 'tsc --noEmit'; pkgChanged = true; }
|
|
655
655
|
const manager = hookManager(cwd, pkg);
|
|
656
|
+
// a team may keep .githooks out of git: a fresh clone has none until it runs sync, which also turns the hooks on
|
|
657
|
+
const keptOut = ignoredByGit(cwd, '.githooks/pre-commit');
|
|
656
658
|
if (manager) {
|
|
657
659
|
// the project's hook manager runs the kit's hooks; drop the postinstall earlier kit versions added, which fought it
|
|
658
660
|
if (dropHooksCmd(scripts)) pkgChanged = true;
|
|
659
661
|
if (wireHooks(cwd, manager, done)) pkgChanged = true;
|
|
660
|
-
if (!manager.manual &&
|
|
662
|
+
if (!manager.manual && keptOut) {
|
|
661
663
|
done.warnings.push(`.githooks is kept out of git here, so a fresh clone has none until it runs npx agentic-mobile-kit sync. Until then, ${manager.name} skips the kit's checks and says so`);
|
|
662
664
|
}
|
|
665
|
+
} else if (keptOut) {
|
|
666
|
+
// pointing git at a folder a fresh clone doesn't have would switch off every hook there, other tools' too
|
|
667
|
+
if (dropHooksCmd(scripts)) pkgChanged = true;
|
|
668
|
+
done.warnings.push('.githooks is kept out of git here, so a fresh clone has none until it runs npx agentic-mobile-kit sync, which turns the kit\'s hooks on. Until then, git runs only the hooks in .git/hooks there');
|
|
663
669
|
} else if (!(scripts.postinstall || '').includes('core.hooksPath')) {
|
|
664
670
|
// parentheses keep the existing script's failure behavior: `a && b || true` would hide a failing `a`
|
|
665
671
|
scripts.postinstall = scripts.postinstall ? `${scripts.postinstall} && (${HOOKS_CMD})` : HOOKS_CMD;
|
|
@@ -960,5 +966,5 @@ function printUninstall({ report }, log = console.log) {
|
|
|
960
966
|
|
|
961
967
|
module.exports = {
|
|
962
968
|
init, sync, uninstall, printSummary, printSync, printUninstall, InitError, TOOLS, TESTED, CI, KIT_VERSION, tool, cleanEnv,
|
|
963
|
-
hookManager, hooksWired, kitRun, checkProject, recorded, installedCi, emptyFolder, createApp,
|
|
969
|
+
hookManager, hooksWired, kitRun, ignoredByGit, checkProject, recorded, installedCi, emptyFolder, createApp,
|
|
964
970
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-mobile-kit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
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",
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"hooks": {
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// "./" lets rulesync anchor each command to the project folder for a tool that keeps the agent's cd between
|
|
5
|
+
// commands (Claude Code: "$CLAUDE_PROJECT_DIR"/scripts/...): a relative one isn't found after a cd into a
|
|
6
|
+
// subfolder, which turns the guard off. No matcher: runs for every tool call; guard.js decides from the payload
|
|
7
|
+
"preToolUse": [{ "command": "node ./scripts/amk/guard.js" }],
|
|
8
|
+
"stop": [{ "command": "node ./scripts/amk/handoff-check.js" }]
|
|
7
9
|
}
|
|
8
10
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// Agent guard hook (preToolUse). Blocks destructive shell commands and access to secret files.
|
|
3
3
|
// Each AI tool sends a differently shaped JSON payload, so look for command and path fields anywhere in it.
|
|
4
4
|
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
// the project this script is in (scripts/amk/): the agent may have moved into a subfolder
|
|
7
|
+
const root = path.join(__dirname, '..', '..');
|
|
5
8
|
|
|
6
9
|
let payload;
|
|
7
10
|
const raw = fs.readFileSync(0, 'utf8');
|
|
@@ -28,7 +31,7 @@ const destructive = /\brm(?=[^;&|\n]*\s(-[a-zA-Z]*[rR][a-zA-Z]*|--recursive)\b)(
|
|
|
28
31
|
const secretFile = /(^|[\s/'"=])\.env(?![\w.-]*\.(?:example|sample|template)(?=$|[\s'";|&)]))(\.[\w.-]+)?(?=$|[\s'";|&)])|\.(keystore|jks|p8|p12|mobileprovision)\b/;
|
|
29
32
|
// the project's own secret files: .amk-secrets lists them, one path from the project root per line (a folder ends in /)
|
|
30
33
|
let listed = [];
|
|
31
|
-
try { listed = fs.readFileSync('.amk-secrets', 'utf8').split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#')); } catch {}
|
|
34
|
+
try { listed = fs.readFileSync(path.join(root, '.amk-secrets'), 'utf8').split('\n').map(l => l.trim()).filter(l => l && !l.startsWith('#')); } catch {}
|
|
32
35
|
const secret = s => secretFile.test(s) || listed.some(p => s.includes(p));
|
|
33
36
|
|
|
34
37
|
const block = reason => { process.stderr.write(`Blocked by scripts/amk/guard.js: ${reason}\n`); process.exit(2); };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Agent stop hook. If code changed but the active spec's handoff block wasn't updated, ask the agent to update it.
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
4
5
|
const { execSync } = require('child_process');
|
|
6
|
+
// the project this script is in (scripts/amk/): the agent may have moved into a subfolder
|
|
7
|
+
const root = path.join(__dirname, '..', '..');
|
|
5
8
|
|
|
6
9
|
let payload = {};
|
|
7
10
|
try { payload = JSON.parse(fs.readFileSync(0, 'utf8')); } catch {}
|
|
@@ -9,13 +12,13 @@ if (payload.stop_hook_active) process.exit(0); // already reminded once; don't l
|
|
|
9
12
|
|
|
10
13
|
// a spec counts only when its handoff says "Status: in progress" (not done, not an untouched template copy)
|
|
11
14
|
const inProgress = d => {
|
|
12
|
-
const f =
|
|
15
|
+
const f = path.join(root, 'specs', d, 'progress.md');
|
|
13
16
|
return d !== '_templates' && fs.existsSync(f) && /^Status:\s*in progress/im.test(fs.readFileSync(f, 'utf8'));
|
|
14
17
|
};
|
|
15
|
-
const specs = fs.existsSync('specs') ? fs.readdirSync('specs').filter(inProgress) : [];
|
|
18
|
+
const specs = fs.existsSync(path.join(root, 'specs')) ? fs.readdirSync(path.join(root, 'specs')).filter(inProgress) : [];
|
|
16
19
|
if (specs.length === 0) process.exit(0); // no spec in progress (quick change, bug fix, or finished work)
|
|
17
20
|
|
|
18
|
-
const changed = execSync('git status --porcelain --untracked-files=all', { encoding: 'utf8' }) // every new file, not just its new folder
|
|
21
|
+
const changed = execSync('git status --porcelain --untracked-files=all', { cwd: root, encoding: 'utf8' }) // every new file, not just its new folder
|
|
19
22
|
.split('\n').filter(Boolean).map(l => l.slice(3));
|
|
20
23
|
const codeChanged = changed.some(f => !f.startsWith('specs/') && !f.startsWith('.amk/'));
|
|
21
24
|
const handoffUpdated = changed.some(f => /^specs\/[^/]+\/progress\.md$/.test(f));
|