Repository navigation
feat: Add git tools - #104
Merged
Merged
Conversation
Implements 7 new git tools using the {gert} package:
- btw_tool_git_status() - Show working directory status
- btw_tool_git_diff() - View diffs between refs or working tree
- btw_tool_git_log() - List commit history
- btw_tool_git_commit() - Create commits
- btw_tool_git_branch_list() - List branches
- btw_tool_git_branch_create() - Create new branches
- btw_tool_git_branch_checkout() - Switch branches
Tools are conditionally registered only when {gert} is installed,
with runtime checks using check_installed("gert").
Generated with Claude Code
Creates tests/testthat/helpers-git.R with a helper function that abstracts the common setup pattern for temporary git repositories. This reduces duplication across all git tool tests and makes the tests more maintainable. Generated with Claude Code
Adds snapshots to capture the key outputs that are returned to LLMs for each git tool. These snapshots provide a clear picture of the data format and content being sent back, making it easier to validate that tools are returning appropriate information. Snapshots cover: - git_status: file status tables and empty state messages - git_diff: diff patches and no-changes messages - git_log: commit history tables - git_commit: commit confirmation messages - git_branch_list: branch listing tables - git_branch_create: branch creation confirmations - git_branch_checkout: checkout confirmations Generated with Claude Code
Creates a helper function in tests/testthat/helpers-git.R that replaces variable git details (timestamps and commit SHAs) with fixed placeholder values. This ensures snapshot tests don't change on every test run. The function: - Replaces timestamps (YYYY-MM-DD HH:MM:SS) with "2025-10-11 12:13:14" - Replaces 7-character commit SHAs with "abcd123" All snapshot tests now use `transform = scrub_git_details` to ensure stable, reproducible snapshots across test runs. Generated with Claude Code
This reverts commit 4139ec2.
Use gert::git_diff_patch param docs and fix empty-diff detection (handle character vectors returned by git_diff_patch). Update tool description and man pages to clarify that the tool shows the diff for a single commit and note the limitation that diffing two arbitrary commits is not supported.
Add clickable action-link toggle to each tool group so users can select/deselect all tools in a group from the btw_app UI. Introduce tool_group_icon() and refactor set_tool_icon() to centralize group icons. Add a new 'difference' SVG icon used for the git group.
Use enum include for git status: switch staged -> include; update tests and snapshot
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.
Adds seven new git tools for basic repository operations using the {gert} package, enhancing functionality for status, diffs, commits, and branch management.