replicas-cli 0.2.280 → 0.2.281
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +62 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7735,9 +7735,61 @@ function parsePrUrl(url) {
|
|
|
7735
7735
|
if (!Number.isFinite(number)) return null;
|
|
7736
7736
|
return { owner, repo, number };
|
|
7737
7737
|
}
|
|
7738
|
-
function
|
|
7739
|
-
const
|
|
7740
|
-
|
|
7738
|
+
function parseCodeHostPrUrl(url) {
|
|
7739
|
+
const github = parsePrUrl(url);
|
|
7740
|
+
if (github) {
|
|
7741
|
+
return {
|
|
7742
|
+
...github,
|
|
7743
|
+
provider: "github",
|
|
7744
|
+
host: "github.com",
|
|
7745
|
+
repositoryPath: `${github.owner}/${github.repo}`,
|
|
7746
|
+
repoUrl: `https://github.com/${github.owner}/${github.repo}`
|
|
7747
|
+
};
|
|
7748
|
+
}
|
|
7749
|
+
let parsed;
|
|
7750
|
+
try {
|
|
7751
|
+
parsed = new URL(url);
|
|
7752
|
+
} catch {
|
|
7753
|
+
return null;
|
|
7754
|
+
}
|
|
7755
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
7756
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
7757
|
+
const separatorIndex = segments.indexOf("-");
|
|
7758
|
+
if (separatorIndex <= 0 || segments[separatorIndex + 1] !== "merge_requests") return null;
|
|
7759
|
+
const number = Number.parseInt(segments[separatorIndex + 2] ?? "", 10);
|
|
7760
|
+
if (!Number.isFinite(number)) return null;
|
|
7761
|
+
const repositorySegments = decodePathSegments(segments.slice(0, separatorIndex));
|
|
7762
|
+
const repo = repositorySegments[repositorySegments.length - 1];
|
|
7763
|
+
const owner = repositorySegments[0];
|
|
7764
|
+
if (!owner || !repo) return null;
|
|
7765
|
+
const repositoryPath = repositorySegments.join("/");
|
|
7766
|
+
return {
|
|
7767
|
+
provider: "gitlab",
|
|
7768
|
+
host: parsed.host.toLowerCase(),
|
|
7769
|
+
owner,
|
|
7770
|
+
repo,
|
|
7771
|
+
number,
|
|
7772
|
+
repositoryPath,
|
|
7773
|
+
repoUrl: `${parsed.origin}/${repositoryPath}`
|
|
7774
|
+
};
|
|
7775
|
+
}
|
|
7776
|
+
function decodePathSegments(segments) {
|
|
7777
|
+
return segments.map((segment) => {
|
|
7778
|
+
try {
|
|
7779
|
+
return decodeURIComponent(segment);
|
|
7780
|
+
} catch {
|
|
7781
|
+
return segment;
|
|
7782
|
+
}
|
|
7783
|
+
});
|
|
7784
|
+
}
|
|
7785
|
+
function getCodeHostRequestNoun(url) {
|
|
7786
|
+
return parseCodeHostPrUrl(url)?.provider === "gitlab" ? "MR" : "PR";
|
|
7787
|
+
}
|
|
7788
|
+
function formatCodeHostRequestRef(url, number) {
|
|
7789
|
+
const parsed = parseCodeHostPrUrl(url);
|
|
7790
|
+
const requestNumber = number ?? parsed?.number;
|
|
7791
|
+
if (!requestNumber) return null;
|
|
7792
|
+
return `${parsed?.provider === "gitlab" ? "!" : "#"}${requestNumber}`;
|
|
7741
7793
|
}
|
|
7742
7794
|
|
|
7743
7795
|
// ../shared/src/default-skills/replicas-agent/abilities/computer.ts
|
|
@@ -9264,7 +9316,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
9264
9316
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
9265
9317
|
|
|
9266
9318
|
// ../shared/src/cli-version.ts
|
|
9267
|
-
var CLI_VERSION = "0.2.
|
|
9319
|
+
var CLI_VERSION = "0.2.281";
|
|
9268
9320
|
|
|
9269
9321
|
// ../shared/src/engine/environment.ts
|
|
9270
9322
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
@@ -16445,9 +16497,10 @@ function getItemLabel(item) {
|
|
|
16445
16497
|
case "preview":
|
|
16446
16498
|
return `\u2197 Preview :${item.port}`;
|
|
16447
16499
|
case "pr": {
|
|
16448
|
-
const
|
|
16449
|
-
const
|
|
16450
|
-
|
|
16500
|
+
const noun = getCodeHostRequestNoun(item.url);
|
|
16501
|
+
const ref = formatCodeHostRequestRef(item.url);
|
|
16502
|
+
const suffix = ref ? ` ${ref}` : "";
|
|
16503
|
+
return `\u2197 View ${noun} (${item.repoName})${suffix}`;
|
|
16451
16504
|
}
|
|
16452
16505
|
case "diff":
|
|
16453
16506
|
return `\u25B8 Diff +${item.added} -${item.removed}`;
|
|
@@ -16468,8 +16521,8 @@ function getItemId(item) {
|
|
|
16468
16521
|
case "preview":
|
|
16469
16522
|
return `info-preview-${item.port}`;
|
|
16470
16523
|
case "pr": {
|
|
16471
|
-
const
|
|
16472
|
-
return `info-pr-${item.repoName}-${
|
|
16524
|
+
const parsed = parseCodeHostPrUrl(item.url);
|
|
16525
|
+
return `info-pr-${item.repoName}-${parsed?.number ?? item.url}`;
|
|
16473
16526
|
}
|
|
16474
16527
|
case "diff":
|
|
16475
16528
|
return `info-diff-${item.repoName}`;
|