@locusai/cli 0.9.1 → 0.9.3

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 +164 -2
  2. package/package.json +2 -2
package/bin/locus.js CHANGED
@@ -6376,7 +6376,10 @@ var init_config = __esm(() => {
6376
6376
  ".locus-worktrees/",
6377
6377
  "",
6378
6378
  "# Locus AI - Settings (contains API key, telegram config, etc.)",
6379
- ".locus/settings.json"
6379
+ ".locus/settings.json",
6380
+ "",
6381
+ "# Locus AI - Configuration (contains project context, progress, etc.)",
6382
+ ".locus/config.json"
6380
6383
  ];
6381
6384
  });
6382
6385
 
@@ -43307,6 +43310,8 @@ function showHelp2() {
43307
43310
  ${c.dim("sessions show <id> Show session messages")}
43308
43311
  ${c.dim("sessions delete <id> Delete a session")}
43309
43312
  ${c.dim("sessions clear Clear all sessions")}
43313
+ ${c.success("version")} Show installed package versions
43314
+ ${c.success("upgrade")} Update CLI and Telegram to the latest version
43310
43315
 
43311
43316
  ${c.header(" OPTIONS ")}
43312
43317
  ${c.secondary("--help")} Show this help message
@@ -43988,6 +43993,9 @@ ${c.info(`Received ${signal}. Stopping agents and cleaning up worktrees...`)}`);
43988
43993
  }
43989
43994
  // src/commands/telegram.ts
43990
43995
  init_index_node();
43996
+ import { spawn as spawn4 } from "node:child_process";
43997
+ import { existsSync as existsSync16 } from "node:fs";
43998
+ import { join as join15 } from "node:path";
43991
43999
  import { createInterface as createInterface3 } from "node:readline";
43992
44000
  function ask2(question) {
43993
44001
  const rl = createInterface3({
@@ -44013,6 +44021,7 @@ function showTelegramHelp() {
44013
44021
  ${c.primary("locus telegram")} ${c.dim("<subcommand> [options]")}
44014
44022
 
44015
44023
  ${c.header(" SUBCOMMANDS ")}
44024
+ ${c.success("run")} Start the Telegram bot
44016
44025
  ${c.success("setup")} Interactive Telegram bot setup (or pass flags below)
44017
44026
  ${c.dim("--token <TOKEN> Bot token from @BotFather (required)")}
44018
44027
  ${c.dim("--chat-id <ID> Your Telegram chat ID (required)")}
@@ -44023,6 +44032,7 @@ function showTelegramHelp() {
44023
44032
  ${c.success("remove")} Remove Telegram configuration
44024
44033
 
44025
44034
  ${c.header(" EXAMPLES ")}
44035
+ ${c.dim("$")} ${c.primary("locus telegram run")}
44026
44036
  ${c.dim("$")} ${c.primary('locus telegram setup --token "123:ABC" --chat-id 987654')}
44027
44037
  ${c.dim("$")} ${c.primary("locus telegram config")}
44028
44038
  ${c.dim("$")} ${c.primary("locus telegram remove")}
@@ -44105,7 +44115,7 @@ async function setupCommand2(args, projectPath) {
44105
44115
  ${c.primary("Chat ID:")} ${parsedChatId}
44106
44116
 
44107
44117
  ${c.bold("Next steps:")}
44108
- Start the bot with: ${c.primary("bun run packages/telegram/src/index.ts")}
44118
+ Start the bot with: ${c.primary("locus telegram run")}
44109
44119
  `);
44110
44120
  }
