@integrity-labs/agt-cli 0.10.18 → 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,10 +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
+ import { existsSync as existsSync5, realpathSync } from "fs";
3706
3707
  import chalk20 from "chalk";
3707
3708
  import ora15 from "ora";
3708
- var cliVersion = true ? "0.10.18" : "dev";
3709
+ var cliVersion = true ? "0.10.21" : "dev";
3709
3710
  async function fetchLatestVersion() {
3710
3711
  const host2 = getHost();
3711
3712
  if (!host2) return null;
@@ -3758,10 +3759,55 @@ function detectActiveSessions() {
3758
3759
  }
3759
3760
  return { managerPid, tmuxSessions };
3760
3761
  }
3762
+ function detectInstallSource() {
3763
+ try {
3764
+ const resolved = realpathSync(process.argv[1] ?? "");
3765
+ if (/\/Cellar\/[^/]+\//.test(resolved)) {
3766
+ return "brew";
3767
+ }
3768
+ } catch {
3769
+ }
3770
+ return "npm";
3771
+ }
3761
3772
  function performUpdate(version) {
3762
- execSync(`npm install -g @integrity-labs/agt-cli@${version} --registry=https://npm.pkg.github.com`, {
3763
- stdio: "inherit"
3764
- });
3773
+ const source = detectInstallSource();
3774
+ if (source === "brew") {
3775
+ try {
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;
3781
+ const cellarOwner = detectBrewOwner();
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" });
3791
+ }
3792
+ return;
3793
+ }
3794
+ execFileSync("npm", [
3795
+ "install",
3796
+ "-g",
3797
+ `@integrity-labs/agt-cli@${version}`,
3798
+ "--registry=https://registry.npmjs.org"
3799
+ ], { stdio: "inherit" });
3800
+ }
3801
+ function detectBrewOwner() {
3802
+ for (const prefix of ["/home/linuxbrew/.linuxbrew", "/opt/homebrew", "/usr/local"]) {
3803
+ const cellar = `${prefix}/Cellar`;
3804
+ if (!existsSync5(cellar)) continue;
3805
+ try {
3806
+ return execSync(`stat -c %U "${cellar}" 2>/dev/null || stat -f %Su "${cellar}"`, { encoding: "utf-8" }).trim() || null;
3807
+ } catch {
3808
+ }
3809
+ }
3810
+ return null;
3765
3811
  }
3766
3812
  async function updateCommand(opts = {}) {
3767
3813
  const json = isJsonMode();
@@ -3858,7 +3904,12 @@ async function updateCommand(opts = {}) {
3858
3904
  });
3859
3905
  } else {
3860
3906
  error(`Failed to install update: ${err.message}`);
3861
- info(`You can manually update with: npm install -g @integrity-labs/agt-cli@${versionInfo.latest} --registry=https://npm.pkg.github.com`);
3907
+ const source = detectInstallSource();
3908
+ if (source === "brew") {
3909
+ info(`You can manually update with: brew upgrade integrity-labs/tap/agt`);
3910
+ } else {
3911
+ info(`You can manually update with: sudo npm install -g @integrity-labs/agt-cli@${versionInfo.latest}`);
3912
+ }
3862
3913
  }
3863
3914
  process.exitCode = 1;
3864
3915
  }
@@ -4104,7 +4155,7 @@ function handleError(err) {
4104
4155
  }
4105
4156
 
4106
4157
  // src/bin/agt.ts
4107
- var cliVersion2 = true ? "0.10.18" : "dev";
4158
+ var cliVersion2 = true ? "0.10.21" : "dev";
4108
4159
  var program = new Command();
4109
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");
4110
4161
  program.hook("preAction", (thisCommand) => {