mobbdev 1.0.185 → 1.0.186

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.
Files changed (2) hide show
  1. package/dist/index.mjs +68 -27
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1692,6 +1692,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
1692
1692
  IssueType_Enum2["DeclareVariableExplicitly"] = "DECLARE_VARIABLE_EXPLICITLY";
1693
1693
  IssueType_Enum2["DefaultRightsInObjDefinition"] = "DEFAULT_RIGHTS_IN_OBJ_DEFINITION";
1694
1694
  IssueType_Enum2["DeprecatedFunction"] = "DEPRECATED_FUNCTION";
1695
+ IssueType_Enum2["DjangoBlankFieldNeedsNullOrDefault"] = "DJANGO_BLANK_FIELD_NEEDS_NULL_OR_DEFAULT";
1695
1696
  IssueType_Enum2["DosStringBuilder"] = "DOS_STRING_BUILDER";
1696
1697
  IssueType_Enum2["DoNotRaiseException"] = "DO_NOT_RAISE_EXCEPTION";
1697
1698
  IssueType_Enum2["DoNotThrowGenericException"] = "DO_NOT_THROW_GENERIC_EXCEPTION";
@@ -2916,7 +2917,8 @@ var fixDetailsData = {
2916
2917
  ["FUNCTION_CALL_WITHOUT_PARENTHESES" /* FunctionCallWithoutParentheses */]: void 0,
2917
2918
  ["SPRING_DEFAULT_PERMIT" /* SpringDefaultPermit */]: void 0,
2918
2919
  ["RETURN_IN_INIT" /* ReturnInInit */]: void 0,
2919
- ["ACTION_NOT_PINNED_TO_COMMIT_SHA" /* ActionNotPinnedToCommitSha */]: void 0
2920
+ ["ACTION_NOT_PINNED_TO_COMMIT_SHA" /* ActionNotPinnedToCommitSha */]: void 0,
2921
+ ["DJANGO_BLANK_FIELD_NEEDS_NULL_OR_DEFAULT" /* DjangoBlankFieldNeedsNullOrDefault */]: void 0
2920
2922
  };
2921
2923
 
2922
2924
  // src/features/analysis/scm/shared/src/getIssueType.ts
@@ -3054,7 +3056,8 @@ var issueTypeMap = {
3054
3056
  ["FUNCTION_CALL_WITHOUT_PARENTHESES" /* FunctionCallWithoutParentheses */]: "Function Call Without Parentheses",
3055
3057
  ["SPRING_DEFAULT_PERMIT" /* SpringDefaultPermit */]: "Spring Default Permit",
3056
3058
  ["RETURN_IN_INIT" /* ReturnInInit */]: "Return in Init",
3057
- ["ACTION_NOT_PINNED_TO_COMMIT_SHA" /* ActionNotPinnedToCommitSha */]: "Action Not Pinned to Commit Sha"
3059
+ ["ACTION_NOT_PINNED_TO_COMMIT_SHA" /* ActionNotPinnedToCommitSha */]: "Action Not Pinned to Commit Sha",
3060
+ ["DJANGO_BLANK_FIELD_NEEDS_NULL_OR_DEFAULT" /* DjangoBlankFieldNeedsNullOrDefault */]: "Django Blank Field Needs Null or Default"
3058
3061
  };
3059
3062
  var issueTypeZ = z.nativeEnum(IssueType_Enum);
