@locusai/cli 0.15.1 → 0.15.2

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.
Files changed (2) hide show
  1. package/bin/locus.js +45 -23
  2. package/package.json +4 -4
package/bin/locus.js CHANGED
@@ -46277,6 +46277,11 @@ import { spawn as spawn4 } from "node:child_process";
46277
46277
  import { existsSync as existsSync20, writeFileSync as writeFileSync9 } from "node:fs";
46278
46278
  import { homedir as homedir3 } from "node:os";
46279
46279
  import { join as join20 } from "node:path";
46280
+ async function findBinary() {
46281
+ const result = await runShell("which", ["locus-telegram"]);
46282
+ const p = result.stdout.trim();
46283
+ return p?.startsWith?.("/") ? p : null;
46284
+ }
46280
46285
  var SERVICE_NAME = "locus";
46281
46286
  var SYSTEMD_UNIT_PATH = `/etc/systemd/system/${SERVICE_NAME}.service`;
46282
46287
  var PLIST_LABEL = "com.locus.agent";
@@ -46338,16 +46343,13 @@ WantedBy=multi-user.target
46338
46343
  }
46339
46344
  async function installSystemd(projectPath) {
46340
46345
  const user2 = process.env.USER || "root";
46341
- const monorepoEntry = join20(projectPath, "packages/telegram/src/index.ts");
46342
- const isMonorepo = existsSync20(monorepoEntry);
46343
- let binaryPath;
46344
- if (isMonorepo) {
46345
- const bunPath = (await runShell("which", ["bun"])).stdout.trim() || join20(homedir3(), ".bun/bin/bun");
46346
- binaryPath = `${bunPath} run ${monorepoEntry}`;
46347
- } else {
46348
- const npmGlobalBin = (await runShell("npm", ["bin", "-g"])).stdout.trim();
46349
- const telegramBin = join20(npmGlobalBin, "locus-telegram");
46350
- binaryPath = existsSync20(telegramBin) ? telegramBin : "locus-telegram";
46346
+ const binaryPath = await findBinary();
46347
+ if (!binaryPath) {
46348
+ console.error(`
46349
+ ${c.error("✖")} ${c.bold("Could not find locus-telegram binary.")}
46350
+ ` + ` Install with: ${c.primary("npm install -g @locusai/telegram")}
46351
+ `);
46352
+ process.exit(1);
46351
46353
  }
46352
46354
  const unit = generateSystemdUnit(projectPath, user2, binaryPath);
46353
46355
  console.log(`
@@ -46452,20 +46454,15 @@ async function installLaunchd(projectPath) {
46452
46454
  if (existsSync20(plistPath)) {
46453
46455
  await runShell("launchctl", ["unload", plistPath]);
46454
46456
  }
46455
- const monorepoEntry = join20(projectPath, "packages/telegram/src/index.ts");
46456
- const isMonorepo = existsSync20(monorepoEntry);
46457
- let binaryPath;
46458
- let binaryArgs;
46459
- if (isMonorepo) {
46460
- const bunPath = (await runShell("which", ["bun"])).stdout.trim() || join20(homedir3(), ".bun/bin/bun");
46461
- binaryPath = bunPath;
46462
- binaryArgs = ["run", monorepoEntry];
46463
- } else {
46464
- const npmGlobalBin = (await runShell("npm", ["bin", "-g"])).stdout.trim();
46465
- const telegramBin = join20(npmGlobalBin, "locus-telegram");
46466
- binaryPath = existsSync20(telegramBin) ? telegramBin : "locus-telegram";
46467
- binaryArgs = [];
46457
+ const binaryPath = await findBinary();
46458
+ if (!binaryPath) {
46459
+ console.error(`
46460
+ ${c.error("✖")} ${c.bold("Could not find locus-telegram binary.")}
46461
+ Install with: ${c.primary("npm install -g @locusai/telegram")}
46462
+ `);
46463
+ process.exit(1);
46468
46464
  }
46465
+ const binaryArgs = [];
46469
46466
  const logDir = join20(homedir3(), "Library/Logs/Locus");
46470
46467
  const { mkdirSync: mkdirSync10 } = await import("node:fs");
46471
46468
  mkdirSync10(logDir, { recursive: true });
@@ -46930,7 +46927,10 @@ async function telegramCommand(args) {
46930
46927
  // src/commands/upgrade.ts
46931
46928
  init_index_node();
46932
46929
  import { execSync as execSync3 } from "node:child_process";
46930
+ import { existsSync as existsSync22 } from "node:fs";
46933
46931
  var PACKAGES = ["@locusai/cli", "@locusai/telegram"];
46932
+ var SYSTEMD_UNIT_PATH2 = "/etc/systemd/system/locus.service";
46933
+ var SYSTEMD_TELEGRAM_UNIT_PATH = "/etc/systemd/system/locus-telegram.service";
46934
46934
  function getInstalledVersion(pkg) {
46935
46935
  try {
46936
46936
  const output = execSync3(`npm list -g ${pkg} --depth=0 --json`, {
@@ -46996,6 +46996,28 @@ async function upgradeCommand() {
46996
46996
  `);
46997
46997
  }
46998
46998
  }
46999
+ if (process.platform === "linux") {
47000
+ for (const unit of [SYSTEMD_UNIT_PATH2, SYSTEMD_TELEGRAM_UNIT_PATH]) {
47001
+ if (!existsSync22(unit))
47002
+ continue;
47003
+ const split = unit.split("/").pop();
47004
+ if (!split) {
47005
+ throw "PATH NOTH FOUND";
47006
+ }
47007
+ const name = split.replace(".service", "");
47008
+ try {
47009
+ console.log(` ${c.info("▶")} Restarting ${name} service...`);
47010
+ execSync3(`systemctl restart ${name}`, {
47011
+ stdio: ["pipe", "pipe", "pipe"]
47012
+ });
47013
+ console.log(` ${c.success("✔")} ${name} service restarted
47014
+ `);
47015
+ } catch {
47016
+ console.log(` ${c.dim("⚠")} Could not restart ${name} service (may need sudo)
47017
+ `);
47018
+ }
47019
+ }
47020
+ }
46999
47021
  console.log("");
47000
47022
  }
47001
47023
  // src/commands/version.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/cli",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "CLI for Locus - AI-native project management platform",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,9 +32,9 @@
32
32
  "author": "",
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "@locusai/sdk": "^0.15.1",
36
- "@locusai/shared": "^0.15.1",
37
- "@locusai/telegram": "^0.15.1"
35
+ "@locusai/sdk": "^0.15.2",
36
+ "@locusai/shared": "^0.15.2",
37
+ "@locusai/telegram": "^0.15.2"
38
38
  },
39
39
  "devDependencies": {}
40
40
  }