Skip to content

feat: add --format option to GitShow tool (patch/stat/metadata)#3212

Open
TheArchitectit wants to merge 1 commit into
ultraworkers:mainfrom
TheArchitectit:worktree-gitshow-format
Open

feat: add --format option to GitShow tool (patch/stat/metadata)#3212
TheArchitectit wants to merge 1 commit into
ultraworkers:mainfrom
TheArchitectit:worktree-gitshow-format

Conversation

@TheArchitectit
Copy link
Copy Markdown
Contributor

Context

Reviewer 1716775457damn on our merged PR #2832 (git-aware context tools) suggested:

Consider adding a GitShow --format option so the model can request patch vs metadata selectively.

This PR implements that suggestion.

Changes

New format field on GitShowInput

Value Behavior Git flags
"patch" (default) Full diff (none)
"stat" Diffstat summary --stat
"metadata" Commit info only (author, date, message, no diff) --format=medium --no-patch

Backward compatibility

The legacy stat: Option<bool> field still works when format is not set. When format is set, it takes priority. This is fully backward compatible — no existing tool calls break.

Error handling

Unknown format values return a clear error:

unknown GitShow format: "foo". Supported values: "patch" (default), "stat", "metadata".

Why this matters

When the model uses GitShow to understand recent commits, the full diff is often unnecessary and expensive in terms of context window tokens. With format: "metadata", the model can efficiently review commit messages and authors without loading the diff. With format: "stat", it gets a quick overview of which files changed.

Diff verification

1 file changed, 34 insertions(+), 4 deletions(-)

Single-file change, no cross-cutting concerns, no upstream commits reverted.

The reviewer of our merged PR ultraworkers#2832 (git-aware context tools)
suggested adding a GitShow --format option so the model can request
patch vs metadata selectively. This implements that suggestion.

Changes:
- GitShowInput: add format: Option<String> field
  - "patch" (default): full diff — no flags needed
  - "stat": diffstat summary — passes --stat
  - "metadata": commit info only — passes --format=medium --no-patch
- Backward compatible: the legacy stat: Option<bool> field still works
  when format is not set. When format is set, it takes priority.
- ToolSpec: updated description and input_schema with format enum
- Unknown format values return a clear error message with valid options

Single-file change, no cross-cutting concerns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant