fix(signal-auth): read 'number' field from signal-cli 0.13+ listAccounts

signal-cli >= 0.13 emits the account identifier as `number` in JSON
output, not `account`. The skip-if-already-linked path in signal-auth
always returned an empty list, so re-runs of setup unconditionally
tried `signal-cli link`, which fails when the data directory already
exists.

Read `number` first, fall back to `account` for older signal-cli.
This commit is contained in:
Paul Snyman
2026-05-21 13:28:48 -07:00
parent 0683c6ec58
commit 3a87953bc9
+2 -1
View File
@@ -36,6 +36,7 @@ const LINK_TIMEOUT_MS = 180_000;
const DEFAULT_DEVICE_NAME = 'NanoClaw';
interface SignalAccount {
number?: string;
account?: string;
registered?: boolean;
}
@@ -59,7 +60,7 @@ function listAccounts(): string[] {
const parsed = JSON.parse(res.stdout || '[]') as SignalAccount[];
return parsed
.filter((a) => a.registered !== false)
.map((a) => a.account ?? '')
.map((a) => a.number ?? a.account ?? '')
.filter(Boolean);
} catch {
return [];