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