Skip to content

Commit 571e2a7

Browse files
committed
updated README
1 parent 65a1bb1 commit 571e2a7

2 files changed

Lines changed: 180 additions & 100 deletions

File tree

README.md

Lines changed: 101 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,112 @@ Quick overview of current menu shotcuts and key combinations
1919
- **AI Integration**: Context-aware AI assistance powered by Ollama or Gemini
2020
- **Agentic Code Fixing**: AI autonomously reads, analyzes, and fixes code directly in the editor
2121
- **Chat History Management**: Save and reload complete AI conversations with Ctrl+A and Ctrl+L
22+
- **Integrated Git Operations**: Full Git workflow support with visual panel interface
2223
- **File Management**: Create, open, save, and delete files
2324
- **Command Execution**: Run scripts and programs with Ctrl+R (auto-detects file type)
2425
- **Go Development**: Full support for running Go programs and tests
2526
- **Keyboard Shortcuts**: Efficient keyboard-driven workflow
2627
- **Session Management**: Unsaved changes confirmation on exit
2728
- **Cross-Platform**: Runs on Linux, Windows, and macOS
2829

30+
## Integrated Git Operations
31+
32+
Terminal Intelligence includes a built-in Git client powered by go-git, providing a complete Git workflow without requiring external Git installation. Access all Git operations through an intuitive visual panel interface.
33+
34+
### Opening the Git Panel
35+
36+
Press `Ctrl+G` to open the Git Operations panel. The panel provides:
37+
- Three input fields for repository URL, username, and password/token
38+
- Eight operation buttons organized into logical groups
39+
- Real-time status and error messages
40+
- Automatic credential detection from existing repositories
41+
42+
### Git Operations
43+
44+
The Git panel organizes operations into three logical groups:
45+
46+
**Remote Operations** (Clone, Pull, Fetch)
47+
- **Clone**: Clone a repository from a remote URL to your workspace
48+
- **Pull**: Fetch and merge changes from the remote repository
49+
- **Fetch**: Download changes from remote without merging
50+
51+
**Local to Remote Workflow** (Stage, Commit, Push)
52+
- **Stage**: Stage all modified and untracked files for commit
53+
- **Commit**: Create a commit with staged changes (requires commit message)
54+
- **Push**: Push local commits to the remote repository
55+
56+
**Info and Undo** (Status, Restore)
57+
- **Status**: View repository status (modified, staged, and untracked files)
58+
- **Restore**: Discard all uncommitted changes and restore to last commit
59+
60+
### Git Workflow Example
61+
62+
1. **Check Status**: Press `Ctrl+G`, select Status button, press Enter
63+
2. **Stage Changes**: Navigate to Stage button, press Enter
64+
3. **Commit**: Navigate to Commit button, press Enter
65+
- Enter your commit message in the input field
66+
- Press Enter to commit (message cannot be empty)
67+
4. **Push**: Navigate to Push button, press Enter to push to remote
68+
69+
### Authentication
70+
71+
The Git panel supports multiple authentication methods:
72+
73+
**GitHub Personal Access Token (Recommended)**
74+
- Username: Your GitHub username
75+
- Password: GitHub Personal Access Token (ghp_...)
76+
- Tokens are securely stored in repository configuration
77+
78+
**Username/Password**
79+
- Username: Your Git username
80+
- Password: Your Git password
81+
- Works with most Git hosting services
82+
83+
**Credential Auto-Detection**
84+
- When opening the panel in an existing repository, credentials are automatically loaded from `.git/config`
85+
- Stored credentials are used for subsequent operations
86+
87+
### Navigation
88+
89+
- `Tab` or `Down`: Move focus forward (URL → USER → PASS → Buttons → Commit Message)
90+
- `Shift+Tab` or `Up`: Move focus backward
91+
- `Left/Right`: Navigate between buttons when focused on button row
92+
- `Enter`: Activate selected button or submit commit message
93+
- `Esc`: Close the Git panel
94+
95+
### Commit Message Input
96+
97+
When the Commit button is selected:
98+
1. Press Enter to show the commit message input field
99+
2. Type your commit message (cannot be empty)
100+
3. Press Enter to create the commit
101+
4. The input field disappears after successful commit
102+
103+
### Features
104+
105+
- **Pure Go Implementation**: No external Git installation required
106+
- **Credential Management**: Secure storage and auto-detection of credentials
107+
- **Visual Feedback**: Real-time status messages for all operations
108+
- **Error Handling**: Clear error messages with actionable guidance
109+
- **Repository Detection**: Automatically detects if current directory is a Git repository
110+
- **Cross-Platform**: Works consistently on Linux, Windows, and macOS
111+
112+
### Keyboard Shortcut
113+
114+
| Shortcut | Action |
115+
|----------|--------|
116+
| `Ctrl+G` | Open/Close Git Operations Panel |
117+
118+
### Technical Details
119+
120+
The Git integration uses:
121+
- **go-git/go-git/v5**: Pure Go Git implementation
122+
- **GitClient** (`internal/git/client.go`): Core Git operations
123+
- **CredentialStore** (`internal/git/credentials.go`): Secure credential management
124+
- **GitPane** (`internal/ui/gitpane.go`): Visual panel interface
125+
126+
For more technical details, see [internal/git/README.md](internal/git/README.md).
127+
29128
## Agentic Code Fixing
30129

