replicas-cli 0.2.584 → 0.2.586

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.
Files changed (2) hide show
  1. package/dist/index.cjs +451 -400
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -7362,10 +7362,10 @@ var require_dist = __commonJS({
7362
7362
  });
7363
7363
 
7364
7364
  // src/index.ts
7365
- var import_config21 = require("dotenv/config");
7365
+ var import_config22 = require("dotenv/config");
7366
7366
  var import_node_child_process2 = require("child_process");
7367
7367
  var import_commander = require("commander");
7368
- var import_chalk22 = __toESM(require("chalk"));
7368
+ var import_chalk23 = __toESM(require("chalk"));
7369
7369
 
7370
7370
  // src/commands/login.ts
7371
7371
  var import_http = __toESM(require("http"));
@@ -22696,6 +22696,17 @@ var PLANS = {
22696
22696
  var TEAM_PLAN = PLANS.team;
22697
22697
  var ENTERPRISE_PLAN = PLANS.enterprise;
22698
22698
 
22699
+ // ../shared/src/port.ts
22700
+ function isValidPort(port) {
22701
+ return Number.isInteger(port) && Number(port) >= 1 && Number(port) <= 65535;
22702
+ }
22703
+ function parsePort(port) {
22704
+ if (!/^\d+$/.test(port)) throw new Error("Port must be a number between 1 and 65535");
22705
+ const portNumber = Number(port);
22706
+ if (!isValidPort(portNumber)) throw new Error("Port must be a number between 1 and 65535");
22707
+ return portNumber;
22708
+ }
22709
+
22699
22710
  // ../shared/src/models-dev.ts
22700
22711
  var MODELS_DEV_CACHE_MS = 5 * 6e4;
22701
22712
  var modelsDevCatalogSchema = external_exports.record(external_exports.string(), external_exports.object({
@@ -24472,7 +24483,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
24472
24483
  });
24473
24484
 
24474
24485
  // ../shared/src/cli-version.ts
24475
- var CLI_VERSION = "0.2.584";
24486
+ var CLI_VERSION = "0.2.586";
24476
24487
 
24477
24488
  // ../shared/src/version.ts
24478
24489
  function compareVersions(v1, v2) {
@@ -25050,6 +25061,9 @@ var GITLAB_TRIGGER = {
25050
25061
  ]
25051
25062
  };
25052
25063
 
25064
+ // ../shared/src/routes/repo-files.ts
25065
+ var MAX_REPO_FILE_CONTENT_BYTES = 256 * 1024;
25066
+
25053
25067
  // ../shared/src/routes/admin.ts
25054
25068
  var WEBHOOK_PROVIDERS = ["linear", "github", "gitlab", "slack", "e2b", "stripe", "sentry"];
25055
25069
  var WEBHOOK_PROVIDER_SET = new Set(WEBHOOK_PROVIDERS);
@@ -27885,14 +27899,33 @@ var import_chalk6 = __toESM(require("chalk"));
27885
27899
  // src/lib/ssh.ts
27886
27900
  var import_child_process = require("child_process");
27887
27901
  var SSH_OPTIONS = ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"];
27888
- async function connectSSH(token, host, proxyCommand) {
27902
+ function buildSSHArgs(token, host, proxyCommand, localForward) {
27903
+ return [
27904
+ ...SSH_OPTIONS,
27905
+ ...proxyCommand ? ["-o", `ProxyCommand=${proxyCommand}`] : [],
27906
+ ...localForward ? [
27907
+ "-N",
27908
+ "-o",
27909
+ "ExitOnForwardFailure=yes",
27910
+ "-o",
27911
+ "ServerAliveInterval=30",
27912
+ "-L",
27913
+ `127.0.0.1:${localForward.localPort}:127.0.0.1:${localForward.remotePort}`
27914
+ ] : [],
27915
+ `${token}@${host}`
27916
+ ];
27917
+ }
27918
+ async function connectSSH(token, host, proxyCommand, localForward) {
27889
27919
  return new Promise((resolve2, reject) => {
27890
- const sshArgs = proxyCommand ? [...SSH_OPTIONS, "-o", `ProxyCommand=${proxyCommand}`, `${token}@${host}`] : [...SSH_OPTIONS, `${token}@${host}`];
27891
- const ssh = (0, import_child_process.spawn)("ssh", sshArgs, {
27920
+ const ssh = (0, import_child_process.spawn)("ssh", buildSSHArgs(token, host, proxyCommand, localForward), {
27892
27921
  stdio: "inherit"
27893
27922
  });
27894
- ssh.on("close", () => {
27895
- resolve2();
27923
+ ssh.on("close", (code) => {
27924
+ if (localForward && code) {
27925
+ reject(new Error(`SSH tunnel exited with code ${code}`));
27926
+ } else {
27927
+ resolve2();
27928
+ }
27896
27929
  });
27897
27930
  ssh.on("error", reject);
27898
27931
  });
@@ -28236,26 +28269,41 @@ Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28236
28269
  }
28237
28270
  }
28238
28271
 
28239
- // src/commands/org.ts
28272
+ // src/commands/tunnel.ts
28240
28273
  var import_chalk8 = __toESM(require("chalk"));
28274
+ async function tunnelCommand(workspaceName, options) {
28275
+ if (!isAuthenticated()) {
28276
+ throw new Error('Not logged in. Please run "replicas login" first.');
28277
+ }
28278
+ const remotePort = parsePort(options.port);
28279
+ const localPort = options.localPort ? parsePort(options.localPort) : remotePort;
28280
+ const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
28281
+ console.log(import_chalk8.default.green(`
28282
+ \u2713 Forwarding localhost:${localPort} to ${workspace.name}:${remotePort}`));
28283
+ console.log(import_chalk8.default.gray(" Press Ctrl+C to stop.\n"));
28284
+ await connectSSH(sshToken, sshHost, sshProxyCommand, { localPort, remotePort });
28285
+ }
28286
+
28287
+ // src/commands/org.ts
28288
+ var import_chalk9 = __toESM(require("chalk"));
28241
28289
  async function orgCommand() {
28242
28290
  if (!isAuthenticated()) {
28243
- console.log(import_chalk8.default.red('Not logged in. Please run "replicas login" first.'));
28291
+ console.log(import_chalk9.default.red('Not logged in. Please run "replicas login" first.'));
28244
28292
  process.exit(1);
28245
28293
  }
28246
28294
  try {
28247
28295
  const currentOrgId = getConfirmedOrganizationId();
28248
28296
  const organizations = await fetchOrganizations();
28249
28297
  if (!currentOrgId) {
28250
- console.log(import_chalk8.default.yellow("\n No organization selected."));
28251
- console.log(import_chalk8.default.gray(' Run "replicas org switch" to select one.\n'));
28298
+ console.log(import_chalk9.default.yellow("\n No organization selected."));
28299
+ console.log(import_chalk9.default.gray(' Run "replicas org switch" to select one.\n'));
28252
28300
  return;
28253
28301
  }
28254
28302
  const currentOrg = organizations.find((org2) => org2.id === currentOrgId);
28255
28303
  if (!currentOrg) {
28256
28304
  clearOrganizationId();
28257
- console.log(import_chalk8.default.yellow("\n The selected organization is no longer available to you."));
28258
- console.log(import_chalk8.default.gray(' Run "replicas org switch" to select another.\n'));
28305
+ console.log(import_chalk9.default.yellow("\n The selected organization is no longer available to you."));
28306
+ console.log(import_chalk9.default.gray(' Run "replicas org switch" to select another.\n'));
28259
28307
  return;
28260
28308
  }
28261
28309
  const [account, role] = await Promise.all([
@@ -28266,26 +28314,26 @@ async function orgCommand() {
28266
28314
  renderIdentity({ account, role, organizationName: currentOrg.name });
28267
28315
  if (organizations.length > 1) {
28268
28316
  console.log(
28269
- import_chalk8.default.gray(`
28317
+ import_chalk9.default.gray(`
28270
28318
  ${organizations.length} organizations available. "replicas org switch" to change.`)
28271
28319
  );
28272
28320
  }
28273
28321
  console.log();
28274
28322
  } catch (error51) {
28275
- console.error(import_chalk8.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28323
+ console.error(import_chalk9.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28276
28324
  process.exit(1);
28277
28325
  }
28278
28326
  }
28279
28327
  async function orgSwitchCommand() {
28280
28328
  if (!isAuthenticated()) {
28281
- console.log(import_chalk8.default.red('Not logged in. Please run "replicas login" first.'));
28329
+ console.log(import_chalk9.default.red('Not logged in. Please run "replicas login" first.'));
28282
28330
  process.exit(1);
28283
28331
  }
28284
28332
  try {
28285
28333
  const organizations = await fetchOrganizations();
28286
28334
  if (organizations.length === 0) {
28287
- console.log(import_chalk8.default.yellow("\n You are not a member of any organization."));
28288
- console.log(import_chalk8.default.gray(" Please contact support.\n"));
28335
+ console.log(import_chalk9.default.yellow("\n You are not a member of any organization."));
28336
+ console.log(import_chalk9.default.gray(" Please contact support.\n"));
28289
28337
  return;
28290
28338
  }
28291
28339
  const currentOrgId = getConfirmedOrganizationId();
@@ -28293,7 +28341,7 @@ async function orgSwitchCommand() {
28293
28341
  if (organizations.length > 1) {
28294
28342
  const chosen = await promptForOrganization(organizations, currentOrgId);
28295
28343
  if (!chosen) {
28296
- console.log(import_chalk8.default.yellow("\n Cancelled. The active organization is unchanged.\n"));
28344
+ console.log(import_chalk9.default.yellow("\n Cancelled. The active organization is unchanged.\n"));
28297
28345
  return;
28298
28346
  }
28299
28347
  selectedId = chosen.id;
@@ -28308,72 +28356,72 @@ async function orgSwitchCommand() {
28308
28356
  renderIdentity({ account, role, organizationName: selected?.name });
28309
28357
  console.log();
28310
28358
  } catch (error51) {
28311
- console.error(import_chalk8.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28359
+ console.error(import_chalk9.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28312
28360
  process.exit(1);
28313
28361
  }
28314
28362
  }
28315
28363
 
28316
28364
  // src/commands/config.ts
28317
- var import_chalk9 = __toESM(require("chalk"));
28365
+ var import_chalk10 = __toESM(require("chalk"));
28318
28366
  async function configGetCommand(key) {
28319
28367
  if (!isAuthenticated()) {
28320
- console.log(import_chalk9.default.red('Not logged in. Please run "replicas login" first.'));
28368
+ console.log(import_chalk10.default.red('Not logged in. Please run "replicas login" first.'));
28321
28369
  process.exit(1);
28322
28370
  }
28323
28371
  try {
28324
28372
  if (key === "ide") {
28325
28373
  const ideCommand = getIdeCommand();
28326
- console.log(import_chalk9.default.green(`
28374
+ console.log(import_chalk10.default.green(`
28327
28375
  IDE command: ${ideCommand}
28328
28376
  `));
28329
28377
  } else {
28330
- console.log(import_chalk9.default.red(`Unknown config key: ${key}`));
28331
- console.log(import_chalk9.default.gray("Available keys: ide"));
28378
+ console.log(import_chalk10.default.red(`Unknown config key: ${key}`));
28379
+ console.log(import_chalk10.default.gray("Available keys: ide"));
28332
28380
  process.exit(1);
28333
28381
  }
28334
28382
  } catch (error51) {
28335
- console.error(import_chalk9.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28383
+ console.error(import_chalk10.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28336
28384
  process.exit(1);
28337
28385
  }
28338
28386
  }
28339
28387
  async function configSetCommand(key, value) {
28340
28388
  if (!isAuthenticated()) {
28341
- console.log(import_chalk9.default.red('Not logged in. Please run "replicas login" first.'));
28389
+ console.log(import_chalk10.default.red('Not logged in. Please run "replicas login" first.'));
28342
28390
  process.exit(1);
28343
28391
  }
28344
28392
  try {
28345
28393
  if (key === "ide") {
28346
28394
  setIdeCommand(value);
28347
- console.log(import_chalk9.default.green(`
28395
+ console.log(import_chalk10.default.green(`
28348
28396
  \u2713 IDE command set to: ${value}
28349
28397
  `));
28350
28398
  } else {
28351
- console.log(import_chalk9.default.red(`Unknown config key: ${key}`));
28352
- console.log(import_chalk9.default.gray("Available keys: ide"));
28399
+ console.log(import_chalk10.default.red(`Unknown config key: ${key}`));
28400
+ console.log(import_chalk10.default.gray("Available keys: ide"));
28353
28401
  process.exit(1);
28354
28402
  }
28355
28403
  } catch (error51) {
28356
- console.error(import_chalk9.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28404
+ console.error(import_chalk10.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28357
28405
  process.exit(1);
28358
28406
  }
28359
28407
  }
28360
28408
  async function configListCommand() {
28361
28409
  if (!isAuthenticated()) {
28362
- console.log(import_chalk9.default.red('Not logged in. Please run "replicas login" first.'));
28410
+ console.log(import_chalk10.default.red('Not logged in. Please run "replicas login" first.'));
28363
28411
  process.exit(1);
28364
28412
  }
28365
28413
  try {
28366
28414
  const config3 = readConfig();
28367
28415
  if (!config3) {
28368
- console.log(import_chalk9.default.red("No config found. Please login first."));
28416
+ console.log(import_chalk10.default.red("No config found. Please login first."));
28369
28417
  process.exit(1);
28370
28418
  }
28371
- console.log(import_chalk9.default.green("\nCurrent configuration:"));
28372
- console.log(import_chalk9.default.gray(` Organization ID: ${config3.organization_id || "(not set)"}`));
28373
- console.log(import_chalk9.default.gray(` IDE command: ${config3.ide_command || "code (default)"}`));
28419
+ console.log(import_chalk10.default.green("\nCurrent configuration:"));
28420
+ console.log(import_chalk10.default.gray(` Organization ID: ${config3.organization_id || "(not set)"}`));
28421
+ console.log(import_chalk10.default.gray(` IDE command: ${config3.ide_command || "code (default)"}`));
28374
28422
  console.log();
28375
28423
  } catch (error51) {
28376
- console.error(import_chalk9.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28424
+ console.error(import_chalk10.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
28377
28425
  process.exit(1);
28378
28426
  }
28379
28427
  }
@@ -28535,7 +28583,7 @@ async function runCodexOAuthFlow(totalSteps) {
28535
28583
  }
28536
28584
 
28537
28585
  // src/lib/credential-upload.ts
28538
- var import_chalk10 = __toESM(require("chalk"));
28586
+ var import_chalk11 = __toESM(require("chalk"));
28539
28587
  var UPLOAD_STEPS = 1;
28540
28588
  async function withAuthRecovery(operation, afterReauthentication) {
28541
28589
  try {
@@ -28545,11 +28593,11 @@ async function withAuthRecovery(operation, afterReauthentication) {
28545
28593
  throw error51;
28546
28594
  }
28547
28595
  const message = error51 instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
28548
- console.log(import_chalk10.default.yellow(`
28596
+ console.log(import_chalk11.default.yellow(`
28549
28597
  ${message}`));
28550
28598
  await loginCommand();
28551
28599
  await afterReauthentication?.();
28552
- console.log(import_chalk10.default.gray(" Retrying..."));
28600
+ console.log(import_chalk11.default.gray(" Retrying..."));
28553
28601
  return { result: await operation(), reauthenticated: true };
28554
28602
  }
28555
28603
  }
@@ -28616,7 +28664,7 @@ async function runCredentialAuthFlow(options, flow) {
28616
28664
  const saved = reauthenticated || !target.organization ? await resolveAuthFlowTarget(identity) : target;
28617
28665
  renderAuthFlowSuccess(providerLabel, response, saved);
28618
28666
  } catch (error51) {
28619
- console.log(import_chalk10.default.red("\n \u2717 Error:"), error51 instanceof Error ? error51.message : error51);
28667
+ console.log(import_chalk11.default.red("\n \u2717 Error:"), error51 instanceof Error ? error51.message : error51);
28620
28668
  process.exit(1);
28621
28669
  }
28622
28670
  }
@@ -28641,7 +28689,7 @@ async function codexAuthCommand(options = {}) {
28641
28689
 
28642
28690
  // src/lib/claude-oauth.ts
28643
28691
  var import_readline = __toESM(require("readline"));
28644
- var import_chalk11 = __toESM(require("chalk"));
28692
+ var import_chalk12 = __toESM(require("chalk"));
28645
28693
  var DEFAULT_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
28646
28694
  var CLAUDE_CLIENT_ID = process.env.CLAUDE_OAUTH_CLIENT_ID || DEFAULT_CLIENT_ID;
28647
28695
  var AUTHORIZATION_ENDPOINT2 = "https://claude.ai/oauth/authorize";
@@ -28670,7 +28718,7 @@ async function promptForAuthorizationCode() {
28670
28718
  const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
28671
28719
  return new Promise((resolve2) => {
28672
28720
  rl.on("close", () => resolve2(""));
28673
- rl.question(import_chalk11.default.gray(" Paste code here: "), (answer) => {
28721
+ rl.question(import_chalk12.default.gray(" Paste code here: "), (answer) => {
28674
28722
  resolve2(answer.trim());
28675
28723
  rl.close();
28676
28724
  });
@@ -28772,7 +28820,7 @@ async function claudeAuthCommand(options = {}) {
28772
28820
  }
28773
28821
 
28774
28822
  // src/commands/init.ts
28775
- var import_chalk12 = __toESM(require("chalk"));
28823
+ var import_chalk13 = __toESM(require("chalk"));
28776
28824
  var import_fs3 = __toESM(require("fs"));
28777
28825
  var import_path4 = __toESM(require("path"));
28778
28826
  function getDefaultConfig() {
@@ -28804,11 +28852,11 @@ function initCommand(options) {
28804
28852
  const existingPath = import_path4.default.join(process.cwd(), filename);
28805
28853
  if (import_fs3.default.existsSync(existingPath) && !options.force) {
28806
28854
  console.log(
28807
- import_chalk12.default.yellow(
28855
+ import_chalk13.default.yellow(
28808
28856
  `${filename} already exists in this directory.`
28809
28857
  )
28810
28858
  );
28811
- console.log(import_chalk12.default.gray("Use --force to overwrite the existing file."));
28859
+ console.log(import_chalk13.default.gray("Use --force to overwrite the existing file."));
28812
28860
  return;
28813
28861
  }
28814
28862
  }
@@ -28821,31 +28869,31 @@ function initCommand(options) {
28821
28869
  }
28822
28870
  try {
28823
28871
  import_fs3.default.writeFileSync(configPath, configContent, "utf-8");
28824
- console.log(import_chalk12.default.green(`\u2713 Created ${targetFilename}`));
28872
+ console.log(import_chalk13.default.green(`\u2713 Created ${targetFilename}`));
28825
28873
  for (const filename of REPLICAS_CONFIG_FILENAMES) {
28826
28874
  if (filename === targetFilename) break;
28827
28875
  const higherPath = import_path4.default.join(process.cwd(), filename);
28828
28876
  if (import_fs3.default.existsSync(higherPath)) {
28829
28877
  console.log("");
28830
28878
  console.log(
28831
- import_chalk12.default.yellow(
28879
+ import_chalk13.default.yellow(
28832
28880
  `Warning: ${filename} already exists and takes priority over ${targetFilename}.`
28833
28881
  )
28834
28882
  );
28835
- console.log(import_chalk12.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
28883
+ console.log(import_chalk13.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
28836
28884
  }
28837
28885
  }
28838
28886
  console.log("");
28839
- console.log(import_chalk12.default.gray("Configuration options:"));
28887
+ console.log(import_chalk13.default.gray("Configuration options:"));
28840
28888
  console.log(
28841
- import_chalk12.default.gray(" systemPrompt - Custom instructions for AI coding assistants")
28889
+ import_chalk13.default.gray(" systemPrompt - Custom instructions for AI coding assistants")
28842
28890
  );
28843
28891
  console.log(
28844
- import_chalk12.default.gray(" startHook - Commands to run on workspace startup")
28892
+ import_chalk13.default.gray(" startHook - Commands to run on workspace startup")
28845
28893
  );
28846
28894
  if (!isYaml) {
28847
28895
  console.log("");
28848
- console.log(import_chalk12.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
28896
+ console.log(import_chalk13.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
28849
28897
  }
28850
28898
  } catch (error51) {
28851
28899
  throw new Error(
@@ -28855,7 +28903,7 @@ function initCommand(options) {
28855
28903
  }
28856
28904
 
28857
28905
  // src/lib/version-check.ts
28858
- var import_chalk13 = __toESM(require("chalk"));
28906
+ var import_chalk14 = __toESM(require("chalk"));
28859
28907
  var VERSION_CHECK_TIMEOUT = 2e3;
28860
28908
  function startUpdateCheck(currentVersion) {
28861
28909
  let notice = null;
@@ -28876,7 +28924,7 @@ function startUpdateCheck(currentVersion) {
28876
28924
  }
28877
28925
  const latestVersion = payload.version;
28878
28926
  if (compareVersions(latestVersion, currentVersion) > 0) {
28879
- notice = import_chalk13.default.dim(
28927
+ notice = import_chalk14.default.dim(
28880
28928
  `
28881
28929
  Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm install -g replicas-cli@latest
28882
28930
  `
@@ -28888,7 +28936,7 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
28888
28936
  }
28889
28937
 
28890
28938
  // src/commands/replica.ts
28891
- var import_chalk14 = __toESM(require("chalk"));
28939
+ var import_chalk15 = __toESM(require("chalk"));
28892
28940
  var import_prompts6 = __toESM(require("prompts"));
28893
28941
  var CLI_CODING_AGENT_LABEL = getCodingAgentDisplayNames();
28894
28942
  function parseReplicaAgent(value) {
@@ -28897,15 +28945,15 @@ function parseReplicaAgent(value) {
28897
28945
  if (isValidCodingAgentProvider(normalized)) {
28898
28946
  return normalized;
28899
28947
  }
28900
- console.log(import_chalk14.default.red(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`));
28948
+ console.log(import_chalk15.default.red(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`));
28901
28949
  process.exit(1);
28902
28950
  }
28903
28951
  function formatDate(dateString) {
28904
28952
  return new Date(dateString).toLocaleString();
28905
28953
  }
28906
28954
  function formatStatus(status) {
28907
- if (status === "active") return import_chalk14.default.green(status);
28908
- if (isWorkspaceSuspendedStatus(status)) return import_chalk14.default.gray(status);
28955
+ if (status === "active") return import_chalk15.default.green(status);
28956
+ if (isWorkspaceSuspendedStatus(status)) return import_chalk15.default.gray(status);
28909
28957
  return status;
28910
28958
  }
28911
28959
  function truncate(text, maxLength) {
@@ -28916,95 +28964,95 @@ function formatDisplayMessage(message) {
28916
28964
  const time3 = new Date(message.timestamp).toLocaleTimeString();
28917
28965
  switch (message.type) {
28918
28966
  case "user":
28919
- console.log(import_chalk14.default.blue(`
28967
+ console.log(import_chalk15.default.blue(`
28920
28968
  [${time3}] USER:`));
28921
- console.log(import_chalk14.default.white(` ${truncate(message.content, 500)}`));
28969
+ console.log(import_chalk15.default.white(` ${truncate(message.content, 500)}`));
28922
28970
  break;
28923
28971
  case "agent":
28924
- console.log(import_chalk14.default.green(`
28972
+ console.log(import_chalk15.default.green(`
28925
28973
  [${time3}] ASSISTANT:`));
28926
- console.log(import_chalk14.default.white(` ${truncate(message.content, 500)}`));
28974
+ console.log(import_chalk15.default.white(` ${truncate(message.content, 500)}`));
28927
28975
  break;
28928
28976
  case "reasoning":
28929
- console.log(import_chalk14.default.gray(`
28977
+ console.log(import_chalk15.default.gray(`
28930
28978
  [${time3}] THINKING:`));
28931
- console.log(import_chalk14.default.gray(` ${truncate(message.content, 300)}`));
28979
+ console.log(import_chalk15.default.gray(` ${truncate(message.content, 300)}`));
28932
28980
  break;
28933
28981
  case "command":
28934
- console.log(import_chalk14.default.magenta(`
28982
+ console.log(import_chalk15.default.magenta(`
28935
28983
  [${time3}] COMMAND:`));
28936
- console.log(import_chalk14.default.white(` $ ${message.command}`));
28984
+ console.log(import_chalk15.default.white(` $ ${message.command}`));
28937
28985
  if (message.output) {
28938
- console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
28986
+ console.log(import_chalk15.default.gray(` ${truncate(message.output, 200)}`));
28939
28987
  }
28940
28988
  if (message.exitCode !== void 0) {
28941
- const exitColor = message.exitCode === 0 ? import_chalk14.default.green : import_chalk14.default.red;
28989
+ const exitColor = message.exitCode === 0 ? import_chalk15.default.green : import_chalk15.default.red;
28942
28990
  console.log(exitColor(` Exit code: ${message.exitCode}`));
28943
28991
  }
28944
28992
  break;
28945
28993
  case "file_change":
28946
- console.log(import_chalk14.default.yellow(`
28994
+ console.log(import_chalk15.default.yellow(`
28947
28995
  [${time3}] FILE CHANGES:`));
28948
28996
  for (const change of message.changes) {
28949
28997
  const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
28950
- const color = change.kind === "add" ? import_chalk14.default.green : change.kind === "delete" ? import_chalk14.default.red : import_chalk14.default.yellow;
28998
+ const color = change.kind === "add" ? import_chalk15.default.green : change.kind === "delete" ? import_chalk15.default.red : import_chalk15.default.yellow;
28951
28999
  console.log(color(` ${icon} ${change.path}`));
28952
29000
  }
28953
29001
  break;
28954
29002
  case "patch":
28955
- console.log(import_chalk14.default.yellow(`
29003
+ console.log(import_chalk15.default.yellow(`
28956
29004
  [${time3}] PATCH:`));
28957
29005
  for (const op of message.operations) {
28958
29006
  const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
28959
- const color = op.action === "add" ? import_chalk14.default.green : op.action === "delete" ? import_chalk14.default.red : import_chalk14.default.yellow;
29007
+ const color = op.action === "add" ? import_chalk15.default.green : op.action === "delete" ? import_chalk15.default.red : import_chalk15.default.yellow;
28960
29008
  console.log(color(` ${icon} ${op.path}`));
28961
29009
  }
28962
29010
  break;
28963
29011
  case "tool_call":
28964
- console.log(import_chalk14.default.cyan(`
29012
+ console.log(import_chalk15.default.cyan(`
28965
29013
  [${time3}] TOOL: ${message.tool}`));
28966
29014
  if (message.output) {
28967
- console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
29015
+ console.log(import_chalk15.default.gray(` ${truncate(message.output, 200)}`));
28968
29016
  }
28969
29017
  break;
28970
29018
  case "web_search":
28971
- console.log(import_chalk14.default.cyan(`
29019
+ console.log(import_chalk15.default.cyan(`
28972
29020
  [${time3}] WEB SEARCH:`));
28973
- console.log(import_chalk14.default.white(` "${message.query}"`));
29021
+ console.log(import_chalk15.default.white(` "${message.query}"`));
28974
29022
  break;
28975
29023
  case "todo_list":
28976
- console.log(import_chalk14.default.blue(`
29024
+ console.log(import_chalk15.default.blue(`
28977
29025
  [${time3}] PLAN:`));
28978
29026
  for (const item of message.items) {
28979
- const icon = item.completed ? import_chalk14.default.green("[x]") : import_chalk14.default.gray("[ ]");
29027
+ const icon = item.completed ? import_chalk15.default.green("[x]") : import_chalk15.default.gray("[ ]");
28980
29028
  console.log(` ${icon} ${item.text}`);
28981
29029
  }
28982
29030
  break;
28983
29031
  case "subagent":
28984
- console.log(import_chalk14.default.magenta(`
29032
+ console.log(import_chalk15.default.magenta(`
28985
29033
  [${time3}] SUBAGENT: ${message.description}`));
28986
29034
  if (message.output) {
28987
- console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
29035
+ console.log(import_chalk15.default.gray(` ${truncate(message.output, 200)}`));
28988
29036
  }
28989
29037
  break;
28990
29038
  case "subagent_followup":
28991
- console.log(import_chalk14.default.magenta(`
29039
+ console.log(import_chalk15.default.magenta(`
28992
29040
  [${time3}] MESSAGE SUBAGENT: ${message.targetTitle ?? message.chatId}`));
28993
- console.log(import_chalk14.default.white(` ${truncate(message.message, 500)}`));
29041
+ console.log(import_chalk15.default.white(` ${truncate(message.message, 500)}`));
28994
29042
  if (message.output) {
28995
- console.log(import_chalk14.default.gray(` ${truncate(message.output, 200)}`));
29043
+ console.log(import_chalk15.default.gray(` ${truncate(message.output, 200)}`));
28996
29044
  }
28997
29045
  break;
28998
29046
  case "error":
28999
- console.log(import_chalk14.default.red(`
29047
+ console.log(import_chalk15.default.red(`
29000
29048
  [${time3}] ERROR:`));
29001
- console.log(import_chalk14.default.red(` ${message.message}`));
29049
+ console.log(import_chalk15.default.red(` ${message.message}`));
29002
29050
  break;
29003
29051
  }
29004
29052
  }
29005
29053
  async function replicaListCommand(options) {
29006
29054
  if (!canCallOrgApi()) {
29007
- console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
29055
+ console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29008
29056
  process.exit(1);
29009
29057
  }
29010
29058
  try {
@@ -29016,86 +29064,86 @@ async function replicaListCommand(options) {
29016
29064
  `/v1/replica${query ? "?" + query : ""}`
29017
29065
  );
29018
29066
  if (response.replicas.length === 0) {
29019
- console.log(import_chalk14.default.yellow("\nNo replicas found.\n"));
29067
+ console.log(import_chalk15.default.yellow("\nNo replicas found.\n"));
29020
29068
  return;
29021
29069
  }
29022
- console.log(import_chalk14.default.green(`
29070
+ console.log(import_chalk15.default.green(`
29023
29071
  Replicas (Page ${response.page} of ${response.total_pages}, Total: ${response.total}):
29024
29072
  `));
29025
29073
  for (const replica of response.replicas) {
29026
- console.log(import_chalk14.default.white(` ${replica.name}`));
29027
- console.log(import_chalk14.default.gray(` ID: ${replica.id}`));
29074
+ console.log(import_chalk15.default.white(` ${replica.name}`));
29075
+ console.log(import_chalk15.default.gray(` ID: ${replica.id}`));
29028
29076
  if (replica.repositories.length > 0) {
29029
- console.log(import_chalk14.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
29077
+ console.log(import_chalk15.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
29030
29078
  }
29031
- console.log(import_chalk14.default.gray(` Status: ${formatStatus(replica.status)}`));
29032
- console.log(import_chalk14.default.gray(` Created: ${formatDate(replica.created_at)}`));
29079
+ console.log(import_chalk15.default.gray(` Status: ${formatStatus(replica.status)}`));
29080
+ console.log(import_chalk15.default.gray(` Created: ${formatDate(replica.created_at)}`));
29033
29081
  if (replica.pull_requests && replica.pull_requests.length > 0) {
29034
- console.log(import_chalk14.default.gray(` Pull Requests:`));
29082
+ console.log(import_chalk15.default.gray(` Pull Requests:`));
29035
29083
  for (const pr of replica.pull_requests) {
29036
- console.log(import_chalk14.default.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
29084
+ console.log(import_chalk15.default.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
29037
29085
  }
29038
29086
  }
29039
29087
  console.log();
29040
29088
  }
29041
29089
  } catch (error51) {
29042
- console.error(import_chalk14.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29090
+ console.error(import_chalk15.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29043
29091
  process.exit(1);
29044
29092
  }
29045
29093
  }
29046
29094
  async function replicaGetCommand(id) {
29047
29095
  if (!isAuthenticated()) {
29048
- console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
29096
+ console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29049
29097
  process.exit(1);
29050
29098
  }
29051
29099
  try {
29052
29100
  const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
29053
29101
  const replica = response.replica;
29054
- console.log(import_chalk14.default.green(`
29102
+ console.log(import_chalk15.default.green(`
29055
29103
  Replica: ${replica.name}
29056
29104
  `));
29057
- console.log(import_chalk14.default.gray(` ID: ${replica.id}`));
29105
+ console.log(import_chalk15.default.gray(` ID: ${replica.id}`));
29058
29106
  if (replica.repositories.length > 0) {
29059
- console.log(import_chalk14.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
29107
+ console.log(import_chalk15.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
29060
29108
  }
29061
- console.log(import_chalk14.default.gray(` Status: ${formatStatus(replica.status)}`));
29062
- console.log(import_chalk14.default.gray(` Created: ${formatDate(replica.created_at)}`));
29109
+ console.log(import_chalk15.default.gray(` Status: ${formatStatus(replica.status)}`));
29110
+ console.log(import_chalk15.default.gray(` Created: ${formatDate(replica.created_at)}`));
29063
29111
  if (replica.waking) {
29064
- console.log(import_chalk14.default.yellow("\n Workspace is waking from sleep. Retry in 30-90 seconds for full details.\n"));
29112
+ console.log(import_chalk15.default.yellow("\n Workspace is waking from sleep. Retry in 30-90 seconds for full details.\n"));
29065
29113
  } else {
29066
29114
  if (replica.coding_agent) {
29067
- console.log(import_chalk14.default.gray(` Coding Agent: ${replica.coding_agent}`));
29115
+ console.log(import_chalk15.default.gray(` Coding Agent: ${replica.coding_agent}`));
29068
29116
  }
29069
29117
  if (replica.repository_statuses && replica.repository_statuses.length > 0) {
29070
- console.log(import_chalk14.default.gray(" Repository Statuses:"));
29118
+ console.log(import_chalk15.default.gray(" Repository Statuses:"));
29071
29119
  for (const repositoryStatus of replica.repository_statuses) {
29072
- const changeText = repositoryStatus.git_diff ? ` (${import_chalk14.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk14.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
29073
- console.log(import_chalk14.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
29120
+ const changeText = repositoryStatus.git_diff ? ` (${import_chalk15.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk15.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
29121
+ console.log(import_chalk15.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
29074
29122
  }
29075
29123
  }
29076
29124
  }
29077
29125
  if (replica.pull_requests && replica.pull_requests.length > 0) {
29078
- console.log(import_chalk14.default.gray(` Pull Requests:`));
29126
+ console.log(import_chalk15.default.gray(` Pull Requests:`));
29079
29127
  for (const pr of replica.pull_requests) {
29080
- console.log(import_chalk14.default.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
29128
+ console.log(import_chalk15.default.cyan(` - ${pr.repository} #${pr.number}: ${pr.url}`));
29081
29129
  }
29082
29130
  }
29083
29131
  console.log();
29084
29132
  } catch (error51) {
29085
- console.error(import_chalk14.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29133
+ console.error(import_chalk15.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29086
29134
  process.exit(1);
29087
29135
  }
29088
29136
  }
29089
29137
  async function replicaCreateCommand(name, options) {
29090
29138
  if (!isAuthenticated()) {
29091
- console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
29139
+ console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29092
29140
  process.exit(1);
29093
29141
  }
29094
29142
  try {
29095
29143
  const envResponse = await orgAuthenticatedFetch("/v1/environments");
29096
29144
  const environments = envResponse.environments;
29097
29145
  if (environments.length === 0) {
29098
- console.log(import_chalk14.default.red("No environments found. Please create an environment first."));
29146
+ console.log(import_chalk15.default.red("No environments found. Please create an environment first."));
29099
29147
  process.exit(1);
29100
29148
  }
29101
29149
  let replicaName = name;
@@ -29103,7 +29151,7 @@ async function replicaCreateCommand(name, options) {
29103
29151
  let selectedEnvironmentId = options.environment?.trim();
29104
29152
  let codingAgent = parseReplicaAgent(options.agent);
29105
29153
  if (replicaName && /\s/.test(replicaName)) {
29106
- console.log(import_chalk14.default.red("Replica name cannot contain spaces."));
29154
+ console.log(import_chalk15.default.red("Replica name cannot contain spaces."));
29107
29155
  process.exit(1);
29108
29156
  }
29109
29157
  if (!replicaName) {
@@ -29118,7 +29166,7 @@ async function replicaCreateCommand(name, options) {
29118
29166
  }
29119
29167
  });
29120
29168
  if (!response2.name) {
29121
- console.log(import_chalk14.default.yellow("\nCancelled."));
29169
+ console.log(import_chalk15.default.yellow("\nCancelled."));
29122
29170
  return;
29123
29171
  }
29124
29172
  replicaName = response2.name;
@@ -29135,7 +29183,7 @@ async function replicaCreateCommand(name, options) {
29135
29183
  }))
29136
29184
  });
29137
29185
  if (!response2.environment) {
29138
- console.log(import_chalk14.default.yellow("\nCancelled."));
29186
+ console.log(import_chalk15.default.yellow("\nCancelled."));
29139
29187
  return;
29140
29188
  }
29141
29189
  selectedEnvironmentId = response2.environment;
@@ -29148,7 +29196,7 @@ async function replicaCreateCommand(name, options) {
29148
29196
  validate: (value) => value.trim() ? true : "Message is required"
29149
29197
  });
29150
29198
  if (!response2.message) {
29151
- console.log(import_chalk14.default.yellow("\nCancelled."));
29199
+ console.log(import_chalk15.default.yellow("\nCancelled."));
29152
29200
  return;
29153
29201
  }
29154
29202
  message = response2.message;
@@ -29162,7 +29210,7 @@ async function replicaCreateCommand(name, options) {
29162
29210
  initial: 0
29163
29211
  });
29164
29212
  if (!response2.agent) {
29165
- console.log(import_chalk14.default.yellow("\nCancelled."));
29213
+ console.log(import_chalk15.default.yellow("\nCancelled."));
29166
29214
  return;
29167
29215
  }
29168
29216
  codingAgent = parseReplicaAgent(response2.agent);
@@ -29173,28 +29221,28 @@ async function replicaCreateCommand(name, options) {
29173
29221
  environment_id: selectedEnvironmentId,
29174
29222
  coding_agent: codingAgent
29175
29223
  };
29176
- console.log(import_chalk14.default.gray("\nCreating replica..."));
29224
+ console.log(import_chalk15.default.gray("\nCreating replica..."));
29177
29225
  const response = await orgAuthenticatedFetch("/v1/replica", {
29178
29226
  method: "POST",
29179
29227
  body
29180
29228
  });
29181
29229
  const replica = response.replica;
29182
- console.log(import_chalk14.default.green(`
29230
+ console.log(import_chalk15.default.green(`
29183
29231
  Created replica: ${replica.name}`));
29184
- console.log(import_chalk14.default.gray(` ID: ${replica.id}`));
29185
- console.log(import_chalk14.default.gray(` Status: ${formatStatus(replica.status)}`));
29232
+ console.log(import_chalk15.default.gray(` ID: ${replica.id}`));
29233
+ console.log(import_chalk15.default.gray(` Status: ${formatStatus(replica.status)}`));
29186
29234
  if (replica.repositories.length > 0) {
29187
- console.log(import_chalk14.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
29235
+ console.log(import_chalk15.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
29188
29236
  }
29189
29237
  console.log();
29190
29238
  } catch (error51) {
29191
- console.error(import_chalk14.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29239
+ console.error(import_chalk15.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29192
29240
  process.exit(1);
29193
29241
  }
29194
29242
  }
29195
29243
  async function replicaSendCommand(id, options) {
29196
29244
  if (!isAuthenticated()) {
29197
- console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
29245
+ console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29198
29246
  process.exit(1);
29199
29247
  }
29200
29248
  try {
@@ -29207,7 +29255,7 @@ async function replicaSendCommand(id, options) {
29207
29255
  validate: (value) => value.trim() ? true : "Message is required"
29208
29256
  });
29209
29257
  if (!response2.message) {
29210
- console.log(import_chalk14.default.yellow("\nCancelled."));
29258
+ console.log(import_chalk15.default.yellow("\nCancelled."));
29211
29259
  return;
29212
29260
  }
29213
29261
  message = response2.message;
@@ -29225,21 +29273,21 @@ async function replicaSendCommand(id, options) {
29225
29273
  body
29226
29274
  }
29227
29275
  );
29228
- const statusColor = response.status === "sent" ? import_chalk14.default.green : import_chalk14.default.yellow;
29276
+ const statusColor = response.status === "sent" ? import_chalk15.default.green : import_chalk15.default.yellow;
29229
29277
  console.log(statusColor(`
29230
29278
  Message ${response.status}`));
29231
29279
  if (response.position !== void 0 && response.position > 0) {
29232
- console.log(import_chalk14.default.gray(` Queue position: ${response.position}`));
29280
+ console.log(import_chalk15.default.gray(` Queue position: ${response.position}`));
29233
29281
  }
29234
29282
  console.log();
29235
29283
  } catch (error51) {
29236
- console.error(import_chalk14.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29284
+ console.error(import_chalk15.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29237
29285
  process.exit(1);
29238
29286
  }
29239
29287
  }
29240
29288
  async function replicaDeleteCommand(id, options) {
29241
29289
  if (!isAuthenticated()) {
29242
- console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
29290
+ console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29243
29291
  process.exit(1);
29244
29292
  }
29245
29293
  try {
@@ -29251,24 +29299,24 @@ async function replicaDeleteCommand(id, options) {
29251
29299
  initial: false
29252
29300
  });
29253
29301
  if (!response.confirm) {
29254
- console.log(import_chalk14.default.yellow("\nCancelled."));
29302
+ console.log(import_chalk15.default.yellow("\nCancelled."));
29255
29303
  return;
29256
29304
  }
29257
29305
  }
29258
29306
  await orgAuthenticatedFetch(`/v1/replica/${id}`, {
29259
29307
  method: "DELETE"
29260
29308
  });
29261
- console.log(import_chalk14.default.green(`
29309
+ console.log(import_chalk15.default.green(`
29262
29310
  Replica ${id} deleted.
29263
29311
  `));
29264
29312
  } catch (error51) {
29265
- console.error(import_chalk14.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29313
+ console.error(import_chalk15.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29266
29314
  process.exit(1);
29267
29315
  }
29268
29316
  }
29269
29317
  async function replicaReadCommand(id, options) {
29270
29318
  if (!isAuthenticated()) {
29271
- console.log(import_chalk14.default.red('Not logged in. Please run "replicas login" first.'));
29319
+ console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29272
29320
  process.exit(1);
29273
29321
  }
29274
29322
  try {
@@ -29280,53 +29328,53 @@ async function replicaReadCommand(id, options) {
29280
29328
  `/v1/replica/${id}/read${query ? "?" + query : ""}`
29281
29329
  );
29282
29330
  if (response.waking) {
29283
- console.log(import_chalk14.default.yellow("\nWorkspace is waking from sleep. Retry in 30-90 seconds.\n"));
29331
+ console.log(import_chalk15.default.yellow("\nWorkspace is waking from sleep. Retry in 30-90 seconds.\n"));
29284
29332
  return;
29285
29333
  }
29286
- console.log(import_chalk14.default.green(`
29334
+ console.log(import_chalk15.default.green(`
29287
29335
  Conversation History
29288
29336
  `));
29289
29337
  if (response.coding_agent) {
29290
- console.log(import_chalk14.default.gray(` Agent: ${response.coding_agent}`));
29338
+ console.log(import_chalk15.default.gray(` Agent: ${response.coding_agent}`));
29291
29339
  }
29292
29340
  if (response.thread_id) {
29293
- console.log(import_chalk14.default.gray(` Thread ID: ${response.thread_id}`));
29341
+ console.log(import_chalk15.default.gray(` Thread ID: ${response.thread_id}`));
29294
29342
  }
29295
- console.log(import_chalk14.default.gray(` Total Events: ${response.total}`));
29296
- console.log(import_chalk14.default.gray(` Showing: ${response.events.length} events`));
29343
+ console.log(import_chalk15.default.gray(` Total Events: ${response.total}`));
29344
+ console.log(import_chalk15.default.gray(` Showing: ${response.events.length} events`));
29297
29345
  if (response.has_more) {
29298
- console.log(import_chalk14.default.gray(` Has More: yes (--before-event ${response.eventsStartIndex} for the previous page)`));
29346
+ console.log(import_chalk15.default.gray(` Has More: yes (--before-event ${response.eventsStartIndex} for the previous page)`));
29299
29347
  }
29300
29348
  console.log();
29301
29349
  if (response.events.length === 0) {
29302
- console.log(import_chalk14.default.yellow(" No events found.\n"));
29350
+ console.log(import_chalk15.default.yellow(" No events found.\n"));
29303
29351
  return;
29304
29352
  }
29305
- console.log(import_chalk14.default.gray("-".repeat(60)));
29353
+ console.log(import_chalk15.default.gray("-".repeat(60)));
29306
29354
  const agentType = response.coding_agent || "claude";
29307
29355
  const displayMessages = parseDisplayMessages(response.events, agentType, response.codexAspTranscript);
29308
29356
  for (const message of displayMessages) {
29309
29357
  formatDisplayMessage(message);
29310
29358
  }
29311
- console.log(import_chalk14.default.gray("\n" + "-".repeat(60)));
29359
+ console.log(import_chalk15.default.gray("\n" + "-".repeat(60)));
29312
29360
  console.log();
29313
29361
  } catch (error51) {
29314
- console.error(import_chalk14.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29362
+ console.error(import_chalk15.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29315
29363
  process.exit(1);
29316
29364
  }
29317
29365
  }
29318
29366
 
29319
29367
  // src/commands/repositories.ts
29320
- var import_chalk16 = __toESM(require("chalk"));
29368
+ var import_chalk17 = __toESM(require("chalk"));
29321
29369
 
29322
29370
  // src/lib/command-utils.ts
29323
- var import_chalk15 = __toESM(require("chalk"));
29371
+ var import_chalk16 = __toESM(require("chalk"));
29324
29372
  function formatDate2(dateString) {
29325
29373
  return new Date(dateString).toLocaleString();
29326
29374
  }
29327
29375
  function ensureOrgApiAuthenticated() {
29328
29376
  if (!canCallOrgApi()) {
29329
- console.log(import_chalk15.default.red('Not logged in. Please run "replicas login" first.'));
29377
+ console.log(import_chalk16.default.red('Not logged in. Please run "replicas login" first.'));
29330
29378
  process.exit(1);
29331
29379
  }
29332
29380
  }
@@ -29340,36 +29388,36 @@ async function repositoriesListCommand() {
29340
29388
  try {
29341
29389
  const response = await orgAuthenticatedFetch("/v1/repositories");
29342
29390
  if (response.repositories.length === 0) {
29343
- console.log(import_chalk16.default.yellow("\nNo repositories found.\n"));
29391
+ console.log(import_chalk17.default.yellow("\nNo repositories found.\n"));
29344
29392
  return;
29345
29393
  }
29346
- console.log(import_chalk16.default.green(`
29394
+ console.log(import_chalk17.default.green(`
29347
29395
  Repositories (${response.repositories.length}):
29348
29396
  `));
29349
29397
  for (const repo of response.repositories) {
29350
- console.log(import_chalk16.default.white(` ${repo.name}`));
29351
- console.log(import_chalk16.default.gray(` URL: ${repo.url}`));
29352
- console.log(import_chalk16.default.gray(` Default Branch: ${repo.default_branch}`));
29353
- console.log(import_chalk16.default.gray(` Created: ${formatDate2(repo.created_at)}`));
29398
+ console.log(import_chalk17.default.white(` ${repo.name}`));
29399
+ console.log(import_chalk17.default.gray(` URL: ${repo.url}`));
29400
+ console.log(import_chalk17.default.gray(` Default Branch: ${repo.default_branch}`));
29401
+ console.log(import_chalk17.default.gray(` Created: ${formatDate2(repo.created_at)}`));
29354
29402
  if (repo.github_repository_id) {
29355
- console.log(import_chalk16.default.gray(` GitHub ID: ${repo.github_repository_id}`));
29403
+ console.log(import_chalk17.default.gray(` GitHub ID: ${repo.github_repository_id}`));
29356
29404
  }
29357
29405
  console.log();
29358
29406
  }
29359
29407
  } catch (error51) {
29360
- console.error(import_chalk16.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29408
+ console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29361
29409
  process.exit(1);
29362
29410
  }
29363
29411
  }
29364
29412
 
29365
29413
  // src/commands/automation.ts
29366
- var import_chalk17 = __toESM(require("chalk"));
29414
+ var import_chalk18 = __toESM(require("chalk"));
29367
29415
  var import_prompts7 = __toESM(require("prompts"));
29368
29416
  function parseScopeFilter(value) {
29369
29417
  if (!value) return void 0;
29370
29418
  if (value === "org" || value === "user" || value === "all") return value;
29371
- console.log(import_chalk17.default.red(`Invalid --owner: ${value}`));
29372
- console.log(import_chalk17.default.gray("Valid options: org, user, all"));
29419
+ console.log(import_chalk18.default.red(`Invalid --owner: ${value}`));
29420
+ console.log(import_chalk18.default.gray("Valid options: org, user, all"));
29373
29421
  process.exit(1);
29374
29422
  }
29375
29423
  function parseAgentProviderOption(value) {
@@ -29378,8 +29426,8 @@ function parseAgentProviderOption(value) {
29378
29426
  if (trimmed === "" || trimmed.toLowerCase() === "none") return null;
29379
29427
  const lower = trimmed.toLowerCase();
29380
29428
  if (!isValidAgentProvider(lower)) {
29381
- console.log(import_chalk17.default.red(`Invalid --agent-provider: ${value}`));
29382
- console.log(import_chalk17.default.gray(`Valid options: ${VALID_AGENT_PROVIDERS.join(", ")}, none`));
29429
+ console.log(import_chalk18.default.red(`Invalid --agent-provider: ${value}`));
29430
+ console.log(import_chalk18.default.gray(`Valid options: ${VALID_AGENT_PROVIDERS.join(", ")}, none`));
29383
29431
  process.exit(1);
29384
29432
  }
29385
29433
  return lower;
@@ -29390,8 +29438,8 @@ function parseThinkingLevelOption(value) {
29390
29438
  if (trimmed === "" || trimmed.toLowerCase() === "none") return null;
29391
29439
  const lower = trimmed.toLowerCase();
29392
29440
  if (!isValidThinkingLevel(lower)) {
29393
- console.log(import_chalk17.default.red(`Invalid --thinking-level: ${value}`));
29394
- console.log(import_chalk17.default.gray(`Valid options: ${VALID_THINKING_LEVELS.join(", ")}, none`));
29441
+ console.log(import_chalk18.default.red(`Invalid --thinking-level: ${value}`));
29442
+ console.log(import_chalk18.default.gray(`Valid options: ${VALID_THINKING_LEVELS.join(", ")}, none`));
29395
29443
  process.exit(1);
29396
29444
  }
29397
29445
  return lower;
@@ -29408,8 +29456,8 @@ function isAutomationLifecyclePolicy(value) {
29408
29456
  function parseWorkspaceLifecyclePolicyOption(value) {
29409
29457
  if (!value) return void 0;
29410
29458
  if (isAutomationLifecyclePolicy(value)) return value;
29411
- console.log(import_chalk17.default.red(`Invalid lifecycle policy: ${value}`));
29412
- console.log(import_chalk17.default.gray(`Valid options: ${AUTOMATION_LIFECYCLE_POLICIES.join(", ")}`));
29459
+ console.log(import_chalk18.default.red(`Invalid lifecycle policy: ${value}`));
29460
+ console.log(import_chalk18.default.gray(`Valid options: ${AUTOMATION_LIFECYCLE_POLICIES.join(", ")}`));
29413
29461
  process.exit(1);
29414
29462
  }
29415
29463
  function parseExcludedActorsOption(value) {
@@ -29428,7 +29476,7 @@ function withExcludedActors(config3, excludedActors) {
29428
29476
  }
29429
29477
  function parseAutomationLifecycleOptions(options) {
29430
29478
  if (options.sleepWhenDone && options.lifecycle && options.lifecycle !== "sleep_when_done") {
29431
- console.log(import_chalk17.default.red("--sleep-when-done cannot be combined with a different --lifecycle value"));
29479
+ console.log(import_chalk18.default.red("--sleep-when-done cannot be combined with a different --lifecycle value"));
29432
29480
  process.exit(1);
29433
29481
  }
29434
29482
  if (options.sleepWhenDone) return "sleep_when_done";
@@ -29437,7 +29485,7 @@ function parseAutomationLifecycleOptions(options) {
29437
29485
  function applyAgentSelection(body, existing) {
29438
29486
  const result = validateAgentSelection(body, existing);
29439
29487
  if (!result.ok) {
29440
- console.log(import_chalk17.default.red(result.error.message));
29488
+ console.log(import_chalk18.default.red(result.error.message));
29441
29489
  process.exit(1);
29442
29490
  }
29443
29491
  const out = {};
@@ -29478,8 +29526,8 @@ function resolveTriggerRepositoryIds(repositories, repoNamesInput, provider) {
29478
29526
  for (const repoName of repoNames) {
29479
29527
  const repo = providerRepos.find((r) => r.name === repoName);
29480
29528
  if (!repo) {
29481
- console.log(import_chalk17.default.red(`Repository not found for ${provider} trigger filter: ${repoName}`));
29482
- console.log(import_chalk17.default.gray(`Available: ${providerRepos.map((r) => r.name).join(", ")}`));
29529
+ console.log(import_chalk18.default.red(`Repository not found for ${provider} trigger filter: ${repoName}`));
29530
+ console.log(import_chalk18.default.gray(`Available: ${providerRepos.map((r) => r.name).join(", ")}`));
29483
29531
  process.exit(1);
29484
29532
  }
29485
29533
  repoIds.push(repo.id);
@@ -29512,43 +29560,43 @@ function formatModeSummary(automation2) {
29512
29560
  function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
29513
29561
  const resolved = resolveByNameOrId(envInput, selectableEnvs);
29514
29562
  if (!resolved) {
29515
- console.log(import_chalk17.default.red(`Environment not found: ${envInput}`));
29563
+ console.log(import_chalk18.default.red(`Environment not found: ${envInput}`));
29516
29564
  const available = selectableEnvs.map((e) => e.name).join(", ");
29517
- console.log(import_chalk17.default.gray(`Available: ${available || "(none)"}`));
29565
+ console.log(import_chalk18.default.gray(`Available: ${available || "(none)"}`));
29518
29566
  process.exit(1);
29519
29567
  }
29520
29568
  return resolved.id;
29521
29569
  }
29522
29570
  function printAutomation(automation2) {
29523
- console.log(import_chalk17.default.white(` ${automation2.name}`));
29524
- console.log(import_chalk17.default.gray(` ID: ${automation2.id}`));
29525
- console.log(import_chalk17.default.gray(` Owner: ${automation2.user_id ? "personal" : "organization"}`));
29571
+ console.log(import_chalk18.default.white(` ${automation2.name}`));
29572
+ console.log(import_chalk18.default.gray(` ID: ${automation2.id}`));
29573
+ console.log(import_chalk18.default.gray(` Owner: ${automation2.user_id ? "personal" : "organization"}`));
29526
29574
  if (automation2.description) {
29527
- console.log(import_chalk17.default.gray(` Description: ${automation2.description}`));
29575
+ console.log(import_chalk18.default.gray(` Description: ${automation2.description}`));
29528
29576
  }
29529
- console.log(import_chalk17.default.gray(` Enabled: ${automation2.enabled ? import_chalk17.default.green("yes") : import_chalk17.default.red("no")}`));
29577
+ console.log(import_chalk18.default.gray(` Enabled: ${automation2.enabled ? import_chalk18.default.green("yes") : import_chalk18.default.red("no")}`));
29530
29578
  if (automation2.triggers.length > 0) {
29531
- console.log(import_chalk17.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
29579
+ console.log(import_chalk18.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
29532
29580
  }
29533
29581
  if (automation2.github_check_names.length > 0) {
29534
- console.log(import_chalk17.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
29582
+ console.log(import_chalk18.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
29535
29583
  }
29536
- console.log(import_chalk17.default.gray(` Prompt: ${truncate2(automation2.prompt, 80)}`));
29584
+ console.log(import_chalk18.default.gray(` Prompt: ${truncate2(automation2.prompt, 80)}`));
29537
29585
  if (automation2.cron_next_fire_at) {
29538
- console.log(import_chalk17.default.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
29586
+ console.log(import_chalk18.default.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
29539
29587
  }
29540
29588
  if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
29541
- console.log(import_chalk17.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
29589
+ console.log(import_chalk18.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
29542
29590
  }
29543
29591
  if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
29544
- console.log(import_chalk17.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
29592
+ console.log(import_chalk18.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
29545
29593
  }
29546
29594
  if (automation2.plan_mode || automation2.goal_mode || automation2.fast_mode) {
29547
- console.log(import_chalk17.default.gray(` Modes: ${formatModeSummary(automation2)}`));
29595
+ console.log(import_chalk18.default.gray(` Modes: ${formatModeSummary(automation2)}`));
29548
29596
  }
29549
- console.log(import_chalk17.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? import_chalk17.default.green("managed") : "read-only"}`));
29550
- console.log(import_chalk17.default.gray(` Created: ${formatDate2(automation2.created_at)}`));
29551
- console.log(import_chalk17.default.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
29597
+ console.log(import_chalk18.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? import_chalk18.default.green("managed") : "read-only"}`));
29598
+ console.log(import_chalk18.default.gray(` Created: ${formatDate2(automation2.created_at)}`));
29599
+ console.log(import_chalk18.default.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
29552
29600
  console.log();
29553
29601
  }
29554
29602
  async function automationListCommand(options) {
@@ -29567,17 +29615,17 @@ async function automationListCommand(options) {
29567
29615
  `/v1/automations${query ? "?" + query : ""}`
29568
29616
  );
29569
29617
  if (response.automations.length === 0) {
29570
- console.log(import_chalk17.default.yellow("\nNo automations found.\n"));
29618
+ console.log(import_chalk18.default.yellow("\nNo automations found.\n"));
29571
29619
  return;
29572
29620
  }
29573
- console.log(import_chalk17.default.green(`
29621
+ console.log(import_chalk18.default.green(`
29574
29622
  Automations (Page ${response.page} of ${response.totalPages}, Total: ${response.total}):
29575
29623
  `));
29576
29624
  for (const automation2 of response.automations) {
29577
29625
  printAutomation(automation2);
29578
29626
  }
29579
29627
  } catch (error51) {
29580
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29628
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29581
29629
  process.exit(1);
29582
29630
  }
29583
29631
  }
@@ -29586,50 +29634,50 @@ async function automationGetCommand(id) {
29586
29634
  try {
29587
29635
  const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
29588
29636
  const automation2 = response.automation;
29589
- console.log(import_chalk17.default.green(`
29637
+ console.log(import_chalk18.default.green(`
29590
29638
  Automation: ${automation2.name}
29591
29639
  `));
29592
- console.log(import_chalk17.default.gray(` ID: ${automation2.id}`));
29640
+ console.log(import_chalk18.default.gray(` ID: ${automation2.id}`));
29593
29641
  if (automation2.description) {
29594
- console.log(import_chalk17.default.gray(` Description: ${automation2.description}`));
29642
+ console.log(import_chalk18.default.gray(` Description: ${automation2.description}`));
29595
29643
  }
29596
- console.log(import_chalk17.default.gray(` Enabled: ${automation2.enabled ? import_chalk17.default.green("yes") : import_chalk17.default.red("no")}`));
29644
+ console.log(import_chalk18.default.gray(` Enabled: ${automation2.enabled ? import_chalk18.default.green("yes") : import_chalk18.default.red("no")}`));
29597
29645
  if (automation2.triggers.length > 0) {
29598
- console.log(import_chalk17.default.gray(` Triggers:`));
29646
+ console.log(import_chalk18.default.gray(` Triggers:`));
29599
29647
  for (const trigger of automation2.triggers) {
29600
- console.log(import_chalk17.default.gray(` - ${formatTrigger(trigger)}`));
29648
+ console.log(import_chalk18.default.gray(` - ${formatTrigger(trigger)}`));
29601
29649
  }
29602
29650
  }
29603
29651
  if (automation2.github_check_names.length > 0) {
29604
- console.log(import_chalk17.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
29652
+ console.log(import_chalk18.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
29605
29653
  }
29606
- console.log(import_chalk17.default.gray(` Prompt: ${automation2.prompt}`));
29607
- console.log(import_chalk17.default.gray(` Environment: ${automation2.environment_id}`));
29654
+ console.log(import_chalk18.default.gray(` Prompt: ${automation2.prompt}`));
29655
+ console.log(import_chalk18.default.gray(` Environment: ${automation2.environment_id}`));
29608
29656
  if (automation2.cron_expression) {
29609
- console.log(import_chalk17.default.gray(` Cron: ${automation2.cron_expression}`));
29657
+ console.log(import_chalk18.default.gray(` Cron: ${automation2.cron_expression}`));
29610
29658
  }
29611
29659
  if (automation2.cron_timezone) {
29612
- console.log(import_chalk17.default.gray(` Timezone: ${automation2.cron_timezone}`));
29660
+ console.log(import_chalk18.default.gray(` Timezone: ${automation2.cron_timezone}`));
29613
29661
  }
29614
29662
  if (automation2.cron_next_fire_at) {
29615
- console.log(import_chalk17.default.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
29663
+ console.log(import_chalk18.default.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
29616
29664
  }
29617
29665
  if (automation2.workspace_lifecycle_policy) {
29618
- console.log(import_chalk17.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
29666
+ console.log(import_chalk18.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
29619
29667
  }
29620
29668
  if (automation2.workspace_auto_stop_minutes) {
29621
- console.log(import_chalk17.default.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
29622
- }
29623
- console.log(import_chalk17.default.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
29624
- console.log(import_chalk17.default.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
29625
- console.log(import_chalk17.default.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
29626
- console.log(import_chalk17.default.gray(` Modes: ${formatModeSummary(automation2)}`));
29627
- console.log(import_chalk17.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
29628
- console.log(import_chalk17.default.gray(` Created: ${formatDate2(automation2.created_at)}`));
29629
- console.log(import_chalk17.default.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
29669
+ console.log(import_chalk18.default.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
29670
+ }
29671
+ console.log(import_chalk18.default.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
29672
+ console.log(import_chalk18.default.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
29673
+ console.log(import_chalk18.default.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
29674
+ console.log(import_chalk18.default.gray(` Modes: ${formatModeSummary(automation2)}`));
29675
+ console.log(import_chalk18.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
29676
+ console.log(import_chalk18.default.gray(` Created: ${formatDate2(automation2.created_at)}`));
29677
+ console.log(import_chalk18.default.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
29630
29678
  console.log();
29631
29679
  } catch (error51) {
29632
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29680
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29633
29681
  process.exit(1);
29634
29682
  }
29635
29683
  }
@@ -29754,22 +29802,22 @@ async function automationCreateCommand(name, options) {
29754
29802
  ensureOrgApiAuthenticated();
29755
29803
  const lifecyclePolicy = parseAutomationLifecycleOptions(options);
29756
29804
  if (options.autoStopMinutes && !lifecyclePolicySupportsAutoStop(lifecyclePolicy ?? "default")) {
29757
- console.log(import_chalk17.default.red("--auto-stop-minutes requires --lifecycle default"));
29805
+ console.log(import_chalk18.default.red("--auto-stop-minutes requires --lifecycle default"));
29758
29806
  process.exit(1);
29759
29807
  }
29760
29808
  if (options.autoStopMinutes) {
29761
29809
  const minutes = parseInt(options.autoStopMinutes, 10);
29762
29810
  if (isNaN(minutes) || minutes < 3 || minutes > 1440) {
29763
- console.log(import_chalk17.default.red("--auto-stop-minutes must be between 3 and 1440"));
29811
+ console.log(import_chalk18.default.red("--auto-stop-minutes must be between 3 and 1440"));
29764
29812
  process.exit(1);
29765
29813
  }
29766
29814
  }
29767
29815
  if (options.triggerGithubExcludeUsers !== void 0 && !options.triggerGithub) {
29768
- console.log(import_chalk17.default.red("--trigger-github-exclude-users requires --trigger-github"));
29816
+ console.log(import_chalk18.default.red("--trigger-github-exclude-users requires --trigger-github"));
29769
29817
  process.exit(1);
29770
29818
  }
29771
29819
  if (options.triggerGitlabExcludeUsers !== void 0 && !options.triggerGitlab) {
29772
- console.log(import_chalk17.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab"));
29820
+ console.log(import_chalk18.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab"));
29773
29821
  process.exit(1);
29774
29822
  }
29775
29823
  const agentSelection = applyAgentSelection(
@@ -29784,7 +29832,7 @@ async function automationCreateCommand(name, options) {
29784
29832
  const envResponse = await orgAuthenticatedFetch("/v1/environments");
29785
29833
  const selectableEnvs = envResponse.environments;
29786
29834
  if (selectableEnvs.length === 0) {
29787
- console.log(import_chalk17.default.red("No environments found. Please create an environment first."));
29835
+ console.log(import_chalk18.default.red("No environments found. Please create an environment first."));
29788
29836
  process.exit(1);
29789
29837
  }
29790
29838
  const repoResponse = await orgAuthenticatedFetch("/v1/repositories");
@@ -29798,7 +29846,7 @@ async function automationCreateCommand(name, options) {
29798
29846
  validate: (value) => value.trim() ? true : "Name is required"
29799
29847
  });
29800
29848
  if (!response2.name) {
29801
- console.log(import_chalk17.default.yellow("\nCancelled."));
29849
+ console.log(import_chalk18.default.yellow("\nCancelled."));
29802
29850
  return;
29803
29851
  }
29804
29852
  automationName = response2.name;
@@ -29812,7 +29860,7 @@ async function automationCreateCommand(name, options) {
29812
29860
  validate: (value) => value.trim() ? true : "Prompt is required"
29813
29861
  });
29814
29862
  if (!response2.prompt) {
29815
- console.log(import_chalk17.default.yellow("\nCancelled."));
29863
+ console.log(import_chalk18.default.yellow("\nCancelled."));
29816
29864
  return;
29817
29865
  }
29818
29866
  automationPrompt = response2.prompt;
@@ -29832,7 +29880,7 @@ async function automationCreateCommand(name, options) {
29832
29880
  }))
29833
29881
  });
29834
29882
  if (!envResponse2.env) {
29835
- console.log(import_chalk17.default.yellow("\nCancelled."));
29883
+ console.log(import_chalk18.default.yellow("\nCancelled."));
29836
29884
  return;
29837
29885
  }
29838
29886
  selectedEnvironmentId = envResponse2.env;
@@ -29874,7 +29922,7 @@ async function automationCreateCommand(name, options) {
29874
29922
  if (triggers.length === 0) {
29875
29923
  triggers = await promptForTriggers(repositories.map((r) => ({ id: r.id, name: r.name, provider: r.provider })));
29876
29924
  if (triggers.length === 0) {
29877
- console.log(import_chalk17.default.red("At least one trigger is required."));
29925
+ console.log(import_chalk18.default.red("At least one trigger is required."));
29878
29926
  process.exit(1);
29879
29927
  }
29880
29928
  }
@@ -29904,25 +29952,25 @@ async function automationCreateCommand(name, options) {
29904
29952
  ...options.fastMode ? { fast_mode: true } : {},
29905
29953
  ...agentSelection
29906
29954
  };
29907
- console.log(import_chalk17.default.gray("\nCreating automation..."));
29955
+ console.log(import_chalk18.default.gray("\nCreating automation..."));
29908
29956
  const response = await orgAuthenticatedFetch("/v1/automations", {
29909
29957
  method: "POST",
29910
29958
  body
29911
29959
  });
29912
29960
  const automation2 = response.automation;
29913
- console.log(import_chalk17.default.green(`
29961
+ console.log(import_chalk18.default.green(`
29914
29962
  Created automation: ${automation2.name}`));
29915
- console.log(import_chalk17.default.gray(` ID: ${automation2.id}`));
29916
- console.log(import_chalk17.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
29963
+ console.log(import_chalk18.default.gray(` ID: ${automation2.id}`));
29964
+ console.log(import_chalk18.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
29917
29965
  if (automation2.triggers.length > 0) {
29918
- console.log(import_chalk17.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
29966
+ console.log(import_chalk18.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
29919
29967
  }
29920
29968
  if (automation2.cron_next_fire_at) {
29921
- console.log(import_chalk17.default.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
29969
+ console.log(import_chalk18.default.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
29922
29970
  }
29923
29971
  console.log();
29924
29972
  } catch (error51) {
29925
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29973
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29926
29974
  process.exit(1);
29927
29975
  }
29928
29976
  }
@@ -29932,17 +29980,17 @@ async function automationEditCommand(id, options) {
29932
29980
  if (options.autoStopMinutes) {
29933
29981
  const minutes = parseInt(options.autoStopMinutes, 10);
29934
29982
  if (isNaN(minutes) || minutes < 3 || minutes > 1440) {
29935
- console.log(import_chalk17.default.red("--auto-stop-minutes must be between 3 and 1440"));
29983
+ console.log(import_chalk18.default.red("--auto-stop-minutes must be between 3 and 1440"));
29936
29984
  process.exit(1);
29937
29985
  }
29938
29986
  }
29939
29987
  const replacingTriggers = Boolean(options.triggerCron || options.triggerGithub || options.triggerGitlab);
29940
29988
  if (replacingTriggers && options.triggerGithubExcludeUsers !== void 0 && !options.triggerGithub) {
29941
- console.log(import_chalk17.default.red("--trigger-github-exclude-users requires --trigger-github when replacing triggers"));
29989
+ console.log(import_chalk18.default.red("--trigger-github-exclude-users requires --trigger-github when replacing triggers"));
29942
29990
  process.exit(1);
29943
29991
  }
29944
29992
  if (replacingTriggers && options.triggerGitlabExcludeUsers !== void 0 && !options.triggerGitlab) {
29945
- console.log(import_chalk17.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab when replacing triggers"));
29993
+ console.log(import_chalk18.default.red("--trigger-gitlab-exclude-users requires --trigger-gitlab when replacing triggers"));
29946
29994
  process.exit(1);
29947
29995
  }
29948
29996
  const parsedAgent = {
@@ -29954,7 +30002,7 @@ async function automationEditCommand(id, options) {
29954
30002
  const existing = await orgAuthenticatedFetch(`/v1/automations/${id}`);
29955
30003
  const autoStopLifecyclePolicy = lifecyclePolicy ?? toAutomationLifecyclePolicy(existing.automation.workspace_lifecycle_policy);
29956
30004
  if (options.autoStopMinutes && !lifecyclePolicySupportsAutoStop(autoStopLifecyclePolicy)) {
29957
- console.log(import_chalk17.default.red("--auto-stop-minutes requires --lifecycle default"));
30005
+ console.log(import_chalk18.default.red("--auto-stop-minutes requires --lifecycle default"));
29958
30006
  process.exit(1);
29959
30007
  }
29960
30008
  const agentSelection = applyAgentSelection(parsedAgent, {
@@ -30094,11 +30142,11 @@ async function automationEditCommand(id, options) {
30094
30142
  return trigger;
30095
30143
  });
30096
30144
  if (!matchedGithub) {
30097
- console.log(import_chalk17.default.red("No existing GitHub trigger found. Pass --trigger-github to create one."));
30145
+ console.log(import_chalk18.default.red("No existing GitHub trigger found. Pass --trigger-github to create one."));
30098
30146
  process.exit(1);
30099
30147
  }
30100
30148
  if (!matchedGitlab) {
30101
- console.log(import_chalk17.default.red("No existing GitLab trigger found. Pass --trigger-gitlab to create one."));
30149
+ console.log(import_chalk18.default.red("No existing GitLab trigger found. Pass --trigger-gitlab to create one."));
30102
30150
  process.exit(1);
30103
30151
  }
30104
30152
  }
@@ -30121,25 +30169,25 @@ async function automationEditCommand(id, options) {
30121
30169
  Object.assign(body, agentSelection);
30122
30170
  }
30123
30171
  if (Object.keys(body).length === 0) {
30124
- console.log(import_chalk17.default.yellow("\nNo changes made.\n"));
30172
+ console.log(import_chalk18.default.yellow("\nNo changes made.\n"));
30125
30173
  return;
30126
30174
  }
30127
- console.log(import_chalk17.default.gray("\nUpdating automation..."));
30175
+ console.log(import_chalk18.default.gray("\nUpdating automation..."));
30128
30176
  const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
30129
30177
  method: "PATCH",
30130
30178
  body
30131
30179
  });
30132
30180
  const automation2 = response.automation;
30133
- console.log(import_chalk17.default.green(`
30181
+ console.log(import_chalk18.default.green(`
30134
30182
  Updated automation: ${automation2.name}`));
30135
- console.log(import_chalk17.default.gray(` ID: ${automation2.id}`));
30136
- console.log(import_chalk17.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
30183
+ console.log(import_chalk18.default.gray(` ID: ${automation2.id}`));
30184
+ console.log(import_chalk18.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
30137
30185
  if (automation2.triggers.length > 0) {
30138
- console.log(import_chalk17.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
30186
+ console.log(import_chalk18.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
30139
30187
  }
30140
30188
  console.log();
30141
30189
  } catch (error51) {
30142
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30190
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30143
30191
  process.exit(1);
30144
30192
  }
30145
30193
  }
@@ -30150,12 +30198,12 @@ async function automationRunCommand(id) {
30150
30198
  const automation2 = existing.automation;
30151
30199
  const hasCronTrigger = automation2.triggers.some((t) => t.type === "cron");
30152
30200
  if (!hasCronTrigger) {
30153
- console.log(import_chalk17.default.red("\nManual run is only allowed for automations with a cron trigger."));
30154
- console.log(import_chalk17.default.gray(`This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
30201
+ console.log(import_chalk18.default.red("\nManual run is only allowed for automations with a cron trigger."));
30202
+ console.log(import_chalk18.default.gray(`This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
30155
30203
  console.log();
30156
30204
  process.exit(1);
30157
30205
  }
30158
- console.log(import_chalk17.default.gray(`
30206
+ console.log(import_chalk18.default.gray(`
30159
30207
  Triggering automation "${automation2.name}"...`));
30160
30208
  const response = await orgAuthenticatedFetch(
30161
30209
  `/v1/automations/${id}/trigger`,
@@ -30165,20 +30213,20 @@ Triggering automation "${automation2.name}"...`));
30165
30213
  }
30166
30214
  );
30167
30215
  if (!response.execution_id) {
30168
- console.log(import_chalk17.default.red(`
30216
+ console.log(import_chalk18.default.red(`
30169
30217
  Automation trigger returned no execution ID. The automation may not have started.`));
30170
30218
  console.log();
30171
30219
  process.exit(1);
30172
30220
  }
30173
- console.log(import_chalk17.default.green(`
30221
+ console.log(import_chalk18.default.green(`
30174
30222
  Automation triggered successfully.`));
30175
- console.log(import_chalk17.default.gray(` Execution ID: ${response.execution_id}`));
30223
+ console.log(import_chalk18.default.gray(` Execution ID: ${response.execution_id}`));
30176
30224
  if (response.workspace_id) {
30177
- console.log(import_chalk17.default.gray(` Workspace ID: ${response.workspace_id}`));
30225
+ console.log(import_chalk18.default.gray(` Workspace ID: ${response.workspace_id}`));
30178
30226
  }
30179
30227
  console.log();
30180
30228
  } catch (error51) {
30181
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30229
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30182
30230
  process.exit(1);
30183
30231
  }
30184
30232
  }
@@ -30195,38 +30243,38 @@ async function automationDeleteCommand(id, options) {
30195
30243
  initial: false
30196
30244
  });
30197
30245
  if (!response.confirm) {
30198
- console.log(import_chalk17.default.yellow("\nCancelled."));
30246
+ console.log(import_chalk18.default.yellow("\nCancelled."));
30199
30247
  return;
30200
30248
  }
30201
30249
  }
30202
30250
  await orgAuthenticatedFetch(`/v1/automations/${id}`, {
30203
30251
  method: "DELETE"
30204
30252
  });
30205
- console.log(import_chalk17.default.green(`
30253
+ console.log(import_chalk18.default.green(`
30206
30254
  Automation "${automationName}" (${id}) deleted.
30207
30255
  `));
30208
30256
  } catch (error51) {
30209
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30257
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30210
30258
  process.exit(1);
30211
30259
  }
30212
30260
  }
30213
30261
  async function automationCheckCommand(checkRunId, options) {
30214
30262
  const id = Number(checkRunId);
30215
30263
  if (!Number.isSafeInteger(id)) {
30216
- console.error(import_chalk17.default.red("Error: check run ID must be an integer"));
30264
+ console.error(import_chalk18.default.red("Error: check run ID must be an integer"));
30217
30265
  process.exit(1);
30218
30266
  }
30219
30267
  if (!options.token) {
30220
- console.error(import_chalk17.default.red("Error: --token is required"));
30268
+ console.error(import_chalk18.default.red("Error: --token is required"));
30221
30269
  process.exit(1);
30222
30270
  }
30223
30271
  const { conclusion } = options;
30224
30272
  if (!isAutomationCheckConclusion(conclusion)) {
30225
- console.error(import_chalk17.default.red(`Error: --conclusion must be one of ${AUTOMATION_CHECK_CONCLUSIONS.join(", ")}`));
30273
+ console.error(import_chalk18.default.red(`Error: --conclusion must be one of ${AUTOMATION_CHECK_CONCLUSIONS.join(", ")}`));
30226
30274
  process.exit(1);
30227
30275
  }
30228
30276
  if (!options.title?.trim()) {
30229
- console.error(import_chalk17.default.red("Error: --title is required"));
30277
+ console.error(import_chalk18.default.red("Error: --title is required"));
30230
30278
  process.exit(1);
30231
30279
  }
30232
30280
  const body = {
@@ -30240,19 +30288,19 @@ async function automationCheckCommand(checkRunId, options) {
30240
30288
  `/v1/automations/checks/${id}`,
30241
30289
  { method: "POST", body }
30242
30290
  );
30243
- console.log(response.reported ? import_chalk17.default.green(`
30291
+ console.log(response.reported ? import_chalk18.default.green(`
30244
30292
  Reported ${conclusion} for "${response.name}".
30245
- `) : import_chalk17.default.yellow(`
30293
+ `) : import_chalk18.default.yellow(`
30246
30294
  Skipped "${response.name}" \u2014 a newer run of this automation owns it and will report the verdict.
30247
30295
  `));
30248
30296
  } catch (error51) {
30249
- console.error(import_chalk17.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30297
+ console.error(import_chalk18.default.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
30250
30298
  process.exit(1);
30251
30299
  }
30252
30300
  }
30253
30301
 
30254
30302
  // src/commands/preview.ts
30255
- var import_chalk18 = __toESM(require("chalk"));
30303
+ var import_chalk19 = __toESM(require("chalk"));
30256
30304
 
30257
30305
  // src/lib/agent-api.ts
30258
30306
  var ENGINE_PORT = process.env.REPLICAS_ENGINE_PORT || "3737";
@@ -30304,13 +30352,7 @@ async function engineFetch(path6, options) {
30304
30352
  }
30305
30353
 
30306
30354
  // src/commands/preview.ts
30307
- function parsePreviewPort(port) {
30308
- const portNum = parseInt(port, 10);
30309
- if (isNaN(portNum) || portNum < 1 || portNum > 65535) {
30310
- throw new Error("Port must be a number between 1 and 65535");
30311
- }
30312
- return portNum;
30313
- }
30355
+ var parsePreviewPort = parsePort;
30314
30356
  function createAgentPreview(port, authenticated) {
30315
30357
  return agentFetch("/v1/previews", {
30316
30358
  method: "POST",
@@ -30352,11 +30394,11 @@ async function previewListCommand(workspaceId) {
30352
30394
  `/v1/workspaces/${workspaceId}/previews`
30353
30395
  );
30354
30396
  if (result.previews.length === 0) {
30355
- console.log(import_chalk18.default.dim("No active previews"));
30397
+ console.log(import_chalk19.default.dim("No active previews"));
30356
30398
  return;
30357
30399
  }
30358
30400
  for (const preview2 of result.previews) {
30359
- console.log(` ${import_chalk18.default.cyan(String(preview2.port))} \u2192 ${import_chalk18.default.underline(preview2.publicUrl)}`);
30401
+ console.log(` ${import_chalk19.default.cyan(String(preview2.port))} \u2192 ${import_chalk19.default.underline(preview2.publicUrl)}`);
30360
30402
  }
30361
30403
  }
30362
30404
  }
@@ -30369,7 +30411,7 @@ async function previewAddCommand(workspaceId, options) {
30369
30411
  body: { port: portNum, authenticated: options.authenticated ?? false }
30370
30412
  }
30371
30413
  );
30372
- console.log(import_chalk18.default.green(`Preview created: ${result.preview.publicUrl}`));
30414
+ console.log(import_chalk19.default.green(`Preview created: ${result.preview.publicUrl}`));
30373
30415
  }
30374
30416
  async function previewDeleteCommand(port) {
30375
30417
  const portNum = parsePreviewPort(port);
@@ -30382,7 +30424,7 @@ async function previewRemoveCommand(workspaceId, options) {
30382
30424
  `/v1/workspaces/${workspaceId}/previews/${portNum}`,
30383
30425
  { method: "DELETE" }
30384
30426
  );
30385
- console.log(import_chalk18.default.green(`Preview deleted on port ${portNum}`));
30427
+ console.log(import_chalk19.default.green(`Preview deleted on port ${portNum}`));
30386
30428
  }
30387
30429
 
30388
30430
  // src/commands/media.ts
@@ -30555,7 +30597,7 @@ async function mediaListCommand(options) {
30555
30597
  }
30556
30598
 
30557
30599
  // src/commands/slack.ts
30558
- var import_chalk19 = __toESM(require("chalk"));
30600
+ var import_chalk20 = __toESM(require("chalk"));
30559
30601
  function getThreadOptions(options) {
30560
30602
  const channelId = options.channel || process.env.REPLICAS_SLACK_CHANNEL_ID || process.env.SLACK_CHANNEL_ID;
30561
30603
  const threadTs = options.threadTs || process.env.REPLICAS_SLACK_THREAD_TS || process.env.SLACK_THREAD_TS;
@@ -30572,10 +30614,10 @@ async function attachThread(request) {
30572
30614
  method: "POST",
30573
30615
  body: request
30574
30616
  });
30575
- console.log(import_chalk19.default.green("Slack thread attached."));
30576
- console.log(import_chalk19.default.gray(` Channel: ${response.thread.channel_id}`));
30577
- console.log(import_chalk19.default.gray(` Thread: ${response.thread.thread_ts}`));
30578
- console.log(import_chalk19.default.gray(` Workspace: ${response.workspace.name} (${response.workspace.id})`));
30617
+ console.log(import_chalk20.default.green("Slack thread attached."));
30618
+ console.log(import_chalk20.default.gray(` Channel: ${response.thread.channel_id}`));
30619
+ console.log(import_chalk20.default.gray(` Thread: ${response.thread.thread_ts}`));
30620
+ console.log(import_chalk20.default.gray(` Workspace: ${response.workspace.name} (${response.workspace.id})`));
30579
30621
  }
30580
30622
  async function slackThreadAttachCommand(options) {
30581
30623
  const agentConfig = readAgentConfig();
@@ -30604,7 +30646,7 @@ async function slackThreadSwitchCommand(workspace, options) {
30604
30646
  }
30605
30647
 
30606
30648
  // src/commands/service.ts
30607
- var import_chalk20 = __toESM(require("chalk"));
30649
+ var import_chalk21 = __toESM(require("chalk"));
30608
30650
  var import_node_child_process = require("child_process");
30609
30651
  var import_node_fs = require("fs");
30610
30652
  var import_node_os = require("os");
@@ -30747,7 +30789,7 @@ async function serviceListCommand() {
30747
30789
  return;
30748
30790
  }
30749
30791
  for (const state of states) {
30750
- const status = isRunning(state.pid) ? import_chalk20.default.green("running") : import_chalk20.default.red("stopped");
30792
+ const status = isRunning(state.pid) ? import_chalk21.default.green("running") : import_chalk21.default.red("stopped");
30751
30793
  console.log(`${state.name} ${status} pid ${state.pid} started ${state.startedAt}`);
30752
30794
  console.log(` command: ${state.command} (cwd: ${state.cwd})`);
30753
30795
  console.log(` logs: ${state.logFile}`);
@@ -30807,7 +30849,7 @@ async function mothershipRelayCommand(options) {
30807
30849
 
30808
30850
  // src/commands/environment.ts
30809
30851
  var import_fs5 = __toESM(require("fs"));
30810
- var import_chalk21 = __toESM(require("chalk"));
30852
+ var import_chalk22 = __toESM(require("chalk"));
30811
30853
  var import_prompts8 = __toESM(require("prompts"));
30812
30854
  var UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
30813
30855
  function maskValue(value) {
@@ -30820,38 +30862,38 @@ async function resolveEnvironmentId(input) {
30820
30862
  const response = await orgAuthenticatedFetch("/v1/environments");
30821
30863
  const resolved = resolveByNameOrId(input, response.environments);
30822
30864
  if (!resolved) {
30823
- console.log(import_chalk21.default.red(`Environment not found: ${input}`));
30865
+ console.log(import_chalk22.default.red(`Environment not found: ${input}`));
30824
30866
  const available = response.environments.map((e) => e.name).join(", ");
30825
- console.log(import_chalk21.default.gray(`Available: ${available || "(none)"}`));
30867
+ console.log(import_chalk22.default.gray(`Available: ${available || "(none)"}`));
30826
30868
  process.exit(1);
30827
30869
  }
30828
30870
  return resolved.id;
30829
30871
  }
30830
30872
  function printEnvironment(env) {
30831
- console.log(import_chalk21.default.white(` ${env.name}${env.is_global ? import_chalk21.default.gray(" (global)") : ""}`));
30832
- console.log(import_chalk21.default.gray(` ID: ${env.id}`));
30873
+ console.log(import_chalk22.default.white(` ${env.name}${env.is_global ? import_chalk22.default.gray(" (global)") : ""}`));
30874
+ console.log(import_chalk22.default.gray(` ID: ${env.id}`));
30833
30875
  if (env.description) {
30834
- console.log(import_chalk21.default.gray(` Description: ${env.description}`));
30876
+ console.log(import_chalk22.default.gray(` Description: ${env.description}`));
30835
30877
  }
30836
30878
  if (env.repository_id) {
30837
- console.log(import_chalk21.default.gray(` Repository: ${env.repository_id}`));
30879
+ console.log(import_chalk22.default.gray(` Repository: ${env.repository_id}`));
30838
30880
  } else if (env.repository_set_id) {
30839
- console.log(import_chalk21.default.gray(` Repository Set: ${env.repository_set_id}`));
30881
+ console.log(import_chalk22.default.gray(` Repository Set: ${env.repository_set_id}`));
30840
30882
  }
30841
30883
  if (env.variable_count !== void 0) {
30842
- console.log(import_chalk21.default.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
30884
+ console.log(import_chalk22.default.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
30843
30885
  }
30844
- console.log(import_chalk21.default.gray(` Updated: ${formatDate2(env.updated_at)}`));
30886
+ console.log(import_chalk22.default.gray(` Updated: ${formatDate2(env.updated_at)}`));
30845
30887
  console.log();
30846
30888
  }
30847
30889
  async function environmentListCommand() {
30848
30890
  ensureOrgApiAuthenticated();
30849
30891
  const response = await orgAuthenticatedFetch("/v1/environments");
30850
30892
  if (response.environments.length === 0) {
30851
- console.log(import_chalk21.default.yellow("\nNo environments found.\n"));
30893
+ console.log(import_chalk22.default.yellow("\nNo environments found.\n"));
30852
30894
  return;
30853
30895
  }
30854
- console.log(import_chalk21.default.green(`
30896
+ console.log(import_chalk22.default.green(`
30855
30897
  Environments (${response.environments.length}):
30856
30898
  `));
30857
30899
  for (const env of response.environments) {
@@ -30862,7 +30904,7 @@ async function environmentGetCommand(idOrName) {
30862
30904
  ensureOrgApiAuthenticated();
30863
30905
  const id = await resolveEnvironmentId(idOrName);
30864
30906
  const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
30865
- console.log(import_chalk21.default.green(`
30907
+ console.log(import_chalk22.default.green(`
30866
30908
  Environment: ${response.environment.name}
30867
30909
  `));
30868
30910
  printEnvironment(response.environment);
@@ -30878,7 +30920,7 @@ async function environmentCreateCommand(name, options) {
30878
30920
  validate: (v) => v.trim() ? true : "Name is required"
30879
30921
  });
30880
30922
  if (!r.name) {
30881
- console.log(import_chalk21.default.yellow("\nCancelled."));
30923
+ console.log(import_chalk22.default.yellow("\nCancelled."));
30882
30924
  return;
30883
30925
  }
30884
30926
  envName = r.name;
@@ -30891,8 +30933,8 @@ async function environmentCreateCommand(name, options) {
30891
30933
  const repos2 = await orgAuthenticatedFetch("/v1/repositories");
30892
30934
  const repo = repos2.repositories.find((r) => r.name === options.repository);
30893
30935
  if (!repo) {
30894
- console.log(import_chalk21.default.red(`Repository not found: ${options.repository}`));
30895
- console.log(import_chalk21.default.gray(`Available: ${repos2.repositories.map((r) => r.name).join(", ")}`));
30936
+ console.log(import_chalk22.default.red(`Repository not found: ${options.repository}`));
30937
+ console.log(import_chalk22.default.gray(`Available: ${repos2.repositories.map((r) => r.name).join(", ")}`));
30896
30938
  process.exit(1);
30897
30939
  }
30898
30940
  repositoryId = repo.id;
@@ -30922,9 +30964,9 @@ async function environmentCreateCommand(name, options) {
30922
30964
  method: "POST",
30923
30965
  body
30924
30966
  });
30925
- console.log(import_chalk21.default.green(`
30967
+ console.log(import_chalk22.default.green(`
30926
30968
  Created environment: ${response.environment.name}`));
30927
- console.log(import_chalk21.default.gray(` ID: ${response.environment.id}
30969
+ console.log(import_chalk22.default.gray(` ID: ${response.environment.id}
30928
30970
  `));
30929
30971
  }
30930
30972
  async function environmentEditCommand(idOrName, options) {
@@ -30943,21 +30985,21 @@ async function environmentEditCommand(idOrName, options) {
30943
30985
  const repos2 = await orgAuthenticatedFetch("/v1/repositories");
30944
30986
  const repo = repos2.repositories.find((r) => r.name === options.repository);
30945
30987
  if (!repo) {
30946
- console.log(import_chalk21.default.red(`Repository not found: ${options.repository}`));
30988
+ console.log(import_chalk22.default.red(`Repository not found: ${options.repository}`));
30947
30989
  process.exit(1);
30948
30990
  }
30949
30991
  body.repository_id = repo.id;
30950
30992
  }
30951
30993
  }
30952
30994
  if (Object.keys(body).length === 0) {
30953
- console.log(import_chalk21.default.yellow("\nNo changes specified. Pass --name, --description, --repository, or --system-prompt."));
30995
+ console.log(import_chalk22.default.yellow("\nNo changes specified. Pass --name, --description, --repository, or --system-prompt."));
30954
30996
  return;
30955
30997
  }
30956
30998
  const response = await orgAuthenticatedFetch(`/v1/environments/${id}`, {
30957
30999
  method: "PATCH",
30958
31000
  body
30959
31001
  });
30960
- console.log(import_chalk21.default.green(`
31002
+ console.log(import_chalk22.default.green(`
30961
31003
  Updated environment: ${response.environment.name}
30962
31004
  `));
30963
31005
  }
@@ -30972,20 +31014,20 @@ async function environmentDeleteCommand(idOrName, options) {
30972
31014
  initial: false
30973
31015
  });
30974
31016
  if (!r.confirm) {
30975
- console.log(import_chalk21.default.yellow("\nCancelled."));
31017
+ console.log(import_chalk22.default.yellow("\nCancelled."));
30976
31018
  return;
30977
31019
  }
30978
31020
  }
30979
31021
  await orgAuthenticatedFetch(`/v1/environments/${id}`, { method: "DELETE" });
30980
- console.log(import_chalk21.default.green(`
31022
+ console.log(import_chalk22.default.green(`
30981
31023
  Deleted environment ${idOrName}.
30982
31024
  `));
30983
31025
  }
30984
31026
  function printVariable(v, reveal) {
30985
- console.log(import_chalk21.default.white(` ${v.key}`));
30986
- console.log(import_chalk21.default.gray(` ID: ${v.id}`));
30987
- console.log(import_chalk21.default.gray(` Value: ${reveal ? v.value : maskValue(v.value)}`));
30988
- console.log(import_chalk21.default.gray(` Updated: ${formatDate2(v.updated_at)}`));
31027
+ console.log(import_chalk22.default.white(` ${v.key}`));
31028
+ console.log(import_chalk22.default.gray(` ID: ${v.id}`));
31029
+ console.log(import_chalk22.default.gray(` Value: ${reveal ? v.value : maskValue(v.value)}`));
31030
+ console.log(import_chalk22.default.gray(` Updated: ${formatDate2(v.updated_at)}`));
30989
31031
  console.log();
30990
31032
  }
30991
31033
  async function envVarsListCommand(envIdOrName, options) {
@@ -30995,14 +31037,14 @@ async function envVarsListCommand(envIdOrName, options) {
30995
31037
  `/v1/environments/${id}/variables`
30996
31038
  );
30997
31039
  if (response.environment_variables.length === 0) {
30998
- console.log(import_chalk21.default.yellow("\nNo variables.\n"));
31040
+ console.log(import_chalk22.default.yellow("\nNo variables.\n"));
30999
31041
  return;
31000
31042
  }
31001
- console.log(import_chalk21.default.green(`
31043
+ console.log(import_chalk22.default.green(`
31002
31044
  Variables (${response.environment_variables.length}):
31003
31045
  `));
31004
31046
  if (!options.reveal) {
31005
- console.log(import_chalk21.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
31047
+ console.log(import_chalk22.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
31006
31048
  }
31007
31049
  for (const v of response.environment_variables) printVariable(v, !!options.reveal);
31008
31050
  }
@@ -31019,7 +31061,7 @@ async function envVarsSetCommand(envIdOrName, key, value) {
31019
31061
  `/v1/environments/${id}/variables/${match.id}`,
31020
31062
  { method: "PATCH", body: body2 }
31021
31063
  );
31022
- console.log(import_chalk21.default.green(`
31064
+ console.log(import_chalk22.default.green(`
31023
31065
  Updated variable ${response2.environment_variable.key}.
31024
31066
  `));
31025
31067
  return;
@@ -31033,7 +31075,7 @@ Updated variable ${response2.environment_variable.key}.
31033
31075
  `/v1/environments/${id}/variables`,
31034
31076
  { method: "POST", body }
31035
31077
  );
31036
- console.log(import_chalk21.default.green(`
31078
+ console.log(import_chalk22.default.green(`
31037
31079
  Created variable ${response.environment_variable.key}.
31038
31080
  `));
31039
31081
  }
@@ -31047,7 +31089,7 @@ async function envVarsDeleteCommand(envIdOrName, keyOrId, options) {
31047
31089
  );
31048
31090
  const match = existing.environment_variables.find((v) => v.key === keyOrId);
31049
31091
  if (!match) {
31050
- console.log(import_chalk21.default.red(`Variable not found: ${keyOrId}`));
31092
+ console.log(import_chalk22.default.red(`Variable not found: ${keyOrId}`));
31051
31093
  process.exit(1);
31052
31094
  }
31053
31095
  variableId = match.id;
@@ -31060,23 +31102,23 @@ async function envVarsDeleteCommand(envIdOrName, keyOrId, options) {
31060
31102
  initial: false
31061
31103
  });
31062
31104
  if (!r.confirm) {
31063
- console.log(import_chalk21.default.yellow("\nCancelled."));
31105
+ console.log(import_chalk22.default.yellow("\nCancelled."));
31064
31106
  return;
31065
31107
  }
31066
31108
  }
31067
31109
  await orgAuthenticatedFetch(`/v1/environments/${id}/variables/${variableId}`, {
31068
31110
  method: "DELETE"
31069
31111
  });
31070
- console.log(import_chalk21.default.green(`
31112
+ console.log(import_chalk22.default.green(`
31071
31113
  Deleted variable ${keyOrId}.
31072
31114
  `));
31073
31115
  }
31074
31116
  function printFile(f) {
31075
- console.log(import_chalk21.default.white(` ${f.path}`));
31076
- console.log(import_chalk21.default.gray(` ID: ${f.id}`));
31077
- console.log(import_chalk21.default.gray(` Name: ${f.name}`));
31078
- console.log(import_chalk21.default.gray(` Size: ${f.content.length} bytes`));
31079
- console.log(import_chalk21.default.gray(` Updated: ${formatDate2(f.updated_at)}`));
31117
+ console.log(import_chalk22.default.white(` ${f.path}`));
31118
+ console.log(import_chalk22.default.gray(` ID: ${f.id}`));
31119
+ console.log(import_chalk22.default.gray(` Name: ${f.name}`));
31120
+ console.log(import_chalk22.default.gray(` Size: ${f.content.length} bytes`));
31121
+ console.log(import_chalk22.default.gray(` Updated: ${formatDate2(f.updated_at)}`));
31080
31122
  console.log();
31081
31123
  }
31082
31124
  async function envFilesListCommand(envIdOrName) {
@@ -31086,10 +31128,10 @@ async function envFilesListCommand(envIdOrName) {
31086
31128
  `/v1/environments/${id}/files`
31087
31129
  );
31088
31130
  if (response.environment_files.length === 0) {
31089
- console.log(import_chalk21.default.yellow("\nNo files.\n"));
31131
+ console.log(import_chalk22.default.yellow("\nNo files.\n"));
31090
31132
  return;
31091
31133
  }
31092
- console.log(import_chalk21.default.green(`
31134
+ console.log(import_chalk22.default.green(`
31093
31135
  Files (${response.environment_files.length}):
31094
31136
  `));
31095
31137
  for (const f of response.environment_files) printFile(f);
@@ -31120,7 +31162,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
31120
31162
  `/v1/environments/${id}/files/${match.id}`,
31121
31163
  { method: "PATCH", body: body2 }
31122
31164
  );
31123
- console.log(import_chalk21.default.green(`
31165
+ console.log(import_chalk22.default.green(`
31124
31166
  Updated file ${response2.environment_file.path}.
31125
31167
  `));
31126
31168
  return;
@@ -31135,7 +31177,7 @@ Updated file ${response2.environment_file.path}.
31135
31177
  `/v1/environments/${id}/files`,
31136
31178
  { method: "POST", body }
31137
31179
  );
31138
- console.log(import_chalk21.default.green(`
31180
+ console.log(import_chalk22.default.green(`
31139
31181
  Created file ${response.environment_file.path}.
31140
31182
  `));
31141
31183
  }
@@ -31149,7 +31191,7 @@ async function envFilesDeleteCommand(envIdOrName, pathOrId, options) {
31149
31191
  );
31150
31192
  const match = existing.environment_files.find((f) => f.path === pathOrId);
31151
31193
  if (!match) {
31152
- console.log(import_chalk21.default.red(`File not found: ${pathOrId}`));
31194
+ console.log(import_chalk22.default.red(`File not found: ${pathOrId}`));
31153
31195
  process.exit(1);
31154
31196
  }
31155
31197
  fileId = match.id;
@@ -31162,14 +31204,14 @@ async function envFilesDeleteCommand(envIdOrName, pathOrId, options) {
31162
31204
  initial: false
31163
31205
  });
31164
31206
  if (!r.confirm) {
31165
- console.log(import_chalk21.default.yellow("\nCancelled."));
31207
+ console.log(import_chalk22.default.yellow("\nCancelled."));
31166
31208
  return;
31167
31209
  }
31168
31210
  }
31169
31211
  await orgAuthenticatedFetch(`/v1/environments/${id}/files/${fileId}`, {
31170
31212
  method: "DELETE"
31171
31213
  });
31172
- console.log(import_chalk21.default.green(`
31214
+ console.log(import_chalk22.default.green(`
31173
31215
  Deleted file ${pathOrId}.
31174
31216
  `));
31175
31217
  }
@@ -31178,16 +31220,16 @@ async function envHookGetCommand(envIdOrName, kind) {
31178
31220
  const id = await resolveEnvironmentId(envIdOrName);
31179
31221
  const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
31180
31222
  if (!hook) {
31181
- console.log(import_chalk21.default.yellow(`
31223
+ console.log(import_chalk22.default.yellow(`
31182
31224
  No ${kind} hook configured.
31183
31225
  `));
31184
31226
  return;
31185
31227
  }
31186
- console.log(import_chalk21.default.green(`
31228
+ console.log(import_chalk22.default.green(`
31187
31229
  ${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
31188
31230
  `));
31189
- console.log(import_chalk21.default.gray(` ID: ${hook.id}`));
31190
- console.log(import_chalk21.default.gray(` Created: ${formatDate2(hook.created_at)}
31231
+ console.log(import_chalk22.default.gray(` ID: ${hook.id}`));
31232
+ console.log(import_chalk22.default.gray(` Created: ${formatDate2(hook.created_at)}
31191
31233
  `));
31192
31234
  console.log(hook.content);
31193
31235
  console.log();
@@ -31202,7 +31244,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
31202
31244
  `/v1/environments/${id}/warm-hooks/save`,
31203
31245
  { method: "POST", body: body2 }
31204
31246
  );
31205
- console.log(import_chalk21.default.green(`
31247
+ console.log(import_chalk22.default.green(`
31206
31248
  Saved warm hook v${response2.warm_hook.version}.
31207
31249
  `));
31208
31250
  return;
@@ -31212,7 +31254,7 @@ Saved warm hook v${response2.warm_hook.version}.
31212
31254
  `/v1/environments/${id}/start-hooks/save`,
31213
31255
  { method: "POST", body }
31214
31256
  );
31215
- console.log(import_chalk21.default.green(response.start_hook ? `
31257
+ console.log(import_chalk22.default.green(response.start_hook ? `
31216
31258
  Saved start hook v${response.start_hook.version}.
31217
31259
  ` : "\nCleared start hook.\n"));
31218
31260
  }
@@ -31229,7 +31271,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
31229
31271
  body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
31230
31272
  onEvent: (event) => {
31231
31273
  if (event.type === "progress" && event.message) {
31232
- console.log(import_chalk21.default.gray(event.message));
31274
+ console.log(import_chalk22.default.gray(event.message));
31233
31275
  } else if (event.type === "output" && event.output) {
31234
31276
  process.stdout.write(event.output);
31235
31277
  } else if (event.type === "complete") {
@@ -31242,23 +31284,23 @@ async function envHookTestCommand(envIdOrName, options, kind) {
31242
31284
  }
31243
31285
  );
31244
31286
  if (errorMessage) {
31245
- console.log(import_chalk21.default.red(`
31287
+ console.log(import_chalk22.default.red(`
31246
31288
  ${errorMessage}
31247
31289
  `));
31248
31290
  process.exit(1);
31249
31291
  }
31250
31292
  if (timedOut) {
31251
- console.log(import_chalk21.default.yellow(`
31293
+ console.log(import_chalk22.default.yellow(`
31252
31294
  ${kind === "warm" ? "Warm" : "Start"} hook timed out.
31253
31295
  `));
31254
31296
  process.exit(1);
31255
31297
  }
31256
31298
  if (exitCode === 0) {
31257
- console.log(import_chalk21.default.green(`
31299
+ console.log(import_chalk22.default.green(`
31258
31300
  ${kind === "warm" ? "Warm" : "Start"} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
31259
31301
  `));
31260
31302
  } else {
31261
- console.log(import_chalk21.default.red(`
31303
+ console.log(import_chalk22.default.red(`
31262
31304
  ${kind === "warm" ? "Warm" : "Start"} hook failed (exit code ${exitCode ?? "unknown"}).
31263
31305
  `));
31264
31306
  process.exit(1);
@@ -31273,24 +31315,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
31273
31315
  `/v1/environments/${id}/start-hooks/repository-hooks`
31274
31316
  )).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
31275
31317
  if (repositories.length === 0) {
31276
- console.log(import_chalk21.default.yellow("\nNo repositories bound to this environment.\n"));
31318
+ console.log(import_chalk22.default.yellow("\nNo repositories bound to this environment.\n"));
31277
31319
  return;
31278
31320
  }
31279
- console.log(import_chalk21.default.green(`
31321
+ console.log(import_chalk22.default.green(`
31280
31322
  Repository ${kind} hooks (${repositories.length}):
31281
31323
  `));
31282
31324
  for (const repo of repositories) {
31283
- console.log(import_chalk21.default.white(` ${repo.repository_name} @${repo.default_branch}`));
31325
+ console.log(import_chalk22.default.white(` ${repo.repository_name} @${repo.default_branch}`));
31284
31326
  if (repo.error) {
31285
- console.log(import_chalk21.default.red(` Error: ${repo.error}`));
31327
+ console.log(import_chalk22.default.red(` Error: ${repo.error}`));
31286
31328
  } else if (repo.hook) {
31287
- console.log(import_chalk21.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
31288
- console.log(import_chalk21.default.gray(` Commands (${repo.hook.commands.length}):`));
31329
+ console.log(import_chalk22.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
31330
+ console.log(import_chalk22.default.gray(` Commands (${repo.hook.commands.length}):`));
31289
31331
  for (const cmd of repo.hook.commands) {
31290
- console.log(import_chalk21.default.gray(` ${cmd}`));
31332
+ console.log(import_chalk22.default.gray(` ${cmd}`));
31291
31333
  }
31292
31334
  } else {
31293
- console.log(import_chalk21.default.gray(` No ${kind}Hook defined.`));
31335
+ console.log(import_chalk22.default.gray(` No ${kind}Hook defined.`));
31294
31336
  }
31295
31337
  console.log();
31296
31338
  }
@@ -31354,7 +31396,7 @@ program.hook("preAction", async (_command, actionCommand) => {
31354
31396
  throw new Error('No organization selected. Run "replicas org switch" to select one.');
31355
31397
  }
31356
31398
  } catch (error51) {
31357
- console.error(import_chalk22.default.red(`
31399
+ console.error(import_chalk23.default.red(`
31358
31400
  \u2717 ${error51 instanceof Error ? error51.message : "Unknown error"}
31359
31401
  `));
31360
31402
  process.exit(1);
@@ -31368,7 +31410,7 @@ function registerSlackCommands(parent) {
31368
31410
  await slackThreadAttachCommand(options);
31369
31411
  } catch (error51) {
31370
31412
  if (error51 instanceof Error) {
31371
- console.error(import_chalk22.default.red(`
31413
+ console.error(import_chalk23.default.red(`
31372
31414
  \u2717 ${error51.message}
31373
31415
  `));
31374
31416
  }
@@ -31380,7 +31422,7 @@ function registerSlackCommands(parent) {
31380
31422
  await slackThreadSwitchCommand(workspace, options);
31381
31423
  } catch (error51) {
31382
31424
  if (error51 instanceof Error) {
31383
- console.error(import_chalk22.default.red(`
31425
+ console.error(import_chalk23.default.red(`
31384
31426
  \u2717 ${error51.message}
31385
31427
  `));
31386
31428
  }
@@ -31394,7 +31436,7 @@ program.command("login").description("Authenticate with your Replicas account").
31394
31436
  await loginCommand();
31395
31437
  } catch (error51) {
31396
31438
  if (error51 instanceof Error) {
31397
- console.error(import_chalk22.default.red(`
31439
+ console.error(import_chalk23.default.red(`
31398
31440
  \u2717 ${error51.message}
31399
31441
  `));
31400
31442
  }
@@ -31406,7 +31448,7 @@ program.command("init").description("Create a replicas.json or replicas.yaml con
31406
31448
  initCommand(options);
31407
31449
  } catch (error51) {
31408
31450
  if (error51 instanceof Error) {
31409
- console.error(import_chalk22.default.red(`
31451
+ console.error(import_chalk23.default.red(`
31410
31452
  \u2717 ${error51.message}
31411
31453
  `));
31412
31454
  }
@@ -31418,7 +31460,7 @@ program.command("logout").description("Clear stored credentials").action(() => {
31418
31460
  logoutCommand();
31419
31461
  } catch (error51) {
31420
31462
  if (error51 instanceof Error) {
31421
- console.error(import_chalk22.default.red(`
31463
+ console.error(import_chalk23.default.red(`
31422
31464
  \u2717 ${error51.message}
31423
31465
  `));
31424
31466
  }
@@ -31430,7 +31472,7 @@ program.command("whoami").description("Display current authenticated user").acti
31430
31472
  await whoamiCommand();
31431
31473
  } catch (error51) {
31432
31474
  if (error51 instanceof Error) {
31433
- console.error(import_chalk22.default.red(`
31475
+ console.error(import_chalk23.default.red(`
31434
31476
  \u2717 ${error51.message}
31435
31477
  `));
31436
31478
  }
@@ -31442,7 +31484,7 @@ program.command("codex-auth").description("Connect your Codex credentials to Rep
31442
31484
  await codexAuthCommand(options);
31443
31485
  } catch (error51) {
31444
31486
  if (error51 instanceof Error) {
31445
- console.error(import_chalk22.default.red(`
31487
+ console.error(import_chalk23.default.red(`
31446
31488
  \u2717 ${error51.message}
31447
31489
  `));
31448
31490
  }
@@ -31454,7 +31496,7 @@ program.command("claude-auth").description("Connect your Claude Code credentials
31454
31496
  await claudeAuthCommand(options);
31455
31497
  } catch (error51) {
31456
31498
  if (error51 instanceof Error) {
31457
- console.error(import_chalk22.default.red(`
31499
+ console.error(import_chalk23.default.red(`
31458
31500
  \u2717 ${error51.message}
31459
31501
  `));
31460
31502
  }
@@ -31467,7 +31509,7 @@ org.command("switch").description("Switch to a different organization").action(a
31467
31509
  await orgSwitchCommand();
31468
31510
  } catch (error51) {
31469
31511
  if (error51 instanceof Error) {
31470
- console.error(import_chalk22.default.red(`
31512
+ console.error(import_chalk23.default.red(`
31471
31513
  \u2717 ${error51.message}
31472
31514
  `));
31473
31515
  }
@@ -31479,7 +31521,7 @@ org.action(async () => {
31479
31521
  await orgCommand();
31480
31522
  } catch (error51) {
31481
31523
  if (error51 instanceof Error) {
31482
- console.error(import_chalk22.default.red(`
31524
+ console.error(import_chalk23.default.red(`
31483
31525
  \u2717 ${error51.message}
31484
31526
  `));
31485
31527
  }
@@ -31491,19 +31533,28 @@ program.command("connect <workspace-name...>").description("Connect to a workspa
31491
31533
  await connectCommand(workspaceName.join(" "));
31492
31534
  } catch (error51) {
31493
31535
  if (error51 instanceof Error) {
31494
- console.error(import_chalk22.default.red(`
31536
+ console.error(import_chalk23.default.red(`
31495
31537
  \u2717 ${error51.message}
31496
31538
  `));
31497
31539
  }
31498
31540
  process.exit(1);
31499
31541
  }
31500
31542
  });
31543
+ program.command("tunnel <workspace-name...>").description("Forward a workspace port to localhost").requiredOption("-p, --port <port>", "Workspace port to forward").option("-l, --local-port <port>", "Local port (defaults to the workspace port)").action(async (workspaceName, options) => {
31544
+ try {
31545
+ await tunnelCommand(workspaceName.join(" "), options);
31546
+ } catch (error51) {
31547
+ console.error(import_chalk23.default.red(`
31548
+ Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
31549
+ process.exit(1);
31550
+ }
31551
+ });
31501
31552
  program.command("code <workspace-name...>").description("Open a workspace in VSCode/Cursor via Remote SSH").action(async (workspaceName) => {
31502
31553
  try {
31503
31554
  await codeCommand(workspaceName.join(" "));
31504
31555
  } catch (error51) {
31505
31556
  if (error51 instanceof Error) {
31506
- console.error(import_chalk22.default.red(`
31557
+ console.error(import_chalk23.default.red(`
31507
31558
  \u2717 ${error51.message}
31508
31559
  `));
31509
31560
  }
@@ -31516,7 +31567,7 @@ config2.command("get <key>").description("Get a configuration value").action(asy
31516
31567
  await configGetCommand(key);
31517
31568
  } catch (error51) {
31518
31569
  if (error51 instanceof Error) {
31519
- console.error(import_chalk22.default.red(`
31570
+ console.error(import_chalk23.default.red(`
31520
31571
  \u2717 ${error51.message}
31521
31572
  `));
31522
31573
  }
@@ -31528,7 +31579,7 @@ config2.command("set <key> <value>").description("Set a configuration value").ac
31528
31579
  await configSetCommand(key, value);
31529
31580
  } catch (error51) {
31530
31581
  if (error51 instanceof Error) {
31531
- console.error(import_chalk22.default.red(`
31582
+ console.error(import_chalk23.default.red(`
31532
31583
  \u2717 ${error51.message}
31533
31584
  `));
31534
31585
  }
@@ -31540,7 +31591,7 @@ config2.command("list").description("List all configuration values").action(asyn
31540
31591
  await configListCommand();
31541
31592
  } catch (error51) {
31542
31593
  if (error51 instanceof Error) {
31543
- console.error(import_chalk22.default.red(`
31594
+ console.error(import_chalk23.default.red(`
31544
31595
  \u2717 ${error51.message}
31545
31596
  `));
31546
31597
  }
@@ -31552,7 +31603,7 @@ program.command("list").description("List all replicas").option("-p, --page <pag
31552
31603
  await replicaListCommand(options);
31553
31604
  } catch (error51) {
31554
31605
  if (error51 instanceof Error) {
31555
- console.error(import_chalk22.default.red(`
31606
+ console.error(import_chalk23.default.red(`
31556
31607
  \u2717 ${error51.message}
31557
31608
  `));
31558
31609
  }
@@ -31564,7 +31615,7 @@ program.command("get <id>").description("Get replica details by ID").action(asyn
31564
31615
  await replicaGetCommand(id);
31565
31616
  } catch (error51) {
31566
31617
  if (error51 instanceof Error) {
31567
- console.error(import_chalk22.default.red(`
31618
+ console.error(import_chalk23.default.red(`
31568
31619
  \u2717 ${error51.message}
31569
31620
  `));
31570
31621
  }
@@ -31576,7 +31627,7 @@ program.command("create [name]").description("Create a new replica").option("-m,
31576
31627
  await replicaCreateCommand(name, options);
31577
31628
  } catch (error51) {
31578
31629
  if (error51 instanceof Error) {
31579
- console.error(import_chalk22.default.red(`
31630
+ console.error(import_chalk23.default.red(`
31580
31631
  \u2717 ${error51.message}
31581
31632
  `));
31582
31633
  }
@@ -31588,7 +31639,7 @@ program.command("send <id>").description("Send a message to a replica").option("
31588
31639
  await replicaSendCommand(id, options);
31589
31640
  } catch (error51) {
31590
31641
  if (error51 instanceof Error) {
31591
- console.error(import_chalk22.default.red(`
31642
+ console.error(import_chalk23.default.red(`
31592
31643
  \u2717 ${error51.message}
31593
31644
  `));
31594
31645
  }
@@ -31600,7 +31651,7 @@ program.command("delete <id>").description("Delete a replica").option("-f, --for
31600
31651
  await replicaDeleteCommand(id, options);
31601
31652
  } catch (error51) {
31602
31653
  if (error51 instanceof Error) {
31603
- console.error(import_chalk22.default.red(`
31654
+ console.error(import_chalk23.default.red(`
31604
31655
  \u2717 ${error51.message}
31605
31656
  `));
31606
31657
  }
@@ -31612,7 +31663,7 @@ program.command("read <id>").description("Read conversation history of a replica
31612
31663
  await replicaReadCommand(id, options);
31613
31664
  } catch (error51) {
31614
31665
  if (error51 instanceof Error) {
31615
- console.error(import_chalk22.default.red(`
31666
+ console.error(import_chalk23.default.red(`
31616
31667
  \u2717 ${error51.message}
31617
31668
  `));
31618
31669
  }
@@ -31625,7 +31676,7 @@ automation.command("list").description("List all automations").option("-p, --pag
31625
31676
  await automationListCommand(options);
31626
31677
  } catch (error51) {
31627
31678
  if (error51 instanceof Error) {
31628
- console.error(import_chalk22.default.red(`
31679
+ console.error(import_chalk23.default.red(`
31629
31680
  \u2717 ${error51.message}
31630
31681
  `));
31631
31682
  }
@@ -31637,7 +31688,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
31637
31688
  await automationGetCommand(id);
31638
31689
  } catch (error51) {
31639
31690
  if (error51 instanceof Error) {
31640
- console.error(import_chalk22.default.red(`
31691
+ console.error(import_chalk23.default.red(`
31641
31692
  \u2717 ${error51.message}
31642
31693
  `));
31643
31694
  }
@@ -31652,7 +31703,7 @@ automation.command("create [name]").description("Create a new automation").optio
31652
31703
  });
31653
31704
  } catch (error51) {
31654
31705
  if (error51 instanceof Error) {
31655
- console.error(import_chalk22.default.red(`
31706
+ console.error(import_chalk23.default.red(`
31656
31707
  \u2717 ${error51.message}
31657
31708
  `));
31658
31709
  }
@@ -31664,7 +31715,7 @@ automation.command("edit <id>").description("Edit an existing automation").optio
31664
31715
  await automationEditCommand(id, options);
31665
31716
  } catch (error51) {
31666
31717
  if (error51 instanceof Error) {
31667
- console.error(import_chalk22.default.red(`
31718
+ console.error(import_chalk23.default.red(`
31668
31719
  \u2717 ${error51.message}
31669
31720
  `));
31670
31721
  }
@@ -31676,7 +31727,7 @@ automation.command("run <id>").description("Manually trigger an automation (cron
31676
31727
  await automationRunCommand(id);
31677
31728
  } catch (error51) {
31678
31729
  if (error51 instanceof Error) {
31679
- console.error(import_chalk22.default.red(`
31730
+ console.error(import_chalk23.default.red(`
31680
31731
  \u2717 ${error51.message}
31681
31732
  `));
31682
31733
  }
@@ -31688,7 +31739,7 @@ automation.command("delete <id>").description("Delete an automation").option("-f
31688
31739
  await automationDeleteCommand(id, options);
31689
31740
  } catch (error51) {
31690
31741
  if (error51 instanceof Error) {
31691
- console.error(import_chalk22.default.red(`
31742
+ console.error(import_chalk23.default.red(`
31692
31743
  \u2717 ${error51.message}
31693
31744
  `));
31694
31745
  }
@@ -31700,7 +31751,7 @@ automation.command("check <checkRunId>").description("Report this automation run
31700
31751
  await automationCheckCommand(checkRunId, options);
31701
31752
  } catch (error51) {
31702
31753
  if (error51 instanceof Error) {
31703
- console.error(import_chalk22.default.red(`
31754
+ console.error(import_chalk23.default.red(`
31704
31755
  \u2717 ${error51.message}
31705
31756
  `));
31706
31757
  }
@@ -31712,7 +31763,7 @@ automation.action(async () => {
31712
31763
  await automationListCommand({});
31713
31764
  } catch (error51) {
31714
31765
  if (error51 instanceof Error) {
31715
- console.error(import_chalk22.default.red(`
31766
+ console.error(import_chalk23.default.red(`
31716
31767
  \u2717 ${error51.message}
31717
31768
  `));
31718
31769
  }
@@ -31725,7 +31776,7 @@ repos.command("list").description("List all repositories").action(async () => {
31725
31776
  await repositoriesListCommand();
31726
31777
  } catch (error51) {
31727
31778
  if (error51 instanceof Error) {
31728
- console.error(import_chalk22.default.red(`
31779
+ console.error(import_chalk23.default.red(`
31729
31780
  \u2717 ${error51.message}
31730
31781
  `));
31731
31782
  }
@@ -31737,7 +31788,7 @@ repos.action(async () => {
31737
31788
  await repositoriesListCommand();
31738
31789
  } catch (error51) {
31739
31790
  if (error51 instanceof Error) {
31740
- console.error(import_chalk22.default.red(`
31791
+ console.error(import_chalk23.default.red(`
31741
31792
  \u2717 ${error51.message}
31742
31793
  `));
31743
31794
  }
@@ -31750,7 +31801,7 @@ environment.command("list").description("List all environments").action(async ()
31750
31801
  await environmentListCommand();
31751
31802
  } catch (error51) {
31752
31803
  if (error51 instanceof Error) {
31753
- console.error(import_chalk22.default.red(`
31804
+ console.error(import_chalk23.default.red(`
31754
31805
  \u2717 ${error51.message}
31755
31806
  `));
31756
31807
  }
@@ -31762,7 +31813,7 @@ environment.command("get <id-or-name>").description('Get an environment by ID or
31762
31813
  await environmentGetCommand(idOrName);
31763
31814
  } catch (error51) {
31764
31815
  if (error51 instanceof Error) {
31765
- console.error(import_chalk22.default.red(`
31816
+ console.error(import_chalk23.default.red(`
31766
31817
  \u2717 ${error51.message}
31767
31818
  `));
31768
31819
  }
@@ -31774,7 +31825,7 @@ environment.command("create [name]").description("Create a new environment").opt
31774
31825
  await environmentCreateCommand(name, options);
31775
31826
  } catch (error51) {
31776
31827
  if (error51 instanceof Error) {
31777
- console.error(import_chalk22.default.red(`
31828
+ console.error(import_chalk23.default.red(`
31778
31829
  \u2717 ${error51.message}
31779
31830
  `));
31780
31831
  }
@@ -31786,7 +31837,7 @@ environment.command("edit <id-or-name>").description("Edit an environment").opti
31786
31837
  await environmentEditCommand(idOrName, options);
31787
31838
  } catch (error51) {
31788
31839
  if (error51 instanceof Error) {
31789
- console.error(import_chalk22.default.red(`
31840
+ console.error(import_chalk23.default.red(`
31790
31841
  \u2717 ${error51.message}
31791
31842
  `));
31792
31843
  }
@@ -31798,7 +31849,7 @@ environment.command("delete <id-or-name>").description("Delete an environment").
31798
31849
  await environmentDeleteCommand(idOrName, options);
31799
31850
  } catch (error51) {
31800
31851
  if (error51 instanceof Error) {
31801
- console.error(import_chalk22.default.red(`
31852
+ console.error(import_chalk23.default.red(`
31802
31853
  \u2717 ${error51.message}
31803
31854
  `));
31804
31855
  }
@@ -31811,7 +31862,7 @@ envVars.command("list <env>").description("List variables in an environment (val
31811
31862
  await envVarsListCommand(env, options);
31812
31863
  } catch (error51) {
31813
31864
  if (error51 instanceof Error) {
31814
- console.error(import_chalk22.default.red(`
31865
+ console.error(import_chalk23.default.red(`
31815
31866
  \u2717 ${error51.message}
31816
31867
  `));
31817
31868
  }
@@ -31823,7 +31874,7 @@ envVars.command("set <env> <key> <value>").description("Create or update a varia
31823
31874
  await envVarsSetCommand(env, key, value);
31824
31875
  } catch (error51) {
31825
31876
  if (error51 instanceof Error) {
31826
- console.error(import_chalk22.default.red(`
31877
+ console.error(import_chalk23.default.red(`
31827
31878
  \u2717 ${error51.message}
31828
31879
  `));
31829
31880
  }
@@ -31835,7 +31886,7 @@ envVars.command("delete <env> <key-or-id>").description("Delete a variable by ke
31835
31886
  await envVarsDeleteCommand(env, keyOrId, options);
31836
31887
  } catch (error51) {
31837
31888
  if (error51 instanceof Error) {
31838
- console.error(import_chalk22.default.red(`
31889
+ console.error(import_chalk23.default.red(`
31839
31890
  \u2717 ${error51.message}
31840
31891
  `));
31841
31892
  }
@@ -31848,7 +31899,7 @@ envFiles.command("list <env>").description("List files in an environment").actio
31848
31899
  await envFilesListCommand(env);
31849
31900
  } catch (error51) {
31850
31901
  if (error51 instanceof Error) {
31851
- console.error(import_chalk22.default.red(`
31902
+ console.error(import_chalk23.default.red(`
31852
31903
  \u2717 ${error51.message}
31853
31904
  `));
31854
31905
  }
@@ -31860,7 +31911,7 @@ envFiles.command("set <env> <destination-path>").description("Create or update a
31860
31911
  await envFilesSetCommand(env, destinationPath, options);
31861
31912
  } catch (error51) {
31862
31913
  if (error51 instanceof Error) {
31863
- console.error(import_chalk22.default.red(`
31914
+ console.error(import_chalk23.default.red(`
31864
31915
  \u2717 ${error51.message}
31865
31916
  `));
31866
31917
  }
@@ -31872,7 +31923,7 @@ envFiles.command("delete <env> <path-or-id>").description("Delete a file by dest
31872
31923
  await envFilesDeleteCommand(env, pathOrId, options);
31873
31924
  } catch (error51) {
31874
31925
  if (error51 instanceof Error) {
31875
- console.error(import_chalk22.default.red(`
31926
+ console.error(import_chalk23.default.red(`
31876
31927
  \u2717 ${error51.message}
31877
31928
  `));
31878
31929
  }
@@ -31885,7 +31936,7 @@ function registerEnvironmentHookCommands(parent, config3) {
31885
31936
  try {
31886
31937
  await command();
31887
31938
  } catch (error51) {
31888
- if (error51 instanceof Error) console.error(import_chalk22.default.red(`
31939
+ if (error51 instanceof Error) console.error(import_chalk23.default.red(`
31889
31940
  \u2717 ${error51.message}
31890
31941
  `));
31891
31942
  process.exit(1);
@@ -31921,7 +31972,7 @@ environment.action(async () => {
31921
31972
  await environmentListCommand();
31922
31973
  } catch (error51) {
31923
31974
  if (error51 instanceof Error) {
31924
- console.error(import_chalk22.default.red(`
31975
+ console.error(import_chalk23.default.red(`
31925
31976
  \u2717 ${error51.message}
31926
31977
  `));
31927
31978
  }
@@ -31972,7 +32023,7 @@ if (isAgentMode()) {
31972
32023
  await previewAddCommand(workspaceId, options);
31973
32024
  } catch (error51) {
31974
32025
  if (error51 instanceof Error) {
31975
- console.error(import_chalk22.default.red(`
32026
+ console.error(import_chalk23.default.red(`
31976
32027
  \u2717 ${error51.message}
31977
32028
  `));
31978
32029
  }
@@ -31984,7 +32035,7 @@ if (isAgentMode()) {
31984
32035
  await previewListCommand(workspaceId);
31985
32036
  } catch (error51) {
31986
32037
  if (error51 instanceof Error) {
31987
- console.error(import_chalk22.default.red(`
32038
+ console.error(import_chalk23.default.red(`
31988
32039
  \u2717 ${error51.message}
31989
32040
  `));
31990
32041
  }
@@ -31996,7 +32047,7 @@ if (isAgentMode()) {
31996
32047
  await previewRemoveCommand(workspaceId, options);
31997
32048
  } catch (error51) {
31998
32049
  if (error51 instanceof Error) {
31999
- console.error(import_chalk22.default.red(`
32050
+ console.error(import_chalk23.default.red(`
32000
32051
  \u2717 ${error51.message}
32001
32052
  `));
32002
32053
  }
@@ -32057,7 +32108,7 @@ if (isAgentMode()) {
32057
32108
  await mediaUploadCommand(files, options);
32058
32109
  } catch (error51) {
32059
32110
  if (error51 instanceof Error) {
32060
- console.error(import_chalk22.default.red(`
32111
+ console.error(import_chalk23.default.red(`
32061
32112
  \u2717 ${error51.message}
32062
32113
  `));
32063
32114
  }
@@ -32068,7 +32119,7 @@ if (isAgentMode()) {
32068
32119
  try {
32069
32120
  await mediaShareCommand(mediaId);
32070
32121
  } catch (error51) {
32071
- if (error51 instanceof Error) console.error(import_chalk22.default.red(`
32122
+ if (error51 instanceof Error) console.error(import_chalk23.default.red(`
32072
32123
  \u2717 ${error51.message}
32073
32124
  `));
32074
32125
  process.exit(1);
@@ -32078,7 +32129,7 @@ if (isAgentMode()) {
32078
32129
  try {
32079
32130
  await mediaRevokeCommand(mediaId);
32080
32131
  } catch (error51) {
32081
- if (error51 instanceof Error) console.error(import_chalk22.default.red(`
32132
+ if (error51 instanceof Error) console.error(import_chalk23.default.red(`
32082
32133
  \u2717 ${error51.message}
32083
32134
  `));
32084
32135
  process.exit(1);
@@ -32089,7 +32140,7 @@ if (isAgentMode()) {
32089
32140
  await mediaListCommand(options);
32090
32141
  } catch (error51) {
32091
32142
  if (error51 instanceof Error) {
32092
- console.error(import_chalk22.default.red(`
32143
+ console.error(import_chalk23.default.red(`
32093
32144
  \u2717 ${error51.message}
32094
32145
  `));
32095
32146
  }
@@ -32102,7 +32153,7 @@ if (isAgentMode()) {
32102
32153
  await mothershipSpawnCommand(options);
32103
32154
  } catch (error51) {
32104
32155
  if (error51 instanceof Error) {
32105
- console.error(import_chalk22.default.red(`
32156
+ console.error(import_chalk23.default.red(`
32106
32157
  \u2717 ${error51.message}
32107
32158
  `));
32108
32159
  }
@@ -32114,7 +32165,7 @@ if (isAgentMode()) {
32114
32165
  await mothershipRelayCommand(options);
32115
32166
  } catch (error51) {
32116
32167
  if (error51 instanceof Error) {
32117
- console.error(import_chalk22.default.red(`
32168
+ console.error(import_chalk23.default.red(`
32118
32169
  \u2717 ${error51.message}
32119
32170
  `));
32120
32171
  }
@@ -32146,7 +32197,7 @@ async function main() {
32146
32197
  if (process.argv[2] === "computer" && isAgentMode()) {
32147
32198
  const result = (0, import_node_child_process2.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
32148
32199
  if (result.error) {
32149
- console.error(import_chalk22.default.red(`
32200
+ console.error(import_chalk23.default.red(`
32150
32201
  \u2717 replicas-computer is unavailable in this workspace image
32151
32202
  `));
32152
32203
  process.exitCode = 1;