mobbdev 1.2.29 → 1.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/args/commands/upload_ai_blame.mjs +314 -103
- package/dist/index.mjs +541 -304
- package/package.json +13 -13
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
|
|
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
|
|
3882
|
-
|
|
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
|
-
|
|
4101
|
+
metadataLine
|
|
3886
4102
|
});
|
|
3887
4103
|
return null;
|
|
3888
4104
|
}
|
|
3889
|
-
const
|
|
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}`;
|
|
@@ -7357,6 +7575,9 @@ var AdoSCMLib = class extends SCMLib {
|
|
|
7357
7575
|
async getSubmitRequestMetadata(_submitRequestId) {
|
|
7358
7576
|
throw new Error("getSubmitRequestMetadata not implemented for ADO");
|
|
7359
7577
|
}
|
|
7578
|
+
async getPrFiles(_prNumber) {
|
|
7579
|
+
throw new Error("getPrFiles not implemented for ADO");
|
|
7580
|
+
}
|
|
7360
7581
|
async searchSubmitRequests(_params) {
|
|
7361
7582
|
throw new Error("searchSubmitRequests not implemented for ADO");
|
|
7362
7583
|
}
|
|
@@ -7381,34 +7602,34 @@ import querystring2 from "querystring";
|
|
|
7381
7602
|
import * as bitbucketPkgNode from "bitbucket";
|
|
7382
7603
|
import bitbucketPkg from "bitbucket";
|
|
7383
7604
|
import Debug2 from "debug";
|
|
7384
|
-
import { z as
|
|
7605
|
+
import { z as z20 } from "zod";
|
|
7385
7606
|
|
|
7386
7607
|
// src/features/analysis/scm/bitbucket/validation.ts
|
|
7387
|
-
import { z as
|
|
7388
|
-
var BitbucketAuthResultZ =
|
|
7389
|
-
access_token:
|
|
7390
|
-
token_type:
|
|
7391
|
-
refresh_token:
|
|
7608
|
+
import { z as z19 } from "zod";
|
|
7609
|
+
var BitbucketAuthResultZ = z19.object({
|
|
7610
|
+
access_token: z19.string(),
|
|
7611
|
+
token_type: z19.string(),
|
|
7612
|
+
refresh_token: z19.string()
|
|
7392
7613
|
});
|
|
7393
7614
|
|
|
7394
7615
|
// src/features/analysis/scm/bitbucket/bitbucket.ts
|
|
7395
7616
|
var debug2 = Debug2("scm:bitbucket");
|
|
7396
7617
|
var BITBUCKET_HOSTNAME = "bitbucket.org";
|
|
7397
|
-
var TokenExpiredErrorZ =
|
|
7398
|
-
status:
|
|
7399
|
-
error:
|
|
7400
|
-
type:
|
|
7401
|
-
error:
|
|
7402
|
-
message:
|
|
7618
|
+
var TokenExpiredErrorZ = z20.object({
|
|
7619
|
+
status: z20.number(),
|
|
7620
|
+
error: z20.object({
|
|
7621
|
+
type: z20.string(),
|
|
7622
|
+
error: z20.object({
|
|
7623
|
+
message: z20.string()
|
|
7403
7624
|
})
|
|
7404
7625
|
})
|
|
7405
7626
|
});
|
|
7406
7627
|
var BITBUCKET_ACCESS_TOKEN_URL = `https://${BITBUCKET_HOSTNAME}/site/oauth2/access_token`;
|
|
7407
7628
|
var MAX_BITBUCKET_PR_BODY_LENGTH = 32768;
|
|
7408
|
-
var BitbucketParseResultZ =
|
|
7409
|
-
organization:
|
|
7410
|
-
repoName:
|
|
7411
|
-
hostname:
|
|
7629
|
+
var BitbucketParseResultZ = z20.object({
|
|
7630
|
+
organization: z20.string(),
|
|
7631
|
+
repoName: z20.string(),
|
|
7632
|
+
hostname: z20.literal(BITBUCKET_HOSTNAME)
|
|
7412
7633
|
});
|
|
7413
7634
|
function parseBitbucketOrganizationAndRepo(bitbucketUrl) {
|
|
7414
7635
|
const parsedGitHubUrl = normalizeUrl(bitbucketUrl);
|
|
@@ -7468,7 +7689,7 @@ function getBitbucketSdk(params) {
|
|
|
7468
7689
|
if (!res.data.values) {
|
|
7469
7690
|
return [];
|
|
7470
7691
|
}
|
|
7471
|
-
return res.data.values.filter((branch) => !!branch.name).map((branch) =>
|
|
7692
|
+
return res.data.values.filter((branch) => !!branch.name).map((branch) => z20.string().parse(branch.name));
|
|
7472
7693
|
},
|
|
7473
7694
|
async getIsUserCollaborator(params2) {
|
|
7474
7695
|
const { repoUrl } = params2;
|
|
@@ -7583,7 +7804,7 @@ function getBitbucketSdk(params) {
|
|
|
7583
7804
|
return GetReferenceResultZ.parse({
|
|
7584
7805
|
sha: tagRes.data.target?.hash,
|
|
7585
7806
|
type: "TAG" /* TAG */,
|
|
7586
|
-
date: new Date(
|
|
7807
|
+
date: new Date(z20.string().parse(tagRes.data.target?.date))
|
|
7587
7808
|
});
|
|
7588
7809
|
},
|
|
7589
7810
|
async getBranchRef(params2) {
|
|
@@ -7591,7 +7812,7 @@ function getBitbucketSdk(params) {
|
|
|
7591
7812
|
return GetReferenceResultZ.parse({
|
|
7592
7813
|
sha: getBranchRes.target?.hash,
|
|
7593
7814
|
type: "BRANCH" /* BRANCH */,
|
|
7594
|
-
date: new Date(
|
|
7815
|
+
date: new Date(z20.string().parse(getBranchRes.target?.date))
|
|
7595
7816
|
});
|
|
7596
7817
|
},
|
|
7597
7818
|
async getCommitRef(params2) {
|
|
@@ -7599,13 +7820,13 @@ function getBitbucketSdk(params) {
|
|
|
7599
7820
|
return GetReferenceResultZ.parse({
|
|
7600
7821
|
sha: getCommitRes.hash,
|
|
7601
7822
|
type: "COMMIT" /* COMMIT */,
|
|
7602
|
-
date: new Date(
|
|
7823
|
+
date: new Date(z20.string().parse(getCommitRes.date))
|
|
7603
7824
|
});
|
|
7604
7825
|
},
|
|
7605
7826
|
async getDownloadUrl({ url, sha }) {
|
|
7606
7827
|
this.getReferenceData({ ref: sha, url });
|
|
7607
7828
|
const repoRes = await this.getRepo({ repoUrl: url });
|
|
7608
|
-
const parsedRepoUrl =
|
|
7829
|
+
const parsedRepoUrl = z20.string().url().parse(repoRes.links?.html?.href);
|
|
7609
7830
|
return `${parsedRepoUrl}/get/${sha}.zip`;
|
|
7610
7831
|
},
|
|
7611
7832
|
async getPullRequest(params2) {
|
|
@@ -7670,7 +7891,7 @@ async function validateBitbucketParams(params) {
|
|
|
7670
7891
|
}
|
|
7671
7892
|
async function getUsersWorkspacesSlugs(bitbucketClient) {
|
|
7672
7893
|
const res = await bitbucketClient.workspaces.getWorkspaces({});
|
|
7673
|
-
return res.data.values?.map((v) =>
|
|
7894
|
+
return res.data.values?.map((v) => z20.string().parse(v.slug));
|
|
7674
7895
|
}
|
|
7675
7896
|
async function getAllUsersRepositories(bitbucketClient) {
|
|
7676
7897
|
const userWorkspacesSlugs = await getUsersWorkspacesSlugs(bitbucketClient);
|
|
@@ -7698,10 +7919,10 @@ async function getRepositoriesByWorkspace(bitbucketClient, { workspaceSlug }) {
|
|
|
7698
7919
|
|
|
7699
7920
|
// src/features/analysis/scm/bitbucket/BitbucketSCMLib.ts
|
|
7700
7921
|
import { setTimeout as setTimeout3 } from "timers/promises";
|
|
7701
|
-
import { z as
|
|
7922
|
+
import { z as z21 } from "zod";
|
|
7702
7923
|
function getUserAndPassword(token) {
|
|
7703
7924
|
const [username, password] = token.split(":");
|
|
7704
|
-
const safePasswordAndUsername =
|
|
7925
|
+
const safePasswordAndUsername = z21.object({ username: z21.string(), password: z21.string() }).parse({ username, password });
|
|
7705
7926
|
return {
|
|
7706
7927
|
username: safePasswordAndUsername.username,
|
|
7707
7928
|
password: safePasswordAndUsername.password
|
|
@@ -7773,7 +7994,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7773
7994
|
return { username, password, authType };
|
|
7774
7995
|
}
|
|
7775
7996
|
case "token": {
|
|
7776
|
-
return { authType, token:
|
|
7997
|
+
return { authType, token: z21.string().parse(this.accessToken) };
|
|
7777
7998
|
}
|
|
7778
7999
|
case "public":
|
|
7779
8000
|
return { authType };
|
|
@@ -7787,7 +8008,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7787
8008
|
...params,
|
|
7788
8009
|
repoUrl: this.url
|
|
7789
8010
|
});
|
|
7790
|
-
return String(
|
|
8011
|
+
return String(z21.number().parse(pullRequestRes.id));
|
|
7791
8012
|
} catch (e) {
|
|
7792
8013
|
console.warn(
|
|
7793
8014
|
`error creating pull request for BB. Try number ${String(i + 1).replace(/\n|\r/g, "")}`,
|
|
@@ -7872,7 +8093,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7872
8093
|
async getUsername() {
|
|
7873
8094
|
this._validateAccessToken();
|
|
7874
8095
|
const res = await this.bitbucketSdk.getUser();
|
|
7875
|
-
return
|
|
8096
|
+
return z21.string().parse(res["username"]);
|
|
7876
8097
|
}
|
|
7877
8098
|
async getSubmitRequestStatus(_scmSubmitRequestId) {
|
|
7878
8099
|
this._validateAccessTokenAndUrl();
|
|
@@ -7898,7 +8119,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7898
8119
|
async getRepoDefaultBranch() {
|
|
7899
8120
|
this._validateUrl();
|
|
7900
8121
|
const repoRes = await this.bitbucketSdk.getRepo({ repoUrl: this.url });
|
|
7901
|
-
return
|
|
8122
|
+
return z21.string().parse(repoRes.mainbranch?.name);
|
|
7902
8123
|
}
|
|
7903
8124
|
getSubmitRequestUrl(submitRequestId) {
|
|
7904
8125
|
this._validateUrl();
|
|
@@ -7936,6 +8157,9 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7936
8157
|
async getSubmitRequestMetadata(_submitRequestId) {
|
|
7937
8158
|
throw new Error("getSubmitRequestMetadata not implemented for Bitbucket");
|
|
7938
8159
|
}
|
|
8160
|
+
async getPrFiles(_prNumber) {
|
|
8161
|
+
throw new Error("getPrFiles not implemented for Bitbucket");
|
|
8162
|
+
}
|
|
7939
8163
|
async searchSubmitRequests(_params) {
|
|
7940
8164
|
throw new Error("searchSubmitRequests not implemented for Bitbucket");
|
|
7941
8165
|
}
|
|
@@ -7964,7 +8188,7 @@ var REPORT_DEFAULT_FILE_NAME = "report.json";
|
|
|
7964
8188
|
init_env();
|
|
7965
8189
|
|
|
7966
8190
|
// src/features/analysis/scm/github/GithubSCMLib.ts
|
|
7967
|
-
import { z as
|
|
8191
|
+
import { z as z22 } from "zod";
|
|
7968
8192
|
init_client_generates();
|
|
7969
8193
|
|
|
7970
8194
|
// src/features/analysis/scm/utils/cursorValidation.ts
|
|
@@ -8949,7 +9173,7 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8949
9173
|
owner,
|
|
8950
9174
|
repo
|
|
8951
9175
|
});
|
|
8952
|
-
return
|
|
9176
|
+
return z22.string().parse(prRes.data);
|
|
8953
9177
|
}
|
|
8954
9178
|
async getRepoList(_scmOrg) {
|
|
8955
9179
|
this._validateAccessToken();
|
|
@@ -9137,6 +9361,19 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
9137
9361
|
headCommitSha: pr.head.sha
|
|
9138
9362
|
};
|
|
9139
9363
|
}
|
|
9364
|
+
async getPrFiles(prNumber) {
|
|
9365
|
+
this._validateAccessTokenAndUrl();
|
|
9366
|
+
const { owner, repo } = parseGithubOwnerAndRepo(this.url);
|
|
9367
|
+
const filesRes = await this.githubSdk.listPRFiles({
|
|
9368
|
+
owner,
|
|
9369
|
+
repo,
|
|
9370
|
+
pull_number: prNumber
|
|
9371
|
+
});
|
|
9372
|
+
return filesRes.data.filter((file) => {
|
|
9373
|
+
const status = file.status;
|
|
9374
|
+
return status === "added" || status === "modified" || status === "renamed" && file.changes > 0 || status === "copied" && file.changes > 0;
|
|
9375
|
+
}).map((file) => file.filename);
|
|
9376
|
+
}
|
|
9140
9377
|
/**
|
|
9141
9378
|
* Override searchSubmitRequests to use GitHub's Search API for efficient pagination.
|
|
9142
9379
|
* This is much faster than fetching all PRs and filtering in-memory.
|
|
@@ -9402,11 +9639,11 @@ var contextLogger = {
|
|
|
9402
9639
|
init_env();
|
|
9403
9640
|
|
|
9404
9641
|
// src/features/analysis/scm/gitlab/types.ts
|
|
9405
|
-
import { z as
|
|
9406
|
-
var GitlabAuthResultZ =
|
|
9407
|
-
access_token:
|
|
9408
|
-
token_type:
|
|
9409
|
-
refresh_token:
|
|
9642
|
+
import { z as z23 } from "zod";
|
|
9643
|
+
var GitlabAuthResultZ = z23.object({
|
|
9644
|
+
access_token: z23.string(),
|
|
9645
|
+
token_type: z23.string(),
|
|
9646
|
+
refresh_token: z23.string()
|
|
9410
9647
|
});
|
|
9411
9648
|
|
|
9412
9649
|
// src/features/analysis/scm/gitlab/gitlab.ts
|
|
@@ -10273,6 +10510,9 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
10273
10510
|
headCommitSha: mr.sha
|
|
10274
10511
|
};
|
|
10275
10512
|
}
|
|
10513
|
+
async getPrFiles(_prNumber) {
|
|
10514
|
+
throw new Error("getPrFiles not implemented for GitLab");
|
|
10515
|
+
}
|
|
10276
10516
|
async searchSubmitRequests(params) {
|
|
10277
10517
|
this._validateAccessTokenAndUrl();
|
|
10278
10518
|
const page = parseCursorSafe(params.cursor, 1);
|
|
@@ -10442,7 +10682,7 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
10442
10682
|
};
|
|
10443
10683
|
|
|
10444
10684
|
// src/features/analysis/scm/scmFactory.ts
|
|
10445
|
-
import { z as
|
|
10685
|
+
import { z as z24 } from "zod";
|
|
10446
10686
|
|
|
10447
10687
|
// src/features/analysis/scm/StubSCMLib.ts
|
|
10448
10688
|
var StubSCMLib = class extends SCMLib {
|
|
@@ -10534,6 +10774,10 @@ var StubSCMLib = class extends SCMLib {
|
|
|
10534
10774
|
async getSubmitRequestMetadata(_submitRequestId) {
|
|
10535
10775
|
throw new Error("getSubmitRequestMetadata() not implemented");
|
|
10536
10776
|
}
|
|
10777
|
+
async getPrFiles(_prNumber) {
|
|
10778
|
+
console.warn("getPrFiles() returning empty array");
|
|
10779
|
+
return [];
|
|
10780
|
+
}
|
|
10537
10781
|
async getPullRequestMetrics(_prNumber) {
|
|
10538
10782
|
console.warn("getPullRequestMetrics() returning empty object");
|
|
10539
10783
|
throw new Error("getPullRequestMetrics() not implemented");
|
|
@@ -10579,7 +10823,7 @@ async function createScmLib({ url, accessToken, scmType, scmOrg }, { propagateEx
|
|
|
10579
10823
|
if (e instanceof InvalidRepoUrlError && url) {
|
|
10580
10824
|
throw new RepoNoTokenAccessError(
|
|
10581
10825
|
"no access to repo",
|
|
10582
|
-
scmLibScmTypeToScmType[
|
|
10826
|
+
scmLibScmTypeToScmType[z24.nativeEnum(ScmLibScmType).parse(scmType)]
|
|
10583
10827
|
);
|
|
10584
10828
|
}
|
|
10585
10829
|
console.error(`error validating scm: ${scmType} `, e);
|
|
@@ -11169,7 +11413,7 @@ import path6 from "path";
|
|
|
11169
11413
|
import chalk from "chalk";
|
|
11170
11414
|
import Debug4 from "debug";
|
|
11171
11415
|
import * as dotenv from "dotenv";
|
|
11172
|
-
import { z as
|
|
11416
|
+
import { z as z25 } from "zod";
|
|
11173
11417
|
var debug5 = Debug4("mobbdev:constants");
|
|
11174
11418
|
var runtimeConfigPath = path6.join(
|
|
11175
11419
|
getModuleRootDir(),
|
|
@@ -11214,17 +11458,17 @@ var scannerToVulnerabilityReportVendorEnum = {
|
|
|
11214
11458
|
[SCANNERS.Semgrep]: "semgrep" /* Semgrep */,
|
|
11215
11459
|
[SCANNERS.Datadog]: "datadog" /* Datadog */
|
|
11216
11460
|
};
|
|
11217
|
-
var SupportedScannersZ =
|
|
11218
|
-
var envVariablesSchema =
|
|
11461
|
+
var SupportedScannersZ = z25.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
|
|
11462
|
+
var envVariablesSchema = z25.object({
|
|
11219
11463
|
// These have safe defaults for production - the VS Code extension passes explicit URLs
|
|
11220
|
-
WEB_APP_URL:
|
|
11221
|
-
API_URL:
|
|
11464
|
+
WEB_APP_URL: z25.string().optional().default(DEFAULT_WEB_APP_URL),
|
|
11465
|
+
API_URL: z25.string().optional().default(DEFAULT_API_URL),
|
|
11222
11466
|
// These are only needed for local development with Hasura
|
|
11223
|
-
HASURA_ACCESS_KEY:
|
|
11224
|
-
LOCAL_GRAPHQL_ENDPOINT:
|
|
11467
|
+
HASURA_ACCESS_KEY: z25.string().optional().default(""),
|
|
11468
|
+
LOCAL_GRAPHQL_ENDPOINT: z25.string().optional().default(""),
|
|
11225
11469
|
// Proxy settings
|
|
11226
|
-
HTTP_PROXY:
|
|
11227
|
-
HTTPS_PROXY:
|
|
11470
|
+
HTTP_PROXY: z25.string().optional().default(""),
|
|
11471
|
+
HTTPS_PROXY: z25.string().optional().default("")
|
|
11228
11472
|
});
|
|
11229
11473
|
var envVariables = envVariablesSchema.parse(process.env);
|
|
11230
11474
|
debug5("config %o", envVariables);
|
|
@@ -11475,7 +11719,7 @@ import { createSpinner as createSpinner4 } from "nanospinner";
|
|
|
11475
11719
|
import fetch4 from "node-fetch";
|
|
11476
11720
|
import open3 from "open";
|
|
11477
11721
|
import tmp2 from "tmp";
|
|
11478
|
-
import { z as
|
|
11722
|
+
import { z as z30 } from "zod";
|
|
11479
11723
|
|
|
11480
11724
|
// src/commands/handleMobbLogin.ts
|
|
11481
11725
|
import chalk3 from "chalk";
|
|
@@ -11763,62 +12007,62 @@ init_client_generates();
|
|
|
11763
12007
|
|
|
11764
12008
|
// src/features/analysis/graphql/types.ts
|
|
11765
12009
|
init_client_generates();
|
|
11766
|
-
import { z as
|
|
11767
|
-
var VulnerabilityReportIssueCodeNodeZ =
|
|
11768
|
-
vulnerabilityReportIssueId:
|
|
11769
|
-
path:
|
|
11770
|
-
startLine:
|
|
11771
|
-
vulnerabilityReportIssue:
|
|
11772
|
-
fixId:
|
|
11773
|
-
category:
|
|
11774
|
-
safeIssueType:
|
|
11775
|
-
vulnerabilityReportIssueTags:
|
|
11776
|
-
|
|
11777
|
-
tag:
|
|
12010
|
+
import { z as z26 } from "zod";
|
|
12011
|
+
var VulnerabilityReportIssueCodeNodeZ = z26.object({
|
|
12012
|
+
vulnerabilityReportIssueId: z26.string(),
|
|
12013
|
+
path: z26.string(),
|
|
12014
|
+
startLine: z26.number(),
|
|
12015
|
+
vulnerabilityReportIssue: z26.object({
|
|
12016
|
+
fixId: z26.string(),
|
|
12017
|
+
category: z26.nativeEnum(Vulnerability_Report_Issue_Category_Enum),
|
|
12018
|
+
safeIssueType: z26.string(),
|
|
12019
|
+
vulnerabilityReportIssueTags: z26.array(
|
|
12020
|
+
z26.object({
|
|
12021
|
+
tag: z26.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
|
|
11778
12022
|
})
|
|
11779
12023
|
)
|
|
11780
12024
|
})
|
|
11781
12025
|
});
|
|
11782
|
-
var VulnerabilityReportIssueNoFixCodeNodeZ =
|
|
11783
|
-
vulnerabilityReportIssues:
|
|
11784
|
-
|
|
11785
|
-
id:
|
|
11786
|
-
fixId:
|
|
11787
|
-
category:
|
|
11788
|
-
safeIssueType:
|
|
11789
|
-
fpId:
|
|
11790
|
-
codeNodes:
|
|
11791
|
-
|
|
11792
|
-
path:
|
|
11793
|
-
startLine:
|
|
12026
|
+
var VulnerabilityReportIssueNoFixCodeNodeZ = z26.object({
|
|
12027
|
+
vulnerabilityReportIssues: z26.array(
|
|
12028
|
+
z26.object({
|
|
12029
|
+
id: z26.string(),
|
|
12030
|
+
fixId: z26.string().nullable(),
|
|
12031
|
+
category: z26.nativeEnum(Vulnerability_Report_Issue_Category_Enum),
|
|
12032
|
+
safeIssueType: z26.string(),
|
|
12033
|
+
fpId: z26.string().uuid().nullable(),
|
|
12034
|
+
codeNodes: z26.array(
|
|
12035
|
+
z26.object({
|
|
12036
|
+
path: z26.string(),
|
|
12037
|
+
startLine: z26.number()
|
|
11794
12038
|
})
|
|
11795
12039
|
),
|
|
11796
|
-
vulnerabilityReportIssueTags:
|
|
11797
|
-
|
|
11798
|
-
tag:
|
|
12040
|
+
vulnerabilityReportIssueTags: z26.array(
|
|
12041
|
+
z26.object({
|
|
12042
|
+
tag: z26.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
|
|
11799
12043
|
})
|
|
11800
12044
|
)
|
|
11801
12045
|
})
|
|
11802
12046
|
)
|
|
11803
12047
|
});
|
|
11804
|
-
var GetVulByNodesMetadataZ =
|
|
11805
|
-
vulnerabilityReportIssueCodeNodes:
|
|
11806
|
-
nonFixablePrVuls:
|
|
11807
|
-
aggregate:
|
|
11808
|
-
count:
|
|
12048
|
+
var GetVulByNodesMetadataZ = z26.object({
|
|
12049
|
+
vulnerabilityReportIssueCodeNodes: z26.array(VulnerabilityReportIssueCodeNodeZ),
|
|
12050
|
+
nonFixablePrVuls: z26.object({
|
|
12051
|
+
aggregate: z26.object({
|
|
12052
|
+
count: z26.number()
|
|
11809
12053
|
})
|
|
11810
12054
|
}),
|
|
11811
|
-
fixablePrVuls:
|
|
11812
|
-
aggregate:
|
|
11813
|
-
count:
|
|
12055
|
+
fixablePrVuls: z26.object({
|
|
12056
|
+
aggregate: z26.object({
|
|
12057
|
+
count: z26.number()
|
|
11814
12058
|
})
|
|
11815
12059
|
}),
|
|
11816
|
-
totalScanVulnerabilities:
|
|
11817
|
-
aggregate:
|
|
11818
|
-
count:
|
|
12060
|
+
totalScanVulnerabilities: z26.object({
|
|
12061
|
+
aggregate: z26.object({
|
|
12062
|
+
count: z26.number()
|
|
11819
12063
|
})
|
|
11820
12064
|
}),
|
|
11821
|
-
irrelevantVulnerabilityReportIssue:
|
|
12065
|
+
irrelevantVulnerabilityReportIssue: z26.array(
|
|
11822
12066
|
VulnerabilityReportIssueNoFixCodeNodeZ
|
|
11823
12067
|
)
|
|
11824
12068
|
});
|
|
@@ -12595,7 +12839,7 @@ import Debug11 from "debug";
|
|
|
12595
12839
|
// src/features/analysis/add_fix_comments_for_pr/utils/utils.ts
|
|
12596
12840
|
import Debug10 from "debug";
|
|
12597
12841
|
import parseDiff from "parse-diff";
|
|
12598
|
-
import { z as
|
|
12842
|
+
import { z as z28 } from "zod";
|
|
12599
12843
|
|
|
12600
12844
|
// src/features/analysis/utils/by_key.ts
|
|
12601
12845
|
function keyBy(array, keyBy2) {
|
|
@@ -12683,7 +12927,7 @@ var scannerToFriendlyString = {
|
|
|
12683
12927
|
|
|
12684
12928
|
// src/features/analysis/add_fix_comments_for_pr/utils/buildCommentBody.ts
|
|
12685
12929
|
import Debug9 from "debug";
|
|
12686
|
-
import { z as
|
|
12930
|
+
import { z as z27 } from "zod";
|
|
12687
12931
|
init_client_generates();
|
|
12688
12932
|
var debug10 = Debug9("mobbdev:handle-finished-analysis");
|
|
12689
12933
|
var getCommitFixButton = (commitUrl) => `<a href="${commitUrl}"><img src=${COMMIT_FIX_SVG}></a>`;
|
|
@@ -12737,11 +12981,11 @@ function buildFixCommentBody({
|
|
|
12737
12981
|
});
|
|
12738
12982
|
const issueType = getIssueTypeFriendlyString(fix.safeIssueType);
|
|
12739
12983
|
const title = `# ${MobbIconMarkdown} ${issueType} fix is ready`;
|
|
12740
|
-
const validFixParseRes =
|
|
12984
|
+
const validFixParseRes = z27.object({
|
|
12741
12985
|
patchAndQuestions: PatchAndQuestionsZ,
|
|
12742
|
-
safeIssueLanguage:
|
|
12743
|
-
severityText:
|
|
12744
|
-
safeIssueType:
|
|
12986
|
+
safeIssueLanguage: z27.nativeEnum(IssueLanguage_Enum),
|
|
12987
|
+
severityText: z27.nativeEnum(Vulnerability_Severity_Enum),
|
|
12988
|
+
safeIssueType: z27.nativeEnum(IssueType_Enum)
|
|
12745
12989
|
}).safeParse(fix);
|
|
12746
12990
|
if (!validFixParseRes.success) {
|
|
12747
12991
|
debug10(
|
|
@@ -12975,7 +13219,7 @@ async function getRelevantVulenrabilitiesFromDiff(params) {
|
|
|
12975
13219
|
});
|
|
12976
13220
|
const lineAddedRanges = calculateRanges(fileNumbers);
|
|
12977
13221
|
const fileFilter = {
|
|
12978
|
-
path:
|
|
13222
|
+
path: z28.string().parse(file.to),
|
|
12979
13223
|
ranges: lineAddedRanges.map(([startLine, endLine]) => ({
|
|
12980
13224
|
endLine,
|
|
12981
13225
|
startLine
|
|
@@ -13287,15 +13531,15 @@ import { globby } from "globby";
|
|
|
13287
13531
|
import { isBinary as isBinary2 } from "istextorbinary";
|
|
13288
13532
|
import { simpleGit as simpleGit3 } from "simple-git";
|
|
13289
13533
|
import { parseStringPromise } from "xml2js";
|
|
13290
|
-
import { z as
|
|
13534
|
+
import { z as z29 } from "zod";
|
|
13291
13535
|
var debug15 = Debug14("mobbdev:pack");
|
|
13292
|
-
var FPR_SOURCE_CODE_FILE_MAPPING_SCHEMA =
|
|
13293
|
-
properties:
|
|
13294
|
-
entry:
|
|
13295
|
-
|
|
13296
|
-
_:
|
|
13297
|
-
$:
|
|
13298
|
-
key:
|
|
13536
|
+
var FPR_SOURCE_CODE_FILE_MAPPING_SCHEMA = z29.object({
|
|
13537
|
+
properties: z29.object({
|
|
13538
|
+
entry: z29.array(
|
|
13539
|
+
z29.object({
|
|
13540
|
+
_: z29.string(),
|
|
13541
|
+
$: z29.object({
|
|
13542
|
+
key: z29.string()
|
|
13299
13543
|
})
|
|
13300
13544
|
})
|
|
13301
13545
|
)
|
|
@@ -14117,7 +14361,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
14117
14361
|
spinner: mobbSpinner,
|
|
14118
14362
|
submitVulnerabilityReportVariables: {
|
|
14119
14363
|
fixReportId: reportUploadInfo.fixReportId,
|
|
14120
|
-
repoUrl:
|
|
14364
|
+
repoUrl: z30.string().parse(repo),
|
|
14121
14365
|
reference,
|
|
14122
14366
|
projectId,
|
|
14123
14367
|
vulnerabilityReportFileName: shouldScan ? void 0 : REPORT_DEFAULT_FILE_NAME,
|
|
@@ -14450,9 +14694,9 @@ async function waitForAnaysisAndReviewPr({
|
|
|
14450
14694
|
gqlClient,
|
|
14451
14695
|
polling
|
|
14452
14696
|
}) {
|
|
14453
|
-
const params =
|
|
14454
|
-
repo:
|
|
14455
|
-
githubActionToken:
|
|
14697
|
+
const params = z30.object({
|
|
14698
|
+
repo: z30.string().url(),
|
|
14699
|
+
githubActionToken: z30.string()
|
|
14456
14700
|
}).parse({ repo, githubActionToken });
|
|
14457
14701
|
const scm = await createScmLib(
|
|
14458
14702
|
{
|
|
@@ -14470,7 +14714,7 @@ async function waitForAnaysisAndReviewPr({
|
|
|
14470
14714
|
analysisId: analysisId2,
|
|
14471
14715
|
gqlClient,
|
|
14472
14716
|
scm,
|
|
14473
|
-
scanner:
|
|
14717
|
+
scanner: z30.nativeEnum(SCANNERS).parse(scanner)
|
|
14474
14718
|
});
|
|
14475
14719
|
};
|
|
14476
14720
|
if (polling) {
|
|
@@ -14784,7 +15028,7 @@ async function scanSkill(options) {
|
|
|
14784
15028
|
// src/args/validation.ts
|
|
14785
15029
|
import chalk8 from "chalk";
|
|
14786
15030
|
import path11 from "path";
|
|
14787
|
-
import { z as
|
|
15031
|
+
import { z as z31 } from "zod";
|
|
14788
15032
|
function throwRepoUrlErrorMessage({
|
|
14789
15033
|
error,
|
|
14790
15034
|
repoUrl,
|
|
@@ -14801,11 +15045,11 @@ Example:
|
|
|
14801
15045
|
)}`;
|
|
14802
15046
|
throw new CliError(formattedErrorMessage);
|
|
14803
15047
|
}
|
|
14804
|
-
var UrlZ =
|
|
15048
|
+
var UrlZ = z31.string({
|
|
14805
15049
|
invalid_type_error: `is not a valid ${Object.values(ScmType).join("/ ")} URL`
|
|
14806
15050
|
});
|
|
14807
15051
|
function validateOrganizationId(organizationId) {
|
|
14808
|
-
const orgIdValidation =
|
|
15052
|
+
const orgIdValidation = z31.string().uuid().nullish().safeParse(organizationId);
|
|
14809
15053
|
if (!orgIdValidation.success) {
|
|
14810
15054
|
throw new CliError(`organizationId: ${organizationId} is not a valid UUID`);
|
|
14811
15055
|
}
|
|
@@ -14913,7 +15157,7 @@ async function analyzeHandler(args) {
|
|
|
14913
15157
|
}
|
|
14914
15158
|
|
|
14915
15159
|
// src/features/claude_code/data_collector.ts
|
|
14916
|
-
import { z as
|
|
15160
|
+
import { z as z33 } from "zod";
|
|
14917
15161
|
|
|
14918
15162
|
// src/args/commands/upload_ai_blame.ts
|
|
14919
15163
|
import fsPromises3 from "fs/promises";
|
|
@@ -14921,7 +15165,7 @@ import * as os3 from "os";
|
|
|
14921
15165
|
import path12 from "path";
|
|
14922
15166
|
import chalk10 from "chalk";
|
|
14923
15167
|
import { withFile } from "tmp-promise";
|
|
14924
|
-
import
|
|
15168
|
+
import z32 from "zod";
|
|
14925
15169
|
init_client_generates();
|
|
14926
15170
|
init_GitService();
|
|
14927
15171
|
init_urlParser2();
|
|
@@ -15020,7 +15264,8 @@ import { OpenRedaction } from "@openredaction/openredaction";
|
|
|
15020
15264
|
var openRedaction = new OpenRedaction({
|
|
15021
15265
|
patterns: [
|
|
15022
15266
|
// Core Personal Data
|
|
15023
|
-
|
|
15267
|
+
// Removed EMAIL - causes false positives in code/test snippets (e.g. --author="Eve Author <eve@example.com>")
|
|
15268
|
+
// Prefer false negatives over false positives for this use case.
|
|
15024
15269
|
"SSN",
|
|
15025
15270
|
"NATIONAL_INSURANCE_UK",
|
|
15026
15271
|
"DATE_OF_BIRTH",
|
|
@@ -15035,7 +15280,8 @@ var openRedaction = new OpenRedaction({
|
|
|
15035
15280
|
"VISA_MRZ",
|
|
15036
15281
|
"TAX_ID",
|
|
15037
15282
|
// Financial Data (removed SWIFT_BIC, CARD_AUTH_CODE - too broad, causing false positives with authentication words)
|
|
15038
|
-
|
|
15283
|
+
// Removed CREDIT_CARD - causes false positives on zero-filled UUIDs (e.g. '00000000-0000-0000-0000-000000000000')
|
|
15284
|
+
// Prefer false negatives over false positives for this use case.
|
|
15039
15285
|
"IBAN",
|
|
15040
15286
|
"BANK_ACCOUNT_UK",
|
|
15041
15287
|
"ROUTING_NUMBER_US",
|
|
@@ -15121,15 +15367,6 @@ async function sanitizeDataWithCounts(obj) {
|
|
|
15121
15367
|
...piiDetections.low
|
|
15122
15368
|
];
|
|
15123
15369
|
for (const detection of allDetections) {
|
|
15124
|
-
if (detection.type === "CREDIT_CARD") {
|
|
15125
|
-
const start = detection.position[0];
|
|
15126
|
-
const end = detection.position[1];
|
|
15127
|
-
const charBefore = (start > 0 ? str[start - 1] : "") ?? "";
|
|
15128
|
-
const charAfter = str[end] ?? "";
|
|
15129
|
-
if (charBefore === "." || charBefore >= "0" && charBefore <= "9" || charAfter >= "0" && charAfter <= "9") {
|
|
15130
|
-
continue;
|
|
15131
|
-
}
|
|
15132
|
-
}
|
|
15133
15370
|
counts.detections.total++;
|
|
15134
15371
|
if (detection.severity === "high") counts.detections.high++;
|
|
15135
15372
|
else if (detection.severity === "medium") counts.detections.medium++;
|
|
@@ -15182,8 +15419,8 @@ var defaultLogger2 = {
|
|
|
15182
15419
|
}
|
|
15183
15420
|
}
|
|
15184
15421
|
};
|
|
15185
|
-
var PromptItemZ =
|
|
15186
|
-
type:
|
|
15422
|
+
var PromptItemZ = z32.object({
|
|
15423
|
+
type: z32.enum([
|
|
15187
15424
|
"USER_PROMPT",
|
|
15188
15425
|
"AI_RESPONSE",
|
|
15189
15426
|
"TOOL_EXECUTION",
|
|
@@ -15191,32 +15428,32 @@ var PromptItemZ = z31.object({
|
|
|
15191
15428
|
"MCP_TOOL_CALL"
|
|
15192
15429
|
// MCP (Model Context Protocol) tool invocation
|
|
15193
15430
|
]),
|
|
15194
|
-
attachedFiles:
|
|
15195
|
-
|
|
15196
|
-
relativePath:
|
|
15197
|
-
startLine:
|
|
15431
|
+
attachedFiles: z32.array(
|
|
15432
|
+
z32.object({
|
|
15433
|
+
relativePath: z32.string(),
|
|
15434
|
+
startLine: z32.number().optional()
|
|
15198
15435
|
})
|
|
15199
15436
|
).optional(),
|
|
15200
|
-
tokens:
|
|
15201
|
-
inputCount:
|
|
15202
|
-
outputCount:
|
|
15437
|
+
tokens: z32.object({
|
|
15438
|
+
inputCount: z32.number(),
|
|
15439
|
+
outputCount: z32.number()
|
|
15203
15440
|
}).optional(),
|
|
15204
|
-
text:
|
|
15205
|
-
date:
|
|
15206
|
-
tool:
|
|
15207
|
-
name:
|
|
15208
|
-
parameters:
|
|
15209
|
-
result:
|
|
15210
|
-
rawArguments:
|
|
15211
|
-
accepted:
|
|
15441
|
+
text: z32.string().optional(),
|
|
15442
|
+
date: z32.date().optional(),
|
|
15443
|
+
tool: z32.object({
|
|
15444
|
+
name: z32.string(),
|
|
15445
|
+
parameters: z32.string(),
|
|
15446
|
+
result: z32.string(),
|
|
15447
|
+
rawArguments: z32.string().optional(),
|
|
15448
|
+
accepted: z32.boolean().optional(),
|
|
15212
15449
|
// MCP-specific fields (only populated for MCP_TOOL_CALL type)
|
|
15213
|
-
mcpServer:
|
|
15450
|
+
mcpServer: z32.string().optional(),
|
|
15214
15451
|
// MCP server name (e.g., "datadog", "mobb-mcp")
|
|
15215
|
-
mcpToolName:
|
|
15452
|
+
mcpToolName: z32.string().optional()
|
|
15216
15453
|
// MCP tool name without prefix (e.g., "scan_and_fix_vulnerabilities")
|
|
15217
15454
|
}).optional()
|
|
15218
15455
|
});
|
|
15219
|
-
var PromptItemArrayZ =
|
|
15456
|
+
var PromptItemArrayZ = z32.array(PromptItemZ);
|
|
15220
15457
|
async function getRepositoryUrl() {
|
|
15221
15458
|
try {
|
|
15222
15459
|
const gitService = new GitService(process.cwd());
|
|
@@ -15606,46 +15843,46 @@ async function parseTranscriptAndCreateTrace(transcriptPath, hookData, inference
|
|
|
15606
15843
|
}
|
|
15607
15844
|
|
|
15608
15845
|
// src/features/claude_code/data_collector.ts
|
|
15609
|
-
var StructuredPatchItemSchema =
|
|
15610
|
-
oldStart:
|
|
15611
|
-
oldLines:
|
|
15612
|
-
newStart:
|
|
15613
|
-
newLines:
|
|
15614
|
-
lines:
|
|
15846
|
+
var StructuredPatchItemSchema = z33.object({
|
|
15847
|
+
oldStart: z33.number(),
|
|
15848
|
+
oldLines: z33.number(),
|
|
15849
|
+
newStart: z33.number(),
|
|
15850
|
+
newLines: z33.number(),
|
|
15851
|
+
lines: z33.array(z33.string())
|
|
15615
15852
|
});
|
|
15616
|
-
var EditToolInputSchema =
|
|
15617
|
-
file_path:
|
|
15618
|
-
old_string:
|
|
15619
|
-
new_string:
|
|
15853
|
+
var EditToolInputSchema = z33.object({
|
|
15854
|
+
file_path: z33.string(),
|
|
15855
|
+
old_string: z33.string(),
|
|
15856
|
+
new_string: z33.string()
|
|
15620
15857
|
});
|
|
15621
|
-
var WriteToolInputSchema =
|
|
15622
|
-
file_path:
|
|
15623
|
-
content:
|
|
15858
|
+
var WriteToolInputSchema = z33.object({
|
|
15859
|
+
file_path: z33.string(),
|
|
15860
|
+
content: z33.string()
|
|
15624
15861
|
});
|
|
15625
|
-
var EditToolResponseSchema =
|
|
15626
|
-
filePath:
|
|
15627
|
-
oldString:
|
|
15628
|
-
newString:
|
|
15629
|
-
originalFile:
|
|
15630
|
-
structuredPatch:
|
|
15631
|
-
userModified:
|
|
15632
|
-
replaceAll:
|
|
15862
|
+
var EditToolResponseSchema = z33.object({
|
|
15863
|
+
filePath: z33.string(),
|
|
15864
|
+
oldString: z33.string().optional(),
|
|
15865
|
+
newString: z33.string().optional(),
|
|
15866
|
+
originalFile: z33.string().optional(),
|
|
15867
|
+
structuredPatch: z33.array(StructuredPatchItemSchema),
|
|
15868
|
+
userModified: z33.boolean().optional(),
|
|
15869
|
+
replaceAll: z33.boolean().optional()
|
|
15633
15870
|
});
|
|
15634
|
-
var WriteToolResponseSchema =
|
|
15635
|
-
type:
|
|
15636
|
-
filePath:
|
|
15637
|
-
content:
|
|
15638
|
-
structuredPatch:
|
|
15871
|
+
var WriteToolResponseSchema = z33.object({
|
|
15872
|
+
type: z33.string().optional(),
|
|
15873
|
+
filePath: z33.string(),
|
|
15874
|
+
content: z33.string().optional(),
|
|
15875
|
+
structuredPatch: z33.array(z33.any()).optional()
|
|
15639
15876
|
});
|
|
15640
|
-
var HookDataSchema =
|
|
15641
|
-
session_id:
|
|
15642
|
-
transcript_path:
|
|
15643
|
-
cwd:
|
|
15644
|
-
permission_mode:
|
|
15645
|
-
hook_event_name:
|
|
15646
|
-
tool_name:
|
|
15647
|
-
tool_input:
|
|
15648
|
-
tool_response:
|
|
15877
|
+
var HookDataSchema = z33.object({
|
|
15878
|
+
session_id: z33.string(),
|
|
15879
|
+
transcript_path: z33.string(),
|
|
15880
|
+
cwd: z33.string(),
|
|
15881
|
+
permission_mode: z33.string().optional(),
|
|
15882
|
+
hook_event_name: z33.literal("PostToolUse"),
|
|
15883
|
+
tool_name: z33.enum(["Edit", "Write"]),
|
|
15884
|
+
tool_input: z33.union([EditToolInputSchema, WriteToolInputSchema]),
|
|
15885
|
+
tool_response: z33.union([EditToolResponseSchema, WriteToolResponseSchema])
|
|
15649
15886
|
});
|
|
15650
15887
|
async function readStdinData() {
|
|
15651
15888
|
return new Promise((resolve, reject) => {
|
|
@@ -16118,131 +16355,131 @@ init_configs();
|
|
|
16118
16355
|
|
|
16119
16356
|
// src/mcp/types.ts
|
|
16120
16357
|
init_client_generates();
|
|
16121
|
-
import { z as
|
|
16122
|
-
var ScanAndFixVulnerabilitiesToolSchema =
|
|
16123
|
-
path:
|
|
16358
|
+
import { z as z34 } from "zod";
|
|
16359
|
+
var ScanAndFixVulnerabilitiesToolSchema = z34.object({
|
|
16360
|
+
path: z34.string()
|
|
16124
16361
|
});
|
|
16125
|
-
var VulnerabilityReportIssueTagSchema =
|
|
16126
|
-
vulnerability_report_issue_tag_value:
|
|
16362
|
+
var VulnerabilityReportIssueTagSchema = z34.object({
|
|
16363
|
+
vulnerability_report_issue_tag_value: z34.nativeEnum(
|
|
16127
16364
|
Vulnerability_Report_Issue_Tag_Enum
|
|
16128
16365
|
)
|
|
16129
16366
|
});
|
|
16130
|
-
var VulnerabilityReportIssueSchema =
|
|
16131
|
-
category:
|
|
16132
|
-
parsedIssueType:
|
|
16133
|
-
parsedSeverity:
|
|
16134
|
-
vulnerabilityReportIssueTags:
|
|
16367
|
+
var VulnerabilityReportIssueSchema = z34.object({
|
|
16368
|
+
category: z34.any().optional().nullable(),
|
|
16369
|
+
parsedIssueType: z34.nativeEnum(IssueType_Enum).nullable().optional(),
|
|
16370
|
+
parsedSeverity: z34.nativeEnum(Vulnerability_Severity_Enum).nullable().optional(),
|
|
16371
|
+
vulnerabilityReportIssueTags: z34.array(VulnerabilityReportIssueTagSchema)
|
|
16135
16372
|
});
|
|
16136
|
-
var SharedStateSchema =
|
|
16137
|
-
__typename:
|
|
16138
|
-
id:
|
|
16373
|
+
var SharedStateSchema = z34.object({
|
|
16374
|
+
__typename: z34.literal("fix_shared_state").optional(),
|
|
16375
|
+
id: z34.any(),
|
|
16139
16376
|
// GraphQL uses `any` type for UUID
|
|
16140
|
-
downloadedBy:
|
|
16377
|
+
downloadedBy: z34.array(z34.any().nullable()).optional().nullable()
|
|
16141
16378
|
});
|
|
16142
|
-
var UnstructuredFixExtraContextSchema =
|
|
16143
|
-
__typename:
|
|
16144
|
-
key:
|
|
16145
|
-
value:
|
|
16379
|
+
var UnstructuredFixExtraContextSchema = z34.object({
|
|
16380
|
+
__typename: z34.literal("UnstructuredFixExtraContext").optional(),
|
|
16381
|
+
key: z34.string(),
|
|
16382
|
+
value: z34.any()
|
|
16146
16383
|
// GraphQL JSON type
|
|
16147
16384
|
});
|
|
16148
|
-
var FixExtraContextResponseSchema =
|
|
16149
|
-
__typename:
|
|
16150
|
-
extraContext:
|
|
16151
|
-
fixDescription:
|
|
16385
|
+
var FixExtraContextResponseSchema = z34.object({
|
|
16386
|
+
__typename: z34.literal("FixExtraContextResponse").optional(),
|
|
16387
|
+
extraContext: z34.array(UnstructuredFixExtraContextSchema),
|
|
16388
|
+
fixDescription: z34.string()
|
|
16152
16389
|
});
|
|
16153
|
-
var FixDataSchema =
|
|
16154
|
-
__typename:
|
|
16155
|
-
patch:
|
|
16156
|
-
patchOriginalEncodingBase64:
|
|
16390
|
+
var FixDataSchema = z34.object({
|
|
16391
|
+
__typename: z34.literal("FixData"),
|
|
16392
|
+
patch: z34.string(),
|
|
16393
|
+
patchOriginalEncodingBase64: z34.string(),
|
|
16157
16394
|
extraContext: FixExtraContextResponseSchema
|
|
16158
16395
|
});
|
|
16159
|
-
var GetFixNoFixErrorSchema =
|
|
16160
|
-
__typename:
|
|
16396
|
+
var GetFixNoFixErrorSchema = z34.object({
|
|
16397
|
+
__typename: z34.literal("GetFixNoFixError")
|
|
16161
16398
|
});
|
|
16162
|
-
var PatchAndQuestionsSchema =
|
|
16163
|
-
var McpFixSchema =
|
|
16164
|
-
__typename:
|
|
16165
|
-
id:
|
|
16399
|
+
var PatchAndQuestionsSchema = z34.union([FixDataSchema, GetFixNoFixErrorSchema]);
|
|
16400
|
+
var McpFixSchema = z34.object({
|
|
16401
|
+
__typename: z34.literal("fix").optional(),
|
|
16402
|
+
id: z34.any(),
|
|
16166
16403
|
// GraphQL uses `any` type for UUID
|
|
16167
|
-
confidence:
|
|
16168
|
-
safeIssueType:
|
|
16169
|
-
severityText:
|
|
16170
|
-
gitBlameLogin:
|
|
16404
|
+
confidence: z34.number(),
|
|
16405
|
+
safeIssueType: z34.string().nullable(),
|
|
16406
|
+
severityText: z34.string().nullable(),
|
|
16407
|
+
gitBlameLogin: z34.string().nullable().optional(),
|
|
16171
16408
|
// Optional in GraphQL
|
|
16172
|
-
severityValue:
|
|
16173
|
-
vulnerabilityReportIssues:
|
|
16409
|
+
severityValue: z34.number().nullable(),
|
|
16410
|
+
vulnerabilityReportIssues: z34.array(VulnerabilityReportIssueSchema),
|
|
16174
16411
|
sharedState: SharedStateSchema.nullable().optional(),
|
|
16175
16412
|
// Optional in GraphQL
|
|
16176
16413
|
patchAndQuestions: PatchAndQuestionsSchema,
|
|
16177
16414
|
// Additional field added by the client
|
|
16178
|
-
fixUrl:
|
|
16415
|
+
fixUrl: z34.string().optional()
|
|
16179
16416
|
});
|
|
16180
|
-
var FixAggregateSchema =
|
|
16181
|
-
__typename:
|
|
16182
|
-
aggregate:
|
|
16183
|
-
__typename:
|
|
16184
|
-
count:
|
|
16417
|
+
var FixAggregateSchema = z34.object({
|
|
16418
|
+
__typename: z34.literal("fix_aggregate").optional(),
|
|
16419
|
+
aggregate: z34.object({
|
|
16420
|
+
__typename: z34.literal("fix_aggregate_fields").optional(),
|
|
16421
|
+
count: z34.number()
|
|
16185
16422
|
}).nullable()
|
|
16186
16423
|
});
|
|
16187
|
-
var VulnerabilityReportIssueAggregateSchema =
|
|
16188
|
-
__typename:
|
|
16189
|
-
aggregate:
|
|
16190
|
-
__typename:
|
|
16191
|
-
count:
|
|
16424
|
+
var VulnerabilityReportIssueAggregateSchema = z34.object({
|
|
16425
|
+
__typename: z34.literal("vulnerability_report_issue_aggregate").optional(),
|
|
16426
|
+
aggregate: z34.object({
|
|
16427
|
+
__typename: z34.literal("vulnerability_report_issue_aggregate_fields").optional(),
|
|
16428
|
+
count: z34.number()
|
|
16192
16429
|
}).nullable()
|
|
16193
16430
|
});
|
|
16194
|
-
var RepoSchema =
|
|
16195
|
-
__typename:
|
|
16196
|
-
originalUrl:
|
|
16431
|
+
var RepoSchema = z34.object({
|
|
16432
|
+
__typename: z34.literal("repo").optional(),
|
|
16433
|
+
originalUrl: z34.string()
|
|
16197
16434
|
});
|
|
16198
|
-
var ProjectSchema =
|
|
16199
|
-
id:
|
|
16435
|
+
var ProjectSchema = z34.object({
|
|
16436
|
+
id: z34.any(),
|
|
16200
16437
|
// GraphQL uses `any` type for UUID
|
|
16201
|
-
organizationId:
|
|
16438
|
+
organizationId: z34.any()
|
|
16202
16439
|
// GraphQL uses `any` type for UUID
|
|
16203
16440
|
});
|
|
16204
|
-
var VulnerabilityReportSchema =
|
|
16205
|
-
scanDate:
|
|
16441
|
+
var VulnerabilityReportSchema = z34.object({
|
|
16442
|
+
scanDate: z34.any().nullable(),
|
|
16206
16443
|
// GraphQL uses `any` type for timestamp
|
|
16207
|
-
vendor:
|
|
16444
|
+
vendor: z34.string(),
|
|
16208
16445
|
// GraphQL generates as string, not enum
|
|
16209
|
-
projectId:
|
|
16446
|
+
projectId: z34.any().optional(),
|
|
16210
16447
|
// GraphQL uses `any` type for UUID
|
|
16211
16448
|
project: ProjectSchema,
|
|
16212
16449
|
totalVulnerabilityReportIssuesCount: VulnerabilityReportIssueAggregateSchema,
|
|
16213
16450
|
notFixableVulnerabilityReportIssuesCount: VulnerabilityReportIssueAggregateSchema
|
|
16214
16451
|
});
|
|
16215
|
-
var FixReportSummarySchema =
|
|
16216
|
-
__typename:
|
|
16217
|
-
id:
|
|
16452
|
+
var FixReportSummarySchema = z34.object({
|
|
16453
|
+
__typename: z34.literal("fixReport").optional(),
|
|
16454
|
+
id: z34.any(),
|
|
16218
16455
|
// GraphQL uses `any` type for UUID
|
|
16219
|
-
createdOn:
|
|
16456
|
+
createdOn: z34.any(),
|
|
16220
16457
|
// GraphQL uses `any` type for timestamp
|
|
16221
16458
|
repo: RepoSchema.nullable(),
|
|
16222
|
-
issueTypes:
|
|
16459
|
+
issueTypes: z34.any().nullable(),
|
|
16223
16460
|
// GraphQL uses `any` type for JSON
|
|
16224
16461
|
CRITICAL: FixAggregateSchema,
|
|
16225
16462
|
HIGH: FixAggregateSchema,
|
|
16226
16463
|
MEDIUM: FixAggregateSchema,
|
|
16227
16464
|
LOW: FixAggregateSchema,
|
|
16228
|
-
fixes:
|
|
16229
|
-
userFixes:
|
|
16465
|
+
fixes: z34.array(McpFixSchema),
|
|
16466
|
+
userFixes: z34.array(McpFixSchema).optional(),
|
|
16230
16467
|
// Present in some responses but can be omitted
|
|
16231
16468
|
filteredFixesCount: FixAggregateSchema,
|
|
16232
16469
|
totalFixesCount: FixAggregateSchema,
|
|
16233
16470
|
vulnerabilityReport: VulnerabilityReportSchema
|
|
16234
16471
|
});
|
|
16235
|
-
var ExpiredReportSchema =
|
|
16236
|
-
__typename:
|
|
16237
|
-
id:
|
|
16472
|
+
var ExpiredReportSchema = z34.object({
|
|
16473
|
+
__typename: z34.literal("fixReport").optional(),
|
|
16474
|
+
id: z34.any(),
|
|
16238
16475
|
// GraphQL uses `any` type for UUID
|
|
16239
|
-
expirationOn:
|
|
16476
|
+
expirationOn: z34.any().nullable()
|
|
16240
16477
|
// GraphQL uses `any` type for timestamp
|
|
16241
16478
|
});
|
|
16242
|
-
var GetLatestReportByRepoUrlResponseSchema =
|
|
16243
|
-
__typename:
|
|
16244
|
-
fixReport:
|
|
16245
|
-
expiredReport:
|
|
16479
|
+
var GetLatestReportByRepoUrlResponseSchema = z34.object({
|
|
16480
|
+
__typename: z34.literal("query_root").optional(),
|
|
16481
|
+
fixReport: z34.array(FixReportSummarySchema),
|
|
16482
|
+
expiredReport: z34.array(ExpiredReportSchema)
|
|
16246
16483
|
});
|
|
16247
16484
|
|
|
16248
16485
|
// src/mcp/services/McpAuthService.ts
|
|
@@ -18153,10 +18390,10 @@ var McpServer = class {
|
|
|
18153
18390
|
};
|
|
18154
18391
|
|
|
18155
18392
|
// src/mcp/prompts/CheckForNewVulnerabilitiesPrompt.ts
|
|
18156
|
-
import { z as
|
|
18393
|
+
import { z as z36 } from "zod";
|
|
18157
18394
|
|
|
18158
18395
|
// src/mcp/prompts/base/BasePrompt.ts
|
|
18159
|
-
import { z as
|
|
18396
|
+
import { z as z35 } from "zod";
|
|
18160
18397
|
var BasePrompt = class {
|
|
18161
18398
|
getDefinition() {
|
|
18162
18399
|
return {
|
|
@@ -18185,7 +18422,7 @@ var BasePrompt = class {
|
|
|
18185
18422
|
const argsToValidate = args === void 0 ? {} : args;
|
|
18186
18423
|
return this.argumentsValidationSchema.parse(argsToValidate);
|
|
18187
18424
|
} catch (error) {
|
|
18188
|
-
if (error instanceof
|
|
18425
|
+
if (error instanceof z35.ZodError) {
|
|
18189
18426
|
const errorDetails = error.errors.map((e) => {
|
|
18190
18427
|
const fieldPath = e.path.length > 0 ? e.path.join(".") : "root";
|
|
18191
18428
|
const message = e.message === "Required" ? `Missing required argument '${fieldPath}'` : `Invalid value for '${fieldPath}': ${e.message}`;
|
|
@@ -18214,8 +18451,8 @@ var BasePrompt = class {
|
|
|
18214
18451
|
};
|
|
18215
18452
|
|
|
18216
18453
|
// src/mcp/prompts/CheckForNewVulnerabilitiesPrompt.ts
|
|
18217
|
-
var CheckForNewVulnerabilitiesArgsSchema =
|
|
18218
|
-
path:
|
|
18454
|
+
var CheckForNewVulnerabilitiesArgsSchema = z36.object({
|
|
18455
|
+
path: z36.string().optional()
|
|
18219
18456
|
});
|
|
18220
18457
|
var CheckForNewVulnerabilitiesPrompt = class extends BasePrompt {
|
|
18221
18458
|
constructor() {
|
|
@@ -18460,9 +18697,9 @@ Call the \`check_for_new_available_fixes\` tool now${args?.path ? ` for ${args.p
|
|
|
18460
18697
|
};
|
|
18461
18698
|
|
|
18462
18699
|
// src/mcp/prompts/FullSecurityAuditPrompt.ts
|
|
18463
|
-
import { z as
|
|
18464
|
-
var FullSecurityAuditArgsSchema =
|
|
18465
|
-
path:
|
|
18700
|
+
import { z as z37 } from "zod";
|
|
18701
|
+
var FullSecurityAuditArgsSchema = z37.object({
|
|
18702
|
+
path: z37.string().optional()
|
|
18466
18703
|
});
|
|
18467
18704
|
var FullSecurityAuditPrompt = class extends BasePrompt {
|
|
18468
18705
|
constructor() {
|
|
@@ -18913,9 +19150,9 @@ Begin the audit now${args?.path ? ` for ${args.path}` : ""}.
|
|
|
18913
19150
|
};
|
|
18914
19151
|
|
|
18915
19152
|
// src/mcp/prompts/ReviewAndFixCriticalPrompt.ts
|
|
18916
|
-
import { z as
|
|
18917
|
-
var ReviewAndFixCriticalArgsSchema =
|
|
18918
|
-
path:
|
|
19153
|
+
import { z as z38 } from "zod";
|
|
19154
|
+
var ReviewAndFixCriticalArgsSchema = z38.object({
|
|
19155
|
+
path: z38.string().optional()
|
|
18919
19156
|
});
|
|
18920
19157
|
var ReviewAndFixCriticalPrompt = class extends BasePrompt {
|
|
18921
19158
|
constructor() {
|
|
@@ -19219,9 +19456,9 @@ Start by scanning${args?.path ? ` ${args.path}` : " the repository"} and priorit
|
|
|
19219
19456
|
};
|
|
19220
19457
|
|
|
19221
19458
|
// src/mcp/prompts/ScanRecentChangesPrompt.ts
|
|
19222
|
-
import { z as
|
|
19223
|
-
var ScanRecentChangesArgsSchema =
|
|
19224
|
-
path:
|
|
19459
|
+
import { z as z39 } from "zod";
|
|
19460
|
+
var ScanRecentChangesArgsSchema = z39.object({
|
|
19461
|
+
path: z39.string().optional()
|
|
19225
19462
|
});
|
|
19226
19463
|
var ScanRecentChangesPrompt = class extends BasePrompt {
|
|
19227
19464
|
constructor() {
|
|
@@ -19432,9 +19669,9 @@ You now have the guidance needed to perform a fast, targeted security scan of re
|
|
|
19432
19669
|
};
|
|
19433
19670
|
|
|
19434
19671
|
// src/mcp/prompts/ScanRepositoryPrompt.ts
|
|
19435
|
-
import { z as
|
|
19436
|
-
var ScanRepositoryArgsSchema =
|
|
19437
|
-
path:
|
|
19672
|
+
import { z as z40 } from "zod";
|
|
19673
|
+
var ScanRepositoryArgsSchema = z40.object({
|
|
19674
|
+
path: z40.string().optional()
|
|
19438
19675
|
});
|
|
19439
19676
|
var ScanRepositoryPrompt = class extends BasePrompt {
|
|
19440
19677
|
constructor() {
|
|
@@ -19832,7 +20069,7 @@ import * as os11 from "os";
|
|
|
19832
20069
|
import * as path18 from "path";
|
|
19833
20070
|
|
|
19834
20071
|
// src/mcp/tools/checkForNewAvailableFixes/CheckForNewAvailableFixesTool.ts
|
|
19835
|
-
import { z as
|
|
20072
|
+
import { z as z43 } from "zod";
|
|
19836
20073
|
|
|
19837
20074
|
// src/mcp/services/PathValidation.ts
|
|
19838
20075
|
import fs19 from "fs";
|
|
@@ -19908,7 +20145,7 @@ async function validatePath(inputPath) {
|
|
|
19908
20145
|
}
|
|
19909
20146
|
|
|
19910
20147
|
// src/mcp/tools/base/BaseTool.ts
|
|
19911
|
-
import { z as
|
|
20148
|
+
import { z as z41 } from "zod";
|
|
19912
20149
|
var BaseTool = class {
|
|
19913
20150
|
getDefinition() {
|
|
19914
20151
|
return {
|
|
@@ -19941,7 +20178,7 @@ var BaseTool = class {
|
|
|
19941
20178
|
try {
|
|
19942
20179
|
return this.inputValidationSchema.parse(args);
|
|
19943
20180
|
} catch (error) {
|
|
19944
|
-
if (error instanceof
|
|
20181
|
+
if (error instanceof z41.ZodError) {
|
|
19945
20182
|
const errorDetails = error.errors.map((e) => {
|
|
19946
20183
|
const fieldPath = e.path.length > 0 ? e.path.join(".") : "root";
|
|
19947
20184
|
const message = e.message === "Required" ? `Missing required parameter '${fieldPath}'` : `Invalid value for '${fieldPath}': ${e.message}`;
|
|
@@ -20660,13 +20897,13 @@ init_client_generates();
|
|
|
20660
20897
|
init_GitService();
|
|
20661
20898
|
import fs21 from "fs";
|
|
20662
20899
|
import path20 from "path";
|
|
20663
|
-
import { z as
|
|
20900
|
+
import { z as z42 } from "zod";
|
|
20664
20901
|
function extractPathFromPatch(patch) {
|
|
20665
20902
|
const match = patch?.match(/diff --git a\/([^\s]+) b\//);
|
|
20666
20903
|
return match?.[1] ?? null;
|
|
20667
20904
|
}
|
|
20668
20905
|
function parsedIssueTypeRes(issueType) {
|
|
20669
|
-
return
|
|
20906
|
+
return z42.nativeEnum(IssueType_Enum).safeParse(issueType);
|
|
20670
20907
|
}
|
|
20671
20908
|
var LocalMobbFolderService = class {
|
|
20672
20909
|
/**
|
|
@@ -23363,8 +23600,8 @@ Example payload:
|
|
|
23363
23600
|
},
|
|
23364
23601
|
required: ["path"]
|
|
23365
23602
|
});
|
|
23366
|
-
__publicField(this, "inputValidationSchema",
|
|
23367
|
-
path:
|
|
23603
|
+
__publicField(this, "inputValidationSchema", z43.object({
|
|
23604
|
+
path: z43.string().describe(
|
|
23368
23605
|
"Full local path to the cloned git repository to check for new available fixes"
|
|
23369
23606
|
)
|
|
23370
23607
|
}));
|
|
@@ -23394,7 +23631,7 @@ Example payload:
|
|
|
23394
23631
|
|
|
23395
23632
|
// src/mcp/tools/fetchAvailableFixes/FetchAvailableFixesTool.ts
|
|
23396
23633
|
init_GitService();
|
|
23397
|
-
import { z as
|
|
23634
|
+
import { z as z44 } from "zod";
|
|
23398
23635
|
|
|
23399
23636
|
// src/mcp/tools/fetchAvailableFixes/FetchAvailableFixesService.ts
|
|
23400
23637
|
init_configs();
|
|
@@ -23537,16 +23774,16 @@ Call this tool instead of ${MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES} when you only
|
|
|
23537
23774
|
},
|
|
23538
23775
|
required: ["path"]
|
|
23539
23776
|
});
|
|
23540
|
-
__publicField(this, "inputValidationSchema",
|
|
23541
|
-
path:
|
|
23777
|
+
__publicField(this, "inputValidationSchema", z44.object({
|
|
23778
|
+
path: z44.string().describe(
|
|
23542
23779
|
"Full local path to the cloned git repository to check for available fixes"
|
|
23543
23780
|
),
|
|
23544
|
-
offset:
|
|
23545
|
-
limit:
|
|
23546
|
-
fileFilter:
|
|
23781
|
+
offset: z44.number().optional().describe("Optional offset for pagination"),
|
|
23782
|
+
limit: z44.number().optional().describe("Optional maximum number of fixes to return"),
|
|
23783
|
+
fileFilter: z44.array(z44.string()).optional().describe(
|
|
23547
23784
|
"Optional list of file paths relative to the path parameter to filter fixes by. INCOMPATIBLE with fetchFixesFromAnyFile"
|
|
23548
23785
|
),
|
|
23549
|
-
fetchFixesFromAnyFile:
|
|
23786
|
+
fetchFixesFromAnyFile: z44.boolean().optional().describe(
|
|
23550
23787
|
"Optional boolean to fetch fixes for all files. INCOMPATIBLE with fileFilter"
|
|
23551
23788
|
)
|
|
23552
23789
|
}));
|
|
@@ -23611,7 +23848,7 @@ Call this tool instead of ${MCP_TOOL_SCAN_AND_FIX_VULNERABILITIES} when you only
|
|
|
23611
23848
|
};
|
|
23612
23849
|
|
|
23613
23850
|
// src/mcp/tools/mcpChecker/mcpCheckerTool.ts
|
|
23614
|
-
import
|
|
23851
|
+
import z45 from "zod";
|
|
23615
23852
|
|
|
23616
23853
|
// src/mcp/tools/mcpChecker/mcpCheckerService.ts
|
|
23617
23854
|
var _McpCheckerService = class _McpCheckerService {
|
|
@@ -23672,7 +23909,7 @@ var McpCheckerTool = class extends BaseTool {
|
|
|
23672
23909
|
__publicField(this, "displayName", "MCP Checker");
|
|
23673
23910
|
// A detailed description to guide the LLM on when and how to invoke this tool.
|
|
23674
23911
|
__publicField(this, "description", "Check the MCP servers running on this IDE against organization policies.");
|
|
23675
|
-
__publicField(this, "inputValidationSchema",
|
|
23912
|
+
__publicField(this, "inputValidationSchema", z45.object({}));
|
|
23676
23913
|
__publicField(this, "inputSchema", {
|
|
23677
23914
|
type: "object",
|
|
23678
23915
|
properties: {},
|
|
@@ -23698,7 +23935,7 @@ var McpCheckerTool = class extends BaseTool {
|
|
|
23698
23935
|
};
|
|
23699
23936
|
|
|
23700
23937
|
// src/mcp/tools/scanAndFixVulnerabilities/ScanAndFixVulnerabilitiesTool.ts
|
|
23701
|
-
import
|
|
23938
|
+
import z46 from "zod";
|
|
23702
23939
|
init_configs();
|
|
23703
23940
|
|
|
23704
23941
|
// src/mcp/tools/scanAndFixVulnerabilities/ScanAndFixVulnerabilitiesService.ts
|
|
@@ -23886,17 +24123,17 @@ Example payload:
|
|
|
23886
24123
|
"rescan": false
|
|
23887
24124
|
}`);
|
|
23888
24125
|
__publicField(this, "hasAuthentication", true);
|
|
23889
|
-
__publicField(this, "inputValidationSchema",
|
|
23890
|
-
path:
|
|
24126
|
+
__publicField(this, "inputValidationSchema", z46.object({
|
|
24127
|
+
path: z46.string().describe(
|
|
23891
24128
|
"Full local path to repository to scan and fix vulnerabilities"
|
|
23892
24129
|
),
|
|
23893
|
-
offset:
|
|
23894
|
-
limit:
|
|
23895
|
-
maxFiles:
|
|
24130
|
+
offset: z46.number().optional().describe("Optional offset for pagination"),
|
|
24131
|
+
limit: z46.number().optional().describe("Optional maximum number of results to return"),
|
|
24132
|
+
maxFiles: z46.number().optional().describe(
|
|
23896
24133
|
`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.`
|
|
23897
24134
|
),
|
|
23898
|
-
rescan:
|
|
23899
|
-
scanRecentlyChangedFiles:
|
|
24135
|
+
rescan: z46.boolean().optional().describe("Optional whether to rescan the repository"),
|
|
24136
|
+
scanRecentlyChangedFiles: z46.boolean().optional().describe(
|
|
23900
24137
|
"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."
|
|
23901
24138
|
)
|
|
23902
24139
|
}));
|
|
@@ -24204,7 +24441,7 @@ async function addScmTokenHandler(args) {
|
|
|
24204
24441
|
}
|
|
24205
24442
|
|
|
24206
24443
|
// src/features/codeium_intellij/data_collector.ts
|
|
24207
|
-
import { z as
|
|
24444
|
+
import { z as z47 } from "zod";
|
|
24208
24445
|
init_client_generates();
|
|
24209
24446
|
init_urlParser2();
|
|
24210
24447
|
|
|
@@ -24345,8 +24582,8 @@ function findRunningCodeiumLanguageServers() {
|
|
|
24345
24582
|
}
|
|
24346
24583
|
|
|
24347
24584
|
// src/features/codeium_intellij/data_collector.ts
|
|
24348
|
-
var HookDataSchema2 =
|
|
24349
|
-
trajectory_id:
|
|
24585
|
+
var HookDataSchema2 = z47.object({
|
|
24586
|
+
trajectory_id: z47.string()
|
|
24350
24587
|
});
|
|
24351
24588
|
async function processAndUploadHookData2() {
|
|
24352
24589
|
const tracePayload = await getTraceDataForHook();
|
|
@@ -24425,7 +24662,7 @@ async function processChat(client, cascadeId) {
|
|
|
24425
24662
|
let repositoryUrl;
|
|
24426
24663
|
if (repoOrigin) {
|
|
24427
24664
|
const parsed = parseScmURL(repoOrigin);
|
|
24428
|
-
if (parsed?.scmType === "GitHub" /* GitHub */) {
|
|
24665
|
+
if (parsed?.scmType === "GitHub" /* GitHub */ || parsed?.scmType === "GitLab" /* GitLab */) {
|
|
24429
24666
|
repositoryUrl = parsed.canonicalUrl;
|
|
24430
24667
|
}
|
|
24431
24668
|
}
|