mobbdev 1.3.3 → 1.3.4

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.
@@ -211,6 +211,12 @@ type PromptItemArray = z.infer<typeof PromptItemArrayZ>;
211
211
  * Returns null if not in a git repository or if not a GitHub repository.
212
212
  */
213
213
  declare function getRepositoryUrl(workingDir?: string): Promise<string | null>;
214
+ /**
215
+ * Gets the absolute git root path of the working directory's git checkout.
216
+ * Used by Tracy uploads to let the server filter out events whose filePath
217
+ * falls outside the repo (e.g., /tmp scratchpads, ~/.zshrc).
218
+ */
219
+ declare function getRepoGitRoot(workingDir?: string): Promise<string | null>;
214
220
  /**
215
221
  * Get system information for tracking inference source.
216
222
  * Works cross-platform (Windows, macOS, Linux).
@@ -265,4 +271,4 @@ type UploadAiBlameHandlerOptions = {
265
271
  declare function uploadAiBlameHandler(options: UploadAiBlameHandlerOptions): Promise<void>;
266
272
  declare function uploadAiBlameCommandHandler(args: UploadAiBlameOptions): Promise<void>;
267
273
 
268
- export { type PromptItem, type PromptItemArray, type UploadAiBlameOptions, type UploadAiBlameResult, getRepositoryUrl, getSystemInfo, uploadAiBlameBuilder, uploadAiBlameCommandHandler, uploadAiBlameHandler, uploadAiBlameHandlerFromExtension };
274
+ export { type PromptItem, type PromptItemArray, type UploadAiBlameOptions, type UploadAiBlameResult, getRepoGitRoot, getRepositoryUrl, getSystemInfo, uploadAiBlameBuilder, uploadAiBlameCommandHandler, uploadAiBlameHandler, uploadAiBlameHandlerFromExtension };
@@ -2851,10 +2851,27 @@ var init_gitBlameTypes = __esm({
2851
2851
  // Array of commit SHAs in order
2852
2852
  });
2853
2853
  BlameLineEntryZ = z19.object({
2854
+ /** Current file path in the PR head (what git blame was invoked on). */
2854
2855
  file: z19.string(),
2856
+ /** Current line number in the PR head. */
2855
2857
  line: z19.number(),
2858
+ /** SHA of the commit that originally authored this line. */
2856
2859
  originalCommitSha: z19.string(),
2857
- originalLineNumber: z19.number()
2860
+ /** Line number as it was in `originalCommitSha`. */
2861
+ originalLineNumber: z19.number(),
2862
+ /**
2863
+ * File path as it was in `originalCommitSha` at the time that commit
2864
+ * authored this line. When a file has been renamed since, this differs
2865
+ * from `file`. Used as the primary lookup key against attribution
2866
+ * records (which are stored at the path-as-of-original-commit).
2867
+ *
2868
+ * Defaults to `''` to preserve backward compatibility with
2869
+ * BlameLinesData records persisted in S3 before this field existed —
2870
+ * those records deserialize with `originalFile === ''` and callers
2871
+ * must treat empty as "fall back to `file`" (see enrichDiffLines,
2872
+ * targetedBlame).
2873
+ */
2874
+ originalFile: z19.string().default("")
2858
2875
  });
