replicas-cli 0.2.755 → 0.2.757

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 +58 -45
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -7557,7 +7557,7 @@ function readAgentConfig() {
7557
7557
  // src/lib/oauth-flow-ui.ts
7558
7558
  var import_chalk = __toESM(require("chalk"));
7559
7559
  var import_open = __toESM(require("open"));
7560
- var import_prompts4 = __toESM(require("prompts"));
7560
+ var import_prompts5 = __toESM(require("prompts"));
7561
7561
 
7562
7562
  // src/lib/auth.ts
7563
7563
  var import_supabase_js2 = require("@supabase/supabase-js");
@@ -7647,7 +7647,7 @@ async function getCurrentUser() {
7647
7647
  }
7648
7648
 
7649
7649
  // src/lib/organization.ts
7650
- var import_prompts3 = __toESM(require("prompts"));
7650
+ var import_prompts4 = __toESM(require("prompts"));
7651
7651
 
7652
7652
  // ../shared/src/type-guards.ts
7653
7653
  function isRecord(value) {
@@ -25825,6 +25825,17 @@ function removeReplicasInstructions(text2) {
25825
25825
  return removeTag(text2, REPLICAS_INSTRUCTIONS_TAG);
25826
25826
  }
25827
25827
 
25828
+ // ../shared/src/user-message-attachments.ts
25829
+ var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
25830
+ function stripAttachmentNote(text2) {
25831
+ const match = text2.match(/(?:^|\n\n)<replicas_attachments>\nUploaded files are available at:((?:\n- .*)*)(?:\n<\/?[a-z_]*>?)?$/) ?? text2.match(/(?:^|\n\n)Uploaded files are available at:((?:\n- .*)*)$/);
25832
+ if (!match) return { content: text2, files: [] };
25833
+ return {
25834
+ content: text2.replace(match[0], "").trim(),
25835
+ files: [...match[1].matchAll(/^- (.+)$/gm)].map(([, path7]) => path7)
25836
+ };
25837
+ }
25838
+
25828
25839
  // ../shared/src/user-message-matching.ts
25829
25840
  function parseTimestampMs(timestamp) {
25830
25841
  const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
@@ -27698,12 +27709,14 @@ function filterDisplayMessages(messages, provider) {
27698
27709
  }
27699
27710
  result = result.flatMap((msg) => {
27700
27711
  if (msg.type !== "user") return [msg];
27701
- const cleaned = removeReplicasInstructions(msg.content).trim();
27702
- if (INTERRUPTED_MESSAGE_REGEX.test(cleaned)) {
27712
+ const { content, files } = stripAttachmentNote(removeReplicasInstructions(msg.content).trim());
27713
+ if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
27703
27714
  return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
27704
27715
  }
27705
- if (cleaned.length === 0 && !msg.images?.length) return [];
27706
- return [cleaned !== msg.content ? { ...msg, content: cleaned } : msg];
27716
+ const cleaned = (msg.images?.length || files.length) && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
27717
+ if (cleaned.length === 0 && !msg.images?.length && files.length === 0) return [];
27718
+ if (cleaned === msg.content && files.length === 0) return [msg];
27719
+ return [{ ...msg, content: cleaned, ...files.length > 0 ? { files } : {} }];
27707
27720
  });
27708
27721
  return result;
27709
27722
  }
@@ -27999,7 +28012,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
27999
28012
  });
28000
28013
 
28001
28014
  // ../shared/src/cli-version.ts
28002
- var CLI_VERSION = "0.2.755";
28015
+ var CLI_VERSION = "0.2.757";
28003
28016
 
28004
28017
  // ../shared/src/version.ts
28005
28018
  function compareVersions(v1, v2) {
@@ -28806,7 +28819,7 @@ async function findActiveOrganization() {
28806
28819
  };
28807
28820
  }