31130
The AI assistant can autonomously fix code issues in your open files. Simply describe what you want to change, and the AI will read your code, generate a fix, and apply it directly to the editor.
@@ -199,15 +298,12 @@ git clone https://github.com/user/terminal-intelligence.git
199298
cd terminal-intelligence
200299

201300
# Build the application
202-
make build
203-
204-
# Install to local system (optional)
205-
make install
301+
make linux
206302
```
207303

208304
### Compile in windows
209305
```powershell
210-
go build -o .\build\ti.exe
306+
.\build.ps1 windows
211307
```
212308

213309
### Pre-built Binaries
@@ -267,36 +363,6 @@ You can edit this file to customize your settings. The application will load it
267363
- [Go Language Support](./docs/GO_SUPPORT.md) - Complete guide for Go development in TI
268364
- [Automatic Language Installation](./docs/AUTO_INSTALL.md) - Auto-detect and install missing runtimes
269365

270-
```
271-
272-
### Keyboard Shortcuts
273-
274-
| Shortcut | Action |
275-
|----------|--------|
276-
| `Tab` | Cycle between Editor, AI Input, and AI Response areas |
277-
| `Ctrl+S` | Save current file |
278-
| `Ctrl+R` | Execute current script |
279-
| `Ctrl+Enter` | Send message to AI |
280-
| `Ctrl+Y` | List code blocks from AI response (Execute/Insert/Return) |
281-
| `Ctrl+A` | Save full chat history to .ti/ folder |
282-
| `Ctrl+L` | Load saved chat from .ti/ folder |
283-
| `Ctrl+T` | Clear chat / New chat |
284-
| `Ctrl+H` | Show help dialog with all shortcuts |
285-
| `Ctrl+C` or `Ctrl+Q` | Quit application |
286-
287-
Note: You can also type `/help` in the AI chat to see all keyboard shortcuts and agent commands.
288-
289-
### Workflow Example
290-
291-
1. Launch the application
292-
2. Create a new file in the editor
293-
3. Write your code or markdown
294-
4. Press `Ctrl+S` to save
295-
5. Press `Tab` to switch to AI pane
296-
6. Ask the AI for help with your code
297-
7. Press `Tab` to return to editor
298-
8. Press `Ctrl+R` to execute your script
299-
300366
## Building
301367

