@integrity-labs/agt-cli 0.10.18 → 0.10.19

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
@@ -3703,9 +3703,10 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
3703
3703
 
3704
3704
  // src/commands/update.ts
3705
3705
  import { 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.19" : "dev";
3709
3710
  async function fetchLatestVersion() {
3710
3711
  const host2 = getHost();
3711
3712
  if (!host2) return null;
@@ -3758,11 +3759,46 @@ 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 (resolved.includes("/linuxbrew/") || resolved.includes("/homebrew/") || resolved.includes("/Cellar/")) {
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`, {
3773
+ const source = detectInstallSource();
3774
+ if (source === "brew") {
3775
+ try {
3776
+ execSync("brew upgrade integrity-labs/tap/agt", { stdio: "inherit" });
3777
+ } catch {
3778
+ 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
+ }
3784
+ }
3785
+ return;
3786
+ }
3787
+ execSync(`npm install -g @integrity-labs/agt-cli@${version} --registry=https://registry.npmjs.org`, {
3763
3788
  stdio: "inherit"
3764
3789
  });
3765
3790
  }
3791
+ function detectBrewOwner() {
3792
+ for (const prefix of ["/home/linuxbrew/.linuxbrew", "/opt/homebrew", "/usr/local"]) {
3793
+ const cellar = `${prefix}/Cellar`;
3794
+ if (!existsSync5(cellar)) continue;
3795
+ try {
3796
+ return execSync(`stat -c %U "${cellar}" 2>/dev/null || stat -f %Su "${cellar}"`, { encoding: "utf-8" }).trim() || null;
3797
+ } catch {
3798
+ }
3799
+ }
3800
+ return null;
3801
+ }
3766
3802
  async function updateCommand(opts = {}) {
3767
3803
  const json = isJsonMode();
3768
3804
  const spinner = ora15({ text: "Checking for updates\u2026", isSilent: json });
@@ -3858,7 +3894,12 @@ async function updateCommand(opts = {}) {
3858
3894
  });
3859
3895
  } else {
3860
3896
  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`);
3897
+ const source = detectInstallSource();
3898
+ if (source === "brew") {
3899
+ info(`You can manually update with: brew upgrade integrity-labs/tap/agt`);
3900
+ } else {
3901
+ info(`You can manually update with: sudo npm install -g @integrity-labs/agt-cli@${versionInfo.latest}`);
3902
+ }
3862
3903
  }
3863
3904
  process.exitCode = 1;
3864
3905
  }
@@ -4104,7 +4145,7 @@ function handleError(err) {
4104
4145
  }
4105
4146
 
4106
4147
  // src/bin/agt.ts
4107
- var cliVersion2 = true ? "0.10.18" : "dev";
4148
+ var cliVersion2 = true ? "0.10.19" : "dev";
4108
4149
  var program = new Command();
4109
4150
  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
4151
  program.hook("preAction", (thisCommand) => {