Supyagent
ToolsBuilt-in Tools

Git Tool

Reference for the git default tool: git_status, git_diff, git_commit, git_log, and git_branch.

Git Tool

Script: powers/git.py Dependencies: pydantic

Interact with Git repositories -- check status, view diffs, commit changes, browse history, and manage branches. All operations use the git CLI under the hood.


git_status

Get the current status of a Git repository, including staged, unstaged, and untracked files.

Input

FieldTypeDefaultDescription
working_dirstr"."Path to the Git repository

Output

FieldTypeDescription
okbooltrue if status was retrieved
branchstrCurrent branch name
stagedlistFiles staged for commit: {file, status}
unstagedlistModified but unstaged files: {file, status}
untrackedlistUntracked file paths
errorstrError message on failure

Status values: "modified", "added", "deleted", "renamed"

Examples

// Check status of current repo
{"working_dir": "."}

// Check a different repo
{"working_dir": "/path/to/repo"}

Example Output

{
  "ok": true,
  "branch": "feature/new-tool",
  "staged": [
    {"file": "src/main.py", "status": "modified"}
  ],
  "unstaged": [
    {"file": "README.md", "status": "modified"}
  ],
  "untracked": ["new_file.py"]
}

git_diff

Show changes in a Git repository. Can show unstaged changes, staged changes, or diff against a specific ref.

Input

FieldTypeDefaultDescription
working_dirstr"."Path to the Git repository
stagedboolfalseShow staged (cached) changes instead of unstaged
filestrnullLimit diff to a specific file
refstrnullDiff against a specific ref (branch, tag, commit)

Output

FieldTypeDescription
okbooltrue if diff was retrieved
diff_textstrFull diff output
fileslistPer-file statistics: {path, additions, deletions}
errorstrError message on failure

Examples

// Unstaged changes (default)
{"working_dir": "."}

// Staged changes
{"staged": true}

// Diff against main branch
{"ref": "main"}

// Diff for a specific file
{"file": "src/main.py"}

// Staged changes for one file
{"staged": true, "file": "config.yaml"}

git_commit

Create a Git commit. Can stage specific files or all changes before committing.

Input

FieldTypeDefaultDescription
messagestrrequiredCommit message
fileslistnullSpecific files to stage and commit
allboolfalseStage all changes before committing (git add -A)
working_dirstr"."Path to the Git repository

Output

FieldTypeDescription
okbooltrue if commit succeeded
hashstrFull commit hash
messagestrCommit message used
files_changedintNumber of files changed in the commit
errorstrError message on failure

Examples

// Commit specific files
{"message": "Fix bug in parser", "files": ["src/parser.py", "tests/test_parser.py"]}

// Commit all changes
{"message": "Update all configs", "all": true}

// Commit already-staged changes
{"message": "Add new feature"}

Notes

  • If files is provided, those files are staged (git add) before committing
  • If all is true, git add -A is run before committing
  • If neither files nor all is set, only already-staged changes are committed

git_log

Show the commit history of a Git repository.

Input

FieldTypeDefaultDescription
nint10Number of commits to show
refstrnullBranch, tag, or commit ref to start from
working_dirstr"."Path to the Git repository

Output

FieldTypeDescription
okbooltrue if log was retrieved
commitslistArray of commit objects (see below)
errorstrError message on failure

Each commit object:

FieldTypeDescription
hashstrFull commit hash
authorstrAuthor name
datestrCommit date (ISO format)
messagestrCommit subject line

Examples

// Last 5 commits
{"n": 5}

// Last 20 commits on main
{"n": 20, "ref": "main"}

// History of a different repo
{"working_dir": "/path/to/repo"}

git_branch

Manage Git branches -- list, create, switch, or delete.

Input

FieldTypeDefaultDescription
actionstr"list"Action to perform: "list", "create", "switch", or "delete"
namestrnullBranch name (required for create/switch/delete)
working_dirstr"."Path to the Git repository

Output

FieldTypeDescription
okbooltrue if operation succeeded
brancheslistBranch list (for list action): {name, is_current, is_remote}
currentstrCurrent branch name (after any action)
errorstrError message on failure

Examples

// List all branches
{"action": "list"}

// Create and switch to new branch
{"action": "create", "name": "feature/new-thing"}

// Switch to existing branch
{"action": "switch", "name": "main"}

// Delete a branch
{"action": "delete", "name": "old-branch"}

Notes

  • create uses git checkout -b (creates and switches to the new branch)
  • delete uses git branch -d (safe delete -- fails if branch is not merged)
  • list includes both local and remote branches

Tips

  • Use git_status before git_commit to see exactly what will be committed
  • Use git_diff with staged: true to review staged changes before committing
  • Pair git_log with git_diff using a ref to see what changed between branches
  • All operations have a 30-second timeout to prevent hanging
  • These tools require git to be installed and the working directory to be inside a Git repository