mobbdev 1.2.53 → 1.2.55

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.
@@ -210,7 +210,7 @@ type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
210
210
  * Gets the normalized GitHub repository URL from the current working directory.
211
211
  * Returns null if not in a git repository or if not a GitHub repository.
212
212
  */
213
- declare function getRepositoryUrl(): Promise<string | null>;
213
+ declare function getRepositoryUrl(workingDir?: string): Promise<string | null>;
214
214
  /**
215
215
  * Get system information for tracking inference source.
216
216
  * Works cross-platform (Windows, macOS, Linux).
@@ -239,6 +239,7 @@ type UploadAiBlameResult = {
239
239
  inferenceCounts: SanitizationCounts;
240
240
  promptsUUID?: string;
241
241
  inferenceUUID?: string;
242
+ sanitizationDurationMs?: number;
242
243
  };
243
244
  declare function uploadAiBlameHandlerFromExtension(args: {
244
245
  prompts: PromptItemArray;
@@ -251,6 +252,7 @@ declare function uploadAiBlameHandlerFromExtension(args: {
251
252
  apiUrl?: string;
252
253
  webAppUrl?: string;
253
254
  repositoryUrl?: string | null;
255
+ sanitize?: boolean;
254
256
  }): Promise<UploadAiBlameResult>;
255
257
  type UploadAiBlameHandlerOptions = {
256
258
  args: UploadAiBlameOptions;
@@ -7388,22 +7388,21 @@ function buildLoginUrl(baseUrl, loginId, hostname, context) {
7388
7388
 
7389
7389
  // src/utils/ConfigStoreService.ts
7390
7390
  import Configstore from "configstore";
7391
- function createConfigStore(defaultValues = { apiToken: "" }) {
7391
+ function getSanitizedDomain() {
7392
7392
  const API_URL2 = process.env["API_URL"] || DEFAULT_API_URL;
7393
7393
  let domain = "";
7394
7394
  try {
7395
7395
  const url = new URL(API_URL2);
7396
7396
  domain = url.hostname;
7397
- } catch (e) {
7397
+ } catch {
7398
7398
  domain = API_URL2.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
7399
7399
  }
7400
- const sanitizedDomain = domain.replace(/\./g, "_");
7401
- return new Configstore(`mobbdev-${sanitizedDomain}`, defaultValues);
7400
+ return domain.replace(/\./g, "_");
7402
7401
  }
7403
- function getConfigStore() {
7404
- return createConfigStore();
7402
+ function createConfigStore(defaultValues = { apiToken: "" }) {
7403
+ return new Configstore(`mobbdev-${getSanitizedDomain()}`, defaultValues);
7405
7404
  }
7406
- var configStore = getConfigStore();
7405
+ var configStore = createConfigStore();
7407
7406
 
7408
7407
  // src/commands/AuthManager.ts
7409
7408
  var debug10 = Debug9("mobbdev:auth");
@@ -7875,9 +7874,9 @@ var PromptItemZ = z27.object({
7875
7874
  }).optional()
7876
7875
  });
7877
7876
  var PromptItemArrayZ = z27.array(PromptItemZ);
7878
- async function getRepositoryUrl() {
7877
+ async function getRepositoryUrl(workingDir) {
7879
7878
  try {
7880
- const gitService = new GitService(process.cwd());
7879
+ const gitService = new GitService(workingDir ?? process.cwd());
7881
7880
  const isRepo = await gitService.isGitRepository();
7882
7881
  if (!isRepo) {
7883
7882
  return null;
@@ -7938,6 +7937,7 @@ function uploadAiBlameBuilder(args) {
7938
7937
  }).strict();
7939
7938
  }
7940
7939
  async function uploadAiBlameHandlerFromExtension(args) {
7940
+ const shouldSanitize = args.sanitize ?? true;
7941
7941
  const uploadArgs = {
7942
7942
  prompt: [],
7943
7943
  inference: [],
@@ -7951,28 +7951,50 @@ async function uploadAiBlameHandlerFromExtension(args) {
7951
7951
  let inferenceCounts;
7952
7952
  let promptsUUID;
7953
7953
  let inferenceUUID;
7954
+ const zeroCounts = {
7955
+ detections: { total: 0, high: 0, medium: 0, low: 0 }
7956
+ };
7957
+ let sanitizationDurationMs;
7954
7958
  await withFile(async (promptFile) => {
7955
- const promptsResult = await sanitizeDataWithCounts(args.prompts);
7956
- promptsCounts = promptsResult.counts;
7957
7959
  promptsUUID = path6.basename(promptFile.path, path6.extname(promptFile.path));
7958
- await fsPromises2.writeFile(
7959
- promptFile.path,
7960
- JSON.stringify(promptsResult.sanitizedData, null, 2),
7961
- "utf-8"
7962
- );
7960
+ if (shouldSanitize) {
7961
+ const sanitizeStart = performance.now();
7962
+ const promptsResult = await sanitizeDataWithCounts(args.prompts);
7963
+ promptsCounts = promptsResult.counts;
7964
+ await fsPromises2.writeFile(
7965
+ promptFile.path,
7966
+ JSON.stringify(promptsResult.sanitizedData, null, 2),
7967
+ "utf-8"
7968
+ );
7969
+ sanitizationDurationMs = performance.now() - sanitizeStart;
7970
+ } else {
7971
+ promptsCounts = zeroCounts;
7972
+ await fsPromises2.writeFile(
7973
+ promptFile.path,
7974
+ JSON.stringify(args.prompts, null, 2),
7975
+ "utf-8"
7976
+ );
7977
+ }
7963
7978
  uploadArgs.prompt.push(promptFile.path);
7964
7979
  await withFile(async (inferenceFile) => {
7965
- const inferenceResult = await sanitizeDataWithCounts(args.inference);
7966
- inferenceCounts = inferenceResult.counts;
7967
7980
  inferenceUUID = path6.basename(
7968
7981
  inferenceFile.path,
7969
7982
  path6.extname(inferenceFile.path)
7970
7983
  );
7971
- await fsPromises2.writeFile(
7972
- inferenceFile.path,
7973
- inferenceResult.sanitizedData,
7974
- "utf-8"
7975
- );
7984
+ if (shouldSanitize) {
7985
+ const inferenceStart = performance.now();
7986
+ const inferenceResult = await sanitizeDataWithCounts(args.inference);
7987
+ inferenceCounts = inferenceResult.counts;
7988
+ await fsPromises2.writeFile(
7989
+ inferenceFile.path,
7990
+ inferenceResult.sanitizedData,
7991
+ "utf-8"
7992
+ );
7993
+ sanitizationDurationMs = (sanitizationDurationMs ?? 0) + (performance.now() - inferenceStart);
7994
+ } else {
7995
+ inferenceCounts = zeroCounts;
7996
+ await fsPromises2.writeFile(inferenceFile.path, args.inference, "utf-8");
7997
+ }
7976
7998
  uploadArgs.inference.push(inferenceFile.path);
7977
7999
  uploadArgs.model.push(args.model);
7978
8000
  uploadArgs.toolName.push(args.tool);
@@ -7994,7 +8016,8 @@ async function uploadAiBlameHandlerFromExtension(args) {
7994
8016
  promptsCounts,
7995
8017
  inferenceCounts,
7996
8018
  promptsUUID,
7997
- inferenceUUID
8019
+ inferenceUUID,
8020
+ sanitizationDurationMs
7998
8021
  };
7999
8022
  }
8000
8023
  async function uploadAiBlameHandler(options) {