From a09e83aff6354ef1ed6fe447d4979b02a698ff8c Mon Sep 17 00:00:00 2001 From: Amolith Date: Sat, 7 Feb 2026 03:01:00 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20review=20cleanup=20=E2=80=94=20dedup=20c?= =?UTF-8?q?ontainment=20check,=20remove=20dead=20imports,=20fix=20-u=20edg?= =?UTF-8?q?e=20case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Deduplicate ensureContained() in content.ts: import ensureWorkspacePath from path-utils.ts instead of maintaining an identical private copy - Remove unused DEFAULT_MAX_BYTES/DEFAULT_MAX_LINES imports from git blame, diff, and show tools (truncateHead uses them internally) - Fix -u without value silently setting options["u"] = true: now leaves uri unset so command handlers can validate properly - Extract expandHomePath() utility for system_prompt_path tilde expansion, replacing fragile inline regex that missed bare ~ and empty HOME - Remove unnecessary parseArgs re-export from cli/index.ts (tests import directly from parse-args.ts) - Add test for -u at end of args Co-authored-by: Shelley --- 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(-) diff --git a/src/agent/tools/git/blame.ts b/src/agent/tools/git/blame.ts index 90768f01e5d7c612a1c2cd19f5b03ed9d6ced1ce..35ba695c3bcb268eb6a6c3147d9465524b70bed8 100644 --- a/src/agent/tools/git/blame.ts +++ b/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 { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "../../../util/truncate.js"; +import { 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 diff --git a/src/agent/tools/git/diff.ts b/src/agent/tools/git/diff.ts index d7ce739170de6ea830128742fa44f87f9336322b..b69a7744df77044467bf29796c688ce2fad5a0b5 100644 --- a/src/agent/tools/git/diff.ts +++ b/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 { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "../../../util/truncate.js"; +import { 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 diff --git a/src/agent/tools/git/show.ts b/src/agent/tools/git/show.ts index a9960232bf2293f6b23106c37bc7dd066b1850ea..888020ccf84dddfe75e66e50acb6be6822e67adc 100644 --- a/src/agent/tools/git/show.ts +++ b/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 { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead } from "../../../util/truncate.js"; +import { 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