Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): restore whoami JSON contract and Windows Metro path checks

Dash409cca2c9d55
diff --git a/apps/mobile/scripts/sim-metro.mjs b/apps/mobile/scripts/sim-metro.mjs
index 59b1f55652..a517c8b0b4 100644
--- a/apps/mobile/scripts/sim-metro.mjs
+++ b/apps/mobile/scripts/sim-metro.mjs
@@ -76,13 +76,15 @@ export function isMetroPid(pid) {
return /expo|metro/i.test(commandOfPid(pid));
}
+function normalizeComparablePath(value) {
+ return String(value ?? '').replaceAll('\\', '/').replace(/\/+$/, '');
+}
+
export function isDedicatedMetroProcessGroup(entries, expectedWorktree = null) {
if (!entries.length) return false;
- const normalizedRoot = expectedWorktree
- ? resolve(expectedWorktree).replaceAll('\\', '/').replace(/\/+$/, '')
- : null;
+ const normalizedRoot = expectedWorktree ? normalizeComparablePath(expectedWorktree) : null;
const allowedCwds = normalizedRoot
- ? new Set([normalizedRoot, join(normalizedRoot, 'apps/mobile')])
+ ? new Set([normalizedRoot, `${normalizedRoot}/apps/mobile`])
: null;
return entries.every((entry) => {
@@ -90,7 +92,7 @@ export function isDedicatedMetroProcessGroup(entries, expectedWorktree = null) {
const cwd = typeof entry === 'string' ? null : entry.cwd;
if (!command || !/(?:^|\/)(?:node|pnpm|sh|zsh)(?:\s|$)/.test(command)) return false;
if (!/(?:expo|metro|sim-start|mobile:sim:start)/i.test(command)) return false;
- if (normalizedRoot && (!cwd || !allowedCwds.has(resolve(cwd).replaceAll('\\', '/')))) return false;
+ if (normalizedRoot && (!cwd || !allowedCwds.has(normalizeComparablePath(cwd)))) return false;
return true;
});
}
diff --git a/apps/mobile/scripts/sim-whoami.mjs b/apps/mobile/scripts/sim-whoami.mjs
index 45b5ebb96f..1f3bc953a6 100644
--- a/apps/mobile/scripts/sim-whoami.mjs
+++ b/apps/mobile/scripts/sim-whoami.mjs
@@ -211,7 +211,10 @@ if (!jsonOutput) {
bundleId,
worktree: worktreeRoot,
source: expectedSource,
+ expectedSource,
expectedPort,
+ currentSourceOnExpectedPort,
+ anyMetro,
booted: booted.map((line) => line.trim()),
installed,
metros,