@integrity-labs/agt-cli 0.10.19 → 0.10.21

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/bin/agt.js CHANGED
@@ -3702,11 +3702,11 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
3702
3702
  }
3703
3703
 
3704
3704
  // src/commands/update.ts
3705
- import { execSync } from "child_process";
3705
+ import { execFileSync, execSync } from "child_process";
3706
3706
  import { existsSync as existsSync5, realpathSync } from "fs";
3707
3707
  import chalk20 from "chalk";
3708
3708
  import ora15 from "ora";
3709
- var cliVersion = true ? "0.10.19" : "dev";
3709
+ var cliVersion = true ? "0.10.21" : "dev";
3710
3710
  async function fetchLatestVersion() {
3711
3711
  const host2 = getHost();
3712
3712
  if (!host2) return null;
@@ -3762,7 +3762,7 @@ function detectActiveSessions() {
3762
3762
  function detectInstallSource() {
3763
3763
  try {
3764
3764
  const resolved = realpathSync(process.argv[1] ?? "");
3765
- if (resolved.includes("/linuxbrew/") || resolved.includes("/homebrew/") || resolved.includes("/Cellar/")) {
3765
+ if (/\/Cellar\/[^/]+\//.test(resolved)) {
3766
3766
  return "brew";
3767
3767
  }
3768
3768
  } catch {
@@ -3773,20 +3773,30 @@ function performUpdate(version) {
3773
3773
  const source = detectInstallSource();
3774
3774
  if (source === "brew") {
3775
3775
  try {
3776
- execSync("brew upgrade integrity-labs/tap/agt", { stdio: "inherit" });
3777
- } catch {
3776
+ execFileSync("brew", ["upgrade", "integrity-labs/tap/agt"], { stdio: "inherit" });
3777
+ return;
3778
+ } catch (err) {
3779
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
3780
+ if (!isRoot) throw err;
3778
3781
  const cellarOwner = detectBrewOwner();
3779
- if (cellarOwner) {
3780
- execSync(`sudo -u ${cellarOwner} -H bash -c 'brew tap integrity-labs/tap 2>/dev/null || true; brew upgrade integrity-labs/tap/agt'`, { stdio: "inherit" });
3781
- } else {
3782
- throw new Error("brew upgrade failed and no brew owner detected");
3783
- }
3782
+ if (!cellarOwner) throw err;
3783
+ execFileSync("sudo", [
3784
+ "-u",
3785
+ cellarOwner,
3786
+ "-H",
3787
+ "bash",
3788
+ "-c",
3789
+ "brew tap integrity-labs/tap 2>/dev/null || true; brew upgrade integrity-labs/tap/agt"
3790
+ ], { stdio: "inherit" });
3784
3791
  }
3785
3792
  return;
3786
3793
  }
3787
- execSync(`npm install -g @integrity-labs/agt-cli@${version} --registry=https://registry.npmjs.org`, {
3788
- stdio: "inherit"
3789
- });
3794
+ execFileSync("npm", [
3795
+ "install",
3796
+ "-g",
3797
+ `@integrity-labs/agt-cli@${version}`,
3798
+ "--registry=https://registry.npmjs.org"
3799
+ ], { stdio: "inherit" });
3790
3800
  }
3791
3801
  function detectBrewOwner() {
3792
3802
  for (const prefix of ["/home/linuxbrew/.linuxbrew", "/opt/homebrew", "/usr/local"]) {
@@ -4145,7 +4155,7 @@ function handleError(err) {
4145
4155
  }
4146
4156
 
4147
4157
  // src/bin/agt.ts
4148
- var cliVersion2 = true ? "0.10.19" : "dev";
4158
+ var cliVersion2 = true ? "0.10.21" : "dev";
4149
4159
  var program = new Command();
4150
4160
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
4151
4161
  program.hook("preAction", (thisCommand) => {