mobbdev 1.1.24 → 1.1.27

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.
@@ -5100,6 +5100,18 @@ var GQLClient = class {
5100
5100
  }
5101
5101
  };
5102
5102
 
5103
+ // src/mcp/services/types.ts
5104
+ function buildLoginUrl(baseUrl, loginId, hostname2, context) {
5105
+ const url = new URL(`${baseUrl}/${loginId}`);
5106
+ url.searchParams.set("hostname", hostname2);
5107
+ url.searchParams.set("trigger", context.trigger);
5108
+ url.searchParams.set("source", context.source);
5109
+ if (context.ide) {
5110
+ url.searchParams.set("ide", context.ide);
5111
+ }
5112
+ return url.toString();
5113
+ }
5114
+
5103
5115
  // src/utils/ConfigStoreService.ts
5104
5116
  import Configstore from "configstore";
5105
5117
  function createConfigStore(defaultValues = { apiToken: "" }) {
@@ -5150,7 +5162,8 @@ async function handleMobbLogin({
5150
5162
  apiKey,
5151
5163
  skipPrompts,
5152
5164
  apiUrl,
5153
- webAppUrl
5165
+ webAppUrl,
5166
+ loginContext
5154
5167
  }) {
5155
5168
  const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
5156
5169
  const resolvedApiUrl = apiUrl || API_URL;
@@ -5195,7 +5208,8 @@ async function handleMobbLogin({
5195
5208
  const loginId = await inGqlClient.createCliLogin({
5196
5209
  publicKey: publicKey.export({ format: "pem", type: "pkcs1" }).toString()
5197
5210
  });
5198
- const browserUrl = `${resolvedWebAppUrl}/cli-login/${loginId}?hostname=${os.hostname()}`;
5211
+ const webLoginUrl = `${resolvedWebAppUrl}/cli-login`;
5212
+ const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os.hostname()}`;
5199
5213
  !skipPrompts && console.log(
5200
5214
  `If the page does not open automatically, kindly access it through ${browserUrl}.`
5201
5215
  );
@@ -5310,7 +5324,7 @@ var openRedaction = new OpenRedaction({
5310
5324
  "VISA_NUMBER",
5311
5325
  "VISA_MRZ",
5312
5326
  "TAX_ID",
5313
- // Financial Data (removed SWIFT_BIC - too broad, matches bank code formats in variables)
5327
+ // Financial Data (removed SWIFT_BIC, CARD_AUTH_CODE - too broad, causing false positives with authentication words)
5314
5328
  "CREDIT_CARD",
5315
5329
  "IBAN",
5316
5330
  "BANK_ACCOUNT_UK",
@@ -5318,7 +5332,6 @@ var openRedaction = new OpenRedaction({
5318
5332
  "CARD_TRACK1_DATA",
5319
5333
  "CARD_TRACK2_DATA",
5320
5334
  "CARD_EXPIRY",
5321
- "CARD_AUTH_CODE",
5322
5335
  // Cryptocurrency (removed BITCOIN_ADDRESS - too broad, matches hash-like strings)
5323
5336
  "ETHEREUM_ADDRESS",
5324
5337
  "LITECOIN_ADDRESS",
@@ -5332,11 +5345,9 @@ var openRedaction = new OpenRedaction({
5332
5345
  "AUSTRALIAN_MEDICARE",
5333
5346
  "HEALTH_PLAN_NUMBER",
5334
5347
  "PATIENT_ID",
5335
- // Communications (removed EMERGENCY_CONTACT, ADDRESS_PO_BOX, ZIP_CODE_US - too broad)
5336
- "PHONE_US",
5348
+ // Communications (removed EMERGENCY_CONTACT, ADDRESS_PO_BOX, ZIP_CODE_US, PHONE_US, PHONE_INTERNATIONAL - too broad, causing false positives)
5337
5349
  "PHONE_UK",
5338
5350
  "PHONE_UK_MOBILE",
5339
- "PHONE_INTERNATIONAL",
5340
5351
  "PHONE_LINE_NUMBER",
5341
5352
  "ADDRESS_STREET",
5342
5353
  "POSTCODE_UK",
@@ -5434,10 +5445,6 @@ async function sanitizeDataWithCounts(obj) {
5434
5445
  const sanitizedData = await sanitizeRecursive(obj);
5435
5446
  return { sanitizedData, counts };
5436
5447
  }
5437
- async function sanitizeData(obj) {
5438
- const result = await sanitizeDataWithCounts(obj);
5439
- return result.sanitizedData;
5440
- }
5441
5448
 
5442
5449
  // src/args/commands/upload_ai_blame.ts
5443
5450
  var PromptItemZ = z26.object({
@@ -5618,11 +5625,8 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
5618
5625
  const initSessions = sessions.map(
5619
5626
  ({ sessionId: _sessionId, ...rest }) => rest
5620
5627
  );
5621
- const sanitizedSessions = await sanitizeData(
5622
- initSessions
5623
- );
5624
5628
  const initRes = await authenticatedClient.uploadAIBlameInferencesInitRaw({
5625
- sessions: sanitizedSessions
5629
+ sessions: initSessions
5626
5630
  });
5627
5631
  const uploadSessions = initRes.uploadAIBlameInferencesInit?.uploadSessions ?? [];
5628
5632
  if (uploadSessions.length !== sessions.length) {
@@ -5669,11 +5673,8 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
5669
5673
  sessionId: s.sessionId
5670
5674
  };
5671
5675
  });
5672
- const sanitizedFinalizeSessions = await sanitizeData(
5673
- finalizeSessions
5674
- );
5675
5676
  const finRes = await authenticatedClient.finalizeAIBlameInferencesUploadRaw({
5676
- sessions: sanitizedFinalizeSessions
5677
+ sessions: finalizeSessions
5677
5678
  });
5678
5679
  const status = finRes?.finalizeAIBlameInferencesUpload?.status;
5679
5680
  if (status !== "OK") {
package/dist/index.mjs CHANGED
@@ -11400,6 +11400,38 @@ var GQLClient = class {
11400
11400
  }
11401
11401
  };
11402
11402
 
11403
+ // src/mcp/services/types.ts
11404
+ function detectIDE() {
11405
+ const env3 = process.env;
11406
+ if (env3["CURSOR_TRACE_ID"] || env3["CURSOR_SESSION_ID"]) return "cursor";
11407
+ if (env3["WINDSURF_IPC_HOOK"] || env3["WINDSURF_PID"]) return "windsurf";
11408
+ if (env3["CLAUDE_DESKTOP"] || env3["ANTHROPIC_CLAUDE"]) return "claude";
11409
+ if (env3["WEBSTORM_VM_OPTIONS"] || env3["IDEA_VM_OPTIONS"] || env3["JETBRAINS_IDE"])
11410
+ return "webstorm";
11411
+ if (env3["VSCODE_IPC_HOOK"] || env3["VSCODE_PID"]) return "vscode";
11412
+ const termProgram = env3["TERM_PROGRAM"]?.toLowerCase();
11413
+ if (termProgram === "windsurf") return "windsurf";
11414
+ if (termProgram === "vscode") return "vscode";
11415
+ return void 0;
11416
+ }
11417
+ function createMcpLoginContext(trigger) {
11418
+ return {
11419
+ trigger,
11420
+ source: "mcp",
11421
+ ide: detectIDE()
11422
+ };
11423
+ }
11424
+ function buildLoginUrl(baseUrl, loginId, hostname2, context) {
11425
+ const url = new URL(`${baseUrl}/${loginId}`);
11426
+ url.searchParams.set("hostname", hostname2);
11427
+ url.searchParams.set("trigger", context.trigger);
11428
+ url.searchParams.set("source", context.source);
11429
+ if (context.ide) {
11430
+ url.searchParams.set("ide", context.ide);
11431
+ }
11432
+ return url.toString();
11433
+ }
11434
+
11403
11435
  // src/utils/ConfigStoreService.ts
11404
11436
  import Configstore from "configstore";
11405
11437
  function createConfigStore(defaultValues = { apiToken: "" }) {
@@ -11450,7 +11482,8 @@ async function handleMobbLogin({
11450
11482
  apiKey,
11451
11483
  skipPrompts,
11452
11484
  apiUrl,
11453
- webAppUrl
11485
+ webAppUrl,
11486
+ loginContext
11454
11487
  }) {
11455
11488
  const resolvedWebAppUrl = webAppUrl || WEB_APP_URL;
11456
11489
  const resolvedApiUrl = apiUrl || API_URL;
@@ -11495,7 +11528,8 @@ async function handleMobbLogin({
11495
11528
  const loginId = await inGqlClient.createCliLogin({
11496
11529
  publicKey: publicKey.export({ format: "pem", type: "pkcs1" }).toString()
11497
11530
  });
11498
- const browserUrl = `${resolvedWebAppUrl}/cli-login/${loginId}?hostname=${os.hostname()}`;
11531
+ const webLoginUrl = `${resolvedWebAppUrl}/cli-login`;
11532
+ const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os.hostname()}`;
11499
11533
  !skipPrompts && console.log(
11500
11534
  `If the page does not open automatically, kindly access it through ${browserUrl}.`
11501
11535
  );
@@ -13644,7 +13678,7 @@ var openRedaction = new OpenRedaction({
13644
13678
  "VISA_NUMBER",
13645
13679
  "VISA_MRZ",
13646
13680
  "TAX_ID",
13647
- // Financial Data (removed SWIFT_BIC - too broad, matches bank code formats in variables)
13681
+ // Financial Data (removed SWIFT_BIC, CARD_AUTH_CODE - too broad, causing false positives with authentication words)
13648
13682
  "CREDIT_CARD",
13649
13683
  "IBAN",
13650
13684
  "BANK_ACCOUNT_UK",
@@ -13652,7 +13686,6 @@ var openRedaction = new OpenRedaction({
13652
13686
  "CARD_TRACK1_DATA",
13653
13687
  "CARD_TRACK2_DATA",
13654
13688
  "CARD_EXPIRY",
13655
- "CARD_AUTH_CODE",
13656
13689
  // Cryptocurrency (removed BITCOIN_ADDRESS - too broad, matches hash-like strings)
13657
13690
  "ETHEREUM_ADDRESS",
13658
13691
  "LITECOIN_ADDRESS",
@@ -13666,11 +13699,9 @@ var openRedaction = new OpenRedaction({
13666
13699
  "AUSTRALIAN_MEDICARE",
13667
13700
  "HEALTH_PLAN_NUMBER",
13668
13701
  "PATIENT_ID",
13669
- // Communications (removed EMERGENCY_CONTACT, ADDRESS_PO_BOX, ZIP_CODE_US - too broad)
13670
- "PHONE_US",
13702
+ // Communications (removed EMERGENCY_CONTACT, ADDRESS_PO_BOX, ZIP_CODE_US, PHONE_US, PHONE_INTERNATIONAL - too broad, causing false positives)
13671
13703
  "PHONE_UK",
13672
13704
  "PHONE_UK_MOBILE",
13673
- "PHONE_INTERNATIONAL",
13674
13705
  "PHONE_LINE_NUMBER",
13675
13706
  "ADDRESS_STREET",
13676
13707
  "POSTCODE_UK",
@@ -13768,10 +13799,6 @@ async function sanitizeDataWithCounts(obj) {
13768
13799
  const sanitizedData = await sanitizeRecursive(obj);
13769
13800
  return { sanitizedData, counts };
13770
13801
  }
13771
- async function sanitizeData(obj) {
13772
- const result = await sanitizeDataWithCounts(obj);
13773
- return result.sanitizedData;
13774
- }
13775
13802
 
13776
13803
  // src/args/commands/upload_ai_blame.ts
13777
13804
  var PromptItemZ = z31.object({
@@ -13952,11 +13979,8 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
13952
13979
  const initSessions = sessions.map(
13953
13980
  ({ sessionId: _sessionId, ...rest }) => rest
13954
13981
  );
13955
- const sanitizedSessions = await sanitizeData(
13956
- initSessions
13957
- );
13958
13982
  const initRes = await authenticatedClient.uploadAIBlameInferencesInitRaw({
13959
- sessions: sanitizedSessions
13983
+ sessions: initSessions
13960
13984
  });
13961
13985
  const uploadSessions = initRes.uploadAIBlameInferencesInit?.uploadSessions ?? [];
13962
13986
  if (uploadSessions.length !== sessions.length) {
@@ -14003,11 +14027,8 @@ async function uploadAiBlameHandler(args, exitOnError = true) {
14003
14027
  sessionId: s.sessionId
14004
14028
  };
14005
14029
  });
14006
- const sanitizedFinalizeSessions = await sanitizeData(
14007
- finalizeSessions
14008
- );
14009
14030
  const finRes = await authenticatedClient.finalizeAIBlameInferencesUploadRaw({
14010
- sessions: sanitizedFinalizeSessions
14031
+ sessions: finalizeSessions
14011
14032
  });
14012
14033
  const status = finRes?.finalizeAIBlameInferencesUpload?.status;
14013
14034
  if (status !== "OK") {
@@ -14276,7 +14297,8 @@ async function processAndUploadHookData() {
14276
14297
  model: result.tracePayload.model,
14277
14298
  tool: result.tracePayload.tool,
14278
14299
  responseTime: result.tracePayload.responseTime,
14279
- blameType: "CHAT" /* Chat */
14300
+ blameType: "CHAT" /* Chat */,
14301
+ sessionId: result.hookData.session_id
14280
14302
  });
14281
14303
  uploadSuccess = true;
14282
14304
  } catch (error) {
@@ -14789,9 +14811,10 @@ var McpAuthService = class {
14789
14811
  /**
14790
14812
  * Handles the complete authentication flow
14791
14813
  * @param isBackgoundCall Whether this is called from tools context
14814
+ * @param loginContext Context information about who triggered the login
14792
14815
  * @returns Authenticated API token
14793
14816
  */
14794
- async authenticate(isBackgoundCall = false) {
14817
+ async authenticate(isBackgoundCall = false, loginContext) {
14795
14818
  const { publicKey, privateKey } = crypto2.generateKeyPairSync("rsa", {
14796
14819
  modulusLength: 2048
14797
14820
  });
@@ -14804,7 +14827,7 @@ var McpAuthService = class {
14804
14827
  }
14805
14828
  logDebug(`cli login created ${loginId}`);
14806
14829
  const webLoginUrl = `${WEB_APP_URL}/mvs-login`;
14807
- const browserUrl = `${webLoginUrl}/${loginId}?hostname=${os4.hostname()}`;
14830
+ const browserUrl = loginContext ? buildLoginUrl(webLoginUrl, loginId, os4.hostname(), loginContext) : `${webLoginUrl}/${loginId}?hostname=${os4.hostname()}`;
14808
14831
  await this.openBrowser(browserUrl, isBackgoundCall);
14809
14832
  logDebug(`waiting for login to complete`);
14810
14833
  let newApiToken = null;
@@ -15478,7 +15501,8 @@ var McpGQLClient = class {
15478
15501
  }
15479
15502
  };
15480
15503
  async function createAuthenticatedMcpGQLClient({
15481
- isBackgroundCall = false
15504
+ isBackgroundCall = false,
15505
+ loginContext
15482
15506
  } = {}) {
15483
15507
  logDebug("[GraphQL] Getting config", {
15484
15508
  apiToken: configStore.get("apiToken")
@@ -15499,7 +15523,10 @@ async function createAuthenticatedMcpGQLClient({
15499
15523
  return initialClient;
15500
15524
  }
15501
15525
  const authService = new McpAuthService(initialClient);
15502
- const newApiToken = await authService.authenticate(isBackgroundCall);
15526
+ const newApiToken = await authService.authenticate(
15527
+ isBackgroundCall,
15528
+ loginContext
15529
+ );
15503
15530
  configStore.set("apiToken", newApiToken);
15504
15531
  return new McpGQLClient({ apiKey: newApiToken, type: "apiKey" });
15505
15532
  }
@@ -18443,7 +18470,10 @@ var BaseTool = class {
18443
18470
  async execute(args) {
18444
18471
  if (this.hasAuthentication) {
18445
18472
  logDebug(`Authenticating tool: ${this.name}`, { args });
18446
- const mcpGqlClient = await createAuthenticatedMcpGQLClient();
18473
+ const loginContext = createMcpLoginContext(this.name);
18474
+ const mcpGqlClient = await createAuthenticatedMcpGQLClient({
18475
+ loginContext
18476
+ });
18447
18477
  const userInfo2 = await mcpGqlClient.getUserInfo();
18448
18478
  logDebug("User authenticated successfully", { userInfo: userInfo2 });
18449
18479
  }
@@ -21677,7 +21707,8 @@ var _CheckForNewAvailableFixesService = class _CheckForNewAvailableFixesService
21677
21707
  logInfo(`[${scanContext}] Reset service state for new path`, { path: path22 });
21678
21708
  }
21679
21709
  try {
21680
- this.gqlClient = await createAuthenticatedMcpGQLClient();
21710
+ const loginContext = createMcpLoginContext("check_new_fixes");
21711
+ this.gqlClient = await createAuthenticatedMcpGQLClient({ loginContext });
21681
21712
  } catch (error) {
21682
21713
  const errorMessage = error.message;
21683
21714
  if (errorMessage.includes("Authentication failed") || errorMessage.includes("access-denied") || errorMessage.includes("Authentication hook unauthorized")) {
@@ -21929,7 +21960,8 @@ var _FetchAvailableFixesService = class _FetchAvailableFixesService {
21929
21960
  }
21930
21961
  async initializeGqlClient() {
21931
21962
  if (!this.gqlClient) {
21932
- this.gqlClient = await createAuthenticatedMcpGQLClient();
21963
+ const loginContext = createMcpLoginContext("fetch_fixes");
21964
+ this.gqlClient = await createAuthenticatedMcpGQLClient({ loginContext });
21933
21965
  }
21934
21966
  return this.gqlClient;
21935
21967
  }
@@ -22326,7 +22358,8 @@ var _ScanAndFixVulnerabilitiesService = class _ScanAndFixVulnerabilitiesService
22326
22358
  }
22327
22359
  }
22328
22360
  async initializeGqlClient() {
22329
- const gqlClient = await createAuthenticatedMcpGQLClient();
22361
+ const loginContext = createMcpLoginContext("scan_vulnerabilities");
22362
+ const gqlClient = await createAuthenticatedMcpGQLClient({ loginContext });
22330
22363
  const isConnected = await gqlClient.verifyApiConnection();
22331
22364
  if (!isConnected) {
22332
22365
  throw new ApiConnectionError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.1.24",
3
+ "version": "1.1.27",
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",