Skip to main content

Git Tools

Category: version-control · 10 tools

Version control operations for Git repositories.

Tools

ToolParametersDescription
git.clonerepo, sha, filter?, depth?, cloneRoot?Clone a GitHub repository at a specific commit SHA for local inspection
git.statuspath?Get modified, staged, untracked files
git.diffpath?, staged?Show changes (staged or unstaged)
git.logmaxCount?, path?Get recent commit history
git.addpathStage files for commit
git.commitmessageCommit staged changes
git.blamepathShow who changed what
git.branch_listremote?List all branches
git.branch_createnameCreate a new branch
git.checkoutbranchSwitch branches

git.clone Parameters

ParameterTypeRequiredDescription
repostringYesRepository in owner/repo format (e.g. microsoft/typescript)
shastringYesCommit SHA to checkout (7–40 hex characters). Always use SHAs, not branch names
filterstringNoGit partial clone filter. blob:none (default) skips file blobs for a fast clone — blobs are fetched on demand. Use none when you need immediate access to all file contents
depthnumberNoCommit history depth. Default 50. Use 0 for full history when you need complete git log or blame across a long-lived file
cloneRootstringNoOverride the local directory where clones are stored. Leave unset in almost all cases — the default is managed automatically

Clones are cached per repo+sha pair. Repeated calls with the same arguments are instant. Disk is managed automatically with LRU eviction.

Examples

Cloning a Repo at a Specific Commit

const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Clone acme/my-app at commit abc1234 and show me what changed' }],
model: 'gpt-4o',
});
// AI uses git.clone, then git.diff or fs.* on the returned cloneDir

Checking Status

const stream = toolpack.stream({
messages: [{ role: 'user', content: 'What files have I changed?' }],
model: 'gpt-4o',
});
// AI uses git.status

Viewing Changes

const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Show me the diff for utils.ts' }],
model: 'gpt-4o',
});
// AI uses git.diff

Committing

const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Stage and commit these changes with message "Fix bug"' }],
model: 'gpt-4o',
});
// AI uses git.add then git.commit

Branch Management

const stream = toolpack.stream({
messages: [{ role: 'user', content: 'Create a new branch called feature/auth' }],
model: 'gpt-4o',
});
// AI uses git.branch_create