replicas-cli 0.2.95 → 0.2.97

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.
@@ -7552,18 +7552,38 @@ var ATTACH_TO_USER_PARAM = {
7552
7552
  label: "Attach to user",
7553
7553
  type: "boolean"
7554
7554
  };
7555
+ var GROUP_PR_EVENTS_PARAM = {
7556
+ id: "group_pr_events",
7557
+ label: "Group PR events to same workspace",
7558
+ type: "boolean"
7559
+ };
7555
7560
  var GITHUB_TRIGGER = {
7556
7561
  type: "github",
7557
7562
  label: "GitHub",
7558
7563
  description: "Trigger on repository events",
7559
7564
  icon: "github",
7560
7565
  events: [
7561
- { id: "pull_request.opened", label: "PR opened", parameters: [REPO_FILTER_PARAM, ATTACH_TO_USER_PARAM] },
7562
- { id: "pull_request.synchronize", label: "PR updated (new commits)", parameters: [REPO_FILTER_PARAM, ATTACH_TO_USER_PARAM] },
7566
+ { id: "pull_request.opened", label: "PR opened", parameters: [REPO_FILTER_PARAM, ATTACH_TO_USER_PARAM, GROUP_PR_EVENTS_PARAM] },
7567
+ { id: "pull_request.synchronize", label: "PR updated (new commits)", parameters: [REPO_FILTER_PARAM, ATTACH_TO_USER_PARAM, GROUP_PR_EVENTS_PARAM] },
7563
7568
  { id: "pull_request.closed", label: "PR closed", parameters: [REPO_FILTER_PARAM, ATTACH_TO_USER_PARAM] }
7564
7569
  ]
7565
7570
  };
7566
7571
 
7572
+ // ../shared/src/urls.ts
7573
+ var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
7574
+ function parsePrUrl(url) {
7575
+ const match = url.match(PR_URL_REGEX);
7576
+ if (!match) return null;
7577
+ const [, owner, repo, numberStr] = match;
7578
+ const number = Number.parseInt(numberStr, 10);
7579
+ if (!Number.isFinite(number)) return null;
7580
+ return { owner, repo, number };
7581
+ }
7582
+ function extractPrNumber(url) {
7583
+ const parsed = parsePrUrl(url);
7584
+ return parsed ? String(parsed.number) : null;
7585
+ }
7586
+
7567
7587
  // ../shared/src/prompts.ts
7568
7588
  var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
7569
7589
  function removeTag(text, tag) {
@@ -8612,6 +8632,7 @@ export {
8612
8632
  getValidToken,
8613
8633
  getCurrentUser,
8614
8634
  SANDBOX_PATHS,
8635
+ extractPrNumber,
8615
8636
  REPLICAS_CONFIG_FILENAMES,
8616
8637
  getInitialChatId,
8617
8638
  GITHUB_TRIGGER,
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  setIdeCommand,
17
17
  setOrganizationId,
18
18
  writeConfig
19
- } from "./chunk-MSRBXLAA.mjs";
19
+ } from "./chunk-53QOEANU.mjs";
20
20
 
21
21
  // src/index.ts
22
22
  import "dotenv/config";
@@ -2505,12 +2505,12 @@ async function interactiveCommand() {
2505
2505
  );
2506
2506
  }
2507
2507
  console.log(chalk18.gray("Starting interactive mode..."));
2508
- const { launchInteractive } = await import("./interactive-OOT5K7GA.mjs");
2508
+ const { launchInteractive } = await import("./interactive-GZEWFBTQ.mjs");
2509
2509
  await launchInteractive();
2510
2510
  }
2511
2511
 
2512
2512
  // src/index.ts
2513
- var CLI_VERSION = "0.2.95";
2513
+ var CLI_VERSION = "0.2.97";
2514
2514
  var program = new Command();
2515
2515
  program.name("replicas").description("CLI for managing Replicas workspaces").version(CLI_VERSION);