28808
28821
  async function promptForOrganization(organizations, currentId) {
28809
- const { organizationId } = await (0, import_prompts3.default)({
28822
+ const { organizationId } = await (0, import_prompts4.default)({
28810
28823
  type: "select",
28811
28824
  name: "organizationId",
28812
28825
  message: " Select an organization",
@@ -28926,7 +28939,7 @@ async function verifyAuthFlowTarget(target, assumeYes) {
28926
28939
  "Cannot confirm the destination without a terminal. Re-run with --yes to accept the values above."
28927
28940
  );
28928
28941
  }
28929
- const { confirmed } = await (0, import_prompts4.default)({
28942
+ const { confirmed } = await (0, import_prompts5.default)({
28930
28943
  type: "confirm",
28931
28944
  name: "confirmed",
28932
28945
  message: " Save credentials here?",
@@ -29398,7 +29411,7 @@ async function connectSSH(token, host, proxyCommand, localForward) {
29398
29411
 
29399
29412
  // src/lib/workspace-connection.ts
29400
29413
  var import_chalk6 = __toESM(require("chalk"));
29401
- var import_prompts5 = __toESM(require("prompts"));
29414
+ var import_prompts6 = __toESM(require("prompts"));
29402
29415
 
29403
29416
  // src/lib/api.ts
29404
29417
  async function buildOrgAuthHeaders() {
@@ -29521,7 +29534,7 @@ Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
29521
29534
  console.log(import_chalk6.default.yellow(`
29522
29535
  Found ${workspaces.length} workspaces matching "${workspaceName}":`));
29523
29536
  }
29524
- const selectResponse = await (0, import_prompts5.default)({
29537
+ const selectResponse = await (0, import_prompts6.default)({
29525
29538
  type: "select",
29526
29539
  name: "workspaceId",
29527
29540
  message: "Select a workspace:",
@@ -30517,7 +30530,7 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
30517
30530
 
30518
30531
  // src/commands/replica.ts
30519
30532
  var import_chalk16 = __toESM(require("chalk"));
30520
- var import_prompts6 = __toESM(require("prompts"));
30533
+ var import_prompts7 = __toESM(require("prompts"));
30521
30534
  var CLI_CODING_AGENT_LABEL = getCodingAgentDisplayNames();
30522
30535
  function parseReplicaAgent(value) {
30523
30536
  if (!value) return void 0;
@@ -30735,7 +30748,7 @@ async function replicaCreateCommand(name, options) {
30735
30748
  process.exit(1);
30736
30749
  }
30737
30750
  if (!replicaName) {
30738
- const response2 = await (0, import_prompts6.default)({
30751
+ const response2 = await (0, import_prompts7.default)({
30739
30752
  type: "text",
30740
30753
  name: "name",
30741
30754
  message: "Enter replica name (without spaces):",
@@ -30752,7 +30765,7 @@ async function replicaCreateCommand(name, options) {
30752
30765
  replicaName = response2.name;
30753
30766
  }
30754
30767
  if (!selectedEnvironmentId) {
30755
- const response2 = await (0, import_prompts6.default)({
30768
+ const response2 = await (0, import_prompts7.default)({
30756
30769
  type: "select",
30757
30770
  name: "environment",
30758
30771
  message: "Select environment:",
@@ -30769,7 +30782,7 @@ async function replicaCreateCommand(name, options) {
30769
30782
  selectedEnvironmentId = response2.environment;
30770
30783
  }
30771
30784
  if (!message) {
30772
- const response2 = await (0, import_prompts6.default)({
30785
+ const response2 = await (0, import_prompts7.default)({
30773
30786
  type: "text",
30774
30787
  name: "message",
30775
30788
  message: "Enter initial message for the replica:",
@@ -30782,7 +30795,7 @@ async function replicaCreateCommand(name, options) {
30782
30795
  message = response2.message;
30783
30796
  }
30784
30797
  if (!codingAgent) {
30785
- const response2 = await (0, import_prompts6.default)({
30798
+ const response2 = await (0, import_prompts7.default)({
30786
30799
  type: "select",
30787
30800
  name: "agent",
30788
30801
  message: "Select coding agent:",
@@ -30828,7 +30841,7 @@ async function replicaSendCommand(id, options) {
30828
30841
  try {
30829
30842
  let message = options.message;
30830
30843
  if (!message) {
30831
- const response2 = await (0, import_prompts6.default)({
30844
+ const response2 = await (0, import_prompts7.default)({
30832
30845
  type: "text",
30833
30846
  name: "message",
30834
30847
  message: "Enter message to send:",
@@ -30872,7 +30885,7 @@ async function replicaDeleteCommand(id, options) {
30872
30885
  }
30873
30886
  try {
30874
30887
  if (!options.force) {
30875
- const response = await (0, import_prompts6.default)({
30888
+ const response = await (0, import_prompts7.default)({
30876
30889
  type: "confirm",
30877
30890
  name: "confirm",
30878
30891
  message: `Are you sure you want to delete replica ${id}?`,
@@ -31141,7 +31154,7 @@ async function environmentSetupWaitVariablesCommand(options) {
31141
31154
 
31142
31155
  // src/commands/automation.ts
31143
31156
  var import_chalk20 = __toESM(require("chalk"));
31144
- var import_prompts7 = __toESM(require("prompts"));
31157
+ var import_prompts8 = __toESM(require("prompts"));
31145
31158
  function parseScopeFilter(value) {
31146
31159
  if (!value) return void 0;
31147
31160
  if (value === "org" || value === "user" || value === "all") return value;
@@ -31414,7 +31427,7 @@ async function promptForTriggers(repositories) {
31414
31427
  const triggers = [];
31415
31428
  let addMore = true;
31416
31429
  while (addMore) {
31417
- const typeResponse = await (0, import_prompts7.default)({
31430
+ const typeResponse = await (0, import_prompts8.default)({
31418
31431
  type: "select",
31419
31432
  name: "type",
31420
31433
  message: "Select trigger type:",
@@ -31426,14 +31439,14 @@ async function promptForTriggers(repositories) {
31426
31439
  });
31427
31440
  if (!typeResponse.type) return triggers;
31428
31441
  if (typeResponse.type === "cron") {
31429
- const scheduleResponse = await (0, import_prompts7.default)({
31442
+ const scheduleResponse = await (0, import_prompts8.default)({
31430
31443
  type: "text",
31431
31444
  name: "schedule",
31432
31445
  message: 'Enter cron expression (e.g. "0 9 * * 1-5" for weekdays at 9am):',
31433
31446
  validate: (value) => value.trim() ? true : "Schedule is required"
31434
31447
  });
31435
31448
  if (!scheduleResponse.schedule) return triggers;
31436
- const tzResponse = await (0, import_prompts7.default)({
31449
+ const tzResponse = await (0, import_prompts8.default)({
31437
31450
  type: "text",
31438
31451
  name: "timezone",
31439
31452
  message: "Enter timezone (default: UTC):",
@@ -31447,7 +31460,7 @@ async function promptForTriggers(repositories) {
31447
31460
  }
31448
31461
  });
31449
31462
  } else if (typeResponse.type === "github") {
31450
- const eventResponse = await (0, import_prompts7.default)({
31463
+ const eventResponse = await (0, import_prompts8.default)({
31451
31464
  type: "select",
31452
31465
  name: "event",
31453
31466
  message: "Select GitHub event:",
@@ -31457,7 +31470,7 @@ async function promptForTriggers(repositories) {
31457
31470
  let triggerRepoIds;
31458
31471
  const githubRepositories = repositories?.filter((repo) => !repo.provider || repo.provider === "github") ?? [];
31459
31472
  if (githubRepositories.length > 0) {
31460
- const filterResponse = await (0, import_prompts7.default)({
31473
+ const filterResponse = await (0, import_prompts8.default)({
31461
31474
  type: "multiselect",
31462
31475
  name: "repos",
31463
31476
  message: "Filter trigger to specific repositories (press enter to skip for all):",
@@ -31467,7 +31480,7 @@ async function promptForTriggers(repositories) {
31467
31480
  triggerRepoIds = filterResponse.repos;
31468
31481
  }
31469
31482
  }
31470
- const excludedActorsResponse = await (0, import_prompts7.default)({
31483
+ const excludedActorsResponse = await (0, import_prompts8.default)({
31471
31484
  type: "text",
31472
31485
  name: "excludedActors",
31473
31486
  message: "Exclude GitHub users (comma-separated, optional):"
@@ -31482,7 +31495,7 @@ async function promptForTriggers(repositories) {
31482
31495
  }
31483
31496
  });
31484
31497
  } else if (typeResponse.type === "gitlab") {
31485
- const eventResponse = await (0, import_prompts7.default)({
31498
+ const eventResponse = await (0, import_prompts8.default)({
31486
31499
  type: "select",
31487
31500
  name: "event",
31488
31501
  message: "Select GitLab event:",
@@ -31492,7 +31505,7 @@ async function promptForTriggers(repositories) {
31492
31505
  let triggerRepoIds;
31493
31506
  const gitlabRepositories = repositories?.filter((repo) => repo.provider === "gitlab") ?? [];
31494
31507
  if (gitlabRepositories.length > 0) {
31495
- const filterResponse = await (0, import_prompts7.default)({
31508
+ const filterResponse = await (0, import_prompts8.default)({
31496
31509
  type: "multiselect",
31497
31510
  name: "repos",
31498
31511
  message: "Filter trigger to specific GitLab projects (press enter to skip for all):",
@@ -31502,7 +31515,7 @@ async function promptForTriggers(repositories) {
31502
31515
  triggerRepoIds = filterResponse.repos;
31503
31516
  }
31504
31517
  }
31505
- const excludedActorsResponse = await (0, import_prompts7.default)({
31518
+ const excludedActorsResponse = await (0, import_prompts8.default)({
31506
31519
  type: "text",
31507
31520
  name: "excludedActors",
31508
31521
  message: "Exclude GitLab users (comma-separated, optional):"
@@ -31517,7 +31530,7 @@ async function promptForTriggers(repositories) {
31517
31530
  }
31518
31531
  });
31519
31532
  }
31520
- const moreResponse = await (0, import_prompts7.default)({
31533
+ const moreResponse = await (0, import_prompts8.default)({
31521
31534
  type: "confirm",
31522
31535
  name: "more",
31523
31536
  message: "Add another trigger?",
@@ -31580,7 +31593,7 @@ async function automationCreateCommand(name, options) {
31580
31593
  const repositories = repoResponse.repositories;
31581
31594
  let automationName = name;
31582
31595
  if (!automationName) {
31583
- const response2 = await (0, import_prompts7.default)({
31596
+ const response2 = await (0, import_prompts8.default)({
31584
31597
  type: "text",
31585
31598
  name: "name",
31586
31599
  message: "Enter automation name:",
@@ -31594,7 +31607,7 @@ async function automationCreateCommand(name, options) {
31594
31607
  }
31595
31608
  let automationPrompt = options.prompt;
31596
31609
  if (!automationPrompt) {
31597
- const response2 = await (0, import_prompts7.default)({
31610
+ const response2 = await (0, import_prompts8.default)({
31598
31611
  type: "text",
31599
31612
  name: "prompt",
31600
31613
  message: "Enter the prompt for this automation:",
@@ -31610,7 +31623,7 @@ async function automationCreateCommand(name, options) {
31610
31623
  if (options.environment) {
31611
31624
  selectedEnvironmentId = resolveSelectableEnvironmentId(options.environment, selectableEnvs);
31612
31625
  } else {
31613
- const envResponse2 = await (0, import_prompts7.default)({
31626
+ const envResponse2 = await (0, import_prompts8.default)({
31614
31627
  type: "select",
31615
31628
  name: "env",
31616
31629
  message: "Select environment:",
@@ -31669,7 +31682,7 @@ async function automationCreateCommand(name, options) {
31669
31682
  }
31670
31683
  let prFollowups = options.prFollowups === true;
31671
31684
  if (options.prFollowups === void 0) {
31672
- const prFollowupsResponse = await (0, import_prompts7.default)({
31685
+ const prFollowupsResponse = await (0, import_prompts8.default)({
31673
31686
  type: "confirm",
31674
31687
  name: "prFollowups",
31675
31688
  message: "Allow PR follow-ups?",
@@ -31754,7 +31767,7 @@ async function automationEditCommand(id, options) {
31754
31767
  const body = {};
31755
31768
  const hasOptions = options.name || options.prompt || options.enabled !== void 0 || options.prFollowups !== void 0 || options.triggerCron || options.triggerGithub || options.triggerGitlab || options.environment || options.triggerGithubExcludeUsers !== void 0 || options.triggerGitlabExcludeUsers !== void 0 || options.githubChecks !== void 0 || options.addGithubChecks !== void 0 || options.lifecycle || options.sleepWhenDone || options.autoStopMinutes || options.agentProvider !== void 0 || options.model !== void 0 || options.thinkingLevel !== void 0 || options.planMode !== void 0 || options.goalMode !== void 0 || options.fastMode !== void 0;
31756
31769
  if (!hasOptions) {
31757
- const nameResponse = await (0, import_prompts7.default)({
31770
+ const nameResponse = await (0, import_prompts8.default)({
31758
31771
  type: "text",
31759
31772
  name: "name",
31760
31773
  message: "Automation name:",
@@ -31763,7 +31776,7 @@ async function automationEditCommand(id, options) {
31763
31776
  if (nameResponse.name && nameResponse.name !== existing.automation.name) {
31764
31777
  body.name = nameResponse.name;
31765
31778
  }
31766
- const promptResponse = await (0, import_prompts7.default)({
31779
+ const promptResponse = await (0, import_prompts8.default)({
31767
31780
  type: "text",
31768
31781
  name: "prompt",
31769
31782
  message: "Prompt:",
@@ -31772,7 +31785,7 @@ async function automationEditCommand(id, options) {
31772
31785
  if (promptResponse.prompt && promptResponse.prompt !== existing.automation.prompt) {
31773
31786
  body.prompt = promptResponse.prompt;
31774
31787
  }
31775
- const enabledResponse = await (0, import_prompts7.default)({
31788
+ const enabledResponse = await (0, import_prompts8.default)({
31776
31789
  type: "confirm",
31777
31790
  name: "enabled",
31778
31791
  message: "Enabled?",
@@ -31782,7 +31795,7 @@ async function automationEditCommand(id, options) {
31782
31795
  body.enabled = enabledResponse.enabled;
31783
31796
  }
31784
31797
  const existingPrFollowups = existing.automation.config.capabilities?.pr_followups === true;
31785
- const prFollowupsResponse = await (0, import_prompts7.default)({
31798
+ const prFollowupsResponse = await (0, import_prompts8.default)({
31786
31799
  type: "confirm",
31787
31800
  name: "prFollowups",
31788
31801
  message: "Allow PR follow-ups?",
@@ -31791,7 +31804,7 @@ async function automationEditCommand(id, options) {
31791
31804
  if (prFollowupsResponse.prFollowups !== void 0 && prFollowupsResponse.prFollowups !== existingPrFollowups) {
31792
31805
  body.config = workspaceConfigWithPrFollowups(existing.automation.config, prFollowupsResponse.prFollowups);
31793
31806
  }
31794
- const editTriggersResponse = await (0, import_prompts7.default)({
31807
+ const editTriggersResponse = await (0, import_prompts8.default)({
31795
31808
  type: "confirm",
31796
31809
  name: "edit",
31797
31810
  message: "Edit triggers?",
@@ -31980,7 +31993,7 @@ async function automationDeleteCommand(id, options) {
31980
31993
  const existing = await orgAuthenticatedFetch(`/v1/automations/${id}`);
31981
31994
  const automationName = existing.automation.name;
31982
31995
  if (!options.force) {
31983
- const response = await (0, import_prompts7.default)({
31996
+ const response = await (0, import_prompts8.default)({
31984
31997
  type: "confirm",
31985
31998
  name: "confirm",
31986
31999
  message: `Are you sure you want to delete automation "${automationName}" (${id})?`,
@@ -32648,7 +32661,7 @@ Workspace: ${workspaceNameForOutput(result.workspace_name)} (${getWorkspaceDashb
32648
32661
  // src/commands/environment.ts
32649
32662
  var import_fs6 = __toESM(require("fs"));
32650
32663
  var import_chalk24 = __toESM(require("chalk"));
32651
- var import_prompts8 = __toESM(require("prompts"));
32664
+ var import_prompts9 = __toESM(require("prompts"));
32652
32665
  function maskValue(value) {
32653
32666
  if (value.length <= 4) return "\u2022\u2022\u2022\u2022";
32654
32667
  return `${value.slice(0, 2)}${"\u2022".repeat(Math.min(value.length - 4, 12))}${value.slice(-2)} (${value.length} chars)`;
@@ -32710,7 +32723,7 @@ async function environmentCreateCommand(name, options) {
32710
32723
  ensureOrgApiAuthenticated();
32711
32724
  let envName = name;
32712
32725
  if (!envName) {
32713
- const r = await (0, import_prompts8.default)({
32726
+ const r = await (0, import_prompts9.default)({
32714
32727
  type: "text",
32715
32728
  name: "name",
32716
32729
  message: "Environment name:",
@@ -32739,7 +32752,7 @@ async function environmentCreateCommand(name, options) {
32739
32752
  } else {
32740
32753
  const repos2 = await orgAuthenticatedFetch("/v1/repositories");
32741
32754
  if (repos2.repositories.length > 0) {
32742
- const r = await (0, import_prompts8.default)({
32755
+ const r = await (0, import_prompts9.default)({
32743
32756
  type: "select",
32744
32757
  name: "repo",
32745
32758
  message: "Bind to repository (esc to skip):",
@@ -32804,7 +32817,7 @@ async function environmentDeleteCommand(idOrName, options) {
32804
32817
  ensureOrgApiAuthenticated();
32805
32818
  const id = await resolveEnvironmentId(idOrName);
32806
32819
  if (!options.force) {
32807
- const r = await (0, import_prompts8.default)({
32820
+ const r = await (0, import_prompts9.default)({
32808
32821
  type: "confirm",
32809
32822
  name: "confirm",
32810
32823
  message: `Delete environment ${idOrName}?`,
@@ -32892,7 +32905,7 @@ async function envVarsDeleteCommand(envIdOrName, keyOrId, options) {
32892
32905
  variableId = match.id;
32893
32906
  }
32894
32907
  if (!options.force) {
32895
- const r = await (0, import_prompts8.default)({
32908
+ const r = await (0, import_prompts9.default)({
32896
32909
  type: "confirm",
32897
32910
  name: "confirm",
32898
32911
  message: `Delete variable ${keyOrId}?`,
@@ -32994,7 +33007,7 @@ async function envFilesDeleteCommand(envIdOrName, pathOrId, options) {
32994
33007
  fileId = match.id;
32995
33008
  }
32996
33009
  if (!options.force) {
32997
- const r = await (0, import_prompts8.default)({
33010
+ const r = await (0, import_prompts9.default)({
32998
33011
  type: "confirm",
32999
33012
  name: "confirm",
33000
33013
  message: `Delete file ${pathOrId}?`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.755",
3
+ "version": "0.2.757",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {