@todoforai/cli 0.1.18 → 0.1.19
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/todoai.js +10 -19
- package/package.json +1 -1
package/dist/todoai.js
CHANGED
|
@@ -44548,20 +44548,19 @@ function ensureBridgeCredentials(apiUrl) {
|
|
|
44548
44548
|
const login = spawnSync("todoforai-bridge", bridgeLoginArgs(apiUrl), { stdio: "inherit" });
|
|
44549
44549
|
return login.status === 0;
|
|
44550
44550
|
}
|
|
44551
|
-
function
|
|
44552
|
-
|
|
44553
|
-
|
|
44554
|
-
|
|
44555
|
-
|
|
44556
|
-
} catch {
|
|
44557
|
-
return null;
|
|
44558
|
-
}
|
|
44551
|
+
function bridgeAlreadyRunning() {
|
|
44552
|
+
if (process.platform === "win32")
|
|
44553
|
+
return false;
|
|
44554
|
+
const r = spawnSync("pgrep", ["-f", "todoforai-bridge"], { encoding: "utf-8" });
|
|
44555
|
+
return r.status === 0 && (r.stdout || "").trim().length > 0;
|
|
44559
44556
|
}
|
|
44560
44557
|
function ensureBridgeRunning(apiUrl, _apiKey) {
|
|
44561
44558
|
if (!hasBridge()) {
|
|
44562
44559
|
console.error("\x1B[2mBridge not started: `todoforai-bridge` was not found on PATH. Install TODOforAI Bridge, or pass --no-bridge (or deprecated --no-edge) to silence this.\x1B[0m");
|
|
44563
44560
|
return;
|
|
44564
44561
|
}
|
|
44562
|
+
if (bridgeAlreadyRunning())
|
|
44563
|
+
return;
|
|
44565
44564
|
if (!ensureBridgeCredentials(apiUrl)) {
|
|
44566
44565
|
console.error("\x1B[33mBridge not started: `todoforai-bridge login` did not complete successfully.\x1B[0m");
|
|
44567
44566
|
return;
|
|
@@ -44584,20 +44583,12 @@ function ensureBridgeRunning(apiUrl, _apiKey) {
|
|
|
44584
44583
|
exitCode = code;
|
|
44585
44584
|
});
|
|
44586
44585
|
child.unref();
|
|
44587
|
-
|
|
44588
|
-
if (!pid)
|
|
44586
|
+
if (!child.pid)
|
|
44589
44587
|
return;
|
|
44590
44588
|
const shortLog = logFile.replace(os3.homedir(), "~");
|
|
44591
44589
|
setTimeout(() => {
|
|
44592
|
-
if (
|
|
44593
|
-
console.error(`\x1B[
|
|
44594
|
-
return;
|
|
44595
|
-
}
|
|
44596
|
-
if (exitCode === 0) {
|
|
44597
|
-
console.error(`\x1B[2mBridge exited cleanly. Logs: ${shortLog}\x1B[0m`);
|
|
44598
|
-
} else {
|
|
44599
|
-
const reason = lastLogLine(logFile);
|
|
44600
|
-
console.error(`\x1B[33mBridge exited early (exit ${exitCode}): ${reason ?? `check logs: ${shortLog}`}\x1B[0m`);
|
|
44590
|
+
if (exited && exitCode !== 0) {
|
|
44591
|
+
console.error(`\x1B[2mBridge not running (exit ${exitCode}), see ${shortLog}\x1B[0m`);
|
|
44601
44592
|
}
|
|
44602
44593
|
}, 500);
|
|
44603
44594
|
}
|