mobbdev 1.2.28 → 1.2.32

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/index.mjs CHANGED
@@ -851,12 +851,15 @@ var init_client_generates = __esm({
851
851
  }
852
852
  `;
853
853
  AnalyzeCommitForExtensionAiBlameDocument = `
854
- mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!, $commitTimestamp: Timestamp) {
854
+ mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!, $commitTimestamp: Timestamp, $commitAuthor: GitIdentityInput, $commitCommitter: GitIdentityInput, $commitCoAuthors: [GitIdentityInput!]) {
855
855
  analyzeCommitForAIBlame(
856
856
  repositoryURL: $repositoryURL
857
857
  commitSha: $commitSha
858
858
  organizationId: $organizationId
859
859
  commitTimestamp: $commitTimestamp
860
+ commitAuthor: $commitAuthor
861
+ commitCommitter: $commitCommitter
862
+ commitCoAuthors: $commitCoAuthors
860
863
  ) {
861
864
  __typename
862
865
  ... on ProcessAIBlameFinalResult {
@@ -2689,6 +2692,217 @@ var init_configs = __esm({
2689
2692
  }
2690
2693
  });
2691
2694
 
2695
+ // src/utils/blame/gitBlameTypes.ts
2696
+ import { z as z18 } from "zod";
2697
+ function parseCoAuthorValue(raw) {
2698
+ const trimmed = raw.trim();
2699
+ if (!trimmed) {
2700
+ return null;
2701
+ }
2702
+ const openBracket = trimmed.lastIndexOf("<");
2703
+ const closeBracket = trimmed.lastIndexOf(">");
2704
+ if (openBracket === -1 || closeBracket === -1 || closeBracket < openBracket) {
2705
+ return null;
2706
+ }
2707
+ const name = trimmed.slice(0, openBracket).trim();
2708
+ const email = trimmed.slice(openBracket + 1, closeBracket).trim();
2709
+ if (!name || !email) {
2710
+ return null;
2711
+ }
2712
+ return { name, email };
2713
+ }
2714
+ function parseCommitLine(line) {
2715
+ const parts = line.split("\0");
2716
+ if (parts.length < 7) {
2717
+ return null;
2718
+ }
2719
+ return {
2720
+ sha: parts[0],
2721
+ author: { name: parts[2], email: parts[1] },
2722
+ committer: { name: parts[4], email: parts[3] },
2723
+ coAuthors: parts.slice(7).map(parseCoAuthorValue).filter((v) => v !== null),
2724
+ timestamp: parseInt(parts[5], 10),
2725
+ message: parts[6]
2726
+ };
2727
+ }
2728
+ var PrepareGitBlameMessageZ, PrepareGitBlameResponseMessageZ, CommitMetadataZ, LineToCommitMapZ, CommitMetadataMapZ, BlameInfoZ, LineRangeZ, PrContextZ, PrepareCommitBlameMessageZ, BlameLineInfoZ, FileBlameDataZ, ChunkFetchResultZ, FileBlameResponseEntryZ, CommitBlameDataZ, CommitInfoZ, GitIdentityZ, COMMIT_LOG_FORMAT, CommitDataZ, PrDiffDataZ, PrStatsZ, CommitsManifestZ, BlameLineEntryZ, BlameLinesDataZ, PrepareCommitBlameResponseMessageZ;
2729
+ var init_gitBlameTypes = __esm({
2730
+ "src/utils/blame/gitBlameTypes.ts"() {
2731
+ "use strict";
2732
+ PrepareGitBlameMessageZ = z18.object({
2733
+ reportId: z18.string(),
2734
+ repoArchivePath: z18.string()
2735
+ });
2736
+ PrepareGitBlameResponseMessageZ = z18.object({
2737
+ reportId: z18.string()
2738
+ });
2739
+ CommitMetadataZ = z18.object({
2740
+ author: z18.string().optional(),
2741
+ "author-mail": z18.string().optional(),
2742
+ "author-time": z18.string().optional(),
2743
+ "author-tz": z18.string().optional(),
2744
+ committer: z18.string().optional(),
2745
+ "committer-mail": z18.string().optional(),
2746
+ "committer-time": z18.string().optional(),
2747
+ "committer-tz": z18.string().optional(),
2748
+ summary: z18.string().optional(),
2749
+ filename: z18.string().optional()
2750
+ });
2751
+ LineToCommitMapZ = z18.record(z18.string(), z18.string());
2752
+ CommitMetadataMapZ = z18.record(z18.string(), CommitMetadataZ);
2753
+ BlameInfoZ = z18.object({
2754
+ lineToCommit: LineToCommitMapZ,
2755
+ commitMetadata: CommitMetadataMapZ
2756
+ });
2757
+ LineRangeZ = z18.object({
2758
+ /** First line in chunk (1-indexed) */
2759
+ start: z18.number(),
2760
+ /** Last line in chunk (inclusive) */
2761
+ end: z18.number()
2762
+ });
2763
+ PrContextZ = z18.object({
2764
+ prNumber: z18.number(),
2765
+ repositoryUrl: z18.string(),
2766
+ organizationId: z18.string(),
2767
+ userEmail: z18.string(),
2768
+ source: z18.enum(["pr", "github"]),
2769
+ githubContext: z18.object({
2770
+ prNumber: z18.number(),
2771
+ installationId: z18.number(),
2772
+ repositoryURL: z18.string()
2773
+ }).optional()
2774
+ });
2775
+ PrepareCommitBlameMessageZ = z18.object({
2776
+ /** Commit blame request ID from database (for tracking and updating status) */
2777
+ commitBlameRequestId: z18.string(),
2778
+ /** Organization ID (for org-scoped caching) */
2779
+ organizationId: z18.string(),
2780
+ /** Full repository URL (e.g., https://github.com/org/repo) */
2781
+ repositoryUrl: z18.string(),
2782
+ /** Commit SHA to analyze (typically PR head commit) */
2783
+ commitSha: z18.string(),
2784
+ /** Authentication headers for repository access (e.g., GitHub token) */
2785
+ extraHeaders: z18.record(z18.string(), z18.string()).default({}),
2786
+ // --- PR analysis fields ---
2787
+ /** Target branch name (from getPr() base.ref). When set, enables PR analysis mode. */
2788
+ targetBranch: z18.string().optional(),
2789
+ /** Context for triggering blame attribution analysis after SCM agent completes. */
2790
+ prContext: PrContextZ.optional(),
2791
+ /** User email for blame attribution analysis trigger context (used for both PR and single commit flows). */
2792
+ userEmail: z18.string().optional()
2793
+ });
2794
+ BlameLineInfoZ = z18.object({
2795
+ /** Line number as it appeared in the introducing commit */
2796
+ originalLineNumber: z18.number(),
2797
+ /** Commit SHA that introduced this line */
2798
+ commitSha: z18.string(),
2799
+ /** Author name for this line */
2800
+ authorName: z18.string().optional(),
2801
+ /** Author email for this line */
2802
+ authorEmail: z18.string().optional()
2803
+ }).nullable();
2804
+ FileBlameDataZ = z18.array(BlameLineInfoZ);
2805
+ ChunkFetchResultZ = z18.object({
2806
+ filePath: z18.string(),
2807
+ lines: z18.array(z18.number()),
2808
+ data: FileBlameDataZ.nullable()
2809
+ });
2810
+ FileBlameResponseEntryZ = z18.object({
2811
+ /** Chunk index (0 for small files, 0-N for large file chunks) */
2812
+ chunkIndex: z18.number(),
2813
+ /** Blame data array (1-indexed, index 0 is null) */
2814
+ blameData: FileBlameDataZ
2815
+ });
2816
+ CommitBlameDataZ = z18.record(
2817
+ z18.string(),
2818
+ // fileName
2819
+ z18.array(FileBlameResponseEntryZ)
2820
+ );
2821
+ CommitInfoZ = z18.object({
2822
+ /** Number of parent commits (1 = normal commit, 2+ = merge commit, null = failed to determine) */
2823
+ parentCount: z18.number().nullable()
2824
+ });
2825
+ GitIdentityZ = z18.object({
2826
+ name: z18.string(),
2827
+ email: z18.string()
2828
+ });
2829
+ COMMIT_LOG_FORMAT = "%H%x00%ae%x00%an%x00%ce%x00%cn%x00%at%x00%s%x00%(trailers:key=Co-authored-by,valueonly,separator=%x00)";
2830
+ CommitDataZ = z18.object({
2831
+ diff: z18.string(),
2832
+ author: GitIdentityZ,
2833
+ committer: GitIdentityZ,
2834
+ coAuthors: z18.array(GitIdentityZ),
2835
+ timestamp: z18.number(),
2836
+ // Unix timestamp in seconds
2837
+ message: z18.string().optional(),
2838
+ parentCount: z18.number().nullable()
2839
+ });
2840
+ PrDiffDataZ = z18.object({
2841
+ diff: z18.string()
2842
+ });
2843
+ PrStatsZ = z18.object({
2844
+ additions: z18.number(),
2845
+ deletions: z18.number()
2846
+ });
2847
+ CommitsManifestZ = z18.object({
2848
+ commits: z18.array(z18.string())
2849
+ // Array of commit SHAs in order
2850
+ });
2851
+ BlameLineEntryZ = z18.object({
2852
+ file: z18.string(),
2853
+ line: z18.number(),
2854
+ originalCommitSha: z18.string(),
2855
+ originalLineNumber: z18.number()
2856
+ });
2857
+ BlameLinesDataZ = z18.object({
2858
+ lines: z18.array(BlameLineEntryZ)
2859
+ });
2860
+ PrepareCommitBlameResponseMessageZ = z18.object({
2861
+ /** Commit blame request ID (matches request, used to update specific DB record) */
2862
+ commitBlameRequestId: z18.string(),
2863
+ /** Organization ID (matches request) */
2864
+ organizationId: z18.string(),
2865
+ /** Repository URL (matches request) */
2866
+ repositoryUrl: z18.string(),
2867
+ /** Commit SHA analyzed (matches request) */
2868
+ commitSha: z18.string(),
2869
+ /** Processing status */
2870
+ status: z18.enum(["success", "failure"]),
2871
+ /** Error message (only present if status is 'failure') */
2872
+ error: z18.string().optional(),
2873
+ /**
2874
+ * Blame data for all processed files/chunks.
2875
+ * Empty dictionary if status is 'failure'.
2876
+ * Contains line mappings as arrays if status is 'success'.
2877
+ */
2878
+ blameData: CommitBlameDataZ,
2879
+ /**
2880
+ * Info about each commit referenced in the blame data plus the head commit.
2881
+ * Keyed by commit SHA, deduplicated.
2882
+ * Empty dictionary if status is 'failure'.
2883
+ */
2884
+ commits: z18.record(z18.string(), CommitInfoZ).default({}),
2885
+ // --- New PR diff computation response fields ---
2886
+ /** S3 paths for commit-level data (commitSha → S3 key). Present in PR analysis mode and single commit mode. */
2887
+ commitDataS3Paths: z18.record(z18.string(), z18.string()).optional(),
2888
+ /** S3 key for PR diff JSON. Present in PR analysis mode. */
2889
+ prDiffS3Path: z18.string().optional(),
2890
+ /** S3 key for commits manifest. Present in PR analysis mode. */
2891
+ commitsManifestS3Path: z18.string().optional(),
2892
+ /** S3 key for per-line targeted blame data. Present in PR analysis mode. */
2893
+ blameLinesS3Path: z18.string().optional(),
2894
+ /** S3 key for PR stats (additions/deletions). Present in PR analysis mode. */
2895
+ prStatsS3Path: z18.string().optional(),
2896
+ /** PR context passed through from request for response handler. */
2897
+ prContext: PrContextZ.optional(),
2898
+ /** PR title from the request metadata (passed through). */
2899
+ prTitle: z18.string().optional(),
2900
+ /** User email passed through from request for single commit blame attribution analysis trigger. */
2901
+ userEmail: z18.string().optional()
2902
+ });
2903
+ }
2904
+ });
2905
+
2692
2906
  // src/features/analysis/scm/services/ExcludedDirs.ts
2693
2907
  var EXCLUDED_DIRS;
2694
2908
  var init_ExcludedDirs = __esm({
@@ -3361,6 +3575,7 @@ var init_GitService = __esm({
3361
3575
  "src/features/analysis/scm/services/GitService.ts"() {
3362
3576
  "use strict";
3363
3577
  init_configs();
3578
+ init_gitBlameTypes();
3364
3579
  init_urlParser2();
3365
3580
  init_FileUtils();
3366
3581
  MAX_COMMIT_DIFF_SIZE_BYTES = 3 * 1024 * 1024;
@@ -3857,7 +4072,7 @@ ${rootContent}`;
3857
4072
  const DIFF_DELIMITER = "---MOBB_DIFF_START---";
3858
4073
  const output = await this.git.show([
3859
4074
  commitSha,
3860
- `--format=%cI%n${DIFF_DELIMITER}`,
4075
+ `--format=${COMMIT_LOG_FORMAT}%n${DIFF_DELIMITER}`,
3861
4076
  "--patch"
3862
4077
  ]);
3863
4078
  const delimiterIndex = output.indexOf(DIFF_DELIMITER);
@@ -3878,16 +4093,16 @@ ${rootContent}`;
3878
4093
  });
3879
4094
  return null;
3880
4095
  }
3881
- const metadataLines = metadataOutput.trim().split("\n");
3882
- if (metadataLines.length < 1 || !metadataLines[0]) {
4096
+ const metadataLine = metadataOutput.trim();
4097
+ const parsed = parseCommitLine(metadataLine);
4098
+ if (!parsed) {
3883
4099
  this.log("[GitService] Unexpected metadata format", "warning", {
3884
4100
  commitSha,
3885
- metadataLines
4101
+ metadataLine
3886
4102
  });
3887
4103
  return null;
3888
4104
  }
3889
- const timestampStr = metadataLines[0];
3890
- const timestamp = new Date(timestampStr);
4105
+ const timestamp = new Date(parsed.timestamp * 1e3);
3891
4106
  this.log("[GitService] Local commit data retrieved", "debug", {
3892
4107
  commitSha,
3893
4108
  diffSizeBytes,
@@ -3895,7 +4110,10 @@ ${rootContent}`;
3895
4110
  });
3896
4111
  return {
3897
4112
  diff,
3898
- timestamp
4113
+ timestamp,
4114
+ author: parsed.author,
4115
+ committer: parsed.committer,
4116
+ coAuthors: parsed.coAuthors
3899
4117
  };
3900
4118
  } catch (error) {
3901
4119
  const errorMessage = `Failed to get local commit data: ${error.message}`;
@@ -3908,7 +4126,7 @@ ${rootContent}`;
3908
4126
  });
3909
4127
 
3910
4128
  // src/index.ts
3911
- import Debug19 from "debug";
4129
+ import Debug20 from "debug";
3912
4130
  import { hideBin } from "yargs/helpers";
3913
4131
 
3914
4132
  // src/args/yargs.ts
@@ -7381,34 +7599,34 @@ import querystring2 from "querystring";
7381
7599
  import * as bitbucketPkgNode from "bitbucket";
7382
7600
  import bitbucketPkg from "bitbucket";
7383
7601
  import Debug2 from "debug";
7384
- import { z as z19 } from "zod";
7602
+ import { z as z20 } from "zod";
7385
7603
 
7386
7604
  // src/features/analysis/scm/bitbucket/validation.ts
7387
- import { z as z18 } from "zod";
7388
- var BitbucketAuthResultZ = z18.object({
7389
- access_token: z18.string(),
7390
- token_type: z18.string(),
7391
- refresh_token: z18.string()
7605
+ import { z as z19 } from "zod";
7606
+ var BitbucketAuthResultZ = z19.object({
7607
+ access_token: z19.string(),
7608
+ token_type: z19.string(),
7609
+ refresh_token: z19.string()
7392
7610
  });
7393
7611
 
7394
7612
  // src/features/analysis/scm/bitbucket/bitbucket.ts
7395
7613
  var debug2 = Debug2("scm:bitbucket");
7396
7614
  var BITBUCKET_HOSTNAME = "bitbucket.org";
7397
- var TokenExpiredErrorZ = z19.object({
7398
- status: z19.number(),
7399
- error: z19.object({
7400
- type: z19.string(),
7401
- error: z19.object({
7402
- message: z19.string()
7615
+ var TokenExpiredErrorZ = z20.object({
7616
+ status: z20.number(),
7617
+ error: z20.object({
7618
+ type: z20.string(),
7619
+ error: z20.object({
7620
+ message: z20.string()
7403
7621
  })
7404
7622
  })
7405
7623
  });
7406
7624
  var BITBUCKET_ACCESS_TOKEN_URL = `https://${BITBUCKET_HOSTNAME}/site/oauth2/access_token`;
7407
7625
  var MAX_BITBUCKET_PR_BODY_LENGTH = 32768;
7408
- var BitbucketParseResultZ = z19.object({
7409
- organization: z19.string(),
7410
- repoName: z19.string(),
7411
- hostname: z19.literal(BITBUCKET_HOSTNAME)
7626
+ var BitbucketParseResultZ = z20.object({
7627
+ organization: z20.string(),
7628
+ repoName: z20.string(),
7629
+ hostname: z20.literal(BITBUCKET_HOSTNAME)
7412
7630
  });
7413
7631
  function parseBitbucketOrganizationAndRepo(bitbucketUrl) {
7414
7632
  const parsedGitHubUrl = normalizeUrl(bitbucketUrl);
@@ -7468,7 +7686,7 @@ function getBitbucketSdk(params) {
7468
7686
  if (!res.data.values) {
7469
7687
  return [];
7470
7688
  }
7471
- return res.data.values.filter((branch) => !!branch.name).map((branch) => z19.string().parse(branch.name));
7689
+ return res.data.values.filter((branch) => !!branch.name).map((branch) => z20.string().parse(branch.name));
7472
7690
  },
7473
7691
  async getIsUserCollaborator(params2) {
7474
7692
  const { repoUrl } = params2;
@@ -7583,7 +7801,7 @@ function getBitbucketSdk(params) {
7583
7801
  return GetReferenceResultZ.parse({
7584
7802
  sha: tagRes.data.target?.hash,
7585
7803
  type: "TAG" /* TAG */,
7586
- date: new Date(z19.string().parse(tagRes.data.target?.date))
7804
+ date: new Date(z20.string().parse(tagRes.data.target?.date))
7587
7805
  });
7588
7806
  },
7589
7807
  async getBranchRef(params2) {
@@ -7591,7 +7809,7 @@ function getBitbucketSdk(params) {
7591
7809
  return GetReferenceResultZ.parse({
7592
7810
  sha: getBranchRes.target?.hash,
7593
7811
  type: "BRANCH" /* BRANCH */,
7594
- date: new Date(z19.string().parse(getBranchRes.target?.date))
7812
+ date: new Date(z20.string().parse(getBranchRes.target?.date))
7595
7813
  });
7596
7814
  },
7597
7815
  async getCommitRef(params2) {
@@ -7599,13 +7817,13 @@ function getBitbucketSdk(params) {
7599
7817
  return GetReferenceResultZ.parse({
7600
7818
  sha: getCommitRes.hash,
7601
7819
  type: "COMMIT" /* COMMIT */,
7602
- date: new Date(z19.string().parse(getCommitRes.date))
7820
+ date: new Date(z20.string().parse(getCommitRes.date))
7603
7821
  });
7604
7822
  },
7605
7823
  async getDownloadUrl({ url, sha }) {
7606
7824
  this.getReferenceData({ ref: sha, url });
7607
7825
  const repoRes = await this.getRepo({ repoUrl: url });
7608
- const parsedRepoUrl = z19.string().url().parse(repoRes.links?.html?.href);
7826
+ const parsedRepoUrl = z20.string().url().parse(repoRes.links?.html?.href);
7609
7827
  return `${parsedRepoUrl}/get/${sha}.zip`;
7610
7828
  },
7611
7829
  async getPullRequest(params2) {
@@ -7670,7 +7888,7 @@ async function validateBitbucketParams(params) {
7670
7888
  }
7671
7889
  async function getUsersWorkspacesSlugs(bitbucketClient) {
7672
7890
  const res = await bitbucketClient.workspaces.getWorkspaces({});
7673
- return res.data.values?.map((v) => z19.string().parse(v.slug));
7891
+ return res.data.values?.map((v) => z20.string().parse(v.slug));
7674
7892
  }
7675
7893
  async function getAllUsersRepositories(bitbucketClient) {
7676
7894
  const userWorkspacesSlugs = await getUsersWorkspacesSlugs(bitbucketClient);
@@ -7698,10 +7916,10 @@ async function getRepositoriesByWorkspace(bitbucketClient, { workspaceSlug }) {
7698
7916
 
7699
7917
  // src/features/analysis/scm/bitbucket/BitbucketSCMLib.ts
7700
7918
  import { setTimeout as setTimeout3 } from "timers/promises";
7701
- import { z as z20 } from "zod";
7919
+ import { z as z21 } from "zod";
7702
7920
  function getUserAndPassword(token) {
7703
7921
  const [username, password] = token.split(":");
7704
- const safePasswordAndUsername = z20.object({ username: z20.string(), password: z20.string() }).parse({ username, password });
7922
+ const safePasswordAndUsername = z21.object({ username: z21.string(), password: z21.string() }).parse({ username, password });
7705
7923
  return {
7706
7924
  username: safePasswordAndUsername.username,
7707
7925
  password: safePasswordAndUsername.password
@@ -7773,7 +7991,7 @@ var BitbucketSCMLib = class extends SCMLib {
7773
7991
  return { username, password, authType };
7774
7992
  }
7775
7993
  case "token": {
7776
- return { authType, token: z20.string().parse(this.accessToken) };
7994
+ return { authType, token: z21.string().parse(this.accessToken) };
7777
7995
  }
7778
7996
  case "public":
7779
7997
  return { authType };
@@ -7787,7 +8005,7 @@ var BitbucketSCMLib = class extends SCMLib {
7787
8005
  ...params,
7788
8006
  repoUrl: this.url
7789
8007
  });
7790
- return String(z20.number().parse(pullRequestRes.id));
8008
+ return String(z21.number().parse(pullRequestRes.id));
7791
8009
  } catch (e) {
7792
8010
  console.warn(
7793
8011
  `error creating pull request for BB. Try number ${String(i + 1).replace(/\n|\r/g, "")}`,
@@ -7872,7 +8090,7 @@ var BitbucketSCMLib = class extends SCMLib {
7872
8090
  async getUsername() {
7873
8091
  this._validateAccessToken();
7874
8092
  const res = await this.bitbucketSdk.getUser();
7875
- return z20.string().parse(res["username"]);
8093
+ return z21.string().parse(res["username"]);
7876
8094
  }
7877
8095
  async getSubmitRequestStatus(_scmSubmitRequestId) {
7878
8096
  this._validateAccessTokenAndUrl();
@@ -7898,7 +8116,7 @@ var BitbucketSCMLib = class extends SCMLib {
7898
8116
  async getRepoDefaultBranch() {
7899
8117
  this._validateUrl();
7900
8118
  const repoRes = await this.bitbucketSdk.getRepo({ repoUrl: this.url });
7901
- return z20.string().parse(repoRes.mainbranch?.name);
8119
+ return z21.string().parse(repoRes.mainbranch?.name);
7902
8120
  }
7903
8121
  getSubmitRequestUrl(submitRequestId) {
7904
8122
  this._validateUrl();
@@ -7964,7 +8182,7 @@ var REPORT_DEFAULT_FILE_NAME = "report.json";
7964
8182
  init_env();
7965
8183
 
7966
8184
  // src/features/analysis/scm/github/GithubSCMLib.ts
7967
- import { z as z21 } from "zod";
8185
+ import { z as z22 } from "zod";
7968
8186
  init_client_generates();
7969
8187
 
7970
8188
  // src/features/analysis/scm/utils/cursorValidation.ts
@@ -8949,7 +9167,7 @@ var GithubSCMLib = class extends SCMLib {
8949
9167
  owner,
8950
9168
  repo
8951
9169
  });
8952
- return z21.string().parse(prRes.data);
9170
+ return z22.string().parse(prRes.data);
8953
9171
  }
8954
9172
  async getRepoList(_scmOrg) {
8955
9173
  this._validateAccessToken();
@@ -9402,11 +9620,11 @@ var contextLogger = {
9402
9620
  init_env();
9403
9621
 
9404
9622
  // src/features/analysis/scm/gitlab/types.ts
9405
- import { z as z22 } from "zod";
9406
- var GitlabAuthResultZ = z22.object({
9407
- access_token: z22.string(),
9408
- token_type: z22.string(),
9409
- refresh_token: z22.string()
9623
+ import { z as z23 } from "zod";
9624
+ var GitlabAuthResultZ = z23.object({
9625
+ access_token: z23.string(),
9626
+ token_type: z23.string(),
9627
+ refresh_token: z23.string()
9410
9628
  });
9411
9629
 
9412
9630
  // src/features/analysis/scm/gitlab/gitlab.ts
@@ -10442,7 +10660,7 @@ var GitlabSCMLib = class extends SCMLib {
10442
10660
  };
10443
10661
 
10444
10662
  // src/features/analysis/scm/scmFactory.ts
10445
- import { z as z23 } from "zod";
10663
+ import { z as z24 } from "zod";
10446
10664
 
10447
10665
  // src/features/analysis/scm/StubSCMLib.ts
10448
10666
  var StubSCMLib = class extends SCMLib {
@@ -10579,7 +10797,7 @@ async function createScmLib({ url, accessToken, scmType, scmOrg }, { propagateEx
10579
10797
  if (e instanceof InvalidRepoUrlError && url) {
10580
10798
  throw new RepoNoTokenAccessError(
10581
10799
  "no access to repo",
10582
- scmLibScmTypeToScmType[z23.nativeEnum(ScmLibScmType).parse(scmType)]
10800
+ scmLibScmTypeToScmType[z24.nativeEnum(ScmLibScmType).parse(scmType)]
10583
10801
  );
10584
10802
  }
10585
10803
  console.error(`error validating scm: ${scmType} `, e);
@@ -11169,7 +11387,7 @@ import path6 from "path";
11169
11387
  import chalk from "chalk";
11170
11388
  import Debug4 from "debug";
11171
11389
  import * as dotenv from "dotenv";
11172
- import { z as z24 } from "zod";
11390
+ import { z as z25 } from "zod";
11173
11391
  var debug5 = Debug4("mobbdev:constants");
11174
11392
  var runtimeConfigPath = path6.join(
11175
11393
  getModuleRootDir(),
@@ -11214,17 +11432,17 @@ var scannerToVulnerabilityReportVendorEnum = {
11214
11432
  [SCANNERS.Semgrep]: "semgrep" /* Semgrep */,
11215
11433
  [SCANNERS.Datadog]: "datadog" /* Datadog */
11216
11434
  };
11217
- var SupportedScannersZ = z24.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
11218
- var envVariablesSchema = z24.object({
11435
+ var SupportedScannersZ = z25.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
11436
+ var envVariablesSchema = z25.object({
11219
11437
  // These have safe defaults for production - the VS Code extension passes explicit URLs
11220
- WEB_APP_URL: z24.string().optional().default(DEFAULT_WEB_APP_URL),
11221
- API_URL: z24.string().optional().default(DEFAULT_API_URL),
11438
+ WEB_APP_URL: z25.string().optional().default(DEFAULT_WEB_APP_URL),
11439
+ API_URL: z25.string().optional().default(DEFAULT_API_URL),
11222
11440
  // These are only needed for local development with Hasura
11223
- HASURA_ACCESS_KEY: z24.string().optional().default(""),
11224
- LOCAL_GRAPHQL_ENDPOINT: z24.string().optional().default(""),
11441
+ HASURA_ACCESS_KEY: z25.string().optional().default(""),
11442
+ LOCAL_GRAPHQL_ENDPOINT: z25.string().optional().default(""),
11225
11443
  // Proxy settings
11226
- HTTP_PROXY: z24.string().optional().default(""),
11227
- HTTPS_PROXY: z24.string().optional().default("")
11444
+ HTTP_PROXY: z25.string().optional().default(""),
11445
+ HTTPS_PROXY: z25.string().optional().default("")
11228
11446
  });
11229
11447
  var envVariables = envVariablesSchema.parse(process.env);
11230
11448
  debug5("config %o", envVariables);
@@ -11469,17 +11687,17 @@ import path9 from "path";
11469
11687
  import { env as env2 } from "process";
11470
11688
  import { pipeline } from "stream/promises";
11471
11689
  import chalk6 from "chalk";
11472
- import Debug18 from "debug";
11690
+ import Debug19 from "debug";
11473
11691
  import extract from "extract-zip";
11474
11692
  import { createSpinner as createSpinner4 } from "nanospinner";
11475
11693
  import fetch4 from "node-fetch";
11476
11694
  import open3 from "open";
11477
11695
  import tmp2 from "tmp";
11478
- import { z as z29 } from "zod";
11696
+ import { z as z30 } from "zod";
11479
11697
 
11480
11698
  // src/commands/handleMobbLogin.ts
11481
11699
  import chalk3 from "chalk";
11482
- import Debug6 from "debug";
11700
+ import Debug7 from "debug";
11483
11701
 
11484
11702
  // src/commands/AuthManager.ts
11485
11703
  import crypto from "crypto";
@@ -11487,10 +11705,8 @@ import os from "os";
11487
11705
  import open from "open";
11488
11706
 
11489
11707
  // src/features/analysis/graphql/gql.ts
11490
- import fetchOrig from "cross-fetch";
11491
- import Debug5 from "debug";
11708
+ import Debug6 from "debug";
11492
11709
  import { GraphQLClient } from "graphql-request";
11493
- import { HttpsProxyAgent } from "https-proxy-agent";
11494
11710
  import { v4 as uuidv4 } from "uuid";
11495
11711
 
11496
11712
  // src/mcp/core/Errors.ts
@@ -11565,6 +11781,71 @@ var _ReportDigestError = class _ReportDigestError extends Error {
11565
11781
  __publicField(_ReportDigestError, "defaultMessage", "\u{1F575}\uFE0F\u200D\u2642\uFE0F Digesting report failed. Please verify that the file provided is of a valid supported report format.");
11566
11782
  var ReportDigestError = _ReportDigestError;
11567
11783
 
11784
+ // src/utils/proxy.ts
11785
+ import fetchOrig from "cross-fetch";
11786
+ import Debug5 from "debug";
11787
+ import { HttpsProxyAgent } from "https-proxy-agent";
11788
+
11789
+ // src/utils/url.ts
11790
+ function httpToWsUrl(url) {
11791
+ const parsed = new URL(url);
11792
+ parsed.protocol = parsed.protocol === "https:" ? "wss:" : "ws:";
11793
+ return parsed.toString();
11794
+ }
11795
+
11796
+ // src/utils/proxy.ts
11797
+ var debug6 = Debug5("mobbdev:proxy");
11798
+ function getHttpProxy() {
11799
+ return process.env["HTTPS_PROXY"] || process.env["HTTP_PROXY"] || "";
11800
+ }
11801
+ function getHttpProxyOnly() {
11802
+ return process.env["HTTP_PROXY"] || "";
11803
+ }
11804
+ function getProxyAgent(url) {
11805
+ try {
11806
+ const parsedUrl = new URL(url);
11807
+ const hostname = parsedUrl.hostname.toLowerCase();
11808
+ if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]") {
11809
+ debug6("Skipping proxy for localhost URL: %s", url);
11810
+ return void 0;
11811
+ }
11812
+ const noProxy = process.env["NO_PROXY"] || process.env["no_proxy"];
11813
+ if (noProxy) {
11814
+ const noProxyList = noProxy.split(",").map((h) => h.trim().toLowerCase());
11815
+ if (noProxyList.includes(hostname) || noProxyList.includes("*")) {
11816
+ debug6("Skipping proxy due to NO_PROXY for: %s", url);
11817
+ return void 0;
11818
+ }
11819
+ }
11820
+ const isHttp = parsedUrl.protocol === "http:";
11821
+ const isHttps = parsedUrl.protocol === "https:";
11822
+ const proxy = isHttps ? getHttpProxy() : isHttp ? getHttpProxyOnly() : null;
11823
+ if (proxy) {
11824
+ debug6("Using proxy %s", proxy);
11825
+ debug6("Proxy agent %o", proxy);
11826
+ return new HttpsProxyAgent(proxy);
11827
+ }
11828
+ } catch (err) {
11829
+ debug6(`Skipping proxy for ${url}. Reason: ${err.message}`);
11830
+ }
11831
+ return void 0;
11832
+ }
11833
+ var fetchWithProxy = (url, options = {}) => {
11834
+ try {
11835
+ const agent = getProxyAgent(url.toString());
11836
+ if (agent) {
11837
+ return fetchOrig(url, {
11838
+ ...options,
11839
+ // @ts-expect-error Node-fetch doesn't type 'agent', but it's valid
11840
+ agent
11841
+ });
11842
+ }
11843
+ } catch (err) {
11844
+ debug6(`Skipping proxy for ${url}. Reason: ${err.message}`);
11845
+ }
11846
+ return fetchOrig(url, options);
11847
+ };
11848
+
11568
11849
  // src/utils/subscribe/subscribe.ts
11569
11850
  import { createClient } from "graphql-ws";
11570
11851
  import WebsocketNode from "isomorphic-ws";
@@ -11593,11 +11874,11 @@ function getGraphQlHeaders(options) {
11593
11874
  }
11594
11875
 
11595
11876
  // src/utils/subscribe/subscribe.ts
11596
- var DEFAULT_API_URL2 = "https://api.mobb.ai/v1/graphql";
11877
+ var DEFAULT_API_URL2 = "wss://api.mobb.ai/v1/graphql";
11597
11878
  var SUBSCRIPTION_TIMEOUT_MS = 30 * 60 * 1e3;
11598
11879
  function createWSClient(options) {
11599
- const url = options.url || (process.env["API_URL"] || DEFAULT_API_URL2).replace("http", "ws");
11600
- const websocketImpl = options.websocket || (typeof WebSocket !== "undefined" ? WebSocket : WebsocketNode);
11880
+ const url = options.url || (process.env["API_URL"] ? httpToWsUrl(process.env["API_URL"]) : DEFAULT_API_URL2);
11881
+ const websocketImpl = options.websocket || WebsocketNode;
11601
11882
  const CustomWebSocket = options.proxyAgent ? (
11602
11883
  // biome-ignore lint/suspicious/noExplicitAny: Dynamic WebSocket extension requires any cast for cross-platform compatibility
11603
11884
  class extends websocketImpl {
@@ -11700,124 +11981,80 @@ init_client_generates();
11700
11981
 
11701
11982
  // src/features/analysis/graphql/types.ts
11702
11983
  init_client_generates();
11703
- import { z as z25 } from "zod";
11704
- var VulnerabilityReportIssueCodeNodeZ = z25.object({
11705
- vulnerabilityReportIssueId: z25.string(),
11706
- path: z25.string(),
11707
- startLine: z25.number(),
11708
- vulnerabilityReportIssue: z25.object({
11709
- fixId: z25.string(),
11710
- category: z25.nativeEnum(Vulnerability_Report_Issue_Category_Enum),
11711
- safeIssueType: z25.string(),
11712
- vulnerabilityReportIssueTags: z25.array(
11713
- z25.object({
11714
- tag: z25.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
11984
+ import { z as z26 } from "zod";
11985
+ var VulnerabilityReportIssueCodeNodeZ = z26.object({
11986
+ vulnerabilityReportIssueId: z26.string(),
11987
+ path: z26.string(),
11988
+ startLine: z26.number(),
11989
+ vulnerabilityReportIssue: z26.object({
11990
+ fixId: z26.string(),
11991
+ category: z26.nativeEnum(Vulnerability_Report_Issue_Category_Enum),
11992
+ safeIssueType: z26.string(),
11993
+ vulnerabilityReportIssueTags: z26.array(
11994
+ z26.object({
11995
+ tag: z26.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
11715
11996
  })
11716
11997
  )
11717
11998
  })
11718
11999
  });
11719
- var VulnerabilityReportIssueNoFixCodeNodeZ = z25.object({
11720
- vulnerabilityReportIssues: z25.array(
11721
- z25.object({
11722
- id: z25.string(),
11723
- fixId: z25.string().nullable(),
11724
- category: z25.nativeEnum(Vulnerability_Report_Issue_Category_Enum),
11725
- safeIssueType: z25.string(),
11726
- fpId: z25.string().uuid().nullable(),
11727
- codeNodes: z25.array(
11728
- z25.object({
11729
- path: z25.string(),
11730
- startLine: z25.number()
12000
+ var VulnerabilityReportIssueNoFixCodeNodeZ = z26.object({
12001
+ vulnerabilityReportIssues: z26.array(
12002
+ z26.object({
12003
+ id: z26.string(),
12004
+ fixId: z26.string().nullable(),
12005
+ category: z26.nativeEnum(Vulnerability_Report_Issue_Category_Enum),
12006
+ safeIssueType: z26.string(),
12007
+ fpId: z26.string().uuid().nullable(),
12008
+ codeNodes: z26.array(
12009
+ z26.object({
12010
+ path: z26.string(),
12011
+ startLine: z26.number()
11731
12012
  })
11732
12013
  ),
11733
- vulnerabilityReportIssueTags: z25.array(
11734
- z25.object({
11735
- tag: z25.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
12014
+ vulnerabilityReportIssueTags: z26.array(
12015
+ z26.object({
12016
+ tag: z26.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
11736
12017
  })
11737
12018
  )
11738
12019
  })
11739
12020
  )
11740
12021
  });
11741
- var GetVulByNodesMetadataZ = z25.object({
11742
- vulnerabilityReportIssueCodeNodes: z25.array(VulnerabilityReportIssueCodeNodeZ),
11743
- nonFixablePrVuls: z25.object({
11744
- aggregate: z25.object({
11745
- count: z25.number()
12022
+ var GetVulByNodesMetadataZ = z26.object({
12023
+ vulnerabilityReportIssueCodeNodes: z26.array(VulnerabilityReportIssueCodeNodeZ),
12024
+ nonFixablePrVuls: z26.object({
12025
+ aggregate: z26.object({
12026
+ count: z26.number()
11746
12027
  })
11747
12028
  }),
11748
- fixablePrVuls: z25.object({
11749
- aggregate: z25.object({
11750
- count: z25.number()
12029
+ fixablePrVuls: z26.object({
12030
+ aggregate: z26.object({
12031
+ count: z26.number()
11751
12032
  })
11752
12033
  }),
11753
- totalScanVulnerabilities: z25.object({
11754
- aggregate: z25.object({
11755
- count: z25.number()
12034
+ totalScanVulnerabilities: z26.object({
12035
+ aggregate: z26.object({
12036
+ count: z26.number()
11756
12037
  })
11757
12038
  }),
11758
- irrelevantVulnerabilityReportIssue: z25.array(
12039
+ irrelevantVulnerabilityReportIssue: z26.array(
11759
12040
  VulnerabilityReportIssueNoFixCodeNodeZ
11760
12041
  )
11761
12042
  });
11762
12043
 
11763
12044
  // src/features/analysis/graphql/gql.ts
11764
- var debug6 = Debug5("mobbdev:gql");
12045
+ var debug7 = Debug6("mobbdev:gql");
11765
12046
  var API_KEY_HEADER_NAME = "x-mobb-key";
11766
12047
  var REPORT_STATE_CHECK_DELAY = 5 * 1e3;
11767
- function getProxyAgent(url) {
11768
- try {
11769
- const parsedUrl = new URL(url);
11770
- const hostname = parsedUrl.hostname.toLowerCase();
11771
- if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]") {
11772
- debug6("Skipping proxy for localhost URL: %s", url);
11773
- return void 0;
11774
- }
11775
- const noProxy = process.env["NO_PROXY"] || process.env["no_proxy"];
11776
- if (noProxy) {
11777
- const noProxyList = noProxy.split(",").map((h) => h.trim().toLowerCase());
11778
- if (noProxyList.includes(hostname) || noProxyList.includes("*")) {
11779
- debug6("Skipping proxy due to NO_PROXY for: %s", url);
11780
- return void 0;
11781
- }
11782
- }
11783
- const isHttp = parsedUrl.protocol === "http:";
11784
- const isHttps = parsedUrl.protocol === "https:";
11785
- const proxy = isHttps ? HTTPS_PROXY || HTTP_PROXY : isHttp ? HTTP_PROXY : null;
11786
- if (proxy) {
11787
- debug6("Using proxy %s", proxy);
11788
- debug6("Proxy agent %o", proxy);
11789
- return new HttpsProxyAgent(proxy);
11790
- }
11791
- } catch (err) {
11792
- debug6(`Skipping proxy for ${url}. Reason: ${err.message}`);
11793
- }
11794
- return void 0;
11795
- }
11796
- var fetchWithProxy = (url, options = {}) => {
11797
- try {
11798
- const agent = getProxyAgent(url.toString());
11799
- if (agent) {
11800
- return fetchOrig(url, {
11801
- ...options,
11802
- // @ts-expect-error Node-fetch doesn't type 'agent', but it's valid
11803
- agent
11804
- });
11805
- }
11806
- } catch (err) {
11807
- debug6(`Skipping proxy for ${url}. Reason: ${err.message}`);
11808
- }
11809
- return fetchOrig(url, options);
11810
- };
11811
12048
  var GQLClient = class {
11812
12049
  constructor(args) {
11813
12050
  __publicField(this, "_client");
11814
12051
  __publicField(this, "_clientSdk");
11815
12052
  __publicField(this, "_apiUrl");
11816
12053
  __publicField(this, "_auth");
11817
- debug6(`init with ${args}`);
12054
+ debug7(`init with ${args}`);
11818
12055
  this._auth = args;
11819
12056
  this._apiUrl = args.apiUrl || API_URL;
11820
- debug6(
12057
+ debug7(
11821
12058
  "GQLClient constructor: resolved apiUrl=%s (from param: %s)",
11822
12059
  this._apiUrl,
11823
12060
  args.apiUrl || "fallback to API_URL constant"
@@ -11829,7 +12066,7 @@ var GQLClient = class {
11829
12066
  fetch: fetchWithProxy,
11830
12067
  requestMiddleware: (request) => {
11831
12068
  const requestId = uuidv4();
11832
- debug6(
12069
+ debug7(
11833
12070
  `sending API request with id: ${requestId} and with request: ${request.body}`
11834
12071
  );
11835
12072
  return {
@@ -11866,7 +12103,7 @@ var GQLClient = class {
11866
12103
  await this.getUserInfo();
11867
12104
  } catch (e) {
11868
12105
  if (e?.toString().startsWith("FetchError")) {
11869
- debug6("verify connection failed %o", e);
12106
+ debug7("verify connection failed %o", e);
11870
12107
  return false;
11871
12108
  }
11872
12109
  }
@@ -11878,7 +12115,7 @@ var GQLClient = class {
11878
12115
  try {
11879
12116
  info = await this.getUserInfo();
11880
12117
  } catch (e) {
11881
- debug6("verify token failed %o", e);
12118
+ debug7("verify token failed %o", e);
11882
12119
  return false;
11883
12120
  }
11884
12121
  return info?.email || true;
@@ -11939,7 +12176,7 @@ var GQLClient = class {
11939
12176
  try {
11940
12177
  await this._clientSdk.CreateCommunityUser();
11941
12178
  } catch (e) {
11942
- debug6("create community user failed %o", e);
12179
+ debug7("create community user failed %o", e);
11943
12180
  }
11944
12181
  }
11945
12182
  async updateScmToken(args) {
@@ -12119,11 +12356,13 @@ var GQLClient = class {
12119
12356
  this._auth.type === "apiKey" ? {
12120
12357
  apiKey: this._auth.apiKey,
12121
12358
  type: "apiKey",
12359
+ url: httpToWsUrl(this._apiUrl),
12122
12360
  timeoutInMs: params.timeoutInMs,
12123
12361
  proxyAgent: getProxyAgent(this._apiUrl)
12124
12362
  } : {
12125
12363
  token: this._auth.token,
12126
12364
  type: "token",
12365
+ url: httpToWsUrl(this._apiUrl),
12127
12366
  timeoutInMs: params.timeoutInMs,
12128
12367
  proxyAgent: getProxyAgent(this._apiUrl)
12129
12368
  }
@@ -12136,7 +12375,7 @@ var GQLClient = class {
12136
12375
  const startTime = Date.now();
12137
12376
  const maxDuration = timeoutInMs ?? 30 * 60 * 1e3;
12138
12377
  const pollingIntervalSec = REPORT_STATE_CHECK_DELAY / 1e3;
12139
- debug6(
12378
+ debug7(
12140
12379
  `[pollForAnalysisState] Starting polling for analysis ${analysisId}, target states: ${callbackStates.join(", ")}, interval: ${pollingIntervalSec}s`
12141
12380
  );
12142
12381
  let isPolling = true;
@@ -12145,7 +12384,7 @@ var GQLClient = class {
12145
12384
  pollCount++;
12146
12385
  const elapsedSec = Math.round((Date.now() - startTime) / 1e3);
12147
12386
  if (Date.now() - startTime > maxDuration) {
12148
- debug6(
12387
+ debug7(
12149
12388
  `[pollForAnalysisState] Timeout expired after ${pollCount} polls (${elapsedSec}s)`
12150
12389
  );
12151
12390
  throw new ReportDigestError(
@@ -12153,20 +12392,20 @@ var GQLClient = class {
12153
12392
  `Analysis timed out after ${Math.round(maxDuration / 6e4)} minutes. Please try again or check the Mobb platform for status.`
12154
12393
  );
12155
12394
  }
12156
- debug6(
12395
+ debug7(
12157
12396
  `[pollForAnalysisState] Poll #${pollCount} (elapsed: ${elapsedSec}s) - fetching analysis state...`
12158
12397
  );
12159
12398
  const analysis = await this.getAnalysis(analysisId);
12160
- debug6(
12399
+ debug7(
12161
12400
  `[pollForAnalysisState] Poll #${pollCount} - current state: ${analysis.state}`
12162
12401
  );
12163
12402
  if (!analysis.state || analysis.state === "Failed" /* Failed */) {
12164
12403
  const errorMessage = analysis.failReason || `Analysis failed with id: ${analysis.id}`;
12165
- debug6(`[pollForAnalysisState] Analysis failed: ${errorMessage}`);
12404
+ debug7(`[pollForAnalysisState] Analysis failed: ${errorMessage}`);
12166
12405
  throw new ReportDigestError(errorMessage, analysis.failReason ?? "");
12167
12406
  }
12168
12407
  if (callbackStates.includes(analysis.state)) {
12169
- debug6(
12408
+ debug7(
12170
12409
  `[pollForAnalysisState] Target state reached: ${analysis.state} after ${pollCount} polls (${elapsedSec}s)`
12171
12410
  );
12172
12411
  await callback(analysis.id);
@@ -12179,7 +12418,7 @@ var GQLClient = class {
12179
12418
  }
12180
12419
  };
12181
12420
  }
12182
- debug6(
12421
+ debug7(
12183
12422
  `[pollForAnalysisState] State ${analysis.state} not in target states, waiting ${pollingIntervalSec}s before next poll...`
12184
12423
  );
12185
12424
  await sleep(REPORT_STATE_CHECK_DELAY);
@@ -12468,7 +12707,7 @@ var AuthManager = class {
12468
12707
  };
12469
12708
 
12470
12709
  // src/commands/handleMobbLogin.ts
12471
- var debug7 = Debug6("mobbdev:commands");
12710
+ var debug8 = Debug7("mobbdev:commands");
12472
12711
  var LOGIN_MAX_WAIT2 = 10 * 60 * 1e3;
12473
12712
  var LOGIN_CHECK_DELAY2 = 5 * 1e3;
12474
12713
  var MOBB_LOGIN_REQUIRED_MSG = `\u{1F513} Login to Mobb is Required, you will be redirected to our login page, once the authorization is complete return to this prompt, ${chalk3.bgBlue(
@@ -12480,7 +12719,7 @@ async function getAuthenticatedGQLClient({
12480
12719
  apiUrl,
12481
12720
  webAppUrl
12482
12721
  }) {
12483
- debug7(
12722
+ debug8(
12484
12723
  "getAuthenticatedGQLClient called with: apiUrl=%s, webAppUrl=%s",
12485
12724
  apiUrl || "undefined",
12486
12725
  webAppUrl || "undefined"
@@ -12503,7 +12742,7 @@ async function handleMobbLogin({
12503
12742
  webAppUrl,
12504
12743
  loginContext
12505
12744
  }) {
12506
- debug7(
12745
+ debug8(
12507
12746
  "handleMobbLogin: resolved URLs - apiUrl=%s (from param: %s), webAppUrl=%s (from param: %s)",
12508
12747
  apiUrl || "fallback",
12509
12748
  apiUrl || "fallback",
@@ -12522,7 +12761,7 @@ async function handleMobbLogin({
12522
12761
  return authManager.getGQLClient();
12523
12762
  }
12524
12763
  } catch (error) {
12525
- debug7("Authentication check failed:", error);
12764
+ debug8("Authentication check failed:", error);
12526
12765
  }
12527
12766
  if (apiKey) {
12528
12767
  createSpinner5().start().error({
@@ -12569,12 +12808,12 @@ async function handleMobbLogin({
12569
12808
  }
12570
12809
 
12571
12810
  // src/features/analysis/add_fix_comments_for_pr/add_fix_comments_for_pr.ts
12572
- import Debug10 from "debug";
12811
+ import Debug11 from "debug";
12573
12812
 
12574
12813
  // src/features/analysis/add_fix_comments_for_pr/utils/utils.ts
12575
- import Debug9 from "debug";
12814
+ import Debug10 from "debug";
12576
12815
  import parseDiff from "parse-diff";
12577
- import { z as z27 } from "zod";
12816
+ import { z as z28 } from "zod";
12578
12817
 
12579
12818
  // src/features/analysis/utils/by_key.ts
12580
12819
  function keyBy(array, keyBy2) {
@@ -12584,9 +12823,9 @@ function keyBy(array, keyBy2) {
12584
12823
  }
12585
12824
 
12586
12825
  // src/features/analysis/utils/send_report.ts
12587
- import Debug7 from "debug";
12826
+ import Debug8 from "debug";
12588
12827
  init_client_generates();
12589
- var debug8 = Debug7("mobbdev:index");
12828
+ var debug9 = Debug8("mobbdev:index");
12590
12829
  async function sendReport({
12591
12830
  spinner,
12592
12831
  submitVulnerabilityReportVariables,
@@ -12598,7 +12837,7 @@ async function sendReport({
12598
12837
  submitVulnerabilityReportVariables
12599
12838
  );
12600
12839
  if (submitRes.submitVulnerabilityReport.__typename !== "VulnerabilityReport") {
12601
- debug8("error submit vul report %s", submitRes);
12840
+ debug9("error submit vul report %s", submitRes);
12602
12841
  throw new Error("\u{1F575}\uFE0F\u200D\u2642\uFE0F Mobb analysis failed");
12603
12842
  }
12604
12843
  spinner.update({ text: progressMassages.processingVulnerabilityReport });
@@ -12610,7 +12849,7 @@ async function sendReport({
12610
12849
  "Finished" /* Finished */
12611
12850
  ];
12612
12851
  if (polling) {
12613
- debug8("[sendReport] Using POLLING mode for analysis state updates");
12852
+ debug9("[sendReport] Using POLLING mode for analysis state updates");
12614
12853
  await gqlClient.pollForAnalysisState({
12615
12854
  analysisId: submitRes.submitVulnerabilityReport.fixReportId,
12616
12855
  callback,
@@ -12618,7 +12857,7 @@ async function sendReport({
12618
12857
  timeoutInMs: VUL_REPORT_DIGEST_TIMEOUT_MS
12619
12858
  });
12620
12859
  } else {
12621
- debug8("[sendReport] Using WEBSOCKET mode for analysis state updates");
12860
+ debug9("[sendReport] Using WEBSOCKET mode for analysis state updates");
12622
12861
  await gqlClient.subscribeToAnalysis({
12623
12862
  subscribeToAnalysisParams: {
12624
12863
  analysisId: submitRes.submitVulnerabilityReport.fixReportId
@@ -12661,10 +12900,10 @@ var scannerToFriendlyString = {
12661
12900
  };
12662
12901
 
12663
12902
  // src/features/analysis/add_fix_comments_for_pr/utils/buildCommentBody.ts
12664
- import Debug8 from "debug";
12665
- import { z as z26 } from "zod";
12903
+ import Debug9 from "debug";
12904
+ import { z as z27 } from "zod";
12666
12905
  init_client_generates();
12667
- var debug9 = Debug8("mobbdev:handle-finished-analysis");
12906
+ var debug10 = Debug9("mobbdev:handle-finished-analysis");
12668
12907
  var getCommitFixButton = (commitUrl) => `<a href="${commitUrl}"><img src=${COMMIT_FIX_SVG}></a>`;
12669
12908
  function buildFixCommentBody({
12670
12909
  fix,
@@ -12716,14 +12955,14 @@ function buildFixCommentBody({
12716
12955
  });
12717
12956
  const issueType = getIssueTypeFriendlyString(fix.safeIssueType);
12718
12957
  const title = `# ${MobbIconMarkdown} ${issueType} fix is ready`;
12719
- const validFixParseRes = z26.object({
12958
+ const validFixParseRes = z27.object({
12720
12959
  patchAndQuestions: PatchAndQuestionsZ,
12721
- safeIssueLanguage: z26.nativeEnum(IssueLanguage_Enum),
12722
- severityText: z26.nativeEnum(Vulnerability_Severity_Enum),
12723
- safeIssueType: z26.nativeEnum(IssueType_Enum)
12960
+ safeIssueLanguage: z27.nativeEnum(IssueLanguage_Enum),
12961
+ severityText: z27.nativeEnum(Vulnerability_Severity_Enum),
12962
+ safeIssueType: z27.nativeEnum(IssueType_Enum)
12724
12963
  }).safeParse(fix);
12725
12964
  if (!validFixParseRes.success) {
12726
- debug9(
12965
+ debug10(
12727
12966
  `fix ${fixId} has custom issue type or language, therefore the commit description will not be added`,
12728
12967
  validFixParseRes.error
12729
12968
  );
@@ -12787,7 +13026,7 @@ ${issuePageLink}`;
12787
13026
  }
12788
13027
 
12789
13028
  // src/features/analysis/add_fix_comments_for_pr/utils/utils.ts
12790
- var debug10 = Debug9("mobbdev:handle-finished-analysis");
13029
+ var debug11 = Debug10("mobbdev:handle-finished-analysis");
12791
13030
  function calculateRanges(integers) {
12792
13031
  if (integers.length === 0) {
12793
13032
  return [];
@@ -12821,7 +13060,7 @@ function deleteAllPreviousComments({
12821
13060
  try {
12822
13061
  return scm.deleteComment({ comment_id: comment.id });
12823
13062
  } catch (e) {
12824
- debug10("delete comment failed %s", e);
13063
+ debug11("delete comment failed %s", e);
12825
13064
  return Promise.resolve();
12826
13065
  }
12827
13066
  });
@@ -12837,7 +13076,7 @@ function deleteAllPreviousGeneralPrComments(params) {
12837
13076
  try {
12838
13077
  return scm.deleteGeneralPrComment({ commentId: comment.id });
12839
13078
  } catch (e) {
12840
- debug10("delete comment failed %s", e);
13079
+ debug11("delete comment failed %s", e);
12841
13080
  return Promise.resolve();
12842
13081
  }
12843
13082
  });
@@ -12954,7 +13193,7 @@ async function getRelevantVulenrabilitiesFromDiff(params) {
12954
13193
  });
12955
13194
  const lineAddedRanges = calculateRanges(fileNumbers);
12956
13195
  const fileFilter = {
12957
- path: z27.string().parse(file.to),
13196
+ path: z28.string().parse(file.to),
12958
13197
  ranges: lineAddedRanges.map(([startLine, endLine]) => ({
12959
13198
  endLine,
12960
13199
  startLine
@@ -12981,7 +13220,7 @@ async function postAnalysisInsightComment(params) {
12981
13220
  fixablePrVuls,
12982
13221
  nonFixablePrVuls
12983
13222
  } = prVulenrabilities;
12984
- debug10({
13223
+ debug11({
12985
13224
  fixablePrVuls,
12986
13225
  nonFixablePrVuls,
12987
13226
  vulnerabilitiesOutsidePr,
@@ -13036,7 +13275,7 @@ ${contactUsMarkdown}`;
13036
13275
  }
13037
13276
 
13038
13277
  // src/features/analysis/add_fix_comments_for_pr/add_fix_comments_for_pr.ts
13039
- var debug11 = Debug10("mobbdev:handle-finished-analysis");
13278
+ var debug12 = Debug11("mobbdev:handle-finished-analysis");
13040
13279
  async function addFixCommentsForPr({
13041
13280
  analysisId,
13042
13281
  scm: _scm,
@@ -13048,7 +13287,7 @@ async function addFixCommentsForPr({
13048
13287
  }
13049
13288
  const scm = _scm;
13050
13289
  const getAnalysisRes = await gqlClient.getAnalysis(analysisId);
13051
- debug11("getAnalysis %o", getAnalysisRes);
13290
+ debug12("getAnalysis %o", getAnalysisRes);
13052
13291
  const {
13053
13292
  vulnerabilityReport: {
13054
13293
  projectId,
@@ -13158,8 +13397,8 @@ ${contextString}` : description;
13158
13397
 
13159
13398
  // src/features/analysis/auto_pr_handler.ts
13160
13399
  init_client_generates();
13161
- import Debug11 from "debug";
13162
- var debug12 = Debug11("mobbdev:handleAutoPr");
13400
+ import Debug12 from "debug";
13401
+ var debug13 = Debug12("mobbdev:handleAutoPr");
13163
13402
  async function handleAutoPr(params) {
13164
13403
  const {
13165
13404
  gqlClient,
@@ -13180,7 +13419,7 @@ async function handleAutoPr(params) {
13180
13419
  prId,
13181
13420
  prStrategy: createOnePr ? "CONDENSE" /* Condense */ : "SPREAD" /* Spread */
13182
13421
  });
13183
- debug12("auto pr analysis res %o", autoPrAnalysisRes);
13422
+ debug13("auto pr analysis res %o", autoPrAnalysisRes);
13184
13423
  if (autoPrAnalysisRes.autoPrAnalysis?.__typename === "AutoPrError") {
13185
13424
  createAutoPrSpinner.error({
13186
13425
  text: `\u{1F504} Automatic pull request failed - ${autoPrAnalysisRes.autoPrAnalysis.error}`
@@ -13202,14 +13441,14 @@ async function handleAutoPr(params) {
13202
13441
  };
13203
13442
  const callbackStates = ["Finished" /* Finished */];
13204
13443
  if (polling) {
13205
- debug12("[handleAutoPr] Using POLLING mode for analysis state updates");
13444
+ debug13("[handleAutoPr] Using POLLING mode for analysis state updates");
13206
13445
  return await gqlClient.pollForAnalysisState({
13207
13446
  analysisId,
13208
13447
  callback,
13209
13448
  callbackStates
13210
13449
  });
13211
13450
  } else {
13212
- debug12("[handleAutoPr] Using WEBSOCKET mode for analysis state updates");
13451
+ debug13("[handleAutoPr] Using WEBSOCKET mode for analysis state updates");
13213
13452
  return await gqlClient.subscribeToAnalysis({
13214
13453
  subscribeToAnalysisParams: {
13215
13454
  analysisId
@@ -13222,15 +13461,15 @@ async function handleAutoPr(params) {
13222
13461
 
13223
13462
  // src/features/analysis/git.ts
13224
13463
  init_GitService();
13225
- import Debug12 from "debug";
13226
- var debug13 = Debug12("mobbdev:git");
13464
+ import Debug13 from "debug";
13465
+ var debug14 = Debug13("mobbdev:git");
13227
13466
  async function getGitInfo(srcDirPath) {
13228
- debug13("getting git info for %s", srcDirPath);
13467
+ debug14("getting git info for %s", srcDirPath);
13229
13468
  const gitService = new GitService(srcDirPath);
13230
13469
  try {
13231
13470
  const validationResult = await gitService.validateRepository();
13232
13471
  if (!validationResult.isValid) {
13233
- debug13("folder is not a git repo");
13472
+ debug14("folder is not a git repo");
13234
13473
  return {
13235
13474
  success: false,
13236
13475
  hash: void 0,
@@ -13245,9 +13484,9 @@ async function getGitInfo(srcDirPath) {
13245
13484
  };
13246
13485
  } catch (e) {
13247
13486
  if (e instanceof Error) {
13248
- debug13("failed to run git %o", e);
13487
+ debug14("failed to run git %o", e);
13249
13488
  if (e.message.includes(" spawn ")) {
13250
- debug13("git cli not installed");
13489
+ debug14("git cli not installed");
13251
13490
  } else {
13252
13491
  throw e;
13253
13492
  }
@@ -13261,20 +13500,20 @@ init_configs();
13261
13500
  import fs9 from "fs";
13262
13501
  import path7 from "path";
13263
13502
  import AdmZip from "adm-zip";
13264
- import Debug13 from "debug";
13503
+ import Debug14 from "debug";
13265
13504
  import { globby } from "globby";
13266
13505
  import { isBinary as isBinary2 } from "istextorbinary";
13267
13506
  import { simpleGit as simpleGit3 } from "simple-git";
13268
13507
  import { parseStringPromise } from "xml2js";
13269
- import { z as z28 } from "zod";
13270
- var debug14 = Debug13("mobbdev:pack");
13271
- var FPR_SOURCE_CODE_FILE_MAPPING_SCHEMA = z28.object({
13272
- properties: z28.object({
13273
- entry: z28.array(
13274
- z28.object({
13275
- _: z28.string(),
13276
- $: z28.object({
13277
- key: z28.string()
13508
+ import { z as z29 } from "zod";
13509
+ var debug15 = Debug14("mobbdev:pack");
13510
+ var FPR_SOURCE_CODE_FILE_MAPPING_SCHEMA = z29.object({
13511
+ properties: z29.object({
13512
+ entry: z29.array(
13513
+ z29.object({
13514
+ _: z29.string(),
13515
+ $: z29.object({
13516
+ key: z29.string()
13278
13517
  })
13279
13518
  })
13280
13519
  )
@@ -13289,7 +13528,7 @@ function getManifestFilesSuffixes() {
13289
13528
  return ["package.json", "pom.xml"];
13290
13529
  }
13291
13530
  async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
13292
- debug14("pack folder %s", srcDirPath);
13531
+ debug15("pack folder %s", srcDirPath);
13293
13532
  let git = void 0;
13294
13533
  try {
13295
13534
  git = simpleGit3({
@@ -13299,13 +13538,13 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
13299
13538
  });
13300
13539
  await git.status();
13301
13540
  } catch (e) {
13302
- debug14("failed to run git %o", e);
13541
+ debug15("failed to run git %o", e);
13303
13542
  git = void 0;
13304
13543
  if (e instanceof Error) {
13305
13544
  if (e.message.includes(" spawn ")) {
13306
- debug14("git cli not installed");
13545
+ debug15("git cli not installed");
13307
13546
  } else if (e.message.includes("not a git repository")) {
13308
- debug14("folder is not a git repo");
13547
+ debug15("folder is not a git repo");
13309
13548
  } else {
13310
13549
  throw e;
13311
13550
  }
@@ -13320,9 +13559,9 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
13320
13559
  followSymbolicLinks: false,
13321
13560
  dot: true
13322
13561
  });
13323
- debug14("files found %d", filepaths.length);
13562
+ debug15("files found %d", filepaths.length);
13324
13563
  const zip = new AdmZip();
13325
- debug14("compressing files");
13564
+ debug15("compressing files");
13326
13565
  for (const filepath of filepaths) {
13327
13566
  const absFilepath = path7.join(srcDirPath, filepath.toString());
13328
13567
  if (!isIncludeAllFiles) {
@@ -13331,12 +13570,12 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
13331
13570
  absFilepath.toString().replaceAll(path7.win32.sep, path7.posix.sep),
13332
13571
  vulnFiles
13333
13572
  )) {
13334
- debug14("ignoring %s because it is not a vulnerability file", filepath);
13573
+ debug15("ignoring %s because it is not a vulnerability file", filepath);
13335
13574
  continue;
13336
13575
  }
13337
13576
  }
13338
13577
  if (fs9.lstatSync(absFilepath).size > MCP_MAX_FILE_SIZE) {
13339
- debug14("ignoring %s because the size is > 5MB", filepath);
13578
+ debug15("ignoring %s because the size is > 5MB", filepath);
13340
13579
  continue;
13341
13580
  }
13342
13581
  let data;
@@ -13350,16 +13589,16 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
13350
13589
  data = fs9.readFileSync(absFilepath);
13351
13590
  }
13352
13591
  if (isBinary2(null, data)) {
13353
- debug14("ignoring %s because is seems to be a binary file", filepath);
13592
+ debug15("ignoring %s because is seems to be a binary file", filepath);
13354
13593
  continue;
13355
13594
  }
13356
13595
  zip.addFile(filepath.toString(), data);
13357
13596
  }
13358
- debug14("get zip file buffer");
13597
+ debug15("get zip file buffer");
13359
13598
  return zip.toBuffer();
13360
13599
  }
13361
13600
  async function repackFpr(fprPath) {
13362
- debug14("repack fpr file %s", fprPath);
13601
+ debug15("repack fpr file %s", fprPath);
13363
13602
  const zipIn = new AdmZip(fprPath);
13364
13603
  const zipOut = new AdmZip();
13365
13604
  const mappingXML = zipIn.readAsText("src-archive/index.xml", "utf-8");
@@ -13374,7 +13613,7 @@ async function repackFpr(fprPath) {
13374
13613
  zipOut.addFile(realPath, buf);
13375
13614
  }
13376
13615
  }
13377
- debug14("get repacked zip file buffer");
13616
+ debug15("get repacked zip file buffer");
13378
13617
  return zipOut.toBuffer();
13379
13618
  }
13380
13619
 
@@ -13445,7 +13684,7 @@ async function snykArticlePrompt() {
13445
13684
  // src/features/analysis/scanners/checkmarx.ts
13446
13685
  import { createRequire } from "module";
13447
13686
  import chalk4 from "chalk";
13448
- import Debug15 from "debug";
13687
+ import Debug16 from "debug";
13449
13688
  import { existsSync } from "fs";
13450
13689
  import { createSpinner as createSpinner2 } from "nanospinner";
13451
13690
  import { type } from "os";
@@ -13457,7 +13696,7 @@ var cxOperatingSystemSupportMessage = `Your operating system does not support ch
13457
13696
 
13458
13697
  // src/utils/child_process.ts
13459
13698
  import cp from "child_process";
13460
- import Debug14 from "debug";
13699
+ import Debug15 from "debug";
13461
13700
  import * as process2 from "process";
13462
13701
  function createFork({ args, processPath, name }, options) {
13463
13702
  const child = cp.fork(processPath, args, {
@@ -13475,16 +13714,16 @@ function createSpawn({ args, processPath, name, cwd }, options) {
13475
13714
  return createChildProcess({ childProcess: child, name }, options);
13476
13715
  }
13477
13716
  function createChildProcess({ childProcess, name }, options) {
13478
- const debug20 = Debug14(`mobbdev:${name}`);
13717
+ const debug21 = Debug15(`mobbdev:${name}`);
13479
13718
  const { display } = options;
13480
13719
  return new Promise((resolve, reject) => {
13481
13720
  let out = "";
13482
13721
  const onData = (chunk) => {
13483
- debug20(`chunk received from ${name} std ${chunk}`);
13722
+ debug21(`chunk received from ${name} std ${chunk}`);
13484
13723
  out += chunk;
13485
13724
  };
13486
13725
  if (!childProcess?.stdout || !childProcess?.stderr) {
13487
- debug20(`unable to fork ${name}`);
13726
+ debug21(`unable to fork ${name}`);
13488
13727
  reject(new Error(`unable to fork ${name}`));
13489
13728
  }
13490
13729
  childProcess.stdout?.on("data", onData);
@@ -13494,18 +13733,18 @@ function createChildProcess({ childProcess, name }, options) {
13494
13733
  childProcess.stderr?.pipe(process2.stderr);
13495
13734
  }
13496
13735
  childProcess.on("exit", (code) => {
13497
- debug20(`${name} exit code ${code}`);
13736
+ debug21(`${name} exit code ${code}`);
13498
13737
  resolve({ message: out, code });
13499
13738
  });
13500
13739
  childProcess.on("error", (err) => {
13501
- debug20(`${name} error %o`, err);
13740
+ debug21(`${name} error %o`, err);
13502
13741
  reject(err);
13503
13742
  });
13504
13743
  });
13505
13744
  }
13506
13745
 
13507
13746
  // src/features/analysis/scanners/checkmarx.ts
13508
- var debug15 = Debug15("mobbdev:checkmarx");
13747
+ var debug16 = Debug16("mobbdev:checkmarx");
13509
13748
  var moduleUrl;
13510
13749
  if (typeof __filename !== "undefined") {
13511
13750
  moduleUrl = __filename;
@@ -13564,14 +13803,14 @@ function validateCheckmarxInstallation() {
13564
13803
  existsSync(getCheckmarxPath());
13565
13804
  }
13566
13805
  async function forkCheckmarx(args, { display }) {
13567
- debug15("fork checkmarx with args %o %s", args.join(" "), display);
13806
+ debug16("fork checkmarx with args %o %s", args.join(" "), display);
13568
13807
  return createSpawn(
13569
13808
  { args, processPath: getCheckmarxPath(), name: "checkmarx" },
13570
13809
  { display }
13571
13810
  );
13572
13811
  }
13573
13812
  async function getCheckmarxReport({ reportPath, repositoryRoot, branch, projectName }, { skipPrompts = false }) {
13574
- debug15("get checkmarx report start %s %s", reportPath, repositoryRoot);
13813
+ debug16("get checkmarx report start %s %s", reportPath, repositoryRoot);
13575
13814
  const { code: loginCode } = await forkCheckmarx(VALIDATE_COMMAND, {
13576
13815
  display: false
13577
13816
  });
@@ -13639,10 +13878,10 @@ async function validateCheckamxCredentials() {
13639
13878
  // src/features/analysis/scanners/snyk.ts
13640
13879
  import { createRequire as createRequire2 } from "module";
13641
13880
  import chalk5 from "chalk";
13642
- import Debug16 from "debug";
13881
+ import Debug17 from "debug";
13643
13882
  import { createSpinner as createSpinner3 } from "nanospinner";
13644
13883
  import open2 from "open";
13645
- var debug16 = Debug16("mobbdev:snyk");
13884
+ var debug17 = Debug17("mobbdev:snyk");
13646
13885
  var moduleUrl2;
13647
13886
  if (typeof __filename !== "undefined") {
13648
13887
  moduleUrl2 = __filename;
@@ -13664,13 +13903,13 @@ if (typeof __filename !== "undefined") {
13664
13903
  var costumeRequire2 = createRequire2(moduleUrl2);
13665
13904
  var SNYK_PATH = costumeRequire2.resolve("snyk/bin/snyk");
13666
13905
  var SNYK_ARTICLE_URL = "https://docs.snyk.io/scan-using-snyk/snyk-code/configure-snyk-code#enable-snyk-code";
13667
- debug16("snyk executable path %s", SNYK_PATH);
13906
+ debug17("snyk executable path %s", SNYK_PATH);
13668
13907
  async function forkSnyk(args, { display }) {
13669
- debug16("fork snyk with args %o %s", args, display);
13908
+ debug17("fork snyk with args %o %s", args, display);
13670
13909
  return createFork({ args, processPath: SNYK_PATH, name: "snyk" }, { display });
13671
13910
  }
13672
13911
  async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
13673
- debug16("get snyk report start %s %s", reportPath, repoRoot);
13912
+ debug17("get snyk report start %s %s", reportPath, repoRoot);
13674
13913
  const config2 = await forkSnyk(["config"], { display: false });
13675
13914
  const { message: configMessage } = config2;
13676
13915
  if (!configMessage.includes("api: ")) {
@@ -13684,7 +13923,7 @@ async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
13684
13923
  snykLoginSpinner.update({
13685
13924
  text: "\u{1F513} Waiting for Snyk login to complete"
13686
13925
  });
13687
- debug16("no token in the config %s", config2);
13926
+ debug17("no token in the config %s", config2);
13688
13927
  await forkSnyk(["auth"], { display: true });
13689
13928
  snykLoginSpinner.success({ text: "\u{1F513} Login to Snyk Successful" });
13690
13929
  }
@@ -13694,12 +13933,12 @@ async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
13694
13933
  { display: true }
13695
13934
  );
13696
13935
  if (scanOutput.includes("Snyk Code is not supported for org")) {
13697
- debug16("snyk code is not enabled %s", scanOutput);
13936
+ debug17("snyk code is not enabled %s", scanOutput);
13698
13937
  snykSpinner.error({ text: "\u{1F50D} Snyk configuration needed" });
13699
13938
  const answer = await snykArticlePrompt();
13700
- debug16("answer %s", answer);
13939
+ debug17("answer %s", answer);
13701
13940
  if (answer) {
13702
- debug16("opening the browser");
13941
+ debug17("opening the browser");
13703
13942
  await open2(SNYK_ARTICLE_URL);
13704
13943
  }
13705
13944
  console.log(
@@ -13717,9 +13956,9 @@ async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
13717
13956
  init_client_generates();
13718
13957
 
13719
13958
  // src/features/analysis/upload-file.ts
13720
- import Debug17 from "debug";
13959
+ import Debug18 from "debug";
13721
13960
  import fetch3, { File, fileFrom, FormData } from "node-fetch";
13722
- var debug17 = Debug17("mobbdev:upload-file");
13961
+ var debug18 = Debug18("mobbdev:upload-file");
13723
13962
  async function uploadFile({
13724
13963
  file,
13725
13964
  url,
@@ -13732,9 +13971,9 @@ async function uploadFile({
13732
13971
  logInfo2(`FileUpload: upload file start ${url}`);
13733
13972
  logInfo2(`FileUpload: upload fields`, uploadFields);
13734
13973
  logInfo2(`FileUpload: upload key ${uploadKey}`);
13735
- debug17("upload file start %s", url);
13736
- debug17("upload fields %o", uploadFields);
13737
- debug17("upload key %s", uploadKey);
13974
+ debug18("upload file start %s", url);
13975
+ debug18("upload fields %o", uploadFields);
13976
+ debug18("upload key %s", uploadKey);
13738
13977
  const form = new FormData();
13739
13978
  Object.entries(uploadFields).forEach(([key, value]) => {
13740
13979
  form.append(key, value);
@@ -13743,11 +13982,11 @@ async function uploadFile({
13743
13982
  form.append("key", uploadKey);
13744
13983
  }
13745
13984
  if (typeof file === "string") {
13746
- debug17("upload file from path %s", file);
13985
+ debug18("upload file from path %s", file);
13747
13986
  logInfo2(`FileUpload: upload file from path ${file}`);
13748
13987
  form.append("file", await fileFrom(file));
13749
13988
  } else {
13750
- debug17("upload file from buffer");
13989
+ debug18("upload file from buffer");
13751
13990
  logInfo2(`FileUpload: upload file from buffer`);
13752
13991
  form.append("file", new File([new Uint8Array(file)], "file"));
13753
13992
  }
@@ -13758,11 +13997,11 @@ async function uploadFile({
13758
13997
  agent
13759
13998
  });
13760
13999
  if (!response.ok) {
13761
- debug17("error from S3 %s %s", response.body, response.status);
14000
+ debug18("error from S3 %s %s", response.body, response.status);
13762
14001
  logInfo2(`FileUpload: error from S3 ${response.body} ${response.status}`);
13763
14002
  throw new Error(`Failed to upload the file: ${response.status}`);
13764
14003
  }
13765
- debug17("upload file done");
14004
+ debug18("upload file done");
13766
14005
  logInfo2(`FileUpload: upload file done`);
13767
14006
  }
13768
14007
 
@@ -13797,9 +14036,9 @@ async function downloadRepo({
13797
14036
  }) {
13798
14037
  const { createSpinner: createSpinner5 } = Spinner2({ ci });
13799
14038
  const repoSpinner = createSpinner5("\u{1F4BE} Downloading Repo").start();
13800
- debug18("download repo %s %s %s", repoUrl, dirname);
14039
+ debug19("download repo %s %s %s", repoUrl, dirname);
13801
14040
  const zipFilePath = path9.join(dirname, "repo.zip");
13802
- debug18("download URL: %s auth headers: %o", downloadUrl, authHeaders);
14041
+ debug19("download URL: %s auth headers: %o", downloadUrl, authHeaders);
13803
14042
  const response = await fetch4(downloadUrl, {
13804
14043
  method: "GET",
13805
14044
  headers: {
@@ -13807,7 +14046,7 @@ async function downloadRepo({
13807
14046
  }
13808
14047
  });
13809
14048
  if (!response.ok) {
13810
- debug18("SCM zipball request failed %s %s", response.body, response.status);
14049
+ debug19("SCM zipball request failed %s %s", response.body, response.status);
13811
14050
  repoSpinner.error({ text: "\u{1F4BE} Repo download failed" });
13812
14051
  throw new Error(`Can't access ${chalk6.bold(repoUrl)}`);
13813
14052
  }
@@ -13821,7 +14060,7 @@ async function downloadRepo({
13821
14060
  if (!repoRoot) {
13822
14061
  throw new Error("Repo root not found");
13823
14062
  }
13824
- debug18("repo root %s", repoRoot);
14063
+ debug19("repo root %s", repoRoot);
13825
14064
  repoSpinner.success({ text: "\u{1F4BE} Repo downloaded successfully" });
13826
14065
  return path9.join(dirname, repoRoot);
13827
14066
  }
@@ -13830,7 +14069,7 @@ var getReportUrl = ({
13830
14069
  projectId,
13831
14070
  fixReportId
13832
14071
  }) => `${WEB_APP_URL}/organization/${organizationId}/project/${projectId}/report/${fixReportId}`;
13833
- var debug18 = Debug18("mobbdev:index");
14072
+ var debug19 = Debug19("mobbdev:index");
13834
14073
  async function runAnalysis(params, options) {
13835
14074
  const tmpObj = tmp2.dirSync({
13836
14075
  unsafeCleanup: true
@@ -13976,7 +14215,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
13976
14215
  pullRequest,
13977
14216
  polling
13978
14217
  } = params;
13979
- debug18("start %s %s", dirname, repo);
14218
+ debug19("start %s %s", dirname, repo);
13980
14219
  const { createSpinner: createSpinner5 } = Spinner2({ ci });
13981
14220
  skipPrompts = skipPrompts || ci;
13982
14221
  const gqlClient = await getAuthenticatedGQLClient({
@@ -14045,8 +14284,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
14045
14284
  );
14046
14285
  }
14047
14286
  const { sha } = getReferenceDataRes.gitReference;
14048
- debug18("project id %s", projectId);
14049
- debug18("default branch %s", reference);
14287
+ debug19("project id %s", projectId);
14288
+ debug19("default branch %s", reference);
14050
14289
  if (command === "scan") {
14051
14290
  reportPath = await getReport(
14052
14291
  {
@@ -14096,7 +14335,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
14096
14335
  spinner: mobbSpinner,
14097
14336
  submitVulnerabilityReportVariables: {
14098
14337
  fixReportId: reportUploadInfo.fixReportId,
14099
- repoUrl: z29.string().parse(repo),
14338
+ repoUrl: z30.string().parse(repo),
14100
14339
  reference,
14101
14340
  projectId,
14102
14341
  vulnerabilityReportFileName: shouldScan ? void 0 : REPORT_DEFAULT_FILE_NAME,
@@ -14374,7 +14613,7 @@ async function _digestReport({
14374
14613
  text: progressMassages.processingVulnerabilityReportSuccess
14375
14614
  });
14376
14615
  if (polling) {
14377
- debug18(
14616
+ debug19(
14378
14617
  "[_digestReport] Using POLLING mode for analysis state updates (--polling flag enabled)"
14379
14618
  );
14380
14619
  console.log(
@@ -14389,7 +14628,7 @@ async function _digestReport({
14389
14628
  timeoutInMs: VUL_REPORT_DIGEST_TIMEOUT_MS
14390
14629
  });
14391
14630
  } else {
14392
- debug18(
14631
+ debug19(
14393
14632
  "[_digestReport] Using WEBSOCKET mode for analysis state updates (default)"
14394
14633
  );
14395
14634
  console.log(
@@ -14429,9 +14668,9 @@ async function waitForAnaysisAndReviewPr({
14429
14668
  gqlClient,
14430
14669
  polling
14431
14670
  }) {
14432
- const params = z29.object({
14433
- repo: z29.string().url(),
14434
- githubActionToken: z29.string()
14671
+ const params = z30.object({
14672
+ repo: z30.string().url(),
14673
+ githubActionToken: z30.string()
14435
14674
  }).parse({ repo, githubActionToken });
14436
14675
  const scm = await createScmLib(
14437
14676
  {
@@ -14449,11 +14688,11 @@ async function waitForAnaysisAndReviewPr({
14449
14688
  analysisId: analysisId2,
14450
14689
  gqlClient,
14451
14690
  scm,
14452
- scanner: z29.nativeEnum(SCANNERS).parse(scanner)
14691
+ scanner: z30.nativeEnum(SCANNERS).parse(scanner)
14453
14692
  });
14454
14693
  };
14455
14694
  if (polling) {
14456
- debug18(
14695
+ debug19(
14457
14696
  "[waitForAnaysisAndReviewPr] Using POLLING mode for analysis state updates"
14458
14697
  );
14459
14698
  console.log(
@@ -14467,7 +14706,7 @@ async function waitForAnaysisAndReviewPr({
14467
14706
  callbackStates: ["Finished" /* Finished */]
14468
14707
  });
14469
14708
  } else {
14470
- debug18(
14709
+ debug19(
14471
14710
  "[waitForAnaysisAndReviewPr] Using WEBSOCKET mode for analysis state updates"
14472
14711
  );
14473
14712
  console.log(
@@ -14763,7 +15002,7 @@ async function scanSkill(options) {
14763
15002
  // src/args/validation.ts
14764
15003
  import chalk8 from "chalk";
14765
15004
  import path11 from "path";
14766
- import { z as z30 } from "zod";
15005
+ import { z as z31 } from "zod";
14767
15006
  function throwRepoUrlErrorMessage({
14768
15007
  error,
14769
15008
  repoUrl,
@@ -14780,11 +15019,11 @@ Example:
14780
15019
  )}`;
14781
15020
  throw new CliError(formattedErrorMessage);
14782
15021
  }
14783
- var UrlZ = z30.string({
15022
+ var UrlZ = z31.string({
14784
15023
  invalid_type_error: `is not a valid ${Object.values(ScmType).join("/ ")} URL`
14785
15024
  });
14786
15025
  function validateOrganizationId(organizationId) {
14787
- const orgIdValidation = z30.string().uuid().nullish().safeParse(organizationId);
15026
+ const orgIdValidation = z31.string().uuid().nullish().safeParse(organizationId);
14788
15027
  if (!orgIdValidation.success) {
14789
15028
  throw new CliError(`organizationId: ${organizationId} is not a valid UUID`);
14790
15029
  }
@@ -14892,7 +15131,7 @@ async function analyzeHandler(args) {
14892
15131
  }
14893
15132
 
14894
15133
  // src/features/claude_code/data_collector.ts
14895
- import { z as z32 } from "zod";
15134
+ import { z as z33 } from "zod";
14896
15135
 
14897
15136
  // src/args/commands/upload_ai_blame.ts
14898
15137
  import fsPromises3 from "fs/promises";
@@ -14900,7 +15139,7 @@ import * as os3 from "os";
14900
15139
  import path12 from "path";
14901
15140
  import chalk10 from "chalk";
14902
15141
  import { withFile } from "tmp-promise";
14903
- import z31 from "zod";
15142
+ import z32 from "zod";
14904
15143
  init_client_generates();
14905
15144
  init_GitService();
14906
15145
  init_urlParser2();
@@ -14999,7 +15238,8 @@ import { OpenRedaction } from "@openredaction/openredaction";
14999
15238
  var openRedaction = new OpenRedaction({
15000
15239
  patterns: [
15001
15240
  // Core Personal Data
15002
- "EMAIL",
15241
+ // Removed EMAIL - causes false positives in code/test snippets (e.g. --author="Eve Author <eve@example.com>")
15242
+ // Prefer false negatives over false positives for this use case.
15003
15243
  "SSN",
15004
15244
  "NATIONAL_INSURANCE_UK",
15005
15245
  "DATE_OF_BIRTH",
@@ -15014,7 +15254,8 @@ var openRedaction = new OpenRedaction({
15014
15254
  "VISA_MRZ",
15015
15255
  "TAX_ID",
15016
15256
  // Financial Data (removed SWIFT_BIC, CARD_AUTH_CODE - too broad, causing false positives with authentication words)
15017
- "CREDIT_CARD",
15257
+ // Removed CREDIT_CARD - causes false positives on zero-filled UUIDs (e.g. '00000000-0000-0000-0000-000000000000')
15258
+ // Prefer false negatives over false positives for this use case.
15018
15259
  "IBAN",
15019
15260
  "BANK_ACCOUNT_UK",
15020
15261
  "ROUTING_NUMBER_US",
@@ -15100,15 +15341,6 @@ async function sanitizeDataWithCounts(obj) {
15100
15341
  ...piiDetections.low
15101
15342
  ];
15102
15343
  for (const detection of allDetections) {
15103
- if (detection.type === "CREDIT_CARD") {
15104
- const start = detection.position[0];
15105
- const end = detection.position[1];
15106
- const charBefore = (start > 0 ? str[start - 1] : "") ?? "";
15107
- const charAfter = str[end] ?? "";
15108
- if (charBefore === "." || charBefore >= "0" && charBefore <= "9" || charAfter >= "0" && charAfter <= "9") {
15109
- continue;
15110
- }
15111
- }
15112
15344
  counts.detections.total++;
15113
15345
  if (detection.severity === "high") counts.detections.high++;
15114
15346
  else if (detection.severity === "medium") counts.detections.medium++;
@@ -15161,8 +15393,8 @@ var defaultLogger2 = {
15161
15393
  }
15162
15394
  }
15163
15395
  };
15164
- var PromptItemZ = z31.object({
15165
- type: z31.enum([
15396
+ var PromptItemZ = z32.object({
15397
+ type: z32.enum([
15166
15398
  "USER_PROMPT",
15167
15399
  "AI_RESPONSE",
15168
15400
  "TOOL_EXECUTION",
@@ -15170,32 +15402,32 @@ var PromptItemZ = z31.object({
15170
15402
  "MCP_TOOL_CALL"
15171
15403
  // MCP (Model Context Protocol) tool invocation
15172
15404
  ]),
15173
- attachedFiles: z31.array(
15174
- z31.object({
15175
- relativePath: z31.string(),
15176
- startLine: z31.number().optional()
15405
+ attachedFiles: z32.array(
15406
+ z32.object({
15407
+ relativePath: z32.string(),
15408
+ startLine: z32.number().optional()
15177
15409
  })
15178
15410
  ).optional(),
15179
- tokens: z31.object({
15180
- inputCount: z31.number(),
15181
- outputCount: z31.number()
15411
+ tokens: z32.object({
15412
+ inputCount: z32.number(),
15413
+ outputCount: z32.number()
15182
15414
  }).optional(),
15183
- text: z31.string().optional(),
15184
- date: z31.date().optional(),
15185
- tool: z31.object({
15186
- name: z31.string(),
15187
- parameters: z31.string(),
15188
- result: z31.string(),
15189
- rawArguments: z31.string().optional(),
15190
- accepted: z31.boolean().optional(),
15415
+ text: z32.string().optional(),
15416
+ date: z32.date().optional(),
15417
+ tool: z32.object({
15418
+ name: z32.string(),
15419
+ parameters: z32.string(),
15420
+ result: z32.string(),
15421
+ rawArguments: z32.string().optional(),
15422
+ accepted: z32.boolean().optional(),
15191
15423
  // MCP-specific fields (only populated for MCP_TOOL_CALL type)
15192
- mcpServer: z31.string().optional(),
15424
+ mcpServer: z32.string().optional(),
15193
15425
  // MCP server name (e.g., "datadog", "mobb-mcp")
15194
- mcpToolName: z31.string().optional()
15426
+ mcpToolName: z32.string().optional()
15195
15427
  // MCP tool name without prefix (e.g., "scan_and_fix_vulnerabilities")
15196
15428
  }).optional()
15197
15429
  });
15198
- var PromptItemArrayZ = z31.array(PromptItemZ);
15430
+ var PromptItemArrayZ = z32.array(PromptItemZ);
15199
15431
  async function getRepositoryUrl() {
15200
15432
  try {
15201
15433
  const gitService = new GitService(process.cwd());
@@ -15585,46 +15817,46 @@ async function parseTranscriptAndCreateTrace(transcriptPath, hookData, inference
15585
15817
  }
15586
15818
 
15587
15819
  // src/features/claude_code/data_collector.ts
15588
- var StructuredPatchItemSchema = z32.object({
15589
- oldStart: z32.number(),
15590
- oldLines: z32.number(),
15591
- newStart: z32.number(),
15592
- newLines: z32.number(),
15593
- lines: z32.array(z32.string())
15820
+ var StructuredPatchItemSchema = z33.object({
15821
+ oldStart: z33.number(),
15822
+ oldLines: z33.number(),
15823
+ newStart: z33.number(),
15824
+ newLines: z33.number(),
15825
+ lines: z33.array(z33.string())
15594
15826
  });
15595
- var EditToolInputSchema = z32.object({
15596
- file_path: z32.string(),
15597
- old_string: z32.string(),
15598
- new_string: z32.string()
15827
+ var EditToolInputSchema = z33.object({
15828
+ file_path: z33.string(),
15829
+ old_string: z33.string(),
15830
+ new_string: z33.string()
15599
15831
  });
15600
- var WriteToolInputSchema = z32.object({
15601
- file_path: z32.string(),
15602
- content: z32.string()
15832
+ var WriteToolInputSchema = z33.object({
15833
+ file_path: z33.string(),
15834
+ content: z33.string()
15603
15835
  });
15604
- var EditToolResponseSchema = z32.object({
15605
- filePath: z32.string(),
15606
- oldString: z32.string().optional(),
15607
- newString: z32.string().optional(),
15608
- originalFile: z32.string().optional(),
15609
- structuredPatch: z32.array(StructuredPatchItemSchema),
15610
- userModified: z32.boolean().optional(),
15611
- replaceAll: z32.boolean().optional()
15836
+ var EditToolResponseSchema = z33.object({
15837
+ filePath: z33.string(),
15838
+ oldString: z33.string().optional(),
15839
+ newString: z33.string().optional(),
15840
+ originalFile: z33.string().optional(),
15841
+ structuredPatch: z33.array(StructuredPatchItemSchema),
15842
+ userModified: z33.boolean().optional(),
15843
+ replaceAll: z33.boolean().optional()
15612
15844
  });
15613
- var WriteToolResponseSchema = z32.object({
15614
- type: z32.string().optional(),
15615
- filePath: z32.string(),
15616
- content: z32.string().optional(),
15617
- structuredPatch: z32.array(z32.any()).optional()
15845
+ var WriteToolResponseSchema = z33.object({
15846
+ type: z33.string().optional(),
15847
+ filePath: z33.string(),
15848
+ content: z33.string().optional(),
15849
+ structuredPatch: z33.array(z33.any()).optional()
15618
15850
  });
15619
- var HookDataSchema = z32.object({
15620
- session_id: z32.string(),
15621
- transcript_path: z32.string(),
15622
- cwd: z32.string(),
15623
- permission_mode: z32.string().optional(),
15624
- hook_event_name: z32.literal("PostToolUse"),
15625
- tool_name: z32.enum(["Edit", "Write"]),
15626
- tool_input: z32.union([EditToolInputSchema, WriteToolInputSchema]),
15627
- tool_response: z32.union([EditToolResponseSchema, WriteToolResponseSchema])
15851
+ var HookDataSchema = z33.object({
15852
+ session_id: z33.string(),
15853
+ transcript_path: z33.string(),
15854
+ cwd: z33.string(),
15855
+ permission_mode: z33.string().optional(),
15856
+ hook_event_name: z33.literal("PostToolUse"),
15857
+ tool_name: z33.enum(["Edit", "Write"]),
15858
+ tool_input: z33.union([EditToolInputSchema, WriteToolInputSchema]),
15859
+ tool_response: z33.union([EditToolResponseSchema, WriteToolResponseSchema])
15628
15860
  });
15629
15861
  async function readStdinData() {
15630
15862
  return new Promise((resolve, reject) => {
@@ -16091,138 +16323,137 @@ var log = logger.log.bind(logger);
16091
16323
  // src/mcp/services/McpGQLClient.ts
16092
16324
  import crypto3 from "crypto";
16093
16325
  import { GraphQLClient as GraphQLClient2 } from "graphql-request";
16094
- import { HttpsProxyAgent as HttpsProxyAgent2 } from "https-proxy-agent";
16095
16326
  import { v4 as uuidv42 } from "uuid";
16096
16327
  init_client_generates();
16097
16328
  init_configs();
16098
16329
 
16099
16330
  // src/mcp/types.ts
16100
16331
  init_client_generates();
16101
- import { z as z33 } from "zod";
16102
- var ScanAndFixVulnerabilitiesToolSchema = z33.object({
16103
- path: z33.string()
16332
+ import { z as z34 } from "zod";
16333
+ var ScanAndFixVulnerabilitiesToolSchema = z34.object({
16334
+ path: z34.string()
16104
16335
  });
16105
- var VulnerabilityReportIssueTagSchema = z33.object({
16106
- vulnerability_report_issue_tag_value: z33.nativeEnum(
16336
+ var VulnerabilityReportIssueTagSchema = z34.object({
16337
+ vulnerability_report_issue_tag_value: z34.nativeEnum(
16107
16338
  Vulnerability_Report_Issue_Tag_Enum
16108
16339
  )
16109
16340
  });
16110
- var VulnerabilityReportIssueSchema = z33.object({
16111
- category: z33.any().optional().nullable(),
16112
- parsedIssueType: z33.nativeEnum(IssueType_Enum).nullable().optional(),
16113
- parsedSeverity: z33.nativeEnum(Vulnerability_Severity_Enum).nullable().optional(),
16114
- vulnerabilityReportIssueTags: z33.array(VulnerabilityReportIssueTagSchema)
16341
+ var VulnerabilityReportIssueSchema = z34.object({
16342
+ category: z34.any().optional().nullable(),
16343
+ parsedIssueType: z34.nativeEnum(IssueType_Enum).nullable().optional(),
16344
+ parsedSeverity: z34.nativeEnum(Vulnerability_Severity_Enum).nullable().optional(),
16345
+ vulnerabilityReportIssueTags: z34.array(VulnerabilityReportIssueTagSchema)
16115
16346
  });
16116
- var SharedStateSchema = z33.object({
16117
- __typename: z33.literal("fix_shared_state").optional(),
16118
- id: z33.any(),
16347
+ var SharedStateSchema = z34.object({
16348
+ __typename: z34.literal("fix_shared_state").optional(),
16349
+ id: z34.any(),
16119
16350
  // GraphQL uses `any` type for UUID
16120
- downloadedBy: z33.array(z33.any().nullable()).optional().nullable()
16351
+ downloadedBy: z34.array(z34.any().nullable()).optional().nullable()
16121
16352
  });
16122
- var UnstructuredFixExtraContextSchema = z33.object({
16123
- __typename: z33.literal("UnstructuredFixExtraContext").optional(),
16124
- key: z33.string(),
16125
- value: z33.any()
16353
+ var UnstructuredFixExtraContextSchema = z34.object({
16354
+ __typename: z34.literal("UnstructuredFixExtraContext").optional(),
16355
+ key: z34.string(),
16356
+ value: z34.any()
16126
16357
  // GraphQL JSON type
16127
16358
  });
16128
- var FixExtraContextResponseSchema = z33.object({
16129
- __typename: z33.literal("FixExtraContextResponse").optional(),
16130
- extraContext: z33.array(UnstructuredFixExtraContextSchema),
16131
- fixDescription: z33.string()
16359
+ var FixExtraContextResponseSchema = z34.object({
16360
+ __typename: z34.literal("FixExtraContextResponse").optional(),
16361
+ extraContext: z34.array(UnstructuredFixExtraContextSchema),
16362
+ fixDescription: z34.string()
16132
16363
  });
16133
- var FixDataSchema = z33.object({
16134
- __typename: z33.literal("FixData"),
16135
- patch: z33.string(),
16136
- patchOriginalEncodingBase64: z33.string(),
16364
+ var FixDataSchema = z34.object({
16365
+ __typename: z34.literal("FixData"),
16366
+ patch: z34.string(),
16367
+ patchOriginalEncodingBase64: z34.string(),
16137
16368
  extraContext: FixExtraContextResponseSchema
16138
16369
  });
16139
- var GetFixNoFixErrorSchema = z33.object({
16140
- __typename: z33.literal("GetFixNoFixError")
16370
+ var GetFixNoFixErrorSchema = z34.object({
16371
+ __typename: z34.literal("GetFixNoFixError")
16141
16372
  });
16142
- var PatchAndQuestionsSchema = z33.union([FixDataSchema, GetFixNoFixErrorSchema]);
16143
- var McpFixSchema = z33.object({
16144
- __typename: z33.literal("fix").optional(),
16145
- id: z33.any(),
16373
+ var PatchAndQuestionsSchema = z34.union([FixDataSchema, GetFixNoFixErrorSchema]);
16374
+ var McpFixSchema = z34.object({
16375
+ __typename: z34.literal("fix").optional(),
16376
+ id: z34.any(),
16146
16377
  // GraphQL uses `any` type for UUID
16147
- confidence: z33.number(),
16148
- safeIssueType: z33.string().nullable(),
16149
- severityText: z33.string().nullable(),
16150
- gitBlameLogin: z33.string().nullable().optional(),
16378
+ confidence: z34.number(),
16379
+ safeIssueType: z34.string().nullable(),
16380
+ severityText: z34.string().nullable(),
16381
+ gitBlameLogin: z34.string().nullable().optional(),
16151
16382
  // Optional in GraphQL
16152
- severityValue: z33.number().nullable(),
16153
- vulnerabilityReportIssues: z33.array(VulnerabilityReportIssueSchema),
16383
+ severityValue: z34.number().nullable(),
16384
+ vulnerabilityReportIssues: z34.array(VulnerabilityReportIssueSchema),
16154
16385
  sharedState: SharedStateSchema.nullable().optional(),
16155
16386
  // Optional in GraphQL
16156
16387
  patchAndQuestions: PatchAndQuestionsSchema,
16157
16388
  // Additional field added by the client
16158
- fixUrl: z33.string().optional()
16389
+ fixUrl: z34.string().optional()
16159
16390
  });
16160
- var FixAggregateSchema = z33.object({
16161
- __typename: z33.literal("fix_aggregate").optional(),
16162
- aggregate: z33.object({
16163
- __typename: z33.literal("fix_aggregate_fields").optional(),
16164
- count: z33.number()
16391
+ var FixAggregateSchema = z34.object({
16392
+ __typename: z34.literal("fix_aggregate").optional(),
16393
+ aggregate: z34.object({
16394
+ __typename: z34.literal("fix_aggregate_fields").optional(),
16395
+ count: z34.number()
16165
16396
  }).nullable()
16166
16397
  });
16167
- var VulnerabilityReportIssueAggregateSchema = z33.object({
16168
- __typename: z33.literal("vulnerability_report_issue_aggregate").optional(),
16169
- aggregate: z33.object({
16170
- __typename: z33.literal("vulnerability_report_issue_aggregate_fields").optional(),
16171
- count: z33.number()
16398
+ var VulnerabilityReportIssueAggregateSchema = z34.object({
16399
+ __typename: z34.literal("vulnerability_report_issue_aggregate").optional(),
16400
+ aggregate: z34.object({
16401
+ __typename: z34.literal("vulnerability_report_issue_aggregate_fields").optional(),
16402
+ count: z34.number()
16172
16403
  }).nullable()
16173
16404
  });
16174
- var RepoSchema = z33.object({
16175
- __typename: z33.literal("repo").optional(),
16176
- originalUrl: z33.string()
16405
+ var RepoSchema = z34.object({
16406
+ __typename: z34.literal("repo").optional(),
16407
+ originalUrl: z34.string()
16177
16408
  });
16178
- var ProjectSchema = z33.object({
16179
- id: z33.any(),
16409
+ var ProjectSchema = z34.object({
16410
+ id: z34.any(),
16180
16411
  // GraphQL uses `any` type for UUID
16181
- organizationId: z33.any()
16412
+ organizationId: z34.any()
16182
16413
  // GraphQL uses `any` type for UUID
16183
16414
  });
16184
- var VulnerabilityReportSchema = z33.object({
16185
- scanDate: z33.any().nullable(),
16415
+ var VulnerabilityReportSchema = z34.object({
16416
+ scanDate: z34.any().nullable(),
16186
16417
  // GraphQL uses `any` type for timestamp
16187
- vendor: z33.string(),
16418
+ vendor: z34.string(),
16188
16419
  // GraphQL generates as string, not enum
16189
- projectId: z33.any().optional(),
16420
+ projectId: z34.any().optional(),
16190
16421
  // GraphQL uses `any` type for UUID
16191
16422
  project: ProjectSchema,
16192
16423
  totalVulnerabilityReportIssuesCount: VulnerabilityReportIssueAggregateSchema,
16193
16424
  notFixableVulnerabilityReportIssuesCount: VulnerabilityReportIssueAggregateSchema
16194
16425
  });
16195
- var FixReportSummarySchema = z33.object({
16196
- __typename: z33.literal("fixReport").optional(),
16197
- id: z33.any(),
16426
+ var FixReportSummarySchema = z34.object({
16427
+ __typename: z34.literal("fixReport").optional(),
16428
+ id: z34.any(),
16198
16429
  // GraphQL uses `any` type for UUID
16199
- createdOn: z33.any(),
16430
+ createdOn: z34.any(),
16200
16431
  // GraphQL uses `any` type for timestamp
16201
16432
  repo: RepoSchema.nullable(),
16202
- issueTypes: z33.any().nullable(),
16433
+ issueTypes: z34.any().nullable(),
16203
16434
  // GraphQL uses `any` type for JSON
16204
16435
  CRITICAL: FixAggregateSchema,
16205
16436
  HIGH: FixAggregateSchema,
16206
16437
  MEDIUM: FixAggregateSchema,
16207
16438
  LOW: FixAggregateSchema,
16208
- fixes: z33.array(McpFixSchema),
16209
- userFixes: z33.array(McpFixSchema).optional(),
16439
+ fixes: z34.array(McpFixSchema),
16440
+ userFixes: z34.array(McpFixSchema).optional(),
16210
16441
  // Present in some responses but can be omitted
16211
16442
  filteredFixesCount: FixAggregateSchema,
16212
16443
  totalFixesCount: FixAggregateSchema,
16213
16444
  vulnerabilityReport: VulnerabilityReportSchema
16214
16445
  });
16215
- var ExpiredReportSchema = z33.object({
16216
- __typename: z33.literal("fixReport").optional(),
16217
- id: z33.any(),
16446
+ var ExpiredReportSchema = z34.object({
16447
+ __typename: z34.literal("fixReport").optional(),
16448
+ id: z34.any(),
16218
16449
  // GraphQL uses `any` type for UUID
16219
- expirationOn: z33.any().nullable()
16450
+ expirationOn: z34.any().nullable()
16220
16451
  // GraphQL uses `any` type for timestamp
16221
16452
  });
16222
- var GetLatestReportByRepoUrlResponseSchema = z33.object({
16223
- __typename: z33.literal("query_root").optional(),
16224
- fixReport: z33.array(FixReportSummarySchema),
16225
- expiredReport: z33.array(ExpiredReportSchema)
16453
+ var GetLatestReportByRepoUrlResponseSchema = z34.object({
16454
+ __typename: z34.literal("query_root").optional(),
16455
+ fixReport: z34.array(FixReportSummarySchema),
16456
+ expiredReport: z34.array(ExpiredReportSchema)
16226
16457
  });
16227
16458
 
16228
16459
  // src/mcp/services/McpAuthService.ts
@@ -16306,23 +16537,6 @@ var McpAuthService = class {
16306
16537
  };
16307
16538
 
16308
16539
  // src/mcp/services/McpGQLClient.ts
16309
- function getProxyAgent2(url) {
16310
- try {
16311
- const parsedUrl = new URL(url);
16312
- const isHttp = parsedUrl.protocol === "http:";
16313
- const isHttps = parsedUrl.protocol === "https:";
16314
- const proxy = isHttps ? HTTPS_PROXY || HTTP_PROXY : isHttp ? HTTP_PROXY : null;
16315
- if (proxy) {
16316
- logDebug("[GraphQL] Using proxy for websocket subscriptions", { proxy });
16317
- return new HttpsProxyAgent2(proxy);
16318
- }
16319
- } catch (err) {
16320
- logDebug(`[GraphQL] Skipping proxy for ${url}`, {
16321
- error: err.message
16322
- });
16323
- }
16324
- return void 0;
16325
- }
16326
16540
  var McpGQLClient = class {
16327
16541
  constructor(args) {
16328
16542
  __publicField(this, "client");
@@ -16339,6 +16553,7 @@ var McpGQLClient = class {
16339
16553
  headers: args.type === "apiKey" ? { [MCP_API_KEY_HEADER_NAME]: args.apiKey || "" } : {
16340
16554
  Authorization: `Bearer ${args.token}`
16341
16555
  },
16556
+ fetch: fetchWithProxy,
16342
16557
  requestMiddleware: (request) => {
16343
16558
  const requestId = uuidv42();
16344
16559
  return {
@@ -16521,13 +16736,15 @@ var McpGQLClient = class {
16521
16736
  this._auth.type === "apiKey" ? {
16522
16737
  apiKey: this._auth.apiKey,
16523
16738
  type: "apiKey",
16739
+ url: httpToWsUrl(this.apiUrl),
16524
16740
  timeoutInMs: params.timeoutInMs,
16525
- proxyAgent: getProxyAgent2(this.apiUrl)
16741
+ proxyAgent: getProxyAgent(this.apiUrl)
16526
16742
  } : {
16527
16743
  token: this._auth.token,
16528
16744
  type: "token",
16745
+ url: httpToWsUrl(this.apiUrl),
16529
16746
  timeoutInMs: params.timeoutInMs,
16530
- proxyAgent: getProxyAgent2(this.apiUrl)
16747
+ proxyAgent: getProxyAgent(this.apiUrl)
16531
16748
  }
16532
16749
  );
16533
16750
  }
@@ -18147,10 +18364,10 @@ var McpServer = class {
18147
18364
  };
18148
18365
 
18149
18366
  // src/mcp/prompts/CheckForNewVulnerabilitiesPrompt.ts
18150
- import { z as z35 } from "zod";
18367
+ import { z as z36 } from "zod";
18151
18368
 
18152
18369
  // src/mcp/prompts/base/BasePrompt.ts
18153
- import { z as z34 } from "zod";
18370
+ import { z as z35 } from "zod";
18154
18371
  var BasePrompt = class {
18155
18372
  getDefinition() {
18156
18373
  return {
@@ -18179,7 +18396,7 @@ var BasePrompt = class {
18179
18396
  const argsToValidate = args === void 0 ? {} : args;
18180
18397
  return this.argumentsValidationSchema.parse(argsToValidate);
18181
18398
  } catch (error) {
18182
- if (error instanceof z34.ZodError) {
18399
+ if (error instanceof z35.ZodError) {
18183
18400
  const errorDetails = error.errors.map((e) => {
18184
18401
  const fieldPath = e.path.length > 0 ? e.path.join(".") : "root";
18185
18402
  const message = e.message === "Required" ? `Missing required argument '${fieldPath}'` : `Invalid value for '${fieldPath}': ${e.message}`;
@@ -18208,8 +18425,8 @@ var BasePrompt = class {
18208
18425
  };
18209
18426
 
18210
18427
  // src/mcp/prompts/CheckForNewVulnerabilitiesPrompt.ts
18211
- var CheckForNewVulnerabilitiesArgsSchema = z35.object({
18212
- path: z35.string().optional()
18428
+ var CheckForNewVulnerabilitiesArgsSchema = z36.object({
18429
+ path: z36.string().optional()
18213
18430
  });
18214
18431
  var CheckForNewVulnerabilitiesPrompt = class extends BasePrompt {
18215
18432
  constructor() {
@@ -18454,9 +18671,9 @@ Call the \`check_for_new_available_fixes\` tool now${args?.path ? ` for ${args.p
18454
18671
  };
18455
18672
 
18456
18673
  // src/mcp/prompts/FullSecurityAuditPrompt.ts
18457
- import { z as z36 } from "zod";
18458
- var FullSecurityAuditArgsSchema = z36.object({
18459
- path: z36.string().optional()
18674
+ import { z as z37 } from "zod";
18675
+ var FullSecurityAuditArgsSchema = z37.object({
18676
+ path: z37.string().optional()
18460
18677
  });
18461
18678
  var FullSecurityAuditPrompt = class extends BasePrompt {
18462
18679
  constructor() {
@@ -18907,9 +19124,9 @@ Begin the audit now${args?.path ? ` for ${args.path}` : ""}.
18907
19124
  };
18908
19125
 
18909
19126
  // src/mcp/prompts/ReviewAndFixCriticalPrompt.ts
18910
- import { z as z37 } from "zod";
18911
- var ReviewAndFixCriticalArgsSchema = z37.object({
18912
- path: z37.string().optional()
19127
+ import { z as z38 } from "zod";
19128
+ var ReviewAndFixCriticalArgsSchema = z38.object({
19129
+ path: z38.string().optional()
18913
19130
  });
18914
19131
  var ReviewAndFixCriticalPrompt = class extends BasePrompt {
18915
19132
  constructor() {
@@ -19213,9 +19430,9 @@ Start by scanning${args?.path ? ` ${args.path}` : " the repository"} and priorit
19213
19430
  };
19214
19431
 
19215
19432
  // src/mcp/prompts/ScanRecentChangesPrompt.ts
19216
- import { z as z38 } from "zod";
19217
- var ScanRecentChangesArgsSchema = z38.object({
19218
- path: z38.string().optional()
19433
+ import { z as z39 } from "zod";
19434
+ var ScanRecentChangesArgsSchema = z39.object({
19435
+ path: z39.string().optional()
19219
19436
  });
19220
19437
  var ScanRecentChangesPrompt = class extends BasePrompt {
19221
19438
  constructor() {
@@ -19426,9 +19643,9 @@ You now have the guidance needed to perform a fast, targeted security scan of re
19426
19643
  };
19427
19644
 
19428
19645
  // src/mcp/prompts/ScanRepositoryPrompt.ts
19429
- import { z as z39 } from "zod";
19430
- var ScanRepositoryArgsSchema = z39.object({
19431
- path: z39.string().optional()
19646
+ import { z as z40 } from "zod";
19647
+ var ScanRepositoryArgsSchema = z40.object({
19648
+ path: z40.string().optional()
19432
19649
  });
19433
19650
  var ScanRepositoryPrompt = class extends BasePrompt {
19434
19651
  constructor() {
@@ -19826,7 +20043,7 @@ import * as os11 from "os";
19826
20043
  import * as path18 from "path";
19827
20044
 
19828
20045
  // src/mcp/tools/checkForNewAvailableFixes/CheckForNewAvailableFixesTool.ts
19829
- import { z as z42 } from "zod";
20046
+ import { z as z43 } from "zod";
19830
20047
 
19831
20048
  // src/mcp/services/PathValidation.ts
19832
20049
  import fs19 from "fs";
@@ -19902,7 +20119,7 @@ async function validatePath(inputPath) {
19902
20119
  }
19903
20120
 
19904
20121
  // src/mcp/tools/base/BaseTool.ts
19905
- import { z as z40 } from "zod";
20122
+ import { z as z41 } from "zod";
19906
20123
  var BaseTool = class {
19907
20124
  getDefinition() {
19908
20125
  return {
@@ -19935,7 +20152,7 @@ var BaseTool = class {
19935
20152
  try {
19936
20153
  return this.inputValidationSchema.parse(args);
19937
20154
  } catch (error) {
19938
- if (error instanceof z40.ZodError) {
20155
+ if (error instanceof z41.ZodError) {
19939
20156
  const errorDetails = error.errors.map((e) => {
19940
20157
  const fieldPath = e.path.length > 0 ? e.path.join(".") : "root";
19941
20158
  const message = e.message === "Required" ? `Missing required parameter '${fieldPath}'` : `Invalid value for '${fieldPath}': ${e.message}`;
@@ -20654,13 +20871,13 @@ init_client_generates();
20654
20871
  init_GitService();
20655
20872
  import fs21 from "fs";
20656
20873
  import path20 from "path";
20657
- import { z as z41 } from "zod";
20874
+ import { z as z42 } from "zod";
20658
20875
  function extractPathFromPatch(patch) {
20659
20876
  const match = patch?.match(/diff --git a\/([^\s]+) b\//);
20660
20877
  return match?.[1] ?? null;
20661
20878
  }
20662
20879
  function parsedIssueTypeRes(issueType) {
20663
- return z41.nativeEnum(IssueType_Enum).safeParse(issueType);
20880
+ return z42.nativeEnum(IssueType_Enum).safeParse(issueType);
20664
20881
  }
20665
20882
  var LocalMobbFolderService = class {
20666
20883
  /**
@@ -23357,8 +23574,8 @@ Example payload:
23357
23574
  },
23358
23575
  required: ["path"]
23359
23576
  });
23360
- __publicField(this, "inputValidationSchema", z42.object({
23361
- path: z42.string().describe(
23577
+ __publicField(this, "inputValidationSchema", z43.object({
23578
+ path: z43.string().describe(
23362
23579
  "Full local path to the cloned git repository to check for new available fixes"
23363
23580
  )
23364
23581
  }));
@@ -23388,7 +23605,7 @@ Example payload:
23388
23605
 
23389
23606
  // src/mcp/tools/fetchAvailableFixes/FetchAvailableFixesTool.ts
23390
23607
  init_GitService();
23391
- import { z as z43 } from "zod";
23608
+ import { z as z44 } from "zod";
23392
23609
 
23393
23610
  // src/mcp/tools/fetchAvailableFixes/FetchAvailableFixesService.ts
23394
23611
  init_configs();
@@ -23531,16 +23748,16 @@ Call this tool instead of ${MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES} when you only
23531
23748
  },
23532
23749
  required: ["path"]
23533
23750
  });
23534
- __publicField(this, "inputValidationSchema", z43.object({
23535
- path: z43.string().describe(
23751
+ __publicField(this, "inputValidationSchema", z44.object({
23752
+ path: z44.string().describe(
23536
23753
  "Full local path to the cloned git repository to check for available fixes"
23537
23754
  ),
23538
- offset: z43.number().optional().describe("Optional offset for pagination"),
23539
- limit: z43.number().optional().describe("Optional maximum number of fixes to return"),
23540
- fileFilter: z43.array(z43.string()).optional().describe(
23755
+ offset: z44.number().optional().describe("Optional offset for pagination"),
23756
+ limit: z44.number().optional().describe("Optional maximum number of fixes to return"),
23757
+ fileFilter: z44.array(z44.string()).optional().describe(
23541
23758
  "Optional list of file paths relative to the path parameter to filter fixes by. INCOMPATIBLE with fetchFixesFromAnyFile"
23542
23759
  ),
23543
- fetchFixesFromAnyFile: z43.boolean().optional().describe(
23760
+ fetchFixesFromAnyFile: z44.boolean().optional().describe(
23544
23761
  "Optional boolean to fetch fixes for all files. INCOMPATIBLE with fileFilter"
23545
23762
  )
23546
23763
  }));
@@ -23605,7 +23822,7 @@ Call this tool instead of ${MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES} when you only
23605
23822
  };
23606
23823
 
23607
23824
  // src/mcp/tools/mcpChecker/mcpCheckerTool.ts
23608
- import z44 from "zod";
23825
+ import z45 from "zod";
23609
23826
 
23610
23827
  // src/mcp/tools/mcpChecker/mcpCheckerService.ts
23611
23828
  var _McpCheckerService = class _McpCheckerService {
@@ -23666,7 +23883,7 @@ var McpCheckerTool = class extends BaseTool {
23666
23883
  __publicField(this, "displayName", "MCP Checker");
23667
23884
  // A detailed description to guide the LLM on when and how to invoke this tool.
23668
23885
  __publicField(this, "description", "Check the MCP servers running on this IDE against organization policies.");
23669
- __publicField(this, "inputValidationSchema", z44.object({}));
23886
+ __publicField(this, "inputValidationSchema", z45.object({}));
23670
23887
  __publicField(this, "inputSchema", {
23671
23888
  type: "object",
23672
23889
  properties: {},
@@ -23692,7 +23909,7 @@ var McpCheckerTool = class extends BaseTool {
23692
23909
  };
23693
23910
 
23694
23911
  // src/mcp/tools/scanAndFixVulnerabilities/ScanAndFixVulnerabilitiesTool.ts
23695
- import z45 from "zod";
23912
+ import z46 from "zod";
23696
23913
  init_configs();
23697
23914
 
23698
23915
  // src/mcp/tools/scanAndFixVulnerabilities/ScanAndFixVulnerabilitiesService.ts
@@ -23880,17 +24097,17 @@ Example payload:
23880
24097
  "rescan": false
23881
24098
  }`);
23882
24099
  __publicField(this, "hasAuthentication", true);
23883
- __publicField(this, "inputValidationSchema", z45.object({
23884
- path: z45.string().describe(
24100
+ __publicField(this, "inputValidationSchema", z46.object({
24101
+ path: z46.string().describe(
23885
24102
  "Full local path to repository to scan and fix vulnerabilities"
23886
24103
  ),
23887
- offset: z45.number().optional().describe("Optional offset for pagination"),
23888
- limit: z45.number().optional().describe("Optional maximum number of results to return"),
23889
- maxFiles: z45.number().optional().describe(
24104
+ offset: z46.number().optional().describe("Optional offset for pagination"),
24105
+ limit: z46.number().optional().describe("Optional maximum number of results to return"),
24106
+ maxFiles: z46.number().optional().describe(
23890
24107
  `Optional maximum number of files to scan (default: ${MCP_DEFAULT_MAX_FILES_TO_SCAN}). Increase for comprehensive scans of larger codebases or decrease for faster focused scans.`
23891
24108
  ),
23892
- rescan: z45.boolean().optional().describe("Optional whether to rescan the repository"),
23893
- scanRecentlyChangedFiles: z45.boolean().optional().describe(
24109
+ rescan: z46.boolean().optional().describe("Optional whether to rescan the repository"),
24110
+ scanRecentlyChangedFiles: z46.boolean().optional().describe(
23894
24111
  "Optional whether to automatically scan recently changed files when no changed files are found in git status. If false, the tool will prompt the user instead."
23895
24112
  )
23896
24113
  }));
@@ -24198,7 +24415,7 @@ async function addScmTokenHandler(args) {
24198
24415
  }
24199
24416
 
24200
24417
  // src/features/codeium_intellij/data_collector.ts
24201
- import { z as z46 } from "zod";
24418
+ import { z as z47 } from "zod";
24202
24419
  init_client_generates();
24203
24420
  init_urlParser2();
24204
24421
 
@@ -24339,8 +24556,8 @@ function findRunningCodeiumLanguageServers() {
24339
24556
  }
24340
24557
 
24341
24558
  // src/features/codeium_intellij/data_collector.ts
24342
- var HookDataSchema2 = z46.object({
24343
- trajectory_id: z46.string()
24559
+ var HookDataSchema2 = z47.object({
24560
+ trajectory_id: z47.string()
24344
24561
  });
24345
24562
  async function processAndUploadHookData2() {
24346
24563
  const tracePayload = await getTraceDataForHook();
@@ -24720,13 +24937,13 @@ var parseArgs = async (args) => {
24720
24937
  };
24721
24938
 
24722
24939
  // src/index.ts
24723
- var debug19 = Debug19("mobbdev:index");
24940
+ var debug20 = Debug20("mobbdev:index");
24724
24941
  async function run() {
24725
24942
  return parseArgs(hideBin(process.argv));
24726
24943
  }
24727
24944
  (async () => {
24728
24945
  try {
24729
- debug19("Bugsy CLI v%s running...", packageJson.version);
24946
+ debug20("Bugsy CLI v%s running...", packageJson.version);
24730
24947
  await run();
24731
24948
  process.exit(0);
24732
24949
  } catch (err) {