mobbdev 1.0.189 → 1.0.190

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.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.mjs CHANGED
@@ -1323,10 +1323,10 @@ import Debug20 from "debug";
1323
1323
  import { hideBin } from "yargs/helpers";
1324
1324
 
1325
1325
  // src/args/commands/convert_to_sarif.ts
1326
- import fs6 from "fs";
1326
+ import fs7 from "fs";
1327
1327
 
1328
1328
  // src/commands/convert_to_sarif.ts
1329
- import fs5 from "fs";
1329
+ import fs6 from "fs";
1330
1330
  import path5 from "path";
1331
1331
 
1332
1332
  // src/commands/fpr_stream_parser.ts
@@ -9087,6 +9087,7 @@ __export(utils_exports, {
9087
9087
  CliError: () => CliError,
9088
9088
  Spinner: () => Spinner,
9089
9089
  getDirName: () => getDirName,
9090
+ getModuleRootDir: () => getModuleRootDir,
9090
9091
  getTopLevelDirName: () => getTopLevelDirName,
9091
9092
  keypress: () => keypress,
9092
9093
  packageJson: () => packageJson,
@@ -9094,8 +9095,20 @@ __export(utils_exports, {
9094
9095
  });
9095
9096
 
9096
9097
  // src/utils/dirname.ts
9098
+ import fs4 from "fs";
9097
9099
  import path3 from "path";
9098
9100
  import { fileURLToPath } from "url";
9101
+ function getModuleRootDir() {
9102
+ let manifestDir = getDirName();
9103
+ for (let i = 0; i < 10; i++) {
9104
+ const manifestPath = path3.join(manifestDir, "package.json");
9105
+ if (fs4.existsSync(manifestPath)) {
9106
+ return manifestDir;
9107
+ }
9108
+ manifestDir = path3.join(manifestDir, "..");
9109
+ }
9110
+ throw new Error("Cannot locate package.json file");
9111
+ }
9099
9112
  function getDirName() {
9100
9113
  return path3.dirname(fileURLToPath(import.meta.url));
9101
9114
  }
@@ -9163,15 +9176,13 @@ function Spinner({ ci = false } = {}) {
9163
9176
  }
9164
9177
 
9165
9178
  // src/utils/check_node_version.ts
9166
- import fs4 from "fs";
9179
+ import fs5 from "fs";
9167
9180
  import path4 from "path";
9168
9181
  import semver from "semver";
9169
9182
  function getPackageJson() {
9170
- let manifestPath = path4.join(getDirName(), "../package.json");
9171
- if (!fs4.existsSync(manifestPath)) {
9172
- manifestPath = path4.join(getDirName(), "../../package.json");
9173
- }
9174
- return JSON.parse(fs4.readFileSync(manifestPath, "utf8"));
9183
+ return JSON.parse(
9184
+ fs5.readFileSync(path4.join(getModuleRootDir(), "package.json"), "utf8")
9185
+ );
9175
9186
  }
9176
9187
  var packageJson = getPackageJson();
9177
9188
  if (!semver.satisfies(process.version, packageJson.engines.node)) {
@@ -9237,7 +9248,7 @@ async function convertFprToSarif(inputFilePath, outputFilePath, codePathPatterns
9237
9248
  await auditXmlSaxParser.parse();
9238
9249
  }
9239
9250
  await zipIn.close();
9240
- const writer = fs5.createWriteStream(outputFilePath);
9251
+ const writer = fs6.createWriteStream(outputFilePath);
9241
9252
  writer.write(`{
9242
9253
  "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
9243
9254
  "version": "2.1.0",
@@ -9343,14 +9354,12 @@ import chalk2 from "chalk";
9343
9354
 
9344
9355
  // src/constants.ts
9345
9356
  import path6 from "path";
9346
- import { fileURLToPath as fileURLToPath2 } from "url";
9347
9357
  import chalk from "chalk";
9348
9358
  import Debug4 from "debug";
9349
9359
  import * as dotenv from "dotenv";
9350
9360
  import { z as z24 } from "zod";
9351
9361
  var debug5 = Debug4("mobbdev:constants");
9352
- var __dirname = path6.dirname(fileURLToPath2(import.meta.url));
9353
- dotenv.config({ path: path6.join(__dirname, "../.env") });
9362
+ dotenv.config({ path: path6.join(getModuleRootDir(), ".env") });
9354
9363
  var scmFriendlyText = {
9355
9364
  ["Ado" /* Ado */]: "Azure DevOps",
9356
9365
  ["Bitbucket" /* Bitbucket */]: "Bitbucket",
@@ -9571,7 +9580,7 @@ function convertToSarifBuilder(args) {
9571
9580
  ).help().demandOption(["input-file-path", "input-file-format", "output-file-path"]);
9572
9581
  }
9573
9582
  async function validateConvertToSarifOptions(args) {
9574
- if (!fs6.existsSync(args.inputFilePath)) {
9583
+ if (!fs7.existsSync(args.inputFilePath)) {
9575
9584
  throw new CliError(
9576
9585
  "\nError: --input-file-path flag should point to an existing file"
9577
9586
  );
@@ -9605,14 +9614,14 @@ import chalk11 from "chalk";
9605
9614
  import yargs from "yargs/yargs";
9606
9615
 
9607
9616
  // src/args/commands/analyze.ts
9608
- import fs9 from "fs";
9617
+ import fs10 from "fs";
9609
9618
 
9610
9619
  // src/commands/index.ts
9611
9620
  import crypto from "crypto";
9612
9621
  import os from "os";
9613
9622
 
9614
9623
  // src/features/analysis/index.ts
9615
- import fs8 from "fs";
9624
+ import fs9 from "fs";
9616
9625
  import fsPromises2 from "fs/promises";
9617
9626
  import path9 from "path";
9618
9627
  import { env as env2 } from "process";
@@ -10892,7 +10901,7 @@ var GQLClient = class {
10892
10901
 
10893
10902
  // src/features/analysis/pack.ts
10894
10903
  init_configs();
10895
- import fs7 from "fs";
10904
+ import fs8 from "fs";
10896
10905
  import path7 from "path";
10897
10906
  import AdmZip from "adm-zip";
10898
10907
  import Debug13 from "debug";
@@ -10969,11 +10978,11 @@ async function pack(srcDirPath, vulnFiles, isIncludeAllFiles = false) {
10969
10978
  continue;
10970
10979
  }
10971
10980
  }
10972
- if (fs7.lstatSync(absFilepath).size > MCP_MAX_FILE_SIZE) {
10981
+ if (fs8.lstatSync(absFilepath).size > MCP_MAX_FILE_SIZE) {
10973
10982
  debug14("ignoring %s because the size is > 5MB", filepath);
10974
10983
  continue;
10975
10984
  }
10976
- const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) : fs7.readFileSync(absFilepath);
10985
+ const data = git ? await git.showBuffer([`HEAD:./${filepath}`]) : fs8.readFileSync(absFilepath);
10977
10986
  if (isBinary2(null, data)) {
10978
10987
  debug14("ignoring %s because is seems to be a binary file", filepath);
10979
10988
  continue;
@@ -11397,13 +11406,13 @@ async function downloadRepo({
11397
11406
  repoSpinner.error({ text: "\u{1F4BE} Repo download failed" });
11398
11407
  throw new Error(`Can't access ${chalk5.bold(repoUrl)}`);
11399
11408
  }
11400
- const fileWriterStream = fs8.createWriteStream(zipFilePath);
11409
+ const fileWriterStream = fs9.createWriteStream(zipFilePath);
11401
11410
  if (!response.body) {
11402
11411
  throw new Error("Response body is empty");
11403
11412
  }
11404
11413
  await pipeline(response.body, fileWriterStream);
11405
11414
  await extract(zipFilePath, { dir: dirname });
11406
- const repoRoot = fs8.readdirSync(dirname, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name)[0];
11415
+ const repoRoot = fs9.readdirSync(dirname, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name)[0];
11407
11416
  if (!repoRoot) {
11408
11417
  throw new Error("Repo root not found");
11409
11418
  }
@@ -12332,7 +12341,7 @@ function analyzeBuilder(yargs2) {
12332
12341
  ).help();
12333
12342
  }
12334
12343
  function validateAnalyzeOptions(argv) {
12335
- if (argv.f && !fs9.existsSync(argv.f)) {
12344
+ if (argv.f && !fs10.existsSync(argv.f)) {
12336
12345
  throw new CliError(`
12337
12346
  Can't access ${chalk8.bold(argv.f)}`);
12338
12347
  }
@@ -13393,7 +13402,7 @@ async function createAuthenticatedMcpGQLClient({
13393
13402
 
13394
13403
  // src/mcp/services/McpUsageService/host.ts
13395
13404
  import { execSync } from "child_process";
13396
- import fs10 from "fs";
13405
+ import fs11 from "fs";
13397
13406
  import os3 from "os";
13398
13407
  import path11 from "path";
13399
13408
  var IDEs = ["cursor", "windsurf", "webstorm", "vscode", "claude"];
@@ -13412,15 +13421,15 @@ var getClaudeWorkspacePaths = () => {
13412
13421
  const home = os3.homedir();
13413
13422
  const claudeIdePath = path11.join(home, ".claude", "ide");
13414
13423
  const workspacePaths = [];
13415
- if (!fs10.existsSync(claudeIdePath)) {
13424
+ if (!fs11.existsSync(claudeIdePath)) {
13416
13425
  return workspacePaths;
13417
13426
  }
13418
13427
  try {
13419
- const lockFiles = fs10.readdirSync(claudeIdePath).filter((file) => file.endsWith(".lock"));
13428
+ const lockFiles = fs11.readdirSync(claudeIdePath).filter((file) => file.endsWith(".lock"));
13420
13429
  for (const lockFile of lockFiles) {
13421
13430
  const lockFilePath = path11.join(claudeIdePath, lockFile);
13422
13431
  try {
13423
- const lockContent = JSON.parse(fs10.readFileSync(lockFilePath, "utf8"));
13432
+ const lockContent = JSON.parse(fs11.readFileSync(lockFilePath, "utf8"));
13424
13433
  if (lockContent.workspaceFolders && Array.isArray(lockContent.workspaceFolders)) {
13425
13434
  workspacePaths.push(...lockContent.workspaceFolders);
13426
13435
  }
@@ -13486,9 +13495,9 @@ var getMCPConfigPaths = (hostName) => {
13486
13495
  }
13487
13496
  };
13488
13497
  var readConfigFile = (filePath) => {
13489
- if (!fs10.existsSync(filePath)) return null;
13498
+ if (!fs11.existsSync(filePath)) return null;
13490
13499
  try {
13491
- return JSON.parse(fs10.readFileSync(filePath, "utf8"));
13500
+ return JSON.parse(fs11.readFileSync(filePath, "utf8"));
13492
13501
  } catch (error) {
13493
13502
  logWarn(`[UsageService] Failed to read MCP config: ${filePath}`);
13494
13503
  return null;
@@ -14472,7 +14481,7 @@ var McpServer = class {
14472
14481
  import { z as z34 } from "zod";
14473
14482
 
14474
14483
  // src/mcp/services/PathValidation.ts
14475
- import fs11 from "fs";
14484
+ import fs12 from "fs";
14476
14485
  import path12 from "path";
14477
14486
  async function validatePath(inputPath) {
14478
14487
  logDebug("Validating MCP path", { inputPath });
@@ -14532,7 +14541,7 @@ async function validatePath(inputPath) {
14532
14541
  logDebug("Path validation successful", { inputPath });
14533
14542
  logDebug("Checking path existence", { inputPath });
14534
14543
  try {
14535
- await fs11.promises.access(inputPath);
14544
+ await fs12.promises.access(inputPath);
14536
14545
  logDebug("Path exists and is accessible", { inputPath });
14537
14546
  WorkspaceService.setKnownWorkspacePath(inputPath);
14538
14547
  logDebug("Stored validated path in WorkspaceService", { inputPath });
@@ -15154,7 +15163,7 @@ If you wish to scan files that were recently changed in your git history call th
15154
15163
  init_FileUtils();
15155
15164
  init_GitService();
15156
15165
  init_configs();
15157
- import fs12 from "fs/promises";
15166
+ import fs13 from "fs/promises";
15158
15167
  import nodePath from "path";
15159
15168
  var getLocalFiles = async ({
15160
15169
  path: path17,
@@ -15172,7 +15181,7 @@ var getLocalFiles = async ({
15172
15181
  scanRecentlyChangedFiles
15173
15182
  });
15174
15183
  try {
15175
- const resolvedRepoPath = await fs12.realpath(path17);
15184
+ const resolvedRepoPath = await fs13.realpath(path17);
15176
15185
  logDebug(`[${scanContext}] Resolved repository path`, {
15177
15186
  resolvedRepoPath,
15178
15187
  originalPath: path17
@@ -15252,7 +15261,7 @@ var getLocalFiles = async ({
15252
15261
  absoluteFilePath
15253
15262
  );
15254
15263
  try {
15255
- const fileStat = await fs12.stat(absoluteFilePath);
15264
+ const fileStat = await fs13.stat(absoluteFilePath);
15256
15265
  return {
15257
15266
  filename: nodePath.basename(absoluteFilePath),
15258
15267
  relativePath,
@@ -15287,7 +15296,7 @@ var getLocalFiles = async ({
15287
15296
  };
15288
15297
 
15289
15298
  // src/mcp/services/LocalMobbFolderService.ts
15290
- import fs13 from "fs";
15299
+ import fs14 from "fs";
15291
15300
  import path13 from "path";
15292
15301
  import { z as z33 } from "zod";
15293
15302
  init_GitService();
@@ -15379,15 +15388,15 @@ var LocalMobbFolderService = class {
15379
15388
  this.repoPath,
15380
15389
  this.defaultMobbFolderName
15381
15390
  );
15382
- if (!fs13.existsSync(mobbFolderPath)) {
15391
+ if (!fs14.existsSync(mobbFolderPath)) {
15383
15392
  logInfo("[LocalMobbFolderService] Creating .mobb folder", {
15384
15393
  mobbFolderPath
15385
15394
  });
15386
- fs13.mkdirSync(mobbFolderPath, { recursive: true });
15395
+ fs14.mkdirSync(mobbFolderPath, { recursive: true });
15387
15396
  } else {
15388
15397
  logDebug("[LocalMobbFolderService] .mobb folder already exists");
15389
15398
  }
15390
- const stats = fs13.statSync(mobbFolderPath);
15399
+ const stats = fs14.statSync(mobbFolderPath);
15391
15400
  if (!stats.isDirectory()) {
15392
15401
  throw new Error(`Path exists but is not a directory: ${mobbFolderPath}`);
15393
15402
  }
@@ -15428,13 +15437,13 @@ var LocalMobbFolderService = class {
15428
15437
  logDebug("[LocalMobbFolderService] Git repository validated successfully");
15429
15438
  } else {
15430
15439
  try {
15431
- const stats = fs13.statSync(this.repoPath);
15440
+ const stats = fs14.statSync(this.repoPath);
15432
15441
  if (!stats.isDirectory()) {
15433
15442
  throw new Error(
15434
15443
  `Path exists but is not a directory: ${this.repoPath}`
15435
15444
  );
15436
15445
  }
15437
- fs13.accessSync(this.repoPath, fs13.constants.R_OK | fs13.constants.W_OK);
15446
+ fs14.accessSync(this.repoPath, fs14.constants.R_OK | fs14.constants.W_OK);
15438
15447
  logDebug(
15439
15448
  "[LocalMobbFolderService] Non-git directory validated successfully"
15440
15449
  );
@@ -15548,7 +15557,7 @@ var LocalMobbFolderService = class {
15548
15557
  baseFileName
15549
15558
  );
15550
15559
  const filePath = path13.join(mobbFolderPath, uniqueFileName);
15551
- await fs13.promises.writeFile(filePath, patch, "utf8");
15560
+ await fs14.promises.writeFile(filePath, patch, "utf8");
15552
15561
  logInfo("[LocalMobbFolderService] Patch saved successfully", {
15553
15562
  filePath,
15554
15563
  fileName: uniqueFileName,
@@ -15609,7 +15618,7 @@ var LocalMobbFolderService = class {
15609
15618
  const extension = path13.parse(baseFileName).ext;
15610
15619
  let uniqueFileName = baseFileName;
15611
15620
  let index = 1;
15612
- while (fs13.existsSync(path13.join(folderPath, uniqueFileName))) {
15621
+ while (fs14.existsSync(path13.join(folderPath, uniqueFileName))) {
15613
15622
  uniqueFileName = `${baseName}-${index}${extension}`;
15614
15623
  index++;
15615
15624
  if (index > 1e3) {
@@ -15643,15 +15652,15 @@ var LocalMobbFolderService = class {
15643
15652
  const patchInfoPath = path13.join(mobbFolderPath, "patchInfo.md");
15644
15653
  const markdownContent = this.generateFixMarkdown(fix, savedPatchFileName);
15645
15654
  let existingContent = "";
15646
- if (fs13.existsSync(patchInfoPath)) {
15647
- existingContent = await fs13.promises.readFile(patchInfoPath, "utf8");
15655
+ if (fs14.existsSync(patchInfoPath)) {
15656
+ existingContent = await fs14.promises.readFile(patchInfoPath, "utf8");
15648
15657
  logDebug("[LocalMobbFolderService] Existing patchInfo.md found");
15649
15658
  } else {
15650
15659
  logDebug("[LocalMobbFolderService] Creating new patchInfo.md file");
15651
15660
  }
15652
15661
  const separator = existingContent ? "\n\n================================================================================\n\n" : "";
15653
15662
  const updatedContent = `${markdownContent}${separator}${existingContent}`;
15654
- await fs13.promises.writeFile(patchInfoPath, updatedContent, "utf8");
15663
+ await fs14.promises.writeFile(patchInfoPath, updatedContent, "utf8");
15655
15664
  logInfo("[LocalMobbFolderService] Patch info logged successfully", {
15656
15665
  patchInfoPath,
15657
15666
  fixId: fix.id,
@@ -16024,7 +16033,7 @@ import {
16024
16033
  unlinkSync,
16025
16034
  writeFileSync
16026
16035
  } from "fs";
16027
- import fs14 from "fs/promises";
16036
+ import fs15 from "fs/promises";
16028
16037
  import parseDiff2 from "parse-diff";
16029
16038
  import path14 from "path";
16030
16039
  var PatchApplicationService = class {
@@ -16522,7 +16531,7 @@ var PatchApplicationService = class {
16522
16531
  try {
16523
16532
  const absolutePath = path14.resolve(repositoryPath, targetFile);
16524
16533
  if (existsSync2(absolutePath)) {
16525
- const stats = await fs14.stat(absolutePath);
16534
+ const stats = await fs15.stat(absolutePath);
16526
16535
  const fileModTime = stats.mtime.getTime();
16527
16536
  if (fileModTime > scanStartTime) {
16528
16537
  logError(
@@ -16563,7 +16572,7 @@ var PatchApplicationService = class {
16563
16572
  const appliedFixes = [];
16564
16573
  const failedFixes = [];
16565
16574
  const skippedFixes = [];
16566
- const resolvedRepoPath = await fs14.realpath(repositoryPath);
16575
+ const resolvedRepoPath = await fs15.realpath(repositoryPath);
16567
16576
  logInfo(
16568
16577
  `[${scanContext}] Starting patch application for ${fixes.length} fixes`,
16569
16578
  {
@@ -16992,7 +17001,7 @@ init_configs();
16992
17001
 
16993
17002
  // src/mcp/services/FileOperations.ts
16994
17003
  init_FileUtils();
16995
- import fs15 from "fs";
17004
+ import fs16 from "fs";
16996
17005
  import path15 from "path";
16997
17006
  import AdmZip2 from "adm-zip";
16998
17007
  var FileOperations = class {
@@ -17075,7 +17084,7 @@ var FileOperations = class {
17075
17084
  continue;
17076
17085
  }
17077
17086
  try {
17078
- await fs15.promises.access(absoluteFilepath, fs15.constants.R_OK);
17087
+ await fs16.promises.access(absoluteFilepath, fs16.constants.R_OK);
17079
17088
  validatedPaths.push(filepath);
17080
17089
  } catch (error) {
17081
17090
  logDebug(
@@ -17094,7 +17103,7 @@ var FileOperations = class {
17094
17103
  const fileDataArray = [];
17095
17104
  for (const absolutePath of filePaths) {
17096
17105
  try {
17097
- const content = await fs15.promises.readFile(absolutePath);
17106
+ const content = await fs16.promises.readFile(absolutePath);
17098
17107
  const relativePath = path15.basename(absolutePath);
17099
17108
  fileDataArray.push({
17100
17109
  relativePath,
@@ -17120,7 +17129,7 @@ var FileOperations = class {
17120
17129
  relativeFilepath
17121
17130
  }) {
17122
17131
  try {
17123
- return await fs15.promises.readFile(absoluteFilepath);
17132
+ return await fs16.promises.readFile(absoluteFilepath);
17124
17133
  } catch (fsError) {
17125
17134
  logError(
17126
17135
  `[FileOperations] Failed to read ${relativeFilepath} from filesystem: ${fsError}`
@@ -18669,7 +18678,7 @@ var mcpHandler = async (_args) => {
18669
18678
  };
18670
18679
 
18671
18680
  // src/args/commands/review.ts
18672
- import fs16 from "fs";
18681
+ import fs17 from "fs";
18673
18682
  import chalk9 from "chalk";
18674
18683
  function reviewBuilder(yargs2) {
18675
18684
  return yargs2.option("f", {
@@ -18706,7 +18715,7 @@ function reviewBuilder(yargs2) {
18706
18715
  ).help();
18707
18716
  }
18708
18717
  function validateReviewOptions(argv) {
18709
- if (!fs16.existsSync(argv.f)) {
18718
+ if (!fs17.existsSync(argv.f)) {
18710
18719
  throw new CliError(`
18711
18720
  Can't access ${chalk9.bold(argv.f)}`);
18712
18721
  }
@@ -18779,7 +18788,7 @@ async function addScmTokenHandler(args) {
18779
18788
  }
18780
18789
 
18781
18790
  // src/args/commands/upload_ai_blame.ts
18782
- import fs17 from "fs/promises";
18791
+ import fs18 from "fs/promises";
18783
18792
  import path16 from "path";
18784
18793
  import chalk10 from "chalk";
18785
18794
  function uploadAiBlameBuilder(args) {
@@ -18829,7 +18838,7 @@ async function uploadAiBlameHandler(args) {
18829
18838
  const promptPath = String(prompts[i]);
18830
18839
  const inferencePath = String(inferences[i]);
18831
18840
  try {
18832
- await Promise.all([fs17.access(promptPath), fs17.access(inferencePath)]);
18841
+ await Promise.all([fs18.access(promptPath), fs18.access(inferencePath)]);
18833
18842
  } catch {
18834
18843
  console.error(chalk10.red(`File not found for session ${i + 1}`));
18835
18844
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.189",
3
+ "version": "1.0.190",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.mjs",