2516
2516
  program.command("login").description("Authenticate with your Replicas account").action(async () => {
@@ -4,6 +4,7 @@ import {
4
4
  buildGroups,
5
5
  createMockWorkspaceRecord,
6
6
  createUserMessage,
7
+ extractPrNumber,
7
8
  filterDisplayMessages,
8
9
  getInitialChatId,
9
10
  getOrganizationId,
@@ -11,7 +12,7 @@ import {
11
12
  isAgentBackendEvent,
12
13
  parseAgentEvents,
13
14
  parseUserMessage
14
- } from "./chunk-MSRBXLAA.mjs";
15
+ } from "./chunk-53QOEANU.mjs";
15
16
 
16
17
  // src/interactive/index.tsx
17
18
  import { createCliRenderer } from "@opentui/core";
@@ -2013,7 +2014,7 @@ import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs8 } from "@opentui/reac
2013
2014
  var WEB_APP_URL = process.env.REPLICAS_WEB_URL || "https://replicas.dev";
2014
2015
  function buildInteractiveItems(workspaceId, status, previews, wakingWorkspaceId) {
2015
2016
  const items = [];
2016
- const hasAnyPr = status.repoStatuses?.some((repo) => repo.prUrl);
2017
+ const hasAnyPr = status.repoStatuses?.some((repo) => repo.prUrls.length > 0);
2017
2018
  const githubConfigured = status.environmentDetails?.githubAccessConfigured;
2018
2019
  if (workspaceId && status.status === "active" && !hasAnyPr && githubConfigured) {
2019
2020
  items.push({ type: "createPr" });
@@ -2044,8 +2045,8 @@ function buildInteractiveItems(workspaceId, status, previews, wakingWorkspaceId)
2044
2045
  }
2045
2046
  if (status.repoStatuses) {
2046
2047
  for (const repo of status.repoStatuses) {
2047
- if (repo.prUrl) {
2048
- items.push({ type: "pr", url: repo.prUrl, repoName: repo.name });
2048
+ for (const prUrl of repo.prUrls) {
2049
+ items.push({ type: "pr", url: prUrl, repoName: repo.name });
2049
2050
  }
2050
2051
  }
2051
2052
  }
@@ -2059,8 +2060,11 @@ function getItemLabel(item) {
2059
2060
  return "\u25B6 Wake";
2060
2061
  case "preview":
2061
2062
  return `\u2197 Preview :${item.port}`;
2062
- case "pr":
2063
- return `\u2197 View PR (${item.repoName})`;
2063
+ case "pr": {
2064
+ const prNumber = extractPrNumber(item.url);
2065
+ const suffix = prNumber ? ` #${prNumber}` : "";
2066
+ return `\u2197 View PR (${item.repoName})${suffix}`;
2067
+ }
2064
2068
  case "diff":
2065
2069
  return `\u25B8 Diff +${item.added} -${item.removed}`;
2066
2070
  case "view-chat":
@@ -2079,8 +2083,10 @@ function getItemId(item) {
2079
2083
  return "info-wake";
2080
2084
  case "preview":
2081
2085
  return `info-preview-${item.port}`;
2082
- case "pr":
2083
- return `info-pr-${item.repoName}`;
2086
+ case "pr": {
2087
+ const prNumber = extractPrNumber(item.url);
2088
+ return `info-pr-${item.repoName}-${prNumber ?? item.url}`;
2089
+ }
2084
2090
  case "diff":
2085
2091
  return `info-diff-${item.repoName}`;
2086
2092
  case "view-chat":
@@ -2515,7 +2521,9 @@ function WorkspaceInfo({ status, workspaceName, workspaceId, focused, loading, e
2515
2521
  );
2516
2522
  }) }),
2517
2523
  status.repoStatuses && status.repoStatuses.length > 0 && /* @__PURE__ */ jsx8(Section, { title: "Repositories", children: status.repoStatuses.map((repo, i) => {
2518
- const prItem = findItem("pr", repo.name);
2524
+ const prItems = interactiveItems.filter(
2525
+ (item) => item.type === "pr" && item.repoName === repo.name
2526
+ );
2519
2527
  return /* @__PURE__ */ jsxs8(React6.Fragment, { children: [
2520
2528
  /* @__PURE__ */ jsx8("box", { backgroundColor: "#111111", paddingX: 1, children: /* @__PURE__ */ jsx8("text", { children: /* @__PURE__ */ jsx8("span", { fg: "#ffffff", children: /* @__PURE__ */ jsx8("strong", { children: repo.name }) }) }) }),
2521
2529
  /* @__PURE__ */ jsx8("box", { backgroundColor: "#111111", paddingX: 1, flexDirection: "row", justifyContent: "space-between", children: /* @__PURE__ */ jsxs8("text", { children: [
@@ -2525,15 +2533,16 @@ function WorkspaceInfo({ status, workspaceName, workspaceId, focused, loading, e
2525
2533
  ] }),
2526
2534
  /* @__PURE__ */ jsx8("span", { fg: repo.currentBranch !== repo.defaultBranch ? "#ffaa00" : "#66bb6a", children: repo.currentBranch })
2527
2535
  ] }) }),
2528
- prItem && /* @__PURE__ */ jsx8(
2536
+ prItems.map((prItem) => /* @__PURE__ */ jsx8(
2529
2537
  InteractiveRow,
2530
2538
  {
2531
2539
  id: getItemId(prItem),
2532
2540
  label: ` ${getItemLabel(prItem)}`,
2533
2541
  highlighted: isHighlighted(prItem),
2534
2542
  onClick: () => handleAction(prItem)
2535
- }
2536
- )
2543
+ },
2544
+ getItemId(prItem)
2545
+ ))
2537
2546
  ] }, i);
2538
2547
  }) }),
2539
2548
  env && /* @__PURE__ */ jsxs8(Section, { title: "Hooks", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.95",
3
+ "version": "0.2.97",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {