@agentrix/cli 0.0.3 → 0.0.4
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/README.md +69 -0
- package/dist/index.cjs +283 -155
- package/dist/index.mjs +130 -2
- package/dist/lib.cjs +4 -4
- package/dist/lib.mjs +1 -1
- package/dist/{logger-B7C5x_8c.cjs → logger-B4-T7qDc.cjs} +29 -2
- package/dist/{logger-DAsm4mPf.mjs → logger-D0oEaCVA.mjs} +28 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { encodeBase64, createKeyPairWithUit8Array, encryptMachineEncryptionKey, generateAESKey, decodeBase64, decryptWithEphemeralKey, createEventId, encryptFileContent, machineAuth, encryptSdkMessage, decryptSdkMessage, loadAgentConfig, getAgentContext, workerAuth } from '@agentrix/shared';
|
|
5
5
|
import { randomBytes, randomUUID as randomUUID$1 } from 'node:crypto';
|
|
6
6
|
import axios from 'axios';
|
|
7
|
-
import { m as machine, l as logger, p as projectPath, a as packageJson, c as createLogger, g as getLogPath, b as logger$1 } from './logger-
|
|
7
|
+
import { m as machine, l as logger, p as projectPath, a as packageJson, c as createLogger, g as getLogPath, b as logger$1 } from './logger-D0oEaCVA.mjs';
|
|
8
8
|
import * as fs from 'node:fs';
|
|
9
9
|
import { existsSync, rmSync, mkdirSync, readdirSync, createWriteStream } from 'node:fs';
|
|
10
10
|
import { createInterface } from 'node:readline';
|
|
@@ -16,7 +16,7 @@ import { io } from 'socket.io-client';
|
|
|
16
16
|
import { EventEmitter } from 'node:events';
|
|
17
17
|
import * as path from 'node:path';
|
|
18
18
|
import { join as join$1, dirname, extname } from 'node:path';
|
|
19
|
-
import { spawn } from 'child_process';
|
|
19
|
+
import { spawn, execSync } from 'child_process';
|
|
20
20
|
import psList from 'ps-list';
|
|
21
21
|
import spawn$1 from 'cross-spawn';
|
|
22
22
|
import fastify from 'fastify';
|
|
@@ -16566,6 +16566,63 @@ const workerRegistry = {
|
|
|
16566
16566
|
}
|
|
16567
16567
|
};
|
|
16568
16568
|
|
|
16569
|
+
async function checkForUpdates() {
|
|
16570
|
+
const currentVersion = packageJson.version;
|
|
16571
|
+
try {
|
|
16572
|
+
const output = execSync("npm view @agentrix/cli version", {
|
|
16573
|
+
encoding: "utf-8",
|
|
16574
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
16575
|
+
// Suppress stderr
|
|
16576
|
+
timeout: 5e3
|
|
16577
|
+
// 5 second timeout
|
|
16578
|
+
}).trim();
|
|
16579
|
+
const latestVersion = output;
|
|
16580
|
+
const hasUpdate = compareVersions(latestVersion, currentVersion) > 0;
|
|
16581
|
+
return {
|
|
16582
|
+
hasUpdate,
|
|
16583
|
+
currentVersion,
|
|
16584
|
+
latestVersion
|
|
16585
|
+
};
|
|
16586
|
+
} catch (error) {
|
|
16587
|
+
return {
|
|
16588
|
+
hasUpdate: false,
|
|
16589
|
+
currentVersion,
|
|
16590
|
+
latestVersion: null
|
|
16591
|
+
};
|
|
16592
|
+
}
|
|
16593
|
+
}
|
|
16594
|
+
function compareVersions(v1, v2) {
|
|
16595
|
+
const parts1 = v1.split(".").map(Number);
|
|
16596
|
+
const parts2 = v2.split(".").map(Number);
|
|
16597
|
+
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
16598
|
+
const part1 = parts1[i] || 0;
|
|
16599
|
+
const part2 = parts2[i] || 0;
|
|
16600
|
+
if (part1 > part2) return 1;
|
|
16601
|
+
if (part1 < part2) return -1;
|
|
16602
|
+
}
|
|
16603
|
+
return 0;
|
|
16604
|
+
}
|
|
16605
|
+
function displayUpdateNotification(result) {
|
|
16606
|
+
if (!result.hasUpdate || !result.latestVersion) {
|
|
16607
|
+
return;
|
|
16608
|
+
}
|
|
16609
|
+
console.log("");
|
|
16610
|
+
console.log(chalk.yellow("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
16611
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.bold("Update Available") + " " + chalk.yellow("\u2502"));
|
|
16612
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16613
|
+
console.log(chalk.yellow("\u2502") + ` Current: ${chalk.dim(result.currentVersion)} \u2192 Latest: ${chalk.green.bold(result.latestVersion)} ` + chalk.yellow("\u2502"));
|
|
16614
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16615
|
+
console.log(chalk.yellow("\u2502") + " Run " + chalk.cyan.bold("agentrix upgrade") + " to update " + chalk.yellow("\u2502"));
|
|
16616
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16617
|
+
console.log(chalk.yellow("\u2502") + " To disable this check, set: " + chalk.yellow("\u2502"));
|
|
16618
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.dim("AGENTRIX_DISABLE_UPDATE_CHECK=true") + " " + chalk.yellow("\u2502"));
|
|
16619
|
+
console.log(chalk.yellow("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
16620
|
+
console.log("");
|
|
16621
|
+
}
|
|
16622
|
+
function isUpdateCheckDisabled() {
|
|
16623
|
+
return process.env.AGENTRIX_DISABLE_UPDATE_CHECK === "true";
|
|
16624
|
+
}
|
|
16625
|
+
|
|
16569
16626
|
const cli = yargs(hideBin(process.argv)).scriptName("agentrix").version(packageJson.version).usage("$0 <command> [options]").option("debug", {
|
|
16570
16627
|
alias: "d",
|
|
16571
16628
|
type: "boolean",
|
|
@@ -16573,6 +16630,68 @@ const cli = yargs(hideBin(process.argv)).scriptName("agentrix").version(packageJ
|
|
|
16573
16630
|
global: true
|
|
16574
16631
|
}).help("help").alias("h", "help").alias("v", "version").strict().epilog("For more information, visit https://github.com/xmz-ai/agentrix-cli");
|
|
16575
16632
|
void machine.getStatePaths;
|
|
16633
|
+
cli.command("upgrade", "Upgrade CLI to the latest version", {}, async (argv) => {
|
|
16634
|
+
console.log(chalk.blue("Upgrading Agentrix CLI..."));
|
|
16635
|
+
console.log(chalk.dim(`Current version: ${packageJson.version}`));
|
|
16636
|
+
try {
|
|
16637
|
+
const { execSync } = await import('child_process');
|
|
16638
|
+
const daemonRunning = await checkIfDaemonRunningAndCleanupStaleState();
|
|
16639
|
+
let packageManager = "npm";
|
|
16640
|
+
try {
|
|
16641
|
+
execSync("yarn --version", { stdio: "ignore" });
|
|
16642
|
+
packageManager = "yarn";
|
|
16643
|
+
} catch {
|
|
16644
|
+
}
|
|
16645
|
+
console.log(chalk.dim(`Using ${packageManager} for upgrade...`));
|
|
16646
|
+
if (packageManager === "yarn") {
|
|
16647
|
+
execSync("yarn global upgrade @agentrix/cli", { stdio: "inherit" });
|
|
16648
|
+
} else {
|
|
16649
|
+
execSync("npm update -g @agentrix/cli", { stdio: "inherit" });
|
|
16650
|
+
}
|
|
16651
|
+
console.log(chalk.green("\u2713 Upgrade complete"));
|
|
16652
|
+
if (daemonRunning) {
|
|
16653
|
+
console.log(chalk.blue("Restarting daemon..."));
|
|
16654
|
+
await stopDaemon();
|
|
16655
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
16656
|
+
const daemonProcess = spawnAgentrixCLI(["daemon"], {
|
|
16657
|
+
detached: true,
|
|
16658
|
+
stdio: "ignore",
|
|
16659
|
+
env: process.env
|
|
16660
|
+
});
|
|
16661
|
+
daemonProcess.unref();
|
|
16662
|
+
let started = false;
|
|
16663
|
+
for (let i = 0; i < 50; i++) {
|
|
16664
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16665
|
+
if (await checkIfDaemonRunningAndCleanupStaleState()) {
|
|
16666
|
+
started = true;
|
|
16667
|
+
break;
|
|
16668
|
+
}
|
|
16669
|
+
}
|
|
16670
|
+
if (started) {
|
|
16671
|
+
console.log(chalk.green("\u2713 Daemon restarted successfully"));
|
|
16672
|
+
} else {
|
|
16673
|
+
console.log(chalk.yellow("\u26A0\uFE0F Daemon may still be starting. Run 'agentrix status' to check."));
|
|
16674
|
+
}
|
|
16675
|
+
}
|
|
16676
|
+
try {
|
|
16677
|
+
const { version } = await import('./logger-D0oEaCVA.mjs').then(function (n) { return n._; });
|
|
16678
|
+
console.log(chalk.green(`
|
|
16679
|
+
\u2713 Now running version: ${version}`));
|
|
16680
|
+
} catch {
|
|
16681
|
+
console.log(chalk.dim("\nRun 'agentrix --version' to see the new version"));
|
|
16682
|
+
}
|
|
16683
|
+
} catch (error) {
|
|
16684
|
+
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Upgrade failed");
|
|
16685
|
+
console.log(chalk.dim("\nYou can also upgrade manually:"));
|
|
16686
|
+
console.log(chalk.dim(" npm update -g @agentrix/cli"));
|
|
16687
|
+
console.log(chalk.dim(" yarn global upgrade @agentrix/cli"));
|
|
16688
|
+
if (process.env.DEBUG) {
|
|
16689
|
+
console.error(error);
|
|
16690
|
+
}
|
|
16691
|
+
process.exit(1);
|
|
16692
|
+
}
|
|
16693
|
+
process.exit(0);
|
|
16694
|
+
});
|
|
16576
16695
|
cli.command("doctor", "System diagnostics & troubleshooting", {}, async (argv) => {
|
|
16577
16696
|
await runDoctorCommand();
|
|
16578
16697
|
process.exit(0);
|
|
@@ -16724,6 +16843,14 @@ cli.command(
|
|
|
16724
16843
|
}
|
|
16725
16844
|
process.exit(1);
|
|
16726
16845
|
}
|
|
16846
|
+
if (!isUpdateCheckDisabled()) {
|
|
16847
|
+
checkForUpdates().then((result) => {
|
|
16848
|
+
if (result.hasUpdate) {
|
|
16849
|
+
setTimeout(() => displayUpdateNotification(result), 100);
|
|
16850
|
+
}
|
|
16851
|
+
}).catch(() => {
|
|
16852
|
+
});
|
|
16853
|
+
}
|
|
16727
16854
|
const wasRunning = await isLatestDaemonRunning();
|
|
16728
16855
|
if (!wasRunning) {
|
|
16729
16856
|
console.log("Starting Agentrix background service...");
|
|
@@ -16748,6 +16875,7 @@ cli.command(
|
|
|
16748
16875
|
}
|
|
16749
16876
|
}
|
|
16750
16877
|
await runDoctorCommand("daemon");
|
|
16878
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
16751
16879
|
process.exit(0);
|
|
16752
16880
|
}
|
|
16753
16881
|
);
|
package/dist/lib.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _package = require('./logger-B4-T7qDc.cjs');
|
|
4
4
|
require('winston');
|
|
5
5
|
require('chalk');
|
|
6
6
|
require('node:os');
|
|
@@ -14,6 +14,6 @@ require('url');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.Machine =
|
|
18
|
-
exports.logger =
|
|
19
|
-
exports.machine =
|
|
17
|
+
exports.Machine = _package.Machine;
|
|
18
|
+
exports.logger = _package.logger;
|
|
19
|
+
exports.machine = _package.machine;
|
package/dist/lib.mjs
CHANGED
|
@@ -13,7 +13,7 @@ var url = require('url');
|
|
|
13
13
|
|
|
14
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
15
15
|
var name = "@agentrix/cli";
|
|
16
|
-
var version = "0.0.
|
|
16
|
+
var version = "0.0.4";
|
|
17
17
|
var description = "Mobile and Web client for Claude Code and Codex";
|
|
18
18
|
var author = "agentrix.xmz.ai";
|
|
19
19
|
var type = "module";
|
|
@@ -159,7 +159,33 @@ var packageJson = {
|
|
|
159
159
|
packageManager: packageManager
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
var _package = /*#__PURE__*/Object.freeze({
|
|
163
|
+
__proto__: null,
|
|
164
|
+
author: author,
|
|
165
|
+
bin: bin,
|
|
166
|
+
bugs: bugs,
|
|
167
|
+
default: packageJson,
|
|
168
|
+
dependencies: dependencies,
|
|
169
|
+
description: description,
|
|
170
|
+
devDependencies: devDependencies,
|
|
171
|
+
exports: exports$1,
|
|
172
|
+
files: files,
|
|
173
|
+
homepage: homepage,
|
|
174
|
+
main: main,
|
|
175
|
+
module: module$1,
|
|
176
|
+
name: name,
|
|
177
|
+
packageManager: packageManager,
|
|
178
|
+
pkgroll: pkgroll,
|
|
179
|
+
publishConfig: publishConfig,
|
|
180
|
+
repository: repository,
|
|
181
|
+
resolutions: resolutions,
|
|
182
|
+
scripts: scripts,
|
|
183
|
+
type: type,
|
|
184
|
+
types: types,
|
|
185
|
+
version: version
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const __dirname$1 = require$$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('logger-B4-T7qDc.cjs', document.baseURI).href))));
|
|
163
189
|
function projectPath() {
|
|
164
190
|
const path = require$$1.resolve(__dirname$1, "..");
|
|
165
191
|
return path;
|
|
@@ -488,6 +514,7 @@ var logger$1 = /*#__PURE__*/Object.freeze({
|
|
|
488
514
|
});
|
|
489
515
|
|
|
490
516
|
exports.Machine = Machine;
|
|
517
|
+
exports._package = _package;
|
|
491
518
|
exports.createLogger = createLogger;
|
|
492
519
|
exports.getLogPath = getLogPath;
|
|
493
520
|
exports.logger = logger;
|
|
@@ -10,7 +10,7 @@ import { dirname, resolve } from 'path';
|
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
11
11
|
|
|
12
12
|
var name = "@agentrix/cli";
|
|
13
|
-
var version = "0.0.
|
|
13
|
+
var version = "0.0.4";
|
|
14
14
|
var description = "Mobile and Web client for Claude Code and Codex";
|
|
15
15
|
var author = "agentrix.xmz.ai";
|
|
16
16
|
var type = "module";
|
|
@@ -156,6 +156,32 @@ var packageJson = {
|
|
|
156
156
|
packageManager: packageManager
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
+
var _package = /*#__PURE__*/Object.freeze({
|
|
160
|
+
__proto__: null,
|
|
161
|
+
author: author,
|
|
162
|
+
bin: bin,
|
|
163
|
+
bugs: bugs,
|
|
164
|
+
default: packageJson,
|
|
165
|
+
dependencies: dependencies,
|
|
166
|
+
description: description,
|
|
167
|
+
devDependencies: devDependencies,
|
|
168
|
+
exports: exports$1,
|
|
169
|
+
files: files,
|
|
170
|
+
homepage: homepage,
|
|
171
|
+
main: main,
|
|
172
|
+
module: module$1,
|
|
173
|
+
name: name,
|
|
174
|
+
packageManager: packageManager,
|
|
175
|
+
pkgroll: pkgroll,
|
|
176
|
+
publishConfig: publishConfig,
|
|
177
|
+
repository: repository,
|
|
178
|
+
resolutions: resolutions,
|
|
179
|
+
scripts: scripts,
|
|
180
|
+
type: type,
|
|
181
|
+
types: types,
|
|
182
|
+
version: version
|
|
183
|
+
});
|
|
184
|
+
|
|
159
185
|
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
160
186
|
function projectPath() {
|
|
161
187
|
const path = resolve(__dirname$1, "..");
|
|
@@ -484,4 +510,4 @@ var logger$1 = /*#__PURE__*/Object.freeze({
|
|
|
484
510
|
logger: logger
|
|
485
511
|
});
|
|
486
512
|
|
|
487
|
-
export { Machine as M, packageJson as a, logger$1 as b, createLogger as c, getLogPath as g, logger as l, machine as m, projectPath as p };
|
|
513
|
+
export { Machine as M, _package as _, packageJson as a, logger$1 as b, createLogger as c, getLogPath as g, logger as l, machine as m, projectPath as p };
|