3060
3063
  var getIssueTypeFriendlyString = (issueType) => {
@@ -12373,6 +12376,12 @@ var WorkspaceService = class {
12373
12376
  static getKnownWorkspacePath() {
12374
12377
  return this.knownWorkspacePath;
12375
12378
  }
12379
+ /**
12380
+ * Clears the known workspace path cache
12381
+ */
12382
+ static clearKnownWorkspacePath() {
12383
+ this.knownWorkspacePath = void 0;
12384
+ }
12376
12385
  /**
12377
12386
  * Gets the workspace folder path from known path or environment variables
12378
12387
  * @returns The workspace folder path or undefined if none found
@@ -13883,6 +13892,7 @@ var McpServer = class {
13883
13892
  __publicField(this, "eventHandlers", /* @__PURE__ */ new Map());
13884
13893
  __publicField(this, "parentProcessCheckInterval");
13885
13894
  __publicField(this, "parentPid");
13895
+ __publicField(this, "socketEventHandlers", /* @__PURE__ */ new Map());
13886
13896
  __publicField(this, "mcpUsageService");
13887
13897
  this.parentPid = process.ppid;
13888
13898
  this.mcpUsageService = govOrgId ? new McpUsageService(govOrgId) : null;
@@ -14003,31 +14013,43 @@ var McpServer = class {
14003
14013
  logInfo("Setting up parent process monitoring", {
14004
14014
  parentPid: this.parentPid
14005
14015
  });
14006
- process.stdin.on("close", async () => {
14016
+ const stdinCloseHandler = async () => {
14007
14017
  logDebug("stdin closed - parent likely terminated");
14008
14018
  await this.handleParentProcessDeath("stdin-close");
14009
- });
14010
- process.stdin.on("end", async () => {
14019
+ };
14020
+ const stdinEndHandler = async () => {
14011
14021
  logDebug("stdin ended - parent likely terminated");
14012
14022
  await this.handleParentProcessDeath("stdin-end");
14013
- });
14014
- process.stdout.on("error", async (error) => {
14023
+ };
14024
+ const stdoutErrorHandler = async (...args) => {
14025
+ const error = args[0];
14015
14026
  logWarn("stdout error - parent may have terminated", { error });
14016
14027
  if (error.message.includes("EPIPE") || error.message.includes("ECONNRESET")) {
14017
14028
  await this.handleParentProcessDeath("stdout-error");
14018
14029
  }
14019
- });
14020
- process.stderr.on("error", async (error) => {
14030
+ };
14031
+ const stderrErrorHandler = async (...args) => {
14032
+ const error = args[0];
14021
14033
  logWarn("stderr error - parent may have terminated", { error });
14022
14034
  if (error.message.includes("EPIPE") || error.message.includes("ECONNRESET")) {
14023
14035
  await this.handleParentProcessDeath("stderr-error");
14024
14036
  }
14025
- });
14037
+ };
14038
+ const disconnectHandler = async () => {
14039
+ logDebug("IPC disconnected - parent terminated");
14040
+ await this.handleParentProcessDeath("ipc-disconnect");
14041
+ };
14042
+ this.socketEventHandlers.set("stdin-close", stdinCloseHandler);
14043
+ this.socketEventHandlers.set("stdin-end", stdinEndHandler);
14044
+ this.socketEventHandlers.set("stdout-error", stdoutErrorHandler);
14045
+ this.socketEventHandlers.set("stderr-error", stderrErrorHandler);
14046
+ this.socketEventHandlers.set("disconnect", disconnectHandler);
14047
+ process.stdin.on("close", stdinCloseHandler);
14048
+ process.stdin.on("end", stdinEndHandler);
14049
+ process.stdout.on("error", stdoutErrorHandler);
14050
+ process.stderr.on("error", stderrErrorHandler);
14026
14051
  if (process.send) {
14027
- process.on("disconnect", async () => {
14028
- logDebug("IPC disconnected - parent terminated");
14029
- await this.handleParentProcessDeath("ipc-disconnect");
14030
- });
14052
+ process.on("disconnect", disconnectHandler);
14031
14053
  logDebug("IPC monitoring enabled");
14032
14054
  } else {
14033
14055
  logDebug("IPC not available - skipping IPC monitoring");
@@ -14094,6 +14116,7 @@ var McpServer = class {
14094
14116
  logError("Failed to connect to the API, skipping background scan");
14095
14117
  return;
14096
14118
  }
14119
+ WorkspaceService.clearKnownWorkspacePath();
14097
14120
  const workspacePath = WorkspaceService.getWorkspaceFolderPath();
14098
14121
  if (workspacePath) {
14099
14122
  try {
@@ -14250,6 +14273,31 @@ var McpServer = class {
14250
14273
  this.parentProcessCheckInterval = void 0;
14251
14274
  logDebug("Parent process check interval cleared");
14252
14275
  }
14276
+ this.socketEventHandlers.forEach((handler, eventType) => {
14277
+ try {
14278
+ switch (eventType) {
14279
+ case "stdin-close":
14280
+ process.stdin.removeListener("close", handler);
14281
+ break;
14282
+ case "stdin-end":
14283
+ process.stdin.removeListener("end", handler);
14284
+ break;
14285
+ case "stdout-error":
14286
+ process.stdout.removeListener("error", handler);
14287
+ break;
14288
+ case "stderr-error":
14289
+ process.stderr.removeListener("error", handler);
14290
+ break;
14291
+ case "disconnect":
14292
+ process.removeListener("disconnect", handler);
14293
+ break;
14294
+ }
14295
+ } catch (error) {
14296
+ logWarn(`Failed to remove ${eventType} listener`, { error });
14297
+ }
14298
+ });
14299
+ this.socketEventHandlers.clear();
14300
+ logDebug("Socket event handlers cleaned up");
14253
14301
  this.eventHandlers.forEach((handler, signal) => {
14254
14302
  process.removeListener(signal, handler);
14255
14303
  });
@@ -15968,28 +16016,21 @@ var PatchApplicationService = class {
15968
16016
  let finalContent = content;
15969
16017
  if (MCP_AUTO_FIX_DEBUG_MODE) {
15970
16018
  const fixType = fix.safeIssueType || "Security Issue";
15971
- let fixLink;
15972
- if (fix.fixUrl) {
15973
- fixLink = fix.fixUrl;
15974
- } else {
15975
- const apiUrl = process.env["API_URL"] || MCP_DEFAULT_API_URL;
15976
- const appBaseUrl = apiUrl.replace("/v1/graphql", "").replace("api.", "");
15977
- fixLink = `${appBaseUrl}/fixes/${fix.id}`;
15978
- }
15979
16019
  const commentPrefix = this.getCommentSyntax(filePath);
15980
16020
  const lines = content.split("\n");
15981
16021
  const lastLine = lines[lines.length - 1]?.trim() || "";
15982
16022
  const isMobbComment = lastLine.includes("Mobb security fix applied:");
15983
16023
  const spacing = isMobbComment ? "\n" : "\n\n";
16024
+ const fixComment = `Mobb security fix applied: ${fixType} ${fix.fixUrl || ""}`;
15984
16025
  let comment;
15985
16026
  if (commentPrefix === "<!--") {
15986
- comment = `${spacing}<!-- Mobb security fix applied: ${fixType} ${fixLink} -->`;
16027
+ comment = `${spacing}<!-- ${fixComment} -->`;
15987
16028
  } else if (commentPrefix === "/*") {
15988
- comment = `${spacing}/* Mobb security fix applied: ${fixType} ${fixLink} */`;
16029
+ comment = `${spacing}/* ${fixComment} */`;
15989
16030
  } else if (commentPrefix === "(*") {
15990
- comment = `${spacing}(* Mobb security fix applied: ${fixType} ${fixLink} *)`;
16031
+ comment = `${spacing}(* ${fixComment} *)`;
15991
16032
  } else {
15992
- comment = `${spacing}${commentPrefix} Mobb security fix applied: ${fixType} ${fixLink}`;
16033
+ comment = `${spacing}${commentPrefix} ${fixComment}`;
15993
16034
  }
15994
16035
  finalContent = content + comment;
15995
16036
  logInfo(
@@ -15997,7 +16038,7 @@ var PatchApplicationService = class {
15997
16038
  {
15998
16039
  fixId: fix.id,
15999
16040
  fixType,
16000
- fixLink,
16041
+ fixLink: fix.fixUrl,
16001
16042
  commentSyntax: commentPrefix,
16002
16043
  spacing: isMobbComment ? "single line" : "empty line above"
16003
16044
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.0.185",
3
+ "version": "1.0.186",
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",