claude-attribution 1.9.5 → 1.9.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-attribution",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "AI code attribution tracking for Claude Code and GitHub Copilot sessions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { writeFile } from "fs/promises";
2
+ import { mkdir, writeFile } from "fs/promises";
3
3
  import { join } from "path";
4
4
  import {
5
5
  buildAiSinceMinimap,
@@ -64,6 +64,30 @@ await ctx.cleanup();
64
64
  }
65
65
  });
66
66
 
67
+ test("reads large all-AI minimap notes without maxBuffer failures", async () => {
68
+ const ctx = await createTempContext("claude-attribution-minimap-large-note");
69
+ try {
70
+ await initGitRepo(ctx.repo);
71
+ await mkdir(join(ctx.repo, "docs"), { recursive: true });
72
+ const longLine = "x".repeat(1024);
73
+ for (let i = 0; i < 1100; i++) {
74
+ await writeFile(join(ctx.repo, `docs/file-${i}.txt`), `${longLine}-${i}\n`);
75
+ }
76
+ await runCommand("git", ["add", "."], { cwd: ctx.repo });
77
+ await runCommand("git", ["commit", "-m", "large baseline"], { cwd: ctx.repo });
78
+ const sha = await currentSha(ctx.repo);
79
+
80
+ const result = await buildAllAiMinimap(ctx.repo);
81
+ await writeMinimap(result, ctx.repo, sha);
82
+
83
+ const stored = await readMinimap(ctx.repo, sha);
84
+ expect(stored?.totals).toEqual(result.totals);
85
+ expect(stored?.files).toHaveLength(result.files.length);
86
+ } finally {
87
+ await ctx.cleanup();
88
+ }
89
+ });
90
+
67
91
  test("marks only recently changed files as AI in ai-since minimaps", async () => {
68
92
  const ctx = await createTempContext("claude-attribution-minimap-ai-since");
69
93
  try {
@@ -22,10 +22,14 @@ import {
22
22
 
23
23
  const execFileAsync = promisify(execFile);
24
24
  export const NOTES_REF = "refs/notes/claude-attribution";
25
+ const GIT_OUTPUT_MAX_BUFFER = 10 * 1024 * 1024;
25
26
 
26
27
  /** Run a shell command and return trimmed stdout. Throws on non-zero exit. */
27
28
  async function run(cmd: string, args: string[], cwd?: string): Promise<string> {
28
- const { stdout } = await execFileAsync(cmd, args, { cwd });
29
+ const { stdout } = await execFileAsync(cmd, args, {
30
+ cwd,
31
+ maxBuffer: GIT_OUTPUT_MAX_BUFFER,
32
+ });
29
33
  return stdout.trim();
30
34
  }
31
35
 
@@ -35,7 +39,10 @@ async function runRaw(
35
39
  args: string[],
36
40
  cwd?: string,
37
41
  ): Promise<string> {
38
- const { stdout } = await execFileAsync(cmd, args, { cwd });
42
+ const { stdout } = await execFileAsync(cmd, args, {
43
+ cwd,
44
+ maxBuffer: GIT_OUTPUT_MAX_BUFFER,
45
+ });
39
46
  return stdout;
40
47
  }
41
48
 
@@ -27,6 +27,7 @@ import { committedContentAt } from "./git-notes.ts";
27
27
 
28
28
  const execFileAsync = promisify(execFile);
29
29
  const BLANK_LINE_HASH = hashLine("");
30
+ const GIT_OUTPUT_MAX_BUFFER = 10 * 1024 * 1024;
30
31
 
31
32
  export const MINIMAP_NOTES_REF = "refs/notes/claude-attribution-map";
32
33
 
@@ -48,7 +49,10 @@ export interface MinimapResult {
48
49
  }
49
50
 
50
51
  async function run(cmd: string, args: string[], cwd?: string): Promise<string> {
51
- const { stdout } = await execFileAsync(cmd, args, { cwd });
52
+ const { stdout } = await execFileAsync(cmd, args, {
53
+ cwd,
54
+ maxBuffer: GIT_OUTPUT_MAX_BUFFER,
55
+ });
52
56
  return stdout.trim();
53
57
  }
54
58