fix: review cleanup — dedup containment check, remove dead imports, fix -u edge case

Amolith and Shelley created

- 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 <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 { 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

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

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