302368
### Build for Current Platform
@@ -324,53 +390,8 @@ make windows # Build for Windows
324390
make darwin # Build for macOS
325391
```
326392

327-
## Testing
328-
329-
### Run All Tests
330-
331-
```bash
332-
make test
333-
```
334-
335-
### Run Specific Test Suites
336-
337-
```bash
338-
make test-unit # Unit tests only
339-
make test-property # Property-based tests only
340-
make test-integration # Integration tests only
341-
```
342-
343-
### Test Coverage
344-
345-
```bash
346-
make test-coverage
347-
```
348-
349393
This generates a coverage report in `coverage.html`.
350394

351-
## Project Structure
352-
353-
```
354-
terminal-intelligence/
355-
├── internal/
356-
│ ├── types/ # Core data structures and types
357-
│ ├── filemanager/ # File system operations
358-
│ ├── executor/ # Command and script execution
359-
│ ├── ollama/ # Ollama AI client
360-
│ └── ui/ # Bubble Tea UI components
361-
│ ├── app.go # Main application
362-
│ ├── editor.go # Editor pane
363-
│ └── aichat.go # AI chat pane
364-
├── tests/
365-
│ ├── unit/ # Unit tests for specific examples
366-
│ ├── property/ # Property-based tests with gopter
367-
│ └── integration/ # End-to-end integration tests
368-
├── main.go # Application entry point
369-
├── Makefile # Build automation
370-
├── go.mod # Go module definition
371-
└── README.md # This file
372-
```
373-
374395
## Architecture
375396

376397
The application follows a clean architecture with clear separation of concerns:
@@ -388,23 +409,6 @@ The application follows a clean architecture with clear separation of concerns:
388409
- **CommandExecutor**: Executes system commands and scripts
389410
- **OllamaClient**: Communicates with Ollama service via REST API
390411

391-
## Testing Strategy
392-
393-
The project uses a dual testing approach:
394-
395-
- **Unit Tests**: Verify specific examples, edge cases, and error conditions
396-
- **Property-Based Tests**: Verify universal properties across all inputs using gopter
397-
- **Integration Tests**: Verify complete user workflows
398-
399-
### Test Coverage
400-
401-
- File operations (create, read, write, delete)
402-
- Command execution (stdout, stderr, exit codes)
403-
- AI integration (message history, context inclusion)
404-
- UI components (editor, AI pane, split-window layout)
405-
- Keyboard controls (shortcuts, focus management)
406-
- Session management (unsaved changes, exit confirmation)
407-
408412
## Configuration
409413

410414
The application can be configured via:

internal/git/README.md

Lines changed: 79 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,96 @@
22

33
This package provides Git functionality for the Terminal Intelligence IDE using the go-git library.
44

5+
## Overview
6+
7+
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.
8+
59
## Components
610

7-
- `client.go` - GitClient for Git operations (clone, pull, push, fetch, stage, status, restore)
11+
- `client.go` - GitClient for Git operations (clone, pull, push, fetch, stage, commit, status, restore)
812
- `credentials.go` - CredentialStore for secure credential management
9-
- Additional components will be added as implementation progresses
13+
14+
## Features
15+
16+
### Git Operations
17+
18+
**Remote Operations**
19+
- **Clone**: Clone repositories from remote URLs with authentication support
20+
- **Pull**: Fetch and merge changes from remote repository
21+
- **Fetch**: Download changes from remote without merging
22+
23+
**Local to Remote Workflow**
24+
- **Stage**: Stage all modified and untracked files for commit
25+
- **Commit**: Create commits with custom messages (validates non-empty messages)
26+
- **Push**: Push local commits to remote repository with authentication
27+
28+
**Info and Undo**
29+
- **Status**: Display repository status (modified, staged, untracked files)
30+
- **Restore**: Discard uncommitted changes and restore to last commit
31+
32+
### Authentication
33+
34+
- GitHub Personal Access Tokens (ghp_...)
35+
- Username/Password authentication
36+
- Automatic credential detection from `.git/config`
37+
- Secure credential storage in repository configuration
38+
39+
### Repository Detection
40+
41+
- Automatically detects if current directory is a Git repository
42+
- Loads stored credentials from existing repositories
43+
- Populates remote URL from repository configuration
44+
45+
## User Interface
46+
47+
The Git panel (`internal/ui/gitpane.go`) provides:
48+
- Three input fields: URL, Username, Password/Token
49+
- Eight operation buttons organized into logical groups
50+
- Dynamic commit message input (appears only when Commit is selected)
51+
- Real-time status and error messages
52+
- Keyboard-driven navigation
1053

1154
## Dependencies
1255

1356
- github.com/go-git/go-git/v5 - Pure Go Git implementation
14-
- github.com/leanovate/gopter - Property-based testing library
57+
- github.com/go-git/go-git/v5/plumbing/object - Git object types
58+
- github.com/go-git/go-git/v5/plumbing/transport/http - HTTP authentication
1559

1660
## Testing
1761

1862
Tests are organized in the following directories:
1963
- `tests/unit/git/` - Unit tests for individual components
2064
- `tests/property/git/` - Property-based tests for correctness properties
2165
- `tests/integration/git/` - Integration tests for end-to-end workflows
66+
67+
## Usage Example
68+
69+
```go
70+
// Create a Git client
71+
client := git.NewClient("/path/to/workspace")
72+
73+
// Clone a repository
74+
result, err := client.Clone("https://github.com/user/repo.git", "username", "token", "")
75+
76+
// Stage changes
77+
result, err = client.Stage()
78+
79+
// Commit with message
80+
result, err = client.Commit("Add new feature")
81+
82+
// Push to remote
83+
result, err = client.Push("username", "token")
84+
```
85+
86+
## Error Handling
87+
88+
All operations return `*OperationResult` with:
89+
- `Success`: Boolean indicating operation success
90+
- `Message`: Human-readable result message
91+
- `Error`: Detailed error information if operation failed
92+
93+
Errors are categorized for better user feedback:
94+
- Authentication errors
95+
- Network errors
96+
- Repository state errors
97+
- File system errors

0 commit comments

Comments
 (0)