@integrity-labs/agt-cli 0.19.10 → 0.19.12

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
@@ -50,7 +50,7 @@ import {
50
50
  success,
51
51
  table,
52
52
  warn
53
- } from "../chunk-VL4VCDEN.js";
53
+ } from "../chunk-N6PGVBYF.js";
54
54
 
55
55
  // src/bin/agt.ts
56
56
  import { join as join10 } from "path";
@@ -3734,7 +3734,7 @@ import { execFileSync, execSync } from "child_process";
3734
3734
  import { existsSync as existsSync5, realpathSync } from "fs";
3735
3735
  import chalk17 from "chalk";
3736
3736
  import ora15 from "ora";
3737
- var cliVersion = true ? "0.19.10" : "dev";
3737
+ var cliVersion = true ? "0.19.12" : "dev";
3738
3738
  async function fetchLatestVersion() {
3739
3739
  const host2 = getHost();
3740
3740
  if (!host2) return null;
@@ -4192,7 +4192,7 @@ function handleError(err) {
4192
4192
  }
4193
4193
 
4194
4194
  // src/bin/agt.ts
4195
- var cliVersion2 = true ? "0.19.10" : "dev";
4195
+ var cliVersion2 = true ? "0.19.12" : "dev";
4196
4196
  var program = new Command();
4197
4197
  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");
4198
4198
  program.hook("preAction", (thisCommand) => {
@@ -3274,6 +3274,9 @@ function buildRemoteMcpEntry(definitionId) {
3274
3274
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
3275
3275
  var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
3276
3276
  var SECRET_FILE_MODE = 384;
3277
+ function shellQuote(value) {
3278
+ return `'${value.replace(/'/g, `'\\''`)}'`;
3279
+ }
3277
3280
  function assertValidCodeName(codeName) {
3278
3281
  if (!VALID_CODE_NAME.test(codeName)) {
3279
3282
  throw new Error(`Invalid agent code_name: "${codeName}". Must be kebab-case.`);
@@ -3365,6 +3368,24 @@ function syncMcpToProject(codeName) {
3365
3368
  } catch {
3366
3369
  }
3367
3370
  }
3371
+ function readExistingMcpEnvVar(codeName, serverId, envKey) {
3372
+ const mcpJsonPath = join4(getAgentDir(codeName), "provision", ".mcp.json");
3373
+ try {
3374
+ const raw = readFileSync4(mcpJsonPath, "utf-8");
3375
+ const config = JSON.parse(raw);
3376
+ const server = config.mcpServers?.[serverId];
3377
+ if (!server || typeof server !== "object")
3378
+ return void 0;
3379
+ const env2 = server.env;
3380
+ const value = env2?.[envKey];
3381
+ if (typeof value !== "string" || value === "" || value === `\${${envKey}}`) {
3382
+ return void 0;
3383
+ }
3384
+ return value;
3385
+ } catch {
3386
+ return void 0;
3387
+ }
3388
+ }
3368
3389
  function deployArtifactsToProject(codeName, provisionDir) {
3369
3390
  const projectDir = getProjectDir(codeName);
3370
3391
  mkdirSync4(projectDir, { recursive: true });
@@ -4189,11 +4210,11 @@ ${sections}`
4189
4210
  if (!p.api_key)
4190
4211
  continue;
4191
4212
  const providerEnvPrefix = p.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_");
4192
- envLines.push(`${providerEnvPrefix}_API_KEY=${p.api_key}`);
4213
+ envLines.push(`${providerEnvPrefix}_API_KEY=${shellQuote(p.api_key)}`);
4193
4214
  const rawBaseUrl = p.metadata["base_url"];
4194
4215
  const baseUrl = typeof rawBaseUrl === "string" ? rawBaseUrl.trim() : "";
4195
4216
  if (baseUrl.length > 0) {
4196
- envLines.push(`${providerEnvPrefix}_BASE_URL=${baseUrl}`);
4217
+ envLines.push(`${providerEnvPrefix}_BASE_URL=${shellQuote(baseUrl)}`);
4197
4218
  }
4198
4219
  }
4199
4220
  if (envLines.length > 1) {
@@ -4455,12 +4476,12 @@ ${sections}`
4455
4476
  if (integration.auth_type === "oauth2") {
4456
4477
  const accessToken = creds.access_token;
4457
4478
  if (accessToken) {
4458
- envLines.push(`${prefix}_ACCESS_TOKEN=${accessToken}`);
4479
+ envLines.push(`${prefix}_ACCESS_TOKEN=${shellQuote(accessToken)}`);
4459
4480
  }
4460
4481
  } else if (integration.auth_type === "api_key") {
4461
4482
  const apiKey = creds.api_key;
4462
4483
  if (apiKey) {
4463
- envLines.push(`${prefix}_API_KEY=${apiKey}`);
4484
+ envLines.push(`${prefix}_API_KEY=${shellQuote(apiKey)}`);
4464
4485
  }
4465
4486
  }
4466
4487
  if (integration.config) {
@@ -4469,7 +4490,7 @@ ${sections}`
4469
4490
  if (typeof value === "string" && value) {
4470
4491
  const upperKey = key.toUpperCase();
4471
4492
  const envKey = upperKey.startsWith(`${prefix}_`) ? upperKey : `${prefix}_${upperKey}`;
4472
- envLines.push(`${envKey}=${value}`);
4493
+ envLines.push(`${envKey}=${shellQuote(value)}`);
4473
4494
  }
4474
4495
  }
4475
4496
  }
@@ -4508,12 +4529,14 @@ ${sections}`
4508
4529
  }
4509
4530
  const hasCloudBroker = integrations.some((i) => i.definition_id === "cloud-broker");
4510
4531
  if (hasCloudBroker) {
4532
+ const existingAgentId = readExistingMcpEnvVar(codeName, "cloud-broker", "AGT_AGENT_ID");
4511
4533
  this.writeMcpServer(codeName, "cloud-broker", {
4512
4534
  command: "npx",
4513
4535
  args: ["-y", "@integrity-labs/cloud-broker@latest"],
4514
4536
  env: {
4515
4537
  AGT_HOST: "${AGT_HOST}",
4516
4538
  AGT_API_KEY: "${AGT_API_KEY}",
4539
+ AGT_AGENT_ID: existingAgentId ?? "${AGT_AGENT_ID}",
4517
4540
  PATH: process.env["PATH"] ?? "",
4518
4541
  HOME: process.env["HOME"] ?? ""
4519
4542
  }
@@ -8204,4 +8227,4 @@ export {
8204
8227
  managerInstallSystemUnitCommand,
8205
8228
  managerUninstallSystemUnitCommand
8206
8229
  };
8207
- //# sourceMappingURL=chunk-VL4VCDEN.js.map
8230
+ //# sourceMappingURL=chunk-N6PGVBYF.js.map