2859
2876
  BlameLinesDataZ = z19.object({
2860
2877
  lines: z19.array(BlameLineEntryZ)
@@ -7924,6 +7941,18 @@ async function getRepositoryUrl(workingDir) {
7924
7941
  return null;
7925
7942
  }
7926
7943
  }
7944
+ async function getRepoGitRoot(workingDir) {
7945
+ try {
7946
+ const gitService = new GitService(workingDir ?? process.cwd());
7947
+ const isRepo = await gitService.isGitRepository();
7948
+ if (!isRepo) {
7949
+ return null;
7950
+ }
7951
+ return await gitService.getGitRoot();
7952
+ } catch {
7953
+ return null;
7954
+ }
7955
+ }
7927
7956
  function getSystemInfo() {
7928
7957
  let userName;
7929
7958
  try {
@@ -8202,6 +8231,7 @@ async function uploadAiBlameCommandHandler(args) {
8202
8231
  await uploadAiBlameHandler({ args });
8203
8232
  }
8204
8233
  export {
8234
+ getRepoGitRoot,
8205
8235
  getRepositoryUrl,
8206
8236
  getSystemInfo,
8207
8237
  uploadAiBlameBuilder,
package/dist/index.mjs CHANGED
@@ -2903,10 +2903,27 @@ var init_gitBlameTypes = __esm({
2903
2903
  // Array of commit SHAs in order
2904
2904
  });
2905
2905
  BlameLineEntryZ = z18.object({
2906
+ /** Current file path in the PR head (what git blame was invoked on). */
2906
2907
  file: z18.string(),
2908
+ /** Current line number in the PR head. */
2907
2909
  line: z18.number(),
2910
+ /** SHA of the commit that originally authored this line. */
2908
2911
  originalCommitSha: z18.string(),
2909
- originalLineNumber: z18.number()
2912
+ /** Line number as it was in `originalCommitSha`. */
2913
+ originalLineNumber: z18.number(),
2914
+ /**
2915
+ * File path as it was in `originalCommitSha` at the time that commit
2916
+ * authored this line. When a file has been renamed since, this differs
2917
+ * from `file`. Used as the primary lookup key against attribution
2918
+ * records (which are stored at the path-as-of-original-commit).
2919
+ *
2920
+ * Defaults to `''` to preserve backward compatibility with
2921
+ * BlameLinesData records persisted in S3 before this field existed —
2922
+ * those records deserialize with `originalFile === ''` and callers
2923
+ * must treat empty as "fall back to `file`" (see enrichDiffLines,
2924
+ * targetedBlame).
2925
+ */
2926
+ originalFile: z18.string().default("")
2910
2927
  });
2911
2928
  BlameLinesDataZ = z18.object({
2912
2929
  lines: z18.array(BlameLineEntryZ)
@@ -13999,6 +14016,18 @@ async function getRepositoryUrl(workingDir) {
13999
14016
  return null;
14000
14017
  }
14001
14018
  }
14019
+ async function getRepoGitRoot(workingDir) {
14020
+ try {
14021
+ const gitService = new GitService(workingDir ?? process.cwd());
14022
+ const isRepo = await gitService.isGitRepository();
14023
+ if (!isRepo) {
14024
+ return null;
14025
+ }
14026
+ return await gitService.getGitRoot();
14027
+ } catch {
14028
+ return null;
14029
+ }
14030
+ }
14002
14031
  function getSystemInfo() {
14003
14032
  let userName;
14004
14033
  try {
@@ -14331,6 +14360,7 @@ async function prepareAndSendTracyRecords(client, rawRecords, workingDir, option
14331
14360
  const defaultClientVersion = packageJson.version;
14332
14361
  const shouldSanitize = options?.sanitize ?? true;
14333
14362
  const defaultRepoUrl = rawRecords[0]?.repositoryUrl ? void 0 : await getRepositoryUrl(workingDir) ?? void 0;
14363
+ const defaultGitRoot = rawRecords[0]?.gitRoot ? void 0 : await getRepoGitRoot(workingDir) ?? void 0;
14334
14364
  debug10(
14335
14365
  "[step:sanitize] %s %d records",
14336
14366
  shouldSanitize ? "Sanitizing" : "Serializing",
@@ -14349,6 +14379,7 @@ async function prepareAndSendTracyRecords(client, rawRecords, workingDir, option
14349
14379
  return {
14350
14380
  ...rest,
14351
14381
  repositoryUrl: record.repositoryUrl ?? defaultRepoUrl,
14382
+ gitRoot: record.gitRoot ?? defaultGitRoot,
14352
14383
  computerName,
14353
14384
  userName,
14354
14385
  clientVersion: record.clientVersion ?? defaultClientVersion
@@ -17400,7 +17431,7 @@ function createLogger(config2) {
17400
17431
 
17401
17432
  // src/features/claude_code/hook_logger.ts
17402
17433
  var DD_RUM_TOKEN = true ? "pubf59c0182545bfb4c299175119f1abf9b" : "";
17403
- var CLI_VERSION = true ? "1.3.3" : "unknown";
17434
+ var CLI_VERSION = true ? "1.3.4" : "unknown";
17404
17435
  var NAMESPACE = "mobbdev-claude-code-hook-logs";
17405
17436
  var claudeCodeVersion;
17406
17437
  function buildDdTags() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
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",