fix(whatsapp): write pairing code to file for immediate access (#745)

The pairing code was only emitted to stdout, which is buffered by the
calling process and not visible until the auth command exits (~120s).
By also writing to store/pairing-code.txt the moment the code is ready,
callers can poll that file and display the code to the user within seconds
instead of after the 60s expiry window.

Update the add-whatsapp skill instructions to use the background +
file-poll pattern instead of waiting on buffered stdout.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
glifocat
2026-03-06 17:51:00 +01:00
committed by GitHub
parent 0b260ece57
commit be1991108b
2 changed files with 28 additions and 6 deletions

View File

@@ -306,6 +306,16 @@ async function handlePairingCode(
process.exit(3);
}
// Write to file immediately so callers can read it without waiting for stdout
try {
fs.writeFileSync(
path.join(projectRoot, 'store', 'pairing-code.txt'),
pairingCode,
);
} catch {
/* non-fatal */
}
// Emit pairing code immediately so the caller can display it to the user
emitAuthStatus('pairing-code', 'pairing_code_ready', 'waiting', {
PAIRING_CODE: pairingCode,