replicas-cli 0.2.96 → 0.2.98
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.
|
@@ -7569,6 +7569,21 @@ var GITHUB_TRIGGER = {
|
|
|
7569
7569
|
]
|
|
7570
7570
|
};
|
|
7571
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
|
+
|
|
7572
7587
|
// ../shared/src/prompts.ts
|
|
7573
7588
|
var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
|
|
7574
7589
|
function removeTag(text, tag) {
|
|
@@ -8617,6 +8632,7 @@ export {
|
|
|
8617
8632
|
getValidToken,
|
|
8618
8633
|
getCurrentUser,
|
|
8619
8634
|
SANDBOX_PATHS,
|
|
8635
|
+
extractPrNumber,
|
|
8620
8636
|
REPLICAS_CONFIG_FILENAMES,
|
|
8621
8637
|
getInitialChatId,
|
|
8622
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-
|
|
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-
|
|
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.
|
|
2513
|
+
var CLI_VERSION = "0.2.98";
|
|
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-
|
|
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.
|
|
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
|
-
|
|
2048
|
-
items.push({ type: "pr", url:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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: [
|