@integrity-labs/agt-cli 0.27.13 → 0.27.14

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ApiError,
4
- DEFAULT_AGT_HOST,
4
+ PROD_AGT_HOST,
5
5
  api,
6
6
  error,
7
7
  exchangeApiKey,
@@ -27,7 +27,7 @@ import {
27
27
  success,
28
28
  table,
29
29
  warn
30
- } from "../chunk-Q4MWFZ5Y.js";
30
+ } from "../chunk-HKZFMGYE.js";
31
31
  import {
32
32
  CHANNEL_REGISTRY,
33
33
  DEPLOYMENT_TEMPLATES,
@@ -53,7 +53,7 @@ import {
53
53
  renderTemplate,
54
54
  resolveChannels,
55
55
  serializeManifestForSlackCli
56
- } from "../chunk-YSBGIXJG.js";
56
+ } from "../chunk-HT6EETEL.js";
57
57
 
58
58
  // src/bin/agt.ts
59
59
  import { join as join15 } from "path";
@@ -2097,7 +2097,7 @@ async function impersonateConnectCommand(token, options = {}) {
2097
2097
  isSilent: json
2098
2098
  });
2099
2099
  spinner.start();
2100
- const host2 = (options.apiHost ?? DEFAULT_AGT_HOST).replace(/\/+$/, "");
2100
+ const host2 = (options.apiHost ?? PROD_AGT_HOST).replace(/\/+$/, "");
2101
2101
  let bundle;
2102
2102
  try {
2103
2103
  const res = await fetch(`${host2}/impersonate/agent/redeem`, {
@@ -3956,7 +3956,7 @@ function buildExportLines(shell, apiUrl, apiKey, consoleUrl) {
3956
3956
  lines.push("");
3957
3957
  return lines.join("\n");
3958
3958
  }
3959
- async function setupCommand(token) {
3959
+ async function setupCommand(token, options = {}) {
3960
3960
  const json = isJsonMode();
3961
3961
  const shortTokenPattern = /^[A-HJ-NP-Z2-9]{4}-[A-HJ-NP-Z2-9]{4}$/i;
3962
3962
  const legacyTokenPattern = /^prov_[a-f0-9]{64}$/i;
@@ -3971,11 +3971,24 @@ async function setupCommand(token) {
3971
3971
  return;
3972
3972
  }
3973
3973
  const normalizedToken = shortTokenPattern.test(token) ? token.toUpperCase() : token.toLowerCase();
3974
- let apiUrl = process.env["AGT_HOST"];
3974
+ const apiHostFlag = options.apiHost?.trim();
3975
+ const envHost = process.env["AGT_HOST"]?.trim();
3976
+ const apiUrl = apiHostFlag || envHost;
3975
3977
  if (!apiUrl) {
3976
- apiUrl = "https://api.augmented.team";
3977
- if (!json) {
3978
- info(`No AGT_HOST set \u2014 using default: ${chalk16.bold(apiUrl)}`);
3978
+ const msg = "Cannot determine API host for token exchange. Pass --api-host <url> or set AGT_HOST before running `agt setup`.\n Production: --api-host https://api.augmented.team\n Non-prod stage: --api-host https://<stage>.api.staging.augmented.team\n Local development: --api-host http://api.agt.localhost:1355";
3979
+ if (json) {
3980
+ jsonOutput({ ok: false, error: msg });
3981
+ } else {
3982
+ error(msg);
3983
+ }
3984
+ process.exitCode = 1;
3985
+ return;
3986
+ }
3987
+ if (!json) {
3988
+ if (apiHostFlag) {
3989
+ info(`Exchanging token against ${chalk16.bold(apiUrl)} (from --api-host)`);
3990
+ } else {
3991
+ info(`Exchanging token against ${chalk16.bold(apiUrl)} (from AGT_HOST)`);
3979
3992
  }
3980
3993
  }
3981
3994
  const spinner = ora14({ text: "Exchanging provisioning token\u2026", isSilent: json });
@@ -4630,7 +4643,7 @@ import { execFileSync, execSync } from "child_process";
4630
4643
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4631
4644
  import chalk18 from "chalk";
4632
4645
  import ora16 from "ora";
4633
- var cliVersion = true ? "0.27.13" : "dev";
4646
+ var cliVersion = true ? "0.27.14" : "dev";
4634
4647
  async function fetchLatestVersion() {
4635
4648
  const host2 = getHost();
4636
4649
  if (!host2) return null;
@@ -5162,7 +5175,7 @@ function handleError(err) {
5162
5175
  }
5163
5176
 
5164
5177
  // src/bin/agt.ts
5165
- var cliVersion2 = true ? "0.27.13" : "dev";
5178
+ var cliVersion2 = true ? "0.27.14" : "dev";
5166
5179
  var program = new Command();
5167
5180
  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");
5168
5181
  program.hook("preAction", (thisCommand) => {
@@ -5172,7 +5185,13 @@ program.hook("preAction", (thisCommand) => {
5172
5185
  }
5173
5186
  });
5174
5187
  program.command("whoami").description("Show the authenticated host, team, and user from AGT_API_KEY").action(whoamiCommand);
5175
- program.command("setup <token>").description("One-command host setup: exchange provisioning token, configure env vars, verify, and start manager").action(setupCommand);
5188
+ program.command("setup <token>").description("One-command host setup: exchange provisioning token, configure env vars, verify, and start manager").option(
5189
+ "--api-host <url>",
5190
+ // ENG-5831: required when AGT_HOST is not set in the shell — the setup
5191
+ // command no longer silently defaults to prod. Mirrors `agt impersonate
5192
+ // connect --api-host` (ENG-5773).
5193
+ "API host to exchange the provisioning token against. Takes precedence over AGT_HOST. Required when AGT_HOST is unset (e.g. https://test.api.staging.augmented.team for the test stage; https://api.augmented.team for prod)."
5194
+ ).action(setupCommand);
5176
5195
  var team = program.command("team").description("Manage teams");
5177
5196
  team.command("list").description("List teams you belong to").action(teamListCommand);
5178
5197
  team.command("create <name>").description("Create a new team and set it as active").action(teamCreateCommand);