mobbdev 1.1.9 → 1.1.11
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.d.mts +28 -28
- package/dist/args/commands/upload_ai_blame.mjs +29 -11
- package/dist/index.mjs +180 -126
- package/package.json +1 -1
|
@@ -51,26 +51,18 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
51
51
|
name: string;
|
|
52
52
|
parameters: string;
|
|
53
53
|
result: string;
|
|
54
|
-
accepted?: boolean | undefined;
|
|
55
54
|
rawArguments?: string | undefined;
|
|
55
|
+
accepted?: boolean | undefined;
|
|
56
56
|
}, {
|
|
57
57
|
name: string;
|
|
58
58
|
parameters: string;
|
|
59
59
|
result: string;
|
|
60
|
-
accepted?: boolean | undefined;
|
|
61
60
|
rawArguments?: string | undefined;
|
|
61
|
+
accepted?: boolean | undefined;
|
|
62
62
|
}>>;
|
|
63
63
|
}, "strip", z.ZodTypeAny, {
|
|
64
64
|
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
65
|
-
tool?: {
|
|
66
|
-
name: string;
|
|
67
|
-
parameters: string;
|
|
68
|
-
result: string;
|
|
69
|
-
accepted?: boolean | undefined;
|
|
70
|
-
rawArguments?: string | undefined;
|
|
71
|
-
} | undefined;
|
|
72
65
|
date?: Date | undefined;
|
|
73
|
-
text?: string | undefined;
|
|
74
66
|
attachedFiles?: {
|
|
75
67
|
relativePath: string;
|
|
76
68
|
startLine?: number | undefined;
|
|
@@ -79,17 +71,17 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
79
71
|
inputCount: number;
|
|
80
72
|
outputCount: number;
|
|
81
73
|
} | undefined;
|
|
82
|
-
|
|
83
|
-
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
74
|
+
text?: string | undefined;
|
|
84
75
|
tool?: {
|
|
85
76
|
name: string;
|
|
86
77
|
parameters: string;
|
|
87
78
|
result: string;
|
|
88
|
-
accepted?: boolean | undefined;
|
|
89
79
|
rawArguments?: string | undefined;
|
|
80
|
+
accepted?: boolean | undefined;
|
|
90
81
|
} | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
91
84
|
date?: Date | undefined;
|
|
92
|
-
text?: string | undefined;
|
|
93
85
|
attachedFiles?: {
|
|
94
86
|
relativePath: string;
|
|
95
87
|
startLine?: number | undefined;
|
|
@@ -98,6 +90,14 @@ declare const PromptItemZ: z.ZodObject<{
|
|
|
98
90
|
inputCount: number;
|
|
99
91
|
outputCount: number;
|
|
100
92
|
} | undefined;
|
|
93
|
+
text?: string | undefined;
|
|
94
|
+
tool?: {
|
|
95
|
+
name: string;
|
|
96
|
+
parameters: string;
|
|
97
|
+
result: string;
|
|
98
|
+
rawArguments?: string | undefined;
|
|
99
|
+
accepted?: boolean | undefined;
|
|
100
|
+
} | undefined;
|
|
101
101
|
}>;
|
|
102
102
|
type PromptItem = z.infer<typeof PromptItemZ>;
|
|
103
103
|
declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
@@ -134,26 +134,18 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
134
134
|
name: string;
|
|
135
135
|
parameters: string;
|
|
136
136
|
result: string;
|
|
137
|
-
accepted?: boolean | undefined;
|
|
138
137
|
rawArguments?: string | undefined;
|
|
138
|
+
accepted?: boolean | undefined;
|
|
139
139
|
}, {
|
|
140
140
|
name: string;
|
|
141
141
|
parameters: string;
|
|
142
142
|
result: string;
|
|
143
|
-
accepted?: boolean | undefined;
|
|
144
143
|
rawArguments?: string | undefined;
|
|
144
|
+
accepted?: boolean | undefined;
|
|
145
145
|
}>>;
|
|
146
146
|
}, "strip", z.ZodTypeAny, {
|
|
147
147
|
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
148
|
-
tool?: {
|
|
149
|
-
name: string;
|
|
150
|
-
parameters: string;
|
|
151
|
-
result: string;
|
|
152
|
-
accepted?: boolean | undefined;
|
|
153
|
-
rawArguments?: string | undefined;
|
|
154
|
-
} | undefined;
|
|
155
148
|
date?: Date | undefined;
|
|
156
|
-
text?: string | undefined;
|
|
157
149
|
attachedFiles?: {
|
|
158
150
|
relativePath: string;
|
|
159
151
|
startLine?: number | undefined;
|
|
@@ -162,17 +154,17 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
162
154
|
inputCount: number;
|
|
163
155
|
outputCount: number;
|
|
164
156
|
} | undefined;
|
|
165
|
-
|
|
166
|
-
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
157
|
+
text?: string | undefined;
|
|
167
158
|
tool?: {
|
|
168
159
|
name: string;
|
|
169
160
|
parameters: string;
|
|
170
161
|
result: string;
|
|
171
|
-
accepted?: boolean | undefined;
|
|
172
162
|
rawArguments?: string | undefined;
|
|
163
|
+
accepted?: boolean | undefined;
|
|
173
164
|
} | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
type: "USER_PROMPT" | "AI_RESPONSE" | "TOOL_EXECUTION" | "AI_THINKING";
|
|
174
167
|
date?: Date | undefined;
|
|
175
|
-
text?: string | undefined;
|
|
176
168
|
attachedFiles?: {
|
|
177
169
|
relativePath: string;
|
|
178
170
|
startLine?: number | undefined;
|
|
@@ -181,6 +173,14 @@ declare const PromptItemArrayZ: z.ZodArray<z.ZodObject<{
|
|
|
181
173
|
inputCount: number;
|
|
182
174
|
outputCount: number;
|
|
183
175
|
} | undefined;
|
|
176
|
+
text?: string | undefined;
|
|
177
|
+
tool?: {
|
|
178
|
+
name: string;
|
|
179
|
+
parameters: string;
|
|
180
|
+
result: string;
|
|
181
|
+
rawArguments?: string | undefined;
|
|
182
|
+
accepted?: boolean | undefined;
|
|
183
|
+
} | undefined;
|
|
184
184
|
}>, "many">;
|
|
185
185
|
type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
|
|
186
186
|
type UploadAiBlameOptions = {
|
|
@@ -90,6 +90,7 @@ var init_GitService = __esm({
|
|
|
90
90
|
|
|
91
91
|
// src/args/commands/upload_ai_blame.ts
|
|
92
92
|
import fsPromises2 from "fs/promises";
|
|
93
|
+
import * as os2 from "os";
|
|
93
94
|
import path6 from "path";
|
|
94
95
|
import chalk3 from "chalk";
|
|
95
96
|
import { withFile } from "tmp-promise";
|
|
@@ -4116,8 +4117,8 @@ var IssueTypeAndLanguageZ = z12.object({
|
|
|
4116
4117
|
import { z as z13 } from "zod";
|
|
4117
4118
|
var ADO_PREFIX_PATH = "tfs";
|
|
4118
4119
|
function detectAdoUrl(args) {
|
|
4119
|
-
const { pathname, hostname, scmType } = args;
|
|
4120
|
-
const hostnameParts =
|
|
4120
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
4121
|
+
const hostnameParts = hostname2.split(".");
|
|
4121
4122
|
const adoCloudHostname = new URL(scmCloudUrl.Ado).hostname;
|
|
4122
4123
|
const prefixPath = pathname.at(0)?.toLowerCase() === ADO_PREFIX_PATH ? ADO_PREFIX_PATH : "";
|
|
4123
4124
|
const normalizedPath = prefixPath ? pathname.slice(1) : pathname;
|
|
@@ -4146,7 +4147,7 @@ function detectAdoUrl(args) {
|
|
|
4146
4147
|
};
|
|
4147
4148
|
}
|
|
4148
4149
|
}
|
|
4149
|
-
if (
|
|
4150
|
+
if (hostname2 === adoCloudHostname || scmType === "Ado" /* Ado */) {
|
|
4150
4151
|
if (normalizedPath[normalizedPath.length - 2] === "_git") {
|
|
4151
4152
|
if (normalizedPath.length === 3) {
|
|
4152
4153
|
const [organization, _git, repoName] = normalizedPath;
|
|
@@ -4174,9 +4175,9 @@ function detectAdoUrl(args) {
|
|
|
4174
4175
|
return null;
|
|
4175
4176
|
}
|
|
4176
4177
|
function detectGithubUrl(args) {
|
|
4177
|
-
const { pathname, hostname, scmType } = args;
|
|
4178
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
4178
4179
|
const githubHostname = new URL(scmCloudUrl.GitHub).hostname;
|
|
4179
|
-
if (
|
|
4180
|
+
if (hostname2 === githubHostname || scmType === "GitHub" /* GitHub */) {
|
|
4180
4181
|
if (pathname.length === 2) {
|
|
4181
4182
|
return {
|
|
4182
4183
|
scmType: "GitHub" /* GitHub */,
|
|
@@ -4188,9 +4189,9 @@ function detectGithubUrl(args) {
|
|
|
4188
4189
|
return null;
|
|
4189
4190
|
}
|
|
4190
4191
|
function detectGitlabUrl(args) {
|
|
4191
|
-
const { pathname, hostname, scmType } = args;
|
|
4192
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
4192
4193
|
const gitlabHostname = new URL(scmCloudUrl.GitLab).hostname;
|
|
4193
|
-
if (
|
|
4194
|
+
if (hostname2 === gitlabHostname || scmType === "GitLab" /* GitLab */) {
|
|
4194
4195
|
if (pathname.length >= 2) {
|
|
4195
4196
|
return {
|
|
4196
4197
|
scmType: "GitLab" /* GitLab */,
|
|
@@ -4202,9 +4203,9 @@ function detectGitlabUrl(args) {
|
|
|
4202
4203
|
return null;
|
|
4203
4204
|
}
|
|
4204
4205
|
function detectBitbucketUrl(args) {
|
|
4205
|
-
const { pathname, hostname, scmType } = args;
|
|
4206
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
4206
4207
|
const bitbucketHostname = new URL(scmCloudUrl.Bitbucket).hostname;
|
|
4207
|
-
if (
|
|
4208
|
+
if (hostname2 === bitbucketHostname || scmType === "Bitbucket" /* Bitbucket */) {
|
|
4208
4209
|
if (pathname.length === 2) {
|
|
4209
4210
|
return {
|
|
4210
4211
|
scmType: "Bitbucket" /* Bitbucket */,
|
|
@@ -5289,6 +5290,18 @@ var PromptItemZ = z26.object({
|
|
|
5289
5290
|
}).optional()
|
|
5290
5291
|
});
|
|
5291
5292
|
var PromptItemArrayZ = z26.array(PromptItemZ);
|
|
5293
|
+
function getSystemInfo() {
|
|
5294
|
+
let userName;
|
|
5295
|
+
try {
|
|
5296
|
+
userName = os2.userInfo().username;
|
|
5297
|
+
} catch {
|
|
5298
|
+
userName = void 0;
|
|
5299
|
+
}
|
|
5300
|
+
return {
|
|
5301
|
+
computerName: os2.hostname(),
|
|
5302
|
+
userName
|
|
5303
|
+
};
|
|
5304
|
+
}
|
|
5292
5305
|
function uploadAiBlameBuilder(args) {
|
|
5293
5306
|
return args.option("prompt", {
|
|
5294
5307
|
type: "string",
|
|
@@ -5391,6 +5404,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5391
5404
|
throw new Error(errorMsg);
|
|
5392
5405
|
}
|
|
5393
5406
|
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
5407
|
+
const { computerName, userName } = getSystemInfo();
|
|
5394
5408
|
const sessions = [];
|
|
5395
5409
|
for (let i = 0; i < prompts.length; i++) {
|
|
5396
5410
|
const promptPath = String(prompts[i]);
|
|
@@ -5414,7 +5428,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5414
5428
|
aiResponseAt: responseTimes[i] || nowIso,
|
|
5415
5429
|
model: models[i],
|
|
5416
5430
|
toolName: tools[i],
|
|
5417
|
-
blameType: blameTypes[i] || "CHAT" /* Chat
|
|
5431
|
+
blameType: blameTypes[i] || "CHAT" /* Chat */,
|
|
5432
|
+
computerName,
|
|
5433
|
+
userName
|
|
5418
5434
|
});
|
|
5419
5435
|
}
|
|
5420
5436
|
const authenticatedClient = await getAuthenticatedGQLClient({
|
|
@@ -5465,7 +5481,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5465
5481
|
aiResponseAt: s.aiResponseAt,
|
|
5466
5482
|
model: s.model,
|
|
5467
5483
|
toolName: s.toolName,
|
|
5468
|
-
blameType: s.blameType
|
|
5484
|
+
blameType: s.blameType,
|
|
5485
|
+
computerName: s.computerName,
|
|
5486
|
+
userName: s.userName
|
|
5469
5487
|
};
|
|
5470
5488
|
});
|
|
5471
5489
|
const sanitizedFinalizeSessions = await sanitizeData(
|
package/dist/index.mjs
CHANGED
|
@@ -5405,8 +5405,8 @@ import { z as z12 } from "zod";
|
|
|
5405
5405
|
var ADO_PREFIX_PATH = "tfs";
|
|
5406
5406
|
var NAME_REGEX = /[a-z0-9\-_.+]+/i;
|
|
5407
5407
|
function detectAdoUrl(args) {
|
|
5408
|
-
const { pathname, hostname, scmType } = args;
|
|
5409
|
-
const hostnameParts =
|
|
5408
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
5409
|
+
const hostnameParts = hostname2.split(".");
|
|
5410
5410
|
const adoCloudHostname = new URL(scmCloudUrl.Ado).hostname;
|
|
5411
5411
|
const prefixPath = pathname.at(0)?.toLowerCase() === ADO_PREFIX_PATH ? ADO_PREFIX_PATH : "";
|
|
5412
5412
|
const normalizedPath = prefixPath ? pathname.slice(1) : pathname;
|
|
@@ -5435,7 +5435,7 @@ function detectAdoUrl(args) {
|
|
|
5435
5435
|
};
|
|
5436
5436
|
}
|
|
5437
5437
|
}
|
|
5438
|
-
if (
|
|
5438
|
+
if (hostname2 === adoCloudHostname || scmType === "Ado" /* Ado */) {
|
|
5439
5439
|
if (normalizedPath[normalizedPath.length - 2] === "_git") {
|
|
5440
5440
|
if (normalizedPath.length === 3) {
|
|
5441
5441
|
const [organization, _git, repoName] = normalizedPath;
|
|
@@ -5463,9 +5463,9 @@ function detectAdoUrl(args) {
|
|
|
5463
5463
|
return null;
|
|
5464
5464
|
}
|
|
5465
5465
|
function detectGithubUrl(args) {
|
|
5466
|
-
const { pathname, hostname, scmType } = args;
|
|
5466
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
5467
5467
|
const githubHostname = new URL(scmCloudUrl.GitHub).hostname;
|
|
5468
|
-
if (
|
|
5468
|
+
if (hostname2 === githubHostname || scmType === "GitHub" /* GitHub */) {
|
|
5469
5469
|
if (pathname.length === 2) {
|
|
5470
5470
|
return {
|
|
5471
5471
|
scmType: "GitHub" /* GitHub */,
|
|
@@ -5477,9 +5477,9 @@ function detectGithubUrl(args) {
|
|
|
5477
5477
|
return null;
|
|
5478
5478
|
}
|
|
5479
5479
|
function detectGitlabUrl(args) {
|
|
5480
|
-
const { pathname, hostname, scmType } = args;
|
|
5480
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
5481
5481
|
const gitlabHostname = new URL(scmCloudUrl.GitLab).hostname;
|
|
5482
|
-
if (
|
|
5482
|
+
if (hostname2 === gitlabHostname || scmType === "GitLab" /* GitLab */) {
|
|
5483
5483
|
if (pathname.length >= 2) {
|
|
5484
5484
|
return {
|
|
5485
5485
|
scmType: "GitLab" /* GitLab */,
|
|
@@ -5491,9 +5491,9 @@ function detectGitlabUrl(args) {
|
|
|
5491
5491
|
return null;
|
|
5492
5492
|
}
|
|
5493
5493
|
function detectBitbucketUrl(args) {
|
|
5494
|
-
const { pathname, hostname, scmType } = args;
|
|
5494
|
+
const { pathname, hostname: hostname2, scmType } = args;
|
|
5495
5495
|
const bitbucketHostname = new URL(scmCloudUrl.Bitbucket).hostname;
|
|
5496
|
-
if (
|
|
5496
|
+
if (hostname2 === bitbucketHostname || scmType === "Bitbucket" /* Bitbucket */) {
|
|
5497
5497
|
if (pathname.length === 2) {
|
|
5498
5498
|
return {
|
|
5499
5499
|
scmType: "Bitbucket" /* Bitbucket */,
|
|
@@ -5522,10 +5522,10 @@ function getRepoInfo(args) {
|
|
|
5522
5522
|
function parseSshUrl(scmURL, scmType) {
|
|
5523
5523
|
const sshMatch = scmURL.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
5524
5524
|
if (!sshMatch) return null;
|
|
5525
|
-
const
|
|
5525
|
+
const hostname2 = sshMatch[1];
|
|
5526
5526
|
const pathPart = sshMatch[2];
|
|
5527
|
-
if (!
|
|
5528
|
-
const normalizedHostname =
|
|
5527
|
+
if (!hostname2 || !pathPart) return null;
|
|
5528
|
+
const normalizedHostname = hostname2.toLowerCase();
|
|
5529
5529
|
let projectPath = pathPart;
|
|
5530
5530
|
if (normalizedHostname === "ssh.dev.azure.com" && projectPath.startsWith("v3/")) {
|
|
5531
5531
|
projectPath = projectPath.substring(3);
|
|
@@ -5613,11 +5613,11 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5613
5613
|
if (sshResult) return sshResult;
|
|
5614
5614
|
try {
|
|
5615
5615
|
const url = new URL(scmURL);
|
|
5616
|
-
const
|
|
5616
|
+
const hostname2 = url.hostname.toLowerCase();
|
|
5617
5617
|
const projectPath = url.pathname.substring(1).replace(/.git$/i, "");
|
|
5618
5618
|
const repo = getRepoInfo({
|
|
5619
5619
|
pathname: projectPath.split("/"),
|
|
5620
|
-
hostname,
|
|
5620
|
+
hostname: hostname2,
|
|
5621
5621
|
scmType
|
|
5622
5622
|
});
|
|
5623
5623
|
if (!repo) {
|
|
@@ -5627,7 +5627,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5627
5627
|
new URL(scmCloudUrl.Bitbucket).hostname,
|
|
5628
5628
|
new URL(scmCloudUrl.Ado).hostname
|
|
5629
5629
|
];
|
|
5630
|
-
if (knownHosts2.includes(
|
|
5630
|
+
if (knownHosts2.includes(hostname2)) {
|
|
5631
5631
|
return null;
|
|
5632
5632
|
}
|
|
5633
5633
|
const pathElements = projectPath.split("/").filter(Boolean);
|
|
@@ -5638,7 +5638,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5638
5638
|
const repoName2 = pathElements[pathElements.length - 1] || "";
|
|
5639
5639
|
return {
|
|
5640
5640
|
scmType: "Unknown",
|
|
5641
|
-
hostname,
|
|
5641
|
+
hostname: hostname2,
|
|
5642
5642
|
organization: organization2,
|
|
5643
5643
|
projectPath,
|
|
5644
5644
|
repoName: repoName2,
|
|
@@ -5651,7 +5651,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5651
5651
|
if (!organization.match(NAME_REGEX) || !repoName.match(NAME_REGEX))
|
|
5652
5652
|
return null;
|
|
5653
5653
|
const res = {
|
|
5654
|
-
hostname,
|
|
5654
|
+
hostname: hostname2,
|
|
5655
5655
|
organization,
|
|
5656
5656
|
projectPath,
|
|
5657
5657
|
repoName,
|
|
@@ -5840,8 +5840,8 @@ function normalizeUrl(repoUrl) {
|
|
|
5840
5840
|
}
|
|
5841
5841
|
const sshMatch = trimmedUrl.match(sshPattern);
|
|
5842
5842
|
if (sshMatch) {
|
|
5843
|
-
const [_all,
|
|
5844
|
-
trimmedUrl = `https://${
|
|
5843
|
+
const [_all, hostname2, reporPath] = sshMatch;
|
|
5844
|
+
trimmedUrl = `https://${hostname2}/${reporPath}`;
|
|
5845
5845
|
}
|
|
5846
5846
|
return trimmedUrl;
|
|
5847
5847
|
}
|
|
@@ -5872,17 +5872,17 @@ function getCloudScmLibTypeFromUrl(url) {
|
|
|
5872
5872
|
return void 0;
|
|
5873
5873
|
}
|
|
5874
5874
|
const urlObject = new URL(url);
|
|
5875
|
-
const
|
|
5876
|
-
if (
|
|
5875
|
+
const hostname2 = urlObject.hostname.toLowerCase();
|
|
5876
|
+
if (hostname2 === scmCloudHostname.GitLab) {
|
|
5877
5877
|
return "GITLAB" /* GITLAB */;
|
|
5878
5878
|
}
|
|
5879
|
-
if (
|
|
5879
|
+
if (hostname2 === scmCloudHostname.GitHub) {
|
|
5880
5880
|
return "GITHUB" /* GITHUB */;
|
|
5881
5881
|
}
|
|
5882
|
-
if (
|
|
5882
|
+
if (hostname2 === scmCloudHostname.Ado || hostname2.endsWith(".visualstudio.com")) {
|
|
5883
5883
|
return "ADO" /* ADO */;
|
|
5884
5884
|
}
|
|
5885
|
-
if (
|
|
5885
|
+
if (hostname2 === scmCloudHostname.Bitbucket) {
|
|
5886
5886
|
return "BITBUCKET" /* BITBUCKET */;
|
|
5887
5887
|
}
|
|
5888
5888
|
return void 0;
|
|
@@ -6038,7 +6038,7 @@ function parseAdoOwnerAndRepo(adoUrl) {
|
|
|
6038
6038
|
projectName,
|
|
6039
6039
|
projectPath,
|
|
6040
6040
|
pathElements,
|
|
6041
|
-
hostname,
|
|
6041
|
+
hostname: hostname2,
|
|
6042
6042
|
protocol
|
|
6043
6043
|
} = parsingResult;
|
|
6044
6044
|
return {
|
|
@@ -6048,7 +6048,7 @@ function parseAdoOwnerAndRepo(adoUrl) {
|
|
|
6048
6048
|
projectPath,
|
|
6049
6049
|
pathElements,
|
|
6050
6050
|
prefixPath: parsingResult.prefixPath,
|
|
6051
|
-
origin: `${protocol}//${
|
|
6051
|
+
origin: `${protocol}//${hostname2}`
|
|
6052
6052
|
};
|
|
6053
6053
|
}
|
|
6054
6054
|
function isValidAdoRepo(url) {
|
|
@@ -6635,6 +6635,18 @@ var SCMLib = class {
|
|
|
6635
6635
|
password: accessToken
|
|
6636
6636
|
});
|
|
6637
6637
|
}
|
|
6638
|
+
/**
|
|
6639
|
+
* Fetches commits for multiple PRs in a single batch request.
|
|
6640
|
+
* This is an optimization that not all SCM providers may support efficiently.
|
|
6641
|
+
* Default implementation throws - override in subclasses that support batching.
|
|
6642
|
+
*
|
|
6643
|
+
* @param repoUrl - Repository URL
|
|
6644
|
+
* @param prNumbers - Array of PR numbers to fetch commits for
|
|
6645
|
+
* @returns Map of PR number to array of commit SHAs
|
|
6646
|
+
*/
|
|
6647
|
+
async getPrCommitsBatch(_repoUrl, _prNumbers) {
|
|
6648
|
+
throw new Error("getPrCommitsBatch not implemented for this SCM provider");
|
|
6649
|
+
}
|
|
6638
6650
|
getAccessToken() {
|
|
6639
6651
|
return this.accessToken || "";
|
|
6640
6652
|
}
|
|
@@ -7242,8 +7254,8 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7242
7254
|
if (!parseScmURLRes) {
|
|
7243
7255
|
throw new InvalidRepoUrlError("invalid repo url");
|
|
7244
7256
|
}
|
|
7245
|
-
const { protocol, hostname, organization, repoName } = parseScmURLRes;
|
|
7246
|
-
const url = `${protocol}//${
|
|
7257
|
+
const { protocol, hostname: hostname2, organization, repoName } = parseScmURLRes;
|
|
7258
|
+
const url = `${protocol}//${hostname2}/${organization}/${repoName}`;
|
|
7247
7259
|
switch (authData.authType) {
|
|
7248
7260
|
case "public": {
|
|
7249
7261
|
return trimmedUrl;
|
|
@@ -7493,13 +7505,6 @@ var GET_BLAME_DOCUMENT = `
|
|
|
7493
7505
|
ranges {
|
|
7494
7506
|
commit {
|
|
7495
7507
|
oid
|
|
7496
|
-
author {
|
|
7497
|
-
user {
|
|
7498
|
-
name
|
|
7499
|
-
login
|
|
7500
|
-
}
|
|
7501
|
-
}
|
|
7502
|
-
authoredDate
|
|
7503
7508
|
}
|
|
7504
7509
|
startingLine
|
|
7505
7510
|
endingLine
|
|
@@ -7539,6 +7544,7 @@ var GITHUB_GRAPHQL_FRAGMENTS = {
|
|
|
7539
7544
|
/**
|
|
7540
7545
|
* Fragment for fetching blame data.
|
|
7541
7546
|
* Use with object(expression: $ref) on Commit type.
|
|
7547
|
+
* Note: $path placeholder must be replaced with actual file path.
|
|
7542
7548
|
*/
|
|
7543
7549
|
BLAME_RANGES: `
|
|
7544
7550
|
blame(path: "$path") {
|
|
@@ -7547,13 +7553,6 @@ var GITHUB_GRAPHQL_FRAGMENTS = {
|
|
|
7547
7553
|
endingLine
|
|
7548
7554
|
commit {
|
|
7549
7555
|
oid
|
|
7550
|
-
author {
|
|
7551
|
-
user {
|
|
7552
|
-
name
|
|
7553
|
-
login
|
|
7554
|
-
email
|
|
7555
|
-
}
|
|
7556
|
-
}
|
|
7557
7556
|
}
|
|
7558
7557
|
}
|
|
7559
7558
|
}
|
|
@@ -7717,19 +7716,27 @@ async function executeBatchGraphQL(octokit, owner, repo, config2) {
|
|
|
7717
7716
|
}
|
|
7718
7717
|
}
|
|
7719
7718
|
`;
|
|
7720
|
-
|
|
7719
|
+
let response;
|
|
7720
|
+
try {
|
|
7721
|
+
response = await octokit.graphql(query, { owner, repo });
|
|
7722
|
+
} catch (error) {
|
|
7723
|
+
const graphqlError = error;
|
|
7724
|
+
if (graphqlError.data?.repository) {
|
|
7725
|
+
response = graphqlError.data;
|
|
7726
|
+
} else {
|
|
7727
|
+
throw error;
|
|
7728
|
+
}
|
|
7729
|
+
}
|
|
7721
7730
|
const result = /* @__PURE__ */ new Map();
|
|
7722
7731
|
items.forEach((item, index) => {
|
|
7723
7732
|
const data = response.repository[`${aliasPrefix}${index}`];
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
result.set(item, extracted);
|
|
7732
|
-
}
|
|
7733
|
+
const extracted = extractResult(
|
|
7734
|
+
data || {},
|
|
7735
|
+
item,
|
|
7736
|
+
index
|
|
7737
|
+
);
|
|
7738
|
+
if (extracted !== void 0) {
|
|
7739
|
+
result.set(item, extracted);
|
|
7733
7740
|
}
|
|
7734
7741
|
});
|
|
7735
7742
|
return result;
|
|
@@ -7875,9 +7882,15 @@ function getGithubSdk(params = {}) {
|
|
|
7875
7882
|
}));
|
|
7876
7883
|
} catch (e) {
|
|
7877
7884
|
if (e instanceof RequestError && e.status === 401) {
|
|
7885
|
+
console.warn(
|
|
7886
|
+
"GitHub API returned 401 Unauthorized when listing repos - token may be expired or lack repo scope"
|
|
7887
|
+
);
|
|
7878
7888
|
return [];
|
|
7879
7889
|
}
|
|
7880
7890
|
if (e instanceof RequestError && e.status === 404) {
|
|
7891
|
+
console.warn(
|
|
7892
|
+
"GitHub API returned 404 Not Found when listing repos - user may not exist"
|
|
7893
|
+
);
|
|
7881
7894
|
return [];
|
|
7882
7895
|
}
|
|
7883
7896
|
throw e;
|
|
@@ -8023,13 +8036,42 @@ function getGithubSdk(params = {}) {
|
|
|
8023
8036
|
(range) => ({
|
|
8024
8037
|
startingLine: range.startingLine,
|
|
8025
8038
|
endingLine: range.endingLine,
|
|
8026
|
-
commitSha: range.commit.oid
|
|
8027
|
-
email: range.commit.author.user?.email || "",
|
|
8028
|
-
name: range.commit.author.user?.name || "",
|
|
8029
|
-
login: range.commit.author.user?.login || ""
|
|
8039
|
+
commitSha: range.commit.oid
|
|
8030
8040
|
})
|
|
8031
8041
|
);
|
|
8032
8042
|
},
|
|
8043
|
+
/**
|
|
8044
|
+
* Fetches commits for multiple PRs in a single GraphQL request.
|
|
8045
|
+
* This is much more efficient than making N separate REST API calls.
|
|
8046
|
+
*
|
|
8047
|
+
* @param params.owner - Repository owner
|
|
8048
|
+
* @param params.repo - Repository name
|
|
8049
|
+
* @param params.prNumbers - Array of PR numbers to fetch commits for
|
|
8050
|
+
* @returns Map of PR number to array of commit SHAs
|
|
8051
|
+
*/
|
|
8052
|
+
async getPrCommitsBatch(params2) {
|
|
8053
|
+
return executeBatchGraphQL(octokit, params2.owner, params2.repo, {
|
|
8054
|
+
items: params2.prNumbers,
|
|
8055
|
+
aliasPrefix: "prCommits",
|
|
8056
|
+
buildFragment: (prNumber, index) => `
|
|
8057
|
+
prCommits${index}: pullRequest(number: ${prNumber}) {
|
|
8058
|
+
commits(first: 100) {
|
|
8059
|
+
nodes {
|
|
8060
|
+
commit {
|
|
8061
|
+
oid
|
|
8062
|
+
}
|
|
8063
|
+
}
|
|
8064
|
+
}
|
|
8065
|
+
}`,
|
|
8066
|
+
extractResult: (data) => {
|
|
8067
|
+
const prData = data;
|
|
8068
|
+
if (prData?.commits?.nodes) {
|
|
8069
|
+
return prData.commits.nodes.map((node) => node.commit.oid);
|
|
8070
|
+
}
|
|
8071
|
+
return [];
|
|
8072
|
+
}
|
|
8073
|
+
});
|
|
8074
|
+
},
|
|
8033
8075
|
// todo: refactor the name for this function
|
|
8034
8076
|
async createPr(params2) {
|
|
8035
8077
|
const { sourceRepoUrl, filesPaths, userRepoUrl, title, body } = params2;
|
|
@@ -8250,7 +8292,7 @@ function getGithubSdk(params = {}) {
|
|
|
8250
8292
|
},
|
|
8251
8293
|
/**
|
|
8252
8294
|
* Batch fetch blame data for multiple files via GraphQL.
|
|
8253
|
-
*
|
|
8295
|
+
* Uses GITHUB_GRAPHQL_FRAGMENTS.BLAME_RANGES for the field selection.
|
|
8254
8296
|
*/
|
|
8255
8297
|
async getBlameBatch(params2) {
|
|
8256
8298
|
return executeBatchGraphQL(octokit, params2.owner, params2.repo, {
|
|
@@ -8259,15 +8301,7 @@ function getGithubSdk(params = {}) {
|
|
|
8259
8301
|
buildFragment: (path22, index) => `
|
|
8260
8302
|
file${index}: object(expression: "${params2.ref}") {
|
|
8261
8303
|
... on Commit {
|
|
8262
|
-
|
|
8263
|
-
ranges {
|
|
8264
|
-
startingLine
|
|
8265
|
-
endingLine
|
|
8266
|
-
commit {
|
|
8267
|
-
oid
|
|
8268
|
-
}
|
|
8269
|
-
}
|
|
8270
|
-
}
|
|
8304
|
+
${GITHUB_GRAPHQL_FRAGMENTS.BLAME_RANGES.replace("$path", path22)}
|
|
8271
8305
|
}
|
|
8272
8306
|
}`,
|
|
8273
8307
|
extractResult: (data) => {
|
|
@@ -8276,11 +8310,7 @@ function getGithubSdk(params = {}) {
|
|
|
8276
8310
|
return fileData.blame.ranges.map((range) => ({
|
|
8277
8311
|
startingLine: range.startingLine,
|
|
8278
8312
|
endingLine: range.endingLine,
|
|
8279
|
-
commitSha: range.commit.oid
|
|
8280
|
-
// This is an urgent fix. We need to later remove these fields from the return type and propagate the change.
|
|
8281
|
-
email: "",
|
|
8282
|
-
name: "",
|
|
8283
|
-
login: ""
|
|
8313
|
+
commitSha: range.commit.oid
|
|
8284
8314
|
}));
|
|
8285
8315
|
}
|
|
8286
8316
|
return void 0;
|
|
@@ -8451,8 +8481,8 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8451
8481
|
if (!res) {
|
|
8452
8482
|
throw new InvalidRepoUrlError("invalid repo url");
|
|
8453
8483
|
}
|
|
8454
|
-
const { protocol, hostname, organization, repoName } = res;
|
|
8455
|
-
const downloadUrl = isGithubOnPrem(this.url) ? `${protocol}//${
|
|
8484
|
+
const { protocol, hostname: hostname2, organization, repoName } = res;
|
|
8485
|
+
const downloadUrl = isGithubOnPrem(this.url) ? `${protocol}//${hostname2}/api/v3/repos/${organization}/${repoName}/zipball/${sha}` : `https://api.${hostname2}/repos/${organization}/${repoName}/zipball/${sha}`;
|
|
8456
8486
|
return Promise.resolve(downloadUrl);
|
|
8457
8487
|
}
|
|
8458
8488
|
async _getUsernameForAuthUrl() {
|
|
@@ -8681,11 +8711,7 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8681
8711
|
})
|
|
8682
8712
|
)
|
|
8683
8713
|
);
|
|
8684
|
-
const diffLines = await this._attributeLinesViaBlame(
|
|
8685
|
-
pr.head.ref,
|
|
8686
|
-
filesRes.data,
|
|
8687
|
-
commits
|
|
8688
|
-
);
|
|
8714
|
+
const diffLines = filesRes ? await this._attributeLinesViaBlame(pr.head.ref, filesRes.data, commits) : [];
|
|
8689
8715
|
return {
|
|
8690
8716
|
diff: prDiff,
|
|
8691
8717
|
createdAt: new Date(pr.created_at),
|
|
@@ -8743,6 +8769,19 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8743
8769
|
});
|
|
8744
8770
|
return submitRequests;
|
|
8745
8771
|
}
|
|
8772
|
+
/**
|
|
8773
|
+
* Fetches commits for multiple PRs in a single GraphQL request.
|
|
8774
|
+
* Much more efficient than calling getSubmitRequestDiff for each PR.
|
|
8775
|
+
*
|
|
8776
|
+
* @param repoUrl - Repository URL
|
|
8777
|
+
* @param prNumbers - Array of PR numbers to fetch commits for
|
|
8778
|
+
* @returns Map of PR number to array of commit SHAs
|
|
8779
|
+
*/
|
|
8780
|
+
async getPrCommitsBatch(repoUrl, prNumbers) {
|
|
8781
|
+
this._validateAccessToken();
|
|
8782
|
+
const { owner, repo } = parseGithubOwnerAndRepo(repoUrl);
|
|
8783
|
+
return this.githubSdk.getPrCommitsBatch({ owner, repo, prNumbers });
|
|
8784
|
+
}
|
|
8746
8785
|
/**
|
|
8747
8786
|
* Parse a Linear ticket from URL and name
|
|
8748
8787
|
* Returns null if invalid or missing data
|
|
@@ -9211,10 +9250,7 @@ async function getGitlabBlameRanges({ ref, gitlabUrl, path: path22 }, options) {
|
|
|
9211
9250
|
return {
|
|
9212
9251
|
startingLine: oldLineNumber,
|
|
9213
9252
|
endingLine: lineNumber - 1,
|
|
9214
|
-
commitSha: range.commit.id
|
|
9215
|
-
login: range.commit.author_email,
|
|
9216
|
-
email: range.commit.author_email,
|
|
9217
|
-
name: range.commit.author_name
|
|
9253
|
+
commitSha: range.commit.id
|
|
9218
9254
|
};
|
|
9219
9255
|
});
|
|
9220
9256
|
}
|
|
@@ -12108,8 +12144,8 @@ if (typeof __filename !== "undefined") {
|
|
|
12108
12144
|
}
|
|
12109
12145
|
var costumeRequire = createRequire(moduleUrl);
|
|
12110
12146
|
var getCheckmarxPath = () => {
|
|
12111
|
-
const
|
|
12112
|
-
const cxFileName =
|
|
12147
|
+
const os11 = type();
|
|
12148
|
+
const cxFileName = os11 === "Windows_NT" ? "cx.exe" : "cx";
|
|
12113
12149
|
try {
|
|
12114
12150
|
return costumeRequire.resolve(`.bin/${cxFileName}`);
|
|
12115
12151
|
} catch (e) {
|
|
@@ -12467,17 +12503,17 @@ function getBrokerHosts(userOrgsAnUserOrgRoles) {
|
|
|
12467
12503
|
}
|
|
12468
12504
|
async function getScmTokenInfo(params) {
|
|
12469
12505
|
const { gqlClient, repo } = params;
|
|
12470
|
-
const
|
|
12471
|
-
if (!
|
|
12506
|
+
const userInfo2 = await gqlClient.getUserInfo();
|
|
12507
|
+
if (!userInfo2) {
|
|
12472
12508
|
throw new Error("userInfo is null");
|
|
12473
12509
|
}
|
|
12474
|
-
const scmConfigs = getFromArraySafe(
|
|
12510
|
+
const scmConfigs = getFromArraySafe(userInfo2.scmConfigs);
|
|
12475
12511
|
return getScmConfig({
|
|
12476
12512
|
url: repo,
|
|
12477
12513
|
scmConfigs,
|
|
12478
12514
|
includeOrgTokens: false,
|
|
12479
12515
|
brokerHosts: getBrokerHosts(
|
|
12480
|
-
|
|
12516
|
+
userInfo2.userOrganizationsAndUserOrganizationRoles
|
|
12481
12517
|
)
|
|
12482
12518
|
});
|
|
12483
12519
|
}
|
|
@@ -12745,16 +12781,16 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
12745
12781
|
);
|
|
12746
12782
|
await open3(scmAuthUrl2);
|
|
12747
12783
|
for (let i = 0; i < LOGIN_MAX_WAIT / LOGIN_CHECK_DELAY; i++) {
|
|
12748
|
-
const
|
|
12749
|
-
if (!
|
|
12784
|
+
const userInfo2 = await gqlClient.getUserInfo();
|
|
12785
|
+
if (!userInfo2) {
|
|
12750
12786
|
throw new CliError2("User info not found");
|
|
12751
12787
|
}
|
|
12752
|
-
const scmConfigs = getFromArraySafe(
|
|
12788
|
+
const scmConfigs = getFromArraySafe(userInfo2.scmConfigs);
|
|
12753
12789
|
const tokenInfo2 = getScmConfig({
|
|
12754
12790
|
url: repoUrl,
|
|
12755
12791
|
scmConfigs,
|
|
12756
12792
|
brokerHosts: getBrokerHosts(
|
|
12757
|
-
|
|
12793
|
+
userInfo2.userOrganizationsAndUserOrganizationRoles
|
|
12758
12794
|
),
|
|
12759
12795
|
includeOrgTokens: false
|
|
12760
12796
|
});
|
|
@@ -13258,6 +13294,7 @@ import { z as z32 } from "zod";
|
|
|
13258
13294
|
|
|
13259
13295
|
// src/args/commands/upload_ai_blame.ts
|
|
13260
13296
|
import fsPromises3 from "fs/promises";
|
|
13297
|
+
import * as os2 from "os";
|
|
13261
13298
|
import path11 from "path";
|
|
13262
13299
|
import chalk9 from "chalk";
|
|
13263
13300
|
import { withFile } from "tmp-promise";
|
|
@@ -13424,6 +13461,18 @@ var PromptItemZ = z31.object({
|
|
|
13424
13461
|
}).optional()
|
|
13425
13462
|
});
|
|
13426
13463
|
var PromptItemArrayZ = z31.array(PromptItemZ);
|
|
13464
|
+
function getSystemInfo() {
|
|
13465
|
+
let userName;
|
|
13466
|
+
try {
|
|
13467
|
+
userName = os2.userInfo().username;
|
|
13468
|
+
} catch {
|
|
13469
|
+
userName = void 0;
|
|
13470
|
+
}
|
|
13471
|
+
return {
|
|
13472
|
+
computerName: os2.hostname(),
|
|
13473
|
+
userName
|
|
13474
|
+
};
|
|
13475
|
+
}
|
|
13427
13476
|
function uploadAiBlameBuilder(args) {
|
|
13428
13477
|
return args.option("prompt", {
|
|
13429
13478
|
type: "string",
|
|
@@ -13526,6 +13575,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13526
13575
|
throw new Error(errorMsg);
|
|
13527
13576
|
}
|
|
13528
13577
|
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
13578
|
+
const { computerName, userName } = getSystemInfo();
|
|
13529
13579
|
const sessions = [];
|
|
13530
13580
|
for (let i = 0; i < prompts.length; i++) {
|
|
13531
13581
|
const promptPath = String(prompts[i]);
|
|
@@ -13549,7 +13599,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13549
13599
|
aiResponseAt: responseTimes[i] || nowIso,
|
|
13550
13600
|
model: models[i],
|
|
13551
13601
|
toolName: tools[i],
|
|
13552
|
-
blameType: blameTypes[i] || "CHAT" /* Chat
|
|
13602
|
+
blameType: blameTypes[i] || "CHAT" /* Chat */,
|
|
13603
|
+
computerName,
|
|
13604
|
+
userName
|
|
13553
13605
|
});
|
|
13554
13606
|
}
|
|
13555
13607
|
const authenticatedClient = await getAuthenticatedGQLClient({
|
|
@@ -13600,7 +13652,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13600
13652
|
aiResponseAt: s.aiResponseAt,
|
|
13601
13653
|
model: s.model,
|
|
13602
13654
|
toolName: s.toolName,
|
|
13603
|
-
blameType: s.blameType
|
|
13655
|
+
blameType: s.blameType,
|
|
13656
|
+
computerName: s.computerName,
|
|
13657
|
+
userName: s.userName
|
|
13604
13658
|
};
|
|
13605
13659
|
});
|
|
13606
13660
|
const sanitizedFinalizeSessions = await sanitizeData(
|
|
@@ -13894,10 +13948,10 @@ async function processAndUploadHookData() {
|
|
|
13894
13948
|
|
|
13895
13949
|
// src/features/claude_code/install_hook.ts
|
|
13896
13950
|
import fsPromises5 from "fs/promises";
|
|
13897
|
-
import
|
|
13951
|
+
import os3 from "os";
|
|
13898
13952
|
import path12 from "path";
|
|
13899
13953
|
import chalk10 from "chalk";
|
|
13900
|
-
var CLAUDE_SETTINGS_PATH = path12.join(
|
|
13954
|
+
var CLAUDE_SETTINGS_PATH = path12.join(os3.homedir(), ".claude", "settings.json");
|
|
13901
13955
|
async function claudeSettingsExists() {
|
|
13902
13956
|
try {
|
|
13903
13957
|
await fsPromises5.access(CLAUDE_SETTINGS_PATH);
|
|
@@ -14359,7 +14413,7 @@ var GetLatestReportByRepoUrlResponseSchema = z33.object({
|
|
|
14359
14413
|
|
|
14360
14414
|
// src/mcp/services/McpAuthService.ts
|
|
14361
14415
|
import crypto2 from "crypto";
|
|
14362
|
-
import
|
|
14416
|
+
import os4 from "os";
|
|
14363
14417
|
import open4 from "open";
|
|
14364
14418
|
init_configs();
|
|
14365
14419
|
var McpAuthService = class {
|
|
@@ -14403,7 +14457,7 @@ var McpAuthService = class {
|
|
|
14403
14457
|
}
|
|
14404
14458
|
logDebug(`cli login created ${loginId}`);
|
|
14405
14459
|
const webLoginUrl2 = `${WEB_APP_URL}/mvs-login`;
|
|
14406
|
-
const browserUrl = `${webLoginUrl2}/${loginId}?hostname=${
|
|
14460
|
+
const browserUrl = `${webLoginUrl2}/${loginId}?hostname=${os4.hostname()}`;
|
|
14407
14461
|
await this.openBrowser(browserUrl, isBackgoundCall);
|
|
14408
14462
|
logDebug(`waiting for login to complete`);
|
|
14409
14463
|
let newApiToken = null;
|
|
@@ -14870,15 +14924,15 @@ var McpGQLClient = class {
|
|
|
14870
14924
|
});
|
|
14871
14925
|
return overrideValue;
|
|
14872
14926
|
}
|
|
14873
|
-
const
|
|
14874
|
-
if (!
|
|
14927
|
+
const userInfo2 = await this.getUserInfo();
|
|
14928
|
+
if (!userInfo2?.email) {
|
|
14875
14929
|
throw new Error("User email not found");
|
|
14876
14930
|
}
|
|
14877
14931
|
logDebug("[GraphQL] Calling GetUserMvsAutoFix query", {
|
|
14878
|
-
userEmail:
|
|
14932
|
+
userEmail: userInfo2.email
|
|
14879
14933
|
});
|
|
14880
14934
|
const result = await this.clientSdk.GetUserMvsAutoFix({
|
|
14881
|
-
userEmail:
|
|
14935
|
+
userEmail: userInfo2.email
|
|
14882
14936
|
});
|
|
14883
14937
|
logDebug("[GraphQL] GetUserMvsAutoFix successful", { result });
|
|
14884
14938
|
return result.user_email_notification_settings?.[0]?.mvs_auto_fix ?? true;
|
|
@@ -14905,9 +14959,9 @@ var McpGQLClient = class {
|
|
|
14905
14959
|
});
|
|
14906
14960
|
let currentUserEmail = "%@%";
|
|
14907
14961
|
try {
|
|
14908
|
-
const
|
|
14909
|
-
if (
|
|
14910
|
-
currentUserEmail = `%${
|
|
14962
|
+
const userInfo2 = await this.getUserInfo();
|
|
14963
|
+
if (userInfo2?.email) {
|
|
14964
|
+
currentUserEmail = `%${userInfo2.email}%`;
|
|
14911
14965
|
}
|
|
14912
14966
|
} catch (err) {
|
|
14913
14967
|
logDebug("[GraphQL] Failed to get user email, using default pattern", {
|
|
@@ -14984,9 +15038,9 @@ var McpGQLClient = class {
|
|
|
14984
15038
|
});
|
|
14985
15039
|
let currentUserEmail = "%@%";
|
|
14986
15040
|
try {
|
|
14987
|
-
const
|
|
14988
|
-
if (
|
|
14989
|
-
currentUserEmail = `%${
|
|
15041
|
+
const userInfo2 = await this.getUserInfo();
|
|
15042
|
+
if (userInfo2?.email) {
|
|
15043
|
+
currentUserEmail = `%${userInfo2.email}%`;
|
|
14990
15044
|
}
|
|
14991
15045
|
} catch (err) {
|
|
14992
15046
|
logDebug("[GraphQL] Failed to get user email, using default pattern", {
|
|
@@ -15064,7 +15118,7 @@ async function createAuthenticatedMcpGQLClient({
|
|
|
15064
15118
|
// src/mcp/services/McpUsageService/host.ts
|
|
15065
15119
|
import { execSync } from "child_process";
|
|
15066
15120
|
import fs11 from "fs";
|
|
15067
|
-
import
|
|
15121
|
+
import os5 from "os";
|
|
15068
15122
|
import path13 from "path";
|
|
15069
15123
|
var IDEs = ["cursor", "windsurf", "webstorm", "vscode", "claude"];
|
|
15070
15124
|
var runCommand = (cmd) => {
|
|
@@ -15079,7 +15133,7 @@ var gitInfo = {
|
|
|
15079
15133
|
email: runCommand("git config user.email")
|
|
15080
15134
|
};
|
|
15081
15135
|
var getClaudeWorkspacePaths = () => {
|
|
15082
|
-
const home =
|
|
15136
|
+
const home = os5.homedir();
|
|
15083
15137
|
const claudeIdePath = path13.join(home, ".claude", "ide");
|
|
15084
15138
|
const workspacePaths = [];
|
|
15085
15139
|
if (!fs11.existsSync(claudeIdePath)) {
|
|
@@ -15108,7 +15162,7 @@ var getClaudeWorkspacePaths = () => {
|
|
|
15108
15162
|
return workspacePaths;
|
|
15109
15163
|
};
|
|
15110
15164
|
var getMCPConfigPaths = (hostName) => {
|
|
15111
|
-
const home =
|
|
15165
|
+
const home = os5.homedir();
|
|
15112
15166
|
const currentDir = process.env["WORKSPACE_FOLDER_PATHS"] || process.env["PWD"] || process.cwd();
|
|
15113
15167
|
switch (hostName.toLowerCase()) {
|
|
15114
15168
|
case "cursor":
|
|
@@ -15198,7 +15252,7 @@ var readMCPConfig = (hostName) => {
|
|
|
15198
15252
|
};
|
|
15199
15253
|
var getRunningProcesses = () => {
|
|
15200
15254
|
try {
|
|
15201
|
-
return
|
|
15255
|
+
return os5.platform() === "win32" ? execSync("tasklist", { encoding: "utf8" }) : execSync("ps aux", { encoding: "utf8" });
|
|
15202
15256
|
} catch {
|
|
15203
15257
|
return "";
|
|
15204
15258
|
}
|
|
@@ -15273,7 +15327,7 @@ var versionCommands = {
|
|
|
15273
15327
|
}
|
|
15274
15328
|
};
|
|
15275
15329
|
var getProcessInfo = (pid) => {
|
|
15276
|
-
const platform2 =
|
|
15330
|
+
const platform2 = os5.platform();
|
|
15277
15331
|
try {
|
|
15278
15332
|
if (platform2 === "linux" || platform2 === "darwin") {
|
|
15279
15333
|
const output = execSync(`ps -o pid=,ppid=,comm= -p ${pid}`, {
|
|
@@ -15392,7 +15446,7 @@ var getHostInfo = (additionalMcpList) => {
|
|
|
15392
15446
|
const config2 = allConfigs[ide] || null;
|
|
15393
15447
|
const ideName = ide.charAt(0).toUpperCase() + ide.slice(1) || "Unknown";
|
|
15394
15448
|
let ideVersion = "Unknown";
|
|
15395
|
-
const platform2 =
|
|
15449
|
+
const platform2 = os5.platform();
|
|
15396
15450
|
const cmds = versionCommands[ideName]?.[platform2] ?? [];
|
|
15397
15451
|
for (const cmd of cmds) {
|
|
15398
15452
|
try {
|
|
@@ -15425,14 +15479,14 @@ var getHostInfo = (additionalMcpList) => {
|
|
|
15425
15479
|
|
|
15426
15480
|
// src/mcp/services/McpUsageService/McpUsageService.ts
|
|
15427
15481
|
import fetch5 from "node-fetch";
|
|
15428
|
-
import
|
|
15482
|
+
import os7 from "os";
|
|
15429
15483
|
import { v4 as uuidv43, v5 as uuidv5 } from "uuid";
|
|
15430
15484
|
init_configs();
|
|
15431
15485
|
|
|
15432
15486
|
// src/mcp/services/McpUsageService/system.ts
|
|
15433
15487
|
init_configs();
|
|
15434
15488
|
import fs12 from "fs";
|
|
15435
|
-
import
|
|
15489
|
+
import os6 from "os";
|
|
15436
15490
|
import path14 from "path";
|
|
15437
15491
|
var MAX_DEPTH = 2;
|
|
15438
15492
|
var patterns = ["mcp", "claude"];
|
|
@@ -15467,8 +15521,8 @@ var searchDir = async (dir, depth = 0) => {
|
|
|
15467
15521
|
};
|
|
15468
15522
|
var findSystemMCPConfigs = async () => {
|
|
15469
15523
|
try {
|
|
15470
|
-
const home =
|
|
15471
|
-
const platform2 =
|
|
15524
|
+
const home = os6.homedir();
|
|
15525
|
+
const platform2 = os6.platform();
|
|
15472
15526
|
const knownDirs = platform2 === "win32" ? [
|
|
15473
15527
|
path14.join(home, ".cursor"),
|
|
15474
15528
|
path14.join(home, "Documents"),
|
|
@@ -15540,7 +15594,7 @@ var McpUsageService = class {
|
|
|
15540
15594
|
generateHostId() {
|
|
15541
15595
|
const stored = configStore.get(this.configKey);
|
|
15542
15596
|
if (stored?.mcpHostId) return stored.mcpHostId;
|
|
15543
|
-
const interfaces =
|
|
15597
|
+
const interfaces = os7.networkInterfaces();
|
|
15544
15598
|
const macs = [];
|
|
15545
15599
|
for (const iface of Object.values(interfaces)) {
|
|
15546
15600
|
if (!iface) continue;
|
|
@@ -15548,7 +15602,7 @@ var McpUsageService = class {
|
|
|
15548
15602
|
if (net.mac && net.mac !== "00:00:00:00:00:00") macs.push(net.mac);
|
|
15549
15603
|
}
|
|
15550
15604
|
}
|
|
15551
|
-
const macString = macs.length ? macs.sort().join(",") : `${
|
|
15605
|
+
const macString = macs.length ? macs.sort().join(",") : `${os7.hostname()}-${uuidv43()}`;
|
|
15552
15606
|
const hostId = uuidv5(macString, uuidv5.DNS);
|
|
15553
15607
|
logDebug("[UsageService] Generated new host ID", { hostId });
|
|
15554
15608
|
return hostId;
|
|
@@ -15571,7 +15625,7 @@ var McpUsageService = class {
|
|
|
15571
15625
|
mcpHostId,
|
|
15572
15626
|
organizationId,
|
|
15573
15627
|
mcpVersion: packageJson.version,
|
|
15574
|
-
mcpOsName:
|
|
15628
|
+
mcpOsName: os7.platform(),
|
|
15575
15629
|
mcps: JSON.stringify(mcps),
|
|
15576
15630
|
status,
|
|
15577
15631
|
userName: user.name,
|
|
@@ -17894,7 +17948,7 @@ For a complete security audit workflow, use the \`full-security-audit\` prompt.
|
|
|
17894
17948
|
|
|
17895
17949
|
// src/mcp/services/McpDetectionService/CursorMcpDetectionService.ts
|
|
17896
17950
|
import * as fs15 from "fs";
|
|
17897
|
-
import * as
|
|
17951
|
+
import * as os9 from "os";
|
|
17898
17952
|
import * as path16 from "path";
|
|
17899
17953
|
|
|
17900
17954
|
// src/mcp/services/McpDetectionService/BaseMcpDetectionService.ts
|
|
@@ -17905,11 +17959,11 @@ import * as path15 from "path";
|
|
|
17905
17959
|
|
|
17906
17960
|
// src/mcp/services/McpDetectionService/McpDetectionServiceUtils.ts
|
|
17907
17961
|
import * as fs13 from "fs";
|
|
17908
|
-
import * as
|
|
17962
|
+
import * as os8 from "os";
|
|
17909
17963
|
|
|
17910
17964
|
// src/mcp/services/McpDetectionService/VscodeMcpDetectionService.ts
|
|
17911
17965
|
import * as fs16 from "fs";
|
|
17912
|
-
import * as
|
|
17966
|
+
import * as os10 from "os";
|
|
17913
17967
|
import * as path17 from "path";
|
|
17914
17968
|
|
|
17915
17969
|
// src/mcp/tools/checkForNewAvailableFixes/CheckForNewAvailableFixesTool.ts
|
|
@@ -18003,8 +18057,8 @@ var BaseTool = class {
|
|
|
18003
18057
|
if (this.hasAuthentication) {
|
|
18004
18058
|
logDebug(`Authenticating tool: ${this.name}`, { args });
|
|
18005
18059
|
const mcpGqlClient = await createAuthenticatedMcpGQLClient();
|
|
18006
|
-
const
|
|
18007
|
-
logDebug("User authenticated successfully", { userInfo });
|
|
18060
|
+
const userInfo2 = await mcpGqlClient.getUserInfo();
|
|
18061
|
+
logDebug("User authenticated successfully", { userInfo: userInfo2 });
|
|
18008
18062
|
}
|
|
18009
18063
|
const validatedArgs = this.validateInput(args);
|
|
18010
18064
|
logDebug(`Tool ${this.name} input validation successful`, {
|