@integrity-labs/agt-cli 0.26.2 → 0.27.0

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
@@ -26,7 +26,7 @@ import {
26
26
  success,
27
27
  table,
28
28
  warn
29
- } from "../chunk-4CESBZPM.js";
29
+ } from "../chunk-YWXPSVI5.js";
30
30
  import {
31
31
  CHANNEL_REGISTRY,
32
32
  DEPLOYMENT_TEMPLATES,
@@ -52,7 +52,7 @@ import {
52
52
  renderTemplate,
53
53
  resolveChannels,
54
54
  serializeManifestForSlackCli
55
- } from "../chunk-U3HCB23E.js";
55
+ } from "../chunk-BKLEFKUZ.js";
56
56
 
57
57
  // src/bin/agt.ts
58
58
  import { join as join12 } from "path";
@@ -1555,6 +1555,7 @@ async function provisionCommand(codeName, options) {
1555
1555
  // src/commands/impersonate.ts
1556
1556
  import chalk10 from "chalk";
1557
1557
  import ora10 from "ora";
1558
+ import { spawn } from "child_process";
1558
1559
  import { writeFileSync as writeFileSync5 } from "fs";
1559
1560
  import { join as join7 } from "path";
1560
1561
 
@@ -1737,9 +1738,10 @@ function lstatSafe(path) {
1737
1738
  var SWAP_FILES = ["CLAUDE.md", ".mcp.json"];
1738
1739
  var AGENT_IMPERSONATION_HEADER = "X-Agent-Impersonation";
1739
1740
  var REDEEM_TOKEN_RE = /^[A-HJ-NP-Z2-9]{4}-[A-HJ-NP-Z2-9]{4}$/i;
1740
- async function impersonateConnectCommand(token) {
1741
+ async function impersonateConnectCommand(token, options = {}) {
1741
1742
  requireImpersonateEnabled();
1742
1743
  const json = isJsonMode();
1744
+ const shouldLaunchClaude = !options.noLaunch && !json;
1743
1745
  if (!REDEEM_TOKEN_RE.test(token)) {
1744
1746
  const msg = "Token is not in the expected XXXX-XXXX format. Copy the full `agt impersonate connect <token>` command from the webapp.";
1745
1747
  if (json) jsonOutput({ ok: false, error: msg });
@@ -1853,11 +1855,41 @@ async function impersonateConnectCommand(token) {
1853
1855
  console.log(` Host: ${chalk10.dim(host2)}`);
1854
1856
  console.log(` Swapped: ${chalk10.dim(SWAP_FILES.join(", "))}`);
1855
1857
  console.log();
1856
- info(
1857
- "Restart Claude Code to pick up the agent's persona + MCP server set. Claude Code 2.1.152 does not honour `tools/list_changed` in-session (spike PoC, ENG-4733)."
1858
- );
1858
+ if (!shouldLaunchClaude) {
1859
+ info(
1860
+ "Restart Claude Code to pick up the agent's persona + MCP server set. Claude Code 2.1.152 does not honour `tools/list_changed` in-session (spike PoC, ENG-4733)."
1861
+ );
1862
+ console.log();
1863
+ info("When done: `agt impersonate exit`");
1864
+ return;
1865
+ }
1866
+ info("Launching Claude Code\u2026 (use `--no-launch` next time to skip)");
1867
+ console.log();
1868
+ await new Promise((resolve2) => {
1869
+ const child = spawn("claude", {
1870
+ stdio: "inherit",
1871
+ cwd: projectCwd
1872
+ });
1873
+ child.on("error", (err) => {
1874
+ if (err.code === "ENOENT") {
1875
+ error(
1876
+ `\`claude\` binary not found on PATH. Start Claude Code yourself from ${projectCwd}, or install the CLI from claude.ai/code.`
1877
+ );
1878
+ process.exitCode = 1;
1879
+ } else {
1880
+ error(`Failed to launch Claude Code: ${err.message}`);
1881
+ process.exitCode = 1;
1882
+ }
1883
+ resolve2();
1884
+ });
1885
+ child.on("exit", (code, signal) => {
1886
+ if (code !== null && code !== 0) process.exitCode = code;
1887
+ if (signal) process.exitCode = 130;
1888
+ resolve2();
1889
+ });
1890
+ });
1859
1891
  console.log();
1860
- info("When done: `agt impersonate exit`");
1892
+ info("When done: `agt impersonate exit` (still active).");
1861
1893
  }
1862
1894
  async function impersonateCurrentCommand() {
1863
1895
  requireImpersonateEnabled();
@@ -2454,7 +2486,7 @@ async function hostDecommissionCommand(hostName) {
2454
2486
  }
2455
2487
 
2456
2488
  // src/commands/host-pair.ts
2457
- import { spawn, spawnSync } from "child_process";
2489
+ import { spawn as spawn2, spawnSync } from "child_process";
2458
2490
  import chalk13 from "chalk";
2459
2491
  async function hostPairCommand(name, opts) {
2460
2492
  const teamSlug = requireTeam();
@@ -2535,7 +2567,7 @@ async function hostPairCommand(name, opts) {
2535
2567
  console.log();
2536
2568
  console.log(chalk13.dim("Exit the shell (Ctrl+D) when Claude Code reports successful login."));
2537
2569
  console.log();
2538
- const tunnel = spawn(
2570
+ const tunnel = spawn2(
2539
2571
  "aws",
2540
2572
  [
2541
2573
  "ssm",
@@ -2592,7 +2624,7 @@ function preflightAws() {
2592
2624
  }
2593
2625
  function runInteractive(cmd, args) {
2594
2626
  return new Promise((resolve2) => {
2595
- const child = spawn(cmd, args, { stdio: "inherit" });
2627
+ const child = spawn2(cmd, args, { stdio: "inherit" });
2596
2628
  child.on("exit", (code) => resolve2(code ?? 0));
2597
2629
  child.on("error", () => resolve2(1));
2598
2630
  });
@@ -3932,7 +3964,7 @@ function getAcpAgent(name) {
3932
3964
  }
3933
3965
 
3934
3966
  // ../../packages/core/dist/acp/client.js
3935
- import { spawn as spawn2 } from "child_process";
3967
+ import { spawn as spawn3 } from "child_process";
3936
3968
  function resolveAgentCommand(agentName) {
3937
3969
  const adapter = getAcpAgent(agentName);
3938
3970
  if (adapter) {
@@ -3948,7 +3980,7 @@ function resolveAgentCommand(agentName) {
3948
3980
  }
3949
3981
  async function runAcpx(args, options = {}) {
3950
3982
  return new Promise((resolve2) => {
3951
- const child = spawn2("acpx", args, {
3983
+ const child = spawn3("acpx", args, {
3952
3984
  cwd: options.cwd,
3953
3985
  stdio: ["pipe", "pipe", "pipe"],
3954
3986
  env: { ...process.env }
@@ -4151,7 +4183,7 @@ import { execFileSync, execSync } from "child_process";
4151
4183
  import { existsSync as existsSync7, realpathSync as realpathSync2 } from "fs";
4152
4184
  import chalk18 from "chalk";
4153
4185
  import ora16 from "ora";
4154
- var cliVersion = true ? "0.26.2" : "dev";
4186
+ var cliVersion = true ? "0.27.0" : "dev";
4155
4187
  async function fetchLatestVersion() {
4156
4188
  const host2 = getHost();
4157
4189
  if (!host2) return null;
@@ -4683,7 +4715,7 @@ function handleError(err) {
4683
4715
  }
4684
4716
 
4685
4717
  // src/bin/agt.ts
4686
- var cliVersion2 = true ? "0.26.2" : "dev";
4718
+ var cliVersion2 = true ? "0.27.0" : "dev";
4687
4719
  var program = new Command();
4688
4720
  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");
4689
4721
  program.hook("preAction", (thisCommand) => {
@@ -4702,8 +4734,18 @@ var impersonate = program.command("impersonate").description(
4702
4734
  "Operate as a managed agent locally (experimental, gated by AGT_IMPERSONATE_ENABLED)"
4703
4735
  );
4704
4736
  impersonate.command("connect <token>").description(
4705
- "Redeem a XXXX-XXXX token from the webapp, render the agent's CLAUDE.md + .mcp.json, and symlink them into the current project"
4706
- ).action(impersonateConnectCommand);
4737
+ "Redeem a XXXX-XXXX token from the webapp, render the agent's CLAUDE.md + .mcp.json, swap them into the current project, and launch Claude Code (use --no-launch to skip the launch)"
4738
+ ).option(
4739
+ "--no-launch",
4740
+ "Skip launching Claude Code after the swap (operator manages their own session)"
4741
+ ).action(
4742
+ (token, opts) => (
4743
+ // Commander negates --no-FLAG into opts.flag, so --no-launch arrives
4744
+ // as opts.launch === false. Translate to the command's noLaunch
4745
+ // option, defaulting to launching when the flag isn't passed.
4746
+ impersonateConnectCommand(token, { noLaunch: opts.launch === false })
4747
+ )
4748
+ );
4707
4749
  impersonate.command("current").description('Print the active impersonation (or "none")').action(impersonateCurrentCommand);
4708
4750
  impersonate.command("exit").description("End the active impersonation, restore project files, and notify the server").action(impersonateExitCommand);
4709
4751
  program.command("init").description("Create a new agent (interactive wizard, or non-interactive with --name)").option("--name <display-name>", "Agent display name (triggers non-interactive mode)").option("--code-name <code-name>", "Agent code name (kebab-case, derived from --name if omitted)").option("--description <text>", "Short agent description").option("--env <environment>", "Environment: dev | stage | prod", "dev").option("--risk-tier <tier>", "Risk tier: Low | Medium | High", "Low").option("--budget-type <type>", "Budget type: tokens | dollars | both", "tokens").option("--budget-tokens <number>", "Token budget limit", "10000").option("--budget-dollars <number>", "Dollar budget limit", "10").option("--budget-window <window>", "Budget window: daily | weekly | monthly", "daily").option("--budget-enforcement <mode>", "Budget enforcement: block | throttle | alert | degrade", "block").option("--channels <list>", "Comma-separated channel IDs").option("--logging <mode>", "Logging mode: redacted | hash-only | full-local", "redacted").action(initCommand);