beecork 1.3.4 → 1.3.5
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/dist/cli/commands.js +16 -0
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -23,6 +23,22 @@ export async function startDaemon() {
|
|
|
23
23
|
console.log(`Beecork daemon is already running (PID: ${existingPid})`);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
+
// Check if WhatsApp needs pairing
|
|
27
|
+
const config = getConfig();
|
|
28
|
+
const waSessionPath = config.whatsapp?.sessionPath ?? `${process.env.HOME}/.beecork/whatsapp-session`;
|
|
29
|
+
const waEnabled = config.whatsapp?.enabled;
|
|
30
|
+
const waHasSession = waEnabled && fs.existsSync(waSessionPath) && fs.readdirSync(waSessionPath).length > 0;
|
|
31
|
+
if (waEnabled && !waHasSession) {
|
|
32
|
+
console.log('\n⚠ WhatsApp is enabled but not yet paired.');
|
|
33
|
+
console.log(' Starting daemon in foreground so you can scan the QR code...');
|
|
34
|
+
console.log(' Once paired, press Ctrl+C and run "beecork start" again.\n');
|
|
35
|
+
const daemonPath = new URL('../daemon.js', import.meta.url).pathname;
|
|
36
|
+
const child = spawn('node', [daemonPath], {
|
|
37
|
+
stdio: 'inherit',
|
|
38
|
+
});
|
|
39
|
+
process.on('SIGINT', () => { child.kill(); process.exit(0); });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
26
42
|
try {
|
|
27
43
|
startService();
|
|
28
44
|
console.log('Beecork daemon started via system service.');
|