@cnwenf/occ 2.1.320 → 2.1.321

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/cli.js +62 -19
  2. 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.320","BINARY_NAME":"occ","BUILD_TIME":"2026-09-03T01:30:46.452Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.321","BINARY_NAME":"occ","BUILD_TIME":"2026-09-03T19:19:08.554Z","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;
@@ -367290,8 +367290,33 @@ ${content}` : stdout;
367290
367290
  function gitCmdRe(subcmd, suffix = "") {
367291
367291
  return new RegExp(`\\bgit(?:\\s+-[cC]\\s+\\S+|\\s+--\\S+=\\S+)*\\s+${subcmd}\\b${suffix}`);
367292
367292
  }
367293
+ function resolvePrAction(command4) {
367294
+ const ghAction = GH_PR_ACTIONS.find((a5) => a5.re.test(command4))?.action;
367295
+ const unquoted = command4.replace(QUOTED_ARGS_RE, " ");
367296
+ if (ghAction === "merged") {
367297
+ if (/--disable-auto\b/.test(unquoted))
367298
+ return "auto-merge-disabled";
367299
+ if (/--auto\b/.test(unquoted))
367300
+ return "auto-merge-enabled";
367301
+ } else if (ghAction === "ready" && /--undo\b/.test(unquoted)) {
367302
+ return "draft";
367303
+ }
367304
+ if (ghAction)
367305
+ return ghAction;
367306
+ const glabAction = GLAB_MR_ACTIONS.find((a5) => a5.re.test(command4))?.action;
367307
+ if (glabAction === "edited") {
367308
+ if (/--ready\b/.test(unquoted))
367309
+ return "ready";
367310
+ if (/--draft\b/.test(unquoted))
367311
+ return "draft";
367312
+ }
367313
+ return glabAction;
367314
+ }
367315
+ function isMrUrl(url3) {
367316
+ return /\/-\/merge_requests\/\d/.test(url3);
367317
+ }
367293
367318
  function parsePrUrl(url3) {
367294
- const match = url3.match(/https:\/\/github\.com\/([^/]+\/[^/]+)\/pull\/(\d+)/);
367319
+ const match = url3.match(PR_URL_RE);
367295
367320
  if (match?.[1] && match?.[2]) {
367296
367321
  return {
367297
367322
  prNumber: parseInt(match[2], 10),
@@ -367302,8 +367327,11 @@ function parsePrUrl(url3) {
367302
367327
  return null;
367303
367328
  }
367304
367329
  function findPrInStdout(stdout) {
367305
- const m5 = stdout.match(/https:\/\/github\.com\/[^/\s]+\/[^/\s]+\/pull\/\d+/);
367306
- return m5 ? parsePrUrl(m5[0]) : null;
367330
+ const matches = stdout.match(new RegExp(PR_URL_RE.source, "g"));
367331
+ if (!matches)
367332
+ return null;
367333
+ const last2 = matches.at(-1);
367334
+ return last2 !== undefined ? parsePrUrl(last2) : null;
367307
367335
  }
367308
367336
  function parseGitCommitId(stdout) {
367309
367337
  const match = stdout.match(/\[[\w./-]+(?: \(root-commit\))? ([0-9a-f]+)\]/);
@@ -367357,12 +367385,12 @@ function detectGitOperation(command4, output) {
367357
367385
  if (ref)
367358
367386
  result.branch = { ref, action: "rebased" };
367359
367387
  }
367360
- const prAction = GH_PR_ACTIONS.find((a5) => a5.re.test(command4))?.action;
367388
+ const prAction = resolvePrAction(command4);
367361
367389
  if (prAction) {
367362
367390
  const pr = findPrInStdout(output);
367363
367391
  if (pr) {
367364
367392
  result.pr = { number: pr.prNumber, url: pr.prUrl, action: prAction };
367365
- } else {
367393
+ } else if (GH_PR_ACTIONS.some((a5) => a5.re.test(command4))) {
367366
367394
  const num = parsePrNumberFromText(output);
367367
367395
  if (num)
367368
367396
  result.pr = { number: num, action: prAction };
@@ -367391,13 +367419,15 @@ function trackGitOperations(command4, exitCode, stdout) {
367391
367419
  operation: "push"
367392
367420
  });
367393
367421
  }
367394
- const prHit = GH_PR_ACTIONS.find((a5) => a5.re.test(command4));
367422
+ const ghHit = GH_PR_ACTIONS.find((a5) => a5.re.test(command4));
367423
+ const glabHit = GLAB_MR_ACTIONS.find((a5) => a5.re.test(command4));
367424
+ const prHit = ghHit ?? glabHit;
367395
367425
  if (prHit) {
367396
367426
  logEvent2("tengu_git_operation", {
367397
367427
  operation: prHit.op
367398
367428
  });
367399
367429
  }
367400
- if (prHit?.action === "created") {
367430
+ if (ghHit?.action === "created" || glabHit?.action === "created") {
367401
367431
  getPrCounter()?.add(1);
367402
367432
  if (stdout) {
367403
367433
  const prInfo = findPrInStdout(stdout);
@@ -367413,12 +367443,6 @@ function trackGitOperations(command4, exitCode, stdout) {
367413
367443
  }
367414
367444
  }
367415
367445
  }
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
367446
  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
367447
  const isPrEndpoint = command4.match(/https?:\/\/[^\s'"]*\/(pulls|pull-requests|merge[-_]requests)(?!\/\d)/i);
367424
367448
  if (isCurlPost && isPrEndpoint) {
@@ -367428,7 +367452,7 @@ function trackGitOperations(command4, exitCode, stdout) {
367428
367452
  getPrCounter()?.add(1);
367429
367453
  }
367430
367454
  }
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;
367455
+ 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
367456
  var init_gitOperationTracking = __esm(() => {
367433
367457
  init_state();
367434
367458
  init_analytics();
@@ -367444,8 +367468,19 @@ var init_gitOperationTracking = __esm(() => {
367444
367468
  { re: /\bgh\s+pr\s+merge\b/, action: "merged", op: "pr_merge" },
367445
367469
  { re: /\bgh\s+pr\s+comment\b/, action: "commented", op: "pr_comment" },
367446
367470
  { re: /\bgh\s+pr\s+close\b/, action: "closed", op: "pr_close" },
367471
+ { re: /\bgh\s+pr\s+reopen\b/, action: "reopened", op: "pr_reopen" },
367447
367472
  { re: /\bgh\s+pr\s+ready\b/, action: "ready", op: "pr_ready" }
367448
367473
  ];
367474
+ GLAB_MR_ACTIONS = [
367475
+ { re: /\bglab\s+mr\s+create\b/, action: "created", op: "pr_create" },
367476
+ { re: /\bglab\s+mr\s+update\b/, action: "edited", op: "pr_edit" },
367477
+ { re: /\bglab\s+mr\s+merge\b/, action: "merged", op: "pr_merge" },
367478
+ { re: /\bglab\s+mr\s+note\b/, action: "commented", op: "pr_comment" },
367479
+ { re: /\bglab\s+mr\s+close\b/, action: "closed", op: "pr_close" },
367480
+ { re: /\bglab\s+mr\s+reopen\b/, action: "reopened", op: "pr_reopen" }
367481
+ ];
367482
+ QUOTED_ARGS_RE = /"(?:[^"\\]|\\.)*"|'[^']*'/g;
367483
+ PR_URL_RE = /https?:\/\/[^/\s"]+\/([^\s"]+?)\/(?:pull|pull-requests|-\/merge_requests)\/(\d+)/;
367449
367484
  });
367450
367485
 
367451
367486
  // src/tools/BashTool/commandSemantics.ts
@@ -467618,17 +467653,24 @@ function CollapsedReadSearchContent({
467618
467653
  merged: "merged",
467619
467654
  commented: "commented on",
467620
467655
  closed: "closed",
467621
- ready: "marked ready"
467656
+ reopened: "reopened",
467657
+ ready: "marked ready",
467658
+ draft: "marked draft",
467659
+ "auto-merge-enabled": "enabled auto-merge on",
467660
+ "auto-merge-disabled": "disabled auto-merge on"
467622
467661
  };
467623
467662
  for (const pr of message.prs) {
467624
- pushPart(`pr-${pr.action}-${pr.number}`, verbs[pr.action], pr.url ? /* @__PURE__ */ jsx_runtime116.jsx(PrBadge, {
467663
+ const isMr = pr.url !== undefined && isMrUrl(pr.url);
467664
+ const badgeEligible = pr.url !== undefined && pr.url.length <= PR_BADGE_URL_MAX_LENGTH;
467665
+ pushPart(`pr-${pr.action}-${pr.number}`, verbs[pr.action], badgeEligible ? /* @__PURE__ */ jsx_runtime116.jsx(PrBadge, {
467625
467666
  number: pr.number,
467626
467667
  url: pr.url,
467627
- bold: true
467668
+ bold: true,
467669
+ kind: isMr ? "mr" : undefined
467628
467670
  }) : /* @__PURE__ */ jsx_runtime116.jsxs(ThemedText, {
467629
467671
  bold: true,
467630
467672
  children: [
467631
- "PR #",
467673
+ isMr ? "MR !" : "PR #",
467632
467674
  pr.number
467633
467675
  ]
467634
467676
  }));
@@ -467910,6 +467952,7 @@ var init_CollapsedReadSearchContent = __esm(() => {
467910
467952
  init_Tool();
467911
467953
  init_primitiveTools();
467912
467954
  init_collapseReadSearch();
467955
+ init_gitOperationTracking();
467913
467956
  init_file();
467914
467957
  init_format();
467915
467958
  init_fullscreen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.320",
3
+ "version": "2.1.321",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {