clevergit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clevergit-0.1.0/LICENSE +21 -0
- clevergit-0.1.0/MANIFEST.in +7 -0
- clevergit-0.1.0/PKG-INFO +376 -0
- clevergit-0.1.0/README.MD +339 -0
- clevergit-0.1.0/clevergit/__init__.py +13 -0
- clevergit-0.1.0/clevergit/cli/__init__.py +1 -0
- clevergit-0.1.0/clevergit/cli/app.py +186 -0
- clevergit-0.1.0/clevergit/cli/branch_cmd.py +150 -0
- clevergit-0.1.0/clevergit/cli/commit_cmd.py +120 -0
- clevergit-0.1.0/clevergit/cli/remote_cmd.py +142 -0
- clevergit-0.1.0/clevergit/cli/repo_cmd.py +118 -0
- clevergit-0.1.0/clevergit/core/__init__.py +1 -0
- clevergit-0.1.0/clevergit/core/blame.py +180 -0
- clevergit-0.1.0/clevergit/core/branch.py +157 -0
- clevergit-0.1.0/clevergit/core/cherry_pick.py +145 -0
- clevergit-0.1.0/clevergit/core/commit.py +192 -0
- clevergit-0.1.0/clevergit/core/conflict.py +306 -0
- clevergit-0.1.0/clevergit/core/diff.py +567 -0
- clevergit-0.1.0/clevergit/core/git_flow.py +403 -0
- clevergit-0.1.0/clevergit/core/graph.py +199 -0
- clevergit-0.1.0/clevergit/core/log.py +294 -0
- clevergit-0.1.0/clevergit/core/merge.py +206 -0
- clevergit-0.1.0/clevergit/core/remote.py +294 -0
- clevergit-0.1.0/clevergit/core/repo.py +350 -0
- clevergit-0.1.0/clevergit/core/revert.py +145 -0
- clevergit-0.1.0/clevergit/core/stash.py +98 -0
- clevergit-0.1.0/clevergit/core/status.py +49 -0
- clevergit-0.1.0/clevergit/core/tag.py +204 -0
- clevergit-0.1.0/clevergit/git/__init__.py +1 -0
- clevergit-0.1.0/clevergit/git/client.py +1051 -0
- clevergit-0.1.0/clevergit/git/errors.py +96 -0
- clevergit-0.1.0/clevergit/integrations/__init__.py +15 -0
- clevergit-0.1.0/clevergit/integrations/github.py +419 -0
- clevergit-0.1.0/clevergit/integrations/gitlab.py +432 -0
- clevergit-0.1.0/clevergit/models/__init__.py +1 -0
- clevergit-0.1.0/clevergit/models/blame_info.py +43 -0
- clevergit-0.1.0/clevergit/models/branch_comparison.py +57 -0
- clevergit-0.1.0/clevergit/models/branch_info.py +69 -0
- clevergit-0.1.0/clevergit/models/commit_info.py +70 -0
- clevergit-0.1.0/clevergit/models/file_status.py +126 -0
- clevergit-0.1.0/clevergit/models/stash_info.py +51 -0
- clevergit-0.1.0/clevergit/models/tag_info.py +44 -0
- clevergit-0.1.0/clevergit/plugins/__init__.py +18 -0
- clevergit-0.1.0/clevergit/plugins/builtin/__init__.py +5 -0
- clevergit-0.1.0/clevergit/plugins/builtin/example_plugin.py +65 -0
- clevergit-0.1.0/clevergit/plugins/config.py +92 -0
- clevergit-0.1.0/clevergit/plugins/interface.py +126 -0
- clevergit-0.1.0/clevergit/plugins/loader.py +132 -0
- clevergit-0.1.0/clevergit/plugins/manager.py +239 -0
- clevergit-0.1.0/clevergit/ui/__init__.py +1 -0
- clevergit-0.1.0/clevergit/ui/main.py +49 -0
- clevergit-0.1.0/clevergit/ui/settings.py +224 -0
- clevergit-0.1.0/clevergit/ui/shortcuts.py +284 -0
- clevergit-0.1.0/clevergit/ui/themes/__init__.py +14 -0
- clevergit-0.1.0/clevergit/ui/themes/base.py +205 -0
- clevergit-0.1.0/clevergit/ui/themes/dark.py +53 -0
- clevergit-0.1.0/clevergit/ui/themes/light.py +53 -0
- clevergit-0.1.0/clevergit/ui/themes/manager.py +208 -0
- clevergit-0.1.0/clevergit/ui/widgets/__init__.py +11 -0
- clevergit-0.1.0/clevergit/ui/widgets/blame_view.py +190 -0
- clevergit-0.1.0/clevergit/ui/widgets/branch_compare_dialog.py +375 -0
- clevergit-0.1.0/clevergit/ui/widgets/branch_view.py +163 -0
- clevergit-0.1.0/clevergit/ui/widgets/cherry_pick_dialog.py +197 -0
- clevergit-0.1.0/clevergit/ui/widgets/clone_dialog.py +290 -0
- clevergit-0.1.0/clevergit/ui/widgets/command_palette.py +400 -0
- clevergit-0.1.0/clevergit/ui/widgets/commit_dialog.py +118 -0
- clevergit-0.1.0/clevergit/ui/widgets/diff_viewer.py +914 -0
- clevergit-0.1.0/clevergit/ui/widgets/git_flow_panel.py +637 -0
- clevergit-0.1.0/clevergit/ui/widgets/github_panel.py +583 -0
- clevergit-0.1.0/clevergit/ui/widgets/gitlab_panel.py +583 -0
- clevergit-0.1.0/clevergit/ui/widgets/graph_view.py +288 -0
- clevergit-0.1.0/clevergit/ui/widgets/log_view.py +49 -0
- clevergit-0.1.0/clevergit/ui/widgets/merge_tool.py +454 -0
- clevergit-0.1.0/clevergit/ui/widgets/repo_view.py +31 -0
- clevergit-0.1.0/clevergit/ui/widgets/repository_tab.py +290 -0
- clevergit-0.1.0/clevergit/ui/widgets/reset_dialog.py +329 -0
- clevergit-0.1.0/clevergit/ui/widgets/revert_dialog.py +197 -0
- clevergit-0.1.0/clevergit/ui/widgets/shortcuts_dialog.py +246 -0
- clevergit-0.1.0/clevergit/ui/widgets/stash_view.py +253 -0
- clevergit-0.1.0/clevergit/ui/widgets/status_view.py +62 -0
- clevergit-0.1.0/clevergit/ui/widgets/tag_view.py +260 -0
- clevergit-0.1.0/clevergit/ui/widgets/welcome_screen.py +57 -0
- clevergit-0.1.0/clevergit/ui/windows/__init__.py +3 -0
- clevergit-0.1.0/clevergit/ui/windows/main_window.py +1232 -0
- clevergit-0.1.0/clevergit/utils/__init__.py +1 -0
- clevergit-0.1.0/clevergit/utils/formatter.py +166 -0
- clevergit-0.1.0/clevergit/utils/helpers.py +228 -0
- clevergit-0.1.0/clevergit.egg-info/PKG-INFO +376 -0
- clevergit-0.1.0/clevergit.egg-info/SOURCES.txt +93 -0
- clevergit-0.1.0/clevergit.egg-info/dependency_links.txt +1 -0
- clevergit-0.1.0/clevergit.egg-info/entry_points.txt +3 -0
- clevergit-0.1.0/clevergit.egg-info/requires.txt +15 -0
- clevergit-0.1.0/clevergit.egg-info/top_level.txt +1 -0
- clevergit-0.1.0/pyproject.toml +74 -0
- clevergit-0.1.0/setup.cfg +4 -0
clevergit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 petertzy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
clevergit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clevergit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CleverGit-like Git client tool with high-level abstractions
|
|
5
|
+
Author: petertzy
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/petertzy/CleverGit
|
|
8
|
+
Project-URL: Repository, https://github.com/petertzy/CleverGit
|
|
9
|
+
Project-URL: Issues, https://github.com/petertzy/CleverGit/issues
|
|
10
|
+
Keywords: git,version-control,cli,gui,git-client
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: GitPython>=3.1.40
|
|
24
|
+
Requires-Dist: typer>=0.9.0
|
|
25
|
+
Requires-Dist: rich>=13.7.0
|
|
26
|
+
Requires-Dist: PySide6>=6.6.0
|
|
27
|
+
Requires-Dist: requests>=2.31.0
|
|
28
|
+
Provides-Extra: gui
|
|
29
|
+
Requires-Dist: PySide6>=6.6.0; extra == "gui"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy>=1.7.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# Project Documentation (CleverGit - Git Client, Python Implementation)
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
CleverGit provides **two ways to interact** with your Git repositories:
|
|
43
|
+
|
|
44
|
+
### 🖥️ **Graphical User Interface (GUI)**
|
|
45
|
+
|
|
46
|
+
Launch the GUI application for an intuitive, visual Git experience:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
sgg
|
|
50
|
+
# or
|
|
51
|
+
python -m clevergit.ui.main
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Features:**
|
|
55
|
+
- Point-and-click repository management
|
|
56
|
+
- Visual file status display
|
|
57
|
+
- Branch management with drag-and-drop
|
|
58
|
+
- Commit history viewer
|
|
59
|
+
- Dialog-based operations
|
|
60
|
+
- **Enhanced Diff Viewer** - Professional, SmartGit-inspired code difference presentation
|
|
61
|
+
- Softer color scheme for reduced eye strain
|
|
62
|
+
- Word-level highlighting to spot exact changes
|
|
63
|
+
- Improved visual spacing and separation
|
|
64
|
+
- Side-by-side and unified views
|
|
65
|
+
- **Command Palette** - Quick search and command execution (`Ctrl+P`)
|
|
66
|
+
- Search files, commits, and branches with fuzzy matching
|
|
67
|
+
- Execute commands without navigating menus
|
|
68
|
+
- Keyboard-driven workflow
|
|
69
|
+
|
|
70
|
+
👉 **For detailed GUI documentation, see [GUI_USAGE.md](GUI_USAGE.md)**
|
|
71
|
+
|
|
72
|
+
### 💻 **Command Line Interface (CLI)**
|
|
73
|
+
|
|
74
|
+
Use powerful command-line commands for scriptable Git operations:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# View repository status
|
|
78
|
+
sg status
|
|
79
|
+
|
|
80
|
+
# Commit all changes
|
|
81
|
+
sg commit all -m "feat: add new feature"
|
|
82
|
+
|
|
83
|
+
# View commit history
|
|
84
|
+
sg log --oneline
|
|
85
|
+
|
|
86
|
+
# Manage branches
|
|
87
|
+
sg branch list
|
|
88
|
+
sg branch new feature/auth
|
|
89
|
+
sg branch switch main
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Features:**
|
|
93
|
+
- Fast, efficient terminal-based workflow
|
|
94
|
+
- Scriptable operations
|
|
95
|
+
- Batch processing support
|
|
96
|
+
- Integration with other tools
|
|
97
|
+
|
|
98
|
+
### 🐍 **Python API**
|
|
99
|
+
|
|
100
|
+
Use CleverGit programmatically in your Python scripts:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from clevergit import Repo
|
|
104
|
+
|
|
105
|
+
# Open repository
|
|
106
|
+
repo = Repo.open(".")
|
|
107
|
+
|
|
108
|
+
# Check status
|
|
109
|
+
status = repo.status()
|
|
110
|
+
print(f"Modified files: {len(status.modified)}")
|
|
111
|
+
|
|
112
|
+
# Create commit
|
|
113
|
+
repo.commit_all("fix: resolve issue")
|
|
114
|
+
|
|
115
|
+
# Branch operations
|
|
116
|
+
repo.create_branch("feature/new")
|
|
117
|
+
repo.checkout("feature/new")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 📦 Installation
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Clone the repository
|
|
124
|
+
git clone https://github.com/petertzy/CleverGit.git
|
|
125
|
+
cd CleverGit
|
|
126
|
+
|
|
127
|
+
# Install with all features
|
|
128
|
+
pip install -e .
|
|
129
|
+
|
|
130
|
+
# Verify installation
|
|
131
|
+
sgg --version # GUI version check
|
|
132
|
+
sg --version # CLI version check
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 1. Project Background & Goals
|
|
138
|
+
|
|
139
|
+
This project aims to develop an advanced Git client tool **CleverGit** using **Python**, with focus on:
|
|
140
|
+
|
|
141
|
+
* Provide **more user-friendly, higher-level** Git operation abstractions
|
|
142
|
+
* Lower the learning curve for daily Git usage (especially complex commands)
|
|
143
|
+
* Support **CLI-first, GUI-extensible** architecture design
|
|
144
|
+
|
|
145
|
+
Target users:
|
|
146
|
+
|
|
147
|
+
* Developers familiar with Git basics but don't want to memorize commands frequently
|
|
148
|
+
* Users who want to operate Git in Python within scripts / toolchains
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 2. Design Principles
|
|
153
|
+
|
|
154
|
+
1. **High-level semantics, not command concatenation**
|
|
155
|
+
Example:
|
|
156
|
+
|
|
157
|
+
* `repo.commit_all("fix login bug")`
|
|
158
|
+
* Instead of `git commit -am "..."`
|
|
159
|
+
|
|
160
|
+
2. **Readability first**
|
|
161
|
+
Class names and method names should express "user intent" rather than Git details
|
|
162
|
+
|
|
163
|
+
3. **Modular & Extensible**
|
|
164
|
+
|
|
165
|
+
* Decouple CLI / GUI / API
|
|
166
|
+
* Can add TUI / Web UI later
|
|
167
|
+
|
|
168
|
+
4. **Failure is explainable**
|
|
169
|
+
|
|
170
|
+
* Convert Git errors to "human-readable" exception messages
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 3. Technology Stack
|
|
175
|
+
|
|
176
|
+
* Python >= 3.10
|
|
177
|
+
* Git calling methods:
|
|
178
|
+
|
|
179
|
+
* Preferred: `GitPython`
|
|
180
|
+
* Fallback: `subprocess` (for scenarios GitPython doesn't support)
|
|
181
|
+
* CLI framework:
|
|
182
|
+
|
|
183
|
+
* `typer` (recommended, type-friendly)
|
|
184
|
+
* GUI (future):
|
|
185
|
+
|
|
186
|
+
* `PySide6` or `Tkinter`
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 4. Core Feature Planning
|
|
191
|
+
|
|
192
|
+
### 4.1 Repository Management
|
|
193
|
+
|
|
194
|
+
* Open / Initialize repository
|
|
195
|
+
* Detect repository status
|
|
196
|
+
* Current branch, HEAD status
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
✔ Is it a Git repository
|
|
200
|
+
✔ Are there uncommitted changes
|
|
201
|
+
✔ Is it behind / ahead of remote branch
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### 4.2 Status View
|
|
207
|
+
|
|
208
|
+
* Modified files
|
|
209
|
+
* Untracked files
|
|
210
|
+
* Staged files
|
|
211
|
+
* Conflicted files
|
|
212
|
+
|
|
213
|
+
Support:
|
|
214
|
+
|
|
215
|
+
* Group by file type
|
|
216
|
+
* Output as structured objects for UI use
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### 4.3 Commit
|
|
221
|
+
|
|
222
|
+
* Commit all changes
|
|
223
|
+
* Selective commit (specific files)
|
|
224
|
+
* Auto-generate commit message (optional)
|
|
225
|
+
* Pre-commit checks (lint / test hooks)
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
### 4.4 Branch Management
|
|
230
|
+
|
|
231
|
+
* List branches (local / remote)
|
|
232
|
+
* Create / Delete / Rename branches
|
|
233
|
+
* Switch branches
|
|
234
|
+
* Display branch relationships (simple DAG)
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### 4.5 Merge & Rebase (High-level Wrapper)
|
|
239
|
+
|
|
240
|
+
* Safe merge (detect conflicts)
|
|
241
|
+
* Interactive rebase workflow (step-by-step)
|
|
242
|
+
* Conflict file list + hints
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### 4.6 Remote Repository Operations
|
|
247
|
+
|
|
248
|
+
* fetch / pull / push
|
|
249
|
+
* Show commits to be pushed / pulled
|
|
250
|
+
* force push risk warning
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### 4.7 History (Log)
|
|
255
|
+
|
|
256
|
+
* Concise log view (like `git log --oneline --graph`)
|
|
257
|
+
* Filter by author / time / branch
|
|
258
|
+
* Single commit details
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 5. Project File Structure (Recommended)
|
|
263
|
+
|
|
264
|
+
```text
|
|
265
|
+
clevergit/
|
|
266
|
+
├── README.md
|
|
267
|
+
├── pyproject.toml
|
|
268
|
+
├── clevergit/
|
|
269
|
+
│ ├── __init__.py
|
|
270
|
+
│ ├── core/ # Core Git logic
|
|
271
|
+
│ │ ├── repo.py # Repository object (core entry point)
|
|
272
|
+
│ │ ├── status.py # Status analysis
|
|
273
|
+
│ │ ├── commit.py # Commit logic
|
|
274
|
+
│ │ ├── branch.py # Branch management
|
|
275
|
+
│ │ ├── merge.py # merge / rebase
|
|
276
|
+
│ │ ├── remote.py # fetch / pull / push
|
|
277
|
+
│ │ └── log.py # History records
|
|
278
|
+
│ │
|
|
279
|
+
│ ├── git/ # Git adapter layer
|
|
280
|
+
│ │ ├── client.py # GitPython / subprocess wrapper
|
|
281
|
+
│ │ └── errors.py # Git errors → business exceptions
|
|
282
|
+
│ │
|
|
283
|
+
│ ├── cli/ # CLI layer
|
|
284
|
+
│ │ ├── app.py # Typer entry point
|
|
285
|
+
│ │ ├── repo_cmd.py
|
|
286
|
+
│ │ ├── commit_cmd.py
|
|
287
|
+
│ │ └── branch_cmd.py
|
|
288
|
+
│ │
|
|
289
|
+
│ ├── ui/ # GUI / TUI (reserved)
|
|
290
|
+
│ │ └── __init__.py
|
|
291
|
+
│ │
|
|
292
|
+
│ ├── models/ # Domain models (DTO)
|
|
293
|
+
│ │ ├── file_status.py
|
|
294
|
+
│ │ ├── commit_info.py
|
|
295
|
+
│ │ └── branch_info.py
|
|
296
|
+
│ │
|
|
297
|
+
│ └── utils/
|
|
298
|
+
│ ├── formatter.py # Output formatting
|
|
299
|
+
│ └── helpers.py
|
|
300
|
+
│
|
|
301
|
+
└── tests/
|
|
302
|
+
├── test_repo.py
|
|
303
|
+
├── test_status.py
|
|
304
|
+
└── test_commit.py
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 6. Core Object Design Example
|
|
310
|
+
|
|
311
|
+
### Repo (Core Entry Point)
|
|
312
|
+
|
|
313
|
+
```python
|
|
314
|
+
repo = Repo.open(".")
|
|
315
|
+
|
|
316
|
+
repo.status()
|
|
317
|
+
repo.commit_all("fix: login bug")
|
|
318
|
+
repo.create_branch("feature/auth")
|
|
319
|
+
repo.checkout("feature/auth")
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Design goals:
|
|
323
|
+
|
|
324
|
+
* **One Repo object = One Git repository**
|
|
325
|
+
* Most features start from here
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 7. CLI Design Example
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
sg status
|
|
333
|
+
sg commit -m "fix bug"
|
|
334
|
+
sg branch new feature/auth
|
|
335
|
+
sg branch switch main
|
|
336
|
+
sg log --oneline
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
CLI principles:
|
|
340
|
+
|
|
341
|
+
* Short commands
|
|
342
|
+
* Don't require users to understand Git detail parameters
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## 8. Error Handling Strategy
|
|
347
|
+
|
|
348
|
+
* Git raw errors → Custom exceptions
|
|
349
|
+
* CLI layer catches exceptions → User-friendly hints
|
|
350
|
+
|
|
351
|
+
Example:
|
|
352
|
+
|
|
353
|
+
```text
|
|
354
|
+
❌ Current branch has uncommitted changes, cannot switch branches
|
|
355
|
+
Suggestions:
|
|
356
|
+
- Commit changes
|
|
357
|
+
- Or use sg stash
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## 9. Future Expansion Directions
|
|
363
|
+
|
|
364
|
+
* GUI (graphical interface)
|
|
365
|
+
* AI assistance:
|
|
366
|
+
|
|
367
|
+
* Auto-generate commit messages
|
|
368
|
+
* Conflict resolution suggestions
|
|
369
|
+
* Plugin system (hooks)
|
|
370
|
+
* Git Flow / Trunk Based workflow support
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## 10. One-Sentence Project Summary
|
|
375
|
+
|
|
376
|
+
> Wrap Git's "intent layer" in Python, make Git usable like objects, not remembered like incantations.
|