@rehpic/vcli 0.1.0-beta.37.1 → 0.1.0-beta.38.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 +32 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
-
}) : x)(function(x) {
|
|
7
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
-
});
|
|
10
4
|
var __esm = (fn, res) => function __init() {
|
|
11
5
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
6
|
};
|
|
@@ -451,7 +445,7 @@ function detectPlatformBinary({ [platform2]: platformBinary }, { wsl } = {}) {
|
|
|
451
445
|
}
|
|
452
446
|
return detectArchBinary(platformBinary);
|
|
453
447
|
}
|
|
454
|
-
var fallbackAttemptSymbol,
|
|
448
|
+
var fallbackAttemptSymbol, __dirname, localXdgOpenPath, platform2, arch, tryEachApp, baseOpen, open, openApp, apps, open_default;
|
|
455
449
|
var init_open = __esm({
|
|
456
450
|
"../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js"() {
|
|
457
451
|
"use strict";
|
|
@@ -462,8 +456,8 @@ var init_open = __esm({
|
|
|
462
456
|
init_is_inside_container();
|
|
463
457
|
init_is_in_ssh();
|
|
464
458
|
fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
465
|
-
|
|
466
|
-
localXdgOpenPath = path2.join(
|
|
459
|
+
__dirname = import.meta.url ? path2.dirname(fileURLToPath(import.meta.url)) : "";
|
|
460
|
+
localXdgOpenPath = path2.join(__dirname, "xdg-open");
|
|
467
461
|
({ platform: platform2, arch } = process8);
|
|
468
462
|
tryEachApp = async (apps2, opener) => {
|
|
469
463
|
if (apps2.length === 0) {
|
|
@@ -608,7 +602,7 @@ var init_open = __esm({
|
|
|
608
602
|
if (app) {
|
|
609
603
|
command = app;
|
|
610
604
|
} else {
|
|
611
|
-
const isBundled = !
|
|
605
|
+
const isBundled = !__dirname || __dirname === "/";
|
|
612
606
|
let exeLocalXdgOpen = false;
|
|
613
607
|
try {
|
|
614
608
|
await fs6.access(localXdgOpenPath, fsConstants3.X_OK);
|
|
@@ -1409,15 +1403,13 @@ function installLaunchAgent(vcliPath) {
|
|
|
1409
1403
|
</dict>
|
|
1410
1404
|
</dict>
|
|
1411
1405
|
</plist>`;
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
"
|
|
1415
|
-
"
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
);
|
|
1420
|
-
if (existsSync(menuBarBinary)) {
|
|
1406
|
+
const menuBarCandidates = [
|
|
1407
|
+
join(CONFIG_DIR, "VectorMenuBar"),
|
|
1408
|
+
"/usr/local/bin/VectorMenuBar",
|
|
1409
|
+
join(homedir2(), ".local", "bin", "VectorMenuBar")
|
|
1410
|
+
];
|
|
1411
|
+
const menuBarBinary = menuBarCandidates.find((p) => existsSync(p));
|
|
1412
|
+
if (menuBarBinary) {
|
|
1421
1413
|
const menuBarPlist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1422
1414
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
1423
1415
|
<plist version="1.0">
|
|
@@ -3551,21 +3543,33 @@ serviceCommand.command("install").description("Install the bridge as a system se
|
|
|
3551
3543
|
serviceCommand.command("uninstall").description("Uninstall the bridge system service").action(() => {
|
|
3552
3544
|
uninstallLaunchAgent();
|
|
3553
3545
|
});
|
|
3554
|
-
serviceCommand.command("logs").description("Show bridge service logs").action(() => {
|
|
3555
|
-
const
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
if (exists(logPath)) {
|
|
3562
|
-
const content = read(logPath, "utf-8");
|
|
3546
|
+
serviceCommand.command("logs").description("Show bridge service logs").action(async () => {
|
|
3547
|
+
const fs7 = await import("fs");
|
|
3548
|
+
const os2 = await import("os");
|
|
3549
|
+
const p = await import("path");
|
|
3550
|
+
const logPath = p.join(os2.homedir(), ".vector", "bridge.log");
|
|
3551
|
+
if (fs7.existsSync(logPath)) {
|
|
3552
|
+
const content = fs7.readFileSync(logPath, "utf-8");
|
|
3563
3553
|
const lines = content.split("\n");
|
|
3564
3554
|
console.log(lines.slice(-50).join("\n"));
|
|
3565
3555
|
} else {
|
|
3566
3556
|
console.log("No log file found at ~/.vector/bridge.log");
|
|
3567
3557
|
}
|
|
3568
3558
|
});
|
|
3559
|
+
serviceCommand.command("enable").description("Enable bridge to start at login (macOS LaunchAgent)").action(async () => {
|
|
3560
|
+
if (osPlatform() !== "darwin") {
|
|
3561
|
+
console.error("Login item is macOS only.");
|
|
3562
|
+
return;
|
|
3563
|
+
}
|
|
3564
|
+
const vcliPath = process.argv[1] ?? "vcli";
|
|
3565
|
+
installLaunchAgent(vcliPath);
|
|
3566
|
+
loadLaunchAgent();
|
|
3567
|
+
console.log("Bridge will start automatically on login.");
|
|
3568
|
+
});
|
|
3569
|
+
serviceCommand.command("disable").description("Disable bridge from starting at login").action(() => {
|
|
3570
|
+
uninstallLaunchAgent();
|
|
3571
|
+
console.log("Bridge will no longer start at login.");
|
|
3572
|
+
});
|
|
3569
3573
|
var bridgeCommand = program.command("bridge").description("Start/stop the local agent bridge");
|
|
3570
3574
|
bridgeCommand.command("start").description("Register device, install service, and start the bridge").action(async (_options, command) => {
|
|
3571
3575
|
let config = loadBridgeConfig();
|