@rehpic/vcli 0.1.0-beta.47.1 → 0.1.0-beta.49.1
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/index.js +31 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var menubar_exports = {};
|
|
|
14
14
|
__export(menubar_exports, {
|
|
15
15
|
startMenuBar: () => startMenuBar
|
|
16
16
|
});
|
|
17
|
-
import
|
|
17
|
+
import SysTrayModule from "systray2";
|
|
18
18
|
import { existsSync, readFileSync } from "fs";
|
|
19
19
|
import { homedir as homedir2 } from "os";
|
|
20
20
|
import { join } from "path";
|
|
@@ -223,10 +223,11 @@ async function startMenuBar() {
|
|
|
223
223
|
void newActions;
|
|
224
224
|
}, 15e3);
|
|
225
225
|
}
|
|
226
|
-
var CONFIG_DIR, BRIDGE_CONFIG_FILE, PID_FILE, LIVE_ACTIVITIES_FILE;
|
|
226
|
+
var SysTray, CONFIG_DIR, BRIDGE_CONFIG_FILE, PID_FILE, LIVE_ACTIVITIES_FILE;
|
|
227
227
|
var init_menubar = __esm({
|
|
228
228
|
"src/menubar.ts"() {
|
|
229
229
|
"use strict";
|
|
230
|
+
SysTray = typeof SysTrayModule.default === "function" ? SysTrayModule.default : SysTrayModule;
|
|
230
231
|
CONFIG_DIR = join(homedir2(), ".vector");
|
|
231
232
|
BRIDGE_CONFIG_FILE = join(CONFIG_DIR, "bridge.json");
|
|
232
233
|
PID_FILE = join(CONFIG_DIR, "bridge.pid");
|
|
@@ -3747,8 +3748,11 @@ serviceCommand.command("start").description("Start the bridge service via Launch
|
|
|
3747
3748
|
console.log(`Bridge is already running (PID ${existing.pid}).`);
|
|
3748
3749
|
return;
|
|
3749
3750
|
}
|
|
3751
|
+
const { spinner } = await import("@clack/prompts");
|
|
3752
|
+
const s = spinner();
|
|
3750
3753
|
let config = loadBridgeConfig();
|
|
3751
3754
|
if (!config) {
|
|
3755
|
+
s.start("Registering device...");
|
|
3752
3756
|
const runtime = await getRuntime(command);
|
|
3753
3757
|
const session = requireSession(runtime);
|
|
3754
3758
|
const client = await createConvexClient(
|
|
@@ -3757,18 +3761,20 @@ serviceCommand.command("start").description("Start the bridge service via Launch
|
|
|
3757
3761
|
runtime.convexUrl
|
|
3758
3762
|
);
|
|
3759
3763
|
const user = await runQuery(client, api.users.currentUser);
|
|
3760
|
-
if (!user)
|
|
3764
|
+
if (!user) {
|
|
3765
|
+
s.stop("Failed");
|
|
3766
|
+
throw new Error("Not logged in. Run `vcli auth login` first.");
|
|
3767
|
+
}
|
|
3761
3768
|
config = await setupBridgeDevice(runtime.convexUrl, user._id);
|
|
3762
|
-
|
|
3763
|
-
`Device registered: ${config.displayName} (${config.deviceId})`
|
|
3764
|
-
);
|
|
3769
|
+
s.stop(`Device registered: ${config.displayName}`);
|
|
3765
3770
|
}
|
|
3766
3771
|
if (osPlatform() === "darwin") {
|
|
3772
|
+
s.start("Starting bridge service...");
|
|
3767
3773
|
const vcliPath = process.argv[1] ?? "vcli";
|
|
3768
3774
|
installLaunchAgent(vcliPath);
|
|
3769
3775
|
loadLaunchAgent();
|
|
3770
3776
|
await launchMenuBar();
|
|
3771
|
-
|
|
3777
|
+
s.stop("Bridge service started.");
|
|
3772
3778
|
} else {
|
|
3773
3779
|
console.log(
|
|
3774
3780
|
"Starting bridge in foreground (use systemd for background)..."
|
|
@@ -3825,8 +3831,11 @@ serviceCommand.command("install").description("Install the bridge as a system se
|
|
|
3825
3831
|
console.error("On Linux, use systemd --user manually for now.");
|
|
3826
3832
|
return;
|
|
3827
3833
|
}
|
|
3834
|
+
const { spinner } = await import("@clack/prompts");
|
|
3835
|
+
const s = spinner();
|
|
3828
3836
|
let config = loadBridgeConfig();
|
|
3829
3837
|
if (!config) {
|
|
3838
|
+
s.start("Registering device...");
|
|
3830
3839
|
const runtime = await getRuntime(command);
|
|
3831
3840
|
const session = requireSession(runtime);
|
|
3832
3841
|
const client = await createConvexClient(
|
|
@@ -3835,22 +3844,32 @@ serviceCommand.command("install").description("Install the bridge as a system se
|
|
|
3835
3844
|
runtime.convexUrl
|
|
3836
3845
|
);
|
|
3837
3846
|
const user = await runQuery(client, api.users.currentUser);
|
|
3838
|
-
if (!user)
|
|
3847
|
+
if (!user) {
|
|
3848
|
+
s.stop("Failed");
|
|
3849
|
+
throw new Error("Not logged in. Run `vcli auth login` first.");
|
|
3850
|
+
}
|
|
3839
3851
|
config = await setupBridgeDevice(runtime.convexUrl, user._id);
|
|
3840
|
-
|
|
3841
|
-
`Device registered: ${config.displayName} (${config.deviceId})`
|
|
3842
|
-
);
|
|
3852
|
+
s.stop(`Device registered: ${config.displayName}`);
|
|
3843
3853
|
}
|
|
3854
|
+
s.start("Installing LaunchAgent...");
|
|
3844
3855
|
const vcliPath = process.argv[1] ?? "vcli";
|
|
3845
3856
|
installLaunchAgent(vcliPath);
|
|
3857
|
+
s.stop("LaunchAgent installed");
|
|
3858
|
+
s.start("Starting bridge service...");
|
|
3846
3859
|
loadLaunchAgent();
|
|
3860
|
+
s.stop("Bridge service started");
|
|
3861
|
+
s.start("Launching menu bar...");
|
|
3847
3862
|
await launchMenuBar();
|
|
3863
|
+
s.stop("Menu bar ready");
|
|
3864
|
+
console.log("");
|
|
3848
3865
|
console.log(
|
|
3849
3866
|
"Bridge installed and running. Will start automatically on login."
|
|
3850
3867
|
);
|
|
3851
3868
|
});
|
|
3852
|
-
serviceCommand.command("uninstall").description("
|
|
3869
|
+
serviceCommand.command("uninstall").description("Stop the bridge and uninstall the system service").action(() => {
|
|
3870
|
+
stopBridge();
|
|
3853
3871
|
uninstallLaunchAgent();
|
|
3872
|
+
console.log("Bridge stopped and service uninstalled.");
|
|
3854
3873
|
});
|
|
3855
3874
|
serviceCommand.command("logs").description("Show bridge service logs").action(async () => {
|
|
3856
3875
|
const fs7 = await import("fs");
|