@rehpic/vcli 0.1.0-beta.75.1 → 0.1.0-beta.77.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 +167 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -735,6 +735,76 @@ var init_open = __esm({
|
|
|
735
735
|
}
|
|
736
736
|
});
|
|
737
737
|
|
|
738
|
+
// package.json
|
|
739
|
+
var package_exports = {};
|
|
740
|
+
__export(package_exports, {
|
|
741
|
+
default: () => package_default
|
|
742
|
+
});
|
|
743
|
+
var package_default;
|
|
744
|
+
var init_package = __esm({
|
|
745
|
+
"package.json"() {
|
|
746
|
+
package_default = {
|
|
747
|
+
name: "@rehpic/vcli",
|
|
748
|
+
version: "0.1.0",
|
|
749
|
+
description: "Command line interface for Vector workspaces.",
|
|
750
|
+
license: "Apache-2.0",
|
|
751
|
+
type: "module",
|
|
752
|
+
repository: {
|
|
753
|
+
type: "git",
|
|
754
|
+
url: "git+https://github.com/xrehpicx/vector.git",
|
|
755
|
+
directory: "packages/vector-cli"
|
|
756
|
+
},
|
|
757
|
+
homepage: "https://github.com/xrehpicx/vector/tree/main/packages/vector-cli#readme",
|
|
758
|
+
bugs: {
|
|
759
|
+
url: "https://github.com/xrehpicx/vector/issues"
|
|
760
|
+
},
|
|
761
|
+
keywords: [
|
|
762
|
+
"vector",
|
|
763
|
+
"cli",
|
|
764
|
+
"project-management",
|
|
765
|
+
"convex",
|
|
766
|
+
"issues"
|
|
767
|
+
],
|
|
768
|
+
engines: {
|
|
769
|
+
node: ">=20.19.0"
|
|
770
|
+
},
|
|
771
|
+
bin: {
|
|
772
|
+
vcli: "dist/index.js"
|
|
773
|
+
},
|
|
774
|
+
files: [
|
|
775
|
+
"dist",
|
|
776
|
+
"native",
|
|
777
|
+
"scripts",
|
|
778
|
+
"README.md"
|
|
779
|
+
],
|
|
780
|
+
scripts: {
|
|
781
|
+
build: "node scripts/build-menubar-app.js && tsup --config tsup.config.ts"
|
|
782
|
+
},
|
|
783
|
+
dependencies: {
|
|
784
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.79",
|
|
785
|
+
"@clack/prompts": "^1.1.0",
|
|
786
|
+
commander: "^14.0.3",
|
|
787
|
+
convex: "^1.33.1",
|
|
788
|
+
dotenv: "^16.4.5",
|
|
789
|
+
localtunnel: "^2.0.2",
|
|
790
|
+
"node-datachannel": "^0.32.1",
|
|
791
|
+
"node-pty": "1.2.0-beta.12",
|
|
792
|
+
tunnelmole: "^2.4.0",
|
|
793
|
+
werift: "^0.22.9",
|
|
794
|
+
ws: "^8.19.0"
|
|
795
|
+
},
|
|
796
|
+
publishConfig: {
|
|
797
|
+
access: "public",
|
|
798
|
+
provenance: true
|
|
799
|
+
},
|
|
800
|
+
devDependencies: {
|
|
801
|
+
"@types/localtunnel": "^2.0.4",
|
|
802
|
+
"@types/ws": "^8.18.1"
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
|
|
738
808
|
// src/index.ts
|
|
739
809
|
import { readFileSync as readFileSync3 } from "fs";
|
|
740
810
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -3362,34 +3432,12 @@ function killExistingMenuBar() {
|
|
|
3362
3432
|
}
|
|
3363
3433
|
}
|
|
3364
3434
|
}
|
|
3365
|
-
function getRunningMenuBarPid() {
|
|
3366
|
-
if (!existsSync3(MENUBAR_PID_FILE)) {
|
|
3367
|
-
return null;
|
|
3368
|
-
}
|
|
3369
|
-
try {
|
|
3370
|
-
const pid = Number(readFileSync2(MENUBAR_PID_FILE, "utf-8").trim());
|
|
3371
|
-
if (Number.isFinite(pid) && pid > 0 && isKnownMenuBarProcess(pid)) {
|
|
3372
|
-
process.kill(pid, 0);
|
|
3373
|
-
return pid;
|
|
3374
|
-
}
|
|
3375
|
-
} catch {
|
|
3376
|
-
}
|
|
3377
|
-
try {
|
|
3378
|
-
unlinkSync(MENUBAR_PID_FILE);
|
|
3379
|
-
} catch {
|
|
3380
|
-
}
|
|
3381
|
-
return null;
|
|
3382
|
-
}
|
|
3383
3435
|
async function launchMenuBar() {
|
|
3384
3436
|
if (platform() !== "darwin") return;
|
|
3385
3437
|
removeLegacyMenuBarLaunchAgent();
|
|
3386
3438
|
const executable = findMenuBarExecutable();
|
|
3387
3439
|
const cliInvocation = getCurrentCliInvocation();
|
|
3388
3440
|
if (!executable || !cliInvocation) return;
|
|
3389
|
-
const existingPid = getRunningMenuBarPid();
|
|
3390
|
-
if (existingPid) {
|
|
3391
|
-
return;
|
|
3392
|
-
}
|
|
3393
3441
|
killExistingMenuBar();
|
|
3394
3442
|
try {
|
|
3395
3443
|
const { spawn: spawnChild } = await import("child_process");
|
|
@@ -5861,6 +5909,103 @@ bridgeCommand.command("status").description("Show bridge status").action(() => {
|
|
|
5861
5909
|
` Status: ${s.running ? `Running (PID ${s.pid})` : "Not running"}`
|
|
5862
5910
|
);
|
|
5863
5911
|
});
|
|
5912
|
+
function detectInstallMethod() {
|
|
5913
|
+
const execPath = process.argv[1] ?? "";
|
|
5914
|
+
if (execPath.includes(".volta")) {
|
|
5915
|
+
return {
|
|
5916
|
+
method: "volta",
|
|
5917
|
+
command: ["volta", "install", "@rehpic/vcli@latest"]
|
|
5918
|
+
};
|
|
5919
|
+
}
|
|
5920
|
+
if (execPath.includes("pnpm")) {
|
|
5921
|
+
return {
|
|
5922
|
+
method: "pnpm",
|
|
5923
|
+
command: ["pnpm", "add", "-g", "@rehpic/vcli@latest"]
|
|
5924
|
+
};
|
|
5925
|
+
}
|
|
5926
|
+
if (execPath.includes("yarn")) {
|
|
5927
|
+
return {
|
|
5928
|
+
method: "yarn",
|
|
5929
|
+
command: ["yarn", "global", "add", "@rehpic/vcli@latest"]
|
|
5930
|
+
};
|
|
5931
|
+
}
|
|
5932
|
+
return {
|
|
5933
|
+
method: "npm",
|
|
5934
|
+
command: ["npm", "install", "-g", "@rehpic/vcli@latest"]
|
|
5935
|
+
};
|
|
5936
|
+
}
|
|
5937
|
+
async function checkForUpdate() {
|
|
5938
|
+
try {
|
|
5939
|
+
const { execSync: exec } = await import("child_process");
|
|
5940
|
+
const latest = exec("npm view @rehpic/vcli version", {
|
|
5941
|
+
encoding: "utf-8",
|
|
5942
|
+
timeout: 1e4
|
|
5943
|
+
}).trim();
|
|
5944
|
+
const pkg = await Promise.resolve().then(() => (init_package(), package_exports));
|
|
5945
|
+
const current = pkg.default?.version ?? pkg.version ?? "0.0.0";
|
|
5946
|
+
return {
|
|
5947
|
+
current,
|
|
5948
|
+
latest,
|
|
5949
|
+
hasUpdate: latest !== current && !current.includes("beta")
|
|
5950
|
+
};
|
|
5951
|
+
} catch {
|
|
5952
|
+
return null;
|
|
5953
|
+
}
|
|
5954
|
+
}
|
|
5955
|
+
program.command("update").description("Update the CLI to the latest version").action(async () => {
|
|
5956
|
+
const { spinner, log } = await import("@clack/prompts");
|
|
5957
|
+
const s = spinner();
|
|
5958
|
+
s.start("Checking for updates...");
|
|
5959
|
+
const updateInfo = await checkForUpdate();
|
|
5960
|
+
if (!updateInfo) {
|
|
5961
|
+
s.stop("Could not check for updates.");
|
|
5962
|
+
return;
|
|
5963
|
+
}
|
|
5964
|
+
if (!updateInfo.hasUpdate) {
|
|
5965
|
+
s.stop(`Already on the latest version (${updateInfo.current}).`);
|
|
5966
|
+
return;
|
|
5967
|
+
}
|
|
5968
|
+
s.stop(`Update available: ${updateInfo.current} \u2192 ${updateInfo.latest}`);
|
|
5969
|
+
const install = detectInstallMethod();
|
|
5970
|
+
log.info(`Install method: ${install.method}`);
|
|
5971
|
+
s.start("Stopping bridge service...");
|
|
5972
|
+
const wasRunning = getBridgeStatus().running;
|
|
5973
|
+
if (wasRunning) {
|
|
5974
|
+
stopBridge({ includeMenuBar: true });
|
|
5975
|
+
if (osPlatform() === "darwin") {
|
|
5976
|
+
unloadLaunchAgent();
|
|
5977
|
+
}
|
|
5978
|
+
stopMenuBar();
|
|
5979
|
+
}
|
|
5980
|
+
s.stop(wasRunning ? "Bridge stopped." : "Bridge was not running.");
|
|
5981
|
+
s.start(`Updating via ${install.method}...`);
|
|
5982
|
+
try {
|
|
5983
|
+
const { execFileSync: exec } = await import("child_process");
|
|
5984
|
+
exec(install.command[0], install.command.slice(1), {
|
|
5985
|
+
stdio: "inherit",
|
|
5986
|
+
timeout: 12e4
|
|
5987
|
+
});
|
|
5988
|
+
s.stop("CLI updated successfully.");
|
|
5989
|
+
} catch (err) {
|
|
5990
|
+
s.stop("Update failed.");
|
|
5991
|
+
log.error(`Run manually: ${install.command.join(" ")}`);
|
|
5992
|
+
return;
|
|
5993
|
+
}
|
|
5994
|
+
if (wasRunning) {
|
|
5995
|
+
s.start("Restarting bridge service...");
|
|
5996
|
+
try {
|
|
5997
|
+
const { execFileSync: exec } = await import("child_process");
|
|
5998
|
+
exec("vcli", ["service", "start"], {
|
|
5999
|
+
stdio: "inherit",
|
|
6000
|
+
timeout: 3e4
|
|
6001
|
+
});
|
|
6002
|
+
s.stop("Bridge restarted.");
|
|
6003
|
+
} catch {
|
|
6004
|
+
s.stop("Could not auto-restart. Run: vcli service start");
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
log.success(`Updated to v${updateInfo.latest}`);
|
|
6008
|
+
});
|
|
5864
6009
|
async function main() {
|
|
5865
6010
|
await program.parseAsync(process.argv);
|
|
5866
6011
|
}
|