mobbdev 1.1.9 → 1.1.10
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 +23 -11
- package/dist/index.mjs +86 -74
- package/package.json +1 -1
|
@@ -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,12 @@ var PromptItemZ = z26.object({
|
|
|
5289
5290
|
}).optional()
|
|
5290
5291
|
});
|
|
5291
5292
|
var PromptItemArrayZ = z26.array(PromptItemZ);
|
|
5293
|
+
function getSystemInfo() {
|
|
5294
|
+
return {
|
|
5295
|
+
computerName: os2.hostname(),
|
|
5296
|
+
userName: os2.userInfo().username
|
|
5297
|
+
};
|
|
5298
|
+
}
|
|
5292
5299
|
function uploadAiBlameBuilder(args) {
|
|
5293
5300
|
return args.option("prompt", {
|
|
5294
5301
|
type: "string",
|
|
@@ -5391,6 +5398,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5391
5398
|
throw new Error(errorMsg);
|
|
5392
5399
|
}
|
|
5393
5400
|
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
5401
|
+
const { computerName, userName } = getSystemInfo();
|
|
5394
5402
|
const sessions = [];
|
|
5395
5403
|
for (let i = 0; i < prompts.length; i++) {
|
|
5396
5404
|
const promptPath = String(prompts[i]);
|
|
@@ -5414,7 +5422,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5414
5422
|
aiResponseAt: responseTimes[i] || nowIso,
|
|
5415
5423
|
model: models[i],
|
|
5416
5424
|
toolName: tools[i],
|
|
5417
|
-
blameType: blameTypes[i] || "CHAT" /* Chat
|
|
5425
|
+
blameType: blameTypes[i] || "CHAT" /* Chat */,
|
|
5426
|
+
computerName,
|
|
5427
|
+
userName
|
|
5418
5428
|
});
|
|
5419
5429
|
}
|
|
5420
5430
|
const authenticatedClient = await getAuthenticatedGQLClient({
|
|
@@ -5465,7 +5475,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
5465
5475
|
aiResponseAt: s.aiResponseAt,
|
|
5466
5476
|
model: s.model,
|
|
5467
5477
|
toolName: s.toolName,
|
|
5468
|
-
blameType: s.blameType
|
|
5478
|
+
blameType: s.blameType,
|
|
5479
|
+
computerName: s.computerName,
|
|
5480
|
+
userName: s.userName
|
|
5469
5481
|
};
|
|
5470
5482
|
});
|
|
5471
5483
|
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) {
|
|
@@ -7242,8 +7242,8 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7242
7242
|
if (!parseScmURLRes) {
|
|
7243
7243
|
throw new InvalidRepoUrlError("invalid repo url");
|
|
7244
7244
|
}
|
|
7245
|
-
const { protocol, hostname, organization, repoName } = parseScmURLRes;
|
|
7246
|
-
const url = `${protocol}//${
|
|
7245
|
+
const { protocol, hostname: hostname2, organization, repoName } = parseScmURLRes;
|
|
7246
|
+
const url = `${protocol}//${hostname2}/${organization}/${repoName}`;
|
|
7247
7247
|
switch (authData.authType) {
|
|
7248
7248
|
case "public": {
|
|
7249
7249
|
return trimmedUrl;
|
|
@@ -8451,8 +8451,8 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8451
8451
|
if (!res) {
|
|
8452
8452
|
throw new InvalidRepoUrlError("invalid repo url");
|
|
8453
8453
|
}
|
|
8454
|
-
const { protocol, hostname, organization, repoName } = res;
|
|
8455
|
-
const downloadUrl = isGithubOnPrem(this.url) ? `${protocol}//${
|
|
8454
|
+
const { protocol, hostname: hostname2, organization, repoName } = res;
|
|
8455
|
+
const downloadUrl = isGithubOnPrem(this.url) ? `${protocol}//${hostname2}/api/v3/repos/${organization}/${repoName}/zipball/${sha}` : `https://api.${hostname2}/repos/${organization}/${repoName}/zipball/${sha}`;
|
|
8456
8456
|
return Promise.resolve(downloadUrl);
|
|
8457
8457
|
}
|
|
8458
8458
|
async _getUsernameForAuthUrl() {
|
|
@@ -12108,8 +12108,8 @@ if (typeof __filename !== "undefined") {
|
|
|
12108
12108
|
}
|
|
12109
12109
|
var costumeRequire = createRequire(moduleUrl);
|
|
12110
12110
|
var getCheckmarxPath = () => {
|
|
12111
|
-
const
|
|
12112
|
-
const cxFileName =
|
|
12111
|
+
const os11 = type();
|
|
12112
|
+
const cxFileName = os11 === "Windows_NT" ? "cx.exe" : "cx";
|
|
12113
12113
|
try {
|
|
12114
12114
|
return costumeRequire.resolve(`.bin/${cxFileName}`);
|
|
12115
12115
|
} catch (e) {
|
|
@@ -12467,17 +12467,17 @@ function getBrokerHosts(userOrgsAnUserOrgRoles) {
|
|
|
12467
12467
|
}
|
|
12468
12468
|
async function getScmTokenInfo(params) {
|
|
12469
12469
|
const { gqlClient, repo } = params;
|
|
12470
|
-
const
|
|
12471
|
-
if (!
|
|
12470
|
+
const userInfo2 = await gqlClient.getUserInfo();
|
|
12471
|
+
if (!userInfo2) {
|
|
12472
12472
|
throw new Error("userInfo is null");
|
|
12473
12473
|
}
|
|
12474
|
-
const scmConfigs = getFromArraySafe(
|
|
12474
|
+
const scmConfigs = getFromArraySafe(userInfo2.scmConfigs);
|
|
12475
12475
|
return getScmConfig({
|
|
12476
12476
|
url: repo,
|
|
12477
12477
|
scmConfigs,
|
|
12478
12478
|
includeOrgTokens: false,
|
|
12479
12479
|
brokerHosts: getBrokerHosts(
|
|
12480
|
-
|
|
12480
|
+
userInfo2.userOrganizationsAndUserOrganizationRoles
|
|
12481
12481
|
)
|
|
12482
12482
|
});
|
|
12483
12483
|
}
|
|
@@ -12745,16 +12745,16 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
12745
12745
|
);
|
|
12746
12746
|
await open3(scmAuthUrl2);
|
|
12747
12747
|
for (let i = 0; i < LOGIN_MAX_WAIT / LOGIN_CHECK_DELAY; i++) {
|
|
12748
|
-
const
|
|
12749
|
-
if (!
|
|
12748
|
+
const userInfo2 = await gqlClient.getUserInfo();
|
|
12749
|
+
if (!userInfo2) {
|
|
12750
12750
|
throw new CliError2("User info not found");
|
|
12751
12751
|
}
|
|
12752
|
-
const scmConfigs = getFromArraySafe(
|
|
12752
|
+
const scmConfigs = getFromArraySafe(userInfo2.scmConfigs);
|
|
12753
12753
|
const tokenInfo2 = getScmConfig({
|
|
12754
12754
|
url: repoUrl,
|
|
12755
12755
|
scmConfigs,
|
|
12756
12756
|
brokerHosts: getBrokerHosts(
|
|
12757
|
-
|
|
12757
|
+
userInfo2.userOrganizationsAndUserOrganizationRoles
|
|
12758
12758
|
),
|
|
12759
12759
|
includeOrgTokens: false
|
|
12760
12760
|
});
|
|
@@ -13258,6 +13258,7 @@ import { z as z32 } from "zod";
|
|
|
13258
13258
|
|
|
13259
13259
|
// src/args/commands/upload_ai_blame.ts
|
|
13260
13260
|
import fsPromises3 from "fs/promises";
|
|
13261
|
+
import * as os2 from "os";
|
|
13261
13262
|
import path11 from "path";
|
|
13262
13263
|
import chalk9 from "chalk";
|
|
13263
13264
|
import { withFile } from "tmp-promise";
|
|
@@ -13424,6 +13425,12 @@ var PromptItemZ = z31.object({
|
|
|
13424
13425
|
}).optional()
|
|
13425
13426
|
});
|
|
13426
13427
|
var PromptItemArrayZ = z31.array(PromptItemZ);
|
|
13428
|
+
function getSystemInfo() {
|
|
13429
|
+
return {
|
|
13430
|
+
computerName: os2.hostname(),
|
|
13431
|
+
userName: os2.userInfo().username
|
|
13432
|
+
};
|
|
13433
|
+
}
|
|
13427
13434
|
function uploadAiBlameBuilder(args) {
|
|
13428
13435
|
return args.option("prompt", {
|
|
13429
13436
|
type: "string",
|
|
@@ -13526,6 +13533,7 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13526
13533
|
throw new Error(errorMsg);
|
|
13527
13534
|
}
|
|
13528
13535
|
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
13536
|
+
const { computerName, userName } = getSystemInfo();
|
|
13529
13537
|
const sessions = [];
|
|
13530
13538
|
for (let i = 0; i < prompts.length; i++) {
|
|
13531
13539
|
const promptPath = String(prompts[i]);
|
|
@@ -13549,7 +13557,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13549
13557
|
aiResponseAt: responseTimes[i] || nowIso,
|
|
13550
13558
|
model: models[i],
|
|
13551
13559
|
toolName: tools[i],
|
|
13552
|
-
blameType: blameTypes[i] || "CHAT" /* Chat
|
|
13560
|
+
blameType: blameTypes[i] || "CHAT" /* Chat */,
|
|
13561
|
+
computerName,
|
|
13562
|
+
userName
|
|
13553
13563
|
});
|
|
13554
13564
|
}
|
|
13555
13565
|
const authenticatedClient = await getAuthenticatedGQLClient({
|
|
@@ -13600,7 +13610,9 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
|
|
|
13600
13610
|
aiResponseAt: s.aiResponseAt,
|
|
13601
13611
|
model: s.model,
|
|
13602
13612
|
toolName: s.toolName,
|
|
13603
|
-
blameType: s.blameType
|
|
13613
|
+
blameType: s.blameType,
|
|
13614
|
+
computerName: s.computerName,
|
|
13615
|
+
userName: s.userName
|
|
13604
13616
|
};
|
|
13605
13617
|
});
|
|
13606
13618
|
const sanitizedFinalizeSessions = await sanitizeData(
|
|
@@ -13894,10 +13906,10 @@ async function processAndUploadHookData() {
|
|
|
13894
13906
|
|
|
13895
13907
|
// src/features/claude_code/install_hook.ts
|
|
13896
13908
|
import fsPromises5 from "fs/promises";
|
|
13897
|
-
import
|
|
13909
|
+
import os3 from "os";
|
|
13898
13910
|
import path12 from "path";
|
|
13899
13911
|
import chalk10 from "chalk";
|
|
13900
|
-
var CLAUDE_SETTINGS_PATH = path12.join(
|
|
13912
|
+
var CLAUDE_SETTINGS_PATH = path12.join(os3.homedir(), ".claude", "settings.json");
|
|
13901
13913
|
async function claudeSettingsExists() {
|
|
13902
13914
|
try {
|
|
13903
13915
|
await fsPromises5.access(CLAUDE_SETTINGS_PATH);
|
|
@@ -14359,7 +14371,7 @@ var GetLatestReportByRepoUrlResponseSchema = z33.object({
|
|
|
14359
14371
|
|
|
14360
14372
|
// src/mcp/services/McpAuthService.ts
|
|
14361
14373
|
import crypto2 from "crypto";
|
|
14362
|
-
import
|
|
14374
|
+
import os4 from "os";
|
|
14363
14375
|
import open4 from "open";
|
|
14364
14376
|
init_configs();
|
|
14365
14377
|
var McpAuthService = class {
|
|
@@ -14403,7 +14415,7 @@ var McpAuthService = class {
|
|
|
14403
14415
|
}
|
|
14404
14416
|
logDebug(`cli login created ${loginId}`);
|
|
14405
14417
|
const webLoginUrl2 = `${WEB_APP_URL}/mvs-login`;
|
|
14406
|
-
const browserUrl = `${webLoginUrl2}/${loginId}?hostname=${
|
|
14418
|
+
const browserUrl = `${webLoginUrl2}/${loginId}?hostname=${os4.hostname()}`;
|
|
14407
14419
|
await this.openBrowser(browserUrl, isBackgoundCall);
|
|
14408
14420
|
logDebug(`waiting for login to complete`);
|
|
14409
14421
|
let newApiToken = null;
|
|
@@ -14870,15 +14882,15 @@ var McpGQLClient = class {
|
|
|
14870
14882
|
});
|
|
14871
14883
|
return overrideValue;
|
|
14872
14884
|
}
|
|
14873
|
-
const
|
|
14874
|
-
if (!
|
|
14885
|
+
const userInfo2 = await this.getUserInfo();
|
|
14886
|
+
if (!userInfo2?.email) {
|
|
14875
14887
|
throw new Error("User email not found");
|
|
14876
14888
|
}
|
|
14877
14889
|
logDebug("[GraphQL] Calling GetUserMvsAutoFix query", {
|
|
14878
|
-
userEmail:
|
|
14890
|
+
userEmail: userInfo2.email
|
|
14879
14891
|
});
|
|
14880
14892
|
const result = await this.clientSdk.GetUserMvsAutoFix({
|
|
14881
|
-
userEmail:
|
|
14893
|
+
userEmail: userInfo2.email
|
|
14882
14894
|
});
|
|
14883
14895
|
logDebug("[GraphQL] GetUserMvsAutoFix successful", { result });
|
|
14884
14896
|
return result.user_email_notification_settings?.[0]?.mvs_auto_fix ?? true;
|
|
@@ -14905,9 +14917,9 @@ var McpGQLClient = class {
|
|
|
14905
14917
|
});
|
|
14906
14918
|
let currentUserEmail = "%@%";
|
|
14907
14919
|
try {
|
|
14908
|
-
const
|
|
14909
|
-
if (
|
|
14910
|
-
currentUserEmail = `%${
|
|
14920
|
+
const userInfo2 = await this.getUserInfo();
|
|
14921
|
+
if (userInfo2?.email) {
|
|
14922
|
+
currentUserEmail = `%${userInfo2.email}%`;
|
|
14911
14923
|
}
|
|
14912
14924
|
} catch (err) {
|
|
14913
14925
|
logDebug("[GraphQL] Failed to get user email, using default pattern", {
|
|
@@ -14984,9 +14996,9 @@ var McpGQLClient = class {
|
|
|
14984
14996
|
});
|
|
14985
14997
|
let currentUserEmail = "%@%";
|
|
14986
14998
|
try {
|
|
14987
|
-
const
|
|
14988
|
-
if (
|
|
14989
|
-
currentUserEmail = `%${
|
|
14999
|
+
const userInfo2 = await this.getUserInfo();
|
|
15000
|
+
if (userInfo2?.email) {
|
|
15001
|
+
currentUserEmail = `%${userInfo2.email}%`;
|
|
14990
15002
|
}
|
|
14991
15003
|
} catch (err) {
|
|
14992
15004
|
logDebug("[GraphQL] Failed to get user email, using default pattern", {
|
|
@@ -15064,7 +15076,7 @@ async function createAuthenticatedMcpGQLClient({
|
|
|
15064
15076
|
// src/mcp/services/McpUsageService/host.ts
|
|
15065
15077
|
import { execSync } from "child_process";
|
|
15066
15078
|
import fs11 from "fs";
|
|
15067
|
-
import
|
|
15079
|
+
import os5 from "os";
|
|
15068
15080
|
import path13 from "path";
|
|
15069
15081
|
var IDEs = ["cursor", "windsurf", "webstorm", "vscode", "claude"];
|
|
15070
15082
|
var runCommand = (cmd) => {
|
|
@@ -15079,7 +15091,7 @@ var gitInfo = {
|
|
|
15079
15091
|
email: runCommand("git config user.email")
|
|
15080
15092
|
};
|
|
15081
15093
|
var getClaudeWorkspacePaths = () => {
|
|
15082
|
-
const home =
|
|
15094
|
+
const home = os5.homedir();
|
|
15083
15095
|
const claudeIdePath = path13.join(home, ".claude", "ide");
|
|
15084
15096
|
const workspacePaths = [];
|
|
15085
15097
|
if (!fs11.existsSync(claudeIdePath)) {
|
|
@@ -15108,7 +15120,7 @@ var getClaudeWorkspacePaths = () => {
|
|
|
15108
15120
|
return workspacePaths;
|
|
15109
15121
|
};
|
|
15110
15122
|
var getMCPConfigPaths = (hostName) => {
|
|
15111
|
-
const home =
|
|
15123
|
+
const home = os5.homedir();
|
|
15112
15124
|
const currentDir = process.env["WORKSPACE_FOLDER_PATHS"] || process.env["PWD"] || process.cwd();
|
|
15113
15125
|
switch (hostName.toLowerCase()) {
|
|
15114
15126
|
case "cursor":
|
|
@@ -15198,7 +15210,7 @@ var readMCPConfig = (hostName) => {
|
|
|
15198
15210
|
};
|
|
15199
15211
|
var getRunningProcesses = () => {
|
|
15200
15212
|
try {
|
|
15201
|
-
return
|
|
15213
|
+
return os5.platform() === "win32" ? execSync("tasklist", { encoding: "utf8" }) : execSync("ps aux", { encoding: "utf8" });
|
|
15202
15214
|
} catch {
|
|
15203
15215
|
return "";
|
|
15204
15216
|
}
|
|
@@ -15273,7 +15285,7 @@ var versionCommands = {
|
|
|
15273
15285
|
}
|
|
15274
15286
|
};
|
|
15275
15287
|
var getProcessInfo = (pid) => {
|
|
15276
|
-
const platform2 =
|
|
15288
|
+
const platform2 = os5.platform();
|
|
15277
15289
|
try {
|
|
15278
15290
|
if (platform2 === "linux" || platform2 === "darwin") {
|
|
15279
15291
|
const output = execSync(`ps -o pid=,ppid=,comm= -p ${pid}`, {
|
|
@@ -15392,7 +15404,7 @@ var getHostInfo = (additionalMcpList) => {
|
|
|
15392
15404
|
const config2 = allConfigs[ide] || null;
|
|
15393
15405
|
const ideName = ide.charAt(0).toUpperCase() + ide.slice(1) || "Unknown";
|
|
15394
15406
|
let ideVersion = "Unknown";
|
|
15395
|
-
const platform2 =
|
|
15407
|
+
const platform2 = os5.platform();
|
|
15396
15408
|
const cmds = versionCommands[ideName]?.[platform2] ?? [];
|
|
15397
15409
|
for (const cmd of cmds) {
|
|
15398
15410
|
try {
|
|
@@ -15425,14 +15437,14 @@ var getHostInfo = (additionalMcpList) => {
|
|
|
15425
15437
|
|
|
15426
15438
|
// src/mcp/services/McpUsageService/McpUsageService.ts
|
|
15427
15439
|
import fetch5 from "node-fetch";
|
|
15428
|
-
import
|
|
15440
|
+
import os7 from "os";
|
|
15429
15441
|
import { v4 as uuidv43, v5 as uuidv5 } from "uuid";
|
|
15430
15442
|
init_configs();
|
|
15431
15443
|
|
|
15432
15444
|
// src/mcp/services/McpUsageService/system.ts
|
|
15433
15445
|
init_configs();
|
|
15434
15446
|
import fs12 from "fs";
|
|
15435
|
-
import
|
|
15447
|
+
import os6 from "os";
|
|
15436
15448
|
import path14 from "path";
|
|
15437
15449
|
var MAX_DEPTH = 2;
|
|
15438
15450
|
var patterns = ["mcp", "claude"];
|
|
@@ -15467,8 +15479,8 @@ var searchDir = async (dir, depth = 0) => {
|
|
|
15467
15479
|
};
|
|
15468
15480
|
var findSystemMCPConfigs = async () => {
|
|
15469
15481
|
try {
|
|
15470
|
-
const home =
|
|
15471
|
-
const platform2 =
|
|
15482
|
+
const home = os6.homedir();
|
|
15483
|
+
const platform2 = os6.platform();
|
|
15472
15484
|
const knownDirs = platform2 === "win32" ? [
|
|
15473
15485
|
path14.join(home, ".cursor"),
|
|
15474
15486
|
path14.join(home, "Documents"),
|
|
@@ -15540,7 +15552,7 @@ var McpUsageService = class {
|
|
|
15540
15552
|
generateHostId() {
|
|
15541
15553
|
const stored = configStore.get(this.configKey);
|
|
15542
15554
|
if (stored?.mcpHostId) return stored.mcpHostId;
|
|
15543
|
-
const interfaces =
|
|
15555
|
+
const interfaces = os7.networkInterfaces();
|
|
15544
15556
|
const macs = [];
|
|
15545
15557
|
for (const iface of Object.values(interfaces)) {
|
|
15546
15558
|
if (!iface) continue;
|
|
@@ -15548,7 +15560,7 @@ var McpUsageService = class {
|
|
|
15548
15560
|
if (net.mac && net.mac !== "00:00:00:00:00:00") macs.push(net.mac);
|
|
15549
15561
|
}
|
|
15550
15562
|
}
|
|
15551
|
-
const macString = macs.length ? macs.sort().join(",") : `${
|
|
15563
|
+
const macString = macs.length ? macs.sort().join(",") : `${os7.hostname()}-${uuidv43()}`;
|
|
15552
15564
|
const hostId = uuidv5(macString, uuidv5.DNS);
|
|
15553
15565
|
logDebug("[UsageService] Generated new host ID", { hostId });
|
|
15554
15566
|
return hostId;
|
|
@@ -15571,7 +15583,7 @@ var McpUsageService = class {
|
|
|
15571
15583
|
mcpHostId,
|
|
15572
15584
|
organizationId,
|
|
15573
15585
|
mcpVersion: packageJson.version,
|
|
15574
|
-
mcpOsName:
|
|
15586
|
+
mcpOsName: os7.platform(),
|
|
15575
15587
|
mcps: JSON.stringify(mcps),
|
|
15576
15588
|
status,
|
|
15577
15589
|
userName: user.name,
|
|
@@ -17894,7 +17906,7 @@ For a complete security audit workflow, use the \`full-security-audit\` prompt.
|
|
|
17894
17906
|
|
|
17895
17907
|
// src/mcp/services/McpDetectionService/CursorMcpDetectionService.ts
|
|
17896
17908
|
import * as fs15 from "fs";
|
|
17897
|
-
import * as
|
|
17909
|
+
import * as os9 from "os";
|
|
17898
17910
|
import * as path16 from "path";
|
|
17899
17911
|
|
|
17900
17912
|
// src/mcp/services/McpDetectionService/BaseMcpDetectionService.ts
|
|
@@ -17905,11 +17917,11 @@ import * as path15 from "path";
|
|
|
17905
17917
|
|
|
17906
17918
|
// src/mcp/services/McpDetectionService/McpDetectionServiceUtils.ts
|
|
17907
17919
|
import * as fs13 from "fs";
|
|
17908
|
-
import * as
|
|
17920
|
+
import * as os8 from "os";
|
|
17909
17921
|
|
|
17910
17922
|
// src/mcp/services/McpDetectionService/VscodeMcpDetectionService.ts
|
|
17911
17923
|
import * as fs16 from "fs";
|
|
17912
|
-
import * as
|
|
17924
|
+
import * as os10 from "os";
|
|
17913
17925
|
import * as path17 from "path";
|
|
17914
17926
|
|
|
17915
17927
|
// src/mcp/tools/checkForNewAvailableFixes/CheckForNewAvailableFixesTool.ts
|
|
@@ -18003,8 +18015,8 @@ var BaseTool = class {
|
|
|
18003
18015
|
if (this.hasAuthentication) {
|
|
18004
18016
|
logDebug(`Authenticating tool: ${this.name}`, { args });
|
|
18005
18017
|
const mcpGqlClient = await createAuthenticatedMcpGQLClient();
|
|
18006
|
-
const
|
|
18007
|
-
logDebug("User authenticated successfully", { userInfo });
|
|
18018
|
+
const userInfo2 = await mcpGqlClient.getUserInfo();
|
|
18019
|
+
logDebug("User authenticated successfully", { userInfo: userInfo2 });
|
|
18008
18020
|
}
|
|
18009
18021
|
const validatedArgs = this.validateInput(args);
|
|
18010
18022
|
logDebug(`Tool ${this.name} input validation successful`, {
|