This package provides Git functionality for the Terminal Intelligence IDE using the go-git library.
The Git integration provides a complete Git workflow without requiring external Git installation. It includes a visual panel interface accessible via Ctrl+G that supports all common Git operations.
client.go- GitClient for Git operations (clone, pull, push, fetch, stage, commit, status, restore)credentials.go- CredentialStore for secure credential management
Remote Operations
- Clone: Clone repositories from remote URLs with authentication support
- Pull: Fetch and merge changes from remote repository
- Fetch: Download changes from remote without merging
Local to Remote Workflow
- Stage: Stage all modified and untracked files for commit
- Commit: Create commits with custom messages (validates non-empty messages)
- Push: Push local commits to remote repository with authentication
Info and Undo
- Status: Display repository status (modified, staged, untracked files)
- Restore: Discard uncommitted changes and restore to last commit
- GitHub Personal Access Tokens (ghp_...)
- Username/Password authentication
- Automatic credential detection from
.git/config - Secure credential storage in repository configuration
- Automatically detects if current directory is a Git repository
- Loads stored credentials from existing repositories
- Populates remote URL from repository configuration
The Git panel (internal/ui/gitpane.go) provides:
- Three input fields: URL, Username, Password/Token
- Eight operation buttons organized into logical groups
- Dynamic commit message input (appears only when Commit is selected)
- Real-time status and error messages
- Keyboard-driven navigation
- github.com/go-git/go-git/v5 - Pure Go Git implementation
- github.com/go-git/go-git/v5/plumbing/object - Git object types
- github.com/go-git/go-git/v5/plumbing/transport/http - HTTP authentication
Tests are organized in the following directories:
tests/unit/git/- Unit tests for individual componentstests/property/git/- Property-based tests for correctness propertiestests/integration/git/- Integration tests for end-to-end workflows
// Create a Git client
client := git.NewClient("/path/to/workspace")
// Clone a repository
result, err := client.Clone("https://github.com/user/repo.git", "username", "token", "")
// Stage changes
result, err = client.Stage()
// Commit with message
result, err = client.Commit("Add new feature")
// Push to remote
result, err = client.Push("username", "token")All operations return *OperationResult with:
Success: Boolean indicating operation successMessage: Human-readable result messageError: Detailed error information if operation failed
Errors are categorized for better user feedback:
- Authentication errors
- Network errors
- Repository state errors
- File system errors