mobbdev 0.0.73 → 0.0.76

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 (3) hide show
  1. package/.env +3 -2
  2. package/dist/index.mjs +41 -17
  3. package/package.json +4 -2
package/.env CHANGED
@@ -1,6 +1,7 @@
1
- # production@v14
1
+ # production@v15
2
2
  WEB_LOGIN_URL="https://app.mobb.ai/cli-login"
3
3
  API_URL="https://api.mobb.ai/v1/graphql"
4
4
  WEB_APP_URL="https://app.mobb.ai"
5
5
  GITLAB_API_TOKEN=""
6
- GITHUB_API_TOKEN=""
6
+ GITHUB_API_TOKEN=""
7
+ ADO_TEST_ACCESS_TOKEN=""
package/dist/index.mjs CHANGED
@@ -1317,14 +1317,15 @@ async function getGithubBlameRanges({ ref, gitHubUrl, path: path8 }, options) {
1317
1317
  }
1318
1318
  async function createPr({
1319
1319
  sourceRepoUrl,
1320
- sourceFilePath,
1321
- targetFilePath,
1320
+ filesPaths,
1322
1321
  userRepoUrl,
1323
- title
1322
+ title,
1323
+ body
1324
1324
  }, options) {
1325
1325
  const oktoKit = getOktoKit(options);
1326
1326
  const { owner: sourceOwner, repo: sourceRepo } = parseOwnerAndRepo(sourceRepoUrl);
1327
1327
  const { owner, repo } = parseOwnerAndRepo(userRepoUrl);
1328
+ const [sourceFilePath, secondFilePath] = filesPaths;
1328
1329
  const sourceFileContentResponse = await oktoKit.rest.repos.getContent({
1329
1330
  owner: sourceOwner,
1330
1331
  repo: sourceRepo,
@@ -1345,18 +1346,40 @@ async function createPr({
1345
1346
  sourceFileContentResponse.data.content,
1346
1347
  "base64"
1347
1348
  ).toString("utf-8");
1349
+ const tree = [
1350
+ {
1351
+ path: sourceFilePath,
1352
+ mode: "100644",
1353
+ type: "blob",
1354
+ content: decodedContent
1355
+ }
1356
+ ];
1357
+ if (secondFilePath) {
1358
+ const secondFileContentResponse = await oktoKit.rest.repos.getContent({
1359
+ owner: sourceOwner,
1360
+ repo: sourceRepo,
1361
+ path: "/" + secondFilePath
1362
+ });
1363
+ const secondDecodedContent = Buffer.from(
1364
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1365
+ // @ts-ignore
1366
+ secondFileContentResponse.data.content,
1367
+ "base64"
1368
+ ).toString("utf-8");
1369
+ tree.push({
1370
+ path: secondFilePath,
1371
+ mode: "100644",
1372
+ type: "blob",
1373
+ content: secondDecodedContent
1374
+ });
1375
+ }
1348
1376
  const createTreeResponse = await oktoKit.rest.git.createTree({
1349
1377
  owner,
1350
1378
  repo,
1351
1379
  base_tree: await oktoKit.rest.git.getRef({ owner, repo, ref: `heads/${defaultBranch}` }).then((response) => response.data.object.sha),
1352
- tree: [
1353
- {
1354
- path: targetFilePath,
1355
- mode: "100644",
1356
- type: "blob",
1357
- content: decodedContent
1358
- }
1359
- ]
1380
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1381
+ // @ts-ignore
1382
+ tree
1360
1383
  });
1361
1384
  const createCommitResponse = await oktoKit.rest.git.createCommit({
1362
1385
  owner,
@@ -1377,6 +1400,7 @@ async function createPr({
1377
1400
  owner,
1378
1401
  repo,
1379
1402
  title,
1403
+ body,
1380
1404
  head: newBranchName,
1381
1405
  base: "main"
1382
1406
  });
@@ -1680,7 +1704,7 @@ var GitlabSCMLib = class extends SCMLib {
1680
1704
  }
1681
1705
  throw new Error("not supported yet");
1682
1706
  }
1683
- async createPullRequestWithNewFile(_sourceRepoUrl, _sourceFilePath, _targetFilePath, _userRepoUrl, _title) {
1707
+ async createPullRequestWithNewFile(_sourceRepoUrl, _filesPaths, _userRepoUrl, _title, _body) {
1684
1708
  throw new Error("not implemented");
1685
1709
  }
1686
1710
  async getRepoList() {
@@ -1867,14 +1891,14 @@ var GithubSCMLib = class extends SCMLib {
1867
1891
  repo
1868
1892
  });
1869
1893
  }
1870
- async createPullRequestWithNewFile(sourceRepoUrl, sourceFilePath, targetFilePath, userRepoUrl, title) {
1894
+ async createPullRequestWithNewFile(sourceRepoUrl, filesPaths, userRepoUrl, title, body) {
1871
1895
  const { pull_request_url } = await createPr(
1872
1896
  {
1873
1897
  sourceRepoUrl,
1874
- sourceFilePath,
1875
- targetFilePath,
1898
+ filesPaths,
1876
1899
  userRepoUrl,
1877
- title
1900
+ title,
1901
+ body
1878
1902
  },
1879
1903
  {
1880
1904
  githubAuthToken: this.accessToken
@@ -2097,7 +2121,7 @@ var StubSCMLib = class extends SCMLib {
2097
2121
  console.error("forkRepo() not implemented");
2098
2122
  throw new Error("forkRepo() not implemented");
2099
2123
  }
2100
- async createPullRequestWithNewFile(_sourceRepoUrl, _sourceFilePath, _targetFilePath, _userRepoUrl, _title) {
2124
+ async createPullRequestWithNewFile(_sourceRepoUrl, _filesPaths, _userRepoUrl, _title, _body) {
2101
2125
  console.error("createPullRequestWithNewFile() not implemented");
2102
2126
  throw new Error("createPullRequestWithNewFile() not implemented");
2103
2127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "0.0.73",
3
+ "version": "0.0.76",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "https://github.com/mobb-dev/bugsy",
6
6
  "main": "dist/index.js",
@@ -22,6 +22,8 @@
22
22
  "author": "",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
+ "@gitbeaker/core": "39.13.0",
26
+ "@gitbeaker/requester-utils": "39.13.0",
25
27
  "@gitbeaker/rest": "39.13.0",
26
28
  "@octokit/core": "5.0.2",
27
29
  "@octokit/graphql": "5.0.5",
@@ -29,7 +31,7 @@
29
31
  "@octokit/request-error": "3.0.3",
30
32
  "@types/libsodium-wrappers": "0.7.13",
31
33
  "adm-zip": "0.5.10",
32
- "axios": "1.5.0",
34
+ "axios": "1.6.5",
33
35
  "chalk": "5.3.0",
34
36
  "chalk-animation": "2.0.3",
35
37
  "configstore": "6.0.0",