@cnwenf/occ 2.1.320 → 2.1.322
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/cli.js +66 -19
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
globalThis.MACRO={"VERSION":"2.1.
|
|
2
|
+
globalThis.MACRO={"VERSION":"2.1.322","BINARY_NAME":"occ","BUILD_TIME":"2026-09-04T18:16:44.981Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
|
|
3
3
|
// @bun
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -362131,6 +362131,10 @@ var init_ast = __esm(() => {
|
|
|
362131
362131
|
"EUID",
|
|
362132
362132
|
"GID",
|
|
362133
362133
|
"EGID",
|
|
362134
|
+
"REPORTTIME",
|
|
362135
|
+
"REPORTMEMORY",
|
|
362136
|
+
"DIRSTACKSIZE",
|
|
362137
|
+
"BAUD",
|
|
362134
362138
|
"ZLE_RPROMPT_INDENT",
|
|
362135
362139
|
"MBEGIN",
|
|
362136
362140
|
"MEND",
|
|
@@ -367290,8 +367294,33 @@ ${content}` : stdout;
|
|
|
367290
367294
|
function gitCmdRe(subcmd, suffix = "") {
|
|
367291
367295
|
return new RegExp(`\\bgit(?:\\s+-[cC]\\s+\\S+|\\s+--\\S+=\\S+)*\\s+${subcmd}\\b${suffix}`);
|
|
367292
367296
|
}
|
|
367297
|
+
function resolvePrAction(command4) {
|
|
367298
|
+
const ghAction = GH_PR_ACTIONS.find((a5) => a5.re.test(command4))?.action;
|
|
367299
|
+
const unquoted = command4.replace(QUOTED_ARGS_RE, " ");
|
|
367300
|
+
if (ghAction === "merged") {
|
|
367301
|
+
if (/--disable-auto\b/.test(unquoted))
|
|
367302
|
+
return "auto-merge-disabled";
|
|
367303
|
+
if (/--auto\b/.test(unquoted))
|
|
367304
|
+
return "auto-merge-enabled";
|
|
367305
|
+
} else if (ghAction === "ready" && /--undo\b/.test(unquoted)) {
|
|
367306
|
+
return "draft";
|
|
367307
|
+
}
|
|
367308
|
+
if (ghAction)
|
|
367309
|
+
return ghAction;
|
|
367310
|
+
const glabAction = GLAB_MR_ACTIONS.find((a5) => a5.re.test(command4))?.action;
|
|
367311
|
+
if (glabAction === "edited") {
|
|
367312
|
+
if (/--ready\b/.test(unquoted))
|
|
367313
|
+
return "ready";
|
|
367314
|
+
if (/--draft\b/.test(unquoted))
|
|
367315
|
+
return "draft";
|
|
367316
|
+
}
|
|
367317
|
+
return glabAction;
|
|
367318
|
+
}
|
|
367319
|
+
function isMrUrl(url3) {
|
|
367320
|
+
return /\/-\/merge_requests\/\d/.test(url3);
|
|
367321
|
+
}
|
|
367293
367322
|
function parsePrUrl(url3) {
|
|
367294
|
-
const match = url3.match(
|
|
367323
|
+
const match = url3.match(PR_URL_RE);
|
|
367295
367324
|
if (match?.[1] && match?.[2]) {
|
|
367296
367325
|
return {
|
|
367297
367326
|
prNumber: parseInt(match[2], 10),
|
|
@@ -367302,8 +367331,11 @@ function parsePrUrl(url3) {
|
|
|
367302
367331
|
return null;
|
|
367303
367332
|
}
|
|
367304
367333
|
function findPrInStdout(stdout) {
|
|
367305
|
-
const
|
|
367306
|
-
|
|
367334
|
+
const matches = stdout.match(new RegExp(PR_URL_RE.source, "g"));
|
|
367335
|
+
if (!matches)
|
|
367336
|
+
return null;
|
|
367337
|
+
const last2 = matches.at(-1);
|
|
367338
|
+
return last2 !== undefined ? parsePrUrl(last2) : null;
|
|
367307
367339
|
}
|
|
367308
367340
|
function parseGitCommitId(stdout) {
|
|
367309
367341
|
const match = stdout.match(/\[[\w./-]+(?: \(root-commit\))? ([0-9a-f]+)\]/);
|
|
@@ -367357,12 +367389,12 @@ function detectGitOperation(command4, output) {
|
|
|
367357
367389
|
if (ref)
|
|
367358
367390
|
result.branch = { ref, action: "rebased" };
|
|
367359
367391
|
}
|
|
367360
|
-
const prAction =
|
|
367392
|
+
const prAction = resolvePrAction(command4);
|
|
367361
367393
|
if (prAction) {
|
|
367362
367394
|
const pr = findPrInStdout(output);
|
|
367363
367395
|
if (pr) {
|
|
367364
367396
|
result.pr = { number: pr.prNumber, url: pr.prUrl, action: prAction };
|
|
367365
|
-
} else {
|
|
367397
|
+
} else if (GH_PR_ACTIONS.some((a5) => a5.re.test(command4))) {
|
|
367366
367398
|
const num = parsePrNumberFromText(output);
|
|
367367
367399
|
if (num)
|
|
367368
367400
|
result.pr = { number: num, action: prAction };
|
|
@@ -367391,13 +367423,15 @@ function trackGitOperations(command4, exitCode, stdout) {
|
|
|
367391
367423
|
operation: "push"
|
|
367392
367424
|
});
|
|
367393
367425
|
}
|
|
367394
|
-
const
|
|
367426
|
+
const ghHit = GH_PR_ACTIONS.find((a5) => a5.re.test(command4));
|
|
367427
|
+
const glabHit = GLAB_MR_ACTIONS.find((a5) => a5.re.test(command4));
|
|
367428
|
+
const prHit = ghHit ?? glabHit;
|
|
367395
367429
|
if (prHit) {
|
|
367396
367430
|
logEvent2("tengu_git_operation", {
|
|
367397
367431
|
operation: prHit.op
|
|
367398
367432
|
});
|
|
367399
367433
|
}
|
|
367400
|
-
if (
|
|
367434
|
+
if (ghHit?.action === "created" || glabHit?.action === "created") {
|
|
367401
367435
|
getPrCounter()?.add(1);
|
|
367402
367436
|
if (stdout) {
|
|
367403
367437
|
const prInfo = findPrInStdout(stdout);
|
|
@@ -367413,12 +367447,6 @@ function trackGitOperations(command4, exitCode, stdout) {
|
|
|
367413
367447
|
}
|
|
367414
367448
|
}
|
|
367415
367449
|
}
|
|
367416
|
-
if (command4.match(/\bglab\s+mr\s+create\b/)) {
|
|
367417
|
-
logEvent2("tengu_git_operation", {
|
|
367418
|
-
operation: "pr_create"
|
|
367419
|
-
});
|
|
367420
|
-
getPrCounter()?.add(1);
|
|
367421
|
-
}
|
|
367422
367450
|
const isCurlPost = command4.match(/\bcurl\b/) && (command4.match(/-X\s*POST\b/i) || command4.match(/--request\s*=?\s*POST\b/i) || command4.match(/\s-d\s/));
|
|
367423
367451
|
const isPrEndpoint = command4.match(/https?:\/\/[^\s'"]*\/(pulls|pull-requests|merge[-_]requests)(?!\/\d)/i);
|
|
367424
367452
|
if (isCurlPost && isPrEndpoint) {
|
|
@@ -367428,7 +367456,7 @@ function trackGitOperations(command4, exitCode, stdout) {
|
|
|
367428
367456
|
getPrCounter()?.add(1);
|
|
367429
367457
|
}
|
|
367430
367458
|
}
|
|
367431
|
-
var GIT_OUTPUT_TAIL_BYTES = 8192, GIT_COMMIT_RE, GIT_PUSH_RE, GIT_CHERRY_PICK_RE, GIT_MERGE_RE, GIT_REBASE_RE, GH_PR_ACTIONS;
|
|
367459
|
+
var GIT_OUTPUT_TAIL_BYTES = 8192, GIT_COMMIT_RE, GIT_PUSH_RE, GIT_CHERRY_PICK_RE, GIT_MERGE_RE, GIT_REBASE_RE, GH_PR_ACTIONS, GLAB_MR_ACTIONS, QUOTED_ARGS_RE, PR_URL_RE, PR_BADGE_URL_MAX_LENGTH = 2048;
|
|
367432
367460
|
var init_gitOperationTracking = __esm(() => {
|
|
367433
367461
|
init_state();
|
|
367434
367462
|
init_analytics();
|
|
@@ -367444,8 +367472,19 @@ var init_gitOperationTracking = __esm(() => {
|
|
|
367444
367472
|
{ re: /\bgh\s+pr\s+merge\b/, action: "merged", op: "pr_merge" },
|
|
367445
367473
|
{ re: /\bgh\s+pr\s+comment\b/, action: "commented", op: "pr_comment" },
|
|
367446
367474
|
{ re: /\bgh\s+pr\s+close\b/, action: "closed", op: "pr_close" },
|
|
367475
|
+
{ re: /\bgh\s+pr\s+reopen\b/, action: "reopened", op: "pr_reopen" },
|
|
367447
367476
|
{ re: /\bgh\s+pr\s+ready\b/, action: "ready", op: "pr_ready" }
|
|
367448
367477
|
];
|
|
367478
|
+
GLAB_MR_ACTIONS = [
|
|
367479
|
+
{ re: /\bglab\s+mr\s+create\b/, action: "created", op: "pr_create" },
|
|
367480
|
+
{ re: /\bglab\s+mr\s+update\b/, action: "edited", op: "pr_edit" },
|
|
367481
|
+
{ re: /\bglab\s+mr\s+merge\b/, action: "merged", op: "pr_merge" },
|
|
367482
|
+
{ re: /\bglab\s+mr\s+note\b/, action: "commented", op: "pr_comment" },
|
|
367483
|
+
{ re: /\bglab\s+mr\s+close\b/, action: "closed", op: "pr_close" },
|
|
367484
|
+
{ re: /\bglab\s+mr\s+reopen\b/, action: "reopened", op: "pr_reopen" }
|
|
367485
|
+
];
|
|
367486
|
+
QUOTED_ARGS_RE = /"(?:[^"\\]|\\.)*"|'[^']*'/g;
|
|
367487
|
+
PR_URL_RE = /https?:\/\/[^/\s"]+\/([^\s"]+?)\/(?:pull|pull-requests|-\/merge_requests)\/(\d+)/;
|
|
367449
367488
|
});
|
|
367450
367489
|
|
|
367451
367490
|
// src/tools/BashTool/commandSemantics.ts
|
|
@@ -467618,17 +467657,24 @@ function CollapsedReadSearchContent({
|
|
|
467618
467657
|
merged: "merged",
|
|
467619
467658
|
commented: "commented on",
|
|
467620
467659
|
closed: "closed",
|
|
467621
|
-
|
|
467660
|
+
reopened: "reopened",
|
|
467661
|
+
ready: "marked ready",
|
|
467662
|
+
draft: "marked draft",
|
|
467663
|
+
"auto-merge-enabled": "enabled auto-merge on",
|
|
467664
|
+
"auto-merge-disabled": "disabled auto-merge on"
|
|
467622
467665
|
};
|
|
467623
467666
|
for (const pr of message.prs) {
|
|
467624
|
-
|
|
467667
|
+
const isMr = pr.url !== undefined && isMrUrl(pr.url);
|
|
467668
|
+
const badgeEligible = pr.url !== undefined && pr.url.length <= PR_BADGE_URL_MAX_LENGTH;
|
|
467669
|
+
pushPart(`pr-${pr.action}-${pr.number}`, verbs[pr.action], badgeEligible ? /* @__PURE__ */ jsx_runtime116.jsx(PrBadge, {
|
|
467625
467670
|
number: pr.number,
|
|
467626
467671
|
url: pr.url,
|
|
467627
|
-
bold: true
|
|
467672
|
+
bold: true,
|
|
467673
|
+
kind: isMr ? "mr" : undefined
|
|
467628
467674
|
}) : /* @__PURE__ */ jsx_runtime116.jsxs(ThemedText, {
|
|
467629
467675
|
bold: true,
|
|
467630
467676
|
children: [
|
|
467631
|
-
"PR #",
|
|
467677
|
+
isMr ? "MR !" : "PR #",
|
|
467632
467678
|
pr.number
|
|
467633
467679
|
]
|
|
467634
467680
|
}));
|
|
@@ -467910,6 +467956,7 @@ var init_CollapsedReadSearchContent = __esm(() => {
|
|
|
467910
467956
|
init_Tool();
|
|
467911
467957
|
init_primitiveTools();
|
|
467912
467958
|
init_collapseReadSearch();
|
|
467959
|
+
init_gitOperationTracking();
|
|
467913
467960
|
init_file();
|
|
467914
467961
|
init_format();
|
|
467915
467962
|
init_fullscreen();
|