mobbdev 1.1.30 → 1.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/args/commands/upload_ai_blame.mjs +157 -20
- package/dist/index.mjs +252 -115
- package/package.json +1 -1
|
@@ -62,7 +62,7 @@ var init_FilePatterns = __esm({
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
// src/features/analysis/scm/services/FileUtils.ts
|
|
65
|
-
import
|
|
65
|
+
import fs4 from "fs";
|
|
66
66
|
import { promises as fsPromises } from "fs";
|
|
67
67
|
import { isBinary } from "istextorbinary";
|
|
68
68
|
import path4 from "path";
|
|
@@ -76,7 +76,7 @@ var init_FileUtils = __esm({
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
// src/features/analysis/scm/services/GitService.ts
|
|
79
|
-
import
|
|
79
|
+
import fs5 from "fs";
|
|
80
80
|
import ignore from "ignore";
|
|
81
81
|
import * as path5 from "path";
|
|
82
82
|
import { simpleGit as simpleGit2 } from "simple-git";
|
|
@@ -92,7 +92,7 @@ var init_GitService = __esm({
|
|
|
92
92
|
|
|
93
93
|
// src/args/commands/upload_ai_blame.ts
|
|
94
94
|
import fsPromises2 from "fs/promises";
|
|
95
|
-
import * as
|
|
95
|
+
import * as os3 from "os";
|
|
96
96
|
import path6 from "path";
|
|
97
97
|
import chalk3 from "chalk";
|
|
98
98
|
import { withFile } from "tmp-promise";
|
|
@@ -106,6 +106,7 @@ import Debug6 from "debug";
|
|
|
106
106
|
import open from "open";
|
|
107
107
|
|
|
108
108
|
// src/constants.ts
|
|
109
|
+
import fs2 from "fs";
|
|
109
110
|
import path2 from "path";
|
|
110
111
|
import chalk from "chalk";
|
|
111
112
|
import Debug from "debug";
|
|
@@ -818,13 +819,25 @@ var UploadS3BucketInfoDocument = `
|
|
|
818
819
|
}
|
|
819
820
|
}
|
|
820
821
|
`;
|
|
822
|
+
var GetTracyDiffUploadUrlDocument = `
|
|
823
|
+
mutation GetTracyDiffUploadUrl($commitSha: String!) {
|
|
824
|
+
getTracyDiffUploadUrl(commitSha: $commitSha) {
|
|
825
|
+
status
|
|
826
|
+
error
|
|
827
|
+
uploadInfo {
|
|
828
|
+
url
|
|
829
|
+
uploadFieldsJSON
|
|
830
|
+
uploadKey
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
`;
|
|
821
835
|
var AnalyzeCommitForExtensionAiBlameDocument = `
|
|
822
|
-
mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!, $
|
|
836
|
+
mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!, $commitTimestamp: Timestamp, $parentCommits: [ParentCommitInput!]) {
|
|
823
837
|
analyzeCommitForAIBlame(
|
|
824
838
|
repositoryURL: $repositoryURL
|
|
825
839
|
commitSha: $commitSha
|
|
826
840
|
organizationId: $organizationId
|
|
827
|
-
commitDiff: $commitDiff
|
|
828
841
|
commitTimestamp: $commitTimestamp
|
|
829
842
|
parentCommits: $parentCommits
|
|
830
843
|
) {
|
|
@@ -1214,6 +1227,9 @@ function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
1214
1227
|
uploadS3BucketInfo(variables, requestHeaders, signal) {
|
|
1215
1228
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: UploadS3BucketInfoDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "uploadS3BucketInfo", "mutation", variables);
|
|
1216
1229
|
},
|
|
1230
|
+
GetTracyDiffUploadUrl(variables, requestHeaders, signal) {
|
|
1231
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetTracyDiffUploadUrlDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "GetTracyDiffUploadUrl", "mutation", variables);
|
|
1232
|
+
},
|
|
1217
1233
|
AnalyzeCommitForExtensionAIBlame(variables, requestHeaders, signal) {
|
|
1218
1234
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: AnalyzeCommitForExtensionAiBlameDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "AnalyzeCommitForExtensionAIBlame", "mutation", variables);
|
|
1219
1235
|
},
|
|
@@ -2233,6 +2249,22 @@ function getDirName() {
|
|
|
2233
2249
|
|
|
2234
2250
|
// src/constants.ts
|
|
2235
2251
|
var debug = Debug("mobbdev:constants");
|
|
2252
|
+
var runtimeConfigPath = path2.join(
|
|
2253
|
+
getModuleRootDir(),
|
|
2254
|
+
"out",
|
|
2255
|
+
"runtime.config.json"
|
|
2256
|
+
);
|
|
2257
|
+
if (fs2.existsSync(runtimeConfigPath)) {
|
|
2258
|
+
try {
|
|
2259
|
+
const runtimeConfig = JSON.parse(
|
|
2260
|
+
fs2.readFileSync(runtimeConfigPath, "utf-8")
|
|
2261
|
+
);
|
|
2262
|
+
Object.assign(process.env, runtimeConfig);
|
|
2263
|
+
debug("Loaded runtime config from %s", runtimeConfigPath);
|
|
2264
|
+
} catch (e) {
|
|
2265
|
+
debug("Failed to load runtime config: %o", e);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2236
2268
|
dotenv.config({ path: path2.join(getModuleRootDir(), ".env") });
|
|
2237
2269
|
var DEFAULT_API_URL = "https://api.mobb.ai/v1/graphql";
|
|
2238
2270
|
var DEFAULT_WEB_APP_URL = "https://app.mobb.ai";
|
|
@@ -2390,12 +2422,12 @@ function Spinner({ ci = false } = {}) {
|
|
|
2390
2422
|
}
|
|
2391
2423
|
|
|
2392
2424
|
// src/utils/check_node_version.ts
|
|
2393
|
-
import
|
|
2425
|
+
import fs3 from "fs";
|
|
2394
2426
|
import path3 from "path";
|
|
2395
2427
|
import semver from "semver";
|
|
2396
2428
|
function getPackageJson() {
|
|
2397
2429
|
return JSON.parse(
|
|
2398
|
-
|
|
2430
|
+
fs3.readFileSync(path3.join(getModuleRootDir(), "package.json"), "utf8")
|
|
2399
2431
|
);
|
|
2400
2432
|
}
|
|
2401
2433
|
var packageJson = getPackageJson();
|
|
@@ -4375,8 +4407,8 @@ var IssueTypeAndLanguageZ = z12.object({
|
|
|
4375
4407
|
import { z as z13 } from "zod";
|
|
4376
4408
|
var ADO_PREFIX_PATH = "tfs";
|
|
4377
4409
|
function detectAdoUrl(args) {
|
|
4378
|
-
const { pathname, hostname
|
|
4379
|
-
const hostnameParts =
|
|
4410
|
+
const { pathname, hostname, scmType } = args;
|
|
4411
|
+
const hostnameParts = hostname.split(".");
|
|
4380
4412
|
const adoCloudHostname = new URL(scmCloudUrl.Ado).hostname;
|
|
4381
4413
|
const prefixPath = pathname.at(0)?.toLowerCase() === ADO_PREFIX_PATH ? ADO_PREFIX_PATH : "";
|
|
4382
4414
|
const normalizedPath = prefixPath ? pathname.slice(1) : pathname;
|
|
@@ -4405,7 +4437,7 @@ function detectAdoUrl(args) {
|
|
|
4405
4437
|
};
|
|
4406
4438
|
}
|
|
4407
4439
|
}
|
|
4408
|
-
if (
|
|
4440
|
+
if (hostname === adoCloudHostname || scmType === "Ado" /* Ado */) {
|
|
4409
4441
|
if (normalizedPath[normalizedPath.length - 2] === "_git") {
|
|
4410
4442
|
if (normalizedPath.length === 3) {
|
|
4411
4443
|
const [organization, _git, repoName] = normalizedPath;
|
|
@@ -4433,9 +4465,9 @@ function detectAdoUrl(args) {
|
|
|
4433
4465
|
return null;
|
|
4434
4466
|
}
|
|
4435
4467
|
function detectGithubUrl(args) {
|
|
4436
|
-
const { pathname, hostname
|
|
4468
|
+
const { pathname, hostname, scmType } = args;
|
|
4437
4469
|
const githubHostname = new URL(scmCloudUrl.GitHub).hostname;
|
|
4438
|
-
if (
|
|
4470
|
+
if (hostname === githubHostname || scmType === "GitHub" /* GitHub */) {
|
|
4439
4471
|
if (pathname.length === 2) {
|
|
4440
4472
|
return {
|
|
4441
4473
|
scmType: "GitHub" /* GitHub */,
|
|
@@ -4447,9 +4479,9 @@ function detectGithubUrl(args) {
|
|
|
4447
4479
|
return null;
|
|
4448
4480
|
}
|
|
4449
4481
|
function detectGitlabUrl(args) {
|
|
4450
|
-
const { pathname, hostname
|
|
4482
|
+
const { pathname, hostname, scmType } = args;
|
|
4451
4483
|
const gitlabHostname = new URL(scmCloudUrl.GitLab).hostname;
|
|
4452
|
-
if (
|
|
4484
|
+
if (hostname === gitlabHostname || scmType === "GitLab" /* GitLab */) {
|
|
4453
4485
|
if (pathname.length >= 2) {
|
|
4454
4486
|
return {
|
|
4455
4487
|
scmType: "GitLab" /* GitLab */,
|
|
@@ -4461,9 +4493,9 @@ function detectGitlabUrl(args) {
|
|
|
4461
4493
|
return null;
|
|
4462
4494
|
}
|
|
4463
4495
|
function detectBitbucketUrl(args) {
|
|
4464
|
-
const { pathname, hostname
|
|
4496
|
+
const { pathname, hostname, scmType } = args;
|
|
4465
4497
|
const bitbucketHostname = new URL(scmCloudUrl.Bitbucket).hostname;
|
|
4466
|
-
if (
|
|
4498
|
+
if (hostname === bitbucketHostname || scmType === "Bitbucket" /* Bitbucket */) {
|
|
4467
4499
|
if (pathname.length === 2) {
|
|
4468
4500
|
return {
|
|
4469
4501
|
scmType: "Bitbucket" /* Bitbucket */,
|
|
@@ -4729,6 +4761,19 @@ var REPORT_STATE_CHECK_DELAY = 5 * 1e3;
|
|
|
4729
4761
|
function getProxyAgent(url) {
|
|
4730
4762
|
try {
|
|
4731
4763
|
const parsedUrl = new URL(url);
|
|
4764
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
4765
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]") {
|
|
4766
|
+
debug6("Skipping proxy for localhost URL: %s", url);
|
|
4767
|
+
return void 0;
|
|
4768
|
+
}
|
|
4769
|
+
const noProxy = process.env["NO_PROXY"] || process.env["no_proxy"];
|
|
4770
|
+
if (noProxy) {
|
|
4771
|
+
const noProxyList = noProxy.split(",").map((h) => h.trim().toLowerCase());
|
|
4772
|
+
if (noProxyList.includes(hostname) || noProxyList.includes("*")) {
|
|
4773
|
+
debug6("Skipping proxy due to NO_PROXY for: %s", url);
|
|
4774
|
+
return void 0;
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4732
4777
|
const isHttp = parsedUrl.protocol === "http:";
|
|
4733
4778
|
const isHttps = parsedUrl.protocol === "https:";
|
|
4734
4779
|
const proxy = isHttps ? HTTPS_PROXY || HTTP_PROXY : isHttp ? HTTP_PROXY : null;
|
|
@@ -5138,12 +5183,15 @@ var GQLClient = class {
|
|
|
5138
5183
|
async getAIBlameAttributionPromptSummary(variables) {
|
|
5139
5184
|
return await this._clientSdk.GetPromptSummary(variables);
|
|
5140
5185
|
}
|
|
5186
|
+
async getTracyDiffUploadUrl(variables) {
|
|
5187
|
+
return await this._clientSdk.GetTracyDiffUploadUrl(variables);
|
|
5188
|
+
}
|
|
5141
5189
|
};
|
|
5142
5190
|
|
|
5143
5191
|
// src/mcp/services/types.ts
|
|
5144
|
-
function buildLoginUrl(baseUrl, loginId,
|
|
5192
|
+
function buildLoginUrl(baseUrl, loginId, hostname, context) {
|
|
5145
5193
|
const url = new URL(`${baseUrl}/${loginId}`);
|
|
5146
|
-
url.searchParams.set("hostname",
|
|
5194
|
+
url.searchParams.set("hostname", hostname);
|
|
5147
5195
|
url.searchParams.set("trigger", context.trigger);
|
|
5148
5196
|
url.searchParams.set("source", context.source);
|
|
5149
5197
|
if (context.ide) {
|
|
@@ -5357,6 +5405,95 @@ async function uploadFile({
|
|
|
5357
5405
|
logInfo(`FileUpload: upload file done`);
|
|
5358
5406
|
}
|
|
5359
5407
|
|
|
5408
|
+
// src/utils/computerName.ts
|
|
5409
|
+
import { execSync } from "child_process";
|
|
5410
|
+
import os2 from "os";
|
|
5411
|
+
var STABLE_COMPUTER_NAME_CONFIG_KEY = "stableComputerName";
|
|
5412
|
+
var HOSTNAME_SUFFIXES = [
|
|
5413
|
+
// Cloud providers (must be first - most specific)
|
|
5414
|
+
".ec2.internal",
|
|
5415
|
+
".compute.internal",
|
|
5416
|
+
".cloudapp.net",
|
|
5417
|
+
// mDNS/Bonjour
|
|
5418
|
+
".local",
|
|
5419
|
+
".localhost",
|
|
5420
|
+
".localdomain",
|
|
5421
|
+
// Home networks
|
|
5422
|
+
".lan",
|
|
5423
|
+
".home",
|
|
5424
|
+
".homelan",
|
|
5425
|
+
// Corporate networks
|
|
5426
|
+
".corp",
|
|
5427
|
+
".internal",
|
|
5428
|
+
".intranet",
|
|
5429
|
+
".domain",
|
|
5430
|
+
".work",
|
|
5431
|
+
".office",
|
|
5432
|
+
// Container environments
|
|
5433
|
+
".docker",
|
|
5434
|
+
".kubernetes",
|
|
5435
|
+
".k8s"
|
|
5436
|
+
];
|
|
5437
|
+
function getOsSpecificComputerName() {
|
|
5438
|
+
const platform = os2.platform();
|
|
5439
|
+
try {
|
|
5440
|
+
if (platform === "darwin") {
|
|
5441
|
+
const result = execSync("scutil --get LocalHostName", {
|
|
5442
|
+
encoding: "utf-8",
|
|
5443
|
+
timeout: 1e3
|
|
5444
|
+
});
|
|
5445
|
+
return result.trim();
|
|
5446
|
+
} else if (platform === "win32") {
|
|
5447
|
+
return process.env["COMPUTERNAME"] || null;
|
|
5448
|
+
} else {
|
|
5449
|
+
try {
|
|
5450
|
+
const result2 = execSync("hostnamectl --static", {
|
|
5451
|
+
encoding: "utf-8",
|
|
5452
|
+
timeout: 1e3
|
|
5453
|
+
});
|
|
5454
|
+
const hostname = result2.trim();
|
|
5455
|
+
if (hostname) return hostname;
|
|
5456
|
+
} catch {
|
|
5457
|
+
}
|
|
5458
|
+
const result = execSync("cat /etc/hostname", {
|
|
5459
|
+
encoding: "utf-8",
|
|
5460
|
+
timeout: 1e3
|
|
5461
|
+
});
|
|
5462
|
+
return result.trim();
|
|
5463
|
+
}
|
|
5464
|
+
} catch (error) {
|
|
5465
|
+
return null;
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
function stripHostnameSuffixes(hostname) {
|
|
5469
|
+
if (!hostname) return hostname;
|
|
5470
|
+
let normalized = hostname;
|
|
5471
|
+
for (const suffix of HOSTNAME_SUFFIXES) {
|
|
5472
|
+
if (normalized.endsWith(suffix)) {
|
|
5473
|
+
normalized = normalized.slice(0, -suffix.length);
|
|
5474
|
+
break;
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
return normalized;
|
|
5478
|
+
}
|
|
5479
|
+
function generateStableComputerName() {
|
|
5480
|
+
const osSpecificName = getOsSpecificComputerName();
|
|
5481
|
+
if (osSpecificName) {
|
|
5482
|
+
return osSpecificName;
|
|
5483
|
+
}
|
|
5484
|
+
const currentHostname = os2.hostname();
|
|
5485
|
+
return stripHostnameSuffixes(currentHostname);
|
|
5486
|
+
}
|
|
5487
|
+
function getStableComputerName() {
|
|
5488
|
+
const cached = configStore.get(STABLE_COMPUTER_NAME_CONFIG_KEY);
|
|
5489
|
+
if (cached) {
|
|
5490
|
+
return cached;
|
|
5491
|
+
}
|
|
5492
|
+
const currentName = generateStableComputerName();
|
|
5493
|
+
configStore.set(STABLE_COMPUTER_NAME_CONFIG_KEY, currentName);
|
|
5494
|
+
return currentName;
|
|
5495
|
+
}
|
|
5496
|
+
|
|
5360
5497
|
// src/utils/sanitize-sensitive-data.ts
|
|
5361
5498
|
import { OpenRedaction } from "@openredaction/openredaction";
|
|
5362
5499
|
var openRedaction = new OpenRedaction({
|
|
@@ -5541,12 +5678,12 @@ var PromptItemArrayZ = z26.array(PromptItemZ);
|
|
|
5541
5678
|
function getSystemInfo() {
|
|
5542
5679
|
let userName;
|
|
5543
5680
|
try {
|
|
5544
|
-
userName =
|
|
5681
|
+
userName = os3.userInfo().username;
|
|
5545
5682
|
} catch {
|
|
5546
5683
|
userName = void 0;
|
|
5547
5684
|
}
|
|
5548
5685
|
return {
|
|
5549
|
-
computerName:
|
|
5686
|
+
computerName: getStableComputerName(),
|
|
5550
5687
|
userName
|
|
5551
5688
|
};
|
|
5552
5689
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1412,7 +1412,7 @@ import chalk12 from "chalk";
|
|
|
1412
1412
|
import yargs from "yargs/yargs";
|
|
1413
1413
|
|
|
1414
1414
|
// src/args/commands/convert_to_sarif.ts
|
|
1415
|
-
import
|
|
1415
|
+
import fs8 from "fs";
|
|
1416
1416
|
|
|
1417
1417
|
// src/commands/convert_to_sarif.ts
|
|
1418
1418
|
import fs6 from "fs";
|
|
@@ -2161,13 +2161,25 @@ var UploadS3BucketInfoDocument = `
|
|
|
2161
2161
|
}
|
|
2162
2162
|
}
|
|
2163
2163
|
`;
|
|
2164
|
+
var GetTracyDiffUploadUrlDocument = `
|
|
2165
|
+
mutation GetTracyDiffUploadUrl($commitSha: String!) {
|
|
2166
|
+
getTracyDiffUploadUrl(commitSha: $commitSha) {
|
|
2167
|
+
status
|
|
2168
|
+
error
|
|
2169
|
+
uploadInfo {
|
|
2170
|
+
url
|
|
2171
|
+
uploadFieldsJSON
|
|
2172
|
+
uploadKey
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
`;
|
|
2164
2177
|
var AnalyzeCommitForExtensionAiBlameDocument = `
|
|
2165
|
-
mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!, $
|
|
2178
|
+
mutation AnalyzeCommitForExtensionAIBlame($repositoryURL: String!, $commitSha: String!, $organizationId: String!, $commitTimestamp: Timestamp, $parentCommits: [ParentCommitInput!]) {
|
|
2166
2179
|
analyzeCommitForAIBlame(
|
|
2167
2180
|
repositoryURL: $repositoryURL
|
|
2168
2181
|
commitSha: $commitSha
|
|
2169
2182
|
organizationId: $organizationId
|
|
2170
|
-
commitDiff: $commitDiff
|
|
2171
2183
|
commitTimestamp: $commitTimestamp
|
|
2172
2184
|
parentCommits: $parentCommits
|
|
2173
2185
|
) {
|
|
@@ -2557,6 +2569,9 @@ function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
2557
2569
|
uploadS3BucketInfo(variables, requestHeaders, signal) {
|
|
2558
2570
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: UploadS3BucketInfoDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "uploadS3BucketInfo", "mutation", variables);
|
|
2559
2571
|
},
|
|
2572
|
+
GetTracyDiffUploadUrl(variables, requestHeaders, signal) {
|
|
2573
|
+
return withWrapper((wrappedRequestHeaders) => client.request({ document: GetTracyDiffUploadUrlDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "GetTracyDiffUploadUrl", "mutation", variables);
|
|
2574
|
+
},
|
|
2560
2575
|
AnalyzeCommitForExtensionAIBlame(variables, requestHeaders, signal) {
|
|
2561
2576
|
return withWrapper((wrappedRequestHeaders) => client.request({ document: AnalyzeCommitForExtensionAiBlameDocument, variables, requestHeaders: { ...requestHeaders, ...wrappedRequestHeaders }, signal }), "AnalyzeCommitForExtensionAIBlame", "mutation", variables);
|
|
2562
2577
|
},
|
|
@@ -5613,8 +5628,8 @@ import { z as z12 } from "zod";
|
|
|
5613
5628
|
var ADO_PREFIX_PATH = "tfs";
|
|
5614
5629
|
var NAME_REGEX = /[a-z0-9\-_.+]+/i;
|
|
5615
5630
|
function detectAdoUrl(args) {
|
|
5616
|
-
const { pathname, hostname
|
|
5617
|
-
const hostnameParts =
|
|
5631
|
+
const { pathname, hostname, scmType } = args;
|
|
5632
|
+
const hostnameParts = hostname.split(".");
|
|
5618
5633
|
const adoCloudHostname = new URL(scmCloudUrl.Ado).hostname;
|
|
5619
5634
|
const prefixPath = pathname.at(0)?.toLowerCase() === ADO_PREFIX_PATH ? ADO_PREFIX_PATH : "";
|
|
5620
5635
|
const normalizedPath = prefixPath ? pathname.slice(1) : pathname;
|
|
@@ -5643,7 +5658,7 @@ function detectAdoUrl(args) {
|
|
|
5643
5658
|
};
|
|
5644
5659
|
}
|
|
5645
5660
|
}
|
|
5646
|
-
if (
|
|
5661
|
+
if (hostname === adoCloudHostname || scmType === "Ado" /* Ado */) {
|
|
5647
5662
|
if (normalizedPath[normalizedPath.length - 2] === "_git") {
|
|
5648
5663
|
if (normalizedPath.length === 3) {
|
|
5649
5664
|
const [organization, _git, repoName] = normalizedPath;
|
|
@@ -5671,9 +5686,9 @@ function detectAdoUrl(args) {
|
|
|
5671
5686
|
return null;
|
|
5672
5687
|
}
|
|
5673
5688
|
function detectGithubUrl(args) {
|
|
5674
|
-
const { pathname, hostname
|
|
5689
|
+
const { pathname, hostname, scmType } = args;
|
|
5675
5690
|
const githubHostname = new URL(scmCloudUrl.GitHub).hostname;
|
|
5676
|
-
if (
|
|
5691
|
+
if (hostname === githubHostname || scmType === "GitHub" /* GitHub */) {
|
|
5677
5692
|
if (pathname.length === 2) {
|
|
5678
5693
|
return {
|
|
5679
5694
|
scmType: "GitHub" /* GitHub */,
|
|
@@ -5685,9 +5700,9 @@ function detectGithubUrl(args) {
|
|
|
5685
5700
|
return null;
|
|
5686
5701
|
}
|
|
5687
5702
|
function detectGitlabUrl(args) {
|
|
5688
|
-
const { pathname, hostname
|
|
5703
|
+
const { pathname, hostname, scmType } = args;
|
|
5689
5704
|
const gitlabHostname = new URL(scmCloudUrl.GitLab).hostname;
|
|
5690
|
-
if (
|
|
5705
|
+
if (hostname === gitlabHostname || scmType === "GitLab" /* GitLab */) {
|
|
5691
5706
|
if (pathname.length >= 2) {
|
|
5692
5707
|
return {
|
|
5693
5708
|
scmType: "GitLab" /* GitLab */,
|
|
@@ -5699,9 +5714,9 @@ function detectGitlabUrl(args) {
|
|
|
5699
5714
|
return null;
|
|
5700
5715
|
}
|
|
5701
5716
|
function detectBitbucketUrl(args) {
|
|
5702
|
-
const { pathname, hostname
|
|
5717
|
+
const { pathname, hostname, scmType } = args;
|
|
5703
5718
|
const bitbucketHostname = new URL(scmCloudUrl.Bitbucket).hostname;
|
|
5704
|
-
if (
|
|
5719
|
+
if (hostname === bitbucketHostname || scmType === "Bitbucket" /* Bitbucket */) {
|
|
5705
5720
|
if (pathname.length === 2) {
|
|
5706
5721
|
return {
|
|
5707
5722
|
scmType: "Bitbucket" /* Bitbucket */,
|
|
@@ -5730,10 +5745,10 @@ function getRepoInfo(args) {
|
|
|
5730
5745
|
function parseSshUrl(scmURL, scmType) {
|
|
5731
5746
|
const sshMatch = scmURL.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
5732
5747
|
if (!sshMatch) return null;
|
|
5733
|
-
const
|
|
5748
|
+
const hostname = sshMatch[1];
|
|
5734
5749
|
const pathPart = sshMatch[2];
|
|
5735
|
-
if (!
|
|
5736
|
-
const normalizedHostname =
|
|
5750
|
+
if (!hostname || !pathPart) return null;
|
|
5751
|
+
const normalizedHostname = hostname.toLowerCase();
|
|
5737
5752
|
let projectPath = pathPart;
|
|
5738
5753
|
if (normalizedHostname === "ssh.dev.azure.com" && projectPath.startsWith("v3/")) {
|
|
5739
5754
|
projectPath = projectPath.substring(3);
|
|
@@ -5821,11 +5836,11 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5821
5836
|
if (sshResult) return sshResult;
|
|
5822
5837
|
try {
|
|
5823
5838
|
const url = new URL(scmURL);
|
|
5824
|
-
const
|
|
5839
|
+
const hostname = url.hostname.toLowerCase();
|
|
5825
5840
|
const projectPath = url.pathname.substring(1).replace(/.git$/i, "");
|
|
5826
5841
|
const repo = getRepoInfo({
|
|
5827
5842
|
pathname: projectPath.split("/"),
|
|
5828
|
-
hostname
|
|
5843
|
+
hostname,
|
|
5829
5844
|
scmType
|
|
5830
5845
|
});
|
|
5831
5846
|
if (!repo) {
|
|
@@ -5835,7 +5850,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5835
5850
|
new URL(scmCloudUrl.Bitbucket).hostname,
|
|
5836
5851
|
new URL(scmCloudUrl.Ado).hostname
|
|
5837
5852
|
];
|
|
5838
|
-
if (knownHosts2.includes(
|
|
5853
|
+
if (knownHosts2.includes(hostname)) {
|
|
5839
5854
|
return null;
|
|
5840
5855
|
}
|
|
5841
5856
|
const pathElements = projectPath.split("/").filter(Boolean);
|
|
@@ -5846,7 +5861,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5846
5861
|
const repoName2 = pathElements[pathElements.length - 1] || "";
|
|
5847
5862
|
return {
|
|
5848
5863
|
scmType: "Unknown",
|
|
5849
|
-
hostname
|
|
5864
|
+
hostname,
|
|
5850
5865
|
organization: organization2,
|
|
5851
5866
|
projectPath,
|
|
5852
5867
|
repoName: repoName2,
|
|
@@ -5859,7 +5874,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
5859
5874
|
if (!organization.match(NAME_REGEX) || !repoName.match(NAME_REGEX))
|
|
5860
5875
|
return null;
|
|
5861
5876
|
const res = {
|
|
5862
|
-
hostname
|
|
5877
|
+
hostname,
|
|
5863
5878
|
organization,
|
|
5864
5879
|
projectPath,
|
|
5865
5880
|
repoName,
|
|
@@ -6048,8 +6063,8 @@ function normalizeUrl(repoUrl) {
|
|
|
6048
6063
|
}
|
|
6049
6064
|
const sshMatch = trimmedUrl.match(sshPattern);
|
|
6050
6065
|
if (sshMatch) {
|
|
6051
|
-
const [_all,
|
|
6052
|
-
trimmedUrl = `https://${
|
|
6066
|
+
const [_all, hostname, reporPath] = sshMatch;
|
|
6067
|
+
trimmedUrl = `https://${hostname}/${reporPath}`;
|
|
6053
6068
|
}
|
|
6054
6069
|
return trimmedUrl;
|
|
6055
6070
|
}
|
|
@@ -6080,17 +6095,17 @@ function getCloudScmLibTypeFromUrl(url) {
|
|
|
6080
6095
|
return void 0;
|
|
6081
6096
|
}
|
|
6082
6097
|
const urlObject = new URL(url);
|
|
6083
|
-
const
|
|
6084
|
-
if (
|
|
6098
|
+
const hostname = urlObject.hostname.toLowerCase();
|
|
6099
|
+
if (hostname === scmCloudHostname.GitLab) {
|
|
6085
6100
|
return "GITLAB" /* GITLAB */;
|
|
6086
6101
|
}
|
|
6087
|
-
if (
|
|
6102
|
+
if (hostname === scmCloudHostname.GitHub) {
|
|
6088
6103
|
return "GITHUB" /* GITHUB */;
|
|
6089
6104
|
}
|
|
6090
|
-
if (
|
|
6105
|
+
if (hostname === scmCloudHostname.Ado || hostname.endsWith(".visualstudio.com")) {
|
|
6091
6106
|
return "ADO" /* ADO */;
|
|
6092
6107
|
}
|
|
6093
|
-
if (
|
|
6108
|
+
if (hostname === scmCloudHostname.Bitbucket) {
|
|
6094
6109
|
return "BITBUCKET" /* BITBUCKET */;
|
|
6095
6110
|
}
|
|
6096
6111
|
return void 0;
|
|
@@ -6246,7 +6261,7 @@ function parseAdoOwnerAndRepo(adoUrl) {
|
|
|
6246
6261
|
projectName,
|
|
6247
6262
|
projectPath,
|
|
6248
6263
|
pathElements,
|
|
6249
|
-
hostname
|
|
6264
|
+
hostname,
|
|
6250
6265
|
protocol
|
|
6251
6266
|
} = parsingResult;
|
|
6252
6267
|
return {
|
|
@@ -6256,7 +6271,7 @@ function parseAdoOwnerAndRepo(adoUrl) {
|
|
|
6256
6271
|
projectPath,
|
|
6257
6272
|
pathElements,
|
|
6258
6273
|
prefixPath: parsingResult.prefixPath,
|
|
6259
|
-
origin: `${protocol}//${
|
|
6274
|
+
origin: `${protocol}//${hostname}`
|
|
6260
6275
|
};
|
|
6261
6276
|
}
|
|
6262
6277
|
function isValidAdoRepo(url) {
|
|
@@ -7467,8 +7482,8 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
7467
7482
|
if (!parseScmURLRes) {
|
|
7468
7483
|
throw new InvalidRepoUrlError("invalid repo url");
|
|
7469
7484
|
}
|
|
7470
|
-
const { protocol, hostname
|
|
7471
|
-
const url = `${protocol}//${
|
|
7485
|
+
const { protocol, hostname, organization, repoName } = parseScmURLRes;
|
|
7486
|
+
const url = `${protocol}//${hostname}/${organization}/${repoName}`;
|
|
7472
7487
|
switch (authData.authType) {
|
|
7473
7488
|
case "public": {
|
|
7474
7489
|
return trimmedUrl;
|
|
@@ -8754,8 +8769,8 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
8754
8769
|
if (!res) {
|
|
8755
8770
|
throw new InvalidRepoUrlError("invalid repo url");
|
|
8756
8771
|
}
|
|
8757
|
-
const { protocol, hostname
|
|
8758
|
-
const downloadUrl = isGithubOnPrem(this.url) ? `${protocol}//${
|
|
8772
|
+
const { protocol, hostname, organization, repoName } = res;
|
|
8773
|
+
const downloadUrl = isGithubOnPrem(this.url) ? `${protocol}//${hostname}/api/v3/repos/${organization}/${repoName}/zipball/${sha}` : `https://api.${hostname}/repos/${organization}/${repoName}/zipball/${sha}`;
|
|
8759
8774
|
return Promise.resolve(downloadUrl);
|
|
8760
8775
|
}
|
|
8761
8776
|
async _getUsernameForAuthUrl() {
|
|
@@ -10552,12 +10567,29 @@ function fortifyNodesToSarifLocations(nodes, unifiedNodePoolParser) {
|
|
|
10552
10567
|
import chalk2 from "chalk";
|
|
10553
10568
|
|
|
10554
10569
|
// src/constants.ts
|
|
10570
|
+
import fs7 from "fs";
|
|
10555
10571
|
import path6 from "path";
|
|
10556
10572
|
import chalk from "chalk";
|
|
10557
10573
|
import Debug4 from "debug";
|
|
10558
10574
|
import * as dotenv from "dotenv";
|
|
10559
10575
|
import { z as z24 } from "zod";
|
|
10560
10576
|
var debug5 = Debug4("mobbdev:constants");
|
|
10577
|
+
var runtimeConfigPath = path6.join(
|
|
10578
|
+
getModuleRootDir(),
|
|
10579
|
+
"out",
|
|
10580
|
+
"runtime.config.json"
|
|
10581
|
+
);
|
|
10582
|
+
if (fs7.existsSync(runtimeConfigPath)) {
|
|
10583
|
+
try {
|
|
10584
|
+
const runtimeConfig = JSON.parse(
|
|
10585
|
+
fs7.readFileSync(runtimeConfigPath, "utf-8")
|
|
10586
|
+
);
|
|
10587
|
+
Object.assign(process.env, runtimeConfig);
|
|
10588
|
+
debug5("Loaded runtime config from %s", runtimeConfigPath);
|
|
10589
|
+
} catch (e) {
|
|
10590
|
+
debug5("Failed to load runtime config: %o", e);
|
|
10591
|
+
}
|
|
10592
|
+
}
|
|
10561
10593
|
dotenv.config({ path: path6.join(getModuleRootDir(), ".env") });
|
|
10562
10594
|
var DEFAULT_API_URL = "https://api.mobb.ai/v1/graphql";
|
|
10563
10595
|
var DEFAULT_WEB_APP_URL = "https://app.mobb.ai";
|
|
@@ -10784,7 +10816,7 @@ function convertToSarifBuilder(args) {
|
|
|
10784
10816
|
).help().demandOption(["input-file-path", "input-file-format", "output-file-path"]);
|
|
10785
10817
|
}
|
|
10786
10818
|
async function validateConvertToSarifOptions(args) {
|
|
10787
|
-
if (!
|
|
10819
|
+
if (!fs8.existsSync(args.inputFilePath)) {
|
|
10788
10820
|
throw new CliError(
|
|
10789
10821
|
"\nError: --input-file-path flag should point to an existing file"
|
|
10790
10822
|
);
|
|
@@ -10816,14 +10848,14 @@ var ScanContext = {
|
|
|
10816
10848
|
};
|
|
10817
10849
|
|
|
10818
10850
|
// src/args/commands/analyze.ts
|
|
10819
|
-
import
|
|
10851
|
+
import fs11 from "fs";
|
|
10820
10852
|
import chalk8 from "chalk";
|
|
10821
10853
|
|
|
10822
10854
|
// src/commands/index.ts
|
|
10823
10855
|
import chalkAnimation from "chalk-animation";
|
|
10824
10856
|
|
|
10825
10857
|
// src/features/analysis/index.ts
|
|
10826
|
-
import
|
|
10858
|
+
import fs10 from "fs";
|
|
10827
10859
|
import fsPromises2 from "fs/promises";
|
|
10828
10860
|
import path9 from "path";
|
|
10829
10861
|
import { env as env2 } from "process";
|
|
@@ -11119,6 +11151,19 @@ var REPORT_STATE_CHECK_DELAY = 5 * 1e3;
|
|
|
11119
11151
|
function getProxyAgent(url) {
|
|
11120
11152
|
try {
|
|
11121
11153
|
const parsedUrl = new URL(url);
|
|
11154
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
11155
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]") {
|
|
11156
|
+
debug6("Skipping proxy for localhost URL: %s", url);
|
|
11157
|
+
return void 0;
|
|
11158
|
+
}
|
|
11159
|
+
const noProxy = process.env["NO_PROXY"] || process.env["no_proxy"];
|
|
11160
|
+
if (noProxy) {
|
|
11161
|
+
const noProxyList = noProxy.split(",").map((h) => h.trim().toLowerCase());
|
|
11162
|
+
if (noProxyList.includes(hostname) || noProxyList.includes("*")) {
|
|
11163
|
+
debug6("Skipping proxy due to NO_PROXY for: %s", url);
|
|
11164
|
+
return void 0;
|
|
11165
|
+
}
|
|
11166
|
+
}
|
|
11122
11167
|
const isHttp = parsedUrl.protocol === "http:";
|
|
11123
11168
|
const isHttps = parsedUrl.protocol === "https:";
|
|
11124
11169
|
const proxy = isHttps ? HTTPS_PROXY || HTTP_PROXY : isHttp ? HTTP_PROXY : null;
|
|
@@ -11528,6 +11573,9 @@ var GQLClient = class {
|
|
|
11528
11573
|
async getAIBlameAttributionPromptSummary(variables) {
|
|
11529
11574
|
return await this._clientSdk.GetPromptSummary(variables);
|
|
11530
11575
|
}
|
|
11576
|
+
async getTracyDiffUploadUrl(variables) {
|
|
11577
|
+
return await this._clientSdk.GetTracyDiffUploadUrl(variables);
|
|
11578
|
+
}
|
|
11531
11579
|
};
|
|
11532
11580
|
|
|
11533
11581
|
// src/mcp/services/types.ts
|
|
@@ -11551,9 +11599,9 @@ function createMcpLoginContext(trigger) {
|
|
|
11551
11599
|
ide: detectIDE()
|
|
11552
11600
|
};
|
|
11553
11601
|
}
|
|
11554
|
-
function buildLoginUrl(baseUrl, loginId,
|
|
11602
|
+
function buildLoginUrl(baseUrl, loginId, hostname, context) {
|
|
11555
11603
|
const url = new URL(`${baseUrl}/${loginId}`);
|
|
11556
|
-
url.searchParams.set("hostname",
|
|
11604
|
+
url.searchParams.set("hostname", hostname);
|
|
11557
11605
|
url.searchParams.set("trigger", context.trigger);
|
|
11558
11606
|
url.searchParams.set("source", context.source);
|
|
11559
11607
|
if (context.ide) {
|
|
@@ -12377,7 +12425,7 @@ async function getGitInfo(srcDirPath) {
|
|
|
12377
12425
|
|
|
12378
12426
|
// src/features/analysis/pack.ts
|
|
12379
12427
|
init_configs();
|
|
12380
|
-
import
|
|
12428
|
+
import fs9 from "fs";
|
|
12381
12429
|
import path7 from "path";
|
|
12382
12430
|
import AdmZip from "adm-zip";
|
|
12383
12431
|
import Debug13 from "debug";
|
|
@@ -12454,7 +12502,7 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
|
|
|
12454
12502
|
continue;
|
|
12455
12503
|
}
|
|
12456
12504
|
}
|
|
12457
|
-
if (
|
|
12505
|
+
if (fs9.lstatSync(absFilepath).size > MCP_MAX_FILE_SIZE) {
|
|
12458
12506
|
debug14("ignoring %s because the size is > 5MB", filepath);
|
|
12459
12507
|
continue;
|
|
12460
12508
|
}
|
|
@@ -12463,10 +12511,10 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
|
|
|
12463
12511
|
try {
|
|
12464
12512
|
data = await git.showBuffer([`HEAD:./${filepath}`]);
|
|
12465
12513
|
} catch {
|
|
12466
|
-
data =
|
|
12514
|
+
data = fs9.readFileSync(absFilepath);
|
|
12467
12515
|
}
|
|
12468
12516
|
} else {
|
|
12469
|
-
data =
|
|
12517
|
+
data = fs9.readFileSync(absFilepath);
|
|
12470
12518
|
}
|
|
12471
12519
|
if (isBinary2(null, data)) {
|
|
12472
12520
|
debug14("ignoring %s because is seems to be a binary file", filepath);
|
|
@@ -12645,8 +12693,8 @@ if (typeof __filename !== "undefined") {
|
|
|
12645
12693
|
}
|
|
12646
12694
|
var costumeRequire = createRequire(moduleUrl);
|
|
12647
12695
|
var getCheckmarxPath = () => {
|
|
12648
|
-
const
|
|
12649
|
-
const cxFileName =
|
|
12696
|
+
const os12 = type();
|
|
12697
|
+
const cxFileName = os12 === "Windows_NT" ? "cx.exe" : "cx";
|
|
12650
12698
|
try {
|
|
12651
12699
|
return costumeRequire.resolve(`.bin/${cxFileName}`);
|
|
12652
12700
|
} catch (e) {
|
|
@@ -12927,13 +12975,13 @@ async function downloadRepo({
|
|
|
12927
12975
|
repoSpinner.error({ text: "\u{1F4BE} Repo download failed" });
|
|
12928
12976
|
throw new Error(`Can't access ${chalk6.bold(repoUrl)}`);
|
|
12929
12977
|
}
|
|
12930
|
-
const fileWriterStream =
|
|
12978
|
+
const fileWriterStream = fs10.createWriteStream(zipFilePath);
|
|
12931
12979
|
if (!response.body) {
|
|
12932
12980
|
throw new Error("Response body is empty");
|
|
12933
12981
|
}
|
|
12934
12982
|
await pipeline(response.body, fileWriterStream);
|
|
12935
12983
|
await extract(zipFilePath, { dir: dirname });
|
|
12936
|
-
const repoRoot =
|
|
12984
|
+
const repoRoot = fs10.readdirSync(dirname, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name)[0];
|
|
12937
12985
|
if (!repoRoot) {
|
|
12938
12986
|
throw new Error("Repo root not found");
|
|
12939
12987
|
}
|
|
@@ -13747,7 +13795,7 @@ function analyzeBuilder(yargs2) {
|
|
|
13747
13795
|
).help();
|
|
13748
13796
|
}
|
|
13749
13797
|
function validateAnalyzeOptions(argv) {
|
|
13750
|
-
if (argv.f && !
|
|
13798
|
+
if (argv.f && !fs11.existsSync(argv.f)) {
|
|
13751
13799
|
throw new CliError(`
|
|
13752
13800
|
Can't access ${chalk8.bold(argv.f)}`);
|
|
13753
13801
|
}
|
|
@@ -13795,12 +13843,101 @@ import { z as z32 } from "zod";
|
|
|
13795
13843
|
|
|
13796
13844
|
// src/args/commands/upload_ai_blame.ts
|
|
13797
13845
|
import fsPromises3 from "fs/promises";
|
|
13798
|
-
import * as
|
|
13846
|
+
import * as os3 from "os";
|
|
13799
13847
|
import path11 from "path";
|
|
13800
13848
|
import chalk9 from "chalk";
|
|
13801
13849
|
import { withFile } from "tmp-promise";
|
|
13802
13850
|
import z31 from "zod";
|
|
13803
13851
|
|
|
13852
|
+
// src/utils/computerName.ts
|
|
13853
|
+
import { execSync } from "child_process";
|
|
13854
|
+
import os2 from "os";
|
|
13855
|
+
var STABLE_COMPUTER_NAME_CONFIG_KEY = "stableComputerName";
|
|
13856
|
+
var HOSTNAME_SUFFIXES = [
|
|
13857
|
+
// Cloud providers (must be first - most specific)
|
|
13858
|
+
".ec2.internal",
|
|
13859
|
+
".compute.internal",
|
|
13860
|
+
".cloudapp.net",
|
|
13861
|
+
// mDNS/Bonjour
|
|
13862
|
+
".local",
|
|
13863
|
+
".localhost",
|
|
13864
|
+
".localdomain",
|
|
13865
|
+
// Home networks
|
|
13866
|
+
".lan",
|
|
13867
|
+
".home",
|
|
13868
|
+
".homelan",
|
|
13869
|
+
// Corporate networks
|
|
13870
|
+
".corp",
|
|
13871
|
+
".internal",
|
|
13872
|
+
".intranet",
|
|
13873
|
+
".domain",
|
|
13874
|
+
".work",
|
|
13875
|
+
".office",
|
|
13876
|
+
// Container environments
|
|
13877
|
+
".docker",
|
|
13878
|
+
".kubernetes",
|
|
13879
|
+
".k8s"
|
|
13880
|
+
];
|
|
13881
|
+
function getOsSpecificComputerName() {
|
|
13882
|
+
const platform2 = os2.platform();
|
|
13883
|
+
try {
|
|
13884
|
+
if (platform2 === "darwin") {
|
|
13885
|
+
const result = execSync("scutil --get LocalHostName", {
|
|
13886
|
+
encoding: "utf-8",
|
|
13887
|
+
timeout: 1e3
|
|
13888
|
+
});
|
|
13889
|
+
return result.trim();
|
|
13890
|
+
} else if (platform2 === "win32") {
|
|
13891
|
+
return process.env["COMPUTERNAME"] || null;
|
|
13892
|
+
} else {
|
|
13893
|
+
try {
|
|
13894
|
+
const result2 = execSync("hostnamectl --static", {
|
|
13895
|
+
encoding: "utf-8",
|
|
13896
|
+
timeout: 1e3
|
|
13897
|
+
});
|
|
13898
|
+
const hostname = result2.trim();
|
|
13899
|
+
if (hostname) return hostname;
|
|
13900
|
+
} catch {
|
|
13901
|
+
}
|
|
13902
|
+
const result = execSync("cat /etc/hostname", {
|
|
13903
|
+
encoding: "utf-8",
|
|
13904
|
+
timeout: 1e3
|
|
13905
|
+
});
|
|
13906
|
+
return result.trim();
|
|
13907
|
+
}
|
|
13908
|
+
} catch (error) {
|
|
13909
|
+
return null;
|
|
13910
|
+
}
|
|
13911
|
+
}
|
|
13912
|
+
function stripHostnameSuffixes(hostname) {
|
|
13913
|
+
if (!hostname) return hostname;
|
|
13914
|
+
let normalized = hostname;
|
|
13915
|
+
for (const suffix of HOSTNAME_SUFFIXES) {
|
|
13916
|
+
if (normalized.endsWith(suffix)) {
|
|
13917
|
+
normalized = normalized.slice(0, -suffix.length);
|
|
13918
|
+
break;
|
|
13919
|
+
}
|
|
13920
|
+
}
|
|
13921
|
+
return normalized;
|
|
13922
|
+
}
|
|
13923
|
+
function generateStableComputerName() {
|
|
13924
|
+
const osSpecificName = getOsSpecificComputerName();
|
|
13925
|
+
if (osSpecificName) {
|
|
13926
|
+
return osSpecificName;
|
|
13927
|
+
}
|
|
13928
|
+
const currentHostname = os2.hostname();
|
|
13929
|
+
return stripHostnameSuffixes(currentHostname);
|
|
13930
|
+
}
|
|
13931
|
+
function getStableComputerName() {
|
|
13932
|
+
const cached = configStore.get(STABLE_COMPUTER_NAME_CONFIG_KEY);
|
|
13933
|
+
if (cached) {
|
|
13934
|
+
return cached;
|
|
13935
|
+
}
|
|
13936
|
+
const currentName = generateStableComputerName();
|
|
13937
|
+
configStore.set(STABLE_COMPUTER_NAME_CONFIG_KEY, currentName);
|
|
13938
|
+
return currentName;
|
|
13939
|
+
}
|
|
13940
|
+
|
|
13804
13941
|
// src/utils/sanitize-sensitive-data.ts
|
|
13805
13942
|
import { OpenRedaction } from "@openredaction/openredaction";
|
|
13806
13943
|
var openRedaction = new OpenRedaction({
|
|
@@ -13985,12 +14122,12 @@ var PromptItemArrayZ = z31.array(PromptItemZ);
|
|
|
13985
14122
|
function getSystemInfo() {
|
|
13986
14123
|
let userName;
|
|
13987
14124
|
try {
|
|
13988
|
-
userName =
|
|
14125
|
+
userName = os3.userInfo().username;
|
|
13989
14126
|
} catch {
|
|
13990
14127
|
userName = void 0;
|
|
13991
14128
|
}
|
|
13992
14129
|
return {
|
|
13993
|
-
computerName:
|
|
14130
|
+
computerName: getStableComputerName(),
|
|
13994
14131
|
userName
|
|
13995
14132
|
};
|
|
13996
14133
|
}
|
|
@@ -14506,10 +14643,10 @@ async function processAndUploadHookData() {
|
|
|
14506
14643
|
|
|
14507
14644
|
// src/features/claude_code/install_hook.ts
|
|
14508
14645
|
import fsPromises5 from "fs/promises";
|
|
14509
|
-
import
|
|
14646
|
+
import os4 from "os";
|
|
14510
14647
|
import path12 from "path";
|
|
14511
14648
|
import chalk10 from "chalk";
|
|
14512
|
-
var CLAUDE_SETTINGS_PATH = path12.join(
|
|
14649
|
+
var CLAUDE_SETTINGS_PATH = path12.join(os4.homedir(), ".claude", "settings.json");
|
|
14513
14650
|
async function claudeSettingsExists() {
|
|
14514
14651
|
try {
|
|
14515
14652
|
await fsPromises5.access(CLAUDE_SETTINGS_PATH);
|
|
@@ -14972,7 +15109,7 @@ var GetLatestReportByRepoUrlResponseSchema = z33.object({
|
|
|
14972
15109
|
|
|
14973
15110
|
// src/mcp/services/McpAuthService.ts
|
|
14974
15111
|
import crypto2 from "crypto";
|
|
14975
|
-
import
|
|
15112
|
+
import os5 from "os";
|
|
14976
15113
|
import open4 from "open";
|
|
14977
15114
|
init_configs();
|
|
14978
15115
|
var McpAuthService = class {
|
|
@@ -15017,7 +15154,7 @@ var McpAuthService = class {
|
|
|
15017
15154
|
}
|
|
15018
15155
|
logDebug(`cli login created ${loginId}`);
|
|
15019
15156
|
const webLoginUrl = `${WEB_APP_URL}/mvs-login`;
|
|
15020
|
-
const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId,
|
|
15157
|
+
const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os5.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os5.hostname()}`;
|
|
15021
15158
|
await this.openBrowser(browserUrl, isBackgoundCall);
|
|
15022
15159
|
logDebug(`waiting for login to complete`);
|
|
15023
15160
|
let newApiToken = null;
|
|
@@ -15722,14 +15859,14 @@ async function createAuthenticatedMcpGQLClient({
|
|
|
15722
15859
|
}
|
|
15723
15860
|
|
|
15724
15861
|
// src/mcp/services/McpUsageService/host.ts
|
|
15725
|
-
import { execSync } from "child_process";
|
|
15726
|
-
import
|
|
15727
|
-
import
|
|
15862
|
+
import { execSync as execSync2 } from "child_process";
|
|
15863
|
+
import fs12 from "fs";
|
|
15864
|
+
import os6 from "os";
|
|
15728
15865
|
import path13 from "path";
|
|
15729
15866
|
var IDEs = ["cursor", "windsurf", "webstorm", "vscode", "claude"];
|
|
15730
15867
|
var runCommand = (cmd) => {
|
|
15731
15868
|
try {
|
|
15732
|
-
return
|
|
15869
|
+
return execSync2(cmd, { encoding: "utf8" }).trim();
|
|
15733
15870
|
} catch {
|
|
15734
15871
|
return "";
|
|
15735
15872
|
}
|
|
@@ -15739,18 +15876,18 @@ var gitInfo = {
|
|
|
15739
15876
|
email: runCommand("git config user.email")
|
|
15740
15877
|
};
|
|
15741
15878
|
var getClaudeWorkspacePaths = () => {
|
|
15742
|
-
const home =
|
|
15879
|
+
const home = os6.homedir();
|
|
15743
15880
|
const claudeIdePath = path13.join(home, ".claude", "ide");
|
|
15744
15881
|
const workspacePaths = [];
|
|
15745
|
-
if (!
|
|
15882
|
+
if (!fs12.existsSync(claudeIdePath)) {
|
|
15746
15883
|
return workspacePaths;
|
|
15747
15884
|
}
|
|
15748
15885
|
try {
|
|
15749
|
-
const lockFiles =
|
|
15886
|
+
const lockFiles = fs12.readdirSync(claudeIdePath).filter((file) => file.endsWith(".lock"));
|
|
15750
15887
|
for (const lockFile of lockFiles) {
|
|
15751
15888
|
const lockFilePath = path13.join(claudeIdePath, lockFile);
|
|
15752
15889
|
try {
|
|
15753
|
-
const lockContent = JSON.parse(
|
|
15890
|
+
const lockContent = JSON.parse(fs12.readFileSync(lockFilePath, "utf8"));
|
|
15754
15891
|
if (lockContent.workspaceFolders && Array.isArray(lockContent.workspaceFolders)) {
|
|
15755
15892
|
workspacePaths.push(...lockContent.workspaceFolders);
|
|
15756
15893
|
}
|
|
@@ -15768,7 +15905,7 @@ var getClaudeWorkspacePaths = () => {
|
|
|
15768
15905
|
return workspacePaths;
|
|
15769
15906
|
};
|
|
15770
15907
|
var getMCPConfigPaths = (hostName) => {
|
|
15771
|
-
const home =
|
|
15908
|
+
const home = os6.homedir();
|
|
15772
15909
|
const currentDir = process.env["WORKSPACE_FOLDER_PATHS"] || process.env["PWD"] || process.cwd();
|
|
15773
15910
|
switch (hostName.toLowerCase()) {
|
|
15774
15911
|
case "cursor":
|
|
@@ -15816,9 +15953,9 @@ var getMCPConfigPaths = (hostName) => {
|
|
|
15816
15953
|
}
|
|
15817
15954
|
};
|
|
15818
15955
|
var readConfigFile = (filePath) => {
|
|
15819
|
-
if (!
|
|
15956
|
+
if (!fs12.existsSync(filePath)) return null;
|
|
15820
15957
|
try {
|
|
15821
|
-
return JSON.parse(
|
|
15958
|
+
return JSON.parse(fs12.readFileSync(filePath, "utf8"));
|
|
15822
15959
|
} catch (error) {
|
|
15823
15960
|
logWarn(`[UsageService] Failed to read MCP config: ${filePath}`);
|
|
15824
15961
|
return null;
|
|
@@ -15858,14 +15995,14 @@ var readMCPConfig = (hostName) => {
|
|
|
15858
15995
|
};
|
|
15859
15996
|
var getRunningProcesses = () => {
|
|
15860
15997
|
try {
|
|
15861
|
-
return
|
|
15998
|
+
return os6.platform() === "win32" ? execSync2("tasklist", { encoding: "utf8" }) : execSync2("ps aux", { encoding: "utf8" });
|
|
15862
15999
|
} catch {
|
|
15863
16000
|
return "";
|
|
15864
16001
|
}
|
|
15865
16002
|
};
|
|
15866
16003
|
var checkUrlAccessibility = (url) => {
|
|
15867
16004
|
try {
|
|
15868
|
-
|
|
16005
|
+
execSync2(`curl -s --connect-timeout 5 --max-time 3 "${url}"`, {
|
|
15869
16006
|
encoding: "utf8",
|
|
15870
16007
|
stdio: "ignore"
|
|
15871
16008
|
});
|
|
@@ -15933,17 +16070,17 @@ var versionCommands = {
|
|
|
15933
16070
|
}
|
|
15934
16071
|
};
|
|
15935
16072
|
var getProcessInfo = (pid) => {
|
|
15936
|
-
const platform2 =
|
|
16073
|
+
const platform2 = os6.platform();
|
|
15937
16074
|
try {
|
|
15938
16075
|
if (platform2 === "linux" || platform2 === "darwin") {
|
|
15939
|
-
const output =
|
|
16076
|
+
const output = execSync2(`ps -o pid=,ppid=,comm= -p ${pid}`, {
|
|
15940
16077
|
stdio: ["pipe", "pipe", "ignore"]
|
|
15941
16078
|
}).toString().trim();
|
|
15942
16079
|
if (!output) return null;
|
|
15943
16080
|
const [pidStr, ppid, ...cmd] = output.trim().split(/\s+/);
|
|
15944
16081
|
return { pid: pidStr ?? "", ppid: ppid ?? "", cmd: cmd.join(" ") };
|
|
15945
16082
|
} else if (platform2 === "win32") {
|
|
15946
|
-
const output =
|
|
16083
|
+
const output = execSync2(
|
|
15947
16084
|
`powershell -Command "Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}' | Select-Object ProcessId,ParentProcessId,Name | Format-Table -HideTableHeaders"`,
|
|
15948
16085
|
{ stdio: ["pipe", "pipe", "ignore"] }
|
|
15949
16086
|
).toString().trim();
|
|
@@ -16052,11 +16189,11 @@ var getHostInfo = (additionalMcpList) => {
|
|
|
16052
16189
|
const config2 = allConfigs[ide] || null;
|
|
16053
16190
|
const ideName = ide.charAt(0).toUpperCase() + ide.slice(1) || "Unknown";
|
|
16054
16191
|
let ideVersion = "Unknown";
|
|
16055
|
-
const platform2 =
|
|
16192
|
+
const platform2 = os6.platform();
|
|
16056
16193
|
const cmds = versionCommands[ideName]?.[platform2] ?? [];
|
|
16057
16194
|
for (const cmd of cmds) {
|
|
16058
16195
|
try {
|
|
16059
|
-
const versionOutput = cmd.includes("grep") || cmd.includes("--version") || cmd.includes("sed") ?
|
|
16196
|
+
const versionOutput = cmd.includes("grep") || cmd.includes("--version") || cmd.includes("sed") ? execSync2(cmd, { stdio: ["pipe", "pipe", "ignore"] }).toString().split("\n")[0] ?? "" : cmd;
|
|
16060
16197
|
if (versionOutput && versionOutput !== "Unknown") {
|
|
16061
16198
|
ideVersion = versionOutput;
|
|
16062
16199
|
break;
|
|
@@ -16085,14 +16222,14 @@ var getHostInfo = (additionalMcpList) => {
|
|
|
16085
16222
|
|
|
16086
16223
|
// src/mcp/services/McpUsageService/McpUsageService.ts
|
|
16087
16224
|
import fetch5 from "node-fetch";
|
|
16088
|
-
import
|
|
16225
|
+
import os8 from "os";
|
|
16089
16226
|
import { v4 as uuidv43, v5 as uuidv5 } from "uuid";
|
|
16090
16227
|
init_configs();
|
|
16091
16228
|
|
|
16092
16229
|
// src/mcp/services/McpUsageService/system.ts
|
|
16093
16230
|
init_configs();
|
|
16094
|
-
import
|
|
16095
|
-
import
|
|
16231
|
+
import fs13 from "fs";
|
|
16232
|
+
import os7 from "os";
|
|
16096
16233
|
import path14 from "path";
|
|
16097
16234
|
var MAX_DEPTH = 2;
|
|
16098
16235
|
var patterns = ["mcp", "claude"];
|
|
@@ -16102,7 +16239,7 @@ var isFileMatch = (fileName) => {
|
|
|
16102
16239
|
};
|
|
16103
16240
|
var safeAccess = async (filePath) => {
|
|
16104
16241
|
try {
|
|
16105
|
-
await
|
|
16242
|
+
await fs13.promises.access(filePath, fs13.constants.R_OK);
|
|
16106
16243
|
return true;
|
|
16107
16244
|
} catch {
|
|
16108
16245
|
return false;
|
|
@@ -16111,7 +16248,7 @@ var safeAccess = async (filePath) => {
|
|
|
16111
16248
|
var searchDir = async (dir, depth = 0) => {
|
|
16112
16249
|
const results = [];
|
|
16113
16250
|
if (depth > MAX_DEPTH) return results;
|
|
16114
|
-
const entries = await
|
|
16251
|
+
const entries = await fs13.promises.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
16115
16252
|
for (const entry of entries) {
|
|
16116
16253
|
const fullPath = path14.join(dir, entry.name);
|
|
16117
16254
|
if (entry.isFile() && isFileMatch(entry.name)) {
|
|
@@ -16127,8 +16264,8 @@ var searchDir = async (dir, depth = 0) => {
|
|
|
16127
16264
|
};
|
|
16128
16265
|
var findSystemMCPConfigs = async () => {
|
|
16129
16266
|
try {
|
|
16130
|
-
const home =
|
|
16131
|
-
const platform2 =
|
|
16267
|
+
const home = os7.homedir();
|
|
16268
|
+
const platform2 = os7.platform();
|
|
16132
16269
|
const knownDirs = platform2 === "win32" ? [
|
|
16133
16270
|
path14.join(home, ".cursor"),
|
|
16134
16271
|
path14.join(home, "Documents"),
|
|
@@ -16149,7 +16286,7 @@ var findSystemMCPConfigs = async () => {
|
|
|
16149
16286
|
);
|
|
16150
16287
|
const searchPromise = Promise.all(
|
|
16151
16288
|
knownDirs.map(
|
|
16152
|
-
(dir) =>
|
|
16289
|
+
(dir) => fs13.existsSync(dir) ? searchDir(dir) : Promise.resolve([])
|
|
16153
16290
|
)
|
|
16154
16291
|
).then((results) => results.flat());
|
|
16155
16292
|
return await Promise.race([timeoutPromise, searchPromise]);
|
|
@@ -16200,7 +16337,7 @@ var McpUsageService = class {
|
|
|
16200
16337
|
generateHostId() {
|
|
16201
16338
|
const stored = configStore.get(this.configKey);
|
|
16202
16339
|
if (stored?.mcpHostId) return stored.mcpHostId;
|
|
16203
|
-
const interfaces =
|
|
16340
|
+
const interfaces = os8.networkInterfaces();
|
|
16204
16341
|
const macs = [];
|
|
16205
16342
|
for (const iface of Object.values(interfaces)) {
|
|
16206
16343
|
if (!iface) continue;
|
|
@@ -16208,7 +16345,7 @@ var McpUsageService = class {
|
|
|
16208
16345
|
if (net.mac && net.mac !== "00:00:00:00:00:00") macs.push(net.mac);
|
|
16209
16346
|
}
|
|
16210
16347
|
}
|
|
16211
|
-
const macString = macs.length ? macs.sort().join(",") : `${
|
|
16348
|
+
const macString = macs.length ? macs.sort().join(",") : `${os8.hostname()}-${uuidv43()}`;
|
|
16212
16349
|
const hostId = uuidv5(macString, uuidv5.DNS);
|
|
16213
16350
|
logDebug("[UsageService] Generated new host ID", { hostId });
|
|
16214
16351
|
return hostId;
|
|
@@ -16231,7 +16368,7 @@ var McpUsageService = class {
|
|
|
16231
16368
|
mcpHostId,
|
|
16232
16369
|
organizationId,
|
|
16233
16370
|
mcpVersion: packageJson.version,
|
|
16234
|
-
mcpOsName:
|
|
16371
|
+
mcpOsName: os8.platform(),
|
|
16235
16372
|
mcps: JSON.stringify(mcps),
|
|
16236
16373
|
status,
|
|
16237
16374
|
userName: user.name,
|
|
@@ -18551,30 +18688,30 @@ For a complete security audit workflow, use the \`full-security-audit\` prompt.
|
|
|
18551
18688
|
};
|
|
18552
18689
|
|
|
18553
18690
|
// src/mcp/services/McpDetectionService/CursorMcpDetectionService.ts
|
|
18554
|
-
import * as
|
|
18555
|
-
import * as
|
|
18691
|
+
import * as fs16 from "fs";
|
|
18692
|
+
import * as os10 from "os";
|
|
18556
18693
|
import * as path16 from "path";
|
|
18557
18694
|
|
|
18558
18695
|
// src/mcp/services/McpDetectionService/BaseMcpDetectionService.ts
|
|
18559
18696
|
init_configs();
|
|
18560
|
-
import * as
|
|
18697
|
+
import * as fs15 from "fs";
|
|
18561
18698
|
import fetch6 from "node-fetch";
|
|
18562
18699
|
import * as path15 from "path";
|
|
18563
18700
|
|
|
18564
18701
|
// src/mcp/services/McpDetectionService/McpDetectionServiceUtils.ts
|
|
18565
|
-
import * as
|
|
18566
|
-
import * as
|
|
18702
|
+
import * as fs14 from "fs";
|
|
18703
|
+
import * as os9 from "os";
|
|
18567
18704
|
|
|
18568
18705
|
// src/mcp/services/McpDetectionService/VscodeMcpDetectionService.ts
|
|
18569
|
-
import * as
|
|
18570
|
-
import * as
|
|
18706
|
+
import * as fs17 from "fs";
|
|
18707
|
+
import * as os11 from "os";
|
|
18571
18708
|
import * as path17 from "path";
|
|
18572
18709
|
|
|
18573
18710
|
// src/mcp/tools/checkForNewAvailableFixes/CheckForNewAvailableFixesTool.ts
|
|
18574
18711
|
import { z as z42 } from "zod";
|
|
18575
18712
|
|
|
18576
18713
|
// src/mcp/services/PathValidation.ts
|
|
18577
|
-
import
|
|
18714
|
+
import fs18 from "fs";
|
|
18578
18715
|
import path18 from "path";
|
|
18579
18716
|
async function validatePath(inputPath) {
|
|
18580
18717
|
logDebug("Validating MCP path", { inputPath });
|
|
@@ -18634,7 +18771,7 @@ async function validatePath(inputPath) {
|
|
|
18634
18771
|
logDebug("Path validation successful", { inputPath });
|
|
18635
18772
|
logDebug("Checking path existence", { inputPath });
|
|
18636
18773
|
try {
|
|
18637
|
-
await
|
|
18774
|
+
await fs18.promises.access(inputPath);
|
|
18638
18775
|
logDebug("Path exists and is accessible", { inputPath });
|
|
18639
18776
|
WorkspaceService.setKnownWorkspacePath(inputPath);
|
|
18640
18777
|
logDebug("Stored validated path in WorkspaceService", { inputPath });
|
|
@@ -19261,7 +19398,7 @@ If you wish to scan files that were recently changed in your git history call th
|
|
|
19261
19398
|
init_FileUtils();
|
|
19262
19399
|
init_GitService();
|
|
19263
19400
|
init_configs();
|
|
19264
|
-
import
|
|
19401
|
+
import fs19 from "fs/promises";
|
|
19265
19402
|
import nodePath from "path";
|
|
19266
19403
|
var getLocalFiles = async ({
|
|
19267
19404
|
path: path22,
|
|
@@ -19279,7 +19416,7 @@ var getLocalFiles = async ({
|
|
|
19279
19416
|
scanRecentlyChangedFiles
|
|
19280
19417
|
});
|
|
19281
19418
|
try {
|
|
19282
|
-
const resolvedRepoPath = await
|
|
19419
|
+
const resolvedRepoPath = await fs19.realpath(path22);
|
|
19283
19420
|
logDebug(`[${scanContext}] Resolved repository path`, {
|
|
19284
19421
|
resolvedRepoPath,
|
|
19285
19422
|
originalPath: path22
|
|
@@ -19359,7 +19496,7 @@ var getLocalFiles = async ({
|
|
|
19359
19496
|
absoluteFilePath
|
|
19360
19497
|
);
|
|
19361
19498
|
try {
|
|
19362
|
-
const fileStat = await
|
|
19499
|
+
const fileStat = await fs19.stat(absoluteFilePath);
|
|
19363
19500
|
return {
|
|
19364
19501
|
filename: nodePath.basename(absoluteFilePath),
|
|
19365
19502
|
relativePath,
|
|
@@ -19394,7 +19531,7 @@ var getLocalFiles = async ({
|
|
|
19394
19531
|
};
|
|
19395
19532
|
|
|
19396
19533
|
// src/mcp/services/LocalMobbFolderService.ts
|
|
19397
|
-
import
|
|
19534
|
+
import fs20 from "fs";
|
|
19398
19535
|
import path19 from "path";
|
|
19399
19536
|
import { z as z41 } from "zod";
|
|
19400
19537
|
init_GitService();
|
|
@@ -19486,15 +19623,15 @@ var LocalMobbFolderService = class {
|
|
|
19486
19623
|
this.repoPath,
|
|
19487
19624
|
this.defaultMobbFolderName
|
|
19488
19625
|
);
|
|
19489
|
-
if (!
|
|
19626
|
+
if (!fs20.existsSync(mobbFolderPath)) {
|
|
19490
19627
|
logInfo("[LocalMobbFolderService] Creating .mobb folder", {
|
|
19491
19628
|
mobbFolderPath
|
|
19492
19629
|
});
|
|
19493
|
-
|
|
19630
|
+
fs20.mkdirSync(mobbFolderPath, { recursive: true });
|
|
19494
19631
|
} else {
|
|
19495
19632
|
logDebug("[LocalMobbFolderService] .mobb folder already exists");
|
|
19496
19633
|
}
|
|
19497
|
-
const stats =
|
|
19634
|
+
const stats = fs20.statSync(mobbFolderPath);
|
|
19498
19635
|
if (!stats.isDirectory()) {
|
|
19499
19636
|
throw new Error(`Path exists but is not a directory: ${mobbFolderPath}`);
|
|
19500
19637
|
}
|
|
@@ -19535,13 +19672,13 @@ var LocalMobbFolderService = class {
|
|
|
19535
19672
|
logDebug("[LocalMobbFolderService] Git repository validated successfully");
|
|
19536
19673
|
} else {
|
|
19537
19674
|
try {
|
|
19538
|
-
const stats =
|
|
19675
|
+
const stats = fs20.statSync(this.repoPath);
|
|
19539
19676
|
if (!stats.isDirectory()) {
|
|
19540
19677
|
throw new Error(
|
|
19541
19678
|
`Path exists but is not a directory: ${this.repoPath}`
|
|
19542
19679
|
);
|
|
19543
19680
|
}
|
|
19544
|
-
|
|
19681
|
+
fs20.accessSync(this.repoPath, fs20.constants.R_OK | fs20.constants.W_OK);
|
|
19545
19682
|
logDebug(
|
|
19546
19683
|
"[LocalMobbFolderService] Non-git directory validated successfully"
|
|
19547
19684
|
);
|
|
@@ -19655,7 +19792,7 @@ var LocalMobbFolderService = class {
|
|
|
19655
19792
|
baseFileName
|
|
19656
19793
|
);
|
|
19657
19794
|
const filePath = path19.join(mobbFolderPath, uniqueFileName);
|
|
19658
|
-
await
|
|
19795
|
+
await fs20.promises.writeFile(filePath, patch, "utf8");
|
|
19659
19796
|
logInfo("[LocalMobbFolderService] Patch saved successfully", {
|
|
19660
19797
|
filePath,
|
|
19661
19798
|
fileName: uniqueFileName,
|
|
@@ -19716,7 +19853,7 @@ var LocalMobbFolderService = class {
|
|
|
19716
19853
|
const extension = path19.parse(baseFileName).ext;
|
|
19717
19854
|
let uniqueFileName = baseFileName;
|
|
19718
19855
|
let index = 1;
|
|
19719
|
-
while (
|
|
19856
|
+
while (fs20.existsSync(path19.join(folderPath, uniqueFileName))) {
|
|
19720
19857
|
uniqueFileName = `${baseName}-${index}${extension}`;
|
|
19721
19858
|
index++;
|
|
19722
19859
|
if (index > 1e3) {
|
|
@@ -19750,15 +19887,15 @@ var LocalMobbFolderService = class {
|
|
|
19750
19887
|
const patchInfoPath = path19.join(mobbFolderPath, "patchInfo.md");
|
|
19751
19888
|
const markdownContent = this.generateFixMarkdown(fix, savedPatchFileName);
|
|
19752
19889
|
let existingContent = "";
|
|
19753
|
-
if (
|
|
19754
|
-
existingContent = await
|
|
19890
|
+
if (fs20.existsSync(patchInfoPath)) {
|
|
19891
|
+
existingContent = await fs20.promises.readFile(patchInfoPath, "utf8");
|
|
19755
19892
|
logDebug("[LocalMobbFolderService] Existing patchInfo.md found");
|
|
19756
19893
|
} else {
|
|
19757
19894
|
logDebug("[LocalMobbFolderService] Creating new patchInfo.md file");
|
|
19758
19895
|
}
|
|
19759
19896
|
const separator = existingContent ? "\n\n================================================================================\n\n" : "";
|
|
19760
19897
|
const updatedContent = `${markdownContent}${separator}${existingContent}`;
|
|
19761
|
-
await
|
|
19898
|
+
await fs20.promises.writeFile(patchInfoPath, updatedContent, "utf8");
|
|
19762
19899
|
logInfo("[LocalMobbFolderService] Patch info logged successfully", {
|
|
19763
19900
|
patchInfoPath,
|
|
19764
19901
|
fixId: fix.id,
|
|
@@ -20131,7 +20268,7 @@ import {
|
|
|
20131
20268
|
unlinkSync,
|
|
20132
20269
|
writeFileSync
|
|
20133
20270
|
} from "fs";
|
|
20134
|
-
import
|
|
20271
|
+
import fs21 from "fs/promises";
|
|
20135
20272
|
import parseDiff2 from "parse-diff";
|
|
20136
20273
|
import path20 from "path";
|
|
20137
20274
|
var PatchApplicationService = class {
|
|
@@ -20652,7 +20789,7 @@ var PatchApplicationService = class {
|
|
|
20652
20789
|
try {
|
|
20653
20790
|
const absolutePath = path20.resolve(repositoryPath, targetFile);
|
|
20654
20791
|
if (existsSync6(absolutePath)) {
|
|
20655
|
-
const stats = await
|
|
20792
|
+
const stats = await fs21.stat(absolutePath);
|
|
20656
20793
|
const fileModTime = stats.mtime.getTime();
|
|
20657
20794
|
if (fileModTime > scanStartTime) {
|
|
20658
20795
|
logError(
|
|
@@ -20693,7 +20830,7 @@ var PatchApplicationService = class {
|
|
|
20693
20830
|
const appliedFixes = [];
|
|
20694
20831
|
const failedFixes = [];
|
|
20695
20832
|
const skippedFixes = [];
|
|
20696
|
-
const resolvedRepoPath = await
|
|
20833
|
+
const resolvedRepoPath = await fs21.realpath(repositoryPath);
|
|
20697
20834
|
logInfo(
|
|
20698
20835
|
`[${scanContext}] Starting patch application for ${fixes.length} fixes`,
|
|
20699
20836
|
{
|
|
@@ -21120,7 +21257,7 @@ init_configs();
|
|
|
21120
21257
|
|
|
21121
21258
|
// src/mcp/services/FileOperations.ts
|
|
21122
21259
|
init_FileUtils();
|
|
21123
|
-
import
|
|
21260
|
+
import fs22 from "fs";
|
|
21124
21261
|
import path21 from "path";
|
|
21125
21262
|
import AdmZip2 from "adm-zip";
|
|
21126
21263
|
var FileOperations = class {
|
|
@@ -21203,7 +21340,7 @@ var FileOperations = class {
|
|
|
21203
21340
|
continue;
|
|
21204
21341
|
}
|
|
21205
21342
|
try {
|
|
21206
|
-
await
|
|
21343
|
+
await fs22.promises.access(absoluteFilepath, fs22.constants.R_OK);
|
|
21207
21344
|
validatedPaths.push(filepath);
|
|
21208
21345
|
} catch (error) {
|
|
21209
21346
|
logDebug(
|
|
@@ -21222,7 +21359,7 @@ var FileOperations = class {
|
|
|
21222
21359
|
const fileDataArray = [];
|
|
21223
21360
|
for (const absolutePath of filePaths) {
|
|
21224
21361
|
try {
|
|
21225
|
-
const content = await
|
|
21362
|
+
const content = await fs22.promises.readFile(absolutePath);
|
|
21226
21363
|
const relativePath = path21.basename(absolutePath);
|
|
21227
21364
|
fileDataArray.push({
|
|
21228
21365
|
relativePath,
|
|
@@ -21248,7 +21385,7 @@ var FileOperations = class {
|
|
|
21248
21385
|
relativeFilepath
|
|
21249
21386
|
}) {
|
|
21250
21387
|
try {
|
|
21251
|
-
return await
|
|
21388
|
+
return await fs22.promises.readFile(absoluteFilepath);
|
|
21252
21389
|
} catch (fsError) {
|
|
21253
21390
|
logError(
|
|
21254
21391
|
`[FileOperations] Failed to read ${relativeFilepath} from filesystem: ${fsError}`
|
|
@@ -22813,7 +22950,7 @@ var mcpHandler = async (_args) => {
|
|
|
22813
22950
|
};
|
|
22814
22951
|
|
|
22815
22952
|
// src/args/commands/review.ts
|
|
22816
|
-
import
|
|
22953
|
+
import fs23 from "fs";
|
|
22817
22954
|
import chalk11 from "chalk";
|
|
22818
22955
|
function reviewBuilder(yargs2) {
|
|
22819
22956
|
return yargs2.option("f", {
|
|
@@ -22850,7 +22987,7 @@ function reviewBuilder(yargs2) {
|
|
|
22850
22987
|
).help();
|
|
22851
22988
|
}
|
|
22852
22989
|
function validateReviewOptions(argv) {
|
|
22853
|
-
if (!
|
|
22990
|
+
if (!fs23.existsSync(argv.f)) {
|
|
22854
22991
|
throw new CliError(`
|
|
22855
22992
|
Can't access ${chalk11.bold(argv.f)}`);
|
|
22856
22993
|
}
|