feat: add --format option to GitShow tool (patch/stat/metadata)#3212
Open
TheArchitectit wants to merge 1 commit into
Open
feat: add --format option to GitShow tool (patch/stat/metadata)#3212TheArchitectit wants to merge 1 commit into
TheArchitectit wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Reviewer
1716775457damnon our merged PR #2832 (git-aware context tools) suggested:This PR implements that suggestion.
Changes
New
formatfield onGitShowInput"patch"(default)"stat"--stat"metadata"--format=medium --no-patchBackward compatibility
The legacy
stat: Option<bool>field still works whenformatis not set. Whenformatis set, it takes priority. This is fully backward compatible — no existing tool calls break.Error handling
Unknown format values return a clear error:
Why this matters
When the model uses
GitShowto understand recent commits, the full diff is often unnecessary and expensive in terms of context window tokens. Withformat: "metadata", the model can efficiently review commit messages and authors without loading the diff. Withformat: "stat", it gets a quick overview of which files changed.Diff verification
Single-file change, no cross-cutting concerns, no upstream commits reverted.