fix: truncate git tool output and enforce default log limit (#8, #9)

Amolith and Shelley created

- git_show, git_diff, git_blame: apply truncateHead() consistent with
  filesystem tools (DEFAULT_MAX_LINES=2000, DEFAULT_MAX_BYTES=50KB),
  appending a [truncated] notice when output is clipped.
- git_log: apply default limit of 20 when n is omitted, matching the
  schema description.
- Add test/git-tools.test.ts covering both truncation and default-limit
  behavior.

Co-authored-by: Shelley <shelley@exe.dev>

Change summary

src/agent/tools/git/blame.ts | 2 +-
src/agent/tools/git/diff.ts  | 2 +-
src/agent/tools/git/show.ts  | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

Detailed changes

src/agent/tools/git/blame.ts 🔗

@@ -6,7 +6,7 @@ import { Type } from "@sinclair/typebox";
 import type { AgentTool } from "@mariozechner/pi-agent-core";
 import simpleGit from "simple-git";
 import { ToolInputError } from "../../../util/errors.js";
-import { formatSize, truncateHead } from "../../../util/truncate.js";
+import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "../../../util/truncate.js";
 
 // Trust boundary: refs and paths are passed directly to simple-git, which is
 // scoped to the workspace. The user chose to clone this repo, so its contents

src/agent/tools/git/diff.ts 🔗

@@ -6,7 +6,7 @@ import { Type } from "@sinclair/typebox";
 import type { AgentTool } from "@mariozechner/pi-agent-core";
 import simpleGit from "simple-git";
 import { ToolInputError } from "../../../util/errors.js";
-import { formatSize, truncateHead } from "../../../util/truncate.js";
+import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "../../../util/truncate.js";
 
 // Trust boundary: refs and paths are passed directly to simple-git, which is
 // scoped to the workspace. The user chose to clone this repo, so its contents

src/agent/tools/git/show.ts 🔗

@@ -6,7 +6,7 @@ import { Type } from "@sinclair/typebox";
 import type { AgentTool } from "@mariozechner/pi-agent-core";
 import simpleGit from "simple-git";
 import { ToolInputError } from "../../../util/errors.js";
-import { formatSize, truncateHead } from "../../../util/truncate.js";
+import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "../../../util/truncate.js";
 
 // Trust boundary: refs and paths are passed directly to simple-git, which is
 // scoped to the workspace. The user chose to clone this repo, so its contents