@integrity-labs/agt-cli 0.27.40 → 0.27.42

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
@@ -27,7 +27,7 @@ import {
27
27
  success,
28
28
  table,
29
29
  warn
30
- } from "../chunk-YYUWW6CQ.js";
30
+ } from "../chunk-ZPBDGI7P.js";
31
31
  import {
32
32
  CHANNEL_REGISTRY,
33
33
  DEPLOYMENT_TEMPLATES,
@@ -2319,6 +2319,10 @@ async function impersonateExitCommand() {
2319
2319
  else info("No active impersonation to exit.");
2320
2320
  return;
2321
2321
  }
2322
+ await performImpersonateExit(manifest, { json, silent: false });
2323
+ }
2324
+ async function performImpersonateExit(manifest, opts) {
2325
+ const { json, silent } = opts;
2322
2326
  let stopOk = true;
2323
2327
  let stopDetail = null;
2324
2328
  try {
@@ -2376,6 +2380,7 @@ async function impersonateExitCommand() {
2376
2380
  }
2377
2381
  }
2378
2382
  clearActiveManifest();
2383
+ if (silent) return;
2379
2384
  if (json) {
2380
2385
  jsonOutput({
2381
2386
  ok: true,
@@ -2396,6 +2401,26 @@ async function impersonateExitCommand() {
2396
2401
  }
2397
2402
  info("Restart Claude Code to pick up your original persona.");
2398
2403
  }
2404
+ async function autoExitExpiredImpersonation() {
2405
+ let manifest;
2406
+ try {
2407
+ manifest = readActiveManifest();
2408
+ } catch {
2409
+ return;
2410
+ }
2411
+ if (!manifest || !isExpired(manifest)) return;
2412
+ try {
2413
+ if (!isJsonMode()) {
2414
+ console.error(
2415
+ chalk10.cyan(
2416
+ `\u2139 Impersonation session for ${manifest.code_name} expired \u2014 auto-exiting and restoring your files.`
2417
+ )
2418
+ );
2419
+ }
2420
+ await performImpersonateExit(manifest, { json: isJsonMode(), silent: true });
2421
+ } catch {
2422
+ }
2423
+ }
2399
2424
  async function impersonateIntroduceCommand() {
2400
2425
  try {
2401
2426
  const manifest = readActiveManifest();
@@ -4662,7 +4687,7 @@ import { execFileSync, execSync } from "child_process";
4662
4687
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4663
4688
  import chalk18 from "chalk";
4664
4689
  import ora16 from "ora";
4665
- var cliVersion = true ? "0.27.40" : "dev";
4690
+ var cliVersion = true ? "0.27.42" : "dev";
4666
4691
  async function fetchLatestVersion() {
4667
4692
  const host2 = getHost();
4668
4693
  if (!host2) return null;
@@ -5335,14 +5360,20 @@ function handleError(err) {
5335
5360
  }
5336
5361
 
5337
5362
  // src/bin/agt.ts
5338
- var cliVersion2 = true ? "0.27.40" : "dev";
5363
+ var cliVersion2 = true ? "0.27.42" : "dev";
5339
5364
  var program = new Command();
5340
5365
  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");
5341
- program.hook("preAction", (thisCommand) => {
5366
+ program.hook("preAction", async (thisCommand, actionCommand) => {
5342
5367
  const root = thisCommand.optsWithGlobals();
5343
5368
  if (root.json) {
5344
5369
  setJsonMode(true);
5345
5370
  }
5371
+ const segs = [];
5372
+ for (let c = actionCommand; c && c.parent; c = c.parent) segs.unshift(c.name());
5373
+ const cmdPath = segs.join(" ");
5374
+ if (cmdPath !== "impersonate introduce" && cmdPath !== "impersonate exit") {
5375
+ await autoExitExpiredImpersonation();
5376
+ }
5346
5377
  });
5347
5378
  program.command("whoami").description("Show the authenticated host, team, and user from AGT_API_KEY").action(whoamiCommand);
5348
5379
  program.command("setup <token>").description("One-command host setup: exchange provisioning token, configure env vars, verify, and start manager").option(
@@ -5461,5 +5492,8 @@ if (!skipUpdateCheck) {
5461
5492
  checkForUpdateOnStartup().catch(() => {
5462
5493
  });
5463
5494
  }
5464
- program.parse();
5495
+ program.parseAsync().catch((err) => {
5496
+ console.error(err instanceof Error ? err.message : String(err));
5497
+ process.exitCode = 1;
5498
+ });
5465
5499
  //# sourceMappingURL=agt.js.map