mobbdev 1.4.50 → 1.4.56
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/args/commands/upload_ai_blame.mjs +6 -0
- package/dist/index.mjs +135 -19
- package/package.json +1 -1
|
@@ -4891,6 +4891,12 @@ var GitlabAuthResultZ = z20.object({
|
|
|
4891
4891
|
|
|
4892
4892
|
// src/features/analysis/scm/gitlab/gitlab.ts
|
|
4893
4893
|
var debug6 = Debug5("scm:gitlab");
|
|
4894
|
+
var GITLAB_HEADERS_TIMEOUT_MS = 3e4;
|
|
4895
|
+
var GITLAB_BODY_TIMEOUT_MS = 6e4;
|
|
4896
|
+
var gitlabDirectAgent = new Agent({
|
|
4897
|
+
headersTimeout: GITLAB_HEADERS_TIMEOUT_MS,
|
|
4898
|
+
bodyTimeout: GITLAB_BODY_TIMEOUT_MS
|
|
4899
|
+
});
|
|
4894
4900
|
|
|
4895
4901
|
// src/features/analysis/scm/gitlab/GitlabSCMLib.ts
|
|
4896
4902
|
init_client_generates();
|
package/dist/index.mjs
CHANGED
|
@@ -9258,16 +9258,63 @@ async function createMergeRequest(options) {
|
|
|
9258
9258
|
url: options.repoUrl,
|
|
9259
9259
|
gitlabAuthToken: options.accessToken
|
|
9260
9260
|
});
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9261
|
+
try {
|
|
9262
|
+
const res = await api2.MergeRequests.create(
|
|
9263
|
+
projectPath,
|
|
9264
|
+
options.sourceBranchName,
|
|
9265
|
+
options.targetBranchName,
|
|
9266
|
+
options.title,
|
|
9267
|
+
{
|
|
9268
|
+
description: safeBody(options.body, MAX_GITLAB_PR_BODY_LENGTH)
|
|
9269
|
+
}
|
|
9270
|
+
);
|
|
9271
|
+
return res.iid;
|
|
9272
|
+
} catch (e) {
|
|
9273
|
+
if (!isGitlabDuplicateMergeRequest(e)) {
|
|
9274
|
+
throw e;
|
|
9275
|
+
}
|
|
9276
|
+
const existingIid = await findOpenGitlabMergeRequestIid({
|
|
9277
|
+
api: api2,
|
|
9278
|
+
projectPath,
|
|
9279
|
+
sourceBranchName: options.sourceBranchName,
|
|
9280
|
+
targetBranchName: options.targetBranchName
|
|
9281
|
+
});
|
|
9282
|
+
if (existingIid === void 0) {
|
|
9283
|
+
throw e;
|
|
9268
9284
|
}
|
|
9285
|
+
contextLogger.warn(
|
|
9286
|
+
"[createMergeRequest] adopted existing MR after duplicate conflict",
|
|
9287
|
+
{
|
|
9288
|
+
projectPath,
|
|
9289
|
+
sourceBranch: options.sourceBranchName,
|
|
9290
|
+
targetBranch: options.targetBranchName,
|
|
9291
|
+
iid: existingIid
|
|
9292
|
+
}
|
|
9293
|
+
);
|
|
9294
|
+
return existingIid;
|
|
9295
|
+
}
|
|
9296
|
+
}
|
|
9297
|
+
function isGitlabDuplicateMergeRequest(e) {
|
|
9298
|
+
const status = e?.status;
|
|
9299
|
+
const msg = (e instanceof Error ? e.message : String(e)).toLowerCase();
|
|
9300
|
+
return status === 409 || /another open merge request already exists|merge request already exists/.test(
|
|
9301
|
+
msg
|
|
9269
9302
|
);
|
|
9270
|
-
|
|
9303
|
+
}
|
|
9304
|
+
async function findOpenGitlabMergeRequestIid({
|
|
9305
|
+
api: api2,
|
|
9306
|
+
projectPath,
|
|
9307
|
+
sourceBranchName,
|
|
9308
|
+
targetBranchName
|
|
9309
|
+
}) {
|
|
9310
|
+
const open6 = await api2.MergeRequests.all({
|
|
9311
|
+
projectId: projectPath,
|
|
9312
|
+
sourceBranch: sourceBranchName,
|
|
9313
|
+
targetBranch: targetBranchName,
|
|
9314
|
+
state: "opened",
|
|
9315
|
+
perPage: 1
|
|
9316
|
+
});
|
|
9317
|
+
return open6[0]?.iid;
|
|
9271
9318
|
}
|
|
9272
9319
|
async function getGitlabMergeRequest({
|
|
9273
9320
|
url,
|
|
@@ -9681,9 +9728,65 @@ async function processBody(response) {
|
|
|
9681
9728
|
}
|
|
9682
9729
|
return await response.text();
|
|
9683
9730
|
}
|
|
9684
|
-
var GITLAB_RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
|
|
9685
|
-
|
|
9731
|
+
var GITLAB_RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
|
|
9732
|
+
408,
|
|
9733
|
+
429,
|
|
9734
|
+
500,
|
|
9735
|
+
502,
|
|
9736
|
+
503,
|
|
9737
|
+
504,
|
|
9738
|
+
520,
|
|
9739
|
+
522,
|
|
9740
|
+
524
|
|
9741
|
+
]);
|
|
9742
|
+
var GITLAB_REQUEST_MAX_ATTEMPTS = 5;
|
|
9686
9743
|
var GITLAB_REQUEST_BASE_BACKOFF_MS = 1e3;
|
|
9744
|
+
var GITLAB_REQUEST_MAX_BACKOFF_MS = 8e3;
|
|
9745
|
+
var GITLAB_RETRY_AFTER_CAP_MS = 3e4;
|
|
9746
|
+
var GITLAB_REQUEST_JITTER_MS = 1e3;
|
|
9747
|
+
var GITLAB_HEADERS_TIMEOUT_MS = 3e4;
|
|
9748
|
+
var GITLAB_BODY_TIMEOUT_MS = 6e4;
|
|
9749
|
+
var gitlabDirectAgent = new Agent({
|
|
9750
|
+
headersTimeout: GITLAB_HEADERS_TIMEOUT_MS,
|
|
9751
|
+
bodyTimeout: GITLAB_BODY_TIMEOUT_MS
|
|
9752
|
+
});
|
|
9753
|
+
function isRetryableGitlabStatus(status) {
|
|
9754
|
+
return GITLAB_RETRYABLE_STATUSES.has(status);
|
|
9755
|
+
}
|
|
9756
|
+
var TRANSIENT_UNDICI_CODES = /* @__PURE__ */ new Set([
|
|
9757
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
9758
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
9759
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
9760
|
+
"UND_ERR_SOCKET"
|
|
9761
|
+
]);
|
|
9762
|
+
function isTransientNetworkError(e) {
|
|
9763
|
+
if (!(e instanceof Error)) return false;
|
|
9764
|
+
if (e.name === "TimeoutError" || e.name === "AbortError") return true;
|
|
9765
|
+
const cause = e.cause;
|
|
9766
|
+
if (cause && typeof cause.code === "string") {
|
|
9767
|
+
return TRANSIENT_UNDICI_CODES.has(cause.code);
|
|
9768
|
+
}
|
|
9769
|
+
return false;
|
|
9770
|
+
}
|
|
9771
|
+
function getGitlabRetryDelayMs({
|
|
9772
|
+
attempt,
|
|
9773
|
+
retryAfterHeader
|
|
9774
|
+
}) {
|
|
9775
|
+
const retryAfterSec = Number(retryAfterHeader);
|
|
9776
|
+
if (Number.isFinite(retryAfterSec) && retryAfterSec > 0) {
|
|
9777
|
+
return Math.min(retryAfterSec * 1e3, GITLAB_RETRY_AFTER_CAP_MS);
|
|
9778
|
+
}
|
|
9779
|
+
const backoffMs = Math.min(
|
|
9780
|
+
GITLAB_REQUEST_BASE_BACKOFF_MS * 2 ** (attempt - 1),
|
|
9781
|
+
GITLAB_REQUEST_MAX_BACKOFF_MS
|
|
9782
|
+
);
|
|
9783
|
+
return backoffMs + Math.floor(Math.random() * GITLAB_REQUEST_JITTER_MS);
|
|
9784
|
+
}
|
|
9785
|
+
function gitlabResponseError(response) {
|
|
9786
|
+
const error = new Error(`gitbeaker: ${response.statusText}`);
|
|
9787
|
+
error.status = response.status;
|
|
9788
|
+
return error;
|
|
9789
|
+
}
|
|
9687
9790
|
async function brokerRequestHandler(endpoint, options) {
|
|
9688
9791
|
const { prefixUrl, searchParams } = options || {};
|
|
9689
9792
|
let baseUrl;
|
|
@@ -9694,8 +9797,10 @@ async function brokerRequestHandler(endpoint, options) {
|
|
|
9694
9797
|
uri: GIT_PROXY_HOST,
|
|
9695
9798
|
requestTls: {
|
|
9696
9799
|
rejectUnauthorized: false
|
|
9697
|
-
}
|
|
9698
|
-
|
|
9800
|
+
},
|
|
9801
|
+
headersTimeout: GITLAB_HEADERS_TIMEOUT_MS,
|
|
9802
|
+
bodyTimeout: GITLAB_BODY_TIMEOUT_MS
|
|
9803
|
+
}) : gitlabDirectAgent;
|
|
9699
9804
|
let lastError;
|
|
9700
9805
|
for (let attempt = 1; attempt <= GITLAB_REQUEST_MAX_ATTEMPTS; attempt++) {
|
|
9701
9806
|
let response;
|
|
@@ -9707,7 +9812,7 @@ async function brokerRequestHandler(endpoint, options) {
|
|
|
9707
9812
|
dispatcher
|
|
9708
9813
|
});
|
|
9709
9814
|
} catch (e) {
|
|
9710
|
-
if (e
|
|
9815
|
+
if (isTransientNetworkError(e)) {
|
|
9711
9816
|
lastError = new Error("Query timeout was reached");
|
|
9712
9817
|
} else {
|
|
9713
9818
|
throw e;
|
|
@@ -9721,14 +9826,25 @@ async function brokerRequestHandler(endpoint, options) {
|
|
|
9721
9826
|
status: response.status
|
|
9722
9827
|
};
|
|
9723
9828
|
}
|
|
9724
|
-
if (!
|
|
9725
|
-
throw
|
|
9829
|
+
if (!isRetryableGitlabStatus(response.status)) {
|
|
9830
|
+
throw gitlabResponseError(response);
|
|
9726
9831
|
}
|
|
9727
|
-
lastError =
|
|
9832
|
+
lastError = gitlabResponseError(response);
|
|
9728
9833
|
}
|
|
9729
9834
|
if (attempt === GITLAB_REQUEST_MAX_ATTEMPTS) break;
|
|
9730
|
-
const
|
|
9731
|
-
|
|
9835
|
+
const waitMs = getGitlabRetryDelayMs({
|
|
9836
|
+
attempt,
|
|
9837
|
+
retryAfterHeader: response?.headers.get("retry-after")
|
|
9838
|
+
});
|
|
9839
|
+
contextLogger.warn("[brokerRequestHandler] retrying GitLab request", {
|
|
9840
|
+
method: options?.method ?? "GET",
|
|
9841
|
+
pathname: url.pathname,
|
|
9842
|
+
status: response?.status,
|
|
9843
|
+
attempt,
|
|
9844
|
+
maxAttempts: GITLAB_REQUEST_MAX_ATTEMPTS,
|
|
9845
|
+
waitMs,
|
|
9846
|
+
error: lastError?.message
|
|
9847
|
+
});
|
|
9732
9848
|
await delay(waitMs);
|
|
9733
9849
|
}
|
|
9734
9850
|
throw lastError ?? new Error("gitbeaker: request failed");
|
|
@@ -18442,7 +18558,7 @@ function createLogger(config2) {
|
|
|
18442
18558
|
|
|
18443
18559
|
// src/features/claude_code/hook_logger.ts
|
|
18444
18560
|
var DD_RUM_TOKEN = true ? "pubf59c0182545bfb4c299175119f1abf9b" : "";
|
|
18445
|
-
var CLI_VERSION = true ? "1.4.
|
|
18561
|
+
var CLI_VERSION = true ? "1.4.56" : "unknown";
|
|
18446
18562
|
var NAMESPACE = "mobbdev-claude-code-hook-logs";
|
|
18447
18563
|
var claudeCodeVersion;
|
|
18448
18564
|
function buildDdTags() {
|