@agentrix/cli 0.0.4 → 0.0.5
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.cjs +105 -73
- package/dist/index.mjs +105 -73
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{logger-B4-T7qDc.cjs → logger-BZmE9yGJ.cjs} +2 -2
- package/dist/{logger-D0oEaCVA.mjs → logger-uuzG-sjn.mjs} +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var chalk = require('chalk');
|
|
|
6
6
|
var shared = require('@agentrix/shared');
|
|
7
7
|
var node_crypto = require('node:crypto');
|
|
8
8
|
var axios = require('axios');
|
|
9
|
-
var _package = require('./logger-
|
|
9
|
+
var _package = require('./logger-BZmE9yGJ.cjs');
|
|
10
10
|
var fs$1 = require('node:fs');
|
|
11
11
|
var node_readline = require('node:readline');
|
|
12
12
|
var fs = require('fs');
|
|
@@ -16586,7 +16586,7 @@ const workerRegistry = {
|
|
|
16586
16586
|
}
|
|
16587
16587
|
};
|
|
16588
16588
|
|
|
16589
|
-
async function
|
|
16589
|
+
async function checkForUpgrades() {
|
|
16590
16590
|
const currentVersion = _package.packageJson.version;
|
|
16591
16591
|
try {
|
|
16592
16592
|
const output = child_process.execSync("npm view @agentrix/cli version", {
|
|
@@ -16597,15 +16597,15 @@ async function checkForUpdates() {
|
|
|
16597
16597
|
// 5 second timeout
|
|
16598
16598
|
}).trim();
|
|
16599
16599
|
const latestVersion = output;
|
|
16600
|
-
const
|
|
16600
|
+
const hasUpgrade = compareVersions(latestVersion, currentVersion) > 0;
|
|
16601
16601
|
return {
|
|
16602
|
-
|
|
16602
|
+
hasUpgrade,
|
|
16603
16603
|
currentVersion,
|
|
16604
16604
|
latestVersion
|
|
16605
16605
|
};
|
|
16606
16606
|
} catch (error) {
|
|
16607
16607
|
return {
|
|
16608
|
-
|
|
16608
|
+
hasUpgrade: false,
|
|
16609
16609
|
currentVersion,
|
|
16610
16610
|
latestVersion: null
|
|
16611
16611
|
};
|
|
@@ -16622,25 +16622,53 @@ function compareVersions(v1, v2) {
|
|
|
16622
16622
|
}
|
|
16623
16623
|
return 0;
|
|
16624
16624
|
}
|
|
16625
|
-
function
|
|
16626
|
-
if (!result.
|
|
16625
|
+
function displayUpgradeNotification(result) {
|
|
16626
|
+
if (!result.hasUpgrade || !result.latestVersion) {
|
|
16627
16627
|
return;
|
|
16628
16628
|
}
|
|
16629
16629
|
console.log("");
|
|
16630
16630
|
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"));
|
|
16631
|
-
console.log(chalk.yellow("\u2502") + " " + chalk.bold("
|
|
16631
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.bold("Upgrade Available") + " " + chalk.yellow("\u2502"));
|
|
16632
16632
|
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16633
16633
|
console.log(chalk.yellow("\u2502") + ` Current: ${chalk.dim(result.currentVersion)} \u2192 Latest: ${chalk.green.bold(result.latestVersion)} ` + chalk.yellow("\u2502"));
|
|
16634
16634
|
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16635
|
-
console.log(chalk.yellow("\u2502") + " Run " + chalk.cyan.bold("agentrix upgrade") + " to
|
|
16635
|
+
console.log(chalk.yellow("\u2502") + " Run " + chalk.cyan.bold("agentrix upgrade") + " to upgrade " + chalk.yellow("\u2502"));
|
|
16636
16636
|
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16637
|
-
console.log(chalk.yellow("\u2502") + " To
|
|
16638
|
-
console.log(chalk.yellow("\u2502") + " " + chalk.dim("
|
|
16637
|
+
console.log(chalk.yellow("\u2502") + " To enable auto-upgrade, set: " + chalk.yellow("\u2502"));
|
|
16638
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.dim("AGENTRIX_DISABLE_AUTO_UPGRADE=false") + " " + chalk.yellow("\u2502"));
|
|
16639
16639
|
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"));
|
|
16640
16640
|
console.log("");
|
|
16641
16641
|
}
|
|
16642
|
-
function
|
|
16643
|
-
return process.env.
|
|
16642
|
+
function isAutoUpgradeDisabled() {
|
|
16643
|
+
return process.env.AGENTRIX_DISABLE_AUTO_UPGRADE === "true";
|
|
16644
|
+
}
|
|
16645
|
+
async function performAutoUpgrade() {
|
|
16646
|
+
try {
|
|
16647
|
+
const { execSync: execSync2 } = await import('child_process');
|
|
16648
|
+
console.log("");
|
|
16649
|
+
console.log(chalk.blue("\u{1F504} Auto-upgrading Agentrix CLI..."));
|
|
16650
|
+
let packageManager = "npm";
|
|
16651
|
+
try {
|
|
16652
|
+
execSync2("yarn --version", { stdio: "ignore" });
|
|
16653
|
+
packageManager = "yarn";
|
|
16654
|
+
} catch {
|
|
16655
|
+
}
|
|
16656
|
+
console.log(chalk.dim(` Using ${packageManager}...`));
|
|
16657
|
+
if (packageManager === "yarn") {
|
|
16658
|
+
execSync2("yarn global upgrade @agentrix/cli", { stdio: "inherit" });
|
|
16659
|
+
} else {
|
|
16660
|
+
execSync2("npm update -g @agentrix/cli", { stdio: "inherit" });
|
|
16661
|
+
}
|
|
16662
|
+
console.log(chalk.green("\u2713 Upgrade complete"));
|
|
16663
|
+
console.log("");
|
|
16664
|
+
return true;
|
|
16665
|
+
} catch (error) {
|
|
16666
|
+
console.log("");
|
|
16667
|
+
console.log(chalk.yellow("\u26A0\uFE0F Auto-upgrade failed"));
|
|
16668
|
+
console.log(chalk.dim(" You can upgrade manually with: agentrix upgrade"));
|
|
16669
|
+
console.log("");
|
|
16670
|
+
return false;
|
|
16671
|
+
}
|
|
16644
16672
|
}
|
|
16645
16673
|
|
|
16646
16674
|
const cli = yargs(helpers.hideBin(process.argv)).scriptName("agentrix").version(_package.packageJson.version).usage("$0 <command> [options]").option("debug", {
|
|
@@ -16651,64 +16679,42 @@ const cli = yargs(helpers.hideBin(process.argv)).scriptName("agentrix").version(
|
|
|
16651
16679
|
}).help("help").alias("h", "help").alias("v", "version").strict().epilog("For more information, visit https://github.com/xmz-ai/agentrix-cli");
|
|
16652
16680
|
void _package.machine.getStatePaths;
|
|
16653
16681
|
cli.command("upgrade", "Upgrade CLI to the latest version", {}, async (argv) => {
|
|
16654
|
-
console.log(chalk.blue("Upgrading Agentrix CLI..."));
|
|
16655
16682
|
console.log(chalk.dim(`Current version: ${_package.packageJson.version}`));
|
|
16656
|
-
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16683
|
+
const daemonRunning = await checkIfDaemonRunningAndCleanupStaleState();
|
|
16684
|
+
const upgraded = await performAutoUpgrade();
|
|
16685
|
+
if (!upgraded) {
|
|
16686
|
+
process.exit(1);
|
|
16687
|
+
}
|
|
16688
|
+
if (daemonRunning) {
|
|
16689
|
+
console.log(chalk.blue("Restarting daemon..."));
|
|
16690
|
+
await stopDaemon();
|
|
16691
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
16692
|
+
const daemonProcess = spawnAgentrixCLI(["daemon"], {
|
|
16693
|
+
detached: true,
|
|
16694
|
+
stdio: "ignore",
|
|
16695
|
+
env: process.env
|
|
16696
|
+
});
|
|
16697
|
+
daemonProcess.unref();
|
|
16698
|
+
let started = false;
|
|
16699
|
+
for (let i = 0; i < 50; i++) {
|
|
16700
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16701
|
+
if (await checkIfDaemonRunningAndCleanupStaleState()) {
|
|
16702
|
+
started = true;
|
|
16703
|
+
break;
|
|
16704
|
+
}
|
|
16664
16705
|
}
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
execSync("yarn global upgrade @agentrix/cli", { stdio: "inherit" });
|
|
16706
|
+
if (started) {
|
|
16707
|
+
console.log(chalk.green("\u2713 Daemon restarted successfully"));
|
|
16668
16708
|
} else {
|
|
16669
|
-
|
|
16709
|
+
console.log(chalk.yellow("\u26A0\uFE0F Daemon may still be starting. Run 'agentrix status' to check."));
|
|
16670
16710
|
}
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
16676
|
-
const daemonProcess = spawnAgentrixCLI(["daemon"], {
|
|
16677
|
-
detached: true,
|
|
16678
|
-
stdio: "ignore",
|
|
16679
|
-
env: process.env
|
|
16680
|
-
});
|
|
16681
|
-
daemonProcess.unref();
|
|
16682
|
-
let started = false;
|
|
16683
|
-
for (let i = 0; i < 50; i++) {
|
|
16684
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16685
|
-
if (await checkIfDaemonRunningAndCleanupStaleState()) {
|
|
16686
|
-
started = true;
|
|
16687
|
-
break;
|
|
16688
|
-
}
|
|
16689
|
-
}
|
|
16690
|
-
if (started) {
|
|
16691
|
-
console.log(chalk.green("\u2713 Daemon restarted successfully"));
|
|
16692
|
-
} else {
|
|
16693
|
-
console.log(chalk.yellow("\u26A0\uFE0F Daemon may still be starting. Run 'agentrix status' to check."));
|
|
16694
|
-
}
|
|
16695
|
-
}
|
|
16696
|
-
try {
|
|
16697
|
-
const { version } = await Promise.resolve().then(function () { return require('./logger-B4-T7qDc.cjs'); }).then(function (n) { return n._package; });
|
|
16698
|
-
console.log(chalk.green(`
|
|
16711
|
+
}
|
|
16712
|
+
try {
|
|
16713
|
+
const { version } = await Promise.resolve().then(function () { return require('./logger-BZmE9yGJ.cjs'); }).then(function (n) { return n._package; });
|
|
16714
|
+
console.log(chalk.green(`
|
|
16699
16715
|
\u2713 Now running version: ${version}`));
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
}
|
|
16703
|
-
} catch (error) {
|
|
16704
|
-
console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Upgrade failed");
|
|
16705
|
-
console.log(chalk.dim("\nYou can also upgrade manually:"));
|
|
16706
|
-
console.log(chalk.dim(" npm update -g @agentrix/cli"));
|
|
16707
|
-
console.log(chalk.dim(" yarn global upgrade @agentrix/cli"));
|
|
16708
|
-
if (process.env.DEBUG) {
|
|
16709
|
-
console.error(error);
|
|
16710
|
-
}
|
|
16711
|
-
process.exit(1);
|
|
16716
|
+
} catch {
|
|
16717
|
+
console.log(chalk.dim("\nRun 'agentrix --version' to see the new version"));
|
|
16712
16718
|
}
|
|
16713
16719
|
process.exit(0);
|
|
16714
16720
|
});
|
|
@@ -16863,13 +16869,40 @@ cli.command(
|
|
|
16863
16869
|
}
|
|
16864
16870
|
process.exit(1);
|
|
16865
16871
|
}
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16872
|
+
const skipUpgradeCheck = process.env.AGENTRIX_SKIP_UPGRADE_CHECK === "true";
|
|
16873
|
+
const autoUpgradeDisabled = isAutoUpgradeDisabled();
|
|
16874
|
+
let upgradeResult = {
|
|
16875
|
+
hasUpgrade: false,
|
|
16876
|
+
currentVersion: "",
|
|
16877
|
+
latestVersion: null
|
|
16878
|
+
};
|
|
16879
|
+
if (!skipUpgradeCheck) {
|
|
16880
|
+
upgradeResult = await checkForUpgrades();
|
|
16881
|
+
}
|
|
16882
|
+
if (upgradeResult.hasUpgrade) {
|
|
16883
|
+
if (autoUpgradeDisabled) {
|
|
16884
|
+
displayUpgradeNotification(upgradeResult);
|
|
16885
|
+
} else {
|
|
16886
|
+
const upgraded = await performAutoUpgrade();
|
|
16887
|
+
if (upgraded) {
|
|
16888
|
+
console.log(chalk.green("\u2713 Restarting with new version..."));
|
|
16889
|
+
console.log("");
|
|
16890
|
+
const { execSync } = await import('child_process');
|
|
16891
|
+
try {
|
|
16892
|
+
execSync("agentrix start", {
|
|
16893
|
+
stdio: "inherit",
|
|
16894
|
+
env: {
|
|
16895
|
+
...process.env,
|
|
16896
|
+
// Set flag to prevent infinite upgrade loop
|
|
16897
|
+
AGENTRIX_SKIP_UPGRADE_CHECK: "true"
|
|
16898
|
+
}
|
|
16899
|
+
});
|
|
16900
|
+
process.exit(0);
|
|
16901
|
+
} catch (error) {
|
|
16902
|
+
console.log(chalk.yellow("\u26A0\uFE0F Failed to restart, continuing with upgrade..."));
|
|
16903
|
+
}
|
|
16870
16904
|
}
|
|
16871
|
-
}
|
|
16872
|
-
});
|
|
16905
|
+
}
|
|
16873
16906
|
}
|
|
16874
16907
|
const wasRunning = await isLatestDaemonRunning();
|
|
16875
16908
|
if (!wasRunning) {
|
|
@@ -16895,7 +16928,6 @@ cli.command(
|
|
|
16895
16928
|
}
|
|
16896
16929
|
}
|
|
16897
16930
|
await runDoctorCommand("daemon");
|
|
16898
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
16899
16931
|
process.exit(0);
|
|
16900
16932
|
}
|
|
16901
16933
|
);
|
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-uuzG-sjn.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';
|
|
@@ -16566,7 +16566,7 @@ const workerRegistry = {
|
|
|
16566
16566
|
}
|
|
16567
16567
|
};
|
|
16568
16568
|
|
|
16569
|
-
async function
|
|
16569
|
+
async function checkForUpgrades() {
|
|
16570
16570
|
const currentVersion = packageJson.version;
|
|
16571
16571
|
try {
|
|
16572
16572
|
const output = execSync("npm view @agentrix/cli version", {
|
|
@@ -16577,15 +16577,15 @@ async function checkForUpdates() {
|
|
|
16577
16577
|
// 5 second timeout
|
|
16578
16578
|
}).trim();
|
|
16579
16579
|
const latestVersion = output;
|
|
16580
|
-
const
|
|
16580
|
+
const hasUpgrade = compareVersions(latestVersion, currentVersion) > 0;
|
|
16581
16581
|
return {
|
|
16582
|
-
|
|
16582
|
+
hasUpgrade,
|
|
16583
16583
|
currentVersion,
|
|
16584
16584
|
latestVersion
|
|
16585
16585
|
};
|
|
16586
16586
|
} catch (error) {
|
|
16587
16587
|
return {
|
|
16588
|
-
|
|
16588
|
+
hasUpgrade: false,
|
|
16589
16589
|
currentVersion,
|
|
16590
16590
|
latestVersion: null
|
|
16591
16591
|
};
|
|
@@ -16602,25 +16602,53 @@ function compareVersions(v1, v2) {
|
|
|
16602
16602
|
}
|
|
16603
16603
|
return 0;
|
|
16604
16604
|
}
|
|
16605
|
-
function
|
|
16606
|
-
if (!result.
|
|
16605
|
+
function displayUpgradeNotification(result) {
|
|
16606
|
+
if (!result.hasUpgrade || !result.latestVersion) {
|
|
16607
16607
|
return;
|
|
16608
16608
|
}
|
|
16609
16609
|
console.log("");
|
|
16610
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("
|
|
16611
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.bold("Upgrade Available") + " " + chalk.yellow("\u2502"));
|
|
16612
16612
|
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16613
16613
|
console.log(chalk.yellow("\u2502") + ` Current: ${chalk.dim(result.currentVersion)} \u2192 Latest: ${chalk.green.bold(result.latestVersion)} ` + chalk.yellow("\u2502"));
|
|
16614
16614
|
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16615
|
-
console.log(chalk.yellow("\u2502") + " Run " + chalk.cyan.bold("agentrix upgrade") + " to
|
|
16615
|
+
console.log(chalk.yellow("\u2502") + " Run " + chalk.cyan.bold("agentrix upgrade") + " to upgrade " + chalk.yellow("\u2502"));
|
|
16616
16616
|
console.log(chalk.yellow("\u2502") + " " + chalk.yellow("\u2502"));
|
|
16617
|
-
console.log(chalk.yellow("\u2502") + " To
|
|
16618
|
-
console.log(chalk.yellow("\u2502") + " " + chalk.dim("
|
|
16617
|
+
console.log(chalk.yellow("\u2502") + " To enable auto-upgrade, set: " + chalk.yellow("\u2502"));
|
|
16618
|
+
console.log(chalk.yellow("\u2502") + " " + chalk.dim("AGENTRIX_DISABLE_AUTO_UPGRADE=false") + " " + chalk.yellow("\u2502"));
|
|
16619
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
16620
|
console.log("");
|
|
16621
16621
|
}
|
|
16622
|
-
function
|
|
16623
|
-
return process.env.
|
|
16622
|
+
function isAutoUpgradeDisabled() {
|
|
16623
|
+
return process.env.AGENTRIX_DISABLE_AUTO_UPGRADE === "true";
|
|
16624
|
+
}
|
|
16625
|
+
async function performAutoUpgrade() {
|
|
16626
|
+
try {
|
|
16627
|
+
const { execSync: execSync2 } = await import('child_process');
|
|
16628
|
+
console.log("");
|
|
16629
|
+
console.log(chalk.blue("\u{1F504} Auto-upgrading Agentrix CLI..."));
|
|
16630
|
+
let packageManager = "npm";
|
|
16631
|
+
try {
|
|
16632
|
+
execSync2("yarn --version", { stdio: "ignore" });
|
|
16633
|
+
packageManager = "yarn";
|
|
16634
|
+
} catch {
|
|
16635
|
+
}
|
|
16636
|
+
console.log(chalk.dim(` Using ${packageManager}...`));
|
|
16637
|
+
if (packageManager === "yarn") {
|
|
16638
|
+
execSync2("yarn global upgrade @agentrix/cli", { stdio: "inherit" });
|
|
16639
|
+
} else {
|
|
16640
|
+
execSync2("npm update -g @agentrix/cli", { stdio: "inherit" });
|
|
16641
|
+
}
|
|
16642
|
+
console.log(chalk.green("\u2713 Upgrade complete"));
|
|
16643
|
+
console.log("");
|
|
16644
|
+
return true;
|
|
16645
|
+
} catch (error) {
|
|
16646
|
+
console.log("");
|
|
16647
|
+
console.log(chalk.yellow("\u26A0\uFE0F Auto-upgrade failed"));
|
|
16648
|
+
console.log(chalk.dim(" You can upgrade manually with: agentrix upgrade"));
|
|
16649
|
+
console.log("");
|
|
16650
|
+
return false;
|
|
16651
|
+
}
|
|
16624
16652
|
}
|
|
16625
16653
|
|
|
16626
16654
|
const cli = yargs(hideBin(process.argv)).scriptName("agentrix").version(packageJson.version).usage("$0 <command> [options]").option("debug", {
|
|
@@ -16631,64 +16659,42 @@ const cli = yargs(hideBin(process.argv)).scriptName("agentrix").version(packageJ
|
|
|
16631
16659
|
}).help("help").alias("h", "help").alias("v", "version").strict().epilog("For more information, visit https://github.com/xmz-ai/agentrix-cli");
|
|
16632
16660
|
void machine.getStatePaths;
|
|
16633
16661
|
cli.command("upgrade", "Upgrade CLI to the latest version", {}, async (argv) => {
|
|
16634
|
-
console.log(chalk.blue("Upgrading Agentrix CLI..."));
|
|
16635
16662
|
console.log(chalk.dim(`Current version: ${packageJson.version}`));
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
|
|
16663
|
+
const daemonRunning = await checkIfDaemonRunningAndCleanupStaleState();
|
|
16664
|
+
const upgraded = await performAutoUpgrade();
|
|
16665
|
+
if (!upgraded) {
|
|
16666
|
+
process.exit(1);
|
|
16667
|
+
}
|
|
16668
|
+
if (daemonRunning) {
|
|
16669
|
+
console.log(chalk.blue("Restarting daemon..."));
|
|
16670
|
+
await stopDaemon();
|
|
16671
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
16672
|
+
const daemonProcess = spawnAgentrixCLI(["daemon"], {
|
|
16673
|
+
detached: true,
|
|
16674
|
+
stdio: "ignore",
|
|
16675
|
+
env: process.env
|
|
16676
|
+
});
|
|
16677
|
+
daemonProcess.unref();
|
|
16678
|
+
let started = false;
|
|
16679
|
+
for (let i = 0; i < 50; i++) {
|
|
16680
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
16681
|
+
if (await checkIfDaemonRunningAndCleanupStaleState()) {
|
|
16682
|
+
started = true;
|
|
16683
|
+
break;
|
|
16684
|
+
}
|
|
16644
16685
|
}
|
|
16645
|
-
|
|
16646
|
-
|
|
16647
|
-
execSync("yarn global upgrade @agentrix/cli", { stdio: "inherit" });
|
|
16686
|
+
if (started) {
|
|
16687
|
+
console.log(chalk.green("\u2713 Daemon restarted successfully"));
|
|
16648
16688
|
} else {
|
|
16649
|
-
|
|
16689
|
+
console.log(chalk.yellow("\u26A0\uFE0F Daemon may still be starting. Run 'agentrix status' to check."));
|
|
16650
16690
|
}
|
|
16651
|
-
|
|
16652
|
-
|
|
16653
|
-
|
|
16654
|
-
|
|
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(`
|
|
16691
|
+
}
|
|
16692
|
+
try {
|
|
16693
|
+
const { version } = await import('./logger-uuzG-sjn.mjs').then(function (n) { return n._; });
|
|
16694
|
+
console.log(chalk.green(`
|
|
16679
16695
|
\u2713 Now running version: ${version}`));
|
|
16680
|
-
|
|
16681
|
-
|
|
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);
|
|
16696
|
+
} catch {
|
|
16697
|
+
console.log(chalk.dim("\nRun 'agentrix --version' to see the new version"));
|
|
16692
16698
|
}
|
|
16693
16699
|
process.exit(0);
|
|
16694
16700
|
});
|
|
@@ -16843,13 +16849,40 @@ cli.command(
|
|
|
16843
16849
|
}
|
|
16844
16850
|
process.exit(1);
|
|
16845
16851
|
}
|
|
16846
|
-
|
|
16847
|
-
|
|
16848
|
-
|
|
16849
|
-
|
|
16852
|
+
const skipUpgradeCheck = process.env.AGENTRIX_SKIP_UPGRADE_CHECK === "true";
|
|
16853
|
+
const autoUpgradeDisabled = isAutoUpgradeDisabled();
|
|
16854
|
+
let upgradeResult = {
|
|
16855
|
+
hasUpgrade: false,
|
|
16856
|
+
currentVersion: "",
|
|
16857
|
+
latestVersion: null
|
|
16858
|
+
};
|
|
16859
|
+
if (!skipUpgradeCheck) {
|
|
16860
|
+
upgradeResult = await checkForUpgrades();
|
|
16861
|
+
}
|
|
16862
|
+
if (upgradeResult.hasUpgrade) {
|
|
16863
|
+
if (autoUpgradeDisabled) {
|
|
16864
|
+
displayUpgradeNotification(upgradeResult);
|
|
16865
|
+
} else {
|
|
16866
|
+
const upgraded = await performAutoUpgrade();
|
|
16867
|
+
if (upgraded) {
|
|
16868
|
+
console.log(chalk.green("\u2713 Restarting with new version..."));
|
|
16869
|
+
console.log("");
|
|
16870
|
+
const { execSync } = await import('child_process');
|
|
16871
|
+
try {
|
|
16872
|
+
execSync("agentrix start", {
|
|
16873
|
+
stdio: "inherit",
|
|
16874
|
+
env: {
|
|
16875
|
+
...process.env,
|
|
16876
|
+
// Set flag to prevent infinite upgrade loop
|
|
16877
|
+
AGENTRIX_SKIP_UPGRADE_CHECK: "true"
|
|
16878
|
+
}
|
|
16879
|
+
});
|
|
16880
|
+
process.exit(0);
|
|
16881
|
+
} catch (error) {
|
|
16882
|
+
console.log(chalk.yellow("\u26A0\uFE0F Failed to restart, continuing with upgrade..."));
|
|
16883
|
+
}
|
|
16850
16884
|
}
|
|
16851
|
-
}
|
|
16852
|
-
});
|
|
16885
|
+
}
|
|
16853
16886
|
}
|
|
16854
16887
|
const wasRunning = await isLatestDaemonRunning();
|
|
16855
16888
|
if (!wasRunning) {
|
|
@@ -16875,7 +16908,6 @@ cli.command(
|
|
|
16875
16908
|
}
|
|
16876
16909
|
}
|
|
16877
16910
|
await runDoctorCommand("daemon");
|
|
16878
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
16879
16911
|
process.exit(0);
|
|
16880
16912
|
}
|
|
16881
16913
|
);
|
package/dist/lib.cjs
CHANGED
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.5";
|
|
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";
|
|
@@ -185,7 +185,7 @@ var _package = /*#__PURE__*/Object.freeze({
|
|
|
185
185
|
version: version
|
|
186
186
|
});
|
|
187
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-
|
|
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-BZmE9yGJ.cjs', document.baseURI).href))));
|
|
189
189
|
function projectPath() {
|
|
190
190
|
const path = require$$1.resolve(__dirname$1, "..");
|
|
191
191
|
return path;
|
|
@@ -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.5";
|
|
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";
|