44111
44121
  function configCommand2(projectPath) {
@@ -44211,11 +44221,57 @@ function removeCommand2(projectPath) {
44211
44221
  ${c.success("✔")} ${c.bold("Telegram configuration removed.")}
44212
44222
  `);
44213
44223
  }
44224
+ function runBotCommand(projectPath) {
44225
+ const manager = new SettingsManager(projectPath);
44226
+ const settings = manager.load();
44227
+ if (!settings.telegram?.botToken || !settings.telegram?.chatId) {
44228
+ console.error(`
44229
+ ${c.error("✖")} ${c.bold("Telegram is not configured.")}
44230
+ ` + ` Run ${c.primary("locus telegram setup")} first.
44231
+ `);
44232
+ process.exit(1);
44233
+ }
44234
+ const monorepoTelegramEntry = join15(projectPath, "packages/telegram/src/index.ts");
44235
+ const isMonorepo = existsSync16(monorepoTelegramEntry);
44236
+ let cmd;
44237
+ let args;
44238
+ if (isMonorepo) {
44239
+ cmd = "bun";
44240
+ args = ["run", monorepoTelegramEntry];
44241
+ } else {
44242
+ cmd = "locus-telegram";
44243
+ args = [];
44244
+ }
44245
+ const child = spawn4(cmd, args, {
44246
+ cwd: projectPath,
44247
+ stdio: "inherit",
44248
+ env: process.env
44249
+ });
44250
+ child.on("error", (err) => {
44251
+ if (err.code === "ENOENT" && !isMonorepo) {
44252
+ console.error(`
44253
+ ${c.error("✖")} ${c.bold("locus-telegram not found.")}
44254
+ ` + ` Install it with: ${c.primary("npm install -g @locusai/telegram")}
44255
+ `);
44256
+ } else {
44257
+ console.error(`
44258
+ ${c.error("✖")} Failed to start bot: ${err.message}
44259
+ `);
44260
+ }
44261
+ process.exit(1);
44262
+ });
44263
+ child.on("close", (code) => {
44264
+ process.exit(code ?? 0);
44265
+ });
44266
+ }
44214
44267
  async function telegramCommand(args) {
44215
44268
  const projectPath = process.cwd();
44216
44269
  const subcommand = args[0];
44217
44270
  const subArgs = args.slice(1);
44218
44271
  switch (subcommand) {
44272
+ case "run":
44273
+ runBotCommand(projectPath);
44274
+ break;
44219
44275
  case "setup":
44220
44276
  await setupCommand2(subArgs, projectPath);
44221
44277
  break;
@@ -44232,6 +44288,104 @@ async function telegramCommand(args) {
44232
44288
  showTelegramHelp();
44233
44289
  }
44234
44290
  }
44291
+ // src/commands/upgrade.ts
44292
+ init_index_node();
44293
+ import { execSync as execSync3 } from "node:child_process";
44294
+ var PACKAGES = ["@locusai/cli", "@locusai/telegram"];
44295
+ function getInstalledVersion(pkg) {
44296
+ try {
44297
+ const output = execSync3(`npm list -g ${pkg} --depth=0 --json`, {
44298
+ encoding: "utf-8",
44299
+ stdio: ["pipe", "pipe", "pipe"]
44300
+ });
44301
+ const parsed = JSON.parse(output);
44302
+ return parsed.dependencies?.[pkg]?.version || null;
44303
+ } catch {
44304
+ return null;
44305
+ }
44306
+ }
44307
+ function getLatestVersion(pkg) {
44308
+ try {
44309
+ return execSync3(`npm view ${pkg} version`, {
44310
+ encoding: "utf-8",
44311
+ stdio: ["pipe", "pipe", "pipe"]
44312
+ }).trim();
44313
+ } catch {
44314
+ return null;
44315
+ }
44316
+ }
44317
+ async function upgradeCommand() {
44318
+ console.log(`
44319
+ ${c.header(" UPGRADE ")}
44320
+ `);
44321
+ for (const pkg of PACKAGES) {
44322
+ const current = getInstalledVersion(pkg);
44323
+ const latest = getLatestVersion(pkg);
44324
+ if (!latest) {
44325
+ console.log(` ${c.error("✖")} ${c.bold(pkg)} — could not fetch latest version`);
44326
+ continue;
44327
+ }
44328
+ if (!current) {
44329
+ console.log(` ${c.dim("⊘")} ${c.bold(pkg)} — not installed, skipping`);
44330
+ continue;
44331
+ }
44332
+ if (current === latest) {
44333
+ console.log(` ${c.success("✔")} ${c.bold(pkg)} already at latest ${c.dim(`v${latest}`)}`);
44334
+ continue;
44335
+ }
44336
+ console.log(` ${c.primary("↑")} ${c.bold(pkg)} ${c.dim(`v${current}`)} → ${c.primary(`v${latest}`)}`);
44337
+ try {
44338
+ execSync3(`npm install -g ${pkg}@latest`, {
44339
+ stdio: "inherit"
44340
+ });
44341
+ console.log(` ${c.success("✔")} ${c.bold(pkg)} updated to ${c.primary(`v${latest}`)}
44342
+ `);
44343
+ } catch {
44344
+ console.error(` ${c.error("✖")} Failed to update ${c.bold(pkg)}. Try manually:
44345
+ ` + ` ${c.primary(`npm install -g ${pkg}@latest`)}
44346
+ `);
44347
+ }
44348
+ }
44349
+ console.log("");
44350
+ }
44351
+ // src/commands/version.ts
44352
+ init_index_node();
44353
+ import { execSync as execSync4 } from "node:child_process";
44354
+ import { existsSync as existsSync17, readFileSync as readFileSync12 } from "node:fs";
44355
+ import { join as join16 } from "node:path";
44356
+ function getTelegramVersion() {
44357
+ const monorepoPath = join16(process.cwd(), "packages/telegram/package.json");
44358
+ if (existsSync17(monorepoPath)) {
44359
+ try {
44360
+ const pkg = JSON.parse(readFileSync12(monorepoPath, "utf-8"));
44361
+ if (pkg.name === "@locusai/telegram") {
44362
+ return pkg.version || null;
44363
+ }
44364
+ } catch {}
44365
+ }
44366
+ try {
44367
+ const version2 = execSync4("npm list -g @locusai/telegram --depth=0 --json", {
44368
+ encoding: "utf-8",
44369
+ stdio: ["pipe", "pipe", "pipe"]
44370
+ });
44371
+ const parsed = JSON.parse(version2);
44372
+ return parsed.dependencies?.["@locusai/telegram"]?.version || null;
44373
+ } catch {}
44374
+ return null;
44375
+ }
44376
+ function versionCommand() {
44377
+ const telegramVersion = getTelegramVersion();
44378
+ console.log(`
44379
+ ${c.header(" VERSIONS ")}
44380
+ `);
44381
+ console.log(` ${c.primary("@locusai/cli")} ${VERSION2}`);
44382
+ if (telegramVersion) {
44383
+ console.log(` ${c.primary("@locusai/telegram")} ${telegramVersion}`);
44384
+ } else {
44385
+ console.log(` ${c.primary("@locusai/telegram")} ${c.dim("not installed")}`);
44386
+ }
44387
+ console.log("");
44388
+ }
44235
44389
  // src/cli.ts
44236
44390
  async function main() {
44237
44391
  const command = process.argv[2];
@@ -44270,6 +44424,14 @@ async function main() {
44270
44424
  case "telegram":
44271
44425
  await telegramCommand(args);
44272
44426
  break;
44427
+ case "version":
44428
+ case "--version":
44429
+ case "-v":
44430
+ versionCommand();
44431
+ break;
44432
+ case "upgrade":
44433
+ await upgradeCommand();
44434
+ break;
44273
44435
  default:
44274
44436
  showHelp2();
44275
44437
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "CLI for Locus - AI-native project management platform",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,7 +32,7 @@
32
32
  "author": "",
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "@locusai/sdk": "^0.9.1"
35
+ "@locusai/sdk": "^0.9.3"
36
36
  },
37
37
  "devDependencies": {}
38
38
  }