mobbdev 1.1.12 → 1.1.14
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 +1 -0
- package/dist/index.mjs +121 -1
- package/package.json +5 -5
|
@@ -333,6 +333,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
|
|
|
333
333
|
var Pr_Status_Enum = /* @__PURE__ */ ((Pr_Status_Enum2) => {
|
|
334
334
|
Pr_Status_Enum2["Active"] = "ACTIVE";
|
|
335
335
|
Pr_Status_Enum2["Closed"] = "CLOSED";
|
|
336
|
+
Pr_Status_Enum2["Draft"] = "DRAFT";
|
|
336
337
|
Pr_Status_Enum2["Merged"] = "MERGED";
|
|
337
338
|
return Pr_Status_Enum2;
|
|
338
339
|
})(Pr_Status_Enum || {});
|
package/dist/index.mjs
CHANGED
|
@@ -1592,6 +1592,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
|
|
|
1592
1592
|
var Pr_Status_Enum = /* @__PURE__ */ ((Pr_Status_Enum2) => {
|
|
1593
1593
|
Pr_Status_Enum2["Active"] = "ACTIVE";
|
|
1594
1594
|
Pr_Status_Enum2["Closed"] = "CLOSED";
|
|
1595
|
+
Pr_Status_Enum2["Draft"] = "DRAFT";
|
|
1595
1596
|
Pr_Status_Enum2["Merged"] = "MERGED";
|
|
1596
1597
|
return Pr_Status_Enum2;
|
|
1597
1598
|
})(Pr_Status_Enum || {});
|
|
@@ -6885,6 +6886,11 @@ var AdoSCMLib = class extends SCMLib {
|
|
|
6885
6886
|
async getSubmitRequests(_repoUrl) {
|
|
6886
6887
|
throw new Error("getSubmitRequests not implemented for ADO");
|
|
6887
6888
|
}
|
|
6889
|
+
// TODO: Add comprehensive tests for getPullRequestMetrics (ADO)
|
|
6890
|
+
// See clients/cli/src/features/analysis/scm/__tests__/github.test.ts:589-648 for reference
|
|
6891
|
+
async getPullRequestMetrics(_prNumber) {
|
|
6892
|
+
throw new Error("getPullRequestMetrics not implemented for ADO");
|
|
6893
|
+
}
|
|
6888
6894
|
};
|
|
6889
6895
|
|
|
6890
6896
|
// src/features/analysis/scm/bitbucket/bitbucket.ts
|
|
@@ -7456,6 +7462,11 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7456
7462
|
async getSubmitRequests(_repoUrl) {
|
|
7457
7463
|
throw new Error("getSubmitRequests not implemented for Bitbucket");
|
|
7458
7464
|
}
|
|
7465
|
+
// TODO: Add comprehensive tests for getPullRequestMetrics (Bitbucket)
|
|
7466
|
+
// See clients/cli/src/features/analysis/scm/__tests__/github.test.ts:589-648 for reference
|
|
7467
|
+
async getPullRequestMetrics(_prNumber) {
|
|
7468
|
+
throw new Error("getPullRequestMetrics not implemented for Bitbucket");
|
|
7469
|
+
}
|
|
7459
7470
|
};
|
|
7460
7471
|
|
|
7461
7472
|
// src/features/analysis/scm/constants.ts
|
|
@@ -7566,6 +7577,40 @@ var GITHUB_GRAPHQL_FRAGMENTS = {
|
|
|
7566
7577
|
committedDate
|
|
7567
7578
|
`
|
|
7568
7579
|
};
|
|
7580
|
+
var GET_PR_METRICS_QUERY = `
|
|
7581
|
+
query GetPRMetrics($owner: String!, $repo: String!, $prNumber: Int!) {
|
|
7582
|
+
repository(owner: $owner, name: $repo) {
|
|
7583
|
+
pullRequest(number: $prNumber) {
|
|
7584
|
+
id
|
|
7585
|
+
number
|
|
7586
|
+
state
|
|
7587
|
+
isDraft
|
|
7588
|
+
createdAt
|
|
7589
|
+
mergedAt
|
|
7590
|
+
additions
|
|
7591
|
+
deletions
|
|
7592
|
+
commits(first: 100) {
|
|
7593
|
+
totalCount
|
|
7594
|
+
nodes {
|
|
7595
|
+
commit {
|
|
7596
|
+
oid
|
|
7597
|
+
committedDate
|
|
7598
|
+
author {
|
|
7599
|
+
date
|
|
7600
|
+
}
|
|
7601
|
+
}
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7604
|
+
comments(first: 100) {
|
|
7605
|
+
totalCount
|
|
7606
|
+
nodes {
|
|
7607
|
+
id
|
|
7608
|
+
}
|
|
7609
|
+
}
|
|
7610
|
+
}
|
|
7611
|
+
}
|
|
7612
|
+
}
|
|
7613
|
+
`;
|
|
7569
7614
|
|
|
7570
7615
|
// src/features/analysis/scm/github/utils/encrypt_secret.ts
|
|
7571
7616
|
import sodium from "libsodium-wrappers";
|
|
@@ -8342,6 +8387,17 @@ function getGithubSdk(params = {}) {
|
|
|
8342
8387
|
return void 0;
|
|
8343
8388
|
}
|
|
8344
8389
|
});
|
|
8390
|
+
},
|
|
8391
|
+
async getPRMetricsGraphQL(params2) {
|
|
8392
|
+
const res = await octokit.graphql(
|
|
8393
|
+
GET_PR_METRICS_QUERY,
|
|
8394
|
+
{
|
|
8395
|
+
owner: params2.owner,
|
|
8396
|
+
repo: params2.repo,
|
|
8397
|
+
prNumber: params2.prNumber
|
|
8398
|
+
}
|
|
8399
|
+
);
|
|
8400
|
+
return res;
|
|
8345
8401
|
}
|
|
8346
8402
|
};
|
|
8347
8403
|
}
|
|
@@ -8782,12 +8838,67 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8782
8838
|
const { owner, repo } = parseGithubOwnerAndRepo(repoUrl);
|
|
8783
8839
|
return this.githubSdk.getPrCommitsBatch({ owner, repo, prNumbers });
|
|
8784
8840
|
}
|
|
8841
|
+
async getPullRequestMetrics(prNumber) {
|
|
8842
|
+
this._validateAccessTokenAndUrl();
|
|
8843
|
+
const { owner, repo } = parseGithubOwnerAndRepo(this.url);
|
|
8844
|
+
const res = await this.githubSdk.getPRMetricsGraphQL({
|
|
8845
|
+
owner,
|
|
8846
|
+
repo,
|
|
8847
|
+
prNumber
|
|
8848
|
+
});
|
|
8849
|
+
const pr = res.repository.pullRequest;
|
|
8850
|
+
if (!pr) {
|
|
8851
|
+
throw new Error(`Pull request #${prNumber} not found`);
|
|
8852
|
+
}
|
|
8853
|
+
let prStatus = "ACTIVE" /* Active */;
|
|
8854
|
+
if (pr.state === "CLOSED") {
|
|
8855
|
+
prStatus = pr.mergedAt ? "MERGED" /* Merged */ : "CLOSED" /* Closed */;
|
|
8856
|
+
} else if (pr.isDraft) {
|
|
8857
|
+
prStatus = "DRAFT" /* Draft */;
|
|
8858
|
+
}
|
|
8859
|
+
const firstCommit = pr.commits.nodes[0];
|
|
8860
|
+
const firstCommitDate = firstCommit ? new Date(
|
|
8861
|
+
firstCommit.commit.author?.date || firstCommit.commit.committedDate || pr.createdAt
|
|
8862
|
+
) : null;
|
|
8863
|
+
let commitShas = pr.commits.nodes.map((node) => node.commit.oid);
|
|
8864
|
+
if (pr.commits.totalCount > 100) {
|
|
8865
|
+
const commitsRes = await this.githubSdk.getPrCommits({
|
|
8866
|
+
owner,
|
|
8867
|
+
repo,
|
|
8868
|
+
pull_number: prNumber
|
|
8869
|
+
});
|
|
8870
|
+
commitShas = commitsRes.data.map((c) => c.sha);
|
|
8871
|
+
}
|
|
8872
|
+
let commentIds = pr.comments.nodes.map((node) => node.id);
|
|
8873
|
+
if (pr.comments.totalCount > 100) {
|
|
8874
|
+
const commentsRes = await this.githubSdk.getGeneralPrComments({
|
|
8875
|
+
owner,
|
|
8876
|
+
repo,
|
|
8877
|
+
issue_number: prNumber
|
|
8878
|
+
});
|
|
8879
|
+
commentIds = commentsRes.data.map((c) => String(c.id));
|
|
8880
|
+
}
|
|
8881
|
+
return {
|
|
8882
|
+
prId: String(prNumber),
|
|
8883
|
+
repositoryUrl: this.url,
|
|
8884
|
+
prCreatedAt: new Date(pr.createdAt),
|
|
8885
|
+
prMergedAt: pr.mergedAt ? new Date(pr.mergedAt) : null,
|
|
8886
|
+
firstCommitDate,
|
|
8887
|
+
linesAdded: pr.additions,
|
|
8888
|
+
commitsCount: pr.commits.totalCount,
|
|
8889
|
+
commitShas,
|
|
8890
|
+
prStatus,
|
|
8891
|
+
commentIds
|
|
8892
|
+
};
|
|
8893
|
+
}
|
|
8785
8894
|
/**
|
|
8786
8895
|
* Parse a Linear ticket from URL and name
|
|
8787
8896
|
* Returns null if invalid or missing data
|
|
8788
8897
|
*/
|
|
8789
8898
|
_parseLinearTicket(url, name) {
|
|
8790
|
-
if (!name || !url)
|
|
8899
|
+
if (!name || !url) {
|
|
8900
|
+
return null;
|
|
8901
|
+
}
|
|
8791
8902
|
const urlParts = url.split("/");
|
|
8792
8903
|
const titleSlug = urlParts[urlParts.length - 1] || "";
|
|
8793
8904
|
const title = titleSlug.replace(/-/g, " ");
|
|
@@ -9475,6 +9586,11 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
9475
9586
|
async getSubmitRequests(_repoUrl) {
|
|
9476
9587
|
throw new Error("getSubmitRequests not implemented for GitLab");
|
|
9477
9588
|
}
|
|
9589
|
+
// TODO: Add comprehensive tests for getPullRequestMetrics (GitLab)
|
|
9590
|
+
// See clients/cli/src/features/analysis/scm/__tests__/github.test.ts:589-648 for reference
|
|
9591
|
+
async getPullRequestMetrics(_prNumber) {
|
|
9592
|
+
throw new Error("getPullRequestMetrics not implemented for GitLab");
|
|
9593
|
+
}
|
|
9478
9594
|
};
|
|
9479
9595
|
|
|
9480
9596
|
// src/features/analysis/scm/scmFactory.ts
|
|
@@ -9604,6 +9720,10 @@ var StubSCMLib = class extends SCMLib {
|
|
|
9604
9720
|
console.warn("getSubmitRequests() returning empty array");
|
|
9605
9721
|
return [];
|
|
9606
9722
|
}
|
|
9723
|
+
async getPullRequestMetrics(_prNumber) {
|
|
9724
|
+
console.warn("getPullRequestMetrics() returning empty object");
|
|
9725
|
+
throw new Error("getPullRequestMetrics() not implemented");
|
|
9726
|
+
}
|
|
9607
9727
|
};
|
|
9608
9728
|
|
|
9609
9729
|
// src/features/analysis/scm/scmFactory.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobbdev",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Automated secure code remediation tool",
|
|
5
5
|
"repository": "git+https://github.com/mobb-dev/bugsy.git",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"sax": "1.4.3",
|
|
92
92
|
"semver": "7.7.3",
|
|
93
93
|
"simple-git": "3.30.0",
|
|
94
|
-
"snyk": "1.1301.
|
|
94
|
+
"snyk": "1.1301.2",
|
|
95
95
|
"tar": "6.2.1",
|
|
96
96
|
"tmp": "0.2.5",
|
|
97
97
|
"tmp-promise": "3.0.3",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@types/uuid": "10.0.0",
|
|
123
123
|
"@types/ws": "8.18.1",
|
|
124
124
|
"@types/xml2js": "0.4.14",
|
|
125
|
-
"@types/yargs": "17.0.
|
|
125
|
+
"@types/yargs": "17.0.35",
|
|
126
126
|
"@typescript-eslint/eslint-plugin": "7.17.0",
|
|
127
127
|
"@typescript-eslint/parser": "7.17.0",
|
|
128
128
|
"@vitest/coverage-v8": "3.2.4",
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
135
135
|
"msw": "2.10.5",
|
|
136
136
|
"nock": "14.0.10",
|
|
137
|
-
"prettier": "3.
|
|
138
|
-
"tsup": "8.5.
|
|
137
|
+
"prettier": "3.7.4",
|
|
138
|
+
"tsup": "8.5.1",
|
|
139
139
|
"typescript": "5.9.3",
|
|
140
140
|
"vitest": "3.2.4"
|
|
141
141
